@e-llm-studio/instant-learning 1.3.0-alpha.277 → 1.3.0-alpha.278

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 (1000) hide show
  1. package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
  2. package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
  3. package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/cjs/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js +0 -2
  6. package/dist/cjs/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js.map +0 -1
  7. package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +0 -2
  8. package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +0 -1
  9. package/dist/cjs/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js +0 -2
  10. package/dist/cjs/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js.map +0 -1
  11. package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.js +0 -2
  12. package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.js.map +0 -1
  13. package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.styles.js +0 -2
  14. package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.styles.js.map +0 -1
  15. package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.js +0 -2
  16. package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.js.map +0 -1
  17. package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.styles.js +0 -2
  18. package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.styles.js.map +0 -1
  19. package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.js +0 -2
  20. package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.js.map +0 -1
  21. package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js +0 -2
  22. package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js.map +0 -1
  23. package/dist/cjs/features/LSCGuidelinesCart/LearningManagementWrapper.js +0 -2
  24. package/dist/cjs/features/LSCGuidelinesCart/LearningManagementWrapper.js.map +0 -1
  25. package/dist/cjs/features/LSCGuidelinesCart/api.js +0 -2
  26. package/dist/cjs/features/LSCGuidelinesCart/api.js.map +0 -1
  27. package/dist/cjs/features/LSCGuidelinesCart/endpoints.js +0 -2
  28. package/dist/cjs/features/LSCGuidelinesCart/endpoints.js.map +0 -1
  29. package/dist/cjs/features/LSCGuidelinesCart/transformSelectedGuidelineData.js +0 -2
  30. package/dist/cjs/features/LSCGuidelinesCart/transformSelectedGuidelineData.js.map +0 -1
  31. package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js +0 -2
  32. package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js.map +0 -1
  33. package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +0 -2
  34. package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +0 -1
  35. package/dist/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js +0 -2
  36. package/dist/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js.map +0 -1
  37. package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +0 -2
  38. package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +0 -1
  39. package/dist/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js +0 -2
  40. package/dist/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js.map +0 -1
  41. package/dist/features/LSCGuidelinesCart/Cart/Cart.js +0 -2
  42. package/dist/features/LSCGuidelinesCart/Cart/Cart.js.map +0 -1
  43. package/dist/features/LSCGuidelinesCart/Cart/Cart.styles.js +0 -2
  44. package/dist/features/LSCGuidelinesCart/Cart/Cart.styles.js.map +0 -1
  45. package/dist/features/LSCGuidelinesCart/GuidelineCard.js +0 -2
  46. package/dist/features/LSCGuidelinesCart/GuidelineCard.js.map +0 -1
  47. package/dist/features/LSCGuidelinesCart/GuidelineCard.styles.js +0 -2
  48. package/dist/features/LSCGuidelinesCart/GuidelineCard.styles.js.map +0 -1
  49. package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.js +0 -2
  50. package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.js.map +0 -1
  51. package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js +0 -2
  52. package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js.map +0 -1
  53. package/dist/features/LSCGuidelinesCart/LearningManagementWrapper.js +0 -2
  54. package/dist/features/LSCGuidelinesCart/LearningManagementWrapper.js.map +0 -1
  55. package/dist/features/LSCGuidelinesCart/api.js +0 -2
  56. package/dist/features/LSCGuidelinesCart/api.js.map +0 -1
  57. package/dist/features/LSCGuidelinesCart/endpoints.js +0 -2
  58. package/dist/features/LSCGuidelinesCart/endpoints.js.map +0 -1
  59. package/dist/features/LSCGuidelinesCart/transformSelectedGuidelineData.js +0 -2
  60. package/dist/features/LSCGuidelinesCart/transformSelectedGuidelineData.js.map +0 -1
  61. package/dist/features/LearningManagement/components/CreateLearningSetModal.js +0 -2
  62. package/dist/features/LearningManagement/components/CreateLearningSetModal.js.map +0 -1
  63. package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +0 -2
  64. package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +0 -1
  65. package/dist/types/AccordianHeadTest.d.ts +0 -3
  66. package/dist/types/AccordianHeadTest.d.ts.map +0 -1
  67. package/dist/types/App.d.ts +0 -4
  68. package/dist/types/App.d.ts.map +0 -1
  69. package/dist/types/CommonComponents/AccordianHead/AccordianHead.d.ts +0 -9
  70. package/dist/types/CommonComponents/AccordianHead/AccordianHead.d.ts.map +0 -1
  71. package/dist/types/CommonComponents/CustomDropdown.d.ts +0 -4
  72. package/dist/types/CommonComponents/CustomDropdown.d.ts.map +0 -1
  73. package/dist/types/CommonComponents/GradientSparkleIcon.d.ts +0 -6
  74. package/dist/types/CommonComponents/GradientSparkleIcon.d.ts.map +0 -1
  75. package/dist/types/CommonComponents/HelloWorld.d.ts +0 -3
  76. package/dist/types/CommonComponents/HelloWorld.d.ts.map +0 -1
  77. package/dist/types/CommonComponents/NoTableData.d.ts +0 -7
  78. package/dist/types/CommonComponents/NoTableData.d.ts.map +0 -1
  79. package/dist/types/CommonComponents/Spinner.d.ts +0 -5
  80. package/dist/types/CommonComponents/Spinner.d.ts.map +0 -1
  81. package/dist/types/CommonConstants/CommonConstants.d.ts +0 -5
  82. package/dist/types/CommonConstants/CommonConstants.d.ts.map +0 -1
  83. package/dist/types/ComponentRegistry.d.ts +0 -13
  84. package/dist/types/ComponentRegistry.d.ts.map +0 -1
  85. package/dist/types/ContinueWithTemplateModal.d.ts +0 -24
  86. package/dist/types/ContinueWithTemplateModal.d.ts.map +0 -1
  87. package/dist/types/CustomStylesProvider.d.ts +0 -6
  88. package/dist/types/CustomStylesProvider.d.ts.map +0 -1
  89. package/dist/types/CustomThemeProvider.d.ts +0 -7
  90. package/dist/types/CustomThemeProvider.d.ts.map +0 -1
  91. package/dist/types/GoogleFilePickerDemo.d.ts +0 -3
  92. package/dist/types/GoogleFilePickerDemo.d.ts.map +0 -1
  93. package/dist/types/ILMarketplaceMockTest.d.ts +0 -4
  94. package/dist/types/ILMarketplaceMockTest.d.ts.map +0 -1
  95. package/dist/types/ILMarketplaceWrapper.d.ts +0 -174
  96. package/dist/types/ILMarketplaceWrapper.d.ts.map +0 -1
  97. package/dist/types/PublishToMarketplaceTest.d.ts +0 -4
  98. package/dist/types/PublishToMarketplaceTest.d.ts.map +0 -1
  99. package/dist/types/api/transport.d.ts +0 -44
  100. package/dist/types/api/transport.d.ts.map +0 -1
  101. package/dist/types/context/DataSelectedContext.d.ts +0 -73
  102. package/dist/types/context/DataSelectedContext.d.ts.map +0 -1
  103. package/dist/types/features/DataSelector/DataSelector.d.ts +0 -18
  104. package/dist/types/features/DataSelector/DataSelector.d.ts.map +0 -1
  105. package/dist/types/features/DataSelector/components/DataSelectionOptionsScreen.d.ts +0 -4
  106. package/dist/types/features/DataSelector/components/DataSelectionOptionsScreen.d.ts.map +0 -1
  107. package/dist/types/features/DataSelector/components/RLEFDataPointsListInSelectedDataSetCollection.d.ts +0 -4
  108. package/dist/types/features/DataSelector/components/RLEFDataPointsListInSelectedDataSetCollection.d.ts.map +0 -1
  109. package/dist/types/features/DataSelector/components/RLEFDataSetCollectionsList.d.ts +0 -4
  110. package/dist/types/features/DataSelector/components/RLEFDataSetCollectionsList.d.ts.map +0 -1
  111. package/dist/types/features/DataSelector/components/RlefDataTabsComponent.d.ts +0 -4
  112. package/dist/types/features/DataSelector/components/RlefDataTabsComponent.d.ts.map +0 -1
  113. package/dist/types/features/DataSelector/components/RlefHistoricalCopilotData.d.ts +0 -4
  114. package/dist/types/features/DataSelector/components/RlefHistoricalCopilotData.d.ts.map +0 -1
  115. package/dist/types/features/DataSelector/components/SavedDataSetListScreen.d.ts +0 -14
  116. package/dist/types/features/DataSelector/components/SavedDataSetListScreen.d.ts.map +0 -1
  117. package/dist/types/features/DataSelector/components/SelectedDataList.d.ts +0 -4
  118. package/dist/types/features/DataSelector/components/SelectedDataList.d.ts.map +0 -1
  119. package/dist/types/features/DataSelector/components/subcomponents/DataSetElement/DataSetElement.d.ts +0 -11
  120. package/dist/types/features/DataSelector/components/subcomponents/DataSetElement/DataSetElement.d.ts.map +0 -1
  121. package/dist/types/features/DataSelector/components/subcomponents/Pagination/Pagination.d.ts +0 -8
  122. package/dist/types/features/DataSelector/components/subcomponents/Pagination/Pagination.d.ts.map +0 -1
  123. package/dist/types/features/DataSelector/tables/ShowSelectedDataTable.d.ts +0 -4
  124. package/dist/types/features/DataSelector/tables/ShowSelectedDataTable.d.ts.map +0 -1
  125. package/dist/types/features/DocumentLearning/DocumentLearning.d.ts +0 -21
  126. package/dist/types/features/DocumentLearning/DocumentLearning.d.ts.map +0 -1
  127. package/dist/types/features/DocumentLearning/_components/AudioWaveform.d.ts +0 -13
  128. package/dist/types/features/DocumentLearning/_components/AudioWaveform.d.ts.map +0 -1
  129. package/dist/types/features/DocumentLearning/_components/BookLearningForm.d.ts +0 -23
  130. package/dist/types/features/DocumentLearning/_components/BookLearningForm.d.ts.map +0 -1
  131. package/dist/types/features/DocumentLearning/_components/ChatComponent.d.ts +0 -61
  132. package/dist/types/features/DocumentLearning/_components/ChatComponent.d.ts.map +0 -1
  133. package/dist/types/features/DocumentLearning/_components/ConflictingLearningWarnCard.d.ts +0 -13
  134. package/dist/types/features/DocumentLearning/_components/ConflictingLearningWarnCard.d.ts.map +0 -1
  135. package/dist/types/features/DocumentLearning/_components/ConflictingLearningWarnCardDB.d.ts +0 -41
  136. package/dist/types/features/DocumentLearning/_components/ConflictingLearningWarnCardDB.d.ts.map +0 -1
  137. package/dist/types/features/DocumentLearning/_components/ContextualChatComponent.d.ts +0 -62
  138. package/dist/types/features/DocumentLearning/_components/ContextualChatComponent.d.ts.map +0 -1
  139. package/dist/types/features/DocumentLearning/_components/ContextualConflictDBCard.d.ts +0 -30
  140. package/dist/types/features/DocumentLearning/_components/ContextualConflictDBCard.d.ts.map +0 -1
  141. package/dist/types/features/DocumentLearning/_components/ContextualLearningForm.d.ts +0 -1
  142. package/dist/types/features/DocumentLearning/_components/ContextualLearningForm.d.ts.map +0 -1
  143. package/dist/types/features/DocumentLearning/_components/LearningDetailsForm.d.ts +0 -71
  144. package/dist/types/features/DocumentLearning/_components/LearningDetailsForm.d.ts.map +0 -1
  145. package/dist/types/features/DocumentLearning/_components/MessageRendering.d.ts +0 -10
  146. package/dist/types/features/DocumentLearning/_components/MessageRendering.d.ts.map +0 -1
  147. package/dist/types/features/DocumentLearning/_components/MinimizedThinkingSteps.d.ts +0 -4
  148. package/dist/types/features/DocumentLearning/_components/MinimizedThinkingSteps.d.ts.map +0 -1
  149. package/dist/types/features/DocumentLearning/_components/SimilarLearningCard.d.ts +0 -20
  150. package/dist/types/features/DocumentLearning/_components/SimilarLearningCard.d.ts.map +0 -1
  151. package/dist/types/features/DocumentLearning/_components/TemplateRetrievalForm.d.ts +0 -50
  152. package/dist/types/features/DocumentLearning/_components/TemplateRetrievalForm.d.ts.map +0 -1
  153. package/dist/types/features/DocumentLearning/_components/TooltipComponent.d.ts +0 -8
  154. package/dist/types/features/DocumentLearning/_components/TooltipComponent.d.ts.map +0 -1
  155. package/dist/types/features/DocumentLearning/_components/_svg/ArrowDown.d.ts +0 -4
  156. package/dist/types/features/DocumentLearning/_components/_svg/ArrowDown.d.ts.map +0 -1
  157. package/dist/types/features/DocumentLearning/_components/_svg/ArrowIconBlue.d.ts +0 -4
  158. package/dist/types/features/DocumentLearning/_components/_svg/ArrowIconBlue.d.ts.map +0 -1
  159. package/dist/types/features/DocumentLearning/_components/_svg/CompleteIconGreen.d.ts +0 -4
  160. package/dist/types/features/DocumentLearning/_components/_svg/CompleteIconGreen.d.ts.map +0 -1
  161. package/dist/types/features/DocumentLearning/_components/_svg/NewChatIcon.d.ts +0 -4
  162. package/dist/types/features/DocumentLearning/_components/_svg/NewChatIcon.d.ts.map +0 -1
  163. package/dist/types/features/IL-OTJ/ILOTJ.d.ts +0 -95
  164. package/dist/types/features/IL-OTJ/ILOTJ.d.ts.map +0 -1
  165. package/dist/types/features/IL-OTJ/ILOTJTest.d.ts +0 -609
  166. package/dist/types/features/IL-OTJ/ILOTJTest.d.ts.map +0 -1
  167. package/dist/types/features/IL-OTJ/ILOTJTriageAITest.d.ts +0 -12
  168. package/dist/types/features/IL-OTJ/ILOTJTriageAITest.d.ts.map +0 -1
  169. package/dist/types/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts +0 -102
  170. package/dist/types/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +0 -1
  171. package/dist/types/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts +0 -33
  172. package/dist/types/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +0 -1
  173. package/dist/types/features/IL-OTJ/_components/AccordianSection.d.ts +0 -52
  174. package/dist/types/features/IL-OTJ/_components/AccordianSection.d.ts.map +0 -1
  175. package/dist/types/features/IL-OTJ/_components/AudioWaveform.d.ts +0 -13
  176. package/dist/types/features/IL-OTJ/_components/AudioWaveform.d.ts.map +0 -1
  177. package/dist/types/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts +0 -59
  178. package/dist/types/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +0 -1
  179. package/dist/types/features/IL-OTJ/_components/ChatComponents/ChatHeader.d.ts +0 -12
  180. package/dist/types/features/IL-OTJ/_components/ChatComponents/ChatHeader.d.ts.map +0 -1
  181. package/dist/types/features/IL-OTJ/_components/ChatComponents/NormalChat.d.ts +0 -45
  182. package/dist/types/features/IL-OTJ/_components/ChatComponents/NormalChat.d.ts.map +0 -1
  183. package/dist/types/features/IL-OTJ/_components/ChatComponents/mockComparisonData.d.ts +0 -1503
  184. package/dist/types/features/IL-OTJ/_components/ChatComponents/mockComparisonData.d.ts.map +0 -1
  185. package/dist/types/features/IL-OTJ/_components/CitationLink.d.ts +0 -18
  186. package/dist/types/features/IL-OTJ/_components/CitationLink.d.ts.map +0 -1
  187. package/dist/types/features/IL-OTJ/_components/CognitiveDecisioningCard.d.ts +0 -11
  188. package/dist/types/features/IL-OTJ/_components/CognitiveDecisioningCard.d.ts.map +0 -1
  189. package/dist/types/features/IL-OTJ/_components/ConflictingReasoningCard.d.ts +0 -11
  190. package/dist/types/features/IL-OTJ/_components/ConflictingReasoningCard.d.ts.map +0 -1
  191. package/dist/types/features/IL-OTJ/_components/CriticalGaps.d.ts +0 -11
  192. package/dist/types/features/IL-OTJ/_components/CriticalGaps.d.ts.map +0 -1
  193. package/dist/types/features/IL-OTJ/_components/GapExplanationAccordion.d.ts +0 -10
  194. package/dist/types/features/IL-OTJ/_components/GapExplanationAccordion.d.ts.map +0 -1
  195. package/dist/types/features/IL-OTJ/_components/ILPopup.d.ts +0 -33
  196. package/dist/types/features/IL-OTJ/_components/ILPopup.d.ts.map +0 -1
  197. package/dist/types/features/IL-OTJ/_components/ILPopup.styles.d.ts +0 -2
  198. package/dist/types/features/IL-OTJ/_components/ILPopup.styles.d.ts.map +0 -1
  199. package/dist/types/features/IL-OTJ/_components/InputDataReasoningCard.d.ts +0 -11
  200. package/dist/types/features/IL-OTJ/_components/InputDataReasoningCard.d.ts.map +0 -1
  201. package/dist/types/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts +0 -33
  202. package/dist/types/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts.map +0 -1
  203. package/dist/types/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.d.ts +0 -26
  204. package/dist/types/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.d.ts.map +0 -1
  205. package/dist/types/features/IL-OTJ/_components/MarkdownRenderer.d.ts +0 -25
  206. package/dist/types/features/IL-OTJ/_components/MarkdownRenderer.d.ts.map +0 -1
  207. package/dist/types/features/IL-OTJ/_components/MessageRendering/ChatFeedback.d.ts +0 -26
  208. package/dist/types/features/IL-OTJ/_components/MessageRendering/ChatFeedback.d.ts.map +0 -1
  209. package/dist/types/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.d.ts +0 -8
  210. package/dist/types/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.d.ts.map +0 -1
  211. package/dist/types/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts +0 -35
  212. package/dist/types/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map +0 -1
  213. package/dist/types/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.d.ts +0 -24
  214. package/dist/types/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.d.ts.map +0 -1
  215. package/dist/types/features/IL-OTJ/_components/MessageRendering/RuleVariantCard.d.ts +0 -17
  216. package/dist/types/features/IL-OTJ/_components/MessageRendering/RuleVariantCard.d.ts.map +0 -1
  217. package/dist/types/features/IL-OTJ/_components/MinimizedThinkingSteps.d.ts +0 -4
  218. package/dist/types/features/IL-OTJ/_components/MinimizedThinkingSteps.d.ts.map +0 -1
  219. package/dist/types/features/IL-OTJ/_components/NewMinimizedThinkingSteps.d.ts +0 -7
  220. package/dist/types/features/IL-OTJ/_components/NewMinimizedThinkingSteps.d.ts.map +0 -1
  221. package/dist/types/features/IL-OTJ/_components/TooltipComponent.d.ts +0 -8
  222. package/dist/types/features/IL-OTJ/_components/TooltipComponent.d.ts.map +0 -1
  223. package/dist/types/features/IL-OTJ/_components/VariantLoadingOverlay.d.ts +0 -9
  224. package/dist/types/features/IL-OTJ/_components/VariantLoadingOverlay.d.ts.map +0 -1
  225. package/dist/types/features/IL-OTJ/_components/ViewFormUpdateCard.d.ts +0 -3
  226. package/dist/types/features/IL-OTJ/_components/ViewFormUpdateCard.d.ts.map +0 -1
  227. package/dist/types/features/IL-OTJ/_components/ViewIdentifiedFieldsCard.d.ts +0 -3
  228. package/dist/types/features/IL-OTJ/_components/ViewIdentifiedFieldsCard.d.ts.map +0 -1
  229. package/dist/types/features/IL-OTJ/_components/WatchMeWork/AgentStepsView.d.ts +0 -16
  230. package/dist/types/features/IL-OTJ/_components/WatchMeWork/AgentStepsView.d.ts.map +0 -1
  231. package/dist/types/features/IL-OTJ/_components/WatchMeWork/StepDetailView.d.ts +0 -11
  232. package/dist/types/features/IL-OTJ/_components/WatchMeWork/StepDetailView.d.ts.map +0 -1
  233. package/dist/types/features/IL-OTJ/_components/WatchMeWork/Thinkingstepshelper.d.ts +0 -43
  234. package/dist/types/features/IL-OTJ/_components/WatchMeWork/Thinkingstepshelper.d.ts.map +0 -1
  235. package/dist/types/features/IL-OTJ/_components/WatchMeWork/Usethinkingsteps.d.ts +0 -27
  236. package/dist/types/features/IL-OTJ/_components/WatchMeWork/Usethinkingsteps.d.ts.map +0 -1
  237. package/dist/types/features/IL-OTJ/_components/WatchMeWork/WorkingIndicator.d.ts +0 -7
  238. package/dist/types/features/IL-OTJ/_components/WatchMeWork/WorkingIndicator.d.ts.map +0 -1
  239. package/dist/types/features/IL-OTJ/_components/_svg/ArrowDown.d.ts +0 -4
  240. package/dist/types/features/IL-OTJ/_components/_svg/ArrowDown.d.ts.map +0 -1
  241. package/dist/types/features/IL-OTJ/_components/_svg/ArrowIconBlue.d.ts +0 -4
  242. package/dist/types/features/IL-OTJ/_components/_svg/ArrowIconBlue.d.ts.map +0 -1
  243. package/dist/types/features/IL-OTJ/_components/_svg/BookIcon.d.ts +0 -4
  244. package/dist/types/features/IL-OTJ/_components/_svg/BookIcon.d.ts.map +0 -1
  245. package/dist/types/features/IL-OTJ/_components/_svg/ButtonCognitiveIcon.d.ts +0 -7
  246. package/dist/types/features/IL-OTJ/_components/_svg/ButtonCognitiveIcon.d.ts.map +0 -1
  247. package/dist/types/features/IL-OTJ/_components/_svg/ChevronDown.d.ts +0 -4
  248. package/dist/types/features/IL-OTJ/_components/_svg/ChevronDown.d.ts.map +0 -1
  249. package/dist/types/features/IL-OTJ/_components/_svg/ChevronIcon.d.ts +0 -7
  250. package/dist/types/features/IL-OTJ/_components/_svg/ChevronIcon.d.ts.map +0 -1
  251. package/dist/types/features/IL-OTJ/_components/_svg/ChevronUp.d.ts +0 -4
  252. package/dist/types/features/IL-OTJ/_components/_svg/ChevronUp.d.ts.map +0 -1
  253. package/dist/types/features/IL-OTJ/_components/_svg/CitationLinkSparkleIcon.d.ts +0 -10
  254. package/dist/types/features/IL-OTJ/_components/_svg/CitationLinkSparkleIcon.d.ts.map +0 -1
  255. package/dist/types/features/IL-OTJ/_components/_svg/CognitiveDecisioning.d.ts +0 -4
  256. package/dist/types/features/IL-OTJ/_components/_svg/CognitiveDecisioning.d.ts.map +0 -1
  257. package/dist/types/features/IL-OTJ/_components/_svg/CompleteIconGreen.d.ts +0 -4
  258. package/dist/types/features/IL-OTJ/_components/_svg/CompleteIconGreen.d.ts.map +0 -1
  259. package/dist/types/features/IL-OTJ/_components/_svg/EditPencilIcon.d.ts +0 -7
  260. package/dist/types/features/IL-OTJ/_components/_svg/EditPencilIcon.d.ts.map +0 -1
  261. package/dist/types/features/IL-OTJ/_components/_svg/GapIcon.d.ts +0 -10
  262. package/dist/types/features/IL-OTJ/_components/_svg/GapIcon.d.ts.map +0 -1
  263. package/dist/types/features/IL-OTJ/_components/_svg/HumanWithBrainIcon.d.ts +0 -9
  264. package/dist/types/features/IL-OTJ/_components/_svg/HumanWithBrainIcon.d.ts.map +0 -1
  265. package/dist/types/features/IL-OTJ/_components/_svg/InfoIcon.d.ts +0 -4
  266. package/dist/types/features/IL-OTJ/_components/_svg/InfoIcon.d.ts.map +0 -1
  267. package/dist/types/features/IL-OTJ/_components/_svg/LeftAndRightArrow.d.ts +0 -4
  268. package/dist/types/features/IL-OTJ/_components/_svg/LeftAndRightArrow.d.ts.map +0 -1
  269. package/dist/types/features/IL-OTJ/_components/_svg/Lightbulb.d.ts +0 -10
  270. package/dist/types/features/IL-OTJ/_components/_svg/Lightbulb.d.ts.map +0 -1
  271. package/dist/types/features/IL-OTJ/_components/_svg/NewChatIcon.d.ts +0 -10
  272. package/dist/types/features/IL-OTJ/_components/_svg/NewChatIcon.d.ts.map +0 -1
  273. package/dist/types/features/IL-OTJ/_components/_svg/PencilEdit.d.ts +0 -9
  274. package/dist/types/features/IL-OTJ/_components/_svg/PencilEdit.d.ts.map +0 -1
  275. package/dist/types/features/IL-OTJ/_components/_svg/RadioButton.d.ts +0 -10
  276. package/dist/types/features/IL-OTJ/_components/_svg/RadioButton.d.ts.map +0 -1
  277. package/dist/types/features/IL-OTJ/_components/_svg/RightSideIcons.d.ts +0 -10
  278. package/dist/types/features/IL-OTJ/_components/_svg/RightSideIcons.d.ts.map +0 -1
  279. package/dist/types/features/IL-OTJ/_components/_svg/ScrollToBottom.d.ts +0 -3
  280. package/dist/types/features/IL-OTJ/_components/_svg/ScrollToBottom.d.ts.map +0 -1
  281. package/dist/types/features/IL-OTJ/_components/_svg/SendButton.d.ts +0 -3
  282. package/dist/types/features/IL-OTJ/_components/_svg/SendButton.d.ts.map +0 -1
  283. package/dist/types/features/IL-OTJ/_components/_svg/SparkleIcon.d.ts +0 -4
  284. package/dist/types/features/IL-OTJ/_components/_svg/SparkleIcon.d.ts.map +0 -1
  285. package/dist/types/features/IL-OTJ/_components/_svg/TickIcon.d.ts +0 -10
  286. package/dist/types/features/IL-OTJ/_components/_svg/TickIcon.d.ts.map +0 -1
  287. package/dist/types/features/IL-OTJ/_components/_svg/UserIcon.d.ts +0 -3
  288. package/dist/types/features/IL-OTJ/_components/_svg/UserIcon.d.ts.map +0 -1
  289. package/dist/types/features/IL-OTJ/_components/_svg/WarningIcon.d.ts +0 -4
  290. package/dist/types/features/IL-OTJ/_components/_svg/WarningIcon.d.ts.map +0 -1
  291. package/dist/types/features/IL-OTJ/_components/_svg/WatchMeWorkIcon.d.ts +0 -4
  292. package/dist/types/features/IL-OTJ/_components/_svg/WatchMeWorkIcon.d.ts.map +0 -1
  293. package/dist/types/features/IL-OTJ/_components/atoms/Button/Button.d.ts +0 -7
  294. package/dist/types/features/IL-OTJ/_components/atoms/Button/Button.d.ts.map +0 -1
  295. package/dist/types/features/IL-OTJ/_components/atoms/Button/index.d.ts +0 -2
  296. package/dist/types/features/IL-OTJ/_components/atoms/Button/index.d.ts.map +0 -1
  297. package/dist/types/features/IL-OTJ/_components/atoms/Dropdown/Dropdown.d.ts +0 -15
  298. package/dist/types/features/IL-OTJ/_components/atoms/Dropdown/Dropdown.d.ts.map +0 -1
  299. package/dist/types/features/IL-OTJ/_components/atoms/Dropdown/index.d.ts +0 -2
  300. package/dist/types/features/IL-OTJ/_components/atoms/Dropdown/index.d.ts.map +0 -1
  301. package/dist/types/features/IL-OTJ/_components/atoms/SkeletonLoader/SkeletonLoader.d.ts +0 -11
  302. package/dist/types/features/IL-OTJ/_components/atoms/SkeletonLoader/SkeletonLoader.d.ts.map +0 -1
  303. package/dist/types/features/IL-OTJ/_components/atoms/Textarea/Textarea.d.ts +0 -27
  304. package/dist/types/features/IL-OTJ/_components/atoms/Textarea/Textarea.d.ts.map +0 -1
  305. package/dist/types/features/IL-OTJ/_components/atoms/Textarea/index.d.ts +0 -2
  306. package/dist/types/features/IL-OTJ/_components/atoms/Textarea/index.d.ts.map +0 -1
  307. package/dist/types/features/IL-OTJ/_components/atoms/Toggle/Toggle.d.ts +0 -9
  308. package/dist/types/features/IL-OTJ/_components/atoms/Toggle/Toggle.d.ts.map +0 -1
  309. package/dist/types/features/IL-OTJ/_components/atoms/Toggle/index.d.ts +0 -2
  310. package/dist/types/features/IL-OTJ/_components/atoms/Toggle/index.d.ts.map +0 -1
  311. package/dist/types/features/IL-OTJ/_components/cognitiveDecisioningThemeStyles.d.ts +0 -98
  312. package/dist/types/features/IL-OTJ/_components/cognitiveDecisioningThemeStyles.d.ts.map +0 -1
  313. package/dist/types/features/IL-OTJ/_components/hooks/usePendingEditHighlight.d.ts +0 -5
  314. package/dist/types/features/IL-OTJ/_components/hooks/usePendingEditHighlight.d.ts.map +0 -1
  315. package/dist/types/features/IL-OTJ/_components/hooks/useVariantEditSession.d.ts +0 -66
  316. package/dist/types/features/IL-OTJ/_components/hooks/useVariantEditSession.d.ts.map +0 -1
  317. package/dist/types/features/IL-OTJ/_components/index.d.ts +0 -22
  318. package/dist/types/features/IL-OTJ/_components/index.d.ts.map +0 -1
  319. package/dist/types/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts +0 -39
  320. package/dist/types/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts.map +0 -1
  321. package/dist/types/features/IL-OTJ/_components/molecules/Condition/index.d.ts +0 -2
  322. package/dist/types/features/IL-OTJ/_components/molecules/Condition/index.d.ts.map +0 -1
  323. package/dist/types/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.d.ts +0 -19
  324. package/dist/types/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.d.ts.map +0 -1
  325. package/dist/types/features/IL-OTJ/_components/molecules/Sections/index.d.ts +0 -2
  326. package/dist/types/features/IL-OTJ/_components/molecules/Sections/index.d.ts.map +0 -1
  327. package/dist/types/features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.d.ts +0 -15
  328. package/dist/types/features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.d.ts.map +0 -1
  329. package/dist/types/features/IL-OTJ/_components/molecules/SeperationRow/index.d.ts +0 -2
  330. package/dist/types/features/IL-OTJ/_components/molecules/SeperationRow/index.d.ts.map +0 -1
  331. package/dist/types/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts +0 -3
  332. package/dist/types/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts.map +0 -1
  333. package/dist/types/features/IL-OTJ/_components/organisms/ConditionSection/index.d.ts +0 -2
  334. package/dist/types/features/IL-OTJ/_components/organisms/ConditionSection/index.d.ts.map +0 -1
  335. package/dist/types/features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.d.ts +0 -30
  336. package/dist/types/features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.d.ts.map +0 -1
  337. package/dist/types/features/IL-OTJ/_components/organisms/ConfigSection/index.d.ts +0 -2
  338. package/dist/types/features/IL-OTJ/_components/organisms/ConfigSection/index.d.ts.map +0 -1
  339. package/dist/types/features/IL-OTJ/_components/organisms/DropdownSection/DropdownSection.d.ts +0 -17
  340. package/dist/types/features/IL-OTJ/_components/organisms/DropdownSection/DropdownSection.d.ts.map +0 -1
  341. package/dist/types/features/IL-OTJ/_components/organisms/DropdownSection/index.d.ts +0 -2
  342. package/dist/types/features/IL-OTJ/_components/organisms/DropdownSection/index.d.ts.map +0 -1
  343. package/dist/types/features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.d.ts +0 -34
  344. package/dist/types/features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.d.ts.map +0 -1
  345. package/dist/types/features/IL-OTJ/_components/organisms/ScopeSection/index.d.ts +0 -2
  346. package/dist/types/features/IL-OTJ/_components/organisms/ScopeSection/index.d.ts.map +0 -1
  347. package/dist/types/features/IL-OTJ/_components/organisms/TextSection/TextSection.d.ts +0 -3
  348. package/dist/types/features/IL-OTJ/_components/organisms/TextSection/TextSection.d.ts.map +0 -1
  349. package/dist/types/features/IL-OTJ/_components/organisms/TextSection/index.d.ts +0 -2
  350. package/dist/types/features/IL-OTJ/_components/organisms/TextSection/index.d.ts.map +0 -1
  351. package/dist/types/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.d.ts +0 -73
  352. package/dist/types/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.d.ts.map +0 -1
  353. package/dist/types/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.d.ts +0 -71
  354. package/dist/types/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.d.ts.map +0 -1
  355. package/dist/types/features/IL-OTJ/_components/templates/RuleComparison/AgentComposerRuleComparison.d.ts +0 -55
  356. package/dist/types/features/IL-OTJ/_components/templates/RuleComparison/AgentComposerRuleComparison.d.ts.map +0 -1
  357. package/dist/types/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.d.ts +0 -22
  358. package/dist/types/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.d.ts.map +0 -1
  359. package/dist/types/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.d.ts +0 -57
  360. package/dist/types/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.d.ts.map +0 -1
  361. package/dist/types/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.d.ts +0 -12
  362. package/dist/types/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.d.ts.map +0 -1
  363. package/dist/types/features/IL-OTJ/_components/templates/TemplatesMap/index.d.ts +0 -2
  364. package/dist/types/features/IL-OTJ/_components/templates/TemplatesMap/index.d.ts.map +0 -1
  365. package/dist/types/features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.d.ts +0 -12
  366. package/dist/types/features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.d.ts.map +0 -1
  367. package/dist/types/features/IL-OTJ/_components/templates/Testing/Testing.d.ts +0 -3
  368. package/dist/types/features/IL-OTJ/_components/templates/Testing/Testing.d.ts.map +0 -1
  369. package/dist/types/features/IL-OTJ/_components/templates/Testing/index.d.ts +0 -2
  370. package/dist/types/features/IL-OTJ/_components/templates/Testing/index.d.ts.map +0 -1
  371. package/dist/types/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts +0 -10
  372. package/dist/types/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map +0 -1
  373. package/dist/types/features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.d.ts +0 -3
  374. package/dist/types/features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.d.ts.map +0 -1
  375. package/dist/types/features/IL-OTJ/_components/templates/TrafficManager/index.d.ts +0 -2
  376. package/dist/types/features/IL-OTJ/_components/templates/TrafficManager/index.d.ts.map +0 -1
  377. package/dist/types/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.d.ts +0 -3
  378. package/dist/types/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.d.ts.map +0 -1
  379. package/dist/types/features/IL-OTJ/helpers/index.d.ts +0 -2
  380. package/dist/types/features/IL-OTJ/helpers/index.d.ts.map +0 -1
  381. package/dist/types/features/IL-OTJ/helpers/message-rendering-utils.d.ts +0 -26
  382. package/dist/types/features/IL-OTJ/helpers/message-rendering-utils.d.ts.map +0 -1
  383. package/dist/types/features/IL-OTJ/helpers/utils.d.ts +0 -23
  384. package/dist/types/features/IL-OTJ/helpers/utils.d.ts.map +0 -1
  385. package/dist/types/features/IL-OTJ/store/CitationsContext.d.ts +0 -23
  386. package/dist/types/features/IL-OTJ/store/CitationsContext.d.ts.map +0 -1
  387. package/dist/types/features/IL-OTJ/store/index.d.ts +0 -2
  388. package/dist/types/features/IL-OTJ/store/index.d.ts.map +0 -1
  389. package/dist/types/features/IL-marketplace/components/GuidelineCardMenu.d.ts +0 -34
  390. package/dist/types/features/IL-marketplace/components/GuidelineCardMenu.d.ts.map +0 -1
  391. package/dist/types/features/IL-marketplace/components/GuidelineCart.d.ts +0 -4
  392. package/dist/types/features/IL-marketplace/components/GuidelineCart.d.ts.map +0 -1
  393. package/dist/types/features/IL-marketplace/components/GuidelineCartHeader.d.ts +0 -14
  394. package/dist/types/features/IL-marketplace/components/GuidelineCartHeader.d.ts.map +0 -1
  395. package/dist/types/features/IL-marketplace/components/GuidelineCartItem.d.ts +0 -16
  396. package/dist/types/features/IL-marketplace/components/GuidelineCartItem.d.ts.map +0 -1
  397. package/dist/types/features/IL-marketplace/components/GuidelineConfirmDialog.d.ts +0 -18
  398. package/dist/types/features/IL-marketplace/components/GuidelineConfirmDialog.d.ts.map +0 -1
  399. package/dist/types/features/IL-marketplace/components/GuidelineEmptyState.d.ts +0 -11
  400. package/dist/types/features/IL-marketplace/components/GuidelineEmptyState.d.ts.map +0 -1
  401. package/dist/types/features/IL-marketplace/components/GuidelineFilterPanel.d.ts +0 -9
  402. package/dist/types/features/IL-marketplace/components/GuidelineFilterPanel.d.ts.map +0 -1
  403. package/dist/types/features/IL-marketplace/components/GuidelineHeader.d.ts +0 -4
  404. package/dist/types/features/IL-marketplace/components/GuidelineHeader.d.ts.map +0 -1
  405. package/dist/types/features/IL-marketplace/components/GuidelineIconButton.d.ts +0 -15
  406. package/dist/types/features/IL-marketplace/components/GuidelineIconButton.d.ts.map +0 -1
  407. package/dist/types/features/IL-marketplace/components/GuidelineLandingPage.d.ts +0 -4
  408. package/dist/types/features/IL-marketplace/components/GuidelineLandingPage.d.ts.map +0 -1
  409. package/dist/types/features/IL-marketplace/components/GuidelineLibrary.d.ts +0 -68
  410. package/dist/types/features/IL-marketplace/components/GuidelineLibrary.d.ts.map +0 -1
  411. package/dist/types/features/IL-marketplace/components/GuidelineLibraryCard.d.ts +0 -94
  412. package/dist/types/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +0 -1
  413. package/dist/types/features/IL-marketplace/components/GuidelineLibraryContent.d.ts +0 -96
  414. package/dist/types/features/IL-marketplace/components/GuidelineLibraryContent.d.ts.map +0 -1
  415. package/dist/types/features/IL-marketplace/components/GuidelineLibraryTab.d.ts +0 -27
  416. package/dist/types/features/IL-marketplace/components/GuidelineLibraryTab.d.ts.map +0 -1
  417. package/dist/types/features/IL-marketplace/components/GuidelineProceedButton.d.ts +0 -4
  418. package/dist/types/features/IL-marketplace/components/GuidelineProceedButton.d.ts.map +0 -1
  419. package/dist/types/features/IL-marketplace/components/GuidelineSelectButton.d.ts +0 -11
  420. package/dist/types/features/IL-marketplace/components/GuidelineSelectButton.d.ts.map +0 -1
  421. package/dist/types/features/IL-marketplace/components/GuidelineStatusChip.d.ts +0 -10
  422. package/dist/types/features/IL-marketplace/components/GuidelineStatusChip.d.ts.map +0 -1
  423. package/dist/types/features/IL-marketplace/components/GuidelineTooltip.d.ts +0 -10
  424. package/dist/types/features/IL-marketplace/components/GuidelineTooltip.d.ts.map +0 -1
  425. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsSelectionBody.d.ts +0 -3
  426. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsSelectionBody.d.ts.map +0 -1
  427. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsSelectionFooter.d.ts +0 -8
  428. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsSelectionFooter.d.ts.map +0 -1
  429. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsValidationBody.d.ts +0 -3
  430. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsValidationBody.d.ts.map +0 -1
  431. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsValidationFooter.d.ts +0 -8
  432. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/LearningsValidationFooter.d.ts.map +0 -1
  433. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishDetailsCards.d.ts +0 -24
  434. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishDetailsCards.d.ts.map +0 -1
  435. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishEmptyState.d.ts +0 -8
  436. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishEmptyState.d.ts.map +0 -1
  437. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishStepBody.d.ts +0 -4
  438. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishStepBody.d.ts.map +0 -1
  439. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishStepFooter.d.ts +0 -4
  440. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishStepFooter.d.ts.map +0 -1
  441. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishStepper.d.ts +0 -5
  442. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishStepper.d.ts.map +0 -1
  443. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplace.constants.d.ts +0 -3
  444. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplace.constants.d.ts.map +0 -1
  445. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplace.types.d.ts +0 -94
  446. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplace.types.d.ts.map +0 -1
  447. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.d.ts +0 -44
  448. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.d.ts.map +0 -1
  449. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/ReleaseSummaryBody.d.ts +0 -4
  450. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/ReleaseSummaryBody.d.ts.map +0 -1
  451. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/ReleaseSummaryFooter.d.ts +0 -14
  452. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/ReleaseSummaryFooter.d.ts.map +0 -1
  453. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/TemplateDetailsBody.d.ts +0 -4
  454. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/TemplateDetailsBody.d.ts.map +0 -1
  455. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/TemplateDetailsFooter.d.ts +0 -8
  456. package/dist/types/features/IL-marketplace/components/ILMarketPlacePublish/TemplateDetailsFooter.d.ts.map +0 -1
  457. package/dist/types/features/IL-marketplace/components/LearningManagementWrapper.d.ts +0 -31
  458. package/dist/types/features/IL-marketplace/components/LearningManagementWrapper.d.ts.map +0 -1
  459. package/dist/types/features/IL-marketplace/components/VersionSelectDropdown.d.ts +0 -13
  460. package/dist/types/features/IL-marketplace/components/VersionSelectDropdown.d.ts.map +0 -1
  461. package/dist/types/features/IL-marketplace/constants.d.ts +0 -183
  462. package/dist/types/features/IL-marketplace/constants.d.ts.map +0 -1
  463. package/dist/types/features/IL-marketplace/hooks/useControllableState.d.ts +0 -8
  464. package/dist/types/features/IL-marketplace/hooks/useControllableState.d.ts.map +0 -1
  465. package/dist/types/features/IL-marketplace/hooks/useDeleteGuidelineMutation.d.ts +0 -10
  466. package/dist/types/features/IL-marketplace/hooks/useDeleteGuidelineMutation.d.ts.map +0 -1
  467. package/dist/types/features/IL-marketplace/hooks/useGuidelineSelection.d.ts +0 -17
  468. package/dist/types/features/IL-marketplace/hooks/useGuidelineSelection.d.ts.map +0 -1
  469. package/dist/types/features/IL-marketplace/hooks/useGuidelineWorkspaceLegacyBridge.d.ts +0 -6
  470. package/dist/types/features/IL-marketplace/hooks/useGuidelineWorkspaceLegacyBridge.d.ts.map +0 -1
  471. package/dist/types/features/IL-marketplace/hooks/useMarketplaceApprovalStatus.d.ts +0 -4
  472. package/dist/types/features/IL-marketplace/hooks/useMarketplaceApprovalStatus.d.ts.map +0 -1
  473. package/dist/types/features/IL-marketplace/hooks/useMarketplacePublishILKBData.d.ts +0 -29
  474. package/dist/types/features/IL-marketplace/hooks/useMarketplacePublishILKBData.d.ts.map +0 -1
  475. package/dist/types/features/IL-marketplace/hooks/usePublishingFlowConfig.d.ts +0 -17
  476. package/dist/types/features/IL-marketplace/hooks/usePublishingFlowConfig.d.ts.map +0 -1
  477. package/dist/types/features/IL-marketplace/icons/GuidelineSpinner.d.ts +0 -7
  478. package/dist/types/features/IL-marketplace/icons/GuidelineSpinner.d.ts.map +0 -1
  479. package/dist/types/features/IL-marketplace/index.d.ts +0 -42
  480. package/dist/types/features/IL-marketplace/index.d.ts.map +0 -1
  481. package/dist/types/features/IL-marketplace/marketplaceTheme.d.ts +0 -99
  482. package/dist/types/features/IL-marketplace/marketplaceTheme.d.ts.map +0 -1
  483. package/dist/types/features/IL-marketplace/queryClient.d.ts +0 -3
  484. package/dist/types/features/IL-marketplace/queryClient.d.ts.map +0 -1
  485. package/dist/types/features/IL-marketplace/services/IL-marketplace.api.d.ts +0 -156
  486. package/dist/types/features/IL-marketplace/services/IL-marketplace.api.d.ts.map +0 -1
  487. package/dist/types/features/IL-marketplace/services/guideline.api.d.ts +0 -2
  488. package/dist/types/features/IL-marketplace/services/guideline.api.d.ts.map +0 -1
  489. package/dist/types/features/IL-marketplace/services/guideline.cart.api.d.ts +0 -28
  490. package/dist/types/features/IL-marketplace/services/guideline.cart.api.d.ts.map +0 -1
  491. package/dist/types/features/IL-marketplace/services/guideline.chat.d.ts +0 -2
  492. package/dist/types/features/IL-marketplace/services/guideline.chat.d.ts.map +0 -1
  493. package/dist/types/features/IL-marketplace/services/guideline.content.d.ts +0 -2
  494. package/dist/types/features/IL-marketplace/services/guideline.content.d.ts.map +0 -1
  495. package/dist/types/features/IL-marketplace/services/guideline.core.api.d.ts +0 -51
  496. package/dist/types/features/IL-marketplace/services/guideline.core.api.d.ts.map +0 -1
  497. package/dist/types/features/IL-marketplace/services/guideline.runtime.config.d.ts +0 -47
  498. package/dist/types/features/IL-marketplace/services/guideline.runtime.config.d.ts.map +0 -1
  499. package/dist/types/features/IL-marketplace/services/guideline.session.d.ts +0 -10
  500. package/dist/types/features/IL-marketplace/services/guideline.session.d.ts.map +0 -1
  501. package/dist/types/features/IL-marketplace/services/instant-learning.api.d.ts +0 -112
  502. package/dist/types/features/IL-marketplace/services/instant-learning.api.d.ts.map +0 -1
  503. package/dist/types/features/IL-marketplace/services/instant-learning.wishlist.d.ts +0 -8
  504. package/dist/types/features/IL-marketplace/services/instant-learning.wishlist.d.ts.map +0 -1
  505. package/dist/types/features/IL-marketplace/store/usePublishTemplateStore.d.ts +0 -14
  506. package/dist/types/features/IL-marketplace/store/usePublishTemplateStore.d.ts.map +0 -1
  507. package/dist/types/features/IL-marketplace/store/usePublishingFlowConfigStore.d.ts +0 -132
  508. package/dist/types/features/IL-marketplace/store/usePublishingFlowConfigStore.d.ts.map +0 -1
  509. package/dist/types/features/IL-marketplace/types/add-context.types.d.ts +0 -40
  510. package/dist/types/features/IL-marketplace/types/add-context.types.d.ts.map +0 -1
  511. package/dist/types/features/IL-marketplace/types/api.types.d.ts +0 -116
  512. package/dist/types/features/IL-marketplace/types/api.types.d.ts.map +0 -1
  513. package/dist/types/features/IL-marketplace/types/file-item.d.ts +0 -60
  514. package/dist/types/features/IL-marketplace/types/file-item.d.ts.map +0 -1
  515. package/dist/types/features/IL-marketplace/types/guideline.api.types.d.ts +0 -11
  516. package/dist/types/features/IL-marketplace/types/guideline.api.types.d.ts.map +0 -1
  517. package/dist/types/features/IL-marketplace/types/guideline.types.d.ts +0 -42
  518. package/dist/types/features/IL-marketplace/types/guideline.types.d.ts.map +0 -1
  519. package/dist/types/features/IL-marketplace/types.d.ts +0 -443
  520. package/dist/types/features/IL-marketplace/types.d.ts.map +0 -1
  521. package/dist/types/features/IL-marketplace/utils/addContextHelpers.d.ts +0 -7
  522. package/dist/types/features/IL-marketplace/utils/addContextHelpers.d.ts.map +0 -1
  523. package/dist/types/features/IL-marketplace/utils/cn.d.ts +0 -3
  524. package/dist/types/features/IL-marketplace/utils/cn.d.ts.map +0 -1
  525. package/dist/types/features/IL-marketplace/utils/guidelineFiles.d.ts +0 -17
  526. package/dist/types/features/IL-marketplace/utils/guidelineFiles.d.ts.map +0 -1
  527. package/dist/types/features/IL-marketplace/utils/guidelineOverlay.d.ts +0 -3
  528. package/dist/types/features/IL-marketplace/utils/guidelineOverlay.d.ts.map +0 -1
  529. package/dist/types/features/IL-marketplace/utils/guidelineSort.d.ts +0 -3
  530. package/dist/types/features/IL-marketplace/utils/guidelineSort.d.ts.map +0 -1
  531. package/dist/types/features/IL-marketplace/utils/microfrontend.d.ts +0 -23
  532. package/dist/types/features/IL-marketplace/utils/microfrontend.d.ts.map +0 -1
  533. package/dist/types/features/IL-marketplace/utils/publishingFlow.d.ts +0 -35
  534. package/dist/types/features/IL-marketplace/utils/publishingFlow.d.ts.map +0 -1
  535. package/dist/types/features/IL-marketplace/utils/session.d.ts +0 -4
  536. package/dist/types/features/IL-marketplace/utils/session.d.ts.map +0 -1
  537. package/dist/types/features/IL-marketplace/utils/url.d.ts +0 -2
  538. package/dist/types/features/IL-marketplace/utils/url.d.ts.map +0 -1
  539. package/dist/types/features/IL-marketplace/utils.d.ts +0 -75
  540. package/dist/types/features/IL-marketplace/utils.d.ts.map +0 -1
  541. package/dist/types/features/IL-marketplace/workspace/useGuidelineWorkspace.d.ts +0 -44
  542. package/dist/types/features/IL-marketplace/workspace/useGuidelineWorkspace.d.ts.map +0 -1
  543. package/dist/types/features/IL-marketplace/workspace/workspace.context.d.ts +0 -9
  544. package/dist/types/features/IL-marketplace/workspace/workspace.context.d.ts.map +0 -1
  545. package/dist/types/features/IL-marketplace/workspace/workspace.runtime.d.ts +0 -12
  546. package/dist/types/features/IL-marketplace/workspace/workspace.runtime.d.ts.map +0 -1
  547. package/dist/types/features/IL-marketplace/workspace/workspace.selectors.d.ts +0 -5
  548. package/dist/types/features/IL-marketplace/workspace/workspace.selectors.d.ts.map +0 -1
  549. package/dist/types/features/IL-marketplace/workspace/workspace.types.d.ts +0 -89
  550. package/dist/types/features/IL-marketplace/workspace/workspace.types.d.ts.map +0 -1
  551. package/dist/types/features/InstantLearning/InstantLearning.d.ts +0 -118
  552. package/dist/types/features/InstantLearning/InstantLearning.d.ts.map +0 -1
  553. package/dist/types/features/InstantLearning/_components/AudioWaveform.d.ts +0 -13
  554. package/dist/types/features/InstantLearning/_components/AudioWaveform.d.ts.map +0 -1
  555. package/dist/types/features/InstantLearning/_components/ChatComponent.d.ts +0 -58
  556. package/dist/types/features/InstantLearning/_components/ChatComponent.d.ts.map +0 -1
  557. package/dist/types/features/InstantLearning/_components/ConflictingLearningWarnCard.d.ts +0 -13
  558. package/dist/types/features/InstantLearning/_components/ConflictingLearningWarnCard.d.ts.map +0 -1
  559. package/dist/types/features/InstantLearning/_components/ConflictingLearningWarnCardDB.d.ts +0 -41
  560. package/dist/types/features/InstantLearning/_components/ConflictingLearningWarnCardDB.d.ts.map +0 -1
  561. package/dist/types/features/InstantLearning/_components/ContextualChatComponent.d.ts +0 -64
  562. package/dist/types/features/InstantLearning/_components/ContextualChatComponent.d.ts.map +0 -1
  563. package/dist/types/features/InstantLearning/_components/ContextualConflictDBCard.d.ts +0 -32
  564. package/dist/types/features/InstantLearning/_components/ContextualConflictDBCard.d.ts.map +0 -1
  565. package/dist/types/features/InstantLearning/_components/ContextualLearningForm.d.ts +0 -45
  566. package/dist/types/features/InstantLearning/_components/ContextualLearningForm.d.ts.map +0 -1
  567. package/dist/types/features/InstantLearning/_components/DebuggerPanel.d.ts +0 -16
  568. package/dist/types/features/InstantLearning/_components/DebuggerPanel.d.ts.map +0 -1
  569. package/dist/types/features/InstantLearning/_components/GeneralizationAccordion.d.ts +0 -28
  570. package/dist/types/features/InstantLearning/_components/GeneralizationAccordion.d.ts.map +0 -1
  571. package/dist/types/features/InstantLearning/_components/LearningDetailsForm.d.ts +0 -74
  572. package/dist/types/features/InstantLearning/_components/LearningDetailsForm.d.ts.map +0 -1
  573. package/dist/types/features/InstantLearning/_components/MessageRendering.d.ts +0 -10
  574. package/dist/types/features/InstantLearning/_components/MessageRendering.d.ts.map +0 -1
  575. package/dist/types/features/InstantLearning/_components/MinimizedThinkingSteps.d.ts +0 -4
  576. package/dist/types/features/InstantLearning/_components/MinimizedThinkingSteps.d.ts.map +0 -1
  577. package/dist/types/features/InstantLearning/_components/SimilarLearningCard.d.ts +0 -20
  578. package/dist/types/features/InstantLearning/_components/SimilarLearningCard.d.ts.map +0 -1
  579. package/dist/types/features/InstantLearning/_components/TemplateRetrievalForm.d.ts +0 -50
  580. package/dist/types/features/InstantLearning/_components/TemplateRetrievalForm.d.ts.map +0 -1
  581. package/dist/types/features/InstantLearning/_components/TooltipComponent.d.ts +0 -8
  582. package/dist/types/features/InstantLearning/_components/TooltipComponent.d.ts.map +0 -1
  583. package/dist/types/features/InstantLearning/_components/_svg/ArrowDown.d.ts +0 -4
  584. package/dist/types/features/InstantLearning/_components/_svg/ArrowDown.d.ts.map +0 -1
  585. package/dist/types/features/InstantLearning/_components/_svg/ArrowIconBlue.d.ts +0 -4
  586. package/dist/types/features/InstantLearning/_components/_svg/ArrowIconBlue.d.ts.map +0 -1
  587. package/dist/types/features/InstantLearning/_components/_svg/CompleteIconGreen.d.ts +0 -4
  588. package/dist/types/features/InstantLearning/_components/_svg/CompleteIconGreen.d.ts.map +0 -1
  589. package/dist/types/features/InstantLearning/_components/_svg/NewChatIcon.d.ts +0 -4
  590. package/dist/types/features/InstantLearning/_components/_svg/NewChatIcon.d.ts.map +0 -1
  591. package/dist/types/features/LearningManagement/AuditLog/AuditLog.d.ts +0 -11
  592. package/dist/types/features/LearningManagement/AuditLog/AuditLog.d.ts.map +0 -1
  593. package/dist/types/features/LearningManagement/AuditLog/ChangeLogDiff.d.ts +0 -15
  594. package/dist/types/features/LearningManagement/AuditLog/ChangeLogDiff.d.ts.map +0 -1
  595. package/dist/types/features/LearningManagement/LearningManagement.d.ts +0 -67
  596. package/dist/types/features/LearningManagement/LearningManagement.d.ts.map +0 -1
  597. package/dist/types/features/LearningManagement/LearningManagementTest.d.ts +0 -4
  598. package/dist/types/features/LearningManagement/LearningManagementTest.d.ts.map +0 -1
  599. package/dist/types/features/LearningManagement/LearningTemplateLayout.d.ts +0 -41
  600. package/dist/types/features/LearningManagement/LearningTemplateLayout.d.ts.map +0 -1
  601. package/dist/types/features/LearningManagement/RBAC/AccessManagementPanel.d.ts +0 -8
  602. package/dist/types/features/LearningManagement/RBAC/AccessManagementPanel.d.ts.map +0 -1
  603. package/dist/types/features/LearningManagement/RBAC/AccessPanel.d.ts +0 -12
  604. package/dist/types/features/LearningManagement/RBAC/AccessPanel.d.ts.map +0 -1
  605. package/dist/types/features/LearningManagement/RBAC/index.d.ts +0 -4
  606. package/dist/types/features/LearningManagement/RBAC/index.d.ts.map +0 -1
  607. package/dist/types/features/LearningManagement/RuleContent/AddScopeApprovalSearchComponent.d.ts +0 -12
  608. package/dist/types/features/LearningManagement/RuleContent/AddScopeApprovalSearchComponent.d.ts.map +0 -1
  609. package/dist/types/features/LearningManagement/RuleContent/AddScopeModal.d.ts +0 -19
  610. package/dist/types/features/LearningManagement/RuleContent/AddScopeModal.d.ts.map +0 -1
  611. package/dist/types/features/LearningManagement/RuleContent/ApprovalActionButton.d.ts +0 -8
  612. package/dist/types/features/LearningManagement/RuleContent/ApprovalActionButton.d.ts.map +0 -1
  613. package/dist/types/features/LearningManagement/RuleContent/ApprovalLearningDialog.d.ts +0 -18
  614. package/dist/types/features/LearningManagement/RuleContent/ApprovalLearningDialog.d.ts.map +0 -1
  615. package/dist/types/features/LearningManagement/RuleContent/ContentLogic.d.ts +0 -44
  616. package/dist/types/features/LearningManagement/RuleContent/ContentLogic.d.ts.map +0 -1
  617. package/dist/types/features/LearningManagement/RuleContent/HistorySkeleton.d.ts +0 -10
  618. package/dist/types/features/LearningManagement/RuleContent/HistorySkeleton.d.ts.map +0 -1
  619. package/dist/types/features/LearningManagement/RuleContent/InheritanceBreadcrumb.d.ts +0 -22
  620. package/dist/types/features/LearningManagement/RuleContent/InheritanceBreadcrumb.d.ts.map +0 -1
  621. package/dist/types/features/LearningManagement/RuleContent/InstructionPromptBlock.d.ts +0 -27
  622. package/dist/types/features/LearningManagement/RuleContent/InstructionPromptBlock.d.ts.map +0 -1
  623. package/dist/types/features/LearningManagement/RuleContent/OverrideTimeline.d.ts +0 -23
  624. package/dist/types/features/LearningManagement/RuleContent/OverrideTimeline.d.ts.map +0 -1
  625. package/dist/types/features/LearningManagement/RuleContent/PendingApprovalChip.d.ts +0 -7
  626. package/dist/types/features/LearningManagement/RuleContent/PendingApprovalChip.d.ts.map +0 -1
  627. package/dist/types/features/LearningManagement/RuleContent/RenameScopeModal.d.ts +0 -10
  628. package/dist/types/features/LearningManagement/RuleContent/RenameScopeModal.d.ts.map +0 -1
  629. package/dist/types/features/LearningManagement/RuleContent/RuleAccordion.d.ts +0 -131
  630. package/dist/types/features/LearningManagement/RuleContent/RuleAccordion.d.ts.map +0 -1
  631. package/dist/types/features/LearningManagement/RuleContent/RuleAccordionHeader.d.ts +0 -47
  632. package/dist/types/features/LearningManagement/RuleContent/RuleAccordionHeader.d.ts.map +0 -1
  633. package/dist/types/features/LearningManagement/RuleContent/RuleAccordionShell.d.ts +0 -69
  634. package/dist/types/features/LearningManagement/RuleContent/RuleAccordionShell.d.ts.map +0 -1
  635. package/dist/types/features/LearningManagement/RuleContent/RuleConditionBlock.d.ts +0 -39
  636. package/dist/types/features/LearningManagement/RuleContent/RuleConditionBlock.d.ts.map +0 -1
  637. package/dist/types/features/LearningManagement/RuleContent/RuleContent.d.ts +0 -49
  638. package/dist/types/features/LearningManagement/RuleContent/RuleContent.d.ts.map +0 -1
  639. package/dist/types/features/LearningManagement/RuleContent/RuleHeader.d.ts +0 -41
  640. package/dist/types/features/LearningManagement/RuleContent/RuleHeader.d.ts.map +0 -1
  641. package/dist/types/features/LearningManagement/RuleContent/RuleTierList.d.ts +0 -51
  642. package/dist/types/features/LearningManagement/RuleContent/RuleTierList.d.ts.map +0 -1
  643. package/dist/types/features/LearningManagement/RuleContent/TierCard.d.ts +0 -60
  644. package/dist/types/features/LearningManagement/RuleContent/TierCard.d.ts.map +0 -1
  645. package/dist/types/features/LearningManagement/RuleContent/VariantCard.d.ts +0 -109
  646. package/dist/types/features/LearningManagement/RuleContent/VariantCard.d.ts.map +0 -1
  647. package/dist/types/features/LearningManagement/RuleContent/VariantList.d.ts +0 -106
  648. package/dist/types/features/LearningManagement/RuleContent/VariantList.d.ts.map +0 -1
  649. package/dist/types/features/LearningManagement/ScopeSelector.d.ts +0 -45
  650. package/dist/types/features/LearningManagement/ScopeSelector.d.ts.map +0 -1
  651. package/dist/types/features/LearningManagement/Sidebar.d.ts +0 -37
  652. package/dist/types/features/LearningManagement/Sidebar.d.ts.map +0 -1
  653. package/dist/types/features/LearningManagement/SidebarWrapper.d.ts +0 -34
  654. package/dist/types/features/LearningManagement/SidebarWrapper.d.ts.map +0 -1
  655. package/dist/types/features/LearningManagement/StationsContent/StationsContent.d.ts +0 -17
  656. package/dist/types/features/LearningManagement/StationsContent/StationsContent.d.ts.map +0 -1
  657. package/dist/types/features/LearningManagement/apis/apiConfig.d.ts +0 -54
  658. package/dist/types/features/LearningManagement/apis/apiConfig.d.ts.map +0 -1
  659. package/dist/types/features/LearningManagement/apis/scopeApis.d.ts +0 -388
  660. package/dist/types/features/LearningManagement/apis/scopeApis.d.ts.map +0 -1
  661. package/dist/types/features/LearningManagement/components/CardSkeleton.d.ts +0 -8
  662. package/dist/types/features/LearningManagement/components/CardSkeleton.d.ts.map +0 -1
  663. package/dist/types/features/LearningManagement/components/ConfirmationModal.d.ts +0 -22
  664. package/dist/types/features/LearningManagement/components/ConfirmationModal.d.ts.map +0 -1
  665. package/dist/types/features/LearningManagement/components/CreateLearningSetModal.d.ts +0 -20
  666. package/dist/types/features/LearningManagement/components/CreateLearningSetModal.d.ts.map +0 -1
  667. package/dist/types/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts +0 -12
  668. package/dist/types/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts.map +0 -1
  669. package/dist/types/features/LearningManagement/components/CustomTooltip.d.ts +0 -16
  670. package/dist/types/features/LearningManagement/components/CustomTooltip.d.ts.map +0 -1
  671. package/dist/types/features/LearningManagement/components/EmptyLearningState.d.ts +0 -42
  672. package/dist/types/features/LearningManagement/components/EmptyLearningState.d.ts.map +0 -1
  673. package/dist/types/features/LearningManagement/components/ErrorStateDisplay.d.ts +0 -25
  674. package/dist/types/features/LearningManagement/components/ErrorStateDisplay.d.ts.map +0 -1
  675. package/dist/types/features/LearningManagement/components/InstantLearningModal.d.ts +0 -41
  676. package/dist/types/features/LearningManagement/components/InstantLearningModal.d.ts.map +0 -1
  677. package/dist/types/features/LearningManagement/components/InstantLearningModalDynamic.d.ts +0 -62
  678. package/dist/types/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +0 -1
  679. package/dist/types/features/LearningManagement/components/LearningTemplateManagementSkeleton.d.ts +0 -8
  680. package/dist/types/features/LearningManagement/components/LearningTemplateManagementSkeleton.d.ts.map +0 -1
  681. package/dist/types/features/LearningManagement/components/PromptTextEditor.d.ts +0 -44
  682. package/dist/types/features/LearningManagement/components/PromptTextEditor.d.ts.map +0 -1
  683. package/dist/types/features/LearningManagement/components/RuleContentSkeleton.d.ts +0 -8
  684. package/dist/types/features/LearningManagement/components/RuleContentSkeleton.d.ts.map +0 -1
  685. package/dist/types/features/LearningManagement/components/ScopeSkeletonLoader.d.ts +0 -36
  686. package/dist/types/features/LearningManagement/components/ScopeSkeletonLoader.d.ts.map +0 -1
  687. package/dist/types/features/LearningManagement/components/ScopeTree/HighlightedText.d.ts +0 -8
  688. package/dist/types/features/LearningManagement/components/ScopeTree/HighlightedText.d.ts.map +0 -1
  689. package/dist/types/features/LearningManagement/components/ScopeTree/TreeAddAction.d.ts +0 -10
  690. package/dist/types/features/LearningManagement/components/ScopeTree/TreeAddAction.d.ts.map +0 -1
  691. package/dist/types/features/LearningManagement/components/ScopeTree/TreeMenu.d.ts +0 -17
  692. package/dist/types/features/LearningManagement/components/ScopeTree/TreeMenu.d.ts.map +0 -1
  693. package/dist/types/features/LearningManagement/components/ScopeTree/TreeNode.d.ts +0 -38
  694. package/dist/types/features/LearningManagement/components/ScopeTree/TreeNode.d.ts.map +0 -1
  695. package/dist/types/features/LearningManagement/components/ScopeTree/TreeNodeHeader.d.ts +0 -22
  696. package/dist/types/features/LearningManagement/components/ScopeTree/TreeNodeHeader.d.ts.map +0 -1
  697. package/dist/types/features/LearningManagement/components/ScopeTree/TreeSectionItem.d.ts +0 -16
  698. package/dist/types/features/LearningManagement/components/ScopeTree/TreeSectionItem.d.ts.map +0 -1
  699. package/dist/types/features/LearningManagement/components/ScopeTree/TreeSidebar.d.ts +0 -23
  700. package/dist/types/features/LearningManagement/components/ScopeTree/TreeSidebar.d.ts.map +0 -1
  701. package/dist/types/features/LearningManagement/components/ScopeTree/TreeTooltip.d.ts +0 -10
  702. package/dist/types/features/LearningManagement/components/ScopeTree/TreeTooltip.d.ts.map +0 -1
  703. package/dist/types/features/LearningManagement/components/SidebarSearch.d.ts +0 -25
  704. package/dist/types/features/LearningManagement/components/SidebarSearch.d.ts.map +0 -1
  705. package/dist/types/features/LearningManagement/components/Skeleton.d.ts +0 -12
  706. package/dist/types/features/LearningManagement/components/Skeleton.d.ts.map +0 -1
  707. package/dist/types/features/LearningManagement/components/StationOnboarding/DayToggleSelector.d.ts +0 -13
  708. package/dist/types/features/LearningManagement/components/StationOnboarding/DayToggleSelector.d.ts.map +0 -1
  709. package/dist/types/features/LearningManagement/components/StationOnboarding/InputField.d.ts +0 -27
  710. package/dist/types/features/LearningManagement/components/StationOnboarding/InputField.d.ts.map +0 -1
  711. package/dist/types/features/LearningManagement/components/StationOnboarding/OnboardingLoader.d.ts +0 -19
  712. package/dist/types/features/LearningManagement/components/StationOnboarding/OnboardingLoader.d.ts.map +0 -1
  713. package/dist/types/features/LearningManagement/components/StationOnboarding/StationAutocomplete.d.ts +0 -15
  714. package/dist/types/features/LearningManagement/components/StationOnboarding/StationAutocomplete.d.ts.map +0 -1
  715. package/dist/types/features/LearningManagement/components/StationOnboarding/StationOnboardModal.d.ts +0 -16
  716. package/dist/types/features/LearningManagement/components/StationOnboarding/StationOnboardModal.d.ts.map +0 -1
  717. package/dist/types/features/LearningManagement/components/StationOnboarding/TemplateCard.d.ts +0 -22
  718. package/dist/types/features/LearningManagement/components/StationOnboarding/TemplateCard.d.ts.map +0 -1
  719. package/dist/types/features/LearningManagement/components/ToolTip.d.ts +0 -8
  720. package/dist/types/features/LearningManagement/components/ToolTip.d.ts.map +0 -1
  721. package/dist/types/features/LearningManagement/config.d.ts +0 -64
  722. package/dist/types/features/LearningManagement/config.d.ts.map +0 -1
  723. package/dist/types/features/LearningManagement/constants.d.ts +0 -19
  724. package/dist/types/features/LearningManagement/constants.d.ts.map +0 -1
  725. package/dist/types/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts +0 -62
  726. package/dist/types/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts.map +0 -1
  727. package/dist/types/features/LearningManagement/queries/useApprovalQueries.d.ts +0 -20
  728. package/dist/types/features/LearningManagement/queries/useApprovalQueries.d.ts.map +0 -1
  729. package/dist/types/features/LearningManagement/queries/useLMSConfigQuery.d.ts +0 -9
  730. package/dist/types/features/LearningManagement/queries/useLMSConfigQuery.d.ts.map +0 -1
  731. package/dist/types/features/LearningManagement/shared/ErrorToastContent.d.ts +0 -22
  732. package/dist/types/features/LearningManagement/shared/ErrorToastContent.d.ts.map +0 -1
  733. package/dist/types/features/LearningManagement/shared/SuccessToastContent.d.ts +0 -22
  734. package/dist/types/features/LearningManagement/shared/SuccessToastContent.d.ts.map +0 -1
  735. package/dist/types/features/LearningManagement/shared/index.d.ts +0 -7
  736. package/dist/types/features/LearningManagement/shared/index.d.ts.map +0 -1
  737. package/dist/types/features/LearningManagement/store/types.d.ts +0 -32
  738. package/dist/types/features/LearningManagement/store/types.d.ts.map +0 -1
  739. package/dist/types/features/LearningManagement/store/useAppSecRolesStore.d.ts +0 -11
  740. package/dist/types/features/LearningManagement/store/useAppSecRolesStore.d.ts.map +0 -1
  741. package/dist/types/features/LearningManagement/store/useAuthStore.d.ts +0 -12
  742. package/dist/types/features/LearningManagement/store/useAuthStore.d.ts.map +0 -1
  743. package/dist/types/features/LearningManagement/store/useConfigStore.d.ts +0 -18
  744. package/dist/types/features/LearningManagement/store/useConfigStore.d.ts.map +0 -1
  745. package/dist/types/features/LearningManagement/store/useEnvStore.d.ts +0 -36
  746. package/dist/types/features/LearningManagement/store/useEnvStore.d.ts.map +0 -1
  747. package/dist/types/features/LearningManagement/store/useExternalWorkflowStore.d.ts +0 -38
  748. package/dist/types/features/LearningManagement/store/useExternalWorkflowStore.d.ts.map +0 -1
  749. package/dist/types/features/LearningManagement/store/useLMSConfigStore.d.ts +0 -388
  750. package/dist/types/features/LearningManagement/store/useLMSConfigStore.d.ts.map +0 -1
  751. package/dist/types/features/LearningManagement/store/useLearningTemplateStore.d.ts +0 -84
  752. package/dist/types/features/LearningManagement/store/useLearningTemplateStore.d.ts.map +0 -1
  753. package/dist/types/features/LearningManagement/store/usePermissionsStore.d.ts +0 -35
  754. package/dist/types/features/LearningManagement/store/usePermissionsStore.d.ts.map +0 -1
  755. package/dist/types/features/LearningManagement/types.d.ts +0 -288
  756. package/dist/types/features/LearningManagement/types.d.ts.map +0 -1
  757. package/dist/types/features/LearningManagement/utils/learningMetadataUtils.d.ts +0 -17
  758. package/dist/types/features/LearningManagement/utils/learningMetadataUtils.d.ts.map +0 -1
  759. package/dist/types/features/LearningManagement/utils/treeUtils.d.ts +0 -18
  760. package/dist/types/features/LearningManagement/utils/treeUtils.d.ts.map +0 -1
  761. package/dist/types/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDrive.d.ts +0 -4
  762. package/dist/types/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDrive.d.ts.map +0 -1
  763. package/dist/types/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDriveButton.d.ts +0 -10
  764. package/dist/types/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDriveButton.d.ts.map +0 -1
  765. package/dist/types/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystem.d.ts +0 -4
  766. package/dist/types/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystem.d.ts.map +0 -1
  767. package/dist/types/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystemButton.d.ts +0 -10
  768. package/dist/types/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystemButton.d.ts.map +0 -1
  769. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/Dataset-collection.d.ts +0 -13
  770. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/Dataset-collection.d.ts.map +0 -1
  771. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/DatasetCollectionInfo.d.ts +0 -4
  772. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/DatasetCollectionInfo.d.ts.map +0 -1
  773. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/ProjectTaskSelect.d.ts +0 -4
  774. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/ProjectTaskSelect.d.ts.map +0 -1
  775. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/Tooltip.d.ts +0 -10
  776. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/Tooltip.d.ts.map +0 -1
  777. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/ConfidenceScoreColumnMenu.d.ts +0 -22
  778. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/ConfidenceScoreColumnMenu.d.ts.map +0 -1
  779. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/FilterHandlerUtility.d.ts +0 -33
  780. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/FilterHandlerUtility.d.ts.map +0 -1
  781. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/LabelColumnMenu.d.ts +0 -20
  782. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/LabelColumnMenu.d.ts.map +0 -1
  783. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TableColumnResetFilterButton.d.ts +0 -7
  784. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TableColumnResetFilterButton.d.ts.map +0 -1
  785. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TagColumnMenu.d.ts +0 -18
  786. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TagColumnMenu.d.ts.map +0 -1
  787. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dropdown-with-radio.d.ts +0 -26
  788. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/dropdown-with-radio.d.ts.map +0 -1
  789. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/input-label-with-info.d.ts +0 -4
  790. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/Components/input-label-with-info.d.ts.map +0 -1
  791. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/RELFInterfaces.d.ts +0 -3
  792. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/RELFInterfaces.d.ts.map +0 -1
  793. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEF.d.ts +0 -4
  794. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEF.d.ts.map +0 -1
  795. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEFButton.d.ts +0 -10
  796. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEFButton.d.ts.map +0 -1
  797. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/collections.d.ts +0 -1108
  798. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/collections.d.ts.map +0 -1
  799. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/common.d.ts +0 -57
  800. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/common.d.ts.map +0 -1
  801. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/data.d.ts +0 -643
  802. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/data.d.ts.map +0 -1
  803. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/modelGroup.type.d.ts +0 -24
  804. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/modelGroup.type.d.ts.map +0 -1
  805. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/models.d.ts +0 -283
  806. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/models.d.ts.map +0 -1
  807. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/projects.d.ts +0 -58
  808. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/projects.d.ts.map +0 -1
  809. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/tags.d.ts +0 -20
  810. package/dist/types/features/UploadData/Components/SelectDataFromRLEF/interfaces/tags.d.ts.map +0 -1
  811. package/dist/types/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSet.d.ts +0 -4
  812. package/dist/types/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSet.d.ts.map +0 -1
  813. package/dist/types/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSetButton.d.ts +0 -4
  814. package/dist/types/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSetButton.d.ts.map +0 -1
  815. package/dist/types/features/UploadData/NotFound.d.ts +0 -4
  816. package/dist/types/features/UploadData/NotFound.d.ts.map +0 -1
  817. package/dist/types/features/UploadData/main.d.ts +0 -10
  818. package/dist/types/features/UploadData/main.d.ts.map +0 -1
  819. package/dist/types/features/WtaWnta/WtaWnta.d.ts +0 -55
  820. package/dist/types/features/WtaWnta/WtaWnta.d.ts.map +0 -1
  821. package/dist/types/features/WtaWnta/_components/AgentDetailsForm.d.ts +0 -43
  822. package/dist/types/features/WtaWnta/_components/AgentDetailsForm.d.ts.map +0 -1
  823. package/dist/types/features/WtaWnta/_components/SimilarConflictingCard.d.ts +0 -18
  824. package/dist/types/features/WtaWnta/_components/SimilarConflictingCard.d.ts.map +0 -1
  825. package/dist/types/features/WtaWnta/_components/ValidationCard.d.ts +0 -30
  826. package/dist/types/features/WtaWnta/_components/ValidationCard.d.ts.map +0 -1
  827. package/dist/types/hooks/useAgentFix.d.ts +0 -15
  828. package/dist/types/hooks/useAgentFix.d.ts.map +0 -1
  829. package/dist/types/hooks/useAgentSuggestions.d.ts +0 -20
  830. package/dist/types/hooks/useAgentSuggestions.d.ts.map +0 -1
  831. package/dist/types/hooks/useAgentValidation.d.ts +0 -17
  832. package/dist/types/hooks/useAgentValidation.d.ts.map +0 -1
  833. package/dist/types/hooks/useDebounce copy.d.ts +0 -2
  834. package/dist/types/hooks/useDebounce copy.d.ts.map +0 -1
  835. package/dist/types/hooks/useDebounce.d.ts +0 -2
  836. package/dist/types/hooks/useDebounce.d.ts.map +0 -1
  837. package/dist/types/hooks/useExistingAgentCheck.d.ts +0 -28
  838. package/dist/types/hooks/useExistingAgentCheck.d.ts.map +0 -1
  839. package/dist/types/hooks/useExistingPromptCheck.d.ts +0 -36
  840. package/dist/types/hooks/useExistingPromptCheck.d.ts.map +0 -1
  841. package/dist/types/hooks/usePromptFix.d.ts +0 -14
  842. package/dist/types/hooks/usePromptFix.d.ts.map +0 -1
  843. package/dist/types/hooks/usePromptSuggestions.d.ts +0 -8
  844. package/dist/types/hooks/usePromptSuggestions.d.ts.map +0 -1
  845. package/dist/types/hooks/usePromptValidation.d.ts +0 -18
  846. package/dist/types/hooks/usePromptValidation.d.ts.map +0 -1
  847. package/dist/types/hooks/useTableHeadCellsCount copy.d.ts +0 -6
  848. package/dist/types/hooks/useTableHeadCellsCount copy.d.ts.map +0 -1
  849. package/dist/types/hooks/useTableHeadCellsCount.d.ts +0 -6
  850. package/dist/types/hooks/useTableHeadCellsCount.d.ts.map +0 -1
  851. package/dist/types/hooks/useURLQuery copy.d.ts +0 -10
  852. package/dist/types/hooks/useURLQuery copy.d.ts.map +0 -1
  853. package/dist/types/hooks/useURLQuery.d.ts +0 -10
  854. package/dist/types/hooks/useURLQuery.d.ts.map +0 -1
  855. package/dist/types/index.d.ts +0 -58
  856. package/dist/types/index.d.ts.map +0 -1
  857. package/dist/types/methodsToExpose.d.ts +0 -13
  858. package/dist/types/methodsToExpose.d.ts.map +0 -1
  859. package/dist/types/plugins/ValueTypes/Category/CategoryTeachMeRenderer.d.ts +0 -29
  860. package/dist/types/plugins/ValueTypes/Category/CategoryTeachMeRenderer.d.ts.map +0 -1
  861. package/dist/types/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts +0 -22
  862. package/dist/types/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +0 -1
  863. package/dist/types/plugins/ValueTypes/Default/DefaultTeachMeRendererOld.d.ts +0 -28
  864. package/dist/types/plugins/ValueTypes/Default/DefaultTeachMeRendererOld.d.ts.map +0 -1
  865. package/dist/types/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.d.ts +0 -29
  866. package/dist/types/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.d.ts.map +0 -1
  867. package/dist/types/plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.d.ts +0 -5
  868. package/dist/types/plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.d.ts.map +0 -1
  869. package/dist/types/schema-driven/BPARenderer.d.ts +0 -14
  870. package/dist/types/schema-driven/BPARenderer.d.ts.map +0 -1
  871. package/dist/types/schema-driven/FallbackField.d.ts +0 -13
  872. package/dist/types/schema-driven/FallbackField.d.ts.map +0 -1
  873. package/dist/types/schema-driven/components/ConditionSectionField.d.ts +0 -3
  874. package/dist/types/schema-driven/components/ConditionSectionField.d.ts.map +0 -1
  875. package/dist/types/schema-driven/components/ConfigSectionField.d.ts +0 -3
  876. package/dist/types/schema-driven/components/ConfigSectionField.d.ts.map +0 -1
  877. package/dist/types/schema-driven/components/DropdownSectionField.d.ts +0 -3
  878. package/dist/types/schema-driven/components/DropdownSectionField.d.ts.map +0 -1
  879. package/dist/types/schema-driven/components/GlobalSetupAccordionField.d.ts +0 -3
  880. package/dist/types/schema-driven/components/GlobalSetupAccordionField.d.ts.map +0 -1
  881. package/dist/types/schema-driven/components/GroupEditRow.d.ts +0 -3
  882. package/dist/types/schema-driven/components/GroupEditRow.d.ts.map +0 -1
  883. package/dist/types/schema-driven/components/PromptTextEditorField.d.ts +0 -3
  884. package/dist/types/schema-driven/components/PromptTextEditorField.d.ts.map +0 -1
  885. package/dist/types/schema-driven/components/ScopeSectionField.d.ts +0 -3
  886. package/dist/types/schema-driven/components/ScopeSectionField.d.ts.map +0 -1
  887. package/dist/types/schema-driven/components/TextInputField.d.ts +0 -3
  888. package/dist/types/schema-driven/components/TextInputField.d.ts.map +0 -1
  889. package/dist/types/schema-driven/components/VariantListField.d.ts +0 -3
  890. package/dist/types/schema-driven/components/VariantListField.d.ts.map +0 -1
  891. package/dist/types/schema-driven/demoSchema.d.ts +0 -13
  892. package/dist/types/schema-driven/demoSchema.d.ts.map +0 -1
  893. package/dist/types/schema-driven/hooks/useParentEditEnabled.d.ts +0 -18
  894. package/dist/types/schema-driven/hooks/useParentEditEnabled.d.ts.map +0 -1
  895. package/dist/types/schema-driven/hooks/useSectionEditSession.d.ts +0 -34
  896. package/dist/types/schema-driven/hooks/useSectionEditSession.d.ts.map +0 -1
  897. package/dist/types/schema-driven/primitives/Accordion.d.ts +0 -21
  898. package/dist/types/schema-driven/primitives/Accordion.d.ts.map +0 -1
  899. package/dist/types/schema-driven/store/useDynamicFormStore.d.ts +0 -28
  900. package/dist/types/schema-driven/store/useDynamicFormStore.d.ts.map +0 -1
  901. package/dist/types/schema-driven/types.d.ts +0 -81
  902. package/dist/types/schema-driven/types.d.ts.map +0 -1
  903. package/dist/types/schema-driven/utils/PayloadUtils.d.ts +0 -82
  904. package/dist/types/schema-driven/utils/PayloadUtils.d.ts.map +0 -1
  905. package/dist/types/schema-driven/utils/aiReasoning.d.ts +0 -5
  906. package/dist/types/schema-driven/utils/aiReasoning.d.ts.map +0 -1
  907. package/dist/types/schema-driven/utils/conditionText.d.ts +0 -8
  908. package/dist/types/schema-driven/utils/conditionText.d.ts.map +0 -1
  909. package/dist/types/schema-driven/utils/editLock.d.ts +0 -39
  910. package/dist/types/schema-driven/utils/editLock.d.ts.map +0 -1
  911. package/dist/types/service/API.d.ts +0 -6
  912. package/dist/types/service/API.d.ts.map +0 -1
  913. package/dist/types/service/DataService.d.ts +0 -73
  914. package/dist/types/service/DataService.d.ts.map +0 -1
  915. package/dist/types/service/GoogleFilePickerService.d.ts +0 -61
  916. package/dist/types/service/GoogleFilePickerService.d.ts.map +0 -1
  917. package/dist/types/service/InstantLearningService.d.ts +0 -20
  918. package/dist/types/service/InstantLearningService.d.ts.map +0 -1
  919. package/dist/types/service/JavascriptFileService.d.ts +0 -4
  920. package/dist/types/service/JavascriptFileService.d.ts.map +0 -1
  921. package/dist/types/service/ModelService.d.ts +0 -68
  922. package/dist/types/service/ModelService.d.ts.map +0 -1
  923. package/dist/types/service/ProjectService.d.ts +0 -16
  924. package/dist/types/service/ProjectService.d.ts.map +0 -1
  925. package/dist/types/service/SavedDataSetService.d.ts +0 -22
  926. package/dist/types/service/SavedDataSetService.d.ts.map +0 -1
  927. package/dist/types/service/constants.d.ts +0 -3
  928. package/dist/types/service/constants.d.ts.map +0 -1
  929. package/dist/types/service/envHelperService.d.ts +0 -5
  930. package/dist/types/service/envHelperService.d.ts.map +0 -1
  931. package/dist/types/service/variableHelperService.d.ts +0 -6
  932. package/dist/types/service/variableHelperService.d.ts.map +0 -1
  933. package/dist/types/shims/react-dom-shim.d.ts +0 -17
  934. package/dist/types/shims/react-dom-shim.d.ts.map +0 -1
  935. package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.d.ts +0 -10
  936. package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.d.ts.map +0 -1
  937. package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.styles.d.ts +0 -6
  938. package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.styles.d.ts.map +0 -1
  939. package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.d.ts +0 -11
  940. package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.d.ts.map +0 -1
  941. package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.styles.d.ts +0 -6
  942. package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.styles.d.ts.map +0 -1
  943. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.d.ts +0 -16
  944. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.d.ts.map +0 -1
  945. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.d.ts +0 -6
  946. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.d.ts.map +0 -1
  947. package/dist/types/src/features/LSCGuidelinesCart/LearningManagementWrapper.d.ts +0 -19
  948. package/dist/types/src/features/LSCGuidelinesCart/LearningManagementWrapper.d.ts.map +0 -1
  949. package/dist/types/src/features/LSCGuidelinesCart/api.d.ts +0 -4
  950. package/dist/types/src/features/LSCGuidelinesCart/api.d.ts.map +0 -1
  951. package/dist/types/src/features/LSCGuidelinesCart/endpoints.d.ts +0 -5
  952. package/dist/types/src/features/LSCGuidelinesCart/endpoints.d.ts.map +0 -1
  953. package/dist/types/src/features/LSCGuidelinesCart/interfacesApi.d.ts +0 -25
  954. package/dist/types/src/features/LSCGuidelinesCart/interfacesApi.d.ts.map +0 -1
  955. package/dist/types/src/features/LSCGuidelinesCart/transformSelectedGuidelineData.d.ts +0 -18
  956. package/dist/types/src/features/LSCGuidelinesCart/transformSelectedGuidelineData.d.ts.map +0 -1
  957. package/dist/types/src/routes/ErrorBoundary.d.ts +0 -22
  958. package/dist/types/src/routes/ErrorBoundary.d.ts.map +0 -1
  959. package/dist/types/src/routes/Routes.d.ts +0 -3
  960. package/dist/types/src/routes/Routes.d.ts.map +0 -1
  961. package/dist/types/theme.d.ts +0 -4
  962. package/dist/types/theme.d.ts.map +0 -1
  963. package/dist/types/types/GoogleFilePicker/GoogleFilePickerCallbackFunctionType.d.ts +0 -23
  964. package/dist/types/types/GoogleFilePicker/GoogleFilePickerCallbackFunctionType.d.ts.map +0 -1
  965. package/dist/types/userProvidedConfig.d.ts +0 -8
  966. package/dist/types/userProvidedConfig.d.ts.map +0 -1
  967. package/dist/types/utils/CustomSkeleton.d.ts +0 -3
  968. package/dist/types/utils/CustomSkeleton.d.ts.map +0 -1
  969. package/dist/types/utils/SkeletonLoader.d.ts +0 -8
  970. package/dist/types/utils/SkeletonLoader.d.ts.map +0 -1
  971. package/dist/types/utils/agentGenieAPI.d.ts +0 -21
  972. package/dist/types/utils/agentGenieAPI.d.ts.map +0 -1
  973. package/dist/types/utils/api.d.ts +0 -2
  974. package/dist/types/utils/api.d.ts.map +0 -1
  975. package/dist/types/utils/bookGenieAPI.d.ts +0 -14
  976. package/dist/types/utils/bookGenieAPI.d.ts.map +0 -1
  977. package/dist/types/utils/codeCitations.utils.d.ts +0 -2
  978. package/dist/types/utils/codeCitations.utils.d.ts.map +0 -1
  979. package/dist/types/utils/colors.d.ts +0 -5
  980. package/dist/types/utils/colors.d.ts.map +0 -1
  981. package/dist/types/utils/date.d.ts +0 -8
  982. package/dist/types/utils/date.d.ts.map +0 -1
  983. package/dist/types/utils/helperFunctions.d.ts +0 -2
  984. package/dist/types/utils/helperFunctions.d.ts.map +0 -1
  985. package/dist/types/utils/instantLearning.utils.d.ts +0 -3
  986. package/dist/types/utils/instantLearning.utils.d.ts.map +0 -1
  987. package/dist/types/utils/instantLearningAPI.d.ts +0 -21
  988. package/dist/types/utils/instantLearningAPI.d.ts.map +0 -1
  989. package/dist/types/utils/payloadParsers.d.ts +0 -16
  990. package/dist/types/utils/payloadParsers.d.ts.map +0 -1
  991. package/dist/types/utils/recommendationParser.d.ts +0 -22
  992. package/dist/types/utils/recommendationParser.d.ts.map +0 -1
  993. package/dist/types/utils/regexHelperService.d.ts +0 -9
  994. package/dist/types/utils/regexHelperService.d.ts.map +0 -1
  995. package/dist/types/utils/urlQueryParamService.d.ts +0 -2
  996. package/dist/types/utils/urlQueryParamService.d.ts.map +0 -1
  997. package/dist/types/utils/variableHelperService.d.ts +0 -7
  998. package/dist/types/utils/variableHelperService.d.ts.map +0 -1
  999. package/dist/types/utils/variantParser.d.ts +0 -14
  1000. package/dist/types/utils/variantParser.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as n,__awaiter as t,__generator as i}from"tslib";import{jsxs as r,jsx as a,Fragment as o}from"react/jsx-runtime";import l,{useState as u,useRef as s,useEffect as d,useCallback as c,useMemo as v}from"react";import{AlertTriangle as p,Loader as _,Lightbulb as f,Check as g}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as w}from"uuid";import{saveInstantLearningQuestion as y,publishFeedback as h,updateVariant as b,saveDraftVariant as I,fetchRulesByQuestionId as M,submitChatFeedback as A}from"../apis/scopeApis.js";import{useLearningTemplateStore as T}from"../store/useLearningTemplateStore.js";import{useTeachMeConfigStore as S,dt as k,useLMSConfigStore as C}from"../store/useLMSConfigStore.js";import E from"../styles/InstantLearningModal.module.css.js";import N from"../../IL-OTJ/ILOTJ.js";import"../../IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../../IL-OTJ/_components/InputDataReasoningCard.js";import"../../IL-OTJ/_components/TooltipComponent.js";import"../../IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import{extractAndParseWithProperty as L,parseValidationData as O,extractAndParseResponse as R,extractVariantIds as x}from"../../IL-OTJ/helpers/utils.js";import{useCitations as D}from"../../IL-OTJ/store/CitationsContext.js";import"@mui/material";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"../../../api/transport.js";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"../store/usePermissionsStore.js";import j from"./ConfirmationModal.js";import"./ToolTip.js";import P from"../store/useAuthStore.js";import"@mui/icons-material/Check";import"@mui/icons-material/CloseRounded";import"../../IL-marketplace/marketplaceTheme.js";import"@tanstack/react-query";import V from"../store/useEnvStore.js";import"date-fns/format";import"date-fns/isValid";import"date-fns/parseISO";import"framer-motion";import"../../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"../store/useExternalWorkflowStore.js";import"../../IL-marketplace/queryClient.js";import{useConfigStore as F}from"../store/useConfigStore.js";import"appsec-ui";import"react-dom";import"@radix-ui/react-tooltip";import"./StationOnboarding/InputField.js";import{IL_CONFIG_CONSTANTS as G}from"../config.js";import"../store/useAppSecRolesStore.js";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"../AuditLog/ChangeLogDiff.js";import"react-router-dom";import"../../IL-marketplace/components/GuidelineIconButton.js";import"@e-llm-studio/federated-dashboard-components";import"@e-llm-studio/federated-dashboard-components/styles.css";import"../hooks/useLearningTemplateQueryParams.js";import"../../../ILMarketplaceWrapper.js";import"../LearningManagementTest.js";import{getInstructionPromptValue as U,isSchedulingConfigLearningMetadata as q,buildLegacyLearningMetadataPayload as J}from"../utils/learningMetadataUtils.js";import{resolveIsEditMode as W}from"../utils/learningFlow.js";import{buildSaveDraftPayload as Y}from"../utils/saveDraft.js";var H=function(){return a(f,{size:20,strokeWidth:2,className:"text-blue-600"})},B="INITIAL",K="SUCCESS",Q="FAILURE",z="IN_PROGRESS",$=function(e){return"string"!=typeof e?"":e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,"").replace(/<!--```json[\s\S]*?```-->/g,"").trim()},Z=function(n){void 0===n&&(n={});var t=e({},n);return Object.keys(n).forEach(function(e){var i=n[e];i&&"object"==typeof i&&!Array.isArray(i)&&Object.keys(t).forEach(function(n){n!==e&&n.startsWith("".concat(e,"_"))&&delete t[n]})}),t},X=function(e){return(null==e?void 0:e.variant_id)||(null==e?void 0:e.new_variant_id)||(null==e?void 0:e.client_id)||void 0},ee=function(e){if(!e)return!1;var n=e.toLowerCase().trim();return"default"===n||"default_variant"===n},ne=function(e){return e.toLowerCase().replace(/ /g,"_").replace(/tier(\d+)/i,"tier_$1")},te=function(f){var te,ie,re,ae,oe,le,ue,se,de,ce,ve,pe,_e,fe,ge,me,we,ye=f.isOpen,he=f.onClose,be=f.initialScope,Ie=void 0===be?"global":be,Me=f.ruleSet,Ae=f.editingRule,Te=f.editingTier,Se=f.editingVariants,ke=f.flow,Ce=f.focusedVariantIndex,Ee=f.setFocusedVariantIndex,Ne=f.triggerAddVariant,Le=f.triggerFixGaps,Oe=f.isDraftFlow,Re=f.copiedRule,xe=f.copiedSourceTier,De=f.copiedTargetTier,je=f.initialDraftMessage,Pe=f.postSaveCallback,Ve=f.initialChatMessage,Fe=f.applicationIntegrationId,Ge=f.contentModeMappingId,Ue=f.modeId,qe=f.uiStateLabels,Je=f.customSections,We=f.enableChatLogs,Ye=u({station:Ie,tiers:["Tier 1"]}),He=Ye[0],Be=Ye[1],Ke=u(B),Qe=Ke[0],ze=Ke[1],$e=u(!1),Ze=$e[0],Xe=$e[1],en=u("Thank you teacher for teaching me, your rule has been saved successfully."),nn=en[0],tn=en[1],rn=u(""),an=rn[0],on=rn[1],ln=u(!1),un=ln[0],sn=ln[1],dn=s(null),cn=u(!1),vn=cn[0],pn=cn[1],_n=s(!1),fn=s(!1),gn=T.getState().tiers,mn=l.useRef(new Set),wn=u(null);wn[0];var yn=wn[1],hn=u(null);hn[0];var bn=hn[1],In=u(null);In[0];var Mn=In[1],An=s({}),Tn=s(new Map),Sn=s(""),kn=s(!1),Cn=u(0),En=Cn[0],Nn=Cn[1],Ln=u(!1),On=Ln[0],Rn=Ln[1],xn=s(null),Dn=s(0),jn=s(null),Pn=u(null),Vn=Pn[0],Fn=Pn[1],Gn=u([]),Un=Gn[0],qn=Gn[1],Jn=u(null),Wn=Jn[0],Yn=Jn[1],Hn=u(null),Bn=Hn[0],Kn=Hn[1],Qn=u(!1),zn=Qn[0],$n=Qn[1],Zn=s({}),Xn=s(new Map),et=s(!1),nt=u(!1),tt=nt[0],it=nt[1],rt=s(!1),at=s(new Set),ot=u(null),lt=ot[0],ut=ot[1],st=u(null),dt=st[0],ct=st[1],vt=u(null),pt=vt[0],_t=vt[1],ft=s(null),gt=s(null),mt=s(null),wt=s(null),yt=s({}),ht=s([]),bt=s([]),It=s({}),Mt=F(),At=Mt.configuration,Tt=Mt.ilLabels,St=T.getState().backwardCompatibility,kt=T.getState().cognitiveCompareCompatibility,Ct=V(function(e){return e.rbacConfig}),Et=V.getState().baseModeName,Nt=s(He.tiers);d(function(){var n=Nt.current[0]?ne(Nt.current[0]):null,t=He.tiers[0]?ne(He.tiers[0]):null;if(n&&t&&n!==t){var i=bt.current||[],r=function(e){var n=i[e];return!!n&&(!n.is_readOnly&&"copy"!==n.action)},a=function(e){e(function(e){var i=new Map(e),a=i.get(n)||new Map,o=new Map(i.get(t)||new Map),l=new Map;return a.forEach(function(e,n){r(n)?o.set(n,e):l.set(n,e)}),i.set(t,o),i.set(n,l),i})};a(Ht),a(Qt),a(Zt),Dt(function(e){var i=new Map(e),a=i.get(n)||new Map,o=new Map(i.get(t)||new Map),l=new Map;return a.forEach(function(e,n){r(n)?o.set(n,e):l.set(n,e)}),i.set(t,o),i.set(n,l.size>0?l:new Map([[0,Lt]])),i}),ni(function(e){var t=new Map(e);return t.set(n,new Map),t}),ri(function(n){return Array.isArray(n)?n.map(function(n){return"copy"===(null==n?void 0:n.action)||(null==n?void 0:n.is_readOnly)?n:e(e({},n),{scope:[t],tier_id:t.replace("tier_","")})}):n}),gt.current=t}Nt.current=He.tiers},[He.tiers]),d(function(){lt||ct(null)},[lt]),d(function(){var e;if(ye&&Ae){ft.current=Ae.ruleId;var n=null===(e=null==Se?void 0:Se[Ce||0])||void 0===e?void 0:e.variantId;_t(n||null)}},[ye,Ae,Se,Ce]),d(function(){ye&&Be(function(n){return e(e({},n),{station:Ie})})},[ye,Ie]),d(function(){console.log("triggered",pt),console.log(ii,"structuredAIResponse"),ri(function(n){return Array.isArray(n)?n.map(function(n){return e(e({},n),{is_readOnly:n.variant_id!==pt&&n.new_variant_id!==pt})}):n}),gi(function(n){return Array.isArray(n)?n.map(function(n){return e(e({},n),{is_readOnly:n.variant_id!==pt&&n.new_variant_id!==pt})}):n})},[pt]),d(function(){var n,t,i,r,a,o;if(!ye)return ba(),void(et.current=!1);if(!et.current){var l=Se,u=l&&l.length>0,s=null!=Ae;if(u||s){var d=null!==(a=null!==(i=null!==(n=null==Ae?void 0:Ae.ruleTitle)&&void 0!==n?n:null===(t=null==l?void 0:l[Ce||0])||void 0===t?void 0:t.title)&&void 0!==i?i:null===(r=null==l?void 0:l[Ce||0])||void 0===r?void 0:r.ruleTitle)&&void 0!==a?a:"";if(d&&Jt(d),Te&&(Be(function(n){return e(e({},n),{tiers:[Te]})}),gt.current=Te.toLowerCase().replace(/ /g,"_")),u){var c=Te?ne(Te):"tier_1",v=new Map,p=new Map,_=new Map,f=new Map,g=new Map,m=new Map,w=[];l.forEach(function(e,n){f.set(n,e.description||"");var t=e.whenToApply?e.whenToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];g.set(n,t);var i=e.whenNotToApply?e.whenNotToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wnta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];m.set(n,i),w.push(e.variantId||e.variant_id||"")}),v.set(c,f),p.set(c,g),_.set(c,m);var y=null===(o=null==l?void 0:l[Ce||0])||void 0===o?void 0:o.variantId,h=l.map(function(e,n){var t,i,r=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config;return{variant_type:e.variantType||"variant",title:d,rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:[c],scheduling_config:r||{},variant_id:e.variantId,question_id:(null==Ae?void 0:Ae.ruleId)||"",tier_id:c.replace("tier_",""),is_readOnly:e.variantId!==y,link_id:e.link_id||"",is_enabled:null===(i=e.is_enabled)||void 0===i||i,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,action:"edit"}});ri(h),ri(h),gi(h),pi(function(e){var n=new Map(e);return n.set(c,JSON.parse(JSON.stringify(h))),n});var b=new Map;l.forEach(function(e,n){var t,i,r,a,o,l,u,s,d,c,v,p,_,f=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config,g=null!==(a=null!==(i=null==f?void 0:f.order_global_min_separation_seconds)&&void 0!==i?i:null===(r=null==f?void 0:f.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)&&void 0!==a?a:0,m=null!==(u=null!==(o=null==f?void 0:f.advertiser_global_min_separation_seconds)&&void 0!==o?o:null===(l=null==f?void 0:f.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)&&void 0!==u?u:0;b.set(n,{order_rules:{enabled:g>0,global_min_separation_seconds:Math.floor(g/60)},advertiser_rules:{enabled:m>0,global_min_separation_seconds:Math.floor(m/60)},inventory_rules:{respect_inventory_code:null!==(c=null!==(d=null===(s=null==f?void 0:f.inventory_rules)||void 0===s?void 0:s.respect_inventory_code)&&void 0!==d?d:null==f?void 0:f.respect_inventory_code)&&void 0!==c&&c},break_code_rules:{respect_break_code:null!==(_=null!==(p=null===(v=null==f?void 0:f.break_code_rules)||void 0===v?void 0:v.respect_break_code)&&void 0!==p?p:null==f?void 0:f.respect_break_code)&&void 0!==_&&_},is_default_enabled:ee(e.variantType||e.variant_type)})}),Dt(new Map([[c,b]])),Ht(v),Qt(p),Zt(_)}else if(s&&Ae){var I=Ae.ruleDesc;if(I&&Ht(new Map([["tier_1",new Map([[0,I]])]])),Ae.whenToApply){var M=Ae.whenToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,n){return{id:"edit-wta-".concat(n),text:e,reasoning:""}});Qt(new Map([["tier_1",new Map([[0,M]])]]))}if(Ae.whenNotToApply){var A=Ae.whenNotToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,n){return{id:"edit-wnta-".concat(n),text:e,reasoning:""}});Zt(new Map([["tier_1",new Map([[0,A]])]]))}}}else if(Re&&xe&&De){Jt(Re.ruleTitle||""),Be(function(n){return e(e({},n),{tiers:[De]})}),gt.current=ne(De);var T=ne(xe),S=Re.variants||[],k=(v=new Map,p=new Map,_=new Map,new Map),C=new Map,E=new Map;S.forEach(function(e,n){k.set(n,e.description||"");var t=e.whenToApply?e.whenToApply.split(" OR ").map(function(e,t){return{id:"copy-wta-".concat(n,"-").concat(t),text:e.trim(),reasoning:""}}):[];C.set(n,t);var i=e.whenNotToApply?e.whenNotToApply.split(" OR ").map(function(e,t){return{id:"copy-wnta-".concat(n,"-").concat(t),text:e.trim(),reasoning:""}}):[];E.set(n,i)}),v.set(T,k),p.set(T,C),_.set(T,E),Ht(v),Qt(p),Zt(_);var N=S.map(function(e,n){var t,i,r=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config;return{variant_type:e.variantType||"variant",title:Re.ruleTitle||"",rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:[xe],scheduling_config:r||{},variant_id:e.variantId,question_id:Re.ruleId||"",tier_id:T.replace("tier_",""),is_readOnly:!0,link_id:e.link_id||"",is_enabled:null===(i=e.is_enabled)||void 0===i||i,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,action:"copy"}});ri(N),gi(N),pi(function(e){var n=new Map(e);return n.set(T,JSON.parse(JSON.stringify(N))),n});var L=new Map;S.forEach(function(e,n){var t,i,r,a,o,l,u,s,d,c,v,p,_,f=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config,g=null!==(a=null!==(i=null==f?void 0:f.order_global_min_separation_seconds)&&void 0!==i?i:null===(r=null==f?void 0:f.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)&&void 0!==a?a:0,m=null!==(u=null!==(o=null==f?void 0:f.advertiser_global_min_separation_seconds)&&void 0!==o?o:null===(l=null==f?void 0:f.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)&&void 0!==u?u:0;L.set(n,{order_rules:{enabled:g>0,global_min_separation_seconds:Math.floor(g/60)},advertiser_rules:{enabled:m>0,global_min_separation_seconds:Math.floor(m/60)},inventory_rules:{respect_inventory_code:null!==(c=null!==(d=null===(s=null==f?void 0:f.inventory_rules)||void 0===s?void 0:s.respect_inventory_code)&&void 0!==d?d:null==f?void 0:f.respect_inventory_code)&&void 0!==c&&c},break_code_rules:{respect_break_code:null!==(_=null!==(p=null===(v=null==f?void 0:f.break_code_rules)||void 0===v?void 0:v.respect_break_code)&&void 0!==p?p:null==f?void 0:f.respect_break_code)&&void 0!==_&&_},is_default_enabled:ee(e.variantType||e.variant_type)})}),Dt(new Map([[T,L]]))}else ba()}},[ye,Ae,Se,Te,Re,xe,De]),d(function(){if(ye){if(console.log("[Accordion Init] editingTier:",Te,"focusedVariantIndex:",Ce),Te&&Be(function(n){return e(e({},n),{tiers:[Te]})}),zn)return console.log("[Accordion] isAddingNewVariant mode — closing all variant accordions"),void Ti(void 0);if(Ne){console.log("[Accordion] triggerAddVariant mode — not opening any variant on RHS"),Ti(void 0);var n=(Te?ne(Te):"tier_1").replace(/_/g," ");Ci("I want to add a new variant to ".concat(n))}else null!=Ce?(console.log("[Accordion] Opening SPECIFIC variant index ".concat(Ce," (from VariantCard)")),Ti(Ce),Qi(function(e){return e+1})):(Ae||Se&&Se.length>0)&&(console.log("[Accordion] Opening DEFAULT/1st variant (index 0) for RuleHeader edit"),Ti(0),Qi(function(e){return e+1}))}else Ti(void 0)},[ye,Te,Ce,Ae,Se,Ne,zn]),d(function(){ye&&Le&&Ae&&null!==Ce&&Ci("I want to fix the gaps")},[ye,Le,Ae,Ce]);var Lt={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},Ot=function(e){var n=T.getState().tiers,t=n.length>0&&!St?n.map(function(e){return e.tier_name.replace(/(\d+)/,"_$1")}):["tier_1","tier_2","tier_3"];return new Map(t.map(function(e){return[e,new Map]}))},Rt=u(function(){var e=T.getState().tiers,n=e.length>0&&!St?e.map(function(e){return e.tier_name.replace(/(\d+)/,"_$1")}):["tier_1","tier_2","tier_3"];return new Map(n.map(function(e){return[e,new Map([[0,Lt]])]}))}),xt=Rt[0],Dt=Rt[1],jt=u(new Set([])),Pt=jt[0],Vt=jt[1],Ft=u("");Ft[0];var Gt=Ft[1],Ut=u(""),qt=Ut[0],Jt=Ut[1],Wt=u(function(){return Ot()}),Yt=Wt[0],Ht=Wt[1],Bt=u(function(){return Ot()}),Kt=Bt[0],Qt=Bt[1],zt=u(function(){return Ot()}),$t=zt[0],Zt=zt[1],Xt=u(function(){return Ot()}),ei=Xt[0],ni=Xt[1],ti=u([]),ii=ti[0],ri=ti[1],ai=u({}),oi=ai[0],li=ai[1],ui=u({}),si=ui[0],di=ui[1],ci=u(new Map),vi=ci[0],pi=ci[1],_i=u([]),fi=_i[0],gi=_i[1],mi=u(!1),wi=mi[0],yi=mi[1],hi=u([]),bi=hi[0],Ii=hi[1],Mi=u(void 0),Ai=Mi[0],Ti=Mi[1],Si=u(""),ki=Si[0],Ci=Si[1],Ei=u(null),Ni=Ei[0],Li=Ei[1],Oi=u([]),Ri=Oi[0],xi=Oi[1],Di=u([]),ji=Di[0],Pi=Di[1],Vi=u({}),Fi=Vi[0],Gi=Vi[1],Ui=u(new Map),qi=Ui[0],Ji=Ui[1],Wi=u(new Set),Yi=Wi[0],Hi=Wi[1],Bi=u(0),Ki=Bi[0],Qi=Bi[1],zi=u({ruleTitle:"",ruleDescription:"",scopeData:"",whenToApply:"",whenNotToApply:"",configData:""}),$i=zi[0],Zi=zi[1],Xi=u([]),er=Xi[0],nr=Xi[1],tr=u(""),ir=tr[0],rr=tr[1],ar=u({}),or=ar[0],lr=ar[1],ur=u(!1),sr=ur[0],dr=ur[1],cr=s(null),vr=s(null),pr=s(-1),_r=s(null);d(function(){bt.current=ii},[ii]),d(function(){var e;mt.current=(null===(e=He.tiers)||void 0===e?void 0:e[0])?ne(He.tiers[0]):null},[He.tiers]),d(function(){var n=new Set,t=console.warn;return console.warn=function(){for(var i,o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];t.apply(void 0,o);var u=o[0];if("string"==typeof u&&u.includes("Failed to parse JSON for property=")){var s=u.match(/warnId="([^"]+)"/),d=null==s?void 0:s[1];if(d&&n.has(d))return;d&&n.add(d),null===(i=_r.current)||void 0===i||i.show({severity:"warn",sticky:!1,life:5e3,className:E.toastWarning,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconWarning}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleWarning)},{children:"Parsing Issue"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageWarning)},{children:"The AI response couldn't be parsed correctly. Please try rephrasing your input or retry."}))]}))})}},function(){console.warn=t}},[]);var fr=u(!1),gr=fr[0],mr=fr[1],wr=u(!1),yr=wr[0],hr=wr[1],br=u(!1),Ir=br[0],Mr=br[1],Ar=u({}),Tr=Ar[0],Sr=Ar[1],kr=u(""),Cr=kr[0],Er=kr[1],Nr=u(!0),Lr=Nr[0],Or=Nr[1],Rr=u(!1),xr=Rr[0],Dr=Rr[1],jr=u(!1),Pr=jr[0],Vr=jr[1],Fr=u(""),Gr=Fr[0],Ur=Fr[1],qr=u(""),Jr=qr[0],Wr=qr[1],Yr=u(""),Hr=Yr[0],Br=Yr[1],Kr=u(null),Qr=Kr[0],zr=Kr[1],$r=u(null),Zr=$r[0],Xr=$r[1],ea=u(null),na=ea[0],ta=ea[1],ia=P.getState().user,ra=D(),aa=ra.dispatch,oa=ra.getLatestReasoning;d(function(){console.log("Structured AI Response updated:",ii)},[ii]),d(function(){console.log("isCloseModal AI Response updated:",Lr)},[Lr]),d(function(){!1===sr?(Mr(!1),Ur(""),Wr("")):(sn(!1),on(""))},[sr]),d(function(){null!=Ai&&Se&&!Se[Ai]&&zr(null)},[Ai,Se]);var la=s(null);d(function(){var n,t,i,r;if(ye){var a=null!=Ai?Ai:Ce;if(null!=a){var o=null!==(i=null!==(n=null==Se?void 0:Se[a])&&void 0!==n?n:null===(t=null==Re?void 0:Re.variants)||void 0===t?void 0:t[a])&&void 0!==i?i:Array.isArray(ii)?ii[a]:void 0,l=null!==(r=X(o))&&void 0!==r?r:"idx-".concat(a);if(la.current!==l){la.current=l;var u=(null==o?void 0:o.learning_metadata)||{},s=oi[l],d=e(e({},u),{instruction_prompt:null!=s?s:U(u)});T.getState().setLearningMetadata(d)}}}else la.current=null},[ye,Ai,Ce,ii]),d(function(){if(vn&&!_n.current){_n.current=!0,console.log("UseEffect triggered: Sending save message to chat agent");Ci("Save this Learning"),pn(!1),setTimeout(function(){_n.current=!1,Ci("")},2e3)}},[vn]),d(function(){ye&&Oe&&!fn.current&&(fn.current=!0,Ci("Please help me continue configuring this draft")),Oe&&ye||(fn.current=!1)},[ye,Oe]);var ua=c(function(e,n){Un.some(function(n){return n.id===e})?(Vr(!0),Yn(e),Kn(n),setTimeout(function(){Kn(null),Yn(null)},6e3)):console.warn("Variant ID ".concat(e," not found in comparison variants."))},[Un]),sa=v(function(){var e=Pr&&En>0;return console.log("[Loader Debug] showComparison: ".concat(Pr,", activeRequests: ").concat(En,", Result: ").concat(e)),e},[Pr,En]),da=c(function(n,t,i){var r,a=void 0!==(null===(r=null==i?void 0:i.target)||void 0===r?void 0:r.value)?i.target.value:i;Ht(function(e){var i=new Map(e),r=new Map(i.get(n));return r.set(t,a),i.set(n,r),i}),Sr(function(i){if(i["ruleDescription-".concat(n,"-").concat(t)]){var r=e({},i);return delete r["ruleDescription-".concat(n,"-").concat(t)],r}return i})},[]),ca=c(function(t,i){Qt(function(e){var r=new Map(e),a=new Map(r.get(t)),o=a.get(i)||[];return a.set(i,n(n([],o,!0),[{id:Date.now(),text:"",reasoning:""}],!1)),r.set(t,a),r}),Sr(function(n){if(n["whenToApply-".concat(t,"-").concat(i)]){var r=e({},n);return delete r["whenToApply-".concat(t,"-").concat(i)],r}return n})},[]),va=c(function(e,n,t){Qt(function(i){var r=new Map(i),a=new Map(r.get(e)),o=a.get(n)||[];return a.set(n,o.filter(function(e){return e.id!==t})),r.set(e,a),r})},[]),pa=c(function(n,t,i,r){Qt(function(a){var o=new Map(a),l=new Map(o.get(n)),u=l.get(t)||[];return l.set(t,u.map(function(n){return String(n.id)===String(i)?e(e({},n),{text:r}):n})),o.set(n,l),o}),Sr(function(i){if(i["whenToApply-".concat(n,"-").concat(t)]){var r=e({},i);return delete r["whenToApply-".concat(n,"-").concat(t)],r}return i})},[]),_a=c(function(e,t){Zt(function(i){var r=new Map(i),a=new Map(r.get(e)),o=a.get(t)||[];return a.set(t,n(n([],o,!0),[{id:Date.now(),text:"",reasoning:""}],!1)),r.set(e,a),r})},[]),fa=c(function(e,n,t){Zt(function(i){var r=new Map(i),a=new Map(r.get(e)),o=a.get(n)||[];return a.set(n,o.filter(function(e){return e.id!==t})),r.set(e,a),r})},[]),ga=c(function(n,t,i,r){Zt(function(a){var o=new Map(a),l=new Map(o.get(n)),u=l.get(t)||[];return l.set(t,u.map(function(n){return String(n.id)===String(i)?e(e({},n),{text:r}):n})),o.set(n,l),o})},[]),ma=c(function(e){var n=e.replace(/_/g," ");$n(!0),null==Ee||Ee(null),Ti(void 0),Ci("I want to add a new variant to ".concat(n))},[]),wa=function(n,t,i){var r="".concat(n,"_").concat(t);console.log("Highlighting ".concat(i," at ").concat(r)),Ji(function(n){var t,a=new Map(n),o=a.get(r)||{};return a.set(r,e(e({},o),((t={})[i]=!0,t))),a}),setTimeout(function(){Ji(function(n){var t,a=new Map(n),o=a.get(r)||{};return a.set(r,e(e({},o),((t={})[i]=!1,t))),a})},1500)},ya=c(function(n,t){Be(function(i){var r;return e(e({},i),((r={})[n]=t,r))}),Sr(function(t){if(t[n]){var i=e({},t);return delete i[n],i}return t})},[]),ha=c(function(n,t,i,r){ni(function(e){var r=new Map(e),a=new Map(r.get(n)||new Map),o=a.get(t)||new Set;return o.add(i),a.set(t,o),r.set(n,a),r}),Dt(function(a){var o,l,u,s=new Map(a),d=new Map(s.get(n)||new Map),c=d.get(t)||Lt;switch(i){case"order_rules":case"advertiser_rules":u="boolean"==typeof r?e(e({},c),((o={})[i]=e(e({},c[i]),{enabled:r}),o)):"object"==typeof r&&null!==r?e(e({},c),((l={})[i]={enabled:r.enabled,global_min_separation_seconds:r.global_min_separation_seconds},l)):c;break;case"inventory_rules":u=e(e({},c),{inventory_rules:{respect_inventory_code:"boolean"==typeof r?r:r.respect_inventory_code}});break;case"break_code_rules":u=e(e({},c),{break_code_rules:{respect_break_code:"boolean"==typeof r?r:r.respect_break_code}});break;case"is_default_enabled":u=e(e({},c),{is_default_enabled:"boolean"==typeof r?r:!!r});break;default:u=c}return d.set(t,u),s.set(n,d),s})},[]);d(function(){sr&&(Vr(!1),Kn(null),Yn(null))},[sr]);var ba=c(function(n){var t;if(void 0===n&&(n=!1),n||(aa({type:"RESET"}),cr.current=null,ri([]),Ii([]),nr([]),lr({}),Vr(!1),mn.current.clear(),T.getState().clearLearningMetadata(),li({})),Jt(""),xi([]),$n(!1),Sn.current="",Br(""),Xr(null),Pi([]),Be({station:"",tiers:[]}),Nn(0),Rn(!1),ta(null),Ht(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Qt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Zt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Dt(new Map([["tier_1",new Map([[0,Lt]])],["tier_2",new Map([[0,Lt]])],["tier_3",new Map([[0,Lt]])]])),ni(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Gt(""),Ti(0),Qi(0),Be({station:Ie,tiers:["Tier 1"]}),n||Gi({}),ni(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Ci(""),Zi({ruleTitle:"",ruleDescription:"",scopeData:"",whenToApply:"",whenNotToApply:"",configData:""}),Sr({}),Er(""),Or(!0),yn(null),bn(null),pi(new Map),gi([]),it(!1),Mn(null),di({}),vr.current=null,kn.current=!1,Zn.current={},at.current.clear(),ft.current=null,gt.current=null,_t(null),on(""),ze(B),Xe(!1),sn(!1),pn(!1),Fn(null),qn([]),Yn(null),Kn(null),ut(null),yi(!1),Li(null),Ur(""),Wr(""),Mr(!1),Vt(new Set),_n.current=!1,Tn.current.clear(),Dn.current=0,jn.current=null,xn.current=null,wt.current=null,pr.current=-1,rt.current=!1,et.current=!1,Ae){Ae.ruleTitle&&Jt(Ae.ruleTitle),Te&&(Be(function(n){return e(e({},n),{tiers:[Te]})}),gt.current=Te.toLowerCase().replace(/ /g,"_")),ft.current=Ae.ruleId;var i=null===(t=null==Se?void 0:Se[Ce||0])||void 0===t?void 0:t.variantId;if(_t(i||null),Se&&Se.length>0){var r=Te?ne(Te):"tier_1",a=new Map,o=new Map,l=new Map,u=new Map,s=new Map,d=new Map;Se.forEach(function(e,n){u.set(n,e.description||"");var t=e.whenToApply?e.whenToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];s.set(n,t);var i=e.whenNotToApply?e.whenNotToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wnta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];d.set(n,i)}),a.set(r,u),o.set(r,s),l.set(r,d),Ht(a),Qt(o),Zt(l);var c=Se.map(function(e){var n,t,a=null===(n=e.configuration)||void 0===n?void 0:n.scheduling_config;return{variant_type:e.variantType||"variant",title:Ae.ruleTitle||"",rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:[r],scheduling_config:a||{},variant_id:e.variantId,question_id:Ae.ruleId||"",tier_id:r.replace("tier_",""),is_readOnly:e.variantId!==i,link_id:e.link_id||"",is_enabled:null===(t=e.is_enabled)||void 0===t||t,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,action:"edit"}});ri(c),gi(c),pi(function(e){var n=new Map(e);return n.set(r,JSON.parse(JSON.stringify(c))),n});var v=new Map;Se.forEach(function(e,n){var t,i,r,a,o,l,u,s,d,c,p,_,f,g=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config,m=null!==(a=null!==(i=null==g?void 0:g.order_global_min_separation_seconds)&&void 0!==i?i:null===(r=null==g?void 0:g.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)&&void 0!==a?a:0,w=null!==(u=null!==(o=null==g?void 0:g.advertiser_global_min_separation_seconds)&&void 0!==o?o:null===(l=null==g?void 0:g.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)&&void 0!==u?u:0;v.set(n,{order_rules:{enabled:m>0,global_min_separation_seconds:Math.floor(m/60)},advertiser_rules:{enabled:w>0,global_min_separation_seconds:Math.floor(w/60)},inventory_rules:{respect_inventory_code:null!==(c=null!==(d=null===(s=null==g?void 0:g.inventory_rules)||void 0===s?void 0:s.respect_inventory_code)&&void 0!==d?d:null==g?void 0:g.respect_inventory_code)&&void 0!==c&&c},break_code_rules:{respect_break_code:null!==(f=null!==(_=null===(p=null==g?void 0:g.break_code_rules)||void 0===p?void 0:p.respect_break_code)&&void 0!==_?_:null==g?void 0:g.respect_break_code)&&void 0!==f&&f},is_default_enabled:ee(e.variantType||e.variant_type)})}),Dt(new Map([[r,v]])),Ti(null!=Ce?Ce:0)}}},[aa,Ie,Ae,Te,Se,Ce]),Ia=function(e){if(!e||0===e.length)return"variant 1";var n=e.filter(function(e){var n=e.variant_type||e.variantType||"";return""!==n&&null!==n});return"variant ".concat(n.length+1)},Ma=c(function(){console.log("variantIds",Ri),Vr(!0)},[Ri]),Aa={"Let me connect the dots for you...":function(e){if("string"==typeof e){var n=e.match(/<!--\s*(\{[^}]*"variant_index"[^}]*\})\s*-->/);if(n)try{var t=JSON.parse(n[1]),i=parseInt(t.variant_index,10);if(!isNaN(i)&&i>0){var r=i-1;pr.current!==r&&(console.log("Opening variant accordion: AI index ".concat(i," → 0-based index ").concat(r)),Ti(r),pr.current=r)}}catch(e){console.error("Failed to parse variant_index from HTML comment:",e)}}},"Crafted Instant Learning with C.A.R.E.":function(t){var i,r,a,o=L(t),l=L(t,"general_details");console.log("--- [CARE] Staging Initial Structure ---",o),o&&(jn.current=e(e({},jn.current||{}),o));var u=L(t,"critical_gaps");if(console.log("isCriticalGap",u),Rn(!!u),o){if(o.variant_type&&!("is_variant"in o)){var s=null===(i=ka(o.variant_type||"").toLowerCase().match(/^(default_variant|default|variant)/i))||void 0===i?void 0:i[0];o.variant_type=ee(s)?"Default":"variant",o.isDefault=ee(s),console.log("parsed.variant_type",o.variant_type)}var d=o.scope&&o.scope.length>0?String(o.scope[0]):null,c=d?ka(d).toLowerCase().trim().replace(/ /g,"_"):null,v=Boolean(c&&gt.current!==c);if(v&&c){var p=gt.current;console.log("[Tier Switch Detected]",gt.current,"→",c),gt.current=c,ft.current=null;var _=(bt.current||[]).findIndex(function(e){return!0===(null==e?void 0:e.is_new_variant)});-1===_&&void 0!==Ai&&(_=Ai),p&&-1!==_&&(console.log("[Tier Switch] Stripping draft variant at index ".concat(_," from ").concat(p)),Ht(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),Qt(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),Zt(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),Dt(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),ri(function(t){if(!Array.isArray(t))return t;var i=n([],t,!0);return i[_]&&(i[_]=e(e({},i[_]),{scope:[c],tier_id:c.replace("tier_","")})),bt.current=i,i})),pr.current=-1;var f=c.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()});Be(function(n){return e(e({},n),{tiers:[f]})})}Li(o),yn({Updated_Fields_Response:o,General_Response:l}),(null==l?void 0:l.variant_id)&&"new_variant_id"===(null==l?void 0:l.variant_id)&&(l.variant_id=null);var g=null==l?void 0:l.variant_id,m=null==o?void 0:o.learning_metadata,y=null!==(a=null===(r=null==m?void 0:m.properties)||void 0===r?void 0:r.scheduling_config)&&void 0!==a?a:null==m?void 0:m.scheduling_config;if(g&&m&&di(function(n){var t,i,r;return e(e({},n),((t={})[g]=e(e(e({},n[g]),m),{properties:e(e(e({},null===(i=n[g])||void 0===i?void 0:i.properties),m.properties),void 0!==y&&{scheduling_config:null!==(r=null==y?void 0:y.value)&&void 0!==r?r:y})}),t))}),(null==l?void 0:l.is_interpretation_ready)&&(null==l?void 0:l.question_id)&&co(l,o,v),(null==l?void 0:l.is_interpretation_ready)&&(null==l?void 0:l.question_id)&&ft.current&&pt)ri(function(n){if(!Array.isArray(n))return n;var t=n.map(function(n){return(null==n?void 0:n.variant_id)&&n.variant_id===pt?e(e({},n),o):n}),i=n.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===pt});return console.log(i,"targetIndexif"),-1!==i&&setTimeout(function(){console.log("targetIndex",i),Ti(i),Qi(function(e){return e+1}),pr.current=i},0),t});else if((null==l?void 0:l.is_interpretation_ready)&&(null==l?void 0:l.question_id)&&ft.current&&!pt){var h=oi["idx-0"]||"";h&&li(function(n){return e(e({},n),{"idx-0":""})}),ri(function(t){var i,r,a=e(e({},o),{is_new_variant:!0,is_variant:!0,learning_metadata:e(e({},o.learning_metadata||{}),{instruction_prompt:h})});if(Array.isArray(t)){var l=t.findIndex(function(e){return!0===e.is_new_variant});if(-1!==l){setTimeout(function(){Ti(l),Qi(function(e){return e+1}),pr.current=l},0);var u=t[l].client_id||w(),s=(null===(i=t[l].learning_metadata)||void 0===i?void 0:i.instruction_prompt)||h,d=t[l].learning_metadata||{};r=t.map(function(n,t){return t===l?e(e(e({},n),a),{client_id:u,learning_metadata:e(e(e({},d),a.learning_metadata||{}),{instruction_prompt:s})}):n})}else{var c=t.length;setTimeout(function(){Ti(c),Qi(function(e){return e+1}),pr.current=c},0),r=n(n([],t,!0),[e(e({},a),{client_id:w()})],!1)}}else setTimeout(function(){Ti(0),Qi(function(e){return e+1}),pr.current=0},0),r=[e(e({},a),{client_id:w()})];return bt.current=r,r})}else(null==l?void 0:l.is_interpretation_ready)&&(ri([o]),setTimeout(function(){Ti(0),Qi(function(e){return e+1}),pr.current=0},0));void 0!==o.is_user_accepted_risk&&ri(function(t){var i=W({flow:ke,editingRule:Ae,editingVariants:Se}),r=Array.isArray(t)?n([],t,!0):[];if(i&&0===r.length&&Se&&Se.length>0&&(r=Se.map(function(e,n){var t;return{variant_type:e.variantType||"variant ".concat(n+1),title:(null==Ae?void 0:Ae.ruleTitle)||"",rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",is_valid:!0,is_readOnly:e.variantId!==pt,variant_id:e.variantId,tier_id:(null===(t=e.tier)||void 0===t?void 0:t.tier_id)||"1",is_user_accepted_risk:e.is_user_accepted_risk||!1}})),i){var a=Qr||Zr,l=r.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===a||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===a||(null==e?void 0:e.id)&&e.id===a});if(-1===l&&void 0!==Ai&&(l=Ai),-1!==l)return r[l]=e(e({},r[l]),{is_user_accepted_risk:!!o.is_user_accepted_risk}),r}return t})}},"RHS Validation Agent Response":function(t){var i,r,a,o=t;if("string"==typeof t)try{o=JSON.parse(t)}catch(e){o=O(t)}if(bn(o),console.log("--- [RHS] Updating Staged Logic ---"),console.log("parsed data from RHS Validation",o),o){Li(function(n){var t=n;if(!t){console.log("⚠️ No staged response found! Constructing fallback from current UI state...");var i=null;if(Array.isArray(ii)){var r=W({flow:ke,editingRule:Ae,editingVariants:Se}),a=Qr||Zr,l=-1;r&&a&&(l=ii.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===a||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===a||(null==e?void 0:e.id)&&e.id===a})),-1===l&&void 0!==Ai&&(l=Ai),-1!==l&&(i=ii[l])}t=i?e({},i):{wta:"",wnta:""}}return e(e({},t),{wta:t.wta,wnta:t.wnta,is_valid:o.is_valid,conflictingConditions:o.conflictingConditions||[],conflictMarkdown:{},conflict_view:o.conflict_view||{}})});var l=Array.isArray(o.scope)&&o.scope[0]||o.tier||null,u=(l?ne(ka(String(l)).trim()):null)||gt.current||mt.current||(Te?ne(Te):null)||"tier_1";console.log("[RHS] Resolved tierKey for conflict injection:",u);var s=function(){var e,n=bt.current;if(Array.isArray(n)&&n.length>0){var t,i=n.findIndex(function(e){return!0===(null==e?void 0:e.is_new_variant)});if(-1!==i)return console.log("[RHS] Resolved via is_new_variant flag:",i),i;if(pt)if(-1!==(t=n.findIndex(function(e){return(null==e?void 0:e.variant_id)===pt||(null==e?void 0:e.new_variant_id)===pt})))return t;if(Qr)if(-1!==(t=n.findIndex(function(e){return(null==e?void 0:e.variant_id)===Qr||(null==e?void 0:e.new_variant_id)===Qr})))return t;var r=null!==(e=null==Se?void 0:Se.length)&&void 0!==e?e:0;if(n.length>r){var a=n.length-1;return console.log("[RHS] Resolved via length diff (new variant appended):",a),a}}var o=void 0!==Ai?Ai:0;return console.log("[RHS] Fallback index used:",o),o}();if(console.log("Resolved variant index for conflict injection:",s),!1===o.is_valid)((null===(i=o.conflictingConditions)||void 0===i?void 0:i.length)||0)>0&&(Sr(function(n){var t=e({},n);return o.conflictingConditions.forEach(function(e){e.condition_wnta&&!e.condition_wta?t["whenNotToApply-".concat(u,"-").concat(s)]=e.reason:t["whenToApply-".concat(u,"-").concat(s)]=e.reason}),t}),Er("")),o.conflict_view&&((null===(r=o.conflict_view.wta)||void 0===r?void 0:r.length)>0&&Qt(function(t){var i=new Map(t),r=new Map(i.get(u)||new Map),a=n([],r.get(s)||[],!0);return o.conflict_view.wta.forEach(function(n){var t=a.findIndex(function(e){return e.text.trim()===n.value});-1!==t?a[t]=e(e({},a[t]),{conflict:n}):a.push({id:"conflict-wta-".concat(Date.now(),"-").concat(Math.random()),text:n.value,conflict:n})}),r.set(s,a),i.set(u,r),i}),(null===(a=o.conflict_view.wnta)||void 0===a?void 0:a.length)>0&&Zt(function(t){var i=new Map(t),r=new Map(i.get(u)||new Map),a=n([],r.get(s)||[],!0);return o.conflict_view.wnta.forEach(function(n){var t=a.findIndex(function(e){return e.text.trim()===n.value});-1!==t?a[t]=e(e({},a[t]),{conflict:n}):a.push({id:"conflict-wnta-".concat(Date.now(),"-").concat(Math.random()),text:n.value,conflict:n})}),r.set(s,a),i.set(u,r),i}));else!0===o.is_valid&&(Sr({}),Er(""),Qt(function(n){var t=new Map(n),i=new Map(t.get(u)||new Map),r=i.get(s)||[];return i.set(s,r.map(function(n){return e(e({},n),{conflict:void 0})})),t.set(u,i),t}),Zt(function(n){var t=new Map(n),i=new Map(t.get(u)||new Map),r=i.get(s)||[];return i.set(s,r.map(function(n){return e(e({},n),{conflict:void 0})})),t.set(u,i),t}))}},"User Action Execution":function(n){console.log("--- [User Action] Execution ---",n);var t=R(n);if(console.log("parsedaction",t),"load"===(null==t?void 0:t.action)&&(null==t?void 0:t.question_id)&&co(t,null),"save"===(null==t?void 0:t.action)){var i=null==t?void 0:t.save_details;if(i&&Object.keys(i).length>0){var o=Object.keys(i),l=o.sort().map(function(e){return"".concat(e,":").concat(i[e].success,":").concat(i[e].is_updated)}).join("|");if(mn.current.has(l))return;mn.current.add(l);var u=o.every(function(e){return i[e].success});if(o.forEach(function(n){var t,o,l=i[n];if(l.success)null===(t=_r.current)||void 0===t||t.show({severity:"success",sticky:!1,life:3e3,className:E.toastSuccess,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(g,{className:E.iconSuccess}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleSuccess)},{children:"Success"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageSuccess)},{children:l.is_updated?"Changes saved successfully test!":"Learning saved successfully test!"}))]}))});else{var u=l.message||"Error Occurred while saving the rule.";null===(o=_r.current)||void 0===o||o.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:u}))]}))})}}),u){var s=new Map,d=o.map(function(e){return{id:e,action:i[e].is_updated?"existing":"new"}});He.tiers.forEach(function(e){var n=e.toLowerCase().replace(/ /g,"_");s.set(n,d)}),T.getState().setCreatedVariantInfo(Array.from(s.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),Or(!0),setTimeout(function(){uo()},3e3)}}else(null==t?void 0:t.is_save)&&(Or(!0),Dr(!0))}"discard_rule"===(null==t?void 0:t.action)&&(ri([{variant_id:void 0,rule_description:"",wta:"",wnta:"",variant_type:"variant"}]),gi([]),_t(null),Ti(0),Qi(0),ut(null),it(!1),$n(!1),xi([]),ft.current=null,kn.current=!1,Jt(""),ta(null),Dt(new Map([["tier_1",new Map([[0,Lt]])],["tier_2",new Map([[0,Lt]])],["tier_3",new Map([[0,Lt]])]])),Ht(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Qt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Zt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])))},"Validation Agent Response":function(t){var i,r;if(console.log("--- [Validation Agent] Committing Staged Data to UI ---"),console.log("raw data from Validation Agent",t,typeof t),"string"==typeof t){var a=t.match(/<!--\s*```json\s+property="rule_validation_card"\s+([\s\S]*?)```\s*-->/i);if(a&&a[1])try{var o=JSON.parse(a[1].trim()),l=null===(r=null===(i=null==o?void 0:o.validated_rules)||void 0===i?void 0:i[0])||void 0===r?void 0:r.rule_id;l&&(console.log("Setting default comparison ID:",l),Yn(l))}catch(e){console.error("Failed to parse rule_validation_card JSON",e)}}var u=L(t,"critical_gaps");console.log("isCriticalGap",u),Rn(!!u);var s="string"==typeof t?R(t):t;console.log("parsed data from Validation Agent",s);var d=x(t);Mn(s);var c=!!(null==s?void 0:s.is_variant),v=void 0===(null==s?void 0:s.close_modal)||!!(null==s?void 0:s.close_modal),p=void 0!==(null==s?void 0:s.is_save)&&!!(null==s?void 0:s.is_save);Or(v),Dr(p);var _=null==s?void 0:s.action,f="string"==typeof(null==s?void 0:s.edit_variant_id)&&s.edit_variant_id.trim()?s.edit_variant_id:"string"==typeof(null==s?void 0:s.set_variant_id)&&s.set_variant_id.trim()?s.set_variant_id:null,g="variant"===_&&c;if((null==s?void 0:s.edit_variant_id)&&!g&&zr(s.edit_variant_id),"edit"!==_&&"edit_current_rule"!==_||!f||Xr(f),g&&(zr(null),Xr(null)),"discard"===_)return console.log("Action 'discard' received: Resetting UI state but preserving chat."),et.current=!0,ba(!0),ri([]),cr.current=null,void(vr.current=null);Br(_);var m=null==s?void 0:s.new_variant_id,w="edit"===(null==s?void 0:s.action)&&(null==s?void 0:s.set_variant_id)&&!Se;(null==s?void 0:s.is_valid)?(Sr({}),Li(function(t){var i,r,a,o,l,u,d,c,v,p,_,g;if(console.log("⏮️ PREVIOUS Staged Response:",t),!t)return console.warn("⚠️ No previous staged response found"),t;var m=function(e,n){return Object.prototype.hasOwnProperty.call(e||{},n)},w=e(e({},t),s);Array.isArray(null===(i=null==s?void 0:s.condition_result)||void 0===i?void 0:i.when_to_apply)?w.wta=s.condition_result.when_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join(" OR "):m(s,"wta")&&void 0!==(null==s?void 0:s.wta)&&(w.wta=null!==(r=null==s?void 0:s.wta)&&void 0!==r?r:""),Array.isArray(null===(a=null==s?void 0:s.condition_result)||void 0===a?void 0:a.when_not_to_apply)?w.wnta=s.condition_result.when_not_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join(" OR "):m(s,"wnta")&&void 0!==(null==s?void 0:s.wnta)&&(w.wnta=null!==(o=null==s?void 0:s.wnta)&&void 0!==o?o:""),console.log("finalData",w),console.log("checking parsed here :",s);var y,h=f;if(Array.isArray(ii)&&h&&(y=h,ii.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===y||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===y||(null==e?void 0:e.id)&&e.id===y})),"edit"!==(null==s?void 0:s.action)||!Ae&&!Se)return w;console.log("inside edit flow merge");var b=Se||[],I=f,M=I?b.findIndex(function(e){return e.variantId===I||e.variant_id&&e.variant_id===I||e.id&&e.id===I}):-1;if(-1===M&&(null==s?void 0:s.set_variant_id)&&(M=b.findIndex(function(e){return e.variantId===s.set_variant_id||e.variant_id&&e.variant_id===s.set_variant_id||e.id&&e.id===s.set_variant_id})),-1===M&&I&&Array.isArray(ii)&&(M=ii.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===I||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===I||(null==e?void 0:e.id)&&e.id===I})),-1!==M){var A,T,S,k=b[M]||(null==ii?void 0:ii[M]),C=(null==k?void 0:k.tier_id)||(null==k?void 0:k.tierId)||"1",E=(null==Te?void 0:Te.toLowerCase().replace(/ /g,"_"))||"tier_".concat(C);if(pr.current!==M&&(Ti(M),pr.current=M),Array.isArray(null===(l=s.condition_result)||void 0===l?void 0:l.when_to_apply)?A=s.condition_result.when_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join("\n"):m(s,"wta")&&void 0!==(null==s?void 0:s.wta)?A=null!==(u=null==s?void 0:s.wta)&&void 0!==u?u:"":m(t,"wta")&&void 0!==(null==t?void 0:t.wta)&&(A=null!==(d=null==t?void 0:t.wta)&&void 0!==d?d:""),Array.isArray(null===(c=s.condition_result)||void 0===c?void 0:c.when_not_to_apply)?T=s.condition_result.when_not_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join("\n"):m(s,"wnta")&&void 0!==(null==s?void 0:s.wnta)?T=null!==(v=null==s?void 0:s.wnta)&&void 0!==v?v:"":m(t,"wnta")&&void 0!==(null==t?void 0:t.wnta)&&(T=null!==(p=null==t?void 0:t.wnta)&&void 0!==p?p:""),void 0!==A){var N=ka(A);Ca(E,M,A,N,Kt,Qt,null==s?void 0:s.conflict_view),wa(E,M,"wta")}if(void 0!==T){var L=ka(T);Ca(E,M,T,L,$t,Zt,null==s?void 0:s.conflict_view),wa(E,M,"wnta")}if(m(s,"rule_description")&&void 0!==(null==s?void 0:s.rule_description)?S=null!==(_=null==s?void 0:s.rule_description)&&void 0!==_?_:"":m(t,"rule_description")&&void 0!==(null==t?void 0:t.rule_description)&&(S=null!==(g=null==t?void 0:t.rule_description)&&void 0!==g?g:""),void 0!==S){var O=ka(S);Ht(function(e){var n=new Map(e),t=new Map(n.get(E)||new Map);return t.set(M,O),n.set(E,t),n}),wa(E,M,"ruleDescription")}var R=void 0;m(s,"scheduling_config")&&void 0!==(null==s?void 0:s.scheduling_config)?R=null==s?void 0:s.scheduling_config:m(t,"scheduling_config")&&void 0!==(null==t?void 0:t.scheduling_config)&&(R=null==t?void 0:t.scheduling_config),R&&(Dt(function(e){var n,i,r,a,o,l,u=new Map(e),s=new Map(u.get(E)||new Map);return s.set(M,{order_rules:{enabled:!!(null===(n=R.order_rules)||void 0===n?void 0:n.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(i=R.order_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)/60)},advertiser_rules:{enabled:!!(null===(r=R.advertiser_rules)||void 0===r?void 0:r.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(a=R.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds)||0)/60)},inventory_rules:{respect_inventory_code:!!(null===(o=R.inventory_rules)||void 0===o?void 0:o.respect_inventory_code)},break_code_rules:{respect_break_code:!!(null===(l=R.break_code_rules)||void 0===l?void 0:l.respect_break_code)},is_default_enabled:"Default"===(null==t?void 0:t.variant_type)||"default_variant"===(null==t?void 0:t.variant_type)||"default"===(null==t?void 0:t.variant_type)}),u.set(E,s),u}),wa(E,M,"order_enabled"),wa(E,M,"advertiser_enabled"),wa(E,M,"respect_inventory_code"),wa(E,M,"respect_break_code")),ri(function(t){if(!Array.isArray(t)||M<0||!t[M])return t;var i=n([],t,!0),r=e({},i[M]);return void 0!==A&&(r.wta=A),void 0!==T&&(r.wnta=T),void 0!==S&&(r.rule_description=ka(S)),R&&(r.scheduling_config=R),i[M]=r,i});var x=null==t?void 0:t.variant_type;x&&ri(function(t){var i=Array.isArray(t)?n([],t,!0):[],r=i.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===I||(null==e?void 0:e.variant_id)&&e.variant_id===(null==s?void 0:s.set_variant_id)||(null==e?void 0:e.variantId)===I});return-1!==r?i[r]=e(e({},i[r]),{variant_type:x}):i[M]=e(e({},i[M]||{}),{variant_type:x,variant_id:I||(null==s?void 0:s.set_variant_id)}),i})}})):console.warn("⚠️ parsed.is_valid is false, not committing to structuredAIResponse"),w||(c?(yi(!0),m&&m!==vr.current?(console.log("🚀 New Variant detected (".concat(m,"). Triggering loader.")),Mr(!0),Ur("Loading a variant"),console.log("reaching here in new variant flow"),Wr("This may take a moment as we update the rule with the new variant."),vr.current=m):m||console.log("ℹ️ Variant flow detected without specific ID.")):(yi(!1),vr.current=null),d&&xi(d))},"Rule comparison results":function(n){var t;if(kt){var i=function(n){if("string"!=typeof n)return n;try{var t=Array.from(n.matchAll(/<!--\s*```json\s*([\s\S]*?)\s*```\s*-->/g));if(0===t.length)return JSON.parse(n);var i=t.map(function(e){try{return JSON.parse(e[1].trim())}catch(e){return console.error("Failed to parse JSON block:",e),null}}).filter(function(e){return null!==e});return 1===i.length?i[0]:i.length>1?i.reduce(function(n,t){return e(e({},n),t)},{}):null}catch(e){return console.error("Error extracting JSON:",e),null}}(n);console.log(" LLM Push Comparison Received:",i);var r=null===(t=i[0])||void 0===t?void 0:t.current_rule_details;r&&Fn({title:r.rule_title||"",description:r.description||"",scope:r.scope||"",wta:Array.isArray(r.wta)?r.wta.join("\n"):r.wta||"",wnta:Array.isArray(r.wnta)?r.wnta.join("\n"):r.wnta||""});var a=i.map(function(e){var n,t,i=e.variant_rule_details||{},r=e.rule_difference_comparison||{},a=i.when_to_apply||i.wta||"",o=i.when_not_to_apply||i.wnta||"";return{id:(null==i?void 0:i.variant_id)&&i.variant_id||(null==i?void 0:i.id)&&i.id||"fallback-id-".concat(Math.random()),title:i.variant_title||i.rule_title||"",description:i.variant_text||i.description||"",scope:i.scope||"",wta:Array.isArray(a)?a.join("\n"):a,wnta:Array.isArray(o)?o.join("\n"):o,similarity:(null===(n=r.summary)||void 0===n?void 0:n.overall_score)||0,summaryText:(null===(t=r.summary)||void 0===t?void 0:t.overall_summary)||"",analysis:{rule_difference_comparison:r},isLoading:!1}});qn(a)}else try{i=n;if("string"==typeof n)try{i=JSON.parse(n)}catch(e){i=R(n)||[]}if(!Array.isArray(i)){if(!i||"object"!=typeof i)return void console.error("[Rule comparison results] Data is not an array:",n);i=[i]}a=i.map(function(e,n){var t,i,r,a,o=null,l=null;if((Array.isArray(e)?e:[e]).forEach(function(e){e&&(e.intent_output&&(o=e.intent_output),e.behaviour_output&&(l=e.behaviour_output))}),"string"==typeof o)try{o=JSON.parse(o)}catch(e){console.error("Failed to parse intent_output",e)}if("string"==typeof l)try{l=JSON.parse(l)}catch(e){console.error("Failed to parse behaviour_output",e)}var u="existing_variant",s="fallback-id-".concat(Math.random()),d=(null==o?void 0:o.documents)||(null==l?void 0:l.documents);if(d){var c=Object.keys(d).find(function(e){return"reference"===d[e].role});c&&(u=c,s=null==l?void 0:l.rule_id)}var v="";if((null==o?void 0:o.nodes)&&o.nodes.title){var p=o.nodes.title;(null===(i=null===(t=null==p?void 0:p.comparison_inputs)||void 0===t?void 0:t[u])||void 0===i?void 0:i.content)&&(v=p.comparison_inputs[u].content)}var _="Score";(null==l?void 0:l.final_score)&&(_=l.final_score);var f="Unknown Tier",g=(null===(r=null==d?void 0:d[u])||void 0===r?void 0:r.title)||(null===(a=null==d?void 0:d.existing_variant)||void 0===a?void 0:a.title);return g&&g.includes("|")&&(f=g.split("|")[1].trim()),console.log("Extracted for carousel:",{uniqueId:s,extractedTitle:v,extractedScore:_,extractedScope:f}),{id:s,title:v,similarityScoreText:_,scope:f,intentTreeData:o,behaviorTreeData:l,isLoading:!1}});qn(a)}catch(e){console.error("[Rule comparison results] Critical Handler Error:",e)}}},Ta=St?["Tier 1","Tier 2","Tier 3"]:gn.map(function(e){return e.tier_name.replace(/(\d+)/," $1").replace(/\b\w/g,function(e){return e.toUpperCase()}).trim()}),Sa=function(e){var n=Array.isArray(e)?e.join(" "):String(e||""),t=null==n?void 0:n.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/);return t?t[1]:null},ka=function(e){return"string"!=typeof e?"":e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,"").replace(/<!--```json[\s\S]*?```-->/g,"").trim()},Ca=function(t,i,r,a,o,l,u){var s;if(void 0!==r){var d=(o.get(t)||new Map).get(i)||[],c=d.map(function(e){return e.text}).join("\n"),v=(null===(s=d[(null==d?void 0:d.length)-1])||void 0===s?void 0:s.reasoning)||"",p=Sa(r)||"";if(""===r&&d.length>0||a.trim()!==c.trim()||p!==v){var _=""===r?{updatedItems:[],newIds:[]}:function(t,i,r){if(!t.trim())return{updatedItems:n([],i,!0),newIds:[]};var a=t.match(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g)||[],o=t.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,"").replace(/<!--```json[\s\S]*?```-->/g,""),l=[],u=o.replace(/<conflicting>[\s\S]*?<\/conflicting>/g,function(e){return l.push(e),"__CONFLICT_BLOCK_".concat((null==l?void 0:l.length)-1,"__")}).split(/\s*(?:\r?\n|\\+n)\s*/).map(function(e){return e.trim().replace(/^-\s*/,"")}).filter(Boolean),s=new Map(i.map(function(e){return[e.text,e]})),d=[],c=[],v=Array.isArray(null==r?void 0:r.wta)&&t.includes("wta")?r.wta:Array.isArray(null==r?void 0:r.wnta)?r.wnta:[];return u.forEach(function(n,t){var i=n;i.includes("__CONFLICT_BLOCK_")&&(i=i.replace(/__CONFLICT_BLOCK_(\d+)__/g,function(e,n){return l[parseInt(n)]}));var r=a[t]||"",o=i.replace(/<conflicting>[\s\S]*?<\/conflicting>/g,"").trim(),u=null==v?void 0:v.find(function(e){return e.value===o}),p=s.get(i);if(p)c.push(e(e({},p),{reasoning:r||p.reasoning,conflict:u||p.conflict}));else{var _="new-".concat(Date.now(),"-").concat(t);d.push(_),c.push({id:_,text:i,reasoning:r,conflict:u})}}),{updatedItems:c,newIds:d}}(r,d,u),f=_.updatedItems,g=_.newIds;l(function(e){var n=new Map(e),r=new Map(n.get(t)||new Map);return r.set(i,f),n.set(t,r),n}),(null==g?void 0:g.length)>0&&(Hi(function(e){return new Set(n(n([],Array.from(e),!0),g,!0))}),setTimeout(function(){Hi(function(e){var n=new Set(e);return g.forEach(function(e){return n.delete(e)}),n})},1500))}}},Ea=function(e){return(Array.isArray(e)?e:e?[e]:[]).map(function(e){return String(e).replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/,"").trim().replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()})})};d(function(){ki&&!_n.current&&"save this learning"!==ki.toLowerCase()&&(sn(!1),on(""),pr.current=null!=Ai?Ai:-1)},[ki]),d(function(){var t,i,r,a,o,l,u,s,d;if(ht.current=er,Array.isArray(ii)&&ii.length>0){var c=ir||"local-".concat(Date.now()),v=["ruleTitle","ruleDescription","whenToApply","whenNotToApply","scopeData","configData"],p={},_=cr.current||[];ii.forEach(function(t,i){var r,a;if(t){t.is_readOnly||(Dn.current=i);var o=i;if((null==t?void 0:t.variant_id)&&Se)-1!==(l=Se.findIndex(function(e){return e.variantId===t.variant_id}))&&(o=l);else if(Qr&&Se&&1===ii.length){var l;-1!==(l=Se.findIndex(function(e){return e.variantId===Qr}))&&(o=l)}var u=null!==(r=_[o])&&void 0!==r?r:_[i],s=null!==(a=t.scope)&&void 0!==a?a:null==u?void 0:u.scope,d=Ea(s).map(function(e){return e.toLowerCase().replace(/ /g,"_")}),c=Xn.current.get(o),f=d.length>0?d:c&&c.length>0?c:["tier_1"];f.length>0&&Xn.current.set(o,f);var g=He.tiers.map(function(e){return ne(e)}),m=f.filter(function(e){return g.includes(e)});0===m.length&&console.warn("[tier guard] Dropping write — resolved tier(s) [".concat(f.join(", "),"] not in selected tiers [").concat(g.join(", "),"]"));var w=ka(t.title);w&&w!==ka(null==u?void 0:u.title)&&!t.is_readOnly&&function(e,n,t,i,r,a){var o=ka(i);o&&o!==r&&(wa(e,n,t),a(o))}("global",0,"ruleTitle",t.title,qt,Jt),m.forEach(function(r){var a,l,u,s,d,c=null!==(a=_[o])&&void 0!==a?a:_[i],f=!c,g=void 0!==t.rule_description&&null!==t.rule_description,m=ka(t.rule_description),w=(null===(l=Yt.get(r))||void 0===l?void 0:l.get(o))||"",y=ka(w);g&&(m!==y||""===m&&""!==w)&&(Ht(function(e){var n=new Map(e),i=new Map(n.get(r)||new Map);return i.set(o,t.rule_description),n.set(r,i),n}),wa(r,o,"ruleDescription"));var h=!1===(null==Ni?void 0:Ni.is_valid),b=ka(t.wta),I=ka(null==c?void 0:c.wta),M=(null===(u=Kt.get(r))||void 0===u?void 0:u.get(o))||[];!(h&&""===b&&M.length>0)&&void 0!==t.wta&&null!==t.wta&&(b!==I||""===b&&M.length>0||0===M.length&&""!==b)&&(Ca(r,o,t.wta,b,Kt,Qt,null==Ni?void 0:Ni.conflict_view),wa(r,o,"wta"));var A=ka(t.wnta),T=ka(null==c?void 0:c.wnta),S=(null===(s=$t.get(r))||void 0===s?void 0:s.get(o))||[];if(!(h&&""===A&&S.length>0)&&void 0!==t.wnta&&null!==t.wnta&&(A!==T||""===A&&S.length>0||0===S.length&&""!==A)&&(Ca(r,o,t.wnta,A,$t,Zt,null==Ni?void 0:Ni.conflict_view),wa(r,o,"wnta")),t.scheduling_config||f||t.variant_type||t.variantType){var k=t.scheduling_config||{order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1}},C=null==c?void 0:c.scheduling_config,E=null===(d=xt.get(r))||void 0===d?void 0:d.get(o),N=t.variant_type||t.variantType,L=N?ee(N):void 0,O=JSON.stringify(k)!==JSON.stringify(C),R=void 0!==L&&L!==(null==E?void 0:E.is_default_enabled),x=function(n,t){if(!n)return t;if(!t)return n;var i=e({},n);for(var r in t)t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])?i[r]=e(e({},i[r]||{}),t[r]):i[r]=t[r];return i};if(t.is_readOnly||Gi(function(e){return x(e,k)}),O||R||!t.is_readOnly){Gi(function(e){return x(e,k)});var D=function(e,n,t,i){var r,a,o,l,u=[],s=(i.get(e)||new Map).get(n)||{order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1}};return Math.floor(((null===(r=t.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)||0)/60)!==s.order_rules.global_min_separation_seconds&&u.push("config_order_rules"),Math.floor(((null===(a=t.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds)||0)/60)!==s.advertiser_rules.global_min_separation_seconds&&u.push("config_advertiser_rules"),!!(null===(o=t.inventory_rules)||void 0===o?void 0:o.respect_inventory_code)!==s.inventory_rules.respect_inventory_code&&u.push("config_inventory_rules"),!!(null===(l=t.break_code_rules)||void 0===l?void 0:l.respect_break_code)!==s.break_code_rules.respect_break_code&&u.push("config_break_code_rules"),!!t.is_default_enabled!=!!s.is_default_enabled&&u.push("config_is_default_enabled"),u}(r,o,k,xt);D.forEach(function(e){return wa(r,o,e)}),Vt(function(e){return new Set(e).add("config")}),Dt(function(n){var t,i,a,l,u,s,d=new Map(n),c=new Map(d.get(r)||new Map),v=c.get(o)||Lt;return c.set(o,e(e(e(e(e(e({},v),k.order_rules&&{order_rules:{enabled:!!(null===(t=k.order_rules)||void 0===t?void 0:t.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(i=k.order_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)/60)}}),k.advertiser_rules&&{advertiser_rules:{enabled:!!(null===(a=k.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(l=k.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)||0)/60)}}),k.inventory_rules&&{inventory_rules:{respect_inventory_code:!!(null===(u=k.inventory_rules)||void 0===u?void 0:u.respect_inventory_code)}}),k.break_code_rules&&{break_code_rules:{respect_break_code:!!(null===(s=k.break_code_rules)||void 0===s?void 0:s.respect_break_code)}}),void 0!==L&&{is_default_enabled:L})),d.set(r,c),d}),ni(function(e){var n=new Map(e),t=new Map(n.get(r)||new Map),i=t.get(o)||new Set;return k.order_rules&&i.add("order_rules"),k.advertiser_rules&&i.add("advertiser_rules"),k.inventory_rules&&i.add("inventory_rules"),k.break_code_rules&&i.add("break_code_rules"),void 0!==L&&i.add("is_default_enabled"),t.set(o,i),n.set(r,t),n})}}var j={ruleTitle:t.title,ruleDescription:t.rule_description,whenToApply:t.wta,whenNotToApply:t.wnta,scopeData:t.scope,configData:t.action};t.is_readOnly||v.forEach(function(e){var n=Sa(j[e]),t="ruleTitle"===e||"scopeData"===e?e:"".concat(e,"_").concat(r);n&&(n!==yt.current[t]&&(yt.current[t]=n,It.current[t]=!0,p[t]={reasoning:n,associatedCitations:[],tier:r,variantIndex:o}))}),t.conflictingConditions&&(Sr(function(n){var i=e({},n);return t.conflictingConditions.forEach(function(e){e.condition_wta&&(i["whenToApply-".concat(r,"-").concat(o)]=e.reason),e.condition_wnta&&(i["whenNotToApply-".concat(r,"-").concat(o)]=e.reason)}),i}),Vt(function(e){return new Set(n(n([],Array.from(e),!0),["conditions"],!1))}))})}});var f=-1,g=W({flow:ke,editingRule:Ae,editingVariants:Se}),m="edit"===Hr||"edit_current_rule"===Hr,w=function(e,n){return(null==e?void 0:e.variant_id)&&e.variant_id===n||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===n||(null==e?void 0:e.id)&&e.id===n},y=function(e,n){if(!n)return-1;var t=e.find(function(e){return w(e,n)});if(!t)return-1;var i=String((null==t?void 0:t.tier_id)||"");if(!i)return e.findIndex(function(e){return w(e,n)});var r=e.filter(function(e){return String((null==e?void 0:e.tier_id)||"")===i}).findIndex(function(e){return w(e,n)});return-1!==r?r:e.findIndex(function(e){return w(e,n)})};if(g)if(vr.current&&wi)-1!==(f=ii.findIndex(function(e){return(null==e?void 0:e.new_variant_id)&&e.new_variant_id===vr.current||(null==e?void 0:e.variant_id)&&e.variant_id===vr.current||(null==e?void 0:e.id)&&e.id===vr.current}))&&(vr.current=null);else if(Qr||Zr){var h;(h=Qr||Zr)&&(f=y(ii,h))}else if(Ne&&Array.isArray(ii)&&ii.length>0){for(b=ii.length-1;b>=0;b--)if(ii[b]&&!(null===(i=ii[b])||void 0===i?void 0:i.is_readOnly)){f=b;break}}else null==Ce||cr.current&&0!==cr.current.length||(f=Ce);else if((h=Qr||Zr||vr.current)&&m&&(f=y(ii,h)),!m&&-1===f&&Array.isArray(ii)&&ii.length>0){for(var b=ii.length-1;b>=0;b--)if(ii[b]&&!(null===(t=ii[b])||void 0===t?void 0:t.is_readOnly)){f=b;break}-1===f&&(f=ii.length-1)}-1!==f&&Ai!==f&&(pr.current===f||kn.current&&!m||(console.log("🎯 Setting active variant accordion to index ".concat(f," (").concat(g?"EDIT":"CREATE"," mode)")),Ti(f),pr.current=f));var I=ii[0];if(I){if(I.scope&&JSON.stringify(I.scope)!==JSON.stringify(null===(r=_[0])||void 0===r?void 0:r.scope)&&"copy"!==I.action&&(l=I.scope,u=null===(a=_[0])||void 0===a?void 0:a.scope,s=Ea(l),d=u?Ea(u):[],Be(function(n){return e(e({},n),{tiers:s})}),s.forEach(function(e){var n=e.trim();d.includes(e)||wa("global",0,"scope_".concat(n))})),I.scope_rule_set&&I.scope_rule_set!==(null===(o=_[0])||void 0===o?void 0:o.scope_rule_set)){var M=I.scope_rule_set.toLowerCase().trim();["global","genre","custom"].includes(M)&&(Be(function(n){return e(e({},n),{station:M})}),wa("global",0,"scope_station"))}I.wtl&&Gt(I.wtl)}cr.current=ii.map(function(e){return e?(n=e,"function"==typeof(t=null===globalThis||void 0===globalThis?void 0:globalThis.structuredClone)?t(n):JSON.parse(JSON.stringify(n))):e;var n,t}),Object.keys(p).length>0&&(aa({type:"SAVE_CITATIONS",requestId:c,reasoningMap:p,rawCitations:er}),function(e){var n=e.requestId,t=e.keys,i=e.newReasoningMap,r=e.getLatestReasoning,a=e.currentCitations;console.group("%c Citation Audit: ".concat(n," "),"background: #5928ed; color: #fff; font-weight: bold;");var o={};t.forEach(function(e){var n=r(e),t=!!i[e],l=t?a:(null==n?void 0:n.associatedCitations)||[];o[e]={Status:t?"NEW ✅":n?"FALLBACK 🔄":"EMPTY ❌",Source:t?"Current Msg":n?"History":"N/A","Reasoning Preview":t?i[e].reasoning:(null==n?void 0:n.reasoning)||"None","Full Citations":l}}),console.table(o),console.groupEnd()}({requestId:c,keys:Object.keys(p),newReasoningMap:p,getLatestReasoning:oa,currentCitations:er}),Zi(function(n){var t=e({},n),i=!1;return Object.keys(p).forEach(function(e){var n=p[e];n.reasoning&&t[e]!==n.reasoning&&(t[e]=n.reasoning,i=!0),n.associatedCitations}),i?t:n}))}},[ii,er,ir]),d(function(){var t=Object.keys(It.current);if(0!==t.length){var i={};t.forEach(function(e){i[e]=n([],er,!0)}),It.current={},lr(function(n){return e(e({},n),i)})}},[er]);var Na=function(e){return e.map(function(e){var n;return null===(n=e.match(/\d+/))||void 0===n||n[0],e.replace(/\s+/g,"-"),{name:"Custom",parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:(null==At?void 0:At.CUSTOM_SCOPE_GROUP_NAME)||"",description:(null==Me?void 0:Me.ruleSetDesc)||""}}})},La=function(n,t,i,r){void 0===r&&(r=0);var a=e({},t||{});return n.forEach(function(n,o){var l=n.get(r);l&&l.forEach(function(n){var l,u=t[n]||{},s=i.get(o),d=null==s?void 0:s.get(r),c=null==d?void 0:d[n];if("order_rules"===n||"advertiser_rules"===n){var v=null!==(l=null==c?void 0:c.enabled)&&void 0!==l&&l?60*((null==c?void 0:c.global_min_separation_seconds)||0):0;a[n]=e(e({},u),{global_min_separation_seconds:v})}else a[n]="inventory_rules"===n?e(e({},u),{respect_inventory_code:null==c?void 0:c.respect_inventory_code}):"break_code_rules"===n?e(e({},u),{respect_break_code:null==c?void 0:c.respect_break_code}):"is_default_enabled"===n?null!=c&&c:u})}),a},Oa=function(e,n,t){void 0===t&&(t="variantType");var i=null==e?void 0:e[n];if(!i)return{label:Ia(e),isDefault:!1};var r=i[t]||"",a=ee(r);return{label:"variant ".concat(n+1),isDefault:a}},Ra=function(e,n){var t=ee(e);return{label:"variant ".concat(n+1),isDefault:t}},xa=function(e,n,t){var i;void 0===t&&(t="");var r=null===(i=xt.get(e))||void 0===i?void 0:i.get(n);return r?r.is_default_enabled?"Default":"Variant":ee(t)?"Default":"Variant"},Da=function(n,o){return void 0===o&&(o=!1),t(void 0,void 0,void 0,function(){var t,l,u,s,d,c,v,_,f,g,m,y,b,I,M;return i(this,function(i){switch(i.label){case 0:t=Na(He.tiers),l=T.getState().backwardCompatibility,u=Dn.current,La(ei,Fi,xt,u),i.label=1;case 1:return i.trys.push([1,3,,4]),ze(z),on(""),s=Z(Fi),d=w(),c=[],v=[],_=(ii||[])[u]||{},He.tiers.forEach(function(i){var r,a,o,p,f,g,m,y,b,I,M,A,T,S,k,C,E,N,L=i.toLowerCase().replace(/ /g,"_");v.push(L);var O=(null===(r=Yt.get(L))||void 0===r?void 0:r.get(u))||"",R=(null===(a=Kt.get(L))||void 0===a?void 0:a.get(u))||[],x=(null===(o=$t.get(L))||void 0===o?void 0:o.get(u))||[];if(!1===l){var D=[e(e({},s&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},s)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},tierLinkId:d,variant:ka(O),conditions_whentoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:x.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null===(g=null===(f=null===(p=xt.get(L))||void 0===p?void 0:p.get(u))||void 0===f?void 0:f.is_default_enabled)||void 0===g||g,tier_id:(null===(m=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===L||e.tier_name.toLowerCase()===L.replace(/_/g,"")}))||void 0===m?void 0:m.tier_id)||"",topic_id:null,scope_id:(null==Me?void 0:Me.ruleSetId)||"",question_title:qt,variantType:xa(L,u,_.variant_type||_.variantType),learning_metadata:J(Qa,Xa),instantLearningType:At.INSTANT_LEARNING_TYPE,is_user_accepted_risk:!1,propagation:!0,applicationMappingId:Fe,modeId:Ue})];c.push(h(D,At.ASSISTANT_NAME))}else{D={status:"approved",metadata:e(e({userName:null!==(y=null==ia?void 0:ia.firstname)&&void 0!==y?y:"",userEmailId:null!==(b=null==ia?void 0:ia.email)&&void 0!==b?b:"",llm:G.MODEL,isVariantFlow:!0},s&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},s)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:d,variant:ka(O),conditions_whentoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:x.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:t[0]||{name:G.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:G.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null===(A=null===(M=null===(I=xt.get(L))||void 0===I?void 0:I.get(u))||void 0===M?void 0:M.is_default_enabled)||void 0===A||A,tier:{name:i.split(" ").join("").toLowerCase(),tierGroupName:G.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(i.split(" ")[1]||"1"),tier_id:(null===(T=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===L||e.tier_name.toLowerCase()===L.replace(/_/g,"")}))||void 0===T?void 0:T.tier_id)||""},topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:G.CATEGORY,description:G.CATEGORY}],originalQuestion:qt,questionId:n.get(L)||null,variantType:xa(L,u,_.variant_type||_.variantType),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(S=null==ia?void 0:ia.email)&&void 0!==S?S:"",instantLearningType:G.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(k=null==_?void 0:_.is_user_accepted_risk)&&void 0!==k?k:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0}),appsecData:{application:null!==(C=null==Ct?void 0:Ct.applicationId)&&void 0!==C?C:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(E=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==E?E:"",applicationLevelResourceId:null!==(N=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==N?N:""}};c.push(h(D,At.ASSISTANT_NAME))}}),[4,Promise.all(c)];case 2:return f=i.sent(),pn(!1),console.log("✅ All feedback published:",f),ze(K),Xe(!0),g=new Map,f.forEach(function(e,n){var t,i,r=v[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)&&e.data.variant_id||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id)&&e.variant_id;if(a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data),a&&"string"==typeof a){var o=g.get(r)||[];o.push({id:a,action:"new"}),g.set(r,o)}}),T.getState().setCreatedVariantInfo(Array.from(g.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),dn.current=setTimeout(function(){Lr||o?(console.log("Closing modal after save success",{isCloseModal:Lr,forceClose:o}),uo()):ba(!0)},3e3),[3,4];case 3:return m=i.sent(),console.error("❌ Error publishing feedback:",m),pn(!1),ze(Q),sn(!0),y=(null===(I=null==m?void 0:m.response)||void 0===I?void 0:I.data)||{},console.log("errorData: ",y),(b="Variant already exists"===(null==y?void 0:y.message))||409===(null==m?void 0:m.status)?on('Looks like a similar rule already exists with the same conditions. You can update the description or conditions to make it unique, or discard this learning. <br/> How would you like to proceed?\n <br/><button class="clickable-button" data-value="Discard learning">Discard learning</button>\n <br/><button class="clickable-button" data-value="Continue editing learning">Continue editing learning</button>\n <br/><button class="clickable-button" id="typeYourAnswer">Or, type your response</button>'):on(((null==y?void 0:y.message)||(null==y?void 0:y.detail)||"Error Occurred while saving the rule.")+'Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),null===(M=_r.current)||void 0===M||M.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:b||409===(null==m?void 0:m.status)?"Similar rule already exists. Please update and try again.":(null==y?void 0:y.message)||(null==y?void 0:y.detail)||"Something went wrong while saving the learning!"}))]}))}),[3,4];case 4:return[2]}})})},ja=function(){return t(void 0,void 0,void 0,function(){var t,o,l,u,s,d,c,v,_,f,g,m,y,I,M,A,S,k,C,N,L,O,R,x,D;return i(this,function(i){switch(i.label){case 0:t=T.getState().tiers,La(ei,Fi,xt),o=Z(Fi),l=Dn.current,u=(ii||[])[l]||{},s=(null==Ni?void 0:Ni.variant_type)||u.variant_type||"",i.label=1;case 1:if(i.trys.push([1,3,,4]),ze(z),on(""),c=(d=Se||[]).length>0?null===(N=d.find(function(e){return(null==e?void 0:e.link_id)&&""!==e.link_id.trim()}))||void 0===N?void 0:N.link_id:null,v=(null===(L=He.tiers[0])||void 0===L?void 0:L.toLowerCase().replace(/ /g,"_"))||"tier_1",_=(null===(O=Yt.get(v))||void 0===O?void 0:O.size)||d.length,f=n([],d,!0),0===_)return console.warn("[saveEditedVariant] No variants to save (editingVariants empty and no ruleDescription entries for",v,"). Aborting save."),ze(Q),pn(!1),on("Nothing to save — no variant data found for this tier."),[2];for(g=d.length;g<_;g++)f.push({isNewVariant:!0,variantId:w()});return m=[],y=[],I=Na(He.tiers),He.tiers.forEach(function(n){var i=n.toLowerCase().replace(/ /g,"_"),r=t.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===i||e.tier_name.toLowerCase()===i.replace(/_/g,"")}),a=Yt.get(i),l=Kt.get(i),d=$t.get(i);f.forEach(function(t,v){var p,_,f,g,M,A,T,S,k,C,E,N,L,O,R,x,D,j,P,V,F,G,U,q,J,W,Y,H,B,K,Q,z,X,ne,te,ie,re,ae,oe,le,ue,se,de=(null==a?void 0:a.get(v))||t.description||"",ce=(null==l?void 0:l.get(v))||[],ve=(null==d?void 0:d.get(v))||[];if(t.isNewVariant){y.push({tierKey:i,payloadType:"new"}),La(ei,Fi,xt,v);var pe=Z(Fi);if(!1===St){var _e={status:"approved",metadata:e(e({userName:null!==(p=null==ia?void 0:ia.firstname)&&void 0!==p?p:"",userEmailId:null!==(_=null==ia?void 0:ia.email)&&void 0!==_?_:"",llm:At.MODEL,isVariantFlow:!0},pe&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},pe)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:c||w(),variant:ka(de),conditions_whentoapply:ce.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:ve.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:I[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(M=null===(g=null===(f=xt.get(i))||void 0===f?void 0:f.get(v))||void 0===g?void 0:g.is_default_enabled)&&void 0!==M?M:ee(t.variantType||t.variant_type||(0===v?"Default":"variant")),tier:{name:n.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(n.split(" ")[1]||"1")},topic:{id:null,value:"".concat(He.station,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:null==Ae?void 0:Ae.ruleId,variantType:xa(i,v,u.variant_type||""),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(A=null==ia?void 0:ia.email)&&void 0!==A?A:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(S=null===(T=(ii||[])[v])||void 0===T?void 0:T.is_user_accepted_risk)&&void 0!==S?S:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0})};console.log("payload (publish new variant)",_e),m.push(h(_e,At.ASSISTANT_NAME))}else{_e={status:"approved",metadata:e(e({userName:null!==(k=null==ia?void 0:ia.firstname)&&void 0!==k?k:"",userEmailId:null!==(C=null==ia?void 0:ia.email)&&void 0!==C?C:"",llm:At.MODEL,isVariantFlow:!0},pe&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},pe)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:c||w(),variant:ka(de),conditions_whentoapply:ce.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:ve.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:I[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(L=null===(N=null===(E=xt.get(i))||void 0===E?void 0:E.get(v))||void 0===N?void 0:N.is_default_enabled)&&void 0!==L?L:ee(t.variantType||t.variant_type||(0===v?"Default":"variant")),tier:{name:n.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(n.split(" ")[1]||"1")},topic:{id:null,value:"".concat(He.station,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:null==Ae?void 0:Ae.ruleId,variantType:xa(i,v,u.variant_type||""),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(O=null==ia?void 0:ia.email)&&void 0!==O?O:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(x=null===(R=(ii||[])[v])||void 0===R?void 0:R.is_user_accepted_risk)&&void 0!==x?x:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0}),appsecData:{application:null!==(D=null==Ct?void 0:Ct.applicationId)&&void 0!==D?D:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(j=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==j?j:"",applicationLevelResourceId:null!==(P=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==P?P:""}};console.log("payload (publish new variant)",_e),m.push(h(_e,At.ASSISTANT_NAME))}}else{y.push({tierKey:i,payloadType:"existing",existingId:t.variantId});var fe=t.variantId===Qr,ge=xa(i,v,fe?s||t.variantType||"":t.variantType||""),me=e(e({variantId:t.variantId,ruleDesc:(null==Me?void 0:Me.ruleSetDesc)||"",whenToApply:ce.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),whenNotToApply:ve.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null!==(G=null===(F=null===(V=xt.get(i))||void 0===V?void 0:V.get(v))||void 0===F?void 0:F.is_default_enabled)&&void 0!==G?G:ee(t.variantType||t.variant_type||(0===v?"Default":"variant")),tier:{tier_id:(null==r?void 0:r.tier_id)||"",tier_name:(null==r?void 0:r.tier_name)||n,tier_priority:null!==(U=null==r?void 0:r.tier_priority)&&void 0!==U?U:null},scope_id:(null==Me?void 0:Me.ruleSetId)||"",description:ka(de)||"",topic:"".concat(He.station,"RuleSet")},o&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},o)}}}),{tierLinkId:null!=c?c:null,variantType:ge,is_user_accepted_risk:!!(null!==(J=null===(q=(ii||[])[v])||void 0===q?void 0:q.is_user_accepted_risk)&&void 0!==J?J:null==t?void 0:t.is_user_accepted_risk),is_enabled:t.is_enabled,appsecData:{application:null!==(W=null==Ct?void 0:Ct.applicationId)&&void 0!==W?W:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(Y=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==Y?Y:"",applicationLevelResourceId:null!==(H=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==H?H:""}}),we=(vi.get(i)||[]).find(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===t.variantId}),ye=!0;if(we){var he=function(e){var n=(e||"").trim();return(n=$(n)).replace(/\s+/g," ").replace(/(\s*OR\s*)/g," OR ")},be=he(qt)===he(we.title),Ie=he(de)===he(we.rule_description),Te=he(me.whenToApply)===he(we.wta),Se=he(me.whenNotToApply)===he(we.wnta),ke=!!me.isDefault===ee(we.variant_type),Ce=we.scheduling_config||{},Ee=null!==(Q=null!==(B=Ce.order_global_min_separation_seconds)&&void 0!==B?B:null===(K=Ce.order_rules)||void 0===K?void 0:K.global_min_separation_seconds)&&void 0!==Q?Q:0,Ne=null!==(ne=null!==(z=Ce.advertiser_global_min_separation_seconds)&&void 0!==z?z:null===(X=Ce.advertiser_rules)||void 0===X?void 0:X.global_min_separation_seconds)&&void 0!==ne?ne:0,Le=null!==(re=null!==(ie=null===(te=Ce.inventory_rules)||void 0===te?void 0:te.respect_inventory_code)&&void 0!==ie?ie:Ce.respect_inventory_code)&&void 0!==re&&re,Oe=null!==(le=null!==(oe=null===(ae=Ce.break_code_rules)||void 0===ae?void 0:ae.respect_break_code)&&void 0!==oe?oe:Ce.respect_break_code)&&void 0!==le&&le,Re=(null===(ue=xt.get(i))||void 0===ue?void 0:ue.get(v))||Lt,xe=Re.order_rules.enabled===Ee>0&&Re.order_rules.global_min_separation_seconds===Math.floor(Ee/60)&&Re.advertiser_rules.enabled===Ne>0&&Re.advertiser_rules.global_min_separation_seconds===Math.floor(Ne/60)&&Re.inventory_rules.respect_inventory_code===Le&&Re.break_code_rules.respect_break_code===Oe;be&&Ie&&Te&&Se&&ke&&xe&&(ye=!1)}ye?(console.log("payloadv (update existing variant)",me),m.push(b(me,null!==(se=null==ia?void 0:ia.email)&&void 0!==se?se:""))):(console.log("[saveEditedVariant] No changes for variant ".concat(t.variantId,", skipping API call")),m.push(Promise.resolve({data:{id:t.variantId},skipped:!0})))}})}),[4,Promise.all(m)];case 2:return M=i.sent(),console.log("✅ All variants updated:",M),M.every(function(e){return null==e?void 0:e.skipped})?(console.warn("[saveEditedVariant] No API calls were made — all variants unchanged. Skipping success toast."),ze(B),pn(!1),null===(R=_r.current)||void 0===R||R.show({severity:"info",sticky:!1,life:3e3,summary:"No changes",detail:"No changes to save."}),[2]):(ze(K),Xe(!0),pn(!1),A=new Map,M.forEach(function(e,n){var t,i;if(!(null==e?void 0:e.skipped)){var r=y[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id);a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data);var o="existing"===r.payloadType?r.existingId:a;if(o&&"string"==typeof o){var l=A.get(r.tierKey)||[];l.push({id:o,action:r.payloadType}),A.set(r.tierKey,l)}}}),T.getState().setCreatedVariantInfo(Array.from(A.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),dn.current=setTimeout(function(){uo()},3e3),[3,4]);case 3:return S=i.sent(),console.error("❌ Error updating variant:",S),ze(Q),sn(!0),pn(!1),k=(null===(x=null==S?void 0:S.response)||void 0===x?void 0:x.data)||{},console.log("errorData: ",k),(C="Variant already exists"===(null==k?void 0:k.message))||409===(null==S?void 0:S.status)?on('Looks like a similar rule already exists with the same conditions. You can update the description or conditions to make it unique, or discard this learning. <br/> How would you like to proceed?\n <br/><button class="clickable-button" data-value="Discard learning">Discard learning</button>\n <br/><button class="clickable-button" data-value="Continue editing learning">Continue editing learning</button>\n <br/><button class="clickable-button" id="typeYourAnswer">Or, type your response</button>'):on(((null==k?void 0:k.message)||(null==k?void 0:k.detail)||"Error Occurred while saving the rule.")+'Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),null===(D=_r.current)||void 0===D||D.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:C||409===(null==S?void 0:S.status)?"Similar rule already exists. Please update and try again.":(null==k?void 0:k.message)||(null==k?void 0:k.detail)||"Something went wrong while saving the learning!"}))]}))}),[3,4];case 4:return[2]}})})},Pa=function(){return t(void 0,void 0,void 0,function(){var n,t,o,l,u,s,d,c,v,_,f,g,m,y,I,M,A,S,k,C,N,L,O,R,x,D;return i(this,function(i){switch(i.label){case 0:n=T.getState().tiers,La(ei,Fi,xt),t=Z(Fi),i.label=1;case 1:return i.trys.push([1,9,,10]),ze(z),on(""),0===(o=Array.isArray(ii)?ii:[]).length?(console.warn("No variants found to save."),ze(Q),[2]):(l=o.filter(function(e){return e.is_new_variant}),u=o.filter(function(e){return!e.is_new_variant&&(null==e?void 0:e.variant_id)}),console.log("[saveLoadAndEditVariant] New: ".concat(l.length,", Existing: ").concat(u.length)),s=u.length>0?null===(O=u.find(function(e){return(null==e?void 0:e.link_id)&&""!==e.link_id.trim()}))||void 0===O?void 0:O.link_id:null,d=[],c=[],v=[],_=[],f=Na(He.tiers),He.tiers.forEach(function(i){var r=i.toLowerCase().replace(/ /g,"_"),a=n.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===r||e.tier_name.toLowerCase()===r.replace(/_/g,"")}),l=Yt.get(r),u=Kt.get(r),p=$t.get(r);o.forEach(function(n,o){var g,m,y,h,I,M,A,T,S,k,C,E,N,L,O,R,x,D,j,P,V,F,G,U,q,J,W,Y,H,B,K,Q,z,X,ne,te,ie,re,ae,oe,le=(null==l?void 0:l.get(o))||n.rule_description||n.description||"",ue=(null==u?void 0:u.get(o))||[],se=(null==p?void 0:p.get(o))||[];if(n.is_new_variant){La(ei,Fi,xt,o);var de=Z(Fi),ce=xa(r,o,n.variant_type||n.variantType||"");if(!1===St){var ve={status:"approved",metadata:e(e({userName:null!==(g=null==ia?void 0:ia.firstname)&&void 0!==g?g:"",userEmailId:null!==(m=null==ia?void 0:ia.email)&&void 0!==m?m:"",llm:At.MODEL,isVariantFlow:!0},de&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},de)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:s||w(),variant:ka(le),conditions_whentoapply:ue.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:se.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:f[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(I=null===(h=null===(y=xt.get(r))||void 0===y?void 0:y.get(o))||void 0===h?void 0:h.is_default_enabled)&&void 0!==I?I:ee(n.variantType||n.variant_type||(0===o?"Default":"variant")),tier:{name:i.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(i.split(" ")[1]||"1"),tier_id:(null==a?void 0:a.tier_id)||""},topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:ft.current||null,variantType:ce,parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(M=null==ia?void 0:ia.email)&&void 0!==M?M:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(A=null==n?void 0:n.is_user_accepted_risk)&&void 0!==A?A:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0})};console.log("[saveLoadAndEditVariant] publish payload (new variant)",ve),c.push({payload:ve,tierKey:r}),_.push({tierKey:r})}else{ve={status:"approved",metadata:e(e({userName:null!==(T=null==ia?void 0:ia.firstname)&&void 0!==T?T:"",userEmailId:null!==(S=null==ia?void 0:ia.email)&&void 0!==S?S:"",llm:At.MODEL,isVariantFlow:!0},de&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},de)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:s||w(),variant:ka(le),conditions_whentoapply:ue.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:se.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:f[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(E=null===(C=null===(k=xt.get(r))||void 0===k?void 0:k.get(o))||void 0===C?void 0:C.is_default_enabled)&&void 0!==E?E:ee(n.variantType||n.variant_type||(0===o?"Default":"variant")),tier:{name:i.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(i.split(" ")[1]||"1"),tier_id:(null==a?void 0:a.tier_id)||""},topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:ft.current||null,variantType:ce,parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(N=null==ia?void 0:ia.email)&&void 0!==N?N:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(L=null==n?void 0:n.is_user_accepted_risk)&&void 0!==L?L:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0}),appsecData:{application:null!==(O=null==Ct?void 0:Ct.applicationId)&&void 0!==O?O:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(R=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==R?R:"",applicationLevelResourceId:null!==(x=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==x?x:""}};console.log("[saveLoadAndEditVariant] publish payload (new variant)",ve),c.push({payload:ve,tierKey:r}),_.push({tierKey:r})}}else if(null==n?void 0:n.variant_id){v.push({tierKey:r,existingId:n.variant_id});var pe=(null==n?void 0:n.variant_id)&&n.variant_id===na?(null==Ni?void 0:Ni.variant_type)||n.variant_type||n.variantType||"":n.variant_type||n.variantType||"",_e=(ce=xa(r,o,pe),e(e({variantId:n.variant_id,ruleDesc:(null==Me?void 0:Me.ruleSetDesc)||"",whenToApply:ue.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),whenNotToApply:se.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null!==(P=null===(j=null===(D=xt.get(r))||void 0===D?void 0:D.get(o))||void 0===j?void 0:j.is_default_enabled)&&void 0!==P?P:ee(n.variantType||n.variant_type||(0===o?"Default":"variant")),tier:{tier_id:(null==a?void 0:a.tier_id)||"",tier_name:(null==a?void 0:a.tier_name)||i,tier_priority:null!==(V=null==a?void 0:a.tier_priority)&&void 0!==V?V:null},scope_id:(null==Me?void 0:Me.ruleSetId)||"",description:ka(le)||"",topic:"".concat(He.station,"RuleSet")},t&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},t)}}}),{tierLinkId:null!=s?s:null,variantType:ce,is_user_accepted_risk:!!(null!==(F=null==n?void 0:n.is_user_accepted_risk)&&void 0!==F?F:null===(G=(ii||[])[o])||void 0===G?void 0:G.is_user_accepted_risk),is_enabled:n.is_enabled,appsecData:{application:null!==(U=null==Ct?void 0:Ct.applicationId)&&void 0!==U?U:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(q=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==q?q:"",applicationLevelResourceId:null!==(J=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==J?J:""}})),fe=(vi.get(r)||[]).find(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===(null==n?void 0:n.variant_id)}),ge=!0;if(fe){var me=function(e){var n=(e||"").trim();return(n=$(n)).replace(/\s+/g," ").replace(/(\s*OR\s*)/g," OR ")},we=me(qt)===me(fe.title),ye=me(le)===me(fe.rule_description),he=me(_e.whenToApply)===me(fe.wta),be=me(_e.whenNotToApply)===me(fe.wnta),Ae=!!_e.isDefault===ee(fe.variant_type),Te=fe.scheduling_config||{},Se=null!==(H=null!==(W=Te.order_global_min_separation_seconds)&&void 0!==W?W:null===(Y=Te.order_rules)||void 0===Y?void 0:Y.global_min_separation_seconds)&&void 0!==H?H:0,ke=null!==(Q=null!==(B=Te.advertiser_global_min_separation_seconds)&&void 0!==B?B:null===(K=Te.advertiser_rules)||void 0===K?void 0:K.global_min_separation_seconds)&&void 0!==Q?Q:0,Ce=null!==(ne=null!==(X=null===(z=Te.inventory_rules)||void 0===z?void 0:z.respect_inventory_code)&&void 0!==X?X:Te.respect_inventory_code)&&void 0!==ne&&ne,Ee=null!==(re=null!==(ie=null===(te=Te.break_code_rules)||void 0===te?void 0:te.respect_break_code)&&void 0!==ie?ie:Te.respect_break_code)&&void 0!==re&&re,Ne=(null===(ae=xt.get(r))||void 0===ae?void 0:ae.get(o))||Lt,Le=Ne.order_rules.enabled===Se>0&&Ne.order_rules.global_min_separation_seconds===Math.floor(Se/60)&&Ne.advertiser_rules.enabled===ke>0&&Ne.advertiser_rules.global_min_separation_seconds===Math.floor(ke/60)&&Ne.inventory_rules.respect_inventory_code===Ce&&Ne.break_code_rules.respect_break_code===Ee;we&&ye&&he&&be&&Ae&&Le&&(ge=!1)}ge?(console.log("[saveLoadAndEditVariant] update payload (existing variant)",_e),d.push(b(_e,null!==(oe=null==ia?void 0:ia.email)&&void 0!==oe?oe:""))):(console.log("[saveLoadAndEditVariant] No changes for variant ".concat(n.variant_id,", skipping API call")),d.push(Promise.resolve({data:{id:n.variant_id},skipped:!0})))}})}),[4,Promise.all(d)]);case 2:g=i.sent(),console.log("✅ All existing variants updated:",g),m=[],y=0,I=c,i.label=3;case 3:if(!(y<I.length))return[3,8];M=I[y],i.label=4;case 4:return i.trys.push([4,6,,7]),[4,h(M.payload,At.ASSISTANT_NAME)];case 5:return A=i.sent(),m.push(A),[3,7];case 6:throw S=i.sent(),console.error("❌ Error publishing new variant:",S),S;case 7:return y++,[3,3];case 8:return console.log("✅ All new variants published:",m),0===c.length&&g.every(function(e){return null==e?void 0:e.skipped})?(console.warn("[saveLoadAndEditVariant] No API calls were made — all variants unchanged. Skipping success toast."),ze(B),pn(!1),null===(R=_r.current)||void 0===R||R.show({severity:"info",sticky:!1,life:3e3,summary:"No changes",detail:"No changes to save."}),[2]):(k=new Map,g.forEach(function(e,n){var t,i;if(!(null==e?void 0:e.skipped)){var r=v[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)&&e.data.variant_id||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id)&&e.variant_id;a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data);var o=r.existingId||a;if(o&&"string"==typeof o){var l=k.get(r.tierKey)||[];l.push({id:o,action:"existing"}),k.set(r.tierKey,l)}}}),m.forEach(function(e,n){var t,i,r=_[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)&&e.data.variant_id||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id)&&e.variant_id;if(a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data),a&&"string"==typeof a){var o=k.get(r.tierKey)||[];o.push({id:a,action:"new"}),k.set(r.tierKey,o)}}),T.getState().setCreatedVariantInfo(Array.from(k.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),ze(K),Xe(!0),pn(!1),kn.current=!1,dn.current=setTimeout(function(){uo()},3e3),[3,10]);case 9:return C=i.sent(),console.error("❌ Error updating variant:",C),ze(Q),sn(!0),pn(!1),N=(null===(x=null==C?void 0:C.response)||void 0===x?void 0:x.data)||{},console.log("errorData: ",N),(L="Variant already exists"===(null==N?void 0:N.message))||409===(null==C?void 0:C.status)?on('Looks like a similar rule already exists with the same conditions. You can update the description or conditions to make it unique, or discard this learning. <br/> How would you like to proceed?\n <br/><button class="clickable-button" data-value="Discard learning">Discard learning</button>\n <br/><button class="clickable-button" data-value="Continue editing learning">Continue editing learning</button>\n <br/><button class="clickable-button" id="typeYourAnswer">Or, type your response</button>'):on(((null==N?void 0:N.message)||(null==N?void 0:N.detail)||"Error Occurred while saving the rule.")+'Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),null===(D=_r.current)||void 0===D||D.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:L||409===(null==C?void 0:C.status)?"Similar rule already exists. Please update and try again.":(null==N?void 0:N.message)||(null==N?void 0:N.detail)||"Something went wrong while saving the learning!"}))]}))}),[3,10];case 10:return[2]}})})},Va=function(e){return"string"!=typeof e?e:e.replace(/<conflicting_text>[\s\S]*?<\/conflicting_text>/g,"").replace(/<decision_strength>[\s\S]*?<\/decision_strength>/g,"").replace(/<conflicting_reasoning>[\s\S]*?<\/conflicting_reasoning>/g,"").replace(/<conflicting_gap>[\s\S]*?<\/conflicting_gap>/g,"").replace(/<\/?conflicting>/g,"").trim()},Fa=W({flow:ke,editingRule:Ae,editingVariants:Se}),Ga=!Fa&&qt.trim().length>0,Ua=Fa?"Drafts cannot be saved in Edit Mode.":"Add a title before saving a draft.",qa=function(){return t(void 0,void 0,void 0,function(){var n,t,r,a,o,l,u,s,d,c;return i(this,function(i){switch(i.label){case 0:if(!Ga)return Sr(function(n){return e(e({},n),{ruleTitle:"Rule Title is required"})}),[2];ze(z),sn(!1),on(""),i.label=1;case 1:return i.trys.push([1,4,,5]),n=(null===(o=null==Se?void 0:Se[0])||void 0===o?void 0:o.is_drafted)&&null!==(u=null===(l=null==Se?void 0:Se[0])||void 0===l?void 0:l.variantId)&&void 0!==u?u:"",t=Y(null===(s=An.current)||void 0===s?void 0:s.save_api_payload,n),console.log("[DRAFT FLOW] Save as Draft payload:",t),[4,I(t)];case 2:return i.sent(),ze(K),tn("Your learning draft has been saved successfully."),Xe(!0),[4,null==Pe?void 0:Pe()];case 3:return i.sent(),lo(),[3,5];case 4:return r=i.sent(),console.error("[DRAFT FLOW] Failed to save draft:",r),a=(null===(c=null===(d=null==r?void 0:r.response)||void 0===d?void 0:d.data)||void 0===c?void 0:c.message)||(null==r?void 0:r.message)||"Failed to save draft. Please try again.",on(a),sn(!0),ze(Q),[3,5];case 5:return[2]}})})};d(function(){if(xr&&!sr&&St){console.log("isSaveRule received from agent — calling publish APIs directly."),Dr(!1);t(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,7,,8]),W({flow:ke,editingRule:Ae,editingVariants:Se})?[4,ja()]:[3,2];case 1:return n.sent(),[3,6];case 2:return!0===kn.current&&ft.current?[4,Pa()]:[3,4];case 3:return n.sent(),[3,6];case 4:return[4,t(void 0,void 0,void 0,function(){var e,n,t,r,a,o,l,u;return i(this,function(s){switch(s.label){case 0:s.trys.push([0,6,,8]),ze(z),console.log("[CREATE FLOW] Starting handleSaveInstantLearningQuestion for tiers:",He.tiers),e=new Map,n=function(n){var t,r,a,o,l,s,d;return i(this,function(i){switch(i.label){case 0:if(t=n.toLowerCase().replace(/ /g,"_"),r=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===t||e.tier_name.toLowerCase()===t.replace(/_/g,"")}),!(a=null==r?void 0:r.tier_id))return console.warn("[CREATE FLOW] No tier_id found for tier: ".concat(n)),e.set(t,null),[2,"continue"];o={question:qt,orgName:At.ORGANIZATION_NAME,scope_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:a},i.label=1;case 1:return i.trys.push([1,3,,4]),console.log("[CREATE FLOW] Calling saveInstantLearningQuestion for ".concat(n," (tier_id: ").concat(a,")")),[4,y(o)];case 2:return l=i.sent(),s=(null===(u=null==l?void 0:l.data)||void 0===u?void 0:u.id)||null,e.set(t,s),console.log("✅ [CREATE FLOW] Question saved for ".concat(n,":"),{questionId:s,fullResponse:l}),[3,4];case 3:return d=i.sent(),console.error("❌ [CREATE FLOW] Error saving question for ".concat(n,":"),d),e.set(t,null),[3,4];case 4:return[2]}})},t=0,r=He.tiers,s.label=1;case 1:return t<r.length?(a=r[t],[5,n(a)]):[3,4];case 2:s.sent(),s.label=3;case 3:return t++,[3,1];case 4:return console.log("[CREATE FLOW] Calling publishFeedbackSaveLearning with questionIdMap:",Array.from(e.entries())),[4,Da(e)];case 5:return s.sent(),[3,8];case 6:return o=s.sent(),l=new Map,He.tiers.forEach(function(e){l.set(e.toLowerCase().replace(/ /g,"_"),null)}),console.error("❌ [CREATE FLOW] Error in outer try-catch, calling publishFeedbackSaveLearning with fallback:",o),[4,Da(l)];case 7:return s.sent(),console.error("❌ [CREATE FLOW] Error saving Instant Learning Question:",o),[3,8];case 8:return[2]}})})];case 5:n.sent(),n.label=6;case 6:return[3,8];case 7:return e=n.sent(),console.error("Error in save execution:",e),[3,8];case 8:return[2]}})})}},[xr,sr]);var Ja=(null===(ie=(null===(te=null==He?void 0:He.tiers)||void 0===te?void 0:te[0])||Te||"Tier 1")||void 0===ie?void 0:ie.toLowerCase().replace(/ /g,"_"))||"tier_1",Wa=null!==(re=null!=Ai?Ai:Ce)&&void 0!==re?re:0,Ya=null!=Ai,Ha=Ya?null==ii?void 0:ii[Wa]:null,Ba=ii&&(null==ii?void 0:ii.find(function(e){return e&&!e.is_readOnly&&((null==e?void 0:e.new_variant_id)&&ji.includes(e.new_variant_id)||(null==e?void 0:e.variant_id)&&Ri.includes(e.variant_id))})),Ka=(null==Ha?void 0:Ha.new_variant_id)&&ji.includes(Ha.new_variant_id)?Ha.new_variant_id:(null==Ba?void 0:Ba.new_variant_id)&&ji.includes(Ba.new_variant_id)?Ba.new_variant_id:"",Qa=null===(ae=S.getState().teachMeConfig)||void 0===ae?void 0:ae.learningMetadataComponents,za=q(Qa),$a=function(n){var t={},i=He.tiers.map(function(e){return null==e?void 0:e.toLowerCase().replace(/ /g,"_")}),r=(null==He?void 0:He.station)+"RuleSet",a=i.map(function(e){var n=gn.find(function(n){return n.tier_name.toLowerCase().replace(/ /g,"_")===e||n.tier_name.toLowerCase()===e.replace(/_/g,"")});return(null==n?void 0:n.tier_id)||""}).filter(Boolean);return n.forEach(function(n,o){var l,u,s,d,c,v,p,_=(null==n?void 0:n.variant_id)&&n.variant_id||Ri[o]||"new_variant_".concat(o),f=(null===(l=n.scope)||void 0===l?void 0:l[0])||Ja,g=Yt.get(f),m=Kt.get(f),w=$t.get(f),y=(null==g?void 0:g.get(o))||n.rule_description||"",h=(null==m?void 0:m.get(o))||[],b=h.length>0?h.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n "):n.wta||"",I=(null==w?void 0:w.get(o))||[],M=I.length>0?I.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n "):n.wnta||"",A=xt.get(f),T=null==A?void 0:A.get(o),S={};T&&Object.keys(T).length>0?S=e(e({},T),{order_rules:e(e({},T.order_rules),{global_min_separation_seconds:60*((null===(u=T.order_rules)||void 0===u?void 0:u.global_min_separation_seconds)||0)}),advertiser_rules:e(e({},T.advertiser_rules),{global_min_separation_seconds:60*((null===(s=T.advertiser_rules)||void 0===s?void 0:s.global_min_separation_seconds)||0)})}):n.scheduling_config&&(S=n.scheduling_config);var k=si[_]||{},C=e(e(e({},n.learning_metadata||{}),k),{properties:e(e({},(null===(d=n.learning_metadata)||void 0===d?void 0:d.properties)||{}),k.properties||{}),instruction_prompt:U(n.learning_metadata)});t[_]=e(e({rule_title:qt,variant_description:y,wta:b,ruleset_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:a,wnta:M,scope:i,scope_rule_set:r},za?{}:{scheduling_config:S}),{learning_metadata:J(Qa,C),is_user_accepted_risk:!(null===(p=null!==(c=null==n?void 0:n.is_user_accepted_risk)&&void 0!==c?c:null===(v=(ii||[])[o])||void 0===v?void 0:v.is_user_accepted_risk)||void 0===p||!p)})}),t};tt&&console.log("customMetaData.ui_state for addvariant flow",$a(fi));var Za=T(function(e){return e.selectedRuleSetId}),Xa=T(function(e){return e.learningMetadata});An.current={send_metadata_to_orchestrator:!1,is_draft_flow:Oe,default:["scope"],app_mapping_id:Fe,content_mode_mapping_id:null!=Ge?Ge:null,LearningTerm:k("agents.LearningTerm","Learnings"),mode_name:Et||void 0,x_full_url:function(){try{var e=new URL(window.location.href);return!e.searchParams.get("rulesetid")&&(null==Me?void 0:Me.ruleSetId)&&e.searchParams.set("rulesetid",null==Me?void 0:Me.ruleSetId),e.toString()}catch(e){return window.location.href}}(),agents_from_ilkb_config:null===(oe=C.getState().lmsConfig)||void 0===oe?void 0:oe.agents,appsecData:{application:null!==(le=null==Ct?void 0:Ct.applicationId)&&void 0!==le?le:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(ue=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==ue?ue:"",applicationLevelResourceId:null!==(se=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==se?se:""},save_api_payload:function(){var n;if(!(null===(n=He.tiers)||void 0===n?void 0:n.length)||!(null==gn?void 0:gn.length))return[];var t=T.getState().backwardCompatibility,i=Dn.current,r=(ii||[])[i]||{};La(ei,Fi,xt,i);var a=Z(Fi),o=w(),l=Na(He.tiers);return He.tiers.map(function(n){var u,s,d,c,v,p,_,f,g,m,y,h,b,I,M,A,T,S,k,C,E,N=n.toLowerCase().replace(/ /g,"_"),L=(null===(u=Yt.get(N))||void 0===u?void 0:u.get(i))||"",O=(null===(s=Kt.get(N))||void 0===s?void 0:s.get(i))||[],R=(null===(d=$t.get(N))||void 0===d?void 0:d.get(i))||[];return!1===t?e(e({},a&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},a)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},tierLinkId:o,variant:ka(L),conditions_whentoapply:O.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null===(p=null===(v=null===(c=xt.get(N))||void 0===c?void 0:c.get(i))||void 0===v?void 0:v.is_default_enabled)||void 0===p||p,tier_id:(null===(_=gn.find(function(e){return(null==e?void 0:e.tier_name)&&(e.tier_name.toLowerCase().replace(/ /g,"_")===N||e.tier_name.toLowerCase()===N.replace(/_/g,""))}))||void 0===_?void 0:_.tier_id)||"",topic_id:null,scope_id:(null==Me?void 0:Me.ruleSetId)||"",question_title:qt,variantType:xa(N,i,r.variant_type||r.variantType),instantLearningType:At.INSTANT_LEARNING_TYPE,is_user_accepted_risk:!1,propagation:!0,applicationMappingId:Fe,modeId:Ue,appsecData:{application:null!==(f=null==Ct?void 0:Ct.applicationId)&&void 0!==f?f:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(g=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==g?g:"",applicationLevelResourceId:null!==(m=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==m?m:""}}):{status:"approved",metadata:e(e({userName:null!==(y=null==ia?void 0:ia.firstname)&&void 0!==y?y:"",userEmailId:null!==(h=null==ia?void 0:ia.email)&&void 0!==h?h:"",llm:G.MODEL,isVariantFlow:!0},a&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},a)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:o,variant:ka(L),conditions_whentoapply:O.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:l[0]||{name:G.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:G.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null===(M=null===(I=null===(b=xt.get(N))||void 0===b?void 0:b.get(i))||void 0===I?void 0:I.is_default_enabled)||void 0===M||M,tier_id:(null===(A=gn.find(function(e){return(null==e?void 0:e.tier_name)&&(e.tier_name.toLowerCase().replace(/ /g,"_")===N||e.tier_name.toLowerCase()===N.replace(/_/g,""))}))||void 0===A?void 0:A.tier_id)||"",topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:G.CATEGORY,description:G.CATEGORY}],originalQuestion:qt,questionId:null,variantType:xa(N,i,r.variant_type||r.variantType),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(T=null==ia?void 0:ia.email)&&void 0!==T?T:"",instantLearningType:G.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(S=null==r?void 0:r.is_user_accepted_risk)&&void 0!==S?S:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0,appsecData:{application:null!==(k=null==Ct?void 0:Ct.applicationId)&&void 0!==k?k:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(C=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==C?C:"",applicationLevelResourceId:null!==(E=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==E?E:""}})}})}(),update_api_payload:function(){var n,t,i;if(!(null==Se?void 0:Se.length)||!(null===(n=He.tiers)||void 0===n?void 0:n.length)||!(null==gn?void 0:gn.length))return[];T.getState().backwardCompatibility,La(ei,Fi,xt);var r=Z(Fi),a=null!==(i=null===(t=Se.find(function(e){return(null==e?void 0:e.link_id)&&""!==e.link_id.trim()}))||void 0===t?void 0:t.link_id)&&void 0!==i?i:null,o=[];return He.tiers.forEach(function(n){var t=n.toLowerCase().replace(/ /g,"_"),i=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===t||e.tier_name.toLowerCase()===t.replace(/_/g,"")}),l=Yt.get(t),u=Kt.get(t),s=$t.get(t);Se.forEach(function(d,c){var v,p,_,f,g,m,w,y,h;if(!d.isNewVariant){var b=(null==l?void 0:l.get(c))||d.description||"",I=(null==u?void 0:u.get(c))||[],M=(null==s?void 0:s.get(c))||[],A=xa(t,c,d.variantType||""),T=e(e({variantId:d.variantId,ruleDesc:(null==Me?void 0:Me.ruleSetDesc)||"",whenToApply:I.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),whenNotToApply:M.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null!==(_=null===(p=null===(v=xt.get(t))||void 0===v?void 0:v.get(c))||void 0===p?void 0:p.is_default_enabled)&&void 0!==_?_:ee(d.variantType||""),tier:{tier_id:(null==i?void 0:i.tier_id)||"",tier_name:(null==i?void 0:i.tier_name)||n,tier_priority:null!==(f=null==i?void 0:i.tier_priority)&&void 0!==f?f:null},scope_id:(null==Me?void 0:Me.ruleSetId)||"",description:ka(b)||"",topic:"".concat(He.station,"RuleSet")},r&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},r)}}}),{tierLinkId:null!=a?a:null,variantType:A,is_user_accepted_risk:!!(null!==(m=null===(g=(ii||[])[c])||void 0===g?void 0:g.is_user_accepted_risk)&&void 0!==m?m:null==d?void 0:d.is_user_accepted_risk),is_enabled:d.is_enabled,appsecData:{application:null!==(w=null==Ct?void 0:Ct.applicationId)&&void 0!==w?w:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(y=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==y?y:"",applicationLevelResourceId:null!==(h=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==h?h:""}});o.push(T)}})}),o}(),ui_state:Fa?{variants:function(){var n={},t=xt.get(Ja);if(!t)return n;var i=Yt.get(Ja),r=Kt.get(Ja),a=$t.get(Ja),o=He.tiers.map(function(e){return null==e?void 0:e.toLowerCase().replace(/ /g,"_")}),l=(null==He?void 0:He.station)+"RuleSet",u=o.map(function(e){var n=gn.find(function(n){return n.tier_name.toLowerCase().replace(/ /g,"_")===e||n.tier_name.toLowerCase()===e.replace(/_/g,"")});return(null==n?void 0:n.tier_id)||""}).filter(Boolean);return t.forEach(function(s,d){var c,v,p,_,f,g,m,w,y,h,b,I,M,A=null===(c=null==Se?void 0:Se[d])||void 0===c?void 0:c.variantId,T=(ii||[])[d],S=(null==T?void 0:T.new_variant_id)||"",k=A||S||Ri[d]||"variant_".concat(d),C=(null==i?void 0:i.get(d))||"",E=((null==r?void 0:r.get(d))||[]).map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n ")||"",N=((null==a?void 0:a.get(d))||[]).map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n ")||"",L=t.get(d),O={};L&&Object.keys(L).length>0&&(O=e(e({},L),{order_rules:e(e({},L.order_rules),{global_min_separation_seconds:60*((null===(v=L.order_rules)||void 0===v?void 0:v.global_min_separation_seconds)||0)}),advertiser_rules:e(e({},L.advertiser_rules),{global_min_separation_seconds:60*((null===(p=L.advertiser_rules)||void 0===p?void 0:p.global_min_separation_seconds)||0)})}));var R=(ii||[])[Wa];void 0!==X(T)&&(X(T),X(R));var x=null!==(_=X(T))&&void 0!==_?_:"idx-".concat(d),D=null!==(f=oi[x])&&void 0!==f?f:U(null==T?void 0:T.learning_metadata)||U(null===(g=null==Se?void 0:Se[d])||void 0===g?void 0:g.learning_metadata),j=si[k]||{},P=e(e(e(e({},(null===(m=null==Se?void 0:Se[d])||void 0===m?void 0:m.learning_metadata)||{}),(null==T?void 0:T.learning_metadata)||{}),j),{properties:e(e(e({},(null===(y=null===(w=null==Se?void 0:Se[d])||void 0===w?void 0:w.learning_metadata)||void 0===y?void 0:y.properties)||{}),(null===(h=null==T?void 0:T.learning_metadata)||void 0===h?void 0:h.properties)||{}),j.properties||{}),instruction_prompt:D});n[k]=e(e({rule_title:qt,variant_description:C,wta:E,ruleset_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:u,wnta:N,scope:o,scope_rule_set:l},za?{}:{scheduling_config:O}),{learning_metadata:J(Qa,P),is_user_accepted_risk:!(null===(M=null!==(b=null==T?void 0:T.is_user_accepted_risk)&&void 0!==b?b:null===(I=null==Se?void 0:Se[d])||void 0===I?void 0:I.is_user_accepted_risk)||void 0===M||!M)})}),n}()}:function(){var n,t,i,r,a,o,l=(ii||[]).findIndex(function(e){return!0===e.is_new_variant}),u=-1;-1!==l?u=l:zn?u=-1:tt||(u=Wa);var s=-1!==u,d=s?(ii||[])[u]:void 0,c=e(e({},(null==d?void 0:d.learning_metadata)||{}),Xa);return{new_current_variant:s?e(e({rule_title:qt,rule_description:(null===(n=Yt.get(Ja))||void 0===n?void 0:n.get(u))||"",wta:(null===(i=null===(t=Kt.get(Ja))||void 0===t?void 0:t.get(u))||void 0===i?void 0:i.map(function(e){return Va(e.text)}).filter(function(e){return""!==e}).join(" \\n "))||"",wnta:(null===(a=null===(r=$t.get(Ja))||void 0===r?void 0:r.get(u))||void 0===a?void 0:a.map(function(e){return Va(e.text)}).filter(function(e){return""!==e}).join(" \\n "))||"",scope:He.tiers.map(function(e){return null==e?void 0:e.toLowerCase().replace(/ /g,"_")}),scope_rule_set:(null==He?void 0:He.station)+"RuleSet"},za?{}:{scheduling_config:function(){var n,t,i,r=null===(n=xt.get(Ja))||void 0===n?void 0:n.get(u);return r&&0!==Object.keys(r).length?e(e({},r),{order_rules:e(e({},r.order_rules),{global_min_separation_seconds:60*((null===(t=r.order_rules)||void 0===t?void 0:t.global_min_separation_seconds)||0)}),advertiser_rules:e(e({},r.advertiser_rules),{global_min_separation_seconds:60*((null===(i=r.advertiser_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)})}):{}}()}),{learning_metadata:J(Qa,c),is_user_accepted_risk:!!(null===(o=(ii||[])[u])||void 0===o?void 0:o.is_user_accepted_risk)}):e(e({rule_title:"",rule_description:"",wta:"",wnta:"",scope:[],scope_rule_set:""},za?{}:{scheduling_config:{}}),{is_user_accepted_risk:!1}),variants:tt?$a(fi):{}}}(),rule_id_in_current_session:bi,new_variant_id:function(){var e;return Ya&&Ae?(null===(e=null==Se?void 0:Se[Wa])||void 0===e?void 0:e.variantId)?null:Ka:null}(),edit_variant_id:pt,rule_id:ft.current,backward_compatibility:T.getState().backwardCompatibility,ruleset_id:Za,current_variants_length:Ae?Array.isArray(ii)&&ii.length>0?Math.max((null===(de=null==Ae?void 0:Ae.variants)||void 0===de?void 0:de.length)||0,ii.length):null===(ce=null==Ae?void 0:Ae.variants)||void 0===ce?void 0:ce.length:void 0,tiers:T.getState().tiers,authToken:(null==ia?void 0:ia.accessToken)||""};var eo=Ia(fi),no={ruleTitle:qt,scopeData:He,variantsByTier:Array.from(xt.keys()).reduce(function(n,t){var i=xt.get(t)||new Map,r=Yt.get(t)||new Map,a=Kt.get(t)||new Map,o=$t.get(t)||new Map;return n[t]=Array.from(i.keys()).map(function(n,l){var u,s,d,c,v,p=(ii||[]).filter(function(e){return Array.isArray(null==e?void 0:e.scope)?e.scope.includes(t):(null==e?void 0:e.scope)===t})[n]||{},_={label:"",isDefault:!1};if(p.is_variant&&!ee(p.variant_type))_={label:"",isDefault:!1};else if(Se&&Se.length>0){_=Oa(Se,n,"variantType");var f=null==Se?void 0:Se.find(function(e){return e.tier===t&&e.index===n});if(f){if(!_.label){var g=f.variantType||"",m=ee(g);_={label:"variant ".concat(n+1),isDefault:m}}if(f.variantId===Qr)(y=p.variant_type||(null==Ni?void 0:Ni.variant_type))&&(_=Ra(y,n),console.log("[templateState] editingVariants[".concat(n,']: using CARE variant_type "').concat(y,'" → label "').concat(_.label,'"')));console.log("Computed variant type at index",n,":",_)}else _={label:Ia(Se),isDefault:!1},console.log("No match found, using getNextVariantType:",_)}else if(fi&&fi.length>0){if(_=Oa(fi,n,"variant_type"),console.log("Found matching variant at index",n,":",_),kn.current){var w=null==fi?void 0:fi.find(function(e){return e.tier===t&&e.index===n});if((null==w?void 0:w.variant_id)===na||(null==w?void 0:w.variantId)===na)(y=p.variant_type||(null==Ni?void 0:Ni.variant_type))&&(_=Ra(y,n),console.log("[templateState] existingVariants[".concat(n,']: load-and-edit using CARE variant_type "').concat(y,'" → label "').concat(_.label,'"')))}}else{var y=p.variant_type||"";_={label:eo,isDefault:ee(y)}}console.log("Computed variant data for tier",t,"index",n,":",_);var h=null!==(s=null===(u=i.get(n))||void 0===u?void 0:u.is_default_enabled)&&void 0!==s?s:_.isDefault;console.log("live is default :",h);var b="variant ".concat(l+1),I=r.get(n)||"",M=null!==(d=X(p))&&void 0!==d?d:"idx-".concat(t,"-").concat(n),A=null!==(c=oi[M])&&void 0!==c?c:U(p.learning_metadata)||U(null===(v=null==Se?void 0:Se.find(function(e){return e.tier===t&&e.index===n}))||void 0===v?void 0:v.learning_metadata);return{variantId:Ri[n]||p.variant_id||p.variantId,instructionPrompt:A,variantType:b,isDefault:h,isModified:p.is_modified,tier:t,index:n,ruleDescription:I.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,""),whenToApplyConditions:(a.get(n)||[]).flatMap(function(n){var t,i=(null===(t=null==n?void 0:n.text)||void 0===t?void 0:t.split(/\s+OR\s+/))||[];return i.length>1?i.map(function(t,i){return e(e({},n),{id:"split-".concat(n.id,"-").concat(i),text:t.trim()})}):[n]}),whenNotToApplyConditions:(o.get(n)||[]).flatMap(function(n){var t,i=(null===(t=null==n?void 0:n.text)||void 0===t?void 0:t.split(/\s+OR\s+/))||[];return i.length>1?i.map(function(t,i){return e(e({},n),{id:"split-".concat(n.id,"-").concat(i),text:t.trim()})}):[n]}),configData:i.get(n)||Lt,isReadOnly:p.is_readOnly||!1,is_variant:p.is_variant||!1,reasoning:{ruleDescription:Sa(I),whenToApply:Sa(p.wta),whenNotToApply:Sa(p.wnta),configData:Sa(p.action)}}}),n},{}),citation:$i,fieldCitations:or,citations:er},to={setRuleTitle:function(n){var t,i=void 0!==(null===(t=null==n?void 0:n.target)||void 0===t?void 0:t.value)?n.target.value:n;Jt(i),Sr(function(n){if(n.ruleTitle){var t=e({},n);return delete t.ruleTitle,t}return n})},setRuleDescription:function(e,n,t){return da(e,n,t)},addWhenToApply:function(e,n){return ca(e,n)},removeWhenToApply:function(e,n,t){return va(e,n,t)},editWhenToApply:function(e,n,t,i){return pa(e,n,t,i)},addWhenNotToApply:function(e,n){return _a(e,n)},removeWhenNotToApply:function(e,n,t){return fa(e,n,t)},editWhenNotToApply:function(e,n,t,i){return ga(e,n,t,i)},addNewVariant:function(e){return ma(e)},onScopeChange:ya,onConfigChange:function(e,n,t,i){return ha(e,n,t,i)}},io={},ro={};xt.forEach(function(n,t){io[t]=new Map,ro[t]=new Map,n.forEach(function(n,i){io[t].set(i,[e({key:"order_rules",label:"Order"},n.order_rules),e({key:"advertiser_rules",label:"Advertiser"},n.advertiser_rules)]),ro[t].set(i,[{key:"inventory_rules",label:"Inventory code",enabled:n.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:n.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:n.is_default_enabled}])})});var ao=v(function(){if(Te){if(1===He.tiers.length)return 0;var e=He.tiers.findIndex(function(e){return e.toLowerCase()===Te.toLowerCase()});return e>=0?e:0}},[Te,He.tiers]),oo=e(e(e(e({defaultOpen:!0,tierOptions:Ta,stationOptions:[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],separationItemsByTier:io,togglesByTier:ro,highlights:qi,highlightedIds:Yi,openSections:Pt,setOpenSections:Vt,setSendMessageInChat:Ci,isAiStreaming:sr,defaultTierOpen:ao,defaultVariantOpen:zn?void 0:Ai,autoScrollVariantIndex:zn?void 0:Ai,activeVariantAccordionIndex:zn?void 0:Ai,setActiveVariantAccordionIndex:function(e){Ti(e),null!=e&&setTimeout(function(){$n(!1)},100)},validationErrors:Tr,activeEditId:lt,setActiveEditId:ut,pendingEditId:dt,setPendingEditId:ct,conflictReason:Cr,usedFor:W({flow:ke,editingRule:Ae,editingVariants:Se})?"Edit":"Create"},Tt),{scrollTrigger:Ki}),qe),{setInstructionPrompt:function(n){var t,i,r=null!=Ai?Ai:Ce;if(null!=r){var a=null!==(t=X(null==ii?void 0:ii[r]))&&void 0!==t?t:"idx-".concat(r);li(function(t){var i;return e(e({},t),((i={})[a]=n,i))})}null===(i=null==qe?void 0:qe.setInstructionPrompt)||void 0===i||i.call(qe,n)}});d(function(){},[ye]),d(function(){var e=W({flow:ke,editingRule:Ae,editingVariants:Se});if(!sr&&wi&&!e){var t=n([],ii,!0).reverse().findIndex(function(e){return"variant"===e.action||e.is_variant});-1===t||ii.length,-1!==t&&(console.log("Post-stream: Focusing new variant at index",t),Ti(t))}},[sr,wi]);var lo=function(){dn.current&&(clearTimeout(dn.current),dn.current=null),kn.current=!1,he(),ba()},uo=function(){return t(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:if(!Pe)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Pe()];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),console.error("postSaveCallback threw after successful save — keeping modal open",e),sn(!0),on('Learning was saved, but something went wrong finishing up. Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),[2];case 4:return lo(),[2]}})})},so=function(){var e={};qt.trim()||(e.ruleTitle="Rule Title is required"),He.station||(e.station="Station Rule Set is required"),He.tiers&&0!==He.tiers.length||(e.tiers="At least one tier must be selected");return He.tiers.map(function(e){return e.toLowerCase().replace(/ /g,"_")}).forEach(function(n){var t=Yt.get(n),i=Kt.get(n),r=xt.get(n);r&&Array.from(r.keys()).forEach(function(r){var a=null==t?void 0:t.get(r);a&&a.trim()||(e["ruleDescription-".concat(n,"-").concat(r)]="Rule Description is required");var o=null==i?void 0:i.get(r);o&&o.some(function(e){return""!==e.text.trim()})||(e["whenToApply-".concat(n,"-").concat(r)]='At least one "When to apply" condition is required')})}),e};function co(r,a,o){var l,u,s,d,c,v;return void 0===o&&(o=!1),t(this,void 0,void 0,function(){var t,p,_,f,g,m,y,h,b,I,A,T,S,k,C,E,N,L,O,R,x,D,j,P,V;return i(this,function(i){switch(i.label){case 0:if(t=r.question_id,p=(null==r?void 0:r.variant_id)||null,rt.current&&wt.current===t)return console.log("[handleAILoadAction] Already fetching question ID, skipping duplicate request:",t),[2];if(ft.current===t&&!o)return console.log("[handleAILoadAction] Question ID unchanged, updating variant focus only:",p),_t(p),p?(-1!==(_=(ii||[]).findIndex(function(e){return e.is_new_variant}))&&(Mr(!0),Ur("Removing new variant..."),Wr("Please wait while we remove new variant.")),ri(function(e){if(!Array.isArray(e))return e;var n=e.filter(function(e){return!e.is_new_variant}),t=n.findIndex(function(e){return e.variant_id===p});return-1!==t&&setTimeout(function(){Ti(t),Qi(function(e){return e+1}),pr.current=t},0),n}),-1!==_&&((f=function(e){e(function(e){var n=new Map;return e.forEach(function(e,t){var i=new Map(e);i.delete(_);var r=new Map,a=0;i.forEach(function(e){r.set(a,e),a++}),n.set(t,r)}),n})})(Dt),f(Ht),f(Qt),f(Zt),xi(function(e){var t=n([],e,!0);return t.length>_&&t.splice(_,1),t})),!1===rt.current&&(rt.current=!0,-1!==_&&(null===(l=_r.current)||void 0===l||l.show({severity:"success",summary:"Success",detail:"New variant removed successfully because you selected to edit an existing variant",life:4e3}))),$n(!1)):(console.log("lastLoadedQuestionIdRef.current in else",ft.current),null===ft.current&&(Mr(!0),Ur("Adding new variant..."),Wr("Please wait while we add new variant."))),[2];console.log("User Action: fetching fresh variant info for question",t),at.current.clear(),at.current.add(t),Mr(!0),Ur("Loading variants..."),console.log("reaching here in load and edit"),Wr("Please wait while we fetch the latest variant data."),rt.current=!0,wt.current=t,i.label=1;case 1:return i.trys.push([1,5,6,10]),g=Date.now(),[4,M(t,(null==Me?void 0:Me.ruleSetId)||"")];case 2:return m=i.sent(),(y=Date.now()-g)<3e3?[4,new Promise(function(e){return setTimeout(e,3e3-y)})]:[3,4];case 3:i.sent(),i.label=4;case 4:return 0===(h=(null===(u=null==m?void 0:m.data)||void 0===u?void 0:u.variants)||[]).length?(console.warn("No variants found for question_id",t),Mr(!1),Ur(""),null===(s=_r.current)||void 0===s||s.show({severity:"error",summary:"Error",detail:"No variants found for this question.",life:3e3}),[2]):(kn.current=!0,rt.current=!0,b=(null===(d=null==m?void 0:m.data)||void 0===d?void 0:d.ruleTitle)||"",Jt(b),I=null===(c=null==m?void 0:m.data)||void 0===c?void 0:c.tier,A="tier_1",T="Tier 1",S="1",I&&((k=String(I).match(/(\d+)/))?(C=k[1],S=C,A="tier_".concat(C),T="Tier ".concat(C)):(A=String(I).toLowerCase().trim().replace(/ /g,"_"),T=A.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),S=A.includes("2")?"2":"1")),console.log("[handleAILoadAction] Detected Tier: ".concat(T," (ID: ").concat(S,", Key: ").concat(A,")")),Be({station:Ie||"global",tiers:[T]}),E=function(e,n,t,i,r,a){var o=e.map(function(e){var o,l,u=[t];return{variant_type:e.variantType||"variant",title:n,rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:u,scheduling_config:(null===(o=e.configuration)||void 0===o?void 0:o.scheduling_config)||{},variant_id:e.variantId,question_id:r,tier_id:i,is_readOnly:e.variantId!==a,link_id:e.link_id||"",is_enabled:null===(l=e.is_enabled)||void 0===l||l,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,learning_metadata:e.learning_metadata||{},action:"edit"}}),l=new Map,u=new Map,s=new Map,d=new Map;return o.forEach(function(e,n){var t,i,r,a,o,c,v=e.scheduling_config||{};l.set(n,{order_rules:{enabled:!!v.order_global_min_separation_seconds||!!(null===(t=v.order_rules)||void 0===t?void 0:t.global_min_separation_seconds),global_min_separation_seconds:Math.floor((v.order_global_min_separation_seconds||(null===(i=v.order_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)/60)},advertiser_rules:{enabled:!!v.advertiser_global_min_separation_seconds||!!(null===(r=v.advertiser_rules)||void 0===r?void 0:r.global_min_separation_seconds),global_min_separation_seconds:Math.floor((v.advertiser_global_min_separation_seconds||(null===(a=v.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds)||0)/60)},inventory_rules:{respect_inventory_code:!!v.respect_inventory_code||!!(null===(o=v.inventory_rules)||void 0===o?void 0:o.respect_inventory_code)},break_code_rules:{respect_break_code:!!v.respect_break_code||!!(null===(c=v.break_code_rules)||void 0===c?void 0:c.respect_break_code)},is_default_enabled:ee(e.variantType||e.variant_type)}),u.set(n,$(e.rule_description||""));var p=e.wta?e.wta.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];s.set(n,p);var _=e.wnta?e.wnta.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wnta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];d.set(n,_)}),{transformedVariants:o,tierConfigMap:l,tierDescMap:u,tierWtaMap:s,tierWntaMap:d}}(h,b,A,S,t,p),N=E.transformedVariants,L=E.tierConfigMap,O=E.tierDescMap,R=E.tierWtaMap,x=E.tierWntaMap,pi(function(e){var n=new Map(e);return n.set(A,JSON.parse(JSON.stringify(N))),n}),ri(function(e){var t=(Array.isArray(e)?e:[]).filter(function(e){return"copy"===e.action||e.tier_id&&e.tier_id!==S});return n(n([],t,!0),N,!0)}),gi(function(e){var t=(Array.isArray(e)?e:[]).filter(function(e){return"copy"===e.action||e.tier_id&&e.tier_id!==S});return n(n([],t,!0),N,!0)}),it(!0),ft.current=t,_t(p),D=0,p&&-1!==(j=N.findIndex(function(e){return e.variant_id===p}))&&(D=j),Ti(D),Qi(function(e){return e+1}),pr.current=D,$n(!1),Dt(function(e){var n=new Map(e);return n.set(A,L),n}),Ht(function(e){var n=new Map(e);return n.set(A,O),n}),Qt(function(e){var n=new Map(e);return n.set(A,R),n}),Zt(function(e){var n=new Map(e);return n.set(A,x),n}),Sr({}),[3,10]);case 5:return P=i.sent(),console.error("Failed to fetch variants by question ID:",P),null===(v=_r.current)||void 0===v||v.show({severity:"error",summary:"Error",detail:"Failed to fetch variants. Please try again.",life:3e3}),[3,10];case 6:return rt.current=!1,Mr(!1),Ur(""),Wr(""),(null==r?void 0:r.is_interpretation_ready)&&(null==r?void 0:r.question_id)&&ft.current&&pt?(ri(function(n){if(!Array.isArray(n))return n;var t=n.map(function(n){return(null==n?void 0:n.variant_id)===pt?e(e({},n),a):n}),i=n.findIndex(function(e){return(null==e?void 0:e.variant_id)===pt});return-1!==i&&setTimeout(function(){console.log("targetIndex",i),Ti(i),Qi(function(e){return e+1}),pr.current=i},0),t}),[3,9]):[3,7];case 7:return(null==r?void 0:r.is_interpretation_ready)&&(null==r?void 0:r.question_id)&&ft.current&&!pt?(Mr(!0),Ur("Adding new variant..."),Wr("Please wait while we add new variant."),[4,new Promise(function(e){return setTimeout(e,3e3)})]):[3,9];case 8:i.sent(),Mr(!1),Ur(""),Wr(""),(V=oi["idx-0"]||"")&&li(function(n){return e(e({},n),{"idx-0":""})}),ri(function(t){var i,r,o=jn.current||{},l=e(e(e({},o),a||{}),{is_new_variant:!0,is_variant:!0,learning_metadata:e(e(e({},o.learning_metadata||{}),(null==a?void 0:a.learning_metadata)||{}),{instruction_prompt:V})});if(Array.isArray(t)){var u=t.findIndex(function(e){return!0===e.is_new_variant});if(-1!==u){setTimeout(function(){Ti(u),Qi(function(e){return e+1}),pr.current=u},0);var s=t[u].client_id||w(),d=(null===(i=t[u].learning_metadata)||void 0===i?void 0:i.instruction_prompt)||V,c=t[u].learning_metadata||{};r=t.map(function(n,t){return t===u?e(e(e({},n),l),{client_id:s,learning_metadata:e(e(e({},c),l.learning_metadata||{}),{instruction_prompt:d})}):n})}else{var v=t.length;setTimeout(function(){Ti(v),Qi(function(e){return e+1}),pr.current=v},0),r=n(n([],t,!0),[e(e({},l),{client_id:w()})],!1)}}else setTimeout(function(){Ti(0),Qi(0),pr.current=0},0),r=[e(e({},l),{client_id:w()})];return bt.current=r,r}),i.label=9;case 9:return[7];case 10:return[2]}})})}var vo;return console.log("RuleSet in render",Me),r(o,{children:[a(m,{ref:_r}),a(N,{open:ye,chatAssistantName:At.ASSISTANT_NAME,organizationName:At.ORGANIZATION_NAME,baseUrl:At.BASE_URL,baseWebsocketUrl:At.BASE_WEBSOCKET_URL,closeFunction:lo,enableChatLogs:We,ThinkingBulbIconComponent:a(H,{}),customSections:null!=Je?Je:a(o,{}),customMetaData:An,chatTitle:Ae?(null!==(ve=null==qe?void 0:qe.chatTitleEdit)&&void 0!==ve?ve:At.CHAT_TITLE_EDIT).replace("{scope}",(null==Me?void 0:Me.ruleSetName)||""):(null!==(pe=null==qe?void 0:qe.chatTitle)&&void 0!==pe?pe:At.CHAT_TITLE).replace("{scope}",(null==Me?void 0:Me.ruleSetName)||""),formTitle:(null==oo?void 0:oo.formTitle)||At.FORM_TITLE,showSavedMessage:!1,savedMessage:nn,isError:un,errorMessage:an,isSaving:vn,onSave:function(e){console.log("Save this Learning",e);var n=so();if(Object.keys(n).length>0)return console.log("validation errors",n),void Sr(n);pn(!0),sn(!1),on("")},showSaveWithoutValidation:!1,onSaveWithoutValidation:function(){return t(void 0,void 0,void 0,function(){var e,n,t,r,a,o,l,u,s;return i(this,function(d){switch(d.label){case 0:return e=so(),Object.keys(e).length>0?(Sr(e),[2]):(console.log("✅ Bypass Save: Initiated"),W({flow:ke,editingRule:Ae,editingVariants:Se})?[4,ja()]:[3,2]);case 1:return d.sent(),[3,11];case 2:return!0===kn.current&&ft.current?[4,Pa()]:[3,4];case 3:return d.sent(),[3,11];case 4:d.trys.push([4,10,,11]),ze(z),n=new Map,t=function(e){var t,r,a,o,l,u;return i(this,function(i){switch(i.label){case 0:if(t=e.toLowerCase().replace(/ /g,"_"),r=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===t||e.tier_name.toLowerCase()===t.replace(/_/g,"")}),!(a=null==r?void 0:r.tier_id))return n.set(t,null),[2,"continue"];o={question:qt,orgName:At.ORGANIZATION_NAME,scope_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:a},i.label=1;case 1:return i.trys.push([1,3,,4]),[4,y(o)];case 2:return l=i.sent(),n.set(t,(null===(s=null==l?void 0:l.data)||void 0===s?void 0:s.id)||null),[3,4];case 3:return u=i.sent(),console.error("❌ Bypass Save: Error saving question for ".concat(e,":"),u),n.set(t,null),[3,4];case 4:return[2]}})},r=0,a=He.tiers,d.label=5;case 5:return r<a.length?(o=a[r],[5,t(o)]):[3,8];case 6:d.sent(),d.label=7;case 7:return r++,[3,5];case 8:return[4,Da(n,!0)];case 9:return d.sent(),[3,11];case 10:return l=d.sent(),ze(Q),u=new Map,He.tiers.forEach(function(e){u.set(e.toLowerCase().replace(/ /g,"_"),null)}),Da(u,!0),console.error("❌ Bypass Save: Error",l),[3,11];case 11:return[2]}})})},headerMessageHandlers:Aa,aiResponse:ii,setAIResponse:ri,width:"90vw",height:"90vh",sendMessageInChat:ki,isLoading:Qe===z,templateProps:{state:no,handlers:to,uiState:oo},setSendMessageInChat:Ci,onResetChat:function(){ba()},onResetRequest:function(){mr(!0)},isFormDirty:function(){return""!==qt.trim()||""!==He.station||He.tiers.length>0||Array.from(Yt.values()).some(function(e){return Array.from(e.values()).some(function(e){return""!==e.trim()})})||Array.from(Kt.values()).some(function(e){return Array.from(e.values()).some(function(e){return e.length>0})})||Array.from($t.values()).some(function(e){return Array.from(e.values()).some(function(e){return e.length>0})})||xt.size>0||ei.size>0},initialChatMessage:Ae?(vo=Ae.ruleTitle||"this rule",null===(_e=null==Se?void 0:Se[null!=Ce?Ce:0])||void 0===_e||_e.is_user_accepted_risk,'<p><span>Welcome back! 👋</span>\n <span>I see you want to edit <strong>"'.concat(vo,'."</strong></span>\n <span> <strong>What would you like to update? </strong> </span>\n <span>Describe the change you want to make, and I’ll help you edit it.</span>\n </p>')):null!=Ve?Ve:At.INITIAL_CHAT_MESSAGE,validateCustom:function(){if(Qe===K||Ze)return!1;if(!qt||""===qt.trim())return!1;if(null!==lt)return!1;if(!He.station||""===He.station.trim())return!1;var e=He.tiers&&He.tiers.filter(function(e){return e&&""!==e.trim()});if(!e||0===(null==e?void 0:e.length))return!1;for(var n,t=0,i=e.map(function(e){return e.toLowerCase().replace(/ /g,"_")});t<i.length;t++){var r=i[t],a=Yt.get(r),o=Kt.get(r),l=xt.get(r);if(!l||0===l.size)return!1;for(var u=0,s=Array.from(l.keys());u<s.length;u++){var d=s[u],c=null==a?void 0:a.get(d);if(!c||""===c.trim())return!1;var v=null==o?void 0:o.get(d);if(!(null==v?void 0:v.some(function(e){return e.text&&""!==e.text.trim()})))return!1}}return!(!xt||0===xt.size)&&(!(n=function(e){return Array.from(e.values()).some(function(e){return Array.from(e.values()).some(function(e){return e.some(function(e){return!!e.conflict})})})})(Kt)&&!n($t)&&!On)},setCitations:nr,isLocked:!0,textareaPlaceholder:(null==qe?void 0:qe.chatTextareaPlaceholder)||"Tell me more about this learning..",saveButtonConfig:(null==oo?void 0:oo.saveBtnConfig)||{label:Ae?"Save Changes":"Save Learning",loadingLabel:r("span",e({style:{display:"flex",gap:"5px",alignItems:"center"}},{children:[a(_,{size:20,color:"white",className:"animate-spin"}),a("span",{children:" Saving Changes..."})]}))},showSaveDraft:!0,onSaveDraft:function(){Ga?hr(!0):Sr(function(n){return e(e({},n),{ruleTitle:"Rule Title is required"})})},onSaveDraftWithoutConfirmation:qa,isSaveDraftDisabled:!Ga,saveDraftDisabledTooltip:Ua,saveDraftButtonConfig:{label:"Save Draft",loadingLabel:"Saving Draft..."},setCurrentRequestId:rr,isAiStreaming:sr,setIsAiStreaming:dr,showConfirmReset:gr,setShowConfirmReset:mr,confirmReset:function(){ba(),mr(!1),lo()},isLoadingVariants:Ir,mainText:Gr,subText:Jr,proposedRule:Vn,isFetchingComparison:sa,handleOpenComparison:Ma,showComparison:Pr,setShowComparison:Vr,variants:Un,onComparisonLinkClick:ua,targetComparisonVariantId:Wn,highlightedComparisonField:Bn,onAddAsVariant:function(){Vr(!1)},isCopyEnabled:!0,onSubmitFeedback:function(n){return t(void 0,void 0,void 0,function(){var t,r,a,o,l,u,s;return i(this,function(i){switch(i.label){case 0:t=T.getState().backwardCompatibility,i.label=1;case 1:return i.trys.push([1,3,,4]),r=e({user_id:null!==(l=null==ia?void 0:ia._id)&&void 0!==l?l:"",user_name:null!==(u=null==ia?void 0:ia.firstname)&&void 0!==u?u:"",user_email:null!==(s=null==ia?void 0:ia.email)&&void 0!==s?s:"",assistant_name:At.ASSISTANT_NAME},n),a=t?r:e(e({},r),{feedback_type:"Negative",application_mapping_id:Fe}),[4,A(a)];case 2:return i.sent(),[3,4];case 3:throw o=i.sent(),console.error("Failed to submit chat feedback",o),o;case 4:return[2]}})})},handleGlobalClickCapture:function(e){null!==lt&&(e.target.closest('[data-edit-id="'.concat(lt,'"]'))||(e.preventDefault(),e.stopPropagation(),ct(lt)))},isGlobalEditActive:null!==lt,initialDraftMessage:je,socketTimeOutInMilliSeconds:At.SOCKET_TIMEOUT,userDetails:{name:"".concat(null!==(fe=null==ia?void 0:ia.firstname)&&void 0!==fe?fe:""," ").concat(null!==(ge=null==ia?void 0:ia.lastname)&&void 0!==ge?ge:"").trim()||"Guest Userr",id:null!==(me=null==ia?void 0:ia._id)&&void 0!==me?me:"Guest Userr",email:null!==(we=null==ia?void 0:ia.email)&&void 0!==we?we:"guestUserr@example.com"}}),a(j,{isOpen:yr,title:"Save as Draft?",description:"Are you sure you want to save this learning as a draft?",confirmText:"Save as Draft",cancelText:"Cancel",onConfirm:function(){return t(void 0,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,qa()];case 1:return e.sent(),hr(!1),[2]}})})},onCancel:function(){return hr(!1)},confirmBgColor:"#5925DC",isLoading:Qe===z,position:"fixed"})]})};export{te as default,$ as filterAgentText};
1
+ import{__assign as e,__spreadArray as n,__awaiter as t,__generator as i}from"tslib";import{jsxs as r,jsx as a,Fragment as o}from"react/jsx-runtime";import l,{useState as u,useRef as s,useEffect as d,useCallback as c,useMemo as v}from"react";import{AlertTriangle as p,Loader as _,Lightbulb as f,Check as g}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as w}from"uuid";import{saveInstantLearningQuestion as y,publishFeedback as h,updateVariant as b,saveDraftVariant as I,fetchRulesByQuestionId as M,submitChatFeedback as A}from"../apis/scopeApis.js";import{useLearningTemplateStore as T}from"../store/useLearningTemplateStore.js";import{useTeachMeConfigStore as S,dt as k,useLMSConfigStore as C}from"../store/useLMSConfigStore.js";import E from"../styles/InstantLearningModal.module.css.js";import N from"../../IL-OTJ/ILOTJ.js";import"../../IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../../IL-OTJ/_components/InputDataReasoningCard.js";import"../../IL-OTJ/_components/TooltipComponent.js";import"../../IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import{extractAndParseWithProperty as L,parseValidationData as O,extractAndParseResponse as R,extractVariantIds as x}from"../../IL-OTJ/helpers/utils.js";import{useCitations as D}from"../../IL-OTJ/store/CitationsContext.js";import"@mui/material";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"../../../api/transport.js";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"../store/usePermissionsStore.js";import j from"./ConfirmationModal.js";import"./ToolTip.js";import P from"../store/useAuthStore.js";import"@mui/icons-material/Check";import"@mui/icons-material/CloseRounded";import"../../IL-marketplace/marketplaceTheme.js";import"@tanstack/react-query";import V from"../store/useEnvStore.js";import"date-fns/format";import"date-fns/isValid";import"date-fns/parseISO";import"framer-motion";import"../../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"../store/useExternalWorkflowStore.js";import"../../IL-marketplace/queryClient.js";import{useConfigStore as F}from"../store/useConfigStore.js";import"appsec-ui";import"react-dom";import"@radix-ui/react-tooltip";import"./StationOnboarding/InputField.js";import{IL_CONFIG_CONSTANTS as G}from"../config.js";import"../store/useAppSecRolesStore.js";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"../AuditLog/ChangeLogDiff.js";import"react-router-dom";import"../../IL-marketplace/components/GuidelineIconButton.js";import"@e-llm-studio/federated-dashboard-components";import"@e-llm-studio/federated-dashboard-components/styles.css";import"../hooks/useLearningTemplateQueryParams.js";import"../../../ILMarketplaceWrapper.js";import"../LearningManagementTest.js";import{getInstructionPromptValue as U,isSchedulingConfigLearningMetadata as q,buildLegacyLearningMetadataPayload as J}from"../utils/learningMetadataUtils.js";import{resolveIsEditMode as W}from"../utils/learningFlow.js";import{buildSaveDraftPayload as Y}from"../utils/saveDraft.js";var H=function(){return a(f,{size:20,strokeWidth:2,className:"text-blue-600"})},B="INITIAL",K="SUCCESS",Q="FAILURE",z="IN_PROGRESS",$=function(e){return"string"!=typeof e?"":e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,"").replace(/<!--```json[\s\S]*?```-->/g,"").trim()},Z=function(n){void 0===n&&(n={});var t=e({},n);return Object.keys(n).forEach(function(e){var i=n[e];i&&"object"==typeof i&&!Array.isArray(i)&&Object.keys(t).forEach(function(n){n!==e&&n.startsWith("".concat(e,"_"))&&delete t[n]})}),t},X=function(e){return(null==e?void 0:e.variant_id)||(null==e?void 0:e.new_variant_id)||(null==e?void 0:e.client_id)||void 0},ee=function(e){if(!e)return!1;var n=e.toLowerCase().trim();return"default"===n||"default_variant"===n},ne=function(e){return e.toLowerCase().replace(/ /g,"_").replace(/tier(\d+)/i,"tier_$1")},te=function(f){var te,ie,re,ae,oe,le,ue,se,de,ce,ve,pe,_e,fe,ge,me,we,ye=f.isOpen,he=f.onClose,be=f.initialScope,Ie=void 0===be?"global":be,Me=f.ruleSet,Ae=f.editingRule,Te=f.editingTier,Se=f.editingVariants,ke=f.flow,Ce=f.focusedVariantIndex,Ee=f.setFocusedVariantIndex,Ne=f.triggerAddVariant,Le=f.triggerFixGaps,Oe=f.isDraftFlow,Re=f.copiedRule,xe=f.copiedSourceTier,De=f.copiedTargetTier,je=f.initialDraftMessage,Pe=f.postSaveCallback,Ve=f.initialChatMessage,Fe=f.applicationIntegrationId,Ge=f.contentModeMappingId,Ue=f.modeId,qe=f.uiStateLabels,Je=f.customSections,We=f.enableChatLogs,Ye=u({station:Ie,tiers:["Tier 1"]}),He=Ye[0],Be=Ye[1],Ke=u(B),Qe=Ke[0],ze=Ke[1],$e=u(!1),Ze=$e[0],Xe=$e[1],en=u("Thank you teacher for teaching me, your rule has been saved successfully."),nn=en[0],tn=en[1],rn=u(""),an=rn[0],on=rn[1],ln=u(!1),un=ln[0],sn=ln[1],dn=s(null),cn=u(!1),vn=cn[0],pn=cn[1],_n=s(!1),fn=s(!1),gn=T.getState().tiers,mn=l.useRef(new Set),wn=u(null);wn[0];var yn=wn[1],hn=u(null);hn[0];var bn=hn[1],In=u(null);In[0];var Mn=In[1],An=s({}),Tn=s(new Map),Sn=s(""),kn=s(!1),Cn=u(0),En=Cn[0],Nn=Cn[1],Ln=u(!1),On=Ln[0],Rn=Ln[1],xn=s(null),Dn=s(0),jn=s(null),Pn=u(null),Vn=Pn[0],Fn=Pn[1],Gn=u([]),Un=Gn[0],qn=Gn[1],Jn=u(null),Wn=Jn[0],Yn=Jn[1],Hn=u(null),Bn=Hn[0],Kn=Hn[1],Qn=u(!1),zn=Qn[0],$n=Qn[1],Zn=s({}),Xn=s(new Map),et=s(!1),nt=u(!1),tt=nt[0],it=nt[1],rt=s(!1),at=s(new Set),ot=u(null),lt=ot[0],ut=ot[1],st=u(null),dt=st[0],ct=st[1],vt=u(null),pt=vt[0],_t=vt[1],ft=s(null),gt=s(null),mt=s(null),wt=s(null),yt=s({}),ht=s([]),bt=s([]),It=s({}),Mt=F(),At=Mt.configuration,Tt=Mt.ilLabels,St=T.getState().backwardCompatibility,kt=T.getState().cognitiveCompareCompatibility,Ct=V(function(e){return e.rbacConfig}),Et=V.getState().baseModeName,Nt=s(He.tiers);d(function(){var n=Nt.current[0]?ne(Nt.current[0]):null,t=He.tiers[0]?ne(He.tiers[0]):null;if(n&&t&&n!==t){var i=(bt.current||[]).findIndex(function(e){return!0===(null==e?void 0:e.is_new_variant)}),r=function(e){e(function(e){var r=new Map(e),a=r.get(n)||new Map,o=new Map;a.forEach(function(e,n){n!==i&&o.set(n,e)});var l=-1===i?void 0:a.get(i);return r.set(t,void 0===l?new Map:new Map([[0,l]])),r.set(n,o),r})};r(Ht),r(Qt),r(Zt),Dt(function(e){var r=new Map(e),a=r.get(n)||new Map,o=new Map;a.forEach(function(e,n){n!==i&&o.set(n,e)});var l=-1===i?void 0:a.get(i);return r.set(t,new Map([[0,null!=l?l:Lt]])),r.set(n,o.size>0?o:new Map([[0,Lt]])),r}),ni(function(e){var t=new Map(e);return t.set(n,new Map),t}),ri(function(n){return Array.isArray(n)?n.map(function(n){return(null==n?void 0:n.is_new_variant)?e(e({},n),{scope:[t],tier_id:t.replace("tier_","")}):n}):n}),gt.current=t}Nt.current=He.tiers},[He.tiers]),d(function(){lt||ct(null)},[lt]),d(function(){var e;if(ye&&Ae){ft.current=Ae.ruleId;var n=null===(e=null==Se?void 0:Se[Ce||0])||void 0===e?void 0:e.variantId;_t(n||null)}},[ye,Ae,Se,Ce]),d(function(){ye&&Be(function(n){return e(e({},n),{station:Ie})})},[ye,Ie]),d(function(){console.log("triggered",pt),console.log(ii,"structuredAIResponse"),ri(function(n){return Array.isArray(n)?n.map(function(n){return e(e({},n),{is_readOnly:n.variant_id!==pt&&n.new_variant_id!==pt})}):n}),gi(function(n){return Array.isArray(n)?n.map(function(n){return e(e({},n),{is_readOnly:n.variant_id!==pt&&n.new_variant_id!==pt})}):n})},[pt]),d(function(){var n,t,i,r,a,o;if(!ye)return ba(),void(et.current=!1);if(!et.current){var l=Se,u=l&&l.length>0,s=null!=Ae;if(u||s){var d=null!==(a=null!==(i=null!==(n=null==Ae?void 0:Ae.ruleTitle)&&void 0!==n?n:null===(t=null==l?void 0:l[Ce||0])||void 0===t?void 0:t.title)&&void 0!==i?i:null===(r=null==l?void 0:l[Ce||0])||void 0===r?void 0:r.ruleTitle)&&void 0!==a?a:"";if(d&&Jt(d),Te&&(Be(function(n){return e(e({},n),{tiers:[Te]})}),gt.current=Te.toLowerCase().replace(/ /g,"_")),u){var c=Te?ne(Te):"tier_1",v=new Map,p=new Map,_=new Map,f=new Map,g=new Map,m=new Map,w=[];l.forEach(function(e,n){f.set(n,e.description||"");var t=e.whenToApply?e.whenToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];g.set(n,t);var i=e.whenNotToApply?e.whenNotToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wnta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];m.set(n,i),w.push(e.variantId||e.variant_id||"")}),v.set(c,f),p.set(c,g),_.set(c,m);var y=null===(o=null==l?void 0:l[Ce||0])||void 0===o?void 0:o.variantId,h=l.map(function(e,n){var t,i,r=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config;return{variant_type:e.variantType||"variant",title:d,rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:[c],scheduling_config:r||{},variant_id:e.variantId,question_id:(null==Ae?void 0:Ae.ruleId)||"",tier_id:c.replace("tier_",""),is_readOnly:e.variantId!==y,link_id:e.link_id||"",is_enabled:null===(i=e.is_enabled)||void 0===i||i,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,action:"edit"}});ri(h),ri(h),gi(h),pi(function(e){var n=new Map(e);return n.set(c,JSON.parse(JSON.stringify(h))),n});var b=new Map;l.forEach(function(e,n){var t,i,r,a,o,l,u,s,d,c,v,p,_,f=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config,g=null!==(a=null!==(i=null==f?void 0:f.order_global_min_separation_seconds)&&void 0!==i?i:null===(r=null==f?void 0:f.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)&&void 0!==a?a:0,m=null!==(u=null!==(o=null==f?void 0:f.advertiser_global_min_separation_seconds)&&void 0!==o?o:null===(l=null==f?void 0:f.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)&&void 0!==u?u:0;b.set(n,{order_rules:{enabled:g>0,global_min_separation_seconds:Math.floor(g/60)},advertiser_rules:{enabled:m>0,global_min_separation_seconds:Math.floor(m/60)},inventory_rules:{respect_inventory_code:null!==(c=null!==(d=null===(s=null==f?void 0:f.inventory_rules)||void 0===s?void 0:s.respect_inventory_code)&&void 0!==d?d:null==f?void 0:f.respect_inventory_code)&&void 0!==c&&c},break_code_rules:{respect_break_code:null!==(_=null!==(p=null===(v=null==f?void 0:f.break_code_rules)||void 0===v?void 0:v.respect_break_code)&&void 0!==p?p:null==f?void 0:f.respect_break_code)&&void 0!==_&&_},is_default_enabled:ee(e.variantType||e.variant_type)})}),Dt(new Map([[c,b]])),Ht(v),Qt(p),Zt(_)}else if(s&&Ae){var I=Ae.ruleDesc;if(I&&Ht(new Map([["tier_1",new Map([[0,I]])]])),Ae.whenToApply){var M=Ae.whenToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,n){return{id:"edit-wta-".concat(n),text:e,reasoning:""}});Qt(new Map([["tier_1",new Map([[0,M]])]]))}if(Ae.whenNotToApply){var A=Ae.whenNotToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,n){return{id:"edit-wnta-".concat(n),text:e,reasoning:""}});Zt(new Map([["tier_1",new Map([[0,A]])]]))}}}else if(Re&&xe&&De){Jt(Re.ruleTitle||""),Be(function(n){return e(e({},n),{tiers:[De]})}),gt.current=ne(De);var T=ne(xe),S=Re.variants||[],k=(v=new Map,p=new Map,_=new Map,new Map),C=new Map,E=new Map;S.forEach(function(e,n){k.set(n,e.description||"");var t=e.whenToApply?e.whenToApply.split(" OR ").map(function(e,t){return{id:"copy-wta-".concat(n,"-").concat(t),text:e.trim(),reasoning:""}}):[];C.set(n,t);var i=e.whenNotToApply?e.whenNotToApply.split(" OR ").map(function(e,t){return{id:"copy-wnta-".concat(n,"-").concat(t),text:e.trim(),reasoning:""}}):[];E.set(n,i)}),v.set(T,k),p.set(T,C),_.set(T,E),Ht(v),Qt(p),Zt(_);var N=S.map(function(e,n){var t,i,r=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config;return{variant_type:e.variantType||"variant",title:Re.ruleTitle||"",rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:[xe],scheduling_config:r||{},variant_id:e.variantId,question_id:Re.ruleId||"",tier_id:T.replace("tier_",""),is_readOnly:!0,link_id:e.link_id||"",is_enabled:null===(i=e.is_enabled)||void 0===i||i,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,action:"copy"}});ri(N),gi(N),pi(function(e){var n=new Map(e);return n.set(T,JSON.parse(JSON.stringify(N))),n});var L=new Map;S.forEach(function(e,n){var t,i,r,a,o,l,u,s,d,c,v,p,_,f=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config,g=null!==(a=null!==(i=null==f?void 0:f.order_global_min_separation_seconds)&&void 0!==i?i:null===(r=null==f?void 0:f.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)&&void 0!==a?a:0,m=null!==(u=null!==(o=null==f?void 0:f.advertiser_global_min_separation_seconds)&&void 0!==o?o:null===(l=null==f?void 0:f.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)&&void 0!==u?u:0;L.set(n,{order_rules:{enabled:g>0,global_min_separation_seconds:Math.floor(g/60)},advertiser_rules:{enabled:m>0,global_min_separation_seconds:Math.floor(m/60)},inventory_rules:{respect_inventory_code:null!==(c=null!==(d=null===(s=null==f?void 0:f.inventory_rules)||void 0===s?void 0:s.respect_inventory_code)&&void 0!==d?d:null==f?void 0:f.respect_inventory_code)&&void 0!==c&&c},break_code_rules:{respect_break_code:null!==(_=null!==(p=null===(v=null==f?void 0:f.break_code_rules)||void 0===v?void 0:v.respect_break_code)&&void 0!==p?p:null==f?void 0:f.respect_break_code)&&void 0!==_&&_},is_default_enabled:ee(e.variantType||e.variant_type)})}),Dt(new Map([[T,L]]))}else ba()}},[ye,Ae,Se,Te,Re,xe,De]),d(function(){if(ye){if(console.log("[Accordion Init] editingTier:",Te,"focusedVariantIndex:",Ce),Te&&Be(function(n){return e(e({},n),{tiers:[Te]})}),zn)return console.log("[Accordion] isAddingNewVariant mode — closing all variant accordions"),void Ti(void 0);if(Ne){console.log("[Accordion] triggerAddVariant mode — not opening any variant on RHS"),Ti(void 0);var n=(Te?ne(Te):"tier_1").replace(/_/g," ");Ci("I want to add a new variant to ".concat(n))}else null!=Ce?(console.log("[Accordion] Opening SPECIFIC variant index ".concat(Ce," (from VariantCard)")),Ti(Ce),Qi(function(e){return e+1})):(Ae||Se&&Se.length>0)&&(console.log("[Accordion] Opening DEFAULT/1st variant (index 0) for RuleHeader edit"),Ti(0),Qi(function(e){return e+1}))}else Ti(void 0)},[ye,Te,Ce,Ae,Se,Ne,zn]),d(function(){ye&&Le&&Ae&&null!==Ce&&Ci("I want to fix the gaps")},[ye,Le,Ae,Ce]);var Lt={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},Ot=function(e){var n=T.getState().tiers,t=n.length>0&&!St?n.map(function(e){return e.tier_name.replace(/(\d+)/,"_$1")}):["tier_1","tier_2","tier_3"];return new Map(t.map(function(e){return[e,new Map]}))},Rt=u(function(){var e=T.getState().tiers,n=e.length>0&&!St?e.map(function(e){return e.tier_name.replace(/(\d+)/,"_$1")}):["tier_1","tier_2","tier_3"];return new Map(n.map(function(e){return[e,new Map([[0,Lt]])]}))}),xt=Rt[0],Dt=Rt[1],jt=u(new Set([])),Pt=jt[0],Vt=jt[1],Ft=u("");Ft[0];var Gt=Ft[1],Ut=u(""),qt=Ut[0],Jt=Ut[1],Wt=u(function(){return Ot()}),Yt=Wt[0],Ht=Wt[1],Bt=u(function(){return Ot()}),Kt=Bt[0],Qt=Bt[1],zt=u(function(){return Ot()}),$t=zt[0],Zt=zt[1],Xt=u(function(){return Ot()}),ei=Xt[0],ni=Xt[1],ti=u([]),ii=ti[0],ri=ti[1],ai=u({}),oi=ai[0],li=ai[1],ui=u({}),si=ui[0],di=ui[1],ci=u(new Map),vi=ci[0],pi=ci[1],_i=u([]),fi=_i[0],gi=_i[1],mi=u(!1),wi=mi[0],yi=mi[1],hi=u([]),bi=hi[0],Ii=hi[1],Mi=u(void 0),Ai=Mi[0],Ti=Mi[1],Si=u(""),ki=Si[0],Ci=Si[1],Ei=u(null),Ni=Ei[0],Li=Ei[1],Oi=u([]),Ri=Oi[0],xi=Oi[1],Di=u([]),ji=Di[0],Pi=Di[1],Vi=u({}),Fi=Vi[0],Gi=Vi[1],Ui=u(new Map),qi=Ui[0],Ji=Ui[1],Wi=u(new Set),Yi=Wi[0],Hi=Wi[1],Bi=u(0),Ki=Bi[0],Qi=Bi[1],zi=u({ruleTitle:"",ruleDescription:"",scopeData:"",whenToApply:"",whenNotToApply:"",configData:""}),$i=zi[0],Zi=zi[1],Xi=u([]),er=Xi[0],nr=Xi[1],tr=u(""),ir=tr[0],rr=tr[1],ar=u({}),or=ar[0],lr=ar[1],ur=u(!1),sr=ur[0],dr=ur[1],cr=s(null),vr=s(null),pr=s(-1),_r=s(null);d(function(){bt.current=ii},[ii]),d(function(){var e;mt.current=(null===(e=He.tiers)||void 0===e?void 0:e[0])?ne(He.tiers[0]):null},[He.tiers]),d(function(){var n=new Set,t=console.warn;return console.warn=function(){for(var i,o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];t.apply(void 0,o);var u=o[0];if("string"==typeof u&&u.includes("Failed to parse JSON for property=")){var s=u.match(/warnId="([^"]+)"/),d=null==s?void 0:s[1];if(d&&n.has(d))return;d&&n.add(d),null===(i=_r.current)||void 0===i||i.show({severity:"warn",sticky:!1,life:5e3,className:E.toastWarning,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconWarning}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleWarning)},{children:"Parsing Issue"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageWarning)},{children:"The AI response couldn't be parsed correctly. Please try rephrasing your input or retry."}))]}))})}},function(){console.warn=t}},[]);var fr=u(!1),gr=fr[0],mr=fr[1],wr=u(!1),yr=wr[0],hr=wr[1],br=u(!1),Ir=br[0],Mr=br[1],Ar=u({}),Tr=Ar[0],Sr=Ar[1],kr=u(""),Cr=kr[0],Er=kr[1],Nr=u(!0),Lr=Nr[0],Or=Nr[1],Rr=u(!1),xr=Rr[0],Dr=Rr[1],jr=u(!1),Pr=jr[0],Vr=jr[1],Fr=u(""),Gr=Fr[0],Ur=Fr[1],qr=u(""),Jr=qr[0],Wr=qr[1],Yr=u(""),Hr=Yr[0],Br=Yr[1],Kr=u(null),Qr=Kr[0],zr=Kr[1],$r=u(null),Zr=$r[0],Xr=$r[1],ea=u(null),na=ea[0],ta=ea[1],ia=P.getState().user,ra=D(),aa=ra.dispatch,oa=ra.getLatestReasoning;d(function(){console.log("Structured AI Response updated:",ii)},[ii]),d(function(){console.log("isCloseModal AI Response updated:",Lr)},[Lr]),d(function(){!1===sr?(Mr(!1),Ur(""),Wr("")):(sn(!1),on(""))},[sr]),d(function(){null!=Ai&&Se&&!Se[Ai]&&zr(null)},[Ai,Se]);var la=s(null);d(function(){var n,t,i,r;if(ye){var a=null!=Ai?Ai:Ce;if(null!=a){var o=null!==(i=null!==(n=null==Se?void 0:Se[a])&&void 0!==n?n:null===(t=null==Re?void 0:Re.variants)||void 0===t?void 0:t[a])&&void 0!==i?i:Array.isArray(ii)?ii[a]:void 0,l=null!==(r=X(o))&&void 0!==r?r:"idx-".concat(a);if(la.current!==l){la.current=l;var u=(null==o?void 0:o.learning_metadata)||{},s=oi[l],d=e(e({},u),{instruction_prompt:null!=s?s:U(u)});T.getState().setLearningMetadata(d)}}}else la.current=null},[ye,Ai,Ce,ii]),d(function(){if(vn&&!_n.current){_n.current=!0,console.log("UseEffect triggered: Sending save message to chat agent");Ci("Save this Learning"),pn(!1),setTimeout(function(){_n.current=!1,Ci("")},2e3)}},[vn]),d(function(){ye&&Oe&&!fn.current&&(fn.current=!0,Ci("Please help me continue configuring this draft")),Oe&&ye||(fn.current=!1)},[ye,Oe]);var ua=c(function(e,n){Un.some(function(n){return n.id===e})?(Vr(!0),Yn(e),Kn(n),setTimeout(function(){Kn(null),Yn(null)},6e3)):console.warn("Variant ID ".concat(e," not found in comparison variants."))},[Un]),sa=v(function(){var e=Pr&&En>0;return console.log("[Loader Debug] showComparison: ".concat(Pr,", activeRequests: ").concat(En,", Result: ").concat(e)),e},[Pr,En]),da=c(function(n,t,i){var r,a=void 0!==(null===(r=null==i?void 0:i.target)||void 0===r?void 0:r.value)?i.target.value:i;Ht(function(e){var i=new Map(e),r=new Map(i.get(n));return r.set(t,a),i.set(n,r),i}),Sr(function(i){if(i["ruleDescription-".concat(n,"-").concat(t)]){var r=e({},i);return delete r["ruleDescription-".concat(n,"-").concat(t)],r}return i})},[]),ca=c(function(t,i){Qt(function(e){var r=new Map(e),a=new Map(r.get(t)),o=a.get(i)||[];return a.set(i,n(n([],o,!0),[{id:Date.now(),text:"",reasoning:""}],!1)),r.set(t,a),r}),Sr(function(n){if(n["whenToApply-".concat(t,"-").concat(i)]){var r=e({},n);return delete r["whenToApply-".concat(t,"-").concat(i)],r}return n})},[]),va=c(function(e,n,t){Qt(function(i){var r=new Map(i),a=new Map(r.get(e)),o=a.get(n)||[];return a.set(n,o.filter(function(e){return e.id!==t})),r.set(e,a),r})},[]),pa=c(function(n,t,i,r){Qt(function(a){var o=new Map(a),l=new Map(o.get(n)),u=l.get(t)||[];return l.set(t,u.map(function(n){return String(n.id)===String(i)?e(e({},n),{text:r}):n})),o.set(n,l),o}),Sr(function(i){if(i["whenToApply-".concat(n,"-").concat(t)]){var r=e({},i);return delete r["whenToApply-".concat(n,"-").concat(t)],r}return i})},[]),_a=c(function(e,t){Zt(function(i){var r=new Map(i),a=new Map(r.get(e)),o=a.get(t)||[];return a.set(t,n(n([],o,!0),[{id:Date.now(),text:"",reasoning:""}],!1)),r.set(e,a),r})},[]),fa=c(function(e,n,t){Zt(function(i){var r=new Map(i),a=new Map(r.get(e)),o=a.get(n)||[];return a.set(n,o.filter(function(e){return e.id!==t})),r.set(e,a),r})},[]),ga=c(function(n,t,i,r){Zt(function(a){var o=new Map(a),l=new Map(o.get(n)),u=l.get(t)||[];return l.set(t,u.map(function(n){return String(n.id)===String(i)?e(e({},n),{text:r}):n})),o.set(n,l),o})},[]),ma=c(function(e){var n=e.replace(/_/g," ");$n(!0),null==Ee||Ee(null),Ti(void 0),Ci("I want to add a new variant to ".concat(n))},[]),wa=function(n,t,i){var r="".concat(n,"_").concat(t);console.log("Highlighting ".concat(i," at ").concat(r)),Ji(function(n){var t,a=new Map(n),o=a.get(r)||{};return a.set(r,e(e({},o),((t={})[i]=!0,t))),a}),setTimeout(function(){Ji(function(n){var t,a=new Map(n),o=a.get(r)||{};return a.set(r,e(e({},o),((t={})[i]=!1,t))),a})},1500)},ya=c(function(n,t){Be(function(i){var r;return e(e({},i),((r={})[n]=t,r))}),Sr(function(t){if(t[n]){var i=e({},t);return delete i[n],i}return t})},[]),ha=c(function(n,t,i,r){ni(function(e){var r=new Map(e),a=new Map(r.get(n)||new Map),o=a.get(t)||new Set;return o.add(i),a.set(t,o),r.set(n,a),r}),Dt(function(a){var o,l,u,s=new Map(a),d=new Map(s.get(n)||new Map),c=d.get(t)||Lt;switch(i){case"order_rules":case"advertiser_rules":u="boolean"==typeof r?e(e({},c),((o={})[i]=e(e({},c[i]),{enabled:r}),o)):"object"==typeof r&&null!==r?e(e({},c),((l={})[i]={enabled:r.enabled,global_min_separation_seconds:r.global_min_separation_seconds},l)):c;break;case"inventory_rules":u=e(e({},c),{inventory_rules:{respect_inventory_code:"boolean"==typeof r?r:r.respect_inventory_code}});break;case"break_code_rules":u=e(e({},c),{break_code_rules:{respect_break_code:"boolean"==typeof r?r:r.respect_break_code}});break;case"is_default_enabled":u=e(e({},c),{is_default_enabled:"boolean"==typeof r?r:!!r});break;default:u=c}return d.set(t,u),s.set(n,d),s})},[]);d(function(){sr&&(Vr(!1),Kn(null),Yn(null))},[sr]);var ba=c(function(n){var t;if(void 0===n&&(n=!1),n||(aa({type:"RESET"}),cr.current=null,ri([]),Ii([]),nr([]),lr({}),Vr(!1),mn.current.clear(),T.getState().clearLearningMetadata(),li({})),Jt(""),xi([]),$n(!1),Sn.current="",Br(""),Xr(null),Pi([]),Be({station:"",tiers:[]}),Nn(0),Rn(!1),ta(null),Ht(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Qt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Zt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Dt(new Map([["tier_1",new Map([[0,Lt]])],["tier_2",new Map([[0,Lt]])],["tier_3",new Map([[0,Lt]])]])),ni(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Gt(""),Ti(0),Qi(0),Be({station:Ie,tiers:["Tier 1"]}),n||Gi({}),ni(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Ci(""),Zi({ruleTitle:"",ruleDescription:"",scopeData:"",whenToApply:"",whenNotToApply:"",configData:""}),Sr({}),Er(""),Or(!0),yn(null),bn(null),pi(new Map),gi([]),it(!1),Mn(null),di({}),vr.current=null,kn.current=!1,Zn.current={},at.current.clear(),ft.current=null,gt.current=null,_t(null),on(""),ze(B),Xe(!1),sn(!1),pn(!1),Fn(null),qn([]),Yn(null),Kn(null),ut(null),yi(!1),Li(null),Ur(""),Wr(""),Mr(!1),Vt(new Set),_n.current=!1,Tn.current.clear(),Dn.current=0,jn.current=null,xn.current=null,wt.current=null,pr.current=-1,rt.current=!1,et.current=!1,Ae){Ae.ruleTitle&&Jt(Ae.ruleTitle),Te&&(Be(function(n){return e(e({},n),{tiers:[Te]})}),gt.current=Te.toLowerCase().replace(/ /g,"_")),ft.current=Ae.ruleId;var i=null===(t=null==Se?void 0:Se[Ce||0])||void 0===t?void 0:t.variantId;if(_t(i||null),Se&&Se.length>0){var r=Te?ne(Te):"tier_1",a=new Map,o=new Map,l=new Map,u=new Map,s=new Map,d=new Map;Se.forEach(function(e,n){u.set(n,e.description||"");var t=e.whenToApply?e.whenToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];s.set(n,t);var i=e.whenNotToApply?e.whenNotToApply.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wnta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];d.set(n,i)}),a.set(r,u),o.set(r,s),l.set(r,d),Ht(a),Qt(o),Zt(l);var c=Se.map(function(e){var n,t,a=null===(n=e.configuration)||void 0===n?void 0:n.scheduling_config;return{variant_type:e.variantType||"variant",title:Ae.ruleTitle||"",rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:[r],scheduling_config:a||{},variant_id:e.variantId,question_id:Ae.ruleId||"",tier_id:r.replace("tier_",""),is_readOnly:e.variantId!==i,link_id:e.link_id||"",is_enabled:null===(t=e.is_enabled)||void 0===t||t,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,action:"edit"}});ri(c),gi(c),pi(function(e){var n=new Map(e);return n.set(r,JSON.parse(JSON.stringify(c))),n});var v=new Map;Se.forEach(function(e,n){var t,i,r,a,o,l,u,s,d,c,p,_,f,g=null===(t=e.configuration)||void 0===t?void 0:t.scheduling_config,m=null!==(a=null!==(i=null==g?void 0:g.order_global_min_separation_seconds)&&void 0!==i?i:null===(r=null==g?void 0:g.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)&&void 0!==a?a:0,w=null!==(u=null!==(o=null==g?void 0:g.advertiser_global_min_separation_seconds)&&void 0!==o?o:null===(l=null==g?void 0:g.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)&&void 0!==u?u:0;v.set(n,{order_rules:{enabled:m>0,global_min_separation_seconds:Math.floor(m/60)},advertiser_rules:{enabled:w>0,global_min_separation_seconds:Math.floor(w/60)},inventory_rules:{respect_inventory_code:null!==(c=null!==(d=null===(s=null==g?void 0:g.inventory_rules)||void 0===s?void 0:s.respect_inventory_code)&&void 0!==d?d:null==g?void 0:g.respect_inventory_code)&&void 0!==c&&c},break_code_rules:{respect_break_code:null!==(f=null!==(_=null===(p=null==g?void 0:g.break_code_rules)||void 0===p?void 0:p.respect_break_code)&&void 0!==_?_:null==g?void 0:g.respect_break_code)&&void 0!==f&&f},is_default_enabled:ee(e.variantType||e.variant_type)})}),Dt(new Map([[r,v]])),Ti(null!=Ce?Ce:0)}}},[aa,Ie,Ae,Te,Se,Ce]),Ia=function(e){if(!e||0===e.length)return"variant 1";var n=e.filter(function(e){var n=e.variant_type||e.variantType||"";return""!==n&&null!==n});return"variant ".concat(n.length+1)},Ma=c(function(){console.log("variantIds",Ri),Vr(!0)},[Ri]),Aa={"Let me connect the dots for you...":function(e){if("string"==typeof e){var n=e.match(/<!--\s*(\{[^}]*"variant_index"[^}]*\})\s*-->/);if(n)try{var t=JSON.parse(n[1]),i=parseInt(t.variant_index,10);if(!isNaN(i)&&i>0){var r=i-1;pr.current!==r&&(console.log("Opening variant accordion: AI index ".concat(i," → 0-based index ").concat(r)),Ti(r),pr.current=r)}}catch(e){console.error("Failed to parse variant_index from HTML comment:",e)}}},"Crafted Instant Learning with C.A.R.E.":function(t){var i,r,a,o=L(t),l=L(t,"general_details");console.log("--- [CARE] Staging Initial Structure ---",o),o&&(jn.current=e(e({},jn.current||{}),o));var u=L(t,"critical_gaps");if(console.log("isCriticalGap",u),Rn(!!u),o){if(o.variant_type&&!("is_variant"in o)){var s=null===(i=ka(o.variant_type||"").toLowerCase().match(/^(default_variant|default|variant)/i))||void 0===i?void 0:i[0];o.variant_type=ee(s)?"Default":"variant",o.isDefault=ee(s),console.log("parsed.variant_type",o.variant_type)}var d=o.scope&&o.scope.length>0?String(o.scope[0]):null,c=d?ka(d).toLowerCase().trim().replace(/ /g,"_"):null,v=Boolean(c&&gt.current!==c);if(v&&c){var p=gt.current;console.log("[Tier Switch Detected]",gt.current,"→",c),gt.current=c,ft.current=null;var _=(bt.current||[]).findIndex(function(e){return!0===(null==e?void 0:e.is_new_variant)});-1===_&&void 0!==Ai&&(_=Ai),p&&-1!==_&&(console.log("[Tier Switch] Stripping draft variant at index ".concat(_," from ").concat(p)),Ht(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),Qt(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),Zt(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),Dt(function(e){var n=new Map(e),t=new Map(n.get(p)||new Map);return t.delete(_),n.set(p,t),n}),ri(function(t){if(!Array.isArray(t))return t;var i=n([],t,!0);return i[_]&&(i[_]=e(e({},i[_]),{scope:[c],tier_id:c.replace("tier_","")})),bt.current=i,i})),pr.current=-1;var f=c.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()});Be(function(n){return e(e({},n),{tiers:[f]})})}Li(o),yn({Updated_Fields_Response:o,General_Response:l}),(null==l?void 0:l.variant_id)&&"new_variant_id"===(null==l?void 0:l.variant_id)&&(l.variant_id=null);var g=null==l?void 0:l.variant_id,m=null==o?void 0:o.learning_metadata,y=null!==(a=null===(r=null==m?void 0:m.properties)||void 0===r?void 0:r.scheduling_config)&&void 0!==a?a:null==m?void 0:m.scheduling_config;if(g&&m&&di(function(n){var t,i,r;return e(e({},n),((t={})[g]=e(e(e({},n[g]),m),{properties:e(e(e({},null===(i=n[g])||void 0===i?void 0:i.properties),m.properties),void 0!==y&&{scheduling_config:null!==(r=null==y?void 0:y.value)&&void 0!==r?r:y})}),t))}),(null==l?void 0:l.is_interpretation_ready)&&(null==l?void 0:l.question_id)&&co(l,o,v),(null==l?void 0:l.is_interpretation_ready)&&(null==l?void 0:l.question_id)&&ft.current&&pt)ri(function(n){if(!Array.isArray(n))return n;var t=n.map(function(n){return(null==n?void 0:n.variant_id)&&n.variant_id===pt?e(e({},n),o):n}),i=n.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===pt});return console.log(i,"targetIndexif"),-1!==i&&setTimeout(function(){console.log("targetIndex",i),Ti(i),Qi(function(e){return e+1}),pr.current=i},0),t});else if((null==l?void 0:l.is_interpretation_ready)&&(null==l?void 0:l.question_id)&&ft.current&&!pt){var h=oi["idx-0"]||"";h&&li(function(n){return e(e({},n),{"idx-0":""})}),ri(function(t){var i,r,a=e(e({},o),{is_new_variant:!0,is_variant:!0,learning_metadata:e(e({},o.learning_metadata||{}),{instruction_prompt:h})});if(Array.isArray(t)){var l=t.findIndex(function(e){return!0===e.is_new_variant});if(-1!==l){setTimeout(function(){Ti(l),Qi(function(e){return e+1}),pr.current=l},0);var u=t[l].client_id||w(),s=(null===(i=t[l].learning_metadata)||void 0===i?void 0:i.instruction_prompt)||h,d=t[l].learning_metadata||{};r=t.map(function(n,t){return t===l?e(e(e({},n),a),{client_id:u,learning_metadata:e(e(e({},d),a.learning_metadata||{}),{instruction_prompt:s})}):n})}else{var c=t.length;setTimeout(function(){Ti(c),Qi(function(e){return e+1}),pr.current=c},0),r=n(n([],t,!0),[e(e({},a),{client_id:w()})],!1)}}else setTimeout(function(){Ti(0),Qi(function(e){return e+1}),pr.current=0},0),r=[e(e({},a),{client_id:w()})];return bt.current=r,r})}else(null==l?void 0:l.is_interpretation_ready)&&(ri([o]),setTimeout(function(){Ti(0),Qi(function(e){return e+1}),pr.current=0},0));void 0!==o.is_user_accepted_risk&&ri(function(t){var i=W({flow:ke,editingRule:Ae,editingVariants:Se}),r=Array.isArray(t)?n([],t,!0):[];if(i&&0===r.length&&Se&&Se.length>0&&(r=Se.map(function(e,n){var t;return{variant_type:e.variantType||"variant ".concat(n+1),title:(null==Ae?void 0:Ae.ruleTitle)||"",rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",is_valid:!0,is_readOnly:e.variantId!==pt,variant_id:e.variantId,tier_id:(null===(t=e.tier)||void 0===t?void 0:t.tier_id)||"1",is_user_accepted_risk:e.is_user_accepted_risk||!1}})),i){var a=Qr||Zr,l=r.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===a||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===a||(null==e?void 0:e.id)&&e.id===a});if(-1===l&&void 0!==Ai&&(l=Ai),-1!==l)return r[l]=e(e({},r[l]),{is_user_accepted_risk:!!o.is_user_accepted_risk}),r}return t})}},"RHS Validation Agent Response":function(t){var i,r,a,o=t;if("string"==typeof t)try{o=JSON.parse(t)}catch(e){o=O(t)}if(bn(o),console.log("--- [RHS] Updating Staged Logic ---"),console.log("parsed data from RHS Validation",o),o){Li(function(n){var t=n;if(!t){console.log("⚠️ No staged response found! Constructing fallback from current UI state...");var i=null;if(Array.isArray(ii)){var r=W({flow:ke,editingRule:Ae,editingVariants:Se}),a=Qr||Zr,l=-1;r&&a&&(l=ii.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===a||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===a||(null==e?void 0:e.id)&&e.id===a})),-1===l&&void 0!==Ai&&(l=Ai),-1!==l&&(i=ii[l])}t=i?e({},i):{wta:"",wnta:""}}return e(e({},t),{wta:t.wta,wnta:t.wnta,is_valid:o.is_valid,conflictingConditions:o.conflictingConditions||[],conflictMarkdown:{},conflict_view:o.conflict_view||{}})});var l=Array.isArray(o.scope)&&o.scope[0]||o.tier||null,u=(l?ne(ka(String(l)).trim()):null)||gt.current||mt.current||(Te?ne(Te):null)||"tier_1";console.log("[RHS] Resolved tierKey for conflict injection:",u);var s=function(){var e,n=bt.current;if(Array.isArray(n)&&n.length>0){var t,i=n.findIndex(function(e){return!0===(null==e?void 0:e.is_new_variant)});if(-1!==i)return console.log("[RHS] Resolved via is_new_variant flag:",i),i;if(pt)if(-1!==(t=n.findIndex(function(e){return(null==e?void 0:e.variant_id)===pt||(null==e?void 0:e.new_variant_id)===pt})))return t;if(Qr)if(-1!==(t=n.findIndex(function(e){return(null==e?void 0:e.variant_id)===Qr||(null==e?void 0:e.new_variant_id)===Qr})))return t;var r=null!==(e=null==Se?void 0:Se.length)&&void 0!==e?e:0;if(n.length>r){var a=n.length-1;return console.log("[RHS] Resolved via length diff (new variant appended):",a),a}}var o=void 0!==Ai?Ai:0;return console.log("[RHS] Fallback index used:",o),o}();if(console.log("Resolved variant index for conflict injection:",s),!1===o.is_valid)((null===(i=o.conflictingConditions)||void 0===i?void 0:i.length)||0)>0&&(Sr(function(n){var t=e({},n);return o.conflictingConditions.forEach(function(e){e.condition_wnta&&!e.condition_wta?t["whenNotToApply-".concat(u,"-").concat(s)]=e.reason:t["whenToApply-".concat(u,"-").concat(s)]=e.reason}),t}),Er("")),o.conflict_view&&((null===(r=o.conflict_view.wta)||void 0===r?void 0:r.length)>0&&Qt(function(t){var i=new Map(t),r=new Map(i.get(u)||new Map),a=n([],r.get(s)||[],!0);return o.conflict_view.wta.forEach(function(n){var t=a.findIndex(function(e){return e.text.trim()===n.value});-1!==t?a[t]=e(e({},a[t]),{conflict:n}):a.push({id:"conflict-wta-".concat(Date.now(),"-").concat(Math.random()),text:n.value,conflict:n})}),r.set(s,a),i.set(u,r),i}),(null===(a=o.conflict_view.wnta)||void 0===a?void 0:a.length)>0&&Zt(function(t){var i=new Map(t),r=new Map(i.get(u)||new Map),a=n([],r.get(s)||[],!0);return o.conflict_view.wnta.forEach(function(n){var t=a.findIndex(function(e){return e.text.trim()===n.value});-1!==t?a[t]=e(e({},a[t]),{conflict:n}):a.push({id:"conflict-wnta-".concat(Date.now(),"-").concat(Math.random()),text:n.value,conflict:n})}),r.set(s,a),i.set(u,r),i}));else!0===o.is_valid&&(Sr({}),Er(""),Qt(function(n){var t=new Map(n),i=new Map(t.get(u)||new Map),r=i.get(s)||[];return i.set(s,r.map(function(n){return e(e({},n),{conflict:void 0})})),t.set(u,i),t}),Zt(function(n){var t=new Map(n),i=new Map(t.get(u)||new Map),r=i.get(s)||[];return i.set(s,r.map(function(n){return e(e({},n),{conflict:void 0})})),t.set(u,i),t}))}},"User Action Execution":function(n){console.log("--- [User Action] Execution ---",n);var t=R(n);if(console.log("parsedaction",t),"load"===(null==t?void 0:t.action)&&(null==t?void 0:t.question_id)&&co(t,null),"save"===(null==t?void 0:t.action)){var i=null==t?void 0:t.save_details;if(i&&Object.keys(i).length>0){var o=Object.keys(i),l=o.sort().map(function(e){return"".concat(e,":").concat(i[e].success,":").concat(i[e].is_updated)}).join("|");if(mn.current.has(l))return;mn.current.add(l);var u=o.every(function(e){return i[e].success});if(o.forEach(function(n){var t,o,l=i[n];if(l.success)null===(t=_r.current)||void 0===t||t.show({severity:"success",sticky:!1,life:3e3,className:E.toastSuccess,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(g,{className:E.iconSuccess}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleSuccess)},{children:"Success"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageSuccess)},{children:l.is_updated?"Changes saved successfully test!":"Learning saved successfully test!"}))]}))});else{var u=l.message||"Error Occurred while saving the rule.";null===(o=_r.current)||void 0===o||o.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:u}))]}))})}}),u){var s=new Map,d=o.map(function(e){return{id:e,action:i[e].is_updated?"existing":"new"}});He.tiers.forEach(function(e){var n=e.toLowerCase().replace(/ /g,"_");s.set(n,d)}),T.getState().setCreatedVariantInfo(Array.from(s.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),Or(!0),setTimeout(function(){uo()},3e3)}}else(null==t?void 0:t.is_save)&&(Or(!0),Dr(!0))}"discard_rule"===(null==t?void 0:t.action)&&(ri([{variant_id:void 0,rule_description:"",wta:"",wnta:"",variant_type:"variant"}]),gi([]),_t(null),Ti(0),Qi(0),ut(null),it(!1),$n(!1),xi([]),ft.current=null,kn.current=!1,Jt(""),ta(null),Dt(new Map([["tier_1",new Map([[0,Lt]])],["tier_2",new Map([[0,Lt]])],["tier_3",new Map([[0,Lt]])]])),Ht(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Qt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])),Zt(new Map([["tier_1",new Map],["tier_2",new Map],["tier_3",new Map]])))},"Validation Agent Response":function(t){var i,r;if(console.log("--- [Validation Agent] Committing Staged Data to UI ---"),console.log("raw data from Validation Agent",t,typeof t),"string"==typeof t){var a=t.match(/<!--\s*```json\s+property="rule_validation_card"\s+([\s\S]*?)```\s*-->/i);if(a&&a[1])try{var o=JSON.parse(a[1].trim()),l=null===(r=null===(i=null==o?void 0:o.validated_rules)||void 0===i?void 0:i[0])||void 0===r?void 0:r.rule_id;l&&(console.log("Setting default comparison ID:",l),Yn(l))}catch(e){console.error("Failed to parse rule_validation_card JSON",e)}}var u=L(t,"critical_gaps");console.log("isCriticalGap",u),Rn(!!u);var s="string"==typeof t?R(t):t;console.log("parsed data from Validation Agent",s);var d=x(t);Mn(s);var c=!!(null==s?void 0:s.is_variant),v=void 0===(null==s?void 0:s.close_modal)||!!(null==s?void 0:s.close_modal),p=void 0!==(null==s?void 0:s.is_save)&&!!(null==s?void 0:s.is_save);Or(v),Dr(p);var _=null==s?void 0:s.action,f="string"==typeof(null==s?void 0:s.edit_variant_id)&&s.edit_variant_id.trim()?s.edit_variant_id:"string"==typeof(null==s?void 0:s.set_variant_id)&&s.set_variant_id.trim()?s.set_variant_id:null,g="variant"===_&&c;if((null==s?void 0:s.edit_variant_id)&&!g&&zr(s.edit_variant_id),"edit"!==_&&"edit_current_rule"!==_||!f||Xr(f),g&&(zr(null),Xr(null)),"discard"===_)return console.log("Action 'discard' received: Resetting UI state but preserving chat."),et.current=!0,ba(!0),ri([]),cr.current=null,void(vr.current=null);Br(_);var m=null==s?void 0:s.new_variant_id,w="edit"===(null==s?void 0:s.action)&&(null==s?void 0:s.set_variant_id)&&!Se;(null==s?void 0:s.is_valid)?(Sr({}),Li(function(t){var i,r,a,o,l,u,d,c,v,p,_,g;if(console.log("⏮️ PREVIOUS Staged Response:",t),!t)return console.warn("⚠️ No previous staged response found"),t;var m=function(e,n){return Object.prototype.hasOwnProperty.call(e||{},n)},w=e(e({},t),s);Array.isArray(null===(i=null==s?void 0:s.condition_result)||void 0===i?void 0:i.when_to_apply)?w.wta=s.condition_result.when_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join(" OR "):m(s,"wta")&&void 0!==(null==s?void 0:s.wta)&&(w.wta=null!==(r=null==s?void 0:s.wta)&&void 0!==r?r:""),Array.isArray(null===(a=null==s?void 0:s.condition_result)||void 0===a?void 0:a.when_not_to_apply)?w.wnta=s.condition_result.when_not_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join(" OR "):m(s,"wnta")&&void 0!==(null==s?void 0:s.wnta)&&(w.wnta=null!==(o=null==s?void 0:s.wnta)&&void 0!==o?o:""),console.log("finalData",w),console.log("checking parsed here :",s);var y,h=f;if(Array.isArray(ii)&&h&&(y=h,ii.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===y||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===y||(null==e?void 0:e.id)&&e.id===y})),"edit"!==(null==s?void 0:s.action)||!Ae&&!Se)return w;console.log("inside edit flow merge");var b=Se||[],I=f,M=I?b.findIndex(function(e){return e.variantId===I||e.variant_id&&e.variant_id===I||e.id&&e.id===I}):-1;if(-1===M&&(null==s?void 0:s.set_variant_id)&&(M=b.findIndex(function(e){return e.variantId===s.set_variant_id||e.variant_id&&e.variant_id===s.set_variant_id||e.id&&e.id===s.set_variant_id})),-1===M&&I&&Array.isArray(ii)&&(M=ii.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===I||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===I||(null==e?void 0:e.id)&&e.id===I})),-1!==M){var A,T,S,k=b[M]||(null==ii?void 0:ii[M]),C=(null==k?void 0:k.tier_id)||(null==k?void 0:k.tierId)||"1",E=(null==Te?void 0:Te.toLowerCase().replace(/ /g,"_"))||"tier_".concat(C);if(pr.current!==M&&(Ti(M),pr.current=M),Array.isArray(null===(l=s.condition_result)||void 0===l?void 0:l.when_to_apply)?A=s.condition_result.when_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join("\n"):m(s,"wta")&&void 0!==(null==s?void 0:s.wta)?A=null!==(u=null==s?void 0:s.wta)&&void 0!==u?u:"":m(t,"wta")&&void 0!==(null==t?void 0:t.wta)&&(A=null!==(d=null==t?void 0:t.wta)&&void 0!==d?d:""),Array.isArray(null===(c=s.condition_result)||void 0===c?void 0:c.when_not_to_apply)?T=s.condition_result.when_not_to_apply.filter(function(e){return e&&"none"!==e.toLowerCase()}).join("\n"):m(s,"wnta")&&void 0!==(null==s?void 0:s.wnta)?T=null!==(v=null==s?void 0:s.wnta)&&void 0!==v?v:"":m(t,"wnta")&&void 0!==(null==t?void 0:t.wnta)&&(T=null!==(p=null==t?void 0:t.wnta)&&void 0!==p?p:""),void 0!==A){var N=ka(A);Ca(E,M,A,N,Kt,Qt,null==s?void 0:s.conflict_view),wa(E,M,"wta")}if(void 0!==T){var L=ka(T);Ca(E,M,T,L,$t,Zt,null==s?void 0:s.conflict_view),wa(E,M,"wnta")}if(m(s,"rule_description")&&void 0!==(null==s?void 0:s.rule_description)?S=null!==(_=null==s?void 0:s.rule_description)&&void 0!==_?_:"":m(t,"rule_description")&&void 0!==(null==t?void 0:t.rule_description)&&(S=null!==(g=null==t?void 0:t.rule_description)&&void 0!==g?g:""),void 0!==S){var O=ka(S);Ht(function(e){var n=new Map(e),t=new Map(n.get(E)||new Map);return t.set(M,O),n.set(E,t),n}),wa(E,M,"ruleDescription")}var R=void 0;m(s,"scheduling_config")&&void 0!==(null==s?void 0:s.scheduling_config)?R=null==s?void 0:s.scheduling_config:m(t,"scheduling_config")&&void 0!==(null==t?void 0:t.scheduling_config)&&(R=null==t?void 0:t.scheduling_config),R&&(Dt(function(e){var n,i,r,a,o,l,u=new Map(e),s=new Map(u.get(E)||new Map);return s.set(M,{order_rules:{enabled:!!(null===(n=R.order_rules)||void 0===n?void 0:n.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(i=R.order_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)/60)},advertiser_rules:{enabled:!!(null===(r=R.advertiser_rules)||void 0===r?void 0:r.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(a=R.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds)||0)/60)},inventory_rules:{respect_inventory_code:!!(null===(o=R.inventory_rules)||void 0===o?void 0:o.respect_inventory_code)},break_code_rules:{respect_break_code:!!(null===(l=R.break_code_rules)||void 0===l?void 0:l.respect_break_code)},is_default_enabled:"Default"===(null==t?void 0:t.variant_type)||"default_variant"===(null==t?void 0:t.variant_type)||"default"===(null==t?void 0:t.variant_type)}),u.set(E,s),u}),wa(E,M,"order_enabled"),wa(E,M,"advertiser_enabled"),wa(E,M,"respect_inventory_code"),wa(E,M,"respect_break_code")),ri(function(t){if(!Array.isArray(t)||M<0||!t[M])return t;var i=n([],t,!0),r=e({},i[M]);return void 0!==A&&(r.wta=A),void 0!==T&&(r.wnta=T),void 0!==S&&(r.rule_description=ka(S)),R&&(r.scheduling_config=R),i[M]=r,i});var x=null==t?void 0:t.variant_type;x&&ri(function(t){var i=Array.isArray(t)?n([],t,!0):[],r=i.findIndex(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===I||(null==e?void 0:e.variant_id)&&e.variant_id===(null==s?void 0:s.set_variant_id)||(null==e?void 0:e.variantId)===I});return-1!==r?i[r]=e(e({},i[r]),{variant_type:x}):i[M]=e(e({},i[M]||{}),{variant_type:x,variant_id:I||(null==s?void 0:s.set_variant_id)}),i})}})):console.warn("⚠️ parsed.is_valid is false, not committing to structuredAIResponse"),w||(c?(yi(!0),m&&m!==vr.current?(console.log("🚀 New Variant detected (".concat(m,"). Triggering loader.")),Mr(!0),Ur("Loading a variant"),console.log("reaching here in new variant flow"),Wr("This may take a moment as we update the rule with the new variant."),vr.current=m):m||console.log("ℹ️ Variant flow detected without specific ID.")):(yi(!1),vr.current=null),d&&xi(d))},"Rule comparison results":function(n){var t;if(kt){var i=function(n){if("string"!=typeof n)return n;try{var t=Array.from(n.matchAll(/<!--\s*```json\s*([\s\S]*?)\s*```\s*-->/g));if(0===t.length)return JSON.parse(n);var i=t.map(function(e){try{return JSON.parse(e[1].trim())}catch(e){return console.error("Failed to parse JSON block:",e),null}}).filter(function(e){return null!==e});return 1===i.length?i[0]:i.length>1?i.reduce(function(n,t){return e(e({},n),t)},{}):null}catch(e){return console.error("Error extracting JSON:",e),null}}(n);console.log(" LLM Push Comparison Received:",i);var r=null===(t=i[0])||void 0===t?void 0:t.current_rule_details;r&&Fn({title:r.rule_title||"",description:r.description||"",scope:r.scope||"",wta:Array.isArray(r.wta)?r.wta.join("\n"):r.wta||"",wnta:Array.isArray(r.wnta)?r.wnta.join("\n"):r.wnta||""});var a=i.map(function(e){var n,t,i=e.variant_rule_details||{},r=e.rule_difference_comparison||{},a=i.when_to_apply||i.wta||"",o=i.when_not_to_apply||i.wnta||"";return{id:(null==i?void 0:i.variant_id)&&i.variant_id||(null==i?void 0:i.id)&&i.id||"fallback-id-".concat(Math.random()),title:i.variant_title||i.rule_title||"",description:i.variant_text||i.description||"",scope:i.scope||"",wta:Array.isArray(a)?a.join("\n"):a,wnta:Array.isArray(o)?o.join("\n"):o,similarity:(null===(n=r.summary)||void 0===n?void 0:n.overall_score)||0,summaryText:(null===(t=r.summary)||void 0===t?void 0:t.overall_summary)||"",analysis:{rule_difference_comparison:r},isLoading:!1}});qn(a)}else try{i=n;if("string"==typeof n)try{i=JSON.parse(n)}catch(e){i=R(n)||[]}if(!Array.isArray(i)){if(!i||"object"!=typeof i)return void console.error("[Rule comparison results] Data is not an array:",n);i=[i]}a=i.map(function(e,n){var t,i,r,a,o=null,l=null;if((Array.isArray(e)?e:[e]).forEach(function(e){e&&(e.intent_output&&(o=e.intent_output),e.behaviour_output&&(l=e.behaviour_output))}),"string"==typeof o)try{o=JSON.parse(o)}catch(e){console.error("Failed to parse intent_output",e)}if("string"==typeof l)try{l=JSON.parse(l)}catch(e){console.error("Failed to parse behaviour_output",e)}var u="existing_variant",s="fallback-id-".concat(Math.random()),d=(null==o?void 0:o.documents)||(null==l?void 0:l.documents);if(d){var c=Object.keys(d).find(function(e){return"reference"===d[e].role});c&&(u=c,s=null==l?void 0:l.rule_id)}var v="";if((null==o?void 0:o.nodes)&&o.nodes.title){var p=o.nodes.title;(null===(i=null===(t=null==p?void 0:p.comparison_inputs)||void 0===t?void 0:t[u])||void 0===i?void 0:i.content)&&(v=p.comparison_inputs[u].content)}var _="Score";(null==l?void 0:l.final_score)&&(_=l.final_score);var f="Unknown Tier",g=(null===(r=null==d?void 0:d[u])||void 0===r?void 0:r.title)||(null===(a=null==d?void 0:d.existing_variant)||void 0===a?void 0:a.title);return g&&g.includes("|")&&(f=g.split("|")[1].trim()),console.log("Extracted for carousel:",{uniqueId:s,extractedTitle:v,extractedScore:_,extractedScope:f}),{id:s,title:v,similarityScoreText:_,scope:f,intentTreeData:o,behaviorTreeData:l,isLoading:!1}});qn(a)}catch(e){console.error("[Rule comparison results] Critical Handler Error:",e)}}},Ta=St?["Tier 1","Tier 2","Tier 3"]:gn.map(function(e){return e.tier_name.replace(/(\d+)/," $1").replace(/\b\w/g,function(e){return e.toUpperCase()}).trim()}),Sa=function(e){var n=Array.isArray(e)?e.join(" "):String(e||""),t=null==n?void 0:n.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/);return t?t[1]:null},ka=function(e){return"string"!=typeof e?"":e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,"").replace(/<!--```json[\s\S]*?```-->/g,"").trim()},Ca=function(t,i,r,a,o,l,u){var s;if(void 0!==r){var d=(o.get(t)||new Map).get(i)||[],c=d.map(function(e){return e.text}).join("\n"),v=(null===(s=d[(null==d?void 0:d.length)-1])||void 0===s?void 0:s.reasoning)||"",p=Sa(r)||"";if(""===r&&d.length>0||a.trim()!==c.trim()||p!==v){var _=""===r?{updatedItems:[],newIds:[]}:function(t,i,r){if(!t.trim())return{updatedItems:n([],i,!0),newIds:[]};var a=t.match(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g)||[],o=t.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,"").replace(/<!--```json[\s\S]*?```-->/g,""),l=[],u=o.replace(/<conflicting>[\s\S]*?<\/conflicting>/g,function(e){return l.push(e),"__CONFLICT_BLOCK_".concat((null==l?void 0:l.length)-1,"__")}).split(/\s*(?:\r?\n|\\+n)\s*/).map(function(e){return e.trim().replace(/^-\s*/,"")}).filter(Boolean),s=new Map(i.map(function(e){return[e.text,e]})),d=[],c=[],v=Array.isArray(null==r?void 0:r.wta)&&t.includes("wta")?r.wta:Array.isArray(null==r?void 0:r.wnta)?r.wnta:[];return u.forEach(function(n,t){var i=n;i.includes("__CONFLICT_BLOCK_")&&(i=i.replace(/__CONFLICT_BLOCK_(\d+)__/g,function(e,n){return l[parseInt(n)]}));var r=a[t]||"",o=i.replace(/<conflicting>[\s\S]*?<\/conflicting>/g,"").trim(),u=null==v?void 0:v.find(function(e){return e.value===o}),p=s.get(i);if(p)c.push(e(e({},p),{reasoning:r||p.reasoning,conflict:u||p.conflict}));else{var _="new-".concat(Date.now(),"-").concat(t);d.push(_),c.push({id:_,text:i,reasoning:r,conflict:u})}}),{updatedItems:c,newIds:d}}(r,d,u),f=_.updatedItems,g=_.newIds;l(function(e){var n=new Map(e),r=new Map(n.get(t)||new Map);return r.set(i,f),n.set(t,r),n}),(null==g?void 0:g.length)>0&&(Hi(function(e){return new Set(n(n([],Array.from(e),!0),g,!0))}),setTimeout(function(){Hi(function(e){var n=new Set(e);return g.forEach(function(e){return n.delete(e)}),n})},1500))}}},Ea=function(e){return(Array.isArray(e)?e:e?[e]:[]).map(function(e){return String(e).replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/,"").trim().replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()})})};d(function(){ki&&!_n.current&&"save this learning"!==ki.toLowerCase()&&(sn(!1),on(""),pr.current=null!=Ai?Ai:-1)},[ki]),d(function(){var t,i,r,a,o,l,u,s,d;if(ht.current=er,Array.isArray(ii)&&ii.length>0){var c=ir||"local-".concat(Date.now()),v=["ruleTitle","ruleDescription","whenToApply","whenNotToApply","scopeData","configData"],p={},_=cr.current||[];ii.forEach(function(t,i){var r,a;if(t){t.is_readOnly||(Dn.current=i);var o=i;if((null==t?void 0:t.variant_id)&&Se)-1!==(l=Se.findIndex(function(e){return e.variantId===t.variant_id}))&&(o=l);else if(Qr&&Se&&1===ii.length){var l;-1!==(l=Se.findIndex(function(e){return e.variantId===Qr}))&&(o=l)}var u=null!==(r=_[o])&&void 0!==r?r:_[i],s=null!==(a=t.scope)&&void 0!==a?a:null==u?void 0:u.scope,d=Ea(s).map(function(e){return e.toLowerCase().replace(/ /g,"_")}),c=Xn.current.get(o),f=d.length>0?d:c&&c.length>0?c:["tier_1"];f.length>0&&Xn.current.set(o,f);var g=He.tiers.map(function(e){return ne(e)}),m=f.filter(function(e){return g.includes(e)});0===m.length&&console.warn("[tier guard] Dropping write — resolved tier(s) [".concat(f.join(", "),"] not in selected tiers [").concat(g.join(", "),"]"));var w=ka(t.title);w&&w!==ka(null==u?void 0:u.title)&&!t.is_readOnly&&function(e,n,t,i,r,a){var o=ka(i);o&&o!==r&&(wa(e,n,t),a(o))}("global",0,"ruleTitle",t.title,qt,Jt),m.forEach(function(r){var a,l,u,s,d,c=null!==(a=_[o])&&void 0!==a?a:_[i],f=!c,g=void 0!==t.rule_description&&null!==t.rule_description,m=ka(t.rule_description),w=(null===(l=Yt.get(r))||void 0===l?void 0:l.get(o))||"",y=ka(w);g&&(m!==y||""===m&&""!==w)&&(Ht(function(e){var n=new Map(e),i=new Map(n.get(r)||new Map);return i.set(o,t.rule_description),n.set(r,i),n}),wa(r,o,"ruleDescription"));var h=!1===(null==Ni?void 0:Ni.is_valid),b=ka(t.wta),I=ka(null==c?void 0:c.wta),M=(null===(u=Kt.get(r))||void 0===u?void 0:u.get(o))||[];!(h&&""===b&&M.length>0)&&void 0!==t.wta&&null!==t.wta&&(b!==I||""===b&&M.length>0||0===M.length&&""!==b)&&(Ca(r,o,t.wta,b,Kt,Qt,null==Ni?void 0:Ni.conflict_view),wa(r,o,"wta"));var A=ka(t.wnta),T=ka(null==c?void 0:c.wnta),S=(null===(s=$t.get(r))||void 0===s?void 0:s.get(o))||[];if(!(h&&""===A&&S.length>0)&&void 0!==t.wnta&&null!==t.wnta&&(A!==T||""===A&&S.length>0||0===S.length&&""!==A)&&(Ca(r,o,t.wnta,A,$t,Zt,null==Ni?void 0:Ni.conflict_view),wa(r,o,"wnta")),t.scheduling_config||f||t.variant_type||t.variantType){var k=t.scheduling_config||{order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1}},C=null==c?void 0:c.scheduling_config,E=null===(d=xt.get(r))||void 0===d?void 0:d.get(o),N=t.variant_type||t.variantType,L=N?ee(N):void 0,O=JSON.stringify(k)!==JSON.stringify(C),R=void 0!==L&&L!==(null==E?void 0:E.is_default_enabled),x=function(n,t){if(!n)return t;if(!t)return n;var i=e({},n);for(var r in t)t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])?i[r]=e(e({},i[r]||{}),t[r]):i[r]=t[r];return i};if(t.is_readOnly||Gi(function(e){return x(e,k)}),O||R||!t.is_readOnly){Gi(function(e){return x(e,k)});var D=function(e,n,t,i){var r,a,o,l,u=[],s=(i.get(e)||new Map).get(n)||{order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1}};return Math.floor(((null===(r=t.order_rules)||void 0===r?void 0:r.global_min_separation_seconds)||0)/60)!==s.order_rules.global_min_separation_seconds&&u.push("config_order_rules"),Math.floor(((null===(a=t.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds)||0)/60)!==s.advertiser_rules.global_min_separation_seconds&&u.push("config_advertiser_rules"),!!(null===(o=t.inventory_rules)||void 0===o?void 0:o.respect_inventory_code)!==s.inventory_rules.respect_inventory_code&&u.push("config_inventory_rules"),!!(null===(l=t.break_code_rules)||void 0===l?void 0:l.respect_break_code)!==s.break_code_rules.respect_break_code&&u.push("config_break_code_rules"),!!t.is_default_enabled!=!!s.is_default_enabled&&u.push("config_is_default_enabled"),u}(r,o,k,xt);D.forEach(function(e){return wa(r,o,e)}),Vt(function(e){return new Set(e).add("config")}),Dt(function(n){var t,i,a,l,u,s,d=new Map(n),c=new Map(d.get(r)||new Map),v=c.get(o)||Lt;return c.set(o,e(e(e(e(e(e({},v),k.order_rules&&{order_rules:{enabled:!!(null===(t=k.order_rules)||void 0===t?void 0:t.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(i=k.order_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)/60)}}),k.advertiser_rules&&{advertiser_rules:{enabled:!!(null===(a=k.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds),global_min_separation_seconds:Math.floor(((null===(l=k.advertiser_rules)||void 0===l?void 0:l.global_min_separation_seconds)||0)/60)}}),k.inventory_rules&&{inventory_rules:{respect_inventory_code:!!(null===(u=k.inventory_rules)||void 0===u?void 0:u.respect_inventory_code)}}),k.break_code_rules&&{break_code_rules:{respect_break_code:!!(null===(s=k.break_code_rules)||void 0===s?void 0:s.respect_break_code)}}),void 0!==L&&{is_default_enabled:L})),d.set(r,c),d}),ni(function(e){var n=new Map(e),t=new Map(n.get(r)||new Map),i=t.get(o)||new Set;return k.order_rules&&i.add("order_rules"),k.advertiser_rules&&i.add("advertiser_rules"),k.inventory_rules&&i.add("inventory_rules"),k.break_code_rules&&i.add("break_code_rules"),void 0!==L&&i.add("is_default_enabled"),t.set(o,i),n.set(r,t),n})}}var j={ruleTitle:t.title,ruleDescription:t.rule_description,whenToApply:t.wta,whenNotToApply:t.wnta,scopeData:t.scope,configData:t.action};t.is_readOnly||v.forEach(function(e){var n=Sa(j[e]),t="ruleTitle"===e||"scopeData"===e?e:"".concat(e,"_").concat(r);n&&(n!==yt.current[t]&&(yt.current[t]=n,It.current[t]=!0,p[t]={reasoning:n,associatedCitations:[],tier:r,variantIndex:o}))}),t.conflictingConditions&&(Sr(function(n){var i=e({},n);return t.conflictingConditions.forEach(function(e){e.condition_wta&&(i["whenToApply-".concat(r,"-").concat(o)]=e.reason),e.condition_wnta&&(i["whenNotToApply-".concat(r,"-").concat(o)]=e.reason)}),i}),Vt(function(e){return new Set(n(n([],Array.from(e),!0),["conditions"],!1))}))})}});var f=-1,g=W({flow:ke,editingRule:Ae,editingVariants:Se}),m="edit"===Hr||"edit_current_rule"===Hr,w=function(e,n){return(null==e?void 0:e.variant_id)&&e.variant_id===n||(null==e?void 0:e.new_variant_id)&&e.new_variant_id===n||(null==e?void 0:e.id)&&e.id===n},y=function(e,n){if(!n)return-1;var t=e.find(function(e){return w(e,n)});if(!t)return-1;var i=String((null==t?void 0:t.tier_id)||"");if(!i)return e.findIndex(function(e){return w(e,n)});var r=e.filter(function(e){return String((null==e?void 0:e.tier_id)||"")===i}).findIndex(function(e){return w(e,n)});return-1!==r?r:e.findIndex(function(e){return w(e,n)})};if(g)if(vr.current&&wi)-1!==(f=ii.findIndex(function(e){return(null==e?void 0:e.new_variant_id)&&e.new_variant_id===vr.current||(null==e?void 0:e.variant_id)&&e.variant_id===vr.current||(null==e?void 0:e.id)&&e.id===vr.current}))&&(vr.current=null);else if(Qr||Zr){var h;(h=Qr||Zr)&&(f=y(ii,h))}else if(Ne&&Array.isArray(ii)&&ii.length>0){for(b=ii.length-1;b>=0;b--)if(ii[b]&&!(null===(i=ii[b])||void 0===i?void 0:i.is_readOnly)){f=b;break}}else null==Ce||cr.current&&0!==cr.current.length||(f=Ce);else if((h=Qr||Zr||vr.current)&&m&&(f=y(ii,h)),!m&&-1===f&&Array.isArray(ii)&&ii.length>0){for(var b=ii.length-1;b>=0;b--)if(ii[b]&&!(null===(t=ii[b])||void 0===t?void 0:t.is_readOnly)){f=b;break}-1===f&&(f=ii.length-1)}-1!==f&&Ai!==f&&(pr.current===f||kn.current&&!m||(console.log("🎯 Setting active variant accordion to index ".concat(f," (").concat(g?"EDIT":"CREATE"," mode)")),Ti(f),pr.current=f));var I=ii[0];if(I){if(I.scope&&JSON.stringify(I.scope)!==JSON.stringify(null===(r=_[0])||void 0===r?void 0:r.scope)&&"copy"!==I.action&&(l=I.scope,u=null===(a=_[0])||void 0===a?void 0:a.scope,s=Ea(l),d=u?Ea(u):[],Be(function(n){return e(e({},n),{tiers:s})}),s.forEach(function(e){var n=e.trim();d.includes(e)||wa("global",0,"scope_".concat(n))})),I.scope_rule_set&&I.scope_rule_set!==(null===(o=_[0])||void 0===o?void 0:o.scope_rule_set)){var M=I.scope_rule_set.toLowerCase().trim();["global","genre","custom"].includes(M)&&(Be(function(n){return e(e({},n),{station:M})}),wa("global",0,"scope_station"))}I.wtl&&Gt(I.wtl)}cr.current=ii.map(function(e){return e?(n=e,"function"==typeof(t=null===globalThis||void 0===globalThis?void 0:globalThis.structuredClone)?t(n):JSON.parse(JSON.stringify(n))):e;var n,t}),Object.keys(p).length>0&&(aa({type:"SAVE_CITATIONS",requestId:c,reasoningMap:p,rawCitations:er}),function(e){var n=e.requestId,t=e.keys,i=e.newReasoningMap,r=e.getLatestReasoning,a=e.currentCitations;console.group("%c Citation Audit: ".concat(n," "),"background: #5928ed; color: #fff; font-weight: bold;");var o={};t.forEach(function(e){var n=r(e),t=!!i[e],l=t?a:(null==n?void 0:n.associatedCitations)||[];o[e]={Status:t?"NEW ✅":n?"FALLBACK 🔄":"EMPTY ❌",Source:t?"Current Msg":n?"History":"N/A","Reasoning Preview":t?i[e].reasoning:(null==n?void 0:n.reasoning)||"None","Full Citations":l}}),console.table(o),console.groupEnd()}({requestId:c,keys:Object.keys(p),newReasoningMap:p,getLatestReasoning:oa,currentCitations:er}),Zi(function(n){var t=e({},n),i=!1;return Object.keys(p).forEach(function(e){var n=p[e];n.reasoning&&t[e]!==n.reasoning&&(t[e]=n.reasoning,i=!0),n.associatedCitations}),i?t:n}))}},[ii,er,ir]),d(function(){var t=Object.keys(It.current);if(0!==t.length){var i={};t.forEach(function(e){i[e]=n([],er,!0)}),It.current={},lr(function(n){return e(e({},n),i)})}},[er]);var Na=function(e){return e.map(function(e){var n;return null===(n=e.match(/\d+/))||void 0===n||n[0],e.replace(/\s+/g,"-"),{name:"Custom",parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:(null==At?void 0:At.CUSTOM_SCOPE_GROUP_NAME)||"",description:(null==Me?void 0:Me.ruleSetDesc)||""}}})},La=function(n,t,i,r){void 0===r&&(r=0);var a=e({},t||{});return n.forEach(function(n,o){var l=n.get(r);l&&l.forEach(function(n){var l,u=t[n]||{},s=i.get(o),d=null==s?void 0:s.get(r),c=null==d?void 0:d[n];if("order_rules"===n||"advertiser_rules"===n){var v=null!==(l=null==c?void 0:c.enabled)&&void 0!==l&&l?60*((null==c?void 0:c.global_min_separation_seconds)||0):0;a[n]=e(e({},u),{global_min_separation_seconds:v})}else a[n]="inventory_rules"===n?e(e({},u),{respect_inventory_code:null==c?void 0:c.respect_inventory_code}):"break_code_rules"===n?e(e({},u),{respect_break_code:null==c?void 0:c.respect_break_code}):"is_default_enabled"===n?null!=c&&c:u})}),a},Oa=function(e,n,t){void 0===t&&(t="variantType");var i=null==e?void 0:e[n];if(!i)return{label:Ia(e),isDefault:!1};var r=i[t]||"",a=ee(r);return{label:"variant ".concat(n+1),isDefault:a}},Ra=function(e,n){var t=ee(e);return{label:"variant ".concat(n+1),isDefault:t}},xa=function(e,n,t){var i;void 0===t&&(t="");var r=null===(i=xt.get(e))||void 0===i?void 0:i.get(n);return r?r.is_default_enabled?"Default":"Variant":ee(t)?"Default":"Variant"},Da=function(n,o){return void 0===o&&(o=!1),t(void 0,void 0,void 0,function(){var t,l,u,s,d,c,v,_,f,g,m,y,b,I,M;return i(this,function(i){switch(i.label){case 0:t=Na(He.tiers),l=T.getState().backwardCompatibility,u=Dn.current,La(ei,Fi,xt,u),i.label=1;case 1:return i.trys.push([1,3,,4]),ze(z),on(""),s=Z(Fi),d=w(),c=[],v=[],_=(ii||[])[u]||{},He.tiers.forEach(function(i){var r,a,o,p,f,g,m,y,b,I,M,A,T,S,k,C,E,N,L=i.toLowerCase().replace(/ /g,"_");v.push(L);var O=(null===(r=Yt.get(L))||void 0===r?void 0:r.get(u))||"",R=(null===(a=Kt.get(L))||void 0===a?void 0:a.get(u))||[],x=(null===(o=$t.get(L))||void 0===o?void 0:o.get(u))||[];if(!1===l){var D=[e(e({},s&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},s)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},tierLinkId:d,variant:ka(O),conditions_whentoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:x.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null===(g=null===(f=null===(p=xt.get(L))||void 0===p?void 0:p.get(u))||void 0===f?void 0:f.is_default_enabled)||void 0===g||g,tier_id:(null===(m=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===L||e.tier_name.toLowerCase()===L.replace(/_/g,"")}))||void 0===m?void 0:m.tier_id)||"",topic_id:null,scope_id:(null==Me?void 0:Me.ruleSetId)||"",question_title:qt,variantType:xa(L,u,_.variant_type||_.variantType),learning_metadata:J(Qa,Xa),instantLearningType:At.INSTANT_LEARNING_TYPE,is_user_accepted_risk:!1,propagation:!0,applicationMappingId:Fe,modeId:Ue})];c.push(h(D,At.ASSISTANT_NAME))}else{D={status:"approved",metadata:e(e({userName:null!==(y=null==ia?void 0:ia.firstname)&&void 0!==y?y:"",userEmailId:null!==(b=null==ia?void 0:ia.email)&&void 0!==b?b:"",llm:G.MODEL,isVariantFlow:!0},s&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},s)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:d,variant:ka(O),conditions_whentoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:x.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:t[0]||{name:G.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:G.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null===(A=null===(M=null===(I=xt.get(L))||void 0===I?void 0:I.get(u))||void 0===M?void 0:M.is_default_enabled)||void 0===A||A,tier:{name:i.split(" ").join("").toLowerCase(),tierGroupName:G.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(i.split(" ")[1]||"1"),tier_id:(null===(T=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===L||e.tier_name.toLowerCase()===L.replace(/_/g,"")}))||void 0===T?void 0:T.tier_id)||""},topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:G.CATEGORY,description:G.CATEGORY}],originalQuestion:qt,questionId:n.get(L)||null,variantType:xa(L,u,_.variant_type||_.variantType),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(S=null==ia?void 0:ia.email)&&void 0!==S?S:"",instantLearningType:G.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(k=null==_?void 0:_.is_user_accepted_risk)&&void 0!==k?k:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0}),appsecData:{application:null!==(C=null==Ct?void 0:Ct.applicationId)&&void 0!==C?C:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(E=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==E?E:"",applicationLevelResourceId:null!==(N=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==N?N:""}};c.push(h(D,At.ASSISTANT_NAME))}}),[4,Promise.all(c)];case 2:return f=i.sent(),pn(!1),console.log("✅ All feedback published:",f),ze(K),Xe(!0),g=new Map,f.forEach(function(e,n){var t,i,r=v[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)&&e.data.variant_id||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id)&&e.variant_id;if(a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data),a&&"string"==typeof a){var o=g.get(r)||[];o.push({id:a,action:"new"}),g.set(r,o)}}),T.getState().setCreatedVariantInfo(Array.from(g.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),dn.current=setTimeout(function(){Lr||o?(console.log("Closing modal after save success",{isCloseModal:Lr,forceClose:o}),uo()):ba(!0)},3e3),[3,4];case 3:return m=i.sent(),console.error("❌ Error publishing feedback:",m),pn(!1),ze(Q),sn(!0),y=(null===(I=null==m?void 0:m.response)||void 0===I?void 0:I.data)||{},console.log("errorData: ",y),(b="Variant already exists"===(null==y?void 0:y.message))||409===(null==m?void 0:m.status)?on('Looks like a similar rule already exists with the same conditions. You can update the description or conditions to make it unique, or discard this learning. <br/> How would you like to proceed?\n <br/><button class="clickable-button" data-value="Discard learning">Discard learning</button>\n <br/><button class="clickable-button" data-value="Continue editing learning">Continue editing learning</button>\n <br/><button class="clickable-button" id="typeYourAnswer">Or, type your response</button>'):on(((null==y?void 0:y.message)||(null==y?void 0:y.detail)||"Error Occurred while saving the rule.")+'Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),null===(M=_r.current)||void 0===M||M.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:b||409===(null==m?void 0:m.status)?"Similar rule already exists. Please update and try again.":(null==y?void 0:y.message)||(null==y?void 0:y.detail)||"Something went wrong while saving the learning!"}))]}))}),[3,4];case 4:return[2]}})})},ja=function(){return t(void 0,void 0,void 0,function(){var t,o,l,u,s,d,c,v,_,f,g,m,y,I,M,A,S,k,C,N,L,O,R,x,D;return i(this,function(i){switch(i.label){case 0:t=T.getState().tiers,La(ei,Fi,xt),o=Z(Fi),l=Dn.current,u=(ii||[])[l]||{},s=(null==Ni?void 0:Ni.variant_type)||u.variant_type||"",i.label=1;case 1:if(i.trys.push([1,3,,4]),ze(z),on(""),c=(d=Se||[]).length>0?null===(N=d.find(function(e){return(null==e?void 0:e.link_id)&&""!==e.link_id.trim()}))||void 0===N?void 0:N.link_id:null,v=(null===(L=He.tiers[0])||void 0===L?void 0:L.toLowerCase().replace(/ /g,"_"))||"tier_1",_=(null===(O=Yt.get(v))||void 0===O?void 0:O.size)||d.length,f=n([],d,!0),0===_)return console.warn("[saveEditedVariant] No variants to save (editingVariants empty and no ruleDescription entries for",v,"). Aborting save."),ze(Q),pn(!1),on("Nothing to save — no variant data found for this tier."),[2];for(g=d.length;g<_;g++)f.push({isNewVariant:!0,variantId:w()});return m=[],y=[],I=Na(He.tiers),He.tiers.forEach(function(n){var i=n.toLowerCase().replace(/ /g,"_"),r=t.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===i||e.tier_name.toLowerCase()===i.replace(/_/g,"")}),a=Yt.get(i),l=Kt.get(i),d=$t.get(i);f.forEach(function(t,v){var p,_,f,g,M,A,T,S,k,C,E,N,L,O,R,x,D,j,P,V,F,G,U,q,J,W,Y,H,B,K,Q,z,X,ne,te,ie,re,ae,oe,le,ue,se,de=(null==a?void 0:a.get(v))||t.description||"",ce=(null==l?void 0:l.get(v))||[],ve=(null==d?void 0:d.get(v))||[];if(t.isNewVariant){y.push({tierKey:i,payloadType:"new"}),La(ei,Fi,xt,v);var pe=Z(Fi);if(!1===St){var _e={status:"approved",metadata:e(e({userName:null!==(p=null==ia?void 0:ia.firstname)&&void 0!==p?p:"",userEmailId:null!==(_=null==ia?void 0:ia.email)&&void 0!==_?_:"",llm:At.MODEL,isVariantFlow:!0},pe&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},pe)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:c||w(),variant:ka(de),conditions_whentoapply:ce.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:ve.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:I[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(M=null===(g=null===(f=xt.get(i))||void 0===f?void 0:f.get(v))||void 0===g?void 0:g.is_default_enabled)&&void 0!==M?M:ee(t.variantType||t.variant_type||(0===v?"Default":"variant")),tier:{name:n.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(n.split(" ")[1]||"1")},topic:{id:null,value:"".concat(He.station,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:null==Ae?void 0:Ae.ruleId,variantType:xa(i,v,u.variant_type||""),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(A=null==ia?void 0:ia.email)&&void 0!==A?A:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(S=null===(T=(ii||[])[v])||void 0===T?void 0:T.is_user_accepted_risk)&&void 0!==S?S:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0})};console.log("payload (publish new variant)",_e),m.push(h(_e,At.ASSISTANT_NAME))}else{_e={status:"approved",metadata:e(e({userName:null!==(k=null==ia?void 0:ia.firstname)&&void 0!==k?k:"",userEmailId:null!==(C=null==ia?void 0:ia.email)&&void 0!==C?C:"",llm:At.MODEL,isVariantFlow:!0},pe&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},pe)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:c||w(),variant:ka(de),conditions_whentoapply:ce.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:ve.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:I[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(L=null===(N=null===(E=xt.get(i))||void 0===E?void 0:E.get(v))||void 0===N?void 0:N.is_default_enabled)&&void 0!==L?L:ee(t.variantType||t.variant_type||(0===v?"Default":"variant")),tier:{name:n.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(n.split(" ")[1]||"1")},topic:{id:null,value:"".concat(He.station,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:null==Ae?void 0:Ae.ruleId,variantType:xa(i,v,u.variant_type||""),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(O=null==ia?void 0:ia.email)&&void 0!==O?O:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(x=null===(R=(ii||[])[v])||void 0===R?void 0:R.is_user_accepted_risk)&&void 0!==x?x:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0}),appsecData:{application:null!==(D=null==Ct?void 0:Ct.applicationId)&&void 0!==D?D:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(j=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==j?j:"",applicationLevelResourceId:null!==(P=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==P?P:""}};console.log("payload (publish new variant)",_e),m.push(h(_e,At.ASSISTANT_NAME))}}else{y.push({tierKey:i,payloadType:"existing",existingId:t.variantId});var fe=t.variantId===Qr,ge=xa(i,v,fe?s||t.variantType||"":t.variantType||""),me=e(e({variantId:t.variantId,ruleDesc:(null==Me?void 0:Me.ruleSetDesc)||"",whenToApply:ce.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),whenNotToApply:ve.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null!==(G=null===(F=null===(V=xt.get(i))||void 0===V?void 0:V.get(v))||void 0===F?void 0:F.is_default_enabled)&&void 0!==G?G:ee(t.variantType||t.variant_type||(0===v?"Default":"variant")),tier:{tier_id:(null==r?void 0:r.tier_id)||"",tier_name:(null==r?void 0:r.tier_name)||n,tier_priority:null!==(U=null==r?void 0:r.tier_priority)&&void 0!==U?U:null},scope_id:(null==Me?void 0:Me.ruleSetId)||"",description:ka(de)||"",topic:"".concat(He.station,"RuleSet")},o&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},o)}}}),{tierLinkId:null!=c?c:null,variantType:ge,is_user_accepted_risk:!!(null!==(J=null===(q=(ii||[])[v])||void 0===q?void 0:q.is_user_accepted_risk)&&void 0!==J?J:null==t?void 0:t.is_user_accepted_risk),is_enabled:t.is_enabled,appsecData:{application:null!==(W=null==Ct?void 0:Ct.applicationId)&&void 0!==W?W:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(Y=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==Y?Y:"",applicationLevelResourceId:null!==(H=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==H?H:""}}),we=(vi.get(i)||[]).find(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===t.variantId}),ye=!0;if(we){var he=function(e){var n=(e||"").trim();return(n=$(n)).replace(/\s+/g," ").replace(/(\s*OR\s*)/g," OR ")},be=he(qt)===he(we.title),Ie=he(de)===he(we.rule_description),Te=he(me.whenToApply)===he(we.wta),Se=he(me.whenNotToApply)===he(we.wnta),ke=!!me.isDefault===ee(we.variant_type),Ce=we.scheduling_config||{},Ee=null!==(Q=null!==(B=Ce.order_global_min_separation_seconds)&&void 0!==B?B:null===(K=Ce.order_rules)||void 0===K?void 0:K.global_min_separation_seconds)&&void 0!==Q?Q:0,Ne=null!==(ne=null!==(z=Ce.advertiser_global_min_separation_seconds)&&void 0!==z?z:null===(X=Ce.advertiser_rules)||void 0===X?void 0:X.global_min_separation_seconds)&&void 0!==ne?ne:0,Le=null!==(re=null!==(ie=null===(te=Ce.inventory_rules)||void 0===te?void 0:te.respect_inventory_code)&&void 0!==ie?ie:Ce.respect_inventory_code)&&void 0!==re&&re,Oe=null!==(le=null!==(oe=null===(ae=Ce.break_code_rules)||void 0===ae?void 0:ae.respect_break_code)&&void 0!==oe?oe:Ce.respect_break_code)&&void 0!==le&&le,Re=(null===(ue=xt.get(i))||void 0===ue?void 0:ue.get(v))||Lt,xe=Re.order_rules.enabled===Ee>0&&Re.order_rules.global_min_separation_seconds===Math.floor(Ee/60)&&Re.advertiser_rules.enabled===Ne>0&&Re.advertiser_rules.global_min_separation_seconds===Math.floor(Ne/60)&&Re.inventory_rules.respect_inventory_code===Le&&Re.break_code_rules.respect_break_code===Oe;be&&Ie&&Te&&Se&&ke&&xe&&(ye=!1)}ye?(console.log("payloadv (update existing variant)",me),m.push(b(me,null!==(se=null==ia?void 0:ia.email)&&void 0!==se?se:""))):(console.log("[saveEditedVariant] No changes for variant ".concat(t.variantId,", skipping API call")),m.push(Promise.resolve({data:{id:t.variantId},skipped:!0})))}})}),[4,Promise.all(m)];case 2:return M=i.sent(),console.log("✅ All variants updated:",M),M.every(function(e){return null==e?void 0:e.skipped})?(console.warn("[saveEditedVariant] No API calls were made — all variants unchanged. Skipping success toast."),ze(B),pn(!1),null===(R=_r.current)||void 0===R||R.show({severity:"info",sticky:!1,life:3e3,summary:"No changes",detail:"No changes to save."}),[2]):(ze(K),Xe(!0),pn(!1),A=new Map,M.forEach(function(e,n){var t,i;if(!(null==e?void 0:e.skipped)){var r=y[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id);a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data);var o="existing"===r.payloadType?r.existingId:a;if(o&&"string"==typeof o){var l=A.get(r.tierKey)||[];l.push({id:o,action:r.payloadType}),A.set(r.tierKey,l)}}}),T.getState().setCreatedVariantInfo(Array.from(A.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),dn.current=setTimeout(function(){uo()},3e3),[3,4]);case 3:return S=i.sent(),console.error("❌ Error updating variant:",S),ze(Q),sn(!0),pn(!1),k=(null===(x=null==S?void 0:S.response)||void 0===x?void 0:x.data)||{},console.log("errorData: ",k),(C="Variant already exists"===(null==k?void 0:k.message))||409===(null==S?void 0:S.status)?on('Looks like a similar rule already exists with the same conditions. You can update the description or conditions to make it unique, or discard this learning. <br/> How would you like to proceed?\n <br/><button class="clickable-button" data-value="Discard learning">Discard learning</button>\n <br/><button class="clickable-button" data-value="Continue editing learning">Continue editing learning</button>\n <br/><button class="clickable-button" id="typeYourAnswer">Or, type your response</button>'):on(((null==k?void 0:k.message)||(null==k?void 0:k.detail)||"Error Occurred while saving the rule.")+'Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),null===(D=_r.current)||void 0===D||D.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:C||409===(null==S?void 0:S.status)?"Similar rule already exists. Please update and try again.":(null==k?void 0:k.message)||(null==k?void 0:k.detail)||"Something went wrong while saving the learning!"}))]}))}),[3,4];case 4:return[2]}})})},Pa=function(){return t(void 0,void 0,void 0,function(){var n,t,o,l,u,s,d,c,v,_,f,g,m,y,I,M,A,S,k,C,N,L,O,R,x,D;return i(this,function(i){switch(i.label){case 0:n=T.getState().tiers,La(ei,Fi,xt),t=Z(Fi),i.label=1;case 1:return i.trys.push([1,9,,10]),ze(z),on(""),0===(o=Array.isArray(ii)?ii:[]).length?(console.warn("No variants found to save."),ze(Q),[2]):(l=o.filter(function(e){return e.is_new_variant}),u=o.filter(function(e){return!e.is_new_variant&&(null==e?void 0:e.variant_id)}),console.log("[saveLoadAndEditVariant] New: ".concat(l.length,", Existing: ").concat(u.length)),s=u.length>0?null===(O=u.find(function(e){return(null==e?void 0:e.link_id)&&""!==e.link_id.trim()}))||void 0===O?void 0:O.link_id:null,d=[],c=[],v=[],_=[],f=Na(He.tiers),He.tiers.forEach(function(i){var r=i.toLowerCase().replace(/ /g,"_"),a=n.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===r||e.tier_name.toLowerCase()===r.replace(/_/g,"")}),l=Yt.get(r),u=Kt.get(r),p=$t.get(r);o.forEach(function(n,o){var g,m,y,h,I,M,A,T,S,k,C,E,N,L,O,R,x,D,j,P,V,F,G,U,q,J,W,Y,H,B,K,Q,z,X,ne,te,ie,re,ae,oe,le=(null==l?void 0:l.get(o))||n.rule_description||n.description||"",ue=(null==u?void 0:u.get(o))||[],se=(null==p?void 0:p.get(o))||[];if(n.is_new_variant){La(ei,Fi,xt,o);var de=Z(Fi),ce=xa(r,o,n.variant_type||n.variantType||"");if(!1===St){var ve={status:"approved",metadata:e(e({userName:null!==(g=null==ia?void 0:ia.firstname)&&void 0!==g?g:"",userEmailId:null!==(m=null==ia?void 0:ia.email)&&void 0!==m?m:"",llm:At.MODEL,isVariantFlow:!0},de&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},de)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:s||w(),variant:ka(le),conditions_whentoapply:ue.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:se.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:f[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(I=null===(h=null===(y=xt.get(r))||void 0===y?void 0:y.get(o))||void 0===h?void 0:h.is_default_enabled)&&void 0!==I?I:ee(n.variantType||n.variant_type||(0===o?"Default":"variant")),tier:{name:i.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(i.split(" ")[1]||"1"),tier_id:(null==a?void 0:a.tier_id)||""},topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:ft.current||null,variantType:ce,parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(M=null==ia?void 0:ia.email)&&void 0!==M?M:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(A=null==n?void 0:n.is_user_accepted_risk)&&void 0!==A?A:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0})};console.log("[saveLoadAndEditVariant] publish payload (new variant)",ve),c.push({payload:ve,tierKey:r}),_.push({tierKey:r})}else{ve={status:"approved",metadata:e(e({userName:null!==(T=null==ia?void 0:ia.firstname)&&void 0!==T?T:"",userEmailId:null!==(S=null==ia?void 0:ia.email)&&void 0!==S?S:"",llm:At.MODEL,isVariantFlow:!0},de&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},de)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:s||w(),variant:ka(le),conditions_whentoapply:ue.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:se.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:f[0]||{name:At.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:At.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null!==(E=null===(C=null===(k=xt.get(r))||void 0===k?void 0:k.get(o))||void 0===C?void 0:C.is_default_enabled)&&void 0!==E?E:ee(n.variantType||n.variant_type||(0===o?"Default":"variant")),tier:{name:i.split(" ").join("").toLowerCase(),tierGroupName:At.CUSTOM_SCOPE_GROUP_NAME,tierPriority:parseInt(i.split(" ")[1]||"1"),tier_id:(null==a?void 0:a.tier_id)||""},topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:At.CATEGORY,description:At.CATEGORY}],originalQuestion:qt,questionId:ft.current||null,variantType:ce,parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(N=null==ia?void 0:ia.email)&&void 0!==N?N:"",instantLearningType:At.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(L=null==n?void 0:n.is_user_accepted_risk)&&void 0!==L?L:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0}),appsecData:{application:null!==(O=null==Ct?void 0:Ct.applicationId)&&void 0!==O?O:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(R=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==R?R:"",applicationLevelResourceId:null!==(x=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==x?x:""}};console.log("[saveLoadAndEditVariant] publish payload (new variant)",ve),c.push({payload:ve,tierKey:r}),_.push({tierKey:r})}}else if(null==n?void 0:n.variant_id){v.push({tierKey:r,existingId:n.variant_id});var pe=(null==n?void 0:n.variant_id)&&n.variant_id===na?(null==Ni?void 0:Ni.variant_type)||n.variant_type||n.variantType||"":n.variant_type||n.variantType||"",_e=(ce=xa(r,o,pe),e(e({variantId:n.variant_id,ruleDesc:(null==Me?void 0:Me.ruleSetDesc)||"",whenToApply:ue.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),whenNotToApply:se.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null!==(P=null===(j=null===(D=xt.get(r))||void 0===D?void 0:D.get(o))||void 0===j?void 0:j.is_default_enabled)&&void 0!==P?P:ee(n.variantType||n.variant_type||(0===o?"Default":"variant")),tier:{tier_id:(null==a?void 0:a.tier_id)||"",tier_name:(null==a?void 0:a.tier_name)||i,tier_priority:null!==(V=null==a?void 0:a.tier_priority)&&void 0!==V?V:null},scope_id:(null==Me?void 0:Me.ruleSetId)||"",description:ka(le)||"",topic:"".concat(He.station,"RuleSet")},t&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},t)}}}),{tierLinkId:null!=s?s:null,variantType:ce,is_user_accepted_risk:!!(null!==(F=null==n?void 0:n.is_user_accepted_risk)&&void 0!==F?F:null===(G=(ii||[])[o])||void 0===G?void 0:G.is_user_accepted_risk),is_enabled:n.is_enabled,appsecData:{application:null!==(U=null==Ct?void 0:Ct.applicationId)&&void 0!==U?U:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(q=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==q?q:"",applicationLevelResourceId:null!==(J=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==J?J:""}})),fe=(vi.get(r)||[]).find(function(e){return(null==e?void 0:e.variant_id)&&e.variant_id===(null==n?void 0:n.variant_id)}),ge=!0;if(fe){var me=function(e){var n=(e||"").trim();return(n=$(n)).replace(/\s+/g," ").replace(/(\s*OR\s*)/g," OR ")},we=me(qt)===me(fe.title),ye=me(le)===me(fe.rule_description),he=me(_e.whenToApply)===me(fe.wta),be=me(_e.whenNotToApply)===me(fe.wnta),Ae=!!_e.isDefault===ee(fe.variant_type),Te=fe.scheduling_config||{},Se=null!==(H=null!==(W=Te.order_global_min_separation_seconds)&&void 0!==W?W:null===(Y=Te.order_rules)||void 0===Y?void 0:Y.global_min_separation_seconds)&&void 0!==H?H:0,ke=null!==(Q=null!==(B=Te.advertiser_global_min_separation_seconds)&&void 0!==B?B:null===(K=Te.advertiser_rules)||void 0===K?void 0:K.global_min_separation_seconds)&&void 0!==Q?Q:0,Ce=null!==(ne=null!==(X=null===(z=Te.inventory_rules)||void 0===z?void 0:z.respect_inventory_code)&&void 0!==X?X:Te.respect_inventory_code)&&void 0!==ne&&ne,Ee=null!==(re=null!==(ie=null===(te=Te.break_code_rules)||void 0===te?void 0:te.respect_break_code)&&void 0!==ie?ie:Te.respect_break_code)&&void 0!==re&&re,Ne=(null===(ae=xt.get(r))||void 0===ae?void 0:ae.get(o))||Lt,Le=Ne.order_rules.enabled===Se>0&&Ne.order_rules.global_min_separation_seconds===Math.floor(Se/60)&&Ne.advertiser_rules.enabled===ke>0&&Ne.advertiser_rules.global_min_separation_seconds===Math.floor(ke/60)&&Ne.inventory_rules.respect_inventory_code===Ce&&Ne.break_code_rules.respect_break_code===Ee;we&&ye&&he&&be&&Ae&&Le&&(ge=!1)}ge?(console.log("[saveLoadAndEditVariant] update payload (existing variant)",_e),d.push(b(_e,null!==(oe=null==ia?void 0:ia.email)&&void 0!==oe?oe:""))):(console.log("[saveLoadAndEditVariant] No changes for variant ".concat(n.variant_id,", skipping API call")),d.push(Promise.resolve({data:{id:n.variant_id},skipped:!0})))}})}),[4,Promise.all(d)]);case 2:g=i.sent(),console.log("✅ All existing variants updated:",g),m=[],y=0,I=c,i.label=3;case 3:if(!(y<I.length))return[3,8];M=I[y],i.label=4;case 4:return i.trys.push([4,6,,7]),[4,h(M.payload,At.ASSISTANT_NAME)];case 5:return A=i.sent(),m.push(A),[3,7];case 6:throw S=i.sent(),console.error("❌ Error publishing new variant:",S),S;case 7:return y++,[3,3];case 8:return console.log("✅ All new variants published:",m),0===c.length&&g.every(function(e){return null==e?void 0:e.skipped})?(console.warn("[saveLoadAndEditVariant] No API calls were made — all variants unchanged. Skipping success toast."),ze(B),pn(!1),null===(R=_r.current)||void 0===R||R.show({severity:"info",sticky:!1,life:3e3,summary:"No changes",detail:"No changes to save."}),[2]):(k=new Map,g.forEach(function(e,n){var t,i;if(!(null==e?void 0:e.skipped)){var r=v[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)&&e.data.variant_id||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id)&&e.variant_id;a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data);var o=r.existingId||a;if(o&&"string"==typeof o){var l=k.get(r.tierKey)||[];l.push({id:o,action:"existing"}),k.set(r.tierKey,l)}}}),m.forEach(function(e,n){var t,i,r=_[n],a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.variant_id)&&e.data.variant_id||(null==e?void 0:e.id)||(null==e?void 0:e.variant_id)&&e.variant_id;if(a||"string"!=typeof(null==e?void 0:e.data)||(a=e.data),a&&"string"==typeof a){var o=k.get(r.tierKey)||[];o.push({id:a,action:"new"}),k.set(r.tierKey,o)}}),T.getState().setCreatedVariantInfo(Array.from(k.entries()).map(function(e){return{tierName:e[0],variants:e[1]}})),ze(K),Xe(!0),pn(!1),kn.current=!1,dn.current=setTimeout(function(){uo()},3e3),[3,10]);case 9:return C=i.sent(),console.error("❌ Error updating variant:",C),ze(Q),sn(!0),pn(!1),N=(null===(x=null==C?void 0:C.response)||void 0===x?void 0:x.data)||{},console.log("errorData: ",N),(L="Variant already exists"===(null==N?void 0:N.message))||409===(null==C?void 0:C.status)?on('Looks like a similar rule already exists with the same conditions. You can update the description or conditions to make it unique, or discard this learning. <br/> How would you like to proceed?\n <br/><button class="clickable-button" data-value="Discard learning">Discard learning</button>\n <br/><button class="clickable-button" data-value="Continue editing learning">Continue editing learning</button>\n <br/><button class="clickable-button" id="typeYourAnswer">Or, type your response</button>'):on(((null==N?void 0:N.message)||(null==N?void 0:N.detail)||"Error Occurred while saving the rule.")+'Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),null===(D=_r.current)||void 0===D||D.show({severity:"error",sticky:!1,className:E.toastError,content:r("div",e({className:E.toastContent},{children:[r("div",e({className:E.toastHeaderLeft},{children:[a(p,{className:E.iconError}),a("span",e({className:"".concat(E.toastTitle," ").concat(E.toastTitleError)},{children:"Error"}))]})),a("p",e({className:"".concat(E.toastMessage," ").concat(E.toastMessageError)},{children:L||409===(null==C?void 0:C.status)?"Similar rule already exists. Please update and try again.":(null==N?void 0:N.message)||(null==N?void 0:N.detail)||"Something went wrong while saving the learning!"}))]}))}),[3,10];case 10:return[2]}})})},Va=function(e){return"string"!=typeof e?e:e.replace(/<conflicting_text>[\s\S]*?<\/conflicting_text>/g,"").replace(/<decision_strength>[\s\S]*?<\/decision_strength>/g,"").replace(/<conflicting_reasoning>[\s\S]*?<\/conflicting_reasoning>/g,"").replace(/<conflicting_gap>[\s\S]*?<\/conflicting_gap>/g,"").replace(/<\/?conflicting>/g,"").trim()},Fa=W({flow:ke,editingRule:Ae,editingVariants:Se}),Ga=!Fa&&qt.trim().length>0,Ua=Fa?"Drafts cannot be saved in Edit Mode.":"Add a title before saving a draft.",qa=function(){return t(void 0,void 0,void 0,function(){var n,t,r,a,o,l,u,s,d,c;return i(this,function(i){switch(i.label){case 0:if(!Ga)return Sr(function(n){return e(e({},n),{ruleTitle:"Rule Title is required"})}),[2];ze(z),sn(!1),on(""),i.label=1;case 1:return i.trys.push([1,4,,5]),n=(null===(o=null==Se?void 0:Se[0])||void 0===o?void 0:o.is_drafted)&&null!==(u=null===(l=null==Se?void 0:Se[0])||void 0===l?void 0:l.variantId)&&void 0!==u?u:"",t=Y(null===(s=An.current)||void 0===s?void 0:s.save_api_payload,n),console.log("[DRAFT FLOW] Save as Draft payload:",t),[4,I(t)];case 2:return i.sent(),ze(K),tn("Your learning draft has been saved successfully."),Xe(!0),[4,null==Pe?void 0:Pe()];case 3:return i.sent(),lo(),[3,5];case 4:return r=i.sent(),console.error("[DRAFT FLOW] Failed to save draft:",r),a=(null===(c=null===(d=null==r?void 0:r.response)||void 0===d?void 0:d.data)||void 0===c?void 0:c.message)||(null==r?void 0:r.message)||"Failed to save draft. Please try again.",on(a),sn(!0),ze(Q),[3,5];case 5:return[2]}})})};d(function(){if(xr&&!sr&&St){console.log("isSaveRule received from agent — calling publish APIs directly."),Dr(!1);t(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,7,,8]),W({flow:ke,editingRule:Ae,editingVariants:Se})?[4,ja()]:[3,2];case 1:return n.sent(),[3,6];case 2:return!0===kn.current&&ft.current?[4,Pa()]:[3,4];case 3:return n.sent(),[3,6];case 4:return[4,t(void 0,void 0,void 0,function(){var e,n,t,r,a,o,l,u;return i(this,function(s){switch(s.label){case 0:s.trys.push([0,6,,8]),ze(z),console.log("[CREATE FLOW] Starting handleSaveInstantLearningQuestion for tiers:",He.tiers),e=new Map,n=function(n){var t,r,a,o,l,s,d;return i(this,function(i){switch(i.label){case 0:if(t=n.toLowerCase().replace(/ /g,"_"),r=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===t||e.tier_name.toLowerCase()===t.replace(/_/g,"")}),!(a=null==r?void 0:r.tier_id))return console.warn("[CREATE FLOW] No tier_id found for tier: ".concat(n)),e.set(t,null),[2,"continue"];o={question:qt,orgName:At.ORGANIZATION_NAME,scope_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:a},i.label=1;case 1:return i.trys.push([1,3,,4]),console.log("[CREATE FLOW] Calling saveInstantLearningQuestion for ".concat(n," (tier_id: ").concat(a,")")),[4,y(o)];case 2:return l=i.sent(),s=(null===(u=null==l?void 0:l.data)||void 0===u?void 0:u.id)||null,e.set(t,s),console.log("✅ [CREATE FLOW] Question saved for ".concat(n,":"),{questionId:s,fullResponse:l}),[3,4];case 3:return d=i.sent(),console.error("❌ [CREATE FLOW] Error saving question for ".concat(n,":"),d),e.set(t,null),[3,4];case 4:return[2]}})},t=0,r=He.tiers,s.label=1;case 1:return t<r.length?(a=r[t],[5,n(a)]):[3,4];case 2:s.sent(),s.label=3;case 3:return t++,[3,1];case 4:return console.log("[CREATE FLOW] Calling publishFeedbackSaveLearning with questionIdMap:",Array.from(e.entries())),[4,Da(e)];case 5:return s.sent(),[3,8];case 6:return o=s.sent(),l=new Map,He.tiers.forEach(function(e){l.set(e.toLowerCase().replace(/ /g,"_"),null)}),console.error("❌ [CREATE FLOW] Error in outer try-catch, calling publishFeedbackSaveLearning with fallback:",o),[4,Da(l)];case 7:return s.sent(),console.error("❌ [CREATE FLOW] Error saving Instant Learning Question:",o),[3,8];case 8:return[2]}})})];case 5:n.sent(),n.label=6;case 6:return[3,8];case 7:return e=n.sent(),console.error("Error in save execution:",e),[3,8];case 8:return[2]}})})}},[xr,sr]);var Ja=(null===(ie=(null===(te=null==He?void 0:He.tiers)||void 0===te?void 0:te[0])||Te||"Tier 1")||void 0===ie?void 0:ie.toLowerCase().replace(/ /g,"_"))||"tier_1",Wa=null!==(re=null!=Ai?Ai:Ce)&&void 0!==re?re:0,Ya=null!=Ai,Ha=Ya?null==ii?void 0:ii[Wa]:null,Ba=ii&&(null==ii?void 0:ii.find(function(e){return e&&!e.is_readOnly&&((null==e?void 0:e.new_variant_id)&&ji.includes(e.new_variant_id)||(null==e?void 0:e.variant_id)&&Ri.includes(e.variant_id))})),Ka=(null==Ha?void 0:Ha.new_variant_id)&&ji.includes(Ha.new_variant_id)?Ha.new_variant_id:(null==Ba?void 0:Ba.new_variant_id)&&ji.includes(Ba.new_variant_id)?Ba.new_variant_id:"",Qa=null===(ae=S.getState().teachMeConfig)||void 0===ae?void 0:ae.learningMetadataComponents,za=q(Qa),$a=function(n){var t={},i=He.tiers.map(function(e){return null==e?void 0:e.toLowerCase().replace(/ /g,"_")}),r=(null==He?void 0:He.station)+"RuleSet",a=i.map(function(e){var n=gn.find(function(n){return n.tier_name.toLowerCase().replace(/ /g,"_")===e||n.tier_name.toLowerCase()===e.replace(/_/g,"")});return(null==n?void 0:n.tier_id)||""}).filter(Boolean);return n.forEach(function(n,o){var l,u,s,d,c,v,p,_=(null==n?void 0:n.variant_id)&&n.variant_id||Ri[o]||"new_variant_".concat(o),f=(null===(l=n.scope)||void 0===l?void 0:l[0])||Ja,g=Yt.get(f),m=Kt.get(f),w=$t.get(f),y=(null==g?void 0:g.get(o))||n.rule_description||"",h=(null==m?void 0:m.get(o))||[],b=h.length>0?h.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n "):n.wta||"",I=(null==w?void 0:w.get(o))||[],M=I.length>0?I.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n "):n.wnta||"",A=xt.get(f),T=null==A?void 0:A.get(o),S={};T&&Object.keys(T).length>0?S=e(e({},T),{order_rules:e(e({},T.order_rules),{global_min_separation_seconds:60*((null===(u=T.order_rules)||void 0===u?void 0:u.global_min_separation_seconds)||0)}),advertiser_rules:e(e({},T.advertiser_rules),{global_min_separation_seconds:60*((null===(s=T.advertiser_rules)||void 0===s?void 0:s.global_min_separation_seconds)||0)})}):n.scheduling_config&&(S=n.scheduling_config);var k=si[_]||{},C=e(e(e({},n.learning_metadata||{}),k),{properties:e(e({},(null===(d=n.learning_metadata)||void 0===d?void 0:d.properties)||{}),k.properties||{}),instruction_prompt:U(n.learning_metadata)});t[_]=e(e({rule_title:qt,variant_description:y,wta:b,ruleset_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:a,wnta:M,scope:i,scope_rule_set:r},za?{}:{scheduling_config:S}),{learning_metadata:J(Qa,C),is_user_accepted_risk:!(null===(p=null!==(c=null==n?void 0:n.is_user_accepted_risk)&&void 0!==c?c:null===(v=(ii||[])[o])||void 0===v?void 0:v.is_user_accepted_risk)||void 0===p||!p)})}),t};tt&&console.log("customMetaData.ui_state for addvariant flow",$a(fi));var Za=T(function(e){return e.selectedRuleSetId}),Xa=T(function(e){return e.learningMetadata});An.current={send_metadata_to_orchestrator:!1,is_draft_flow:Oe,default:["scope"],app_mapping_id:Fe,content_mode_mapping_id:null!=Ge?Ge:null,LearningTerm:k("agents.LearningTerm","Learnings"),mode_name:Et||void 0,x_full_url:function(){try{var e=new URL(window.location.href);return!e.searchParams.get("rulesetid")&&(null==Me?void 0:Me.ruleSetId)&&e.searchParams.set("rulesetid",null==Me?void 0:Me.ruleSetId),e.toString()}catch(e){return window.location.href}}(),agents_from_ilkb_config:null===(oe=C.getState().lmsConfig)||void 0===oe?void 0:oe.agents,appsecData:{application:null!==(le=null==Ct?void 0:Ct.applicationId)&&void 0!==le?le:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(ue=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==ue?ue:"",applicationLevelResourceId:null!==(se=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==se?se:""},save_api_payload:function(){var n;if(!(null===(n=He.tiers)||void 0===n?void 0:n.length)||!(null==gn?void 0:gn.length))return[];var t=T.getState().backwardCompatibility,i=Dn.current,r=(ii||[])[i]||{};La(ei,Fi,xt,i);var a=Z(Fi),o=w(),l=Na(He.tiers);return He.tiers.map(function(n){var u,s,d,c,v,p,_,f,g,m,y,h,b,I,M,A,T,S,k,C,E,N=n.toLowerCase().replace(/ /g,"_"),L=(null===(u=Yt.get(N))||void 0===u?void 0:u.get(i))||"",O=(null===(s=Kt.get(N))||void 0===s?void 0:s.get(i))||[],R=(null===(d=$t.get(N))||void 0===d?void 0:d.get(i))||[];return!1===t?e(e({},a&&{config:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},a)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},tierLinkId:o,variant:ka(L),conditions_whentoapply:O.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null===(p=null===(v=null===(c=xt.get(N))||void 0===c?void 0:c.get(i))||void 0===v?void 0:v.is_default_enabled)||void 0===p||p,tier_id:(null===(_=gn.find(function(e){return(null==e?void 0:e.tier_name)&&(e.tier_name.toLowerCase().replace(/ /g,"_")===N||e.tier_name.toLowerCase()===N.replace(/_/g,""))}))||void 0===_?void 0:_.tier_id)||"",topic_id:null,scope_id:(null==Me?void 0:Me.ruleSetId)||"",question_title:qt,variantType:xa(N,i,r.variant_type||r.variantType),instantLearningType:At.INSTANT_LEARNING_TYPE,is_user_accepted_risk:!1,propagation:!0,applicationMappingId:Fe,modeId:Ue,appsecData:{application:null!==(f=null==Ct?void 0:Ct.applicationId)&&void 0!==f?f:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(g=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==g?g:"",applicationLevelResourceId:null!==(m=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==m?m:""}}):{status:"approved",metadata:e(e({userName:null!==(y=null==ia?void 0:ia.firstname)&&void 0!==y?y:"",userEmailId:null!==(h=null==ia?void 0:ia.email)&&void 0!==h?h:"",llm:G.MODEL,isVariantFlow:!0},a&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},a)}}}),{datasource:{type:"link",ref:"www.something.com",tag:"something"},variant:{tierLinkId:o,variant:ka(L),conditions_whentoapply:O.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),conditions_whennottoapply:R.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),referenceVariantID:null,referenceVariantIDVersion:null,scope:l[0]||{name:G.SCOPE_NAME,parentScopeId:null,scopeRowId:(null==Me?void 0:Me.ruleSetId)||"",value:{scopeName:(null==Me?void 0:Me.ruleSetName)||"",scopeId:"Audacy_"+w(),customScopeGroupName:G.CUSTOM_SCOPE_GROUP_NAME,description:(null==Me?void 0:Me.ruleSetDesc)||""}},overriden:!1,isDefault:null===(M=null===(I=null===(b=xt.get(N))||void 0===b?void 0:b.get(i))||void 0===I?void 0:I.is_default_enabled)||void 0===M||M,tier_id:(null===(A=gn.find(function(e){return(null==e?void 0:e.tier_name)&&(e.tier_name.toLowerCase().replace(/ /g,"_")===N||e.tier_name.toLowerCase()===N.replace(/_/g,""))}))||void 0===A?void 0:A.tier_id)||"",topic:{id:null,value:"".concat(He.station||Ie,"RuleSet"),description:null},categories:[{id:null,value:G.CATEGORY,description:G.CATEGORY}],originalQuestion:qt,questionId:null,variantType:xa(N,i,r.variant_type||r.variantType),parameterizedQuestion:null,created_at:(new Date).toISOString(),created_by:null!==(T=null==ia?void 0:ia.email)&&void 0!==T?T:"",instantLearningType:G.INSTANT_LEARNING_TYPE,appliedTagsIL:[],tagMappingInfoIL:{},is_user_accepted_risk:!!(null!==(S=null==r?void 0:r.is_user_accepted_risk)&&void 0!==S?S:null==Ni?void 0:Ni.is_user_accepted_risk)},isAgentsFeedback:!0,appsecData:{application:null!==(k=null==Ct?void 0:Ct.applicationId)&&void 0!==k?k:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(C=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==C?C:"",applicationLevelResourceId:null!==(E=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==E?E:""}})}})}(),update_api_payload:function(){var n,t,i;if(!(null==Se?void 0:Se.length)||!(null===(n=He.tiers)||void 0===n?void 0:n.length)||!(null==gn?void 0:gn.length))return[];T.getState().backwardCompatibility,La(ei,Fi,xt);var r=Z(Fi),a=null!==(i=null===(t=Se.find(function(e){return(null==e?void 0:e.link_id)&&""!==e.link_id.trim()}))||void 0===t?void 0:t.link_id)&&void 0!==i?i:null,o=[];return He.tiers.forEach(function(n){var t=n.toLowerCase().replace(/ /g,"_"),i=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===t||e.tier_name.toLowerCase()===t.replace(/_/g,"")}),l=Yt.get(t),u=Kt.get(t),s=$t.get(t);Se.forEach(function(d,c){var v,p,_,f,g,m,w,y,h;if(!d.isNewVariant){var b=(null==l?void 0:l.get(c))||d.description||"",I=(null==u?void 0:u.get(c))||[],M=(null==s?void 0:s.get(c))||[],A=xa(t,c,d.variantType||""),T=e(e({variantId:d.variantId,ruleDesc:(null==Me?void 0:Me.ruleSetDesc)||"",whenToApply:I.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),whenNotToApply:M.map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" OR "),isDefault:null!==(_=null===(p=null===(v=xt.get(t))||void 0===v?void 0:v.get(c))||void 0===p?void 0:p.is_default_enabled)&&void 0!==_?_:ee(d.variantType||""),tier:{tier_id:(null==i?void 0:i.tier_id)||"",tier_name:(null==i?void 0:i.tier_name)||n,tier_priority:null!==(f=null==i?void 0:i.tier_priority)&&void 0!==f?f:null},scope_id:(null==Me?void 0:Me.ruleSetId)||"",description:ka(b)||"",topic:"".concat(He.station,"RuleSet")},r&&{configuration:{master_name:At.CONFIG_MASTER_NAME,config_data:{scheduling_config:e({},r)}}}),{tierLinkId:null!=a?a:null,variantType:A,is_user_accepted_risk:!!(null!==(m=null===(g=(ii||[])[c])||void 0===g?void 0:g.is_user_accepted_risk)&&void 0!==m?m:null==d?void 0:d.is_user_accepted_risk),is_enabled:d.is_enabled,appsecData:{application:null!==(w=null==Ct?void 0:Ct.applicationId)&&void 0!==w?w:"",scopeLevelModuleId:(null==Ct?void 0:Ct.moduleId)||"",applicationLevelModuleId:null!==(y=null==Ct?void 0:Ct.applicationModuleId)&&void 0!==y?y:"",applicationLevelResourceId:null!==(h=null==Ct?void 0:Ct.applicationResourceId)&&void 0!==h?h:""}});o.push(T)}})}),o}(),ui_state:Fa?{variants:function(){var n={},t=xt.get(Ja);if(!t)return n;var i=Yt.get(Ja),r=Kt.get(Ja),a=$t.get(Ja),o=He.tiers.map(function(e){return null==e?void 0:e.toLowerCase().replace(/ /g,"_")}),l=(null==He?void 0:He.station)+"RuleSet",u=o.map(function(e){var n=gn.find(function(n){return n.tier_name.toLowerCase().replace(/ /g,"_")===e||n.tier_name.toLowerCase()===e.replace(/_/g,"")});return(null==n?void 0:n.tier_id)||""}).filter(Boolean);return t.forEach(function(s,d){var c,v,p,_,f,g,m,w,y,h,b,I,M,A=null===(c=null==Se?void 0:Se[d])||void 0===c?void 0:c.variantId,T=(ii||[])[d],S=(null==T?void 0:T.new_variant_id)||"",k=A||S||Ri[d]||"variant_".concat(d),C=(null==i?void 0:i.get(d))||"",E=((null==r?void 0:r.get(d))||[]).map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n ")||"",N=((null==a?void 0:a.get(d))||[]).map(function(e){return e.text}).filter(function(e){return""!==e.trim()}).join(" \\n ")||"",L=t.get(d),O={};L&&Object.keys(L).length>0&&(O=e(e({},L),{order_rules:e(e({},L.order_rules),{global_min_separation_seconds:60*((null===(v=L.order_rules)||void 0===v?void 0:v.global_min_separation_seconds)||0)}),advertiser_rules:e(e({},L.advertiser_rules),{global_min_separation_seconds:60*((null===(p=L.advertiser_rules)||void 0===p?void 0:p.global_min_separation_seconds)||0)})}));var R=(ii||[])[Wa];void 0!==X(T)&&(X(T),X(R));var x=null!==(_=X(T))&&void 0!==_?_:"idx-".concat(d),D=null!==(f=oi[x])&&void 0!==f?f:U(null==T?void 0:T.learning_metadata)||U(null===(g=null==Se?void 0:Se[d])||void 0===g?void 0:g.learning_metadata),j=si[k]||{},P=e(e(e(e({},(null===(m=null==Se?void 0:Se[d])||void 0===m?void 0:m.learning_metadata)||{}),(null==T?void 0:T.learning_metadata)||{}),j),{properties:e(e(e({},(null===(y=null===(w=null==Se?void 0:Se[d])||void 0===w?void 0:w.learning_metadata)||void 0===y?void 0:y.properties)||{}),(null===(h=null==T?void 0:T.learning_metadata)||void 0===h?void 0:h.properties)||{}),j.properties||{}),instruction_prompt:D});n[k]=e(e({rule_title:qt,variant_description:C,wta:E,ruleset_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:u,wnta:N,scope:o,scope_rule_set:l},za?{}:{scheduling_config:O}),{learning_metadata:J(Qa,P),is_user_accepted_risk:!(null===(M=null!==(b=null==T?void 0:T.is_user_accepted_risk)&&void 0!==b?b:null===(I=null==Se?void 0:Se[d])||void 0===I?void 0:I.is_user_accepted_risk)||void 0===M||!M)})}),n}()}:function(){var n,t,i,r,a,o,l=(ii||[]).findIndex(function(e){return!0===e.is_new_variant}),u=-1;-1!==l?u=l:zn?u=-1:tt||(u=Wa);var s=-1!==u,d=s?(ii||[])[u]:void 0,c=e(e({},(null==d?void 0:d.learning_metadata)||{}),Xa);return{new_current_variant:s?e(e({rule_title:qt,rule_description:(null===(n=Yt.get(Ja))||void 0===n?void 0:n.get(u))||"",wta:(null===(i=null===(t=Kt.get(Ja))||void 0===t?void 0:t.get(u))||void 0===i?void 0:i.map(function(e){return Va(e.text)}).filter(function(e){return""!==e}).join(" \\n "))||"",wnta:(null===(a=null===(r=$t.get(Ja))||void 0===r?void 0:r.get(u))||void 0===a?void 0:a.map(function(e){return Va(e.text)}).filter(function(e){return""!==e}).join(" \\n "))||"",scope:He.tiers.map(function(e){return null==e?void 0:e.toLowerCase().replace(/ /g,"_")}),scope_rule_set:(null==He?void 0:He.station)+"RuleSet"},za?{}:{scheduling_config:function(){var n,t,i,r=null===(n=xt.get(Ja))||void 0===n?void 0:n.get(u);return r&&0!==Object.keys(r).length?e(e({},r),{order_rules:e(e({},r.order_rules),{global_min_separation_seconds:60*((null===(t=r.order_rules)||void 0===t?void 0:t.global_min_separation_seconds)||0)}),advertiser_rules:e(e({},r.advertiser_rules),{global_min_separation_seconds:60*((null===(i=r.advertiser_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)})}):{}}()}),{learning_metadata:J(Qa,c),is_user_accepted_risk:!!(null===(o=(ii||[])[u])||void 0===o?void 0:o.is_user_accepted_risk)}):e(e({rule_title:"",rule_description:"",wta:"",wnta:"",scope:[],scope_rule_set:""},za?{}:{scheduling_config:{}}),{is_user_accepted_risk:!1}),variants:tt?$a(fi):{}}}(),rule_id_in_current_session:bi,new_variant_id:function(){var e;return Ya&&Ae?(null===(e=null==Se?void 0:Se[Wa])||void 0===e?void 0:e.variantId)?null:Ka:null}(),edit_variant_id:pt,rule_id:ft.current,backward_compatibility:T.getState().backwardCompatibility,ruleset_id:Za,current_variants_length:Ae?Array.isArray(ii)&&ii.length>0?Math.max((null===(de=null==Ae?void 0:Ae.variants)||void 0===de?void 0:de.length)||0,ii.length):null===(ce=null==Ae?void 0:Ae.variants)||void 0===ce?void 0:ce.length:void 0,tiers:T.getState().tiers,authToken:(null==ia?void 0:ia.accessToken)||""};var eo=Ia(fi),no={ruleTitle:qt,scopeData:He,variantsByTier:Array.from(xt.keys()).reduce(function(n,t){var i=xt.get(t)||new Map,r=Yt.get(t)||new Map,a=Kt.get(t)||new Map,o=$t.get(t)||new Map;return n[t]=Array.from(i.keys()).map(function(n,l){var u,s,d,c,v,p=(ii||[]).filter(function(e){return Array.isArray(null==e?void 0:e.scope)?e.scope.includes(t):(null==e?void 0:e.scope)===t})[n]||{},_={label:"",isDefault:!1};if(p.is_variant&&!ee(p.variant_type))_={label:"",isDefault:!1};else if(Se&&Se.length>0){_=Oa(Se,n,"variantType");var f=null==Se?void 0:Se.find(function(e){return e.tier===t&&e.index===n});if(f){if(!_.label){var g=f.variantType||"",m=ee(g);_={label:"variant ".concat(n+1),isDefault:m}}if(f.variantId===Qr)(y=p.variant_type||(null==Ni?void 0:Ni.variant_type))&&(_=Ra(y,n),console.log("[templateState] editingVariants[".concat(n,']: using CARE variant_type "').concat(y,'" → label "').concat(_.label,'"')));console.log("Computed variant type at index",n,":",_)}else _={label:Ia(Se),isDefault:!1},console.log("No match found, using getNextVariantType:",_)}else if(fi&&fi.length>0){if(_=Oa(fi,n,"variant_type"),console.log("Found matching variant at index",n,":",_),kn.current){var w=null==fi?void 0:fi.find(function(e){return e.tier===t&&e.index===n});if((null==w?void 0:w.variant_id)===na||(null==w?void 0:w.variantId)===na)(y=p.variant_type||(null==Ni?void 0:Ni.variant_type))&&(_=Ra(y,n),console.log("[templateState] existingVariants[".concat(n,']: load-and-edit using CARE variant_type "').concat(y,'" → label "').concat(_.label,'"')))}}else{var y=p.variant_type||"";_={label:eo,isDefault:ee(y)}}console.log("Computed variant data for tier",t,"index",n,":",_);var h=null!==(s=null===(u=i.get(n))||void 0===u?void 0:u.is_default_enabled)&&void 0!==s?s:_.isDefault;console.log("live is default :",h);var b="variant ".concat(l+1),I=r.get(n)||"",M=null!==(d=X(p))&&void 0!==d?d:"idx-".concat(t,"-").concat(n),A=null!==(c=oi[M])&&void 0!==c?c:U(p.learning_metadata)||U(null===(v=null==Se?void 0:Se.find(function(e){return e.tier===t&&e.index===n}))||void 0===v?void 0:v.learning_metadata);return{variantId:Ri[n]||p.variant_id||p.variantId,instructionPrompt:A,variantType:b,isDefault:h,isModified:p.is_modified,tier:t,index:n,ruleDescription:I.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,""),whenToApplyConditions:(a.get(n)||[]).flatMap(function(n){var t,i=(null===(t=null==n?void 0:n.text)||void 0===t?void 0:t.split(/\s+OR\s+/))||[];return i.length>1?i.map(function(t,i){return e(e({},n),{id:"split-".concat(n.id,"-").concat(i),text:t.trim()})}):[n]}),whenNotToApplyConditions:(o.get(n)||[]).flatMap(function(n){var t,i=(null===(t=null==n?void 0:n.text)||void 0===t?void 0:t.split(/\s+OR\s+/))||[];return i.length>1?i.map(function(t,i){return e(e({},n),{id:"split-".concat(n.id,"-").concat(i),text:t.trim()})}):[n]}),configData:i.get(n)||Lt,isReadOnly:p.is_readOnly||!1,is_variant:p.is_variant||!1,reasoning:{ruleDescription:Sa(I),whenToApply:Sa(p.wta),whenNotToApply:Sa(p.wnta),configData:Sa(p.action)}}}),n},{}),citation:$i,fieldCitations:or,citations:er},to={setRuleTitle:function(n){var t,i=void 0!==(null===(t=null==n?void 0:n.target)||void 0===t?void 0:t.value)?n.target.value:n;Jt(i),Sr(function(n){if(n.ruleTitle){var t=e({},n);return delete t.ruleTitle,t}return n})},setRuleDescription:function(e,n,t){return da(e,n,t)},addWhenToApply:function(e,n){return ca(e,n)},removeWhenToApply:function(e,n,t){return va(e,n,t)},editWhenToApply:function(e,n,t,i){return pa(e,n,t,i)},addWhenNotToApply:function(e,n){return _a(e,n)},removeWhenNotToApply:function(e,n,t){return fa(e,n,t)},editWhenNotToApply:function(e,n,t,i){return ga(e,n,t,i)},addNewVariant:function(e){return ma(e)},onScopeChange:ya,onConfigChange:function(e,n,t,i){return ha(e,n,t,i)}},io={},ro={};xt.forEach(function(n,t){io[t]=new Map,ro[t]=new Map,n.forEach(function(n,i){io[t].set(i,[e({key:"order_rules",label:"Order"},n.order_rules),e({key:"advertiser_rules",label:"Advertiser"},n.advertiser_rules)]),ro[t].set(i,[{key:"inventory_rules",label:"Inventory code",enabled:n.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:n.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:n.is_default_enabled}])})});var ao=v(function(){if(Te){if(1===He.tiers.length)return 0;var e=He.tiers.findIndex(function(e){return e.toLowerCase()===Te.toLowerCase()});return e>=0?e:0}},[Te,He.tiers]),oo=e(e(e(e({defaultOpen:!0,tierOptions:Ta,stationOptions:[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],separationItemsByTier:io,togglesByTier:ro,highlights:qi,highlightedIds:Yi,openSections:Pt,setOpenSections:Vt,setSendMessageInChat:Ci,isAiStreaming:sr,defaultTierOpen:ao,defaultVariantOpen:zn?void 0:Ai,autoScrollVariantIndex:zn?void 0:Ai,activeVariantAccordionIndex:zn?void 0:Ai,setActiveVariantAccordionIndex:function(e){Ti(e),null!=e&&setTimeout(function(){$n(!1)},100)},validationErrors:Tr,activeEditId:lt,setActiveEditId:ut,pendingEditId:dt,setPendingEditId:ct,conflictReason:Cr,usedFor:W({flow:ke,editingRule:Ae,editingVariants:Se})?"Edit":"Create"},Tt),{scrollTrigger:Ki}),qe),{setInstructionPrompt:function(n){var t,i,r=null!=Ai?Ai:Ce;if(null!=r){var a=null!==(t=X(null==ii?void 0:ii[r]))&&void 0!==t?t:"idx-".concat(r);li(function(t){var i;return e(e({},t),((i={})[a]=n,i))})}null===(i=null==qe?void 0:qe.setInstructionPrompt)||void 0===i||i.call(qe,n)}});d(function(){},[ye]),d(function(){var e=W({flow:ke,editingRule:Ae,editingVariants:Se});if(!sr&&wi&&!e){var t=n([],ii,!0).reverse().findIndex(function(e){return"variant"===e.action||e.is_variant});-1===t||ii.length,-1!==t&&(console.log("Post-stream: Focusing new variant at index",t),Ti(t))}},[sr,wi]);var lo=function(){dn.current&&(clearTimeout(dn.current),dn.current=null),kn.current=!1,he(),ba()},uo=function(){return t(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:if(!Pe)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Pe()];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),console.error("postSaveCallback threw after successful save — keeping modal open",e),sn(!0),on('Learning was saved, but something went wrong finishing up. Please try again.<br/><button class="clickable-button" data-value="Save this Learning">Retry</button>'),[2];case 4:return lo(),[2]}})})},so=function(){var e={};qt.trim()||(e.ruleTitle="Rule Title is required"),He.station||(e.station="Station Rule Set is required"),He.tiers&&0!==He.tiers.length||(e.tiers="At least one tier must be selected");return He.tiers.map(function(e){return e.toLowerCase().replace(/ /g,"_")}).forEach(function(n){var t=Yt.get(n),i=Kt.get(n),r=xt.get(n);r&&Array.from(r.keys()).forEach(function(r){var a=null==t?void 0:t.get(r);a&&a.trim()||(e["ruleDescription-".concat(n,"-").concat(r)]="Rule Description is required");var o=null==i?void 0:i.get(r);o&&o.some(function(e){return""!==e.text.trim()})||(e["whenToApply-".concat(n,"-").concat(r)]='At least one "When to apply" condition is required')})}),e};function co(r,a,o){var l,u,s,d,c,v;return void 0===o&&(o=!1),t(this,void 0,void 0,function(){var t,p,_,f,g,m,y,h,b,I,A,T,S,k,C,E,N,L,O,R,x,D,j,P,V;return i(this,function(i){switch(i.label){case 0:if(t=r.question_id,p=(null==r?void 0:r.variant_id)||null,rt.current&&wt.current===t)return console.log("[handleAILoadAction] Already fetching question ID, skipping duplicate request:",t),[2];if(ft.current===t&&!o)return console.log("[handleAILoadAction] Question ID unchanged, updating variant focus only:",p),_t(p),p?(-1!==(_=(ii||[]).findIndex(function(e){return e.is_new_variant}))&&(Mr(!0),Ur("Removing new variant..."),Wr("Please wait while we remove new variant.")),ri(function(e){if(!Array.isArray(e))return e;var n=e.filter(function(e){return!e.is_new_variant}),t=n.findIndex(function(e){return e.variant_id===p});return-1!==t&&setTimeout(function(){Ti(t),Qi(function(e){return e+1}),pr.current=t},0),n}),-1!==_&&((f=function(e){e(function(e){var n=new Map;return e.forEach(function(e,t){var i=new Map(e);i.delete(_);var r=new Map,a=0;i.forEach(function(e){r.set(a,e),a++}),n.set(t,r)}),n})})(Dt),f(Ht),f(Qt),f(Zt),xi(function(e){var t=n([],e,!0);return t.length>_&&t.splice(_,1),t})),!1===rt.current&&(rt.current=!0,-1!==_&&(null===(l=_r.current)||void 0===l||l.show({severity:"success",summary:"Success",detail:"New variant removed successfully because you selected to edit an existing variant",life:4e3}))),$n(!1)):(console.log("lastLoadedQuestionIdRef.current in else",ft.current),null===ft.current&&(Mr(!0),Ur("Adding new variant..."),Wr("Please wait while we add new variant."))),[2];console.log("User Action: fetching fresh variant info for question",t),at.current.clear(),at.current.add(t),Mr(!0),Ur("Loading variants..."),console.log("reaching here in load and edit"),Wr("Please wait while we fetch the latest variant data."),rt.current=!0,wt.current=t,i.label=1;case 1:return i.trys.push([1,5,6,10]),g=Date.now(),[4,M(t,(null==Me?void 0:Me.ruleSetId)||"")];case 2:return m=i.sent(),(y=Date.now()-g)<3e3?[4,new Promise(function(e){return setTimeout(e,3e3-y)})]:[3,4];case 3:i.sent(),i.label=4;case 4:return 0===(h=(null===(u=null==m?void 0:m.data)||void 0===u?void 0:u.variants)||[]).length?(console.warn("No variants found for question_id",t),Mr(!1),Ur(""),null===(s=_r.current)||void 0===s||s.show({severity:"error",summary:"Error",detail:"No variants found for this question.",life:3e3}),[2]):(kn.current=!0,rt.current=!0,b=(null===(d=null==m?void 0:m.data)||void 0===d?void 0:d.ruleTitle)||"",Jt(b),I=null===(c=null==m?void 0:m.data)||void 0===c?void 0:c.tier,A="tier_1",T="Tier 1",S="1",I&&((k=String(I).match(/(\d+)/))?(C=k[1],S=C,A="tier_".concat(C),T="Tier ".concat(C)):(A=String(I).toLowerCase().trim().replace(/ /g,"_"),T=A.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),S=A.includes("2")?"2":"1")),console.log("[handleAILoadAction] Detected Tier: ".concat(T," (ID: ").concat(S,", Key: ").concat(A,")")),Be({station:Ie||"global",tiers:[T]}),E=function(e,n,t,i,r,a){var o=e.map(function(e){var o,l,u=[t];return{variant_type:e.variantType||"variant",title:n,rule_description:e.description||"",wta:e.whenToApply||"",wnta:e.whenNotToApply||"",scope:u,scheduling_config:(null===(o=e.configuration)||void 0===o?void 0:o.scheduling_config)||{},variant_id:e.variantId,question_id:r,tier_id:i,is_readOnly:e.variantId!==a,link_id:e.link_id||"",is_enabled:null===(l=e.is_enabled)||void 0===l||l,is_user_accepted_risk:e.is_user_accepted_risk,has_accepted_risk:e.has_accepted_risk,user_accepted_risk_at:e.user_accepted_risk_at,learning_metadata:e.learning_metadata||{},action:"edit"}}),l=new Map,u=new Map,s=new Map,d=new Map;return o.forEach(function(e,n){var t,i,r,a,o,c,v=e.scheduling_config||{};l.set(n,{order_rules:{enabled:!!v.order_global_min_separation_seconds||!!(null===(t=v.order_rules)||void 0===t?void 0:t.global_min_separation_seconds),global_min_separation_seconds:Math.floor((v.order_global_min_separation_seconds||(null===(i=v.order_rules)||void 0===i?void 0:i.global_min_separation_seconds)||0)/60)},advertiser_rules:{enabled:!!v.advertiser_global_min_separation_seconds||!!(null===(r=v.advertiser_rules)||void 0===r?void 0:r.global_min_separation_seconds),global_min_separation_seconds:Math.floor((v.advertiser_global_min_separation_seconds||(null===(a=v.advertiser_rules)||void 0===a?void 0:a.global_min_separation_seconds)||0)/60)},inventory_rules:{respect_inventory_code:!!v.respect_inventory_code||!!(null===(o=v.inventory_rules)||void 0===o?void 0:o.respect_inventory_code)},break_code_rules:{respect_break_code:!!v.respect_break_code||!!(null===(c=v.break_code_rules)||void 0===c?void 0:c.respect_break_code)},is_default_enabled:ee(e.variantType||e.variant_type)}),u.set(n,$(e.rule_description||""));var p=e.wta?e.wta.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];s.set(n,p);var _=e.wnta?e.wnta.split(" OR ").map(function(e){return e.trim()}).filter(function(e){return""!==e}).map(function(e,t){return{id:"edit-wnta-".concat(n,"-").concat(t),text:e,reasoning:""}}):[];d.set(n,_)}),{transformedVariants:o,tierConfigMap:l,tierDescMap:u,tierWtaMap:s,tierWntaMap:d}}(h,b,A,S,t,p),N=E.transformedVariants,L=E.tierConfigMap,O=E.tierDescMap,R=E.tierWtaMap,x=E.tierWntaMap,pi(function(e){var n=new Map(e);return n.set(A,JSON.parse(JSON.stringify(N))),n}),ri(function(e){var t=(Array.isArray(e)?e:[]).filter(function(e){return"copy"===e.action||e.tier_id&&e.tier_id!==S});return n(n([],t,!0),N,!0)}),gi(function(e){var t=(Array.isArray(e)?e:[]).filter(function(e){return"copy"===e.action||e.tier_id&&e.tier_id!==S});return n(n([],t,!0),N,!0)}),it(!0),ft.current=t,_t(p),D=0,p&&-1!==(j=N.findIndex(function(e){return e.variant_id===p}))&&(D=j),Ti(D),Qi(function(e){return e+1}),pr.current=D,$n(!1),Dt(function(e){var n=new Map(e);return n.set(A,L),n}),Ht(function(e){var n=new Map(e);return n.set(A,O),n}),Qt(function(e){var n=new Map(e);return n.set(A,R),n}),Zt(function(e){var n=new Map(e);return n.set(A,x),n}),Sr({}),[3,10]);case 5:return P=i.sent(),console.error("Failed to fetch variants by question ID:",P),null===(v=_r.current)||void 0===v||v.show({severity:"error",summary:"Error",detail:"Failed to fetch variants. Please try again.",life:3e3}),[3,10];case 6:return rt.current=!1,Mr(!1),Ur(""),Wr(""),(null==r?void 0:r.is_interpretation_ready)&&(null==r?void 0:r.question_id)&&ft.current&&pt?(ri(function(n){if(!Array.isArray(n))return n;var t=n.map(function(n){return(null==n?void 0:n.variant_id)===pt?e(e({},n),a):n}),i=n.findIndex(function(e){return(null==e?void 0:e.variant_id)===pt});return-1!==i&&setTimeout(function(){console.log("targetIndex",i),Ti(i),Qi(function(e){return e+1}),pr.current=i},0),t}),[3,9]):[3,7];case 7:return(null==r?void 0:r.is_interpretation_ready)&&(null==r?void 0:r.question_id)&&ft.current&&!pt?(Mr(!0),Ur("Adding new variant..."),Wr("Please wait while we add new variant."),[4,new Promise(function(e){return setTimeout(e,3e3)})]):[3,9];case 8:i.sent(),Mr(!1),Ur(""),Wr(""),(V=oi["idx-0"]||"")&&li(function(n){return e(e({},n),{"idx-0":""})}),ri(function(t){var i,r,o=jn.current||{},l=e(e(e({},o),a||{}),{is_new_variant:!0,is_variant:!0,learning_metadata:e(e(e({},o.learning_metadata||{}),(null==a?void 0:a.learning_metadata)||{}),{instruction_prompt:V})});if(Array.isArray(t)){var u=t.findIndex(function(e){return!0===e.is_new_variant});if(-1!==u){setTimeout(function(){Ti(u),Qi(function(e){return e+1}),pr.current=u},0);var s=t[u].client_id||w(),d=(null===(i=t[u].learning_metadata)||void 0===i?void 0:i.instruction_prompt)||V,c=t[u].learning_metadata||{};r=t.map(function(n,t){return t===u?e(e(e({},n),l),{client_id:s,learning_metadata:e(e(e({},c),l.learning_metadata||{}),{instruction_prompt:d})}):n})}else{var v=t.length;setTimeout(function(){Ti(v),Qi(function(e){return e+1}),pr.current=v},0),r=n(n([],t,!0),[e(e({},l),{client_id:w()})],!1)}}else setTimeout(function(){Ti(0),Qi(0),pr.current=0},0),r=[e(e({},l),{client_id:w()})];return bt.current=r,r}),i.label=9;case 9:return[7];case 10:return[2]}})})}var vo;return console.log("RuleSet in render",Me),r(o,{children:[a(m,{ref:_r}),a(N,{open:ye,chatAssistantName:At.ASSISTANT_NAME,organizationName:At.ORGANIZATION_NAME,baseUrl:At.BASE_URL,baseWebsocketUrl:At.BASE_WEBSOCKET_URL,closeFunction:lo,enableChatLogs:We,ThinkingBulbIconComponent:a(H,{}),customSections:null!=Je?Je:a(o,{}),customMetaData:An,chatTitle:Ae?(null!==(ve=null==qe?void 0:qe.chatTitleEdit)&&void 0!==ve?ve:At.CHAT_TITLE_EDIT).replace("{scope}",(null==Me?void 0:Me.ruleSetName)||""):(null!==(pe=null==qe?void 0:qe.chatTitle)&&void 0!==pe?pe:At.CHAT_TITLE).replace("{scope}",(null==Me?void 0:Me.ruleSetName)||""),formTitle:(null==oo?void 0:oo.formTitle)||At.FORM_TITLE,showSavedMessage:!1,savedMessage:nn,isError:un,errorMessage:an,isSaving:vn,onSave:function(e){console.log("Save this Learning",e);var n=so();if(Object.keys(n).length>0)return console.log("validation errors",n),void Sr(n);pn(!0),sn(!1),on("")},showSaveWithoutValidation:!1,onSaveWithoutValidation:function(){return t(void 0,void 0,void 0,function(){var e,n,t,r,a,o,l,u,s;return i(this,function(d){switch(d.label){case 0:return e=so(),Object.keys(e).length>0?(Sr(e),[2]):(console.log("✅ Bypass Save: Initiated"),W({flow:ke,editingRule:Ae,editingVariants:Se})?[4,ja()]:[3,2]);case 1:return d.sent(),[3,11];case 2:return!0===kn.current&&ft.current?[4,Pa()]:[3,4];case 3:return d.sent(),[3,11];case 4:d.trys.push([4,10,,11]),ze(z),n=new Map,t=function(e){var t,r,a,o,l,u;return i(this,function(i){switch(i.label){case 0:if(t=e.toLowerCase().replace(/ /g,"_"),r=gn.find(function(e){return e.tier_name.toLowerCase().replace(/ /g,"_")===t||e.tier_name.toLowerCase()===t.replace(/_/g,"")}),!(a=null==r?void 0:r.tier_id))return n.set(t,null),[2,"continue"];o={question:qt,orgName:At.ORGANIZATION_NAME,scope_id:(null==Me?void 0:Me.ruleSetId)||"",tier_id:a},i.label=1;case 1:return i.trys.push([1,3,,4]),[4,y(o)];case 2:return l=i.sent(),n.set(t,(null===(s=null==l?void 0:l.data)||void 0===s?void 0:s.id)||null),[3,4];case 3:return u=i.sent(),console.error("❌ Bypass Save: Error saving question for ".concat(e,":"),u),n.set(t,null),[3,4];case 4:return[2]}})},r=0,a=He.tiers,d.label=5;case 5:return r<a.length?(o=a[r],[5,t(o)]):[3,8];case 6:d.sent(),d.label=7;case 7:return r++,[3,5];case 8:return[4,Da(n,!0)];case 9:return d.sent(),[3,11];case 10:return l=d.sent(),ze(Q),u=new Map,He.tiers.forEach(function(e){u.set(e.toLowerCase().replace(/ /g,"_"),null)}),Da(u,!0),console.error("❌ Bypass Save: Error",l),[3,11];case 11:return[2]}})})},headerMessageHandlers:Aa,aiResponse:ii,setAIResponse:ri,width:"90vw",height:"90vh",sendMessageInChat:ki,isLoading:Qe===z,templateProps:{state:no,handlers:to,uiState:oo},setSendMessageInChat:Ci,onResetChat:function(){ba()},onResetRequest:function(){mr(!0)},isFormDirty:function(){return""!==qt.trim()||""!==He.station||He.tiers.length>0||Array.from(Yt.values()).some(function(e){return Array.from(e.values()).some(function(e){return""!==e.trim()})})||Array.from(Kt.values()).some(function(e){return Array.from(e.values()).some(function(e){return e.length>0})})||Array.from($t.values()).some(function(e){return Array.from(e.values()).some(function(e){return e.length>0})})||xt.size>0||ei.size>0},initialChatMessage:Ae?(vo=Ae.ruleTitle||"this rule",null===(_e=null==Se?void 0:Se[null!=Ce?Ce:0])||void 0===_e||_e.is_user_accepted_risk,'<p><span>Welcome back! 👋</span>\n <span>I see you want to edit <strong>"'.concat(vo,'."</strong></span>\n <span> <strong>What would you like to update? </strong> </span>\n <span>Describe the change you want to make, and I’ll help you edit it.</span>\n </p>')):null!=Ve?Ve:At.INITIAL_CHAT_MESSAGE,validateCustom:function(){if(Qe===K||Ze)return!1;if(!qt||""===qt.trim())return!1;if(null!==lt)return!1;if(!He.station||""===He.station.trim())return!1;var e=He.tiers&&He.tiers.filter(function(e){return e&&""!==e.trim()});if(!e||0===(null==e?void 0:e.length))return!1;for(var n,t=0,i=e.map(function(e){return e.toLowerCase().replace(/ /g,"_")});t<i.length;t++){var r=i[t],a=Yt.get(r),o=Kt.get(r),l=xt.get(r);if(!l||0===l.size)return!1;for(var u=0,s=Array.from(l.keys());u<s.length;u++){var d=s[u],c=null==a?void 0:a.get(d);if(!c||""===c.trim())return!1;var v=null==o?void 0:o.get(d);if(!(null==v?void 0:v.some(function(e){return e.text&&""!==e.text.trim()})))return!1}}return!(!xt||0===xt.size)&&(!(n=function(e){return Array.from(e.values()).some(function(e){return Array.from(e.values()).some(function(e){return e.some(function(e){return!!e.conflict})})})})(Kt)&&!n($t)&&!On)},setCitations:nr,isLocked:!0,textareaPlaceholder:(null==qe?void 0:qe.chatTextareaPlaceholder)||"Tell me more about this learning..",saveButtonConfig:(null==oo?void 0:oo.saveBtnConfig)||{label:Ae?"Save Changes":"Save Learning",loadingLabel:r("span",e({style:{display:"flex",gap:"5px",alignItems:"center"}},{children:[a(_,{size:20,color:"white",className:"animate-spin"}),a("span",{children:" Saving Changes..."})]}))},showSaveDraft:!0,onSaveDraft:function(){Ga?hr(!0):Sr(function(n){return e(e({},n),{ruleTitle:"Rule Title is required"})})},onSaveDraftWithoutConfirmation:qa,isSaveDraftDisabled:!Ga,saveDraftDisabledTooltip:Ua,saveDraftButtonConfig:{label:"Save Draft",loadingLabel:"Saving Draft..."},setCurrentRequestId:rr,isAiStreaming:sr,setIsAiStreaming:dr,showConfirmReset:gr,setShowConfirmReset:mr,confirmReset:function(){ba(),mr(!1),lo()},isLoadingVariants:Ir,mainText:Gr,subText:Jr,proposedRule:Vn,isFetchingComparison:sa,handleOpenComparison:Ma,showComparison:Pr,setShowComparison:Vr,variants:Un,onComparisonLinkClick:ua,targetComparisonVariantId:Wn,highlightedComparisonField:Bn,onAddAsVariant:function(){Vr(!1)},isCopyEnabled:!0,onSubmitFeedback:function(n){return t(void 0,void 0,void 0,function(){var t,r,a,o,l,u,s;return i(this,function(i){switch(i.label){case 0:t=T.getState().backwardCompatibility,i.label=1;case 1:return i.trys.push([1,3,,4]),r=e({user_id:null!==(l=null==ia?void 0:ia._id)&&void 0!==l?l:"",user_name:null!==(u=null==ia?void 0:ia.firstname)&&void 0!==u?u:"",user_email:null!==(s=null==ia?void 0:ia.email)&&void 0!==s?s:"",assistant_name:At.ASSISTANT_NAME},n),a=t?r:e(e({},r),{feedback_type:"Negative",application_mapping_id:Fe}),[4,A(a)];case 2:return i.sent(),[3,4];case 3:throw o=i.sent(),console.error("Failed to submit chat feedback",o),o;case 4:return[2]}})})},handleGlobalClickCapture:function(e){null!==lt&&(e.target.closest('[data-edit-id="'.concat(lt,'"]'))||(e.preventDefault(),e.stopPropagation(),ct(lt)))},isGlobalEditActive:null!==lt,initialDraftMessage:je,socketTimeOutInMilliSeconds:At.SOCKET_TIMEOUT,userDetails:{name:"".concat(null!==(fe=null==ia?void 0:ia.firstname)&&void 0!==fe?fe:""," ").concat(null!==(ge=null==ia?void 0:ia.lastname)&&void 0!==ge?ge:"").trim()||"Guest Userr",id:null!==(me=null==ia?void 0:ia._id)&&void 0!==me?me:"Guest Userr",email:null!==(we=null==ia?void 0:ia.email)&&void 0!==we?we:"guestUserr@example.com"}}),a(j,{isOpen:yr,title:"Save as Draft?",description:"Are you sure you want to save this learning as a draft?",confirmText:"Save as Draft",cancelText:"Cancel",onConfirm:function(){return t(void 0,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,qa()];case 1:return e.sent(),hr(!1),[2]}})})},onCancel:function(){return hr(!1)},confirmBgColor:"#5925DC",isLoading:Qe===z,position:"fixed"})]})};export{te as default,$ as filterAgentText};
2
2
  //# sourceMappingURL=InstantLearningModal.js.map