@langwatch/server 3.8.0 → 3.9.0

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 (1330) hide show
  1. package/README.md +3 -3
  2. package/feature-map.json +4 -2
  3. package/langevals/evaluators/langevals/langevals_langevals/select_best_compare.py +165 -5
  4. package/langevals/evaluators/langevals/tests/test_select_best_compare.py +471 -9
  5. package/langevals/ts-integration/evaluators.generated.ts +83 -63
  6. package/langwatch/.env.example +7 -0
  7. package/langwatch/biome.jsonc +23 -0
  8. package/langwatch/dist/client/assets/AddAnnotationQueueDrawer-DKvtbwGG.js +2 -0
  9. package/langwatch/dist/client/assets/AddDatasetRecordDrawer-D1vOO9OS.js +6 -0
  10. package/langwatch/dist/client/assets/AddOrEditAnnotationScore-zxFsPi_K.js +2 -0
  11. package/langwatch/dist/client/assets/AddOrEditAnnotationScoreDrawer-soYSKpT_.js +2 -0
  12. package/langwatch/dist/client/assets/AddOrEditDatasetDrawer-BHJmgYGv.js +3 -0
  13. package/langwatch/dist/client/assets/AddParticipants-z6X3xaWh.js +2 -0
  14. package/langwatch/dist/client/assets/AgentHistoryDrawer-kb5K4X01.js +2 -0
  15. package/langwatch/dist/client/assets/AgentHttpEditorDrawer-Cf-aA1pn.js +5 -0
  16. package/langwatch/dist/client/assets/AgentListDrawer-z4OL5IVm.js +2 -0
  17. package/langwatch/dist/client/assets/AgentTypeSelectorDrawer-Ky7GOYHj.js +2 -0
  18. package/langwatch/dist/client/assets/AgentWorkflowEditorDrawer-CAszeo8y.js +2 -0
  19. package/langwatch/dist/client/assets/AgentWorkflowTargetEditorDrawer-DWrxkhIq.js +2 -0
  20. package/langwatch/dist/client/assets/AiGatewayLayout-BqznP5T2.js +2 -0
  21. package/langwatch/dist/client/assets/AnnotationsTable-C9n949u_.js +2 -0
  22. package/langwatch/dist/client/assets/AreaChart-PNFZHqkl.js +2 -0
  23. package/langwatch/dist/client/assets/AuthCard-D14g-b3Y.js +2 -0
  24. package/langwatch/dist/client/assets/AutomationDrawer-Cjo9egay.js +112 -0
  25. package/langwatch/dist/client/assets/BarChart-B23ShI5J.js +4 -0
  26. package/langwatch/dist/client/assets/BatchEvaluationSummary-CmkigWIn.js +2 -0
  27. package/langwatch/dist/client/assets/BudgetEditDrawer-nkQpQiY0.js +2 -0
  28. package/langwatch/dist/client/assets/CartesianChart-Ci1mTvgb.js +54 -0
  29. package/langwatch/dist/client/assets/CascadeArchiveDialog-BPqLe1Ai.js +2 -0
  30. package/langwatch/dist/client/assets/ChartTooltip-BMGa2HEK.js +2 -0
  31. package/langwatch/dist/client/assets/ChatWindow-BBsct-iS.js +5 -0
  32. package/langwatch/dist/client/assets/CodeEvaluatorEditorDrawer-DOqtlBKU.js +9 -0
  33. package/langwatch/dist/client/assets/CodexCodingDefaultsAsk--UfSQyVR.js +2 -0
  34. package/langwatch/dist/client/assets/ColorfulBlockIcons-zwwbjL9F.js +6 -0
  35. package/langwatch/dist/client/assets/ColumnTypeIcon-CZZ6Esh0.js +2 -0
  36. package/langwatch/dist/client/assets/ComparisonLeaderboardDrawer-ChH7KNaX.js +4 -0
  37. package/langwatch/dist/client/assets/ConfirmDialog-CWzCY4sN.js +2 -0
  38. package/langwatch/dist/client/assets/ContactSalesBlock-B3w2lKdE.js +2 -0
  39. package/langwatch/dist/client/assets/Conversation-BhvQmXJ-.js +2 -0
  40. package/langwatch/dist/client/assets/CopyInput-Qeb_2bgP.js +2 -0
  41. package/langwatch/dist/client/assets/CopyableInputWithPrefix-Bp04WBtM.js +2 -0
  42. package/langwatch/dist/client/assets/CreateProjectDrawer-Dg_yrbka.js +2 -0
  43. package/langwatch/dist/client/assets/CreateTeamDrawer-CLJnKmFE.js +2 -0
  44. package/langwatch/dist/client/assets/CustomGraph-C6j6slUs.js +2 -0
  45. package/langwatch/dist/client/assets/DashboardLayout-Cn5-9Ye2.js +96 -0
  46. package/langwatch/dist/client/assets/DashboardNameDrawer-BvGn3rsq.js +2 -0
  47. package/langwatch/dist/client/assets/DataPrivacyRuleDrawer-Wx7PJ_9S.js +2 -0
  48. package/langwatch/dist/client/assets/DatasetEditorTable-Ca3bmQrl.js +2 -0
  49. package/langwatch/dist/client/assets/DatasetPickerList-RZLjPQ2S.js +2 -0
  50. package/langwatch/dist/client/assets/DatasetPreviewTable-Ck22Wy4h.js +2 -0
  51. package/langwatch/dist/client/assets/DatasetSelector-BxeSHSDD.js +2 -0
  52. package/langwatch/dist/client/assets/DefaultModelOverrideDrawer-ncleLyuX.js +2 -0
  53. package/langwatch/dist/client/assets/DeleteConfirmationDialog-Br5m12kp.js +2 -0
  54. package/langwatch/dist/client/assets/DocsLinks-D-I122gH.js +2 -0
  55. package/langwatch/dist/client/assets/DynamicZodForm-BUbQBluG.js +2 -0
  56. package/langwatch/dist/client/assets/EditAutomationFilterDrawer-Bci7dGy6.js +3 -0
  57. package/langwatch/dist/client/assets/EditModelProviderDrawer-CdUQa5qQ.js +4 -0
  58. package/langwatch/dist/client/assets/EditProjectDrawer-DDMa3VNp.js +2 -0
  59. package/langwatch/dist/client/assets/EmojiPickerModal-BLskXRKS.js +3 -0
  60. package/langwatch/dist/client/assets/EnterpriseLockedSurface-CGy3NpuC.js +2 -0
  61. package/langwatch/dist/client/assets/ErrorBarContext-CUuF6tzC.js +2 -0
  62. package/langwatch/dist/client/assets/EvaluatorApiUsageDialog-Dw6JMkKa.js +107 -0
  63. package/langwatch/dist/client/assets/EvaluatorCategorySelectorDrawer-F1nHh-cP.js +2 -0
  64. package/langwatch/dist/client/assets/EvaluatorEditorDrawer-eotRSQPT.js +2 -0
  65. package/langwatch/dist/client/assets/EvaluatorEditorShared-BLZXXMFD.js +43 -0
  66. package/langwatch/dist/client/assets/EvaluatorHistoryDrawer-Bx_uZmkb.js +2 -0
  67. package/langwatch/dist/client/assets/EvaluatorListDrawer--2JYBA1w.js +2 -0
  68. package/langwatch/dist/client/assets/EvaluatorMappingsSection-DCqvgq8G.js +2 -0
  69. package/langwatch/dist/client/assets/EvaluatorSelection-BTMe6CCC.js +2 -0
  70. package/langwatch/dist/client/assets/EvaluatorSelectionBox-CDxYA37_.js +2 -0
  71. package/langwatch/dist/client/assets/EvaluatorTypeSelectorContent-BDgiQ_Gu.js +2 -0
  72. package/langwatch/dist/client/assets/EvaluatorTypeSelectorDrawer-D4HFeq77.js +2 -0
  73. package/langwatch/dist/client/assets/ExecutionState-xp8LG59p.js +2 -0
  74. package/langwatch/dist/client/assets/FeatureFlagsDrawer-DIplgYQy.js +2 -0
  75. package/langwatch/dist/client/assets/FieldInfoTooltip-C_hEtQpK.js +2 -0
  76. package/langwatch/dist/client/assets/FieldsFilters-Ci5mVooQ.js +2 -0
  77. package/langwatch/dist/client/assets/FilterDisplay-BKjP30tt.js +2 -0
  78. package/langwatch/dist/client/assets/FilterSidebar-Cgxbpfi7.js +2 -0
  79. package/langwatch/dist/client/assets/FormatMoney-LZE9c_pf.js +2 -0
  80. package/langwatch/dist/client/assets/FoundryDrawer-DjVyu6Ww.js +2 -0
  81. package/langwatch/dist/client/assets/FullLogo-DRBt8v39.js +2 -0
  82. package/langwatch/dist/client/assets/GovernanceLayout-Baar1Fc8.js +2 -0
  83. package/langwatch/dist/client/assets/GraphsLayout-RNsRoPhs.js +2 -0
  84. package/langwatch/dist/client/assets/GroupBindingInputRow-BxvXd1EU.js +2 -0
  85. package/langwatch/dist/client/assets/GuardrailsDrawer-BtsfIXzD.js +91 -0
  86. package/langwatch/dist/client/assets/History-B3CO9rUC.js +17 -0
  87. package/langwatch/dist/client/assets/HorizontalFormControl-CpxShF8O.js +2 -0
  88. package/langwatch/dist/client/assets/HoverableBigText-BMBnTTnr.js +2 -0
  89. package/langwatch/dist/client/assets/InstallCliCard-DO5HE9Zk.js +2 -0
  90. package/langwatch/dist/client/assets/IntegratePaneShell-Bc7i3AU3.js +8 -0
  91. package/langwatch/dist/client/assets/InviteMemberDrawer-CiQbGDVl.js +2 -0
  92. package/langwatch/dist/client/assets/IsolatedErrorBoundary-QK1gsCee.js +2 -0
  93. package/langwatch/dist/client/assets/LLMModelCostDrawer-K4uPc99h.js +2 -0
  94. package/langwatch/dist/client/assets/LangyContextTarget-Dxr919ue.js +2 -0
  95. package/langwatch/dist/client/assets/LegacyTracesDeprecationBanner-CnBBcfON.js +2 -0
  96. package/langwatch/dist/client/assets/Legend-C-o-ebW-.js +6 -0
  97. package/langwatch/dist/client/assets/Line-CbuF_DU9.js +2 -0
  98. package/langwatch/dist/client/assets/LineChart-CjG7MhLF.js +2 -0
  99. package/langwatch/dist/client/assets/ListTable-Dq11zhPy.js +2 -0
  100. package/langwatch/dist/client/assets/LoadingScreen-BRa1kl7f.js +2 -0
  101. package/langwatch/dist/client/assets/Markdown-Cip8Rj5C.js +35 -0
  102. package/langwatch/dist/client/assets/MenuLink-CEEzPpsg.js +2 -0
  103. package/langwatch/dist/client/assets/MessageCard-Nbu21sIo.js +2 -0
  104. package/langwatch/dist/client/assets/MetadataTag-CQmOL4su.js +5 -0
  105. package/langwatch/dist/client/assets/ModelProviderCustomModelInput-s8Z1JIfQ.js +2 -0
  106. package/langwatch/dist/client/assets/ModelProviderScreen-BkZVsCiO.js +2 -0
  107. package/langwatch/dist/client/assets/ModelSelector-BjEx9IlF.js +2 -0
  108. package/langwatch/dist/client/assets/MyLayout-Dr6t6Ogu.js +2 -0
  109. package/langwatch/dist/client/assets/NavigationFooter-GfOzirbT.js +2 -0
  110. package/langwatch/dist/client/assets/NewWorkflowForm-uqnhwRpZ.js +2 -0
  111. package/langwatch/dist/client/assets/NoDataInfoBlock-Busjhz63.js +2 -0
  112. package/langwatch/dist/client/assets/OnboardingContainer-BGhio01s.js +2 -0
  113. package/langwatch/dist/client/assets/OnlineEvaluationDrawer-DyCVUUmz.js +2 -0
  114. package/langwatch/dist/client/assets/OpsPageShell-GqOT9Ezv.js +2 -0
  115. package/langwatch/dist/client/assets/OttlEditor-BYyg1quG.js +3 -0
  116. package/langwatch/dist/client/assets/OverflownText-q6WIx911.js +2 -0
  117. package/langwatch/dist/client/assets/ProjectAvatar-B0tbfKzY.js +43 -0
  118. package/langwatch/dist/client/assets/ProjectLangyLayout-Du3nxtBV.js +82 -0
  119. package/langwatch/dist/client/assets/PromptEditorDrawer-DeL8XgdG.js +2 -0
  120. package/langwatch/dist/client/assets/PromptListDrawer-y4bmNt4t.js +2 -0
  121. package/langwatch/dist/client/assets/PropertySectionTitle-CK55WvKi.js +37 -0
  122. package/langwatch/dist/client/assets/ProviderModelSelector-B-0vpQ2t.js +2 -0
  123. package/langwatch/dist/client/assets/ProviderScopeChips-DN3rtvAE.js +2 -0
  124. package/langwatch/dist/client/assets/PushToCopiesDialog-Ry_M3FuH.js +2 -0
  125. package/langwatch/dist/client/assets/ReferenceDot-DrNtDSrg.js +2 -0
  126. package/langwatch/dist/client/assets/RenderInputOutput-DqsCnspr.js +261 -0
  127. package/langwatch/dist/client/assets/ScatterChart-jarSkvrF.js +2 -0
  128. package/langwatch/dist/client/assets/ScenarioFormDrawer-DvJcYmkQ.js +2 -0
  129. package/langwatch/dist/client/assets/ScenarioInputMappingSection-BewVLFCZ.js +2 -0
  130. package/langwatch/dist/client/assets/ScenarioRunDetailDrawer-BAPna8ym.js +3 -0
  131. package/langwatch/dist/client/assets/ScopeChipPicker-pQ061i-c.js +2 -0
  132. package/langwatch/dist/client/assets/SearchInput-DH_qIhwi.js +2 -0
  133. package/langwatch/dist/client/assets/SectionNavigationLayout-DwPBnqYj.js +2 -0
  134. package/langwatch/dist/client/assets/SelectDatasetDrawer-8MPCEZID.js +2 -0
  135. package/langwatch/dist/client/assets/SelectionActionBar-C2SOsiow.js +2 -0
  136. package/langwatch/dist/client/assets/SeriesFilterDrawer-d5DYEKTZ.js +2 -0
  137. package/langwatch/dist/client/assets/SettingsLayout-ZI47ZjuT.js +2 -0
  138. package/langwatch/dist/client/assets/SetupWithAgentButton-CNTb3Avj.js +4 -0
  139. package/langwatch/dist/client/assets/ShikiCommandBox-u0WEsz_9.js +5 -0
  140. package/langwatch/dist/client/assets/SpanDetails-L_YT0nxH.js +3 -0
  141. package/langwatch/dist/client/assets/SubscriptionPage-CaUbKJjG.js +2 -0
  142. package/langwatch/dist/client/assets/SuiteFormDrawer-BjUQdKq8.js +2 -0
  143. package/langwatch/dist/client/assets/Symbols-R6sphPWl.js +2 -0
  144. package/langwatch/dist/client/assets/TabButton-8Oc9UYh8.js +3 -0
  145. package/langwatch/dist/client/assets/TableCell-Ci8ylzki.js +2 -0
  146. package/langwatch/dist/client/assets/TargetTypeSelectorDrawer-DSKFRtdD.js +2 -0
  147. package/langwatch/dist/client/assets/TeamForm-CL9ycvq0.js +2 -0
  148. package/langwatch/dist/client/assets/TeamUserRoleField-D0ZTlKiH.js +2 -0
  149. package/langwatch/dist/client/assets/TraceDetails-JolY6sXJ.js +9 -0
  150. package/langwatch/dist/client/assets/TraceDetailsDrawer-lgPzHJ3L.js +2 -0
  151. package/langwatch/dist/client/assets/TraceIdPeek-DDi0ChdF.js +2 -0
  152. package/langwatch/dist/client/assets/TracesMapping-BPXT_-h4.js +2 -0
  153. package/langwatch/dist/client/assets/UpgradeModalContent-DmGd0n65.js +2 -0
  154. package/langwatch/dist/client/assets/UploadCSVDrawer-haYFZH65.js +3 -0
  155. package/langwatch/dist/client/assets/VariablesSection-DW_-pHw8.js +2 -0
  156. package/langwatch/dist/client/assets/VersionBadge-BrsZ4NP1.js +2 -0
  157. package/langwatch/dist/client/assets/ViaClaudeDesktopScreen-B9tl6d9Q.js +1161 -0
  158. package/langwatch/dist/client/assets/ViewAutomationDrawer-DliGiKaC.js +2 -0
  159. package/langwatch/dist/client/assets/VirtualKeySecretReveal-B9QMNIxJ.js +54 -0
  160. package/langwatch/dist/client/assets/WelcomeLayout-DZ1ue0he.js +2 -0
  161. package/langwatch/dist/client/assets/WithFeatureFlagGuard-CgkIIt3_.js +2 -0
  162. package/langwatch/dist/client/assets/WithPermissionGuard-Da_hdEdq.js +2 -0
  163. package/langwatch/dist/client/assets/WorkflowCard-C_ClnTV_.js +2 -0
  164. package/langwatch/dist/client/assets/WorkflowSelectorForEvaluatorDrawer-DozYRazW.js +2 -0
  165. package/langwatch/dist/client/assets/_...path_-Da4obdgF.js +2 -0
  166. package/langwatch/dist/client/assets/_Uint8Array-BKsS4AYJ.js +2 -0
  167. package/langwatch/dist/client/assets/__...path__-hjRUlcmj.js +22 -0
  168. package/langwatch/dist/client/assets/_baseAssignValue-B0IP5NGP.js +2 -0
  169. package/langwatch/dist/client/assets/_baseClone-DWP1OuEe.js +2 -0
  170. package/langwatch/dist/client/assets/_baseEach-Bv6waMUN.js +2 -0
  171. package/langwatch/dist/client/assets/_baseFor-K5aTWdeA.js +2 -0
  172. package/langwatch/dist/client/assets/_experiment_-Cv2h4AYK.js +2 -0
  173. package/langwatch/dist/client/assets/_id_-BoubOQoS.js +2 -0
  174. package/langwatch/dist/client/assets/_id_-BuzJEIUf.js +2 -0
  175. package/langwatch/dist/client/assets/_id_-BzLlrR7z.js +2 -0
  176. package/langwatch/dist/client/assets/_id_-DAzjJ7AY.js +2 -0
  177. package/langwatch/dist/client/assets/_id_-Dc2UAWAO.js +2 -0
  178. package/langwatch/dist/client/assets/_id_-DwutdLKk.js +2 -0
  179. package/langwatch/dist/client/assets/_id_-H7-5DI5r.js +2 -0
  180. package/langwatch/dist/client/assets/_project_-DTuunSJZ.js +8 -0
  181. package/langwatch/dist/client/assets/_runId_-BGhwmwQj.js +7 -0
  182. package/langwatch/dist/client/assets/_shell-ChQAHWWX.js +2 -0
  183. package/langwatch/dist/client/assets/_slug_-D6Y2wsW5.js +2 -0
  184. package/langwatch/dist/client/assets/_slug_-DLKkXVG8.js +2 -0
  185. package/langwatch/dist/client/assets/_slug_-yLo6E4BE.js +17 -0
  186. package/langwatch/dist/client/assets/_team_-TUptH6wK.js +2 -0
  187. package/langwatch/dist/client/assets/_workflow_-B_flNNON.js +3 -0
  188. package/langwatch/dist/client/assets/_workflow_-DUyBeEF1.js +25 -0
  189. package/langwatch/dist/client/assets/accept-BtE8pbrP.js +2 -0
  190. package/langwatch/dist/client/assets/activity-BDNvBEBL.js +1 -0
  191. package/langwatch/dist/client/assets/agents-CZnWSlhu.js +2 -0
  192. package/langwatch/dist/client/assets/alerts-BDNvBEBL.js +1 -0
  193. package/langwatch/dist/client/assets/all-in7z_yGY.js +2 -0
  194. package/langwatch/dist/client/assets/analytics-C8m2qboV.js +2 -0
  195. package/langwatch/dist/client/assets/annotation-scores-hmT53w46.js +2 -0
  196. package/langwatch/dist/client/assets/annotations-DwouO48Z.js +2 -0
  197. package/langwatch/dist/client/assets/anomaly-rules-DoJdIoCt.js +2 -0
  198. package/langwatch/dist/client/assets/api-keys-CykxAxvG.js +4 -0
  199. package/langwatch/dist/client/assets/asaplangy-D3J00Q-Z.js +5 -0
  200. package/langwatch/dist/client/assets/audit-log-Dy4vcEeJ.js +2 -0
  201. package/langwatch/dist/client/assets/auth-IqMSC5k1.js +2 -0
  202. package/langwatch/dist/client/assets/authentication-BqVl7Fh-.js +2 -0
  203. package/langwatch/dist/client/assets/authorize-BGMc1Gzv.js +2 -0
  204. package/langwatch/dist/client/assets/authorize-DhHzBVUd.js +2 -0
  205. package/langwatch/dist/client/assets/automations-BDNvBEBL.js +1 -0
  206. package/langwatch/dist/client/assets/automations-BhzNESFp.js +2 -0
  207. package/langwatch/dist/client/assets/billing-plans-D_IT1cHz.js +2 -0
  208. package/langwatch/dist/client/assets/blank-Ct2wtHyX.js +2 -0
  209. package/langwatch/dist/client/assets/blobs-Dwi1OImQ.js +2 -0
  210. package/langwatch/dist/client/assets/blockDiagram-677ZJIJ3-CnAsMlS_.js +133 -0
  211. package/langwatch/dist/client/assets/budgets-Cn5gXQK_.js +3 -0
  212. package/langwatch/dist/client/assets/bug-reports-feRha8NA.js +2 -0
  213. package/langwatch/dist/client/assets/cache-rules-T0g7jfVv.js +2 -0
  214. package/langwatch/dist/client/assets/choose-D7SJAjkq.js +2 -0
  215. package/langwatch/dist/client/assets/chunk-EX3LRPZG-DkekrL-i.js +232 -0
  216. package/langwatch/dist/client/assets/chunk-FWX5IMBZ-2uc49Oqf.js +3 -0
  217. package/langwatch/dist/client/assets/chunk-PUDLZKDR-CdFvlX4m.js +157 -0
  218. package/langwatch/dist/client/assets/chunk-RYQCIY6F-BLUBc3em.js +2 -0
  219. package/langwatch/dist/client/assets/chunk-V7JOEXUC-daLm26hJ.js +207 -0
  220. package/langwatch/dist/client/assets/classDiagram-OUVF2IWQ-CDA8LHAw.js +2 -0
  221. package/langwatch/dist/client/assets/classDiagram-v2-EOCWNBFH-CDA8LHAw.js +2 -0
  222. package/langwatch/dist/client/assets/clsx-CjueKrWZ.js +2 -0
  223. package/langwatch/dist/client/assets/codeAgentConfig-BGKq9uCt.js +7 -0
  224. package/langwatch/dist/client/assets/codingDefaultSync-BHSxIX3Y.js +2 -0
  225. package/langwatch/dist/client/assets/configure-CrBmyV7I.js +4 -0
  226. package/langwatch/dist/client/assets/constants-CDt5HyiB.js +2 -0
  227. package/langwatch/dist/client/assets/custom-wRFdLdR4.js +12 -0
  228. package/langwatch/dist/client/assets/custom_evaluator-C4ikBFuX.js +31 -0
  229. package/langwatch/dist/client/assets/dagre-VKFMJZFB-BElJnuGp.js +5 -0
  230. package/langwatch/dist/client/assets/dagre-VMur7wh6.js +2 -0
  231. package/langwatch/dist/client/assets/data-privacy-DAIYO4AS.js +2 -0
  232. package/langwatch/dist/client/assets/data-retention-6spK_HnV.js +2 -0
  233. package/langwatch/dist/client/assets/datasets-_6-oF4ZW.js +2 -0
  234. package/langwatch/dist/client/assets/debounce-CS9Z04io.js +2 -0
  235. package/langwatch/dist/client/assets/defaultModelState-B2tL23ua.js +2 -0
  236. package/langwatch/dist/client/assets/dejaview-Cde-wWV4.js +2 -0
  237. package/langwatch/dist/client/assets/departments-Cm-0ZxEt.js +2 -0
  238. package/langwatch/dist/client/assets/devices-DmiWzGY2.js +2 -0
  239. package/langwatch/dist/client/assets/dist-C4xeXVRv.js +6 -0
  240. package/langwatch/dist/client/assets/drawerFromUrl-CKr5SifD.js +2 -0
  241. package/langwatch/dist/client/assets/edit-CLmkWTOM.js +62 -0
  242. package/langwatch/dist/client/assets/email-suppressions-cqwH0a9N.js +2 -0
  243. package/langwatch/dist/client/assets/erDiagram-Q63AITRT-Byy32QYy.js +86 -0
  244. package/langwatch/dist/client/assets/error-D8QCVS4R.js +2 -0
  245. package/langwatch/dist/client/assets/errors-mlatPkMI.js +2 -0
  246. package/langwatch/dist/client/assets/evaluations-BBoYdpZy.js +2 -0
  247. package/langwatch/dist/client/assets/evaluations-DhzXchFj.js +2 -0
  248. package/langwatch/dist/client/assets/evaluators-BtHslgaT.js +2 -0
  249. package/langwatch/dist/client/assets/evaluators-_EDCn-tQ.js +148 -0
  250. package/langwatch/dist/client/assets/experiments-CffarahA.js +1 -0
  251. package/langwatch/dist/client/assets/feature-flags-mcBTRF0E.js +2 -0
  252. package/langwatch/dist/client/assets/fetchSSE-CnJPAkno.js +3 -0
  253. package/langwatch/dist/client/assets/fieldset-kmG3NTVs.js +2 -0
  254. package/langwatch/dist/client/assets/flowDiagram-23GEKE2U-CY9NG0NN.js +1 -0
  255. package/langwatch/dist/client/assets/forgot-password-wo5Sna-0.js +2 -0
  256. package/langwatch/dist/client/assets/formatMoney-ClmqgvaY.js +2 -0
  257. package/langwatch/dist/client/assets/formatTargetOutput-DXvqMkYJ.js +2 -0
  258. package/langwatch/dist/client/assets/foundry-CfvGgfP0.js +477 -0
  259. package/langwatch/dist/client/assets/gateway-Be0EsD57.js +2 -0
  260. package/langwatch/dist/client/assets/getEvaluator-D2EjIa3G.js +2 -0
  261. package/langwatch/dist/client/assets/getRadiusAndStrokeWidthFromDot-D2oUP3Tn.js +2 -0
  262. package/langwatch/dist/client/assets/governance-YZL-Q4Vy.js +2 -0
  263. package/langwatch/dist/client/assets/graphlib-DsLTzvlk.js +2 -0
  264. package/langwatch/dist/client/assets/grid-MxZhegzw.js +2 -0
  265. package/langwatch/dist/client/assets/groups-BmusUt3C.js +2 -0
  266. package/langwatch/dist/client/assets/guardrails-DAx8mDop.js +2 -0
  267. package/langwatch/dist/client/assets/handled-error-DbmvFmFF.js +2 -0
  268. package/langwatch/dist/client/assets/http-C64lOZI7.js +7 -0
  269. package/langwatch/dist/client/assets/identifierUtils-C2FgAR6z.js +2 -0
  270. package/langwatch/dist/client/assets/immer-DImI3Uq2.js +14 -0
  271. package/langwatch/dist/client/assets/index-8SbDirJv.js +68 -0
  272. package/langwatch/dist/client/assets/ingestion-source-detail-PQbeRniA.js +19 -0
  273. package/langwatch/dist/client/assets/ingestion-sources-CCyiAKHP.js +12 -0
  274. package/langwatch/dist/client/assets/integrations-WSl7N8v9.js +2 -0
  275. package/langwatch/dist/client/assets/isArrayLikeObject-DQ6J5Gh8.js +2 -0
  276. package/langwatch/dist/client/assets/isSymbol-DQQCRrSw.js +2 -0
  277. package/langwatch/dist/client/assets/langyHomeSuggestions-czH603Eu.js +2 -0
  278. package/langwatch/dist/client/assets/license-BXfbZQgG.js +2 -0
  279. package/langwatch/dist/client/assets/licenseStatusUtils-CeEgqpQ1.js +2 -0
  280. package/langwatch/dist/client/assets/lu-BSZWBZXU.js +2 -0
  281. package/langwatch/dist/client/assets/map-DUpZ7PrO.js +2 -0
  282. package/langwatch/dist/client/assets/mappingValidation-C7knTdfD.js +2 -0
  283. package/langwatch/dist/client/assets/me-DbCM2fI8.js +7 -0
  284. package/langwatch/dist/client/assets/me-DgXzEkaD.js +2 -0
  285. package/langwatch/dist/client/assets/members-CNILhgB4.js +2 -0
  286. package/langwatch/dist/client/assets/mermaid.core-1LNrQSiZ.js +12 -0
  287. package/langwatch/dist/client/assets/messages-CIoUj-2S.js +2 -0
  288. package/langwatch/dist/client/assets/metrics-Ba4ghWyR.js +2 -0
  289. package/langwatch/dist/client/assets/mindmap-definition-LN4V7U3C-BsK9qdX4.js +97 -0
  290. package/langwatch/dist/client/assets/model-costs-Cmo-7iNN.js +2 -0
  291. package/langwatch/dist/client/assets/model-providers-DNeQW-T1.js +2 -0
  292. package/langwatch/dist/client/assets/modelProviderHelpers-BgYFTBND.js +2 -0
  293. package/langwatch/dist/client/assets/my-queue-DAyfQ6lp.js +2 -0
  294. package/langwatch/dist/client/assets/normalizeComparison-QGQpERT7.js +2 -0
  295. package/langwatch/dist/client/assets/not-found-BFkr8OS7.js +2 -0
  296. package/langwatch/dist/client/assets/now-BWCCq_PO.js +2 -0
  297. package/langwatch/dist/client/assets/onboarding-DAAoh3gE.js +2 -0
  298. package/langwatch/dist/client/assets/online-evaluations-DbC0C3ct.js +2 -0
  299. package/langwatch/dist/client/assets/ops-BnGgY3gP.js +2 -0
  300. package/langwatch/dist/client/assets/organizations-D-hWxeYL.js +2 -0
  301. package/langwatch/dist/client/assets/pages-BthWVZpr.js +2 -0
  302. package/langwatch/dist/client/assets/persistence-NkzSPIBC.js +2 -0
  303. package/langwatch/dist/client/assets/personalProject-C9vU_vdl.js +2 -0
  304. package/langwatch/dist/client/assets/plans-B_rx4bLE.js +2 -0
  305. package/langwatch/dist/client/assets/preconditionFieldUtils-ryKgG9T1.js +2 -0
  306. package/langwatch/dist/client/assets/product-BuY5Xwg3.js +2 -0
  307. package/langwatch/dist/client/assets/project-C2NjfKL8.js +2 -0
  308. package/langwatch/dist/client/assets/projections-rLpLV9w3.js +2 -0
  309. package/langwatch/dist/client/assets/projects-BF0LrAID.js +2 -0
  310. package/langwatch/dist/client/assets/promptHandle-BT-5THDj.js +2 -0
  311. package/langwatch/dist/client/assets/prompts-BHe5aLJx.js +8 -0
  312. package/langwatch/dist/client/assets/radio-group-BPt-WSZX.js +2 -0
  313. package/langwatch/dist/client/assets/registry-olFQKglt.js +2 -0
  314. package/langwatch/dist/client/assets/reports-BLYN6Q1s.js +2 -0
  315. package/langwatch/dist/client/assets/request-DFzKYavU.js +2 -0
  316. package/langwatch/dist/client/assets/requirementDiagram-TGXJPOKE-CRtGWC_J.js +85 -0
  317. package/langwatch/dist/client/assets/reset-password-DYZspdMQ.js +2 -0
  318. package/langwatch/dist/client/assets/role-bindings-FmulBsng.js +2 -0
  319. package/langwatch/dist/client/assets/roles-RLhR-aqL.js +2 -0
  320. package/langwatch/dist/client/assets/routing-policies-ljceihkc.js +5 -0
  321. package/langwatch/dist/client/assets/scenarios-BQqYDDZG.js +2 -0
  322. package/langwatch/dist/client/assets/scheduler-BFnKJjAw.js +2 -0
  323. package/langwatch/dist/client/assets/schedules-BDNvBEBL.js +1 -0
  324. package/langwatch/dist/client/assets/scim-Bmka9JwE.js +2 -0
  325. package/langwatch/dist/client/assets/seatTypeCopy-fhsCX-T3.js +2 -0
  326. package/langwatch/dist/client/assets/secrets-Cwr6m0Ec.js +2 -0
  327. package/langwatch/dist/client/assets/segment-group-BktqF-NE.js +2 -0
  328. package/langwatch/dist/client/assets/segmented-control-Dux7mG6V.js +2 -0
  329. package/langwatch/dist/client/assets/select-BvA110t-.js +2 -0
  330. package/langwatch/dist/client/assets/send-KqbwnHm5.js +2 -0
  331. package/langwatch/dist/client/assets/sequenceView-CXTCS8lF.js +5 -0
  332. package/langwatch/dist/client/assets/seriesOptions-B04NlY20.js +1015 -0
  333. package/langwatch/dist/client/assets/settings-U355L_I1.js +2 -0
  334. package/langwatch/dist/client/assets/setup-BlSoABYV.js +2 -0
  335. package/langwatch/dist/client/assets/shikiAdapter-Ctbe7cQu.js +3 -0
  336. package/langwatch/dist/client/assets/showSuiteRunError-D2fez5Ub.js +2 -0
  337. package/langwatch/dist/client/assets/signin-DyT1qLoq.js +2 -0
  338. package/langwatch/dist/client/assets/signup-D8m3PZ3b.js +2 -0
  339. package/langwatch/dist/client/assets/stateDiagram-2N3HPSRC-iaTfadDT.js +2 -0
  340. package/langwatch/dist/client/assets/stateDiagram-v2-6OUMAXLB-DH-TUWs1.js +2 -0
  341. package/langwatch/dist/client/assets/subscription-_ypR9RT2.js +3 -0
  342. package/langwatch/dist/client/assets/subscriptions-BRPlrnsz.js +2 -0
  343. package/langwatch/dist/client/assets/suggestionUI-BvF9IL3n.js +106 -0
  344. package/langwatch/dist/client/assets/swimlanes-5IMT3BWC-DT3qutmi.js +3 -0
  345. package/langwatch/dist/client/assets/swimlanesDiagram-G3AALYLV-Chcqm6v8.js +9 -0
  346. package/langwatch/dist/client/assets/switch-BZp2DIfW.js +2 -0
  347. package/langwatch/dist/client/assets/switch-C1DNHB2v.js +2 -0
  348. package/langwatch/dist/client/assets/tabs-B6CQXTUQ.js +2 -0
  349. package/langwatch/dist/client/assets/teams-B3Yc0LtS.js +2 -0
  350. package/langwatch/dist/client/assets/teams-Df3DGQGZ.js +2 -0
  351. package/langwatch/dist/client/assets/tool-catalog-CpVqJ_Dp.js +7 -0
  352. package/langwatch/dist/client/assets/toolIcons-CwYXl2Eu.js +2 -0
  353. package/langwatch/dist/client/assets/tooltip-CM-lMDNU.js +2 -0
  354. package/langwatch/dist/client/assets/topic-clustering-DEtDEXOU.js +2 -0
  355. package/langwatch/dist/client/assets/topics-BGSBPvH8.js +2 -0
  356. package/langwatch/dist/client/assets/traceStore-C-SeEWpA.js +55 -0
  357. package/langwatch/dist/client/assets/traces-hMC5nfWE.js +289 -0
  358. package/langwatch/dist/client/assets/tracesMapping-CJhNJ9Ej.js +3 -0
  359. package/langwatch/dist/client/assets/tracking-in5OR8uP.js +2 -0
  360. package/langwatch/dist/client/assets/types-DNh2n8ZE.js +2 -0
  361. package/langwatch/dist/client/assets/types-OZJZgbcd.js +2 -0
  362. package/langwatch/dist/client/assets/types-nw9Z9F-v.js +2 -0
  363. package/langwatch/dist/client/assets/undo-2-CYjzz3Fj.js +2 -0
  364. package/langwatch/dist/client/assets/usage-BMXYHJUH.js +2 -0
  365. package/langwatch/dist/client/assets/usage-Da6wBDdP.js +2 -0
  366. package/langwatch/dist/client/assets/use-generic-onboarding-flow-eie3NRF5.js +2 -0
  367. package/langwatch/dist/client/assets/useActivePlan-Dsa3BYxd.js +2 -0
  368. package/langwatch/dist/client/assets/useAllPromptsForProject-BS-h_uSZ.js +2 -0
  369. package/langwatch/dist/client/assets/useAnnotationQueues-BMo2kZ_n.js +2 -0
  370. package/langwatch/dist/client/assets/useAvailableEvaluators-DkZ2Yt1F.js +2 -0
  371. package/langwatch/dist/client/assets/useCyclingVerb-BTWaxKR2.js +2 -0
  372. package/langwatch/dist/client/assets/useDepartmentColumn-xoZ52lPP.js +2 -0
  373. package/langwatch/dist/client/assets/useEvaluationsV3Store-CjI63SqB.js +2 -0
  374. package/langwatch/dist/client/assets/useExportTraces-kA2TFkjy.js +2 -0
  375. package/langwatch/dist/client/assets/useFeatureFlag-BjAcqOFH.js +2 -0
  376. package/langwatch/dist/client/assets/usePersonalContext-BGjy_Vrg.js +2 -0
  377. package/langwatch/dist/client/assets/useProjectSpanNames-DV-N8Iqc.js +2 -0
  378. package/langwatch/dist/client/assets/useProjectsForCopy-C63wLMNr.js +2 -0
  379. package/langwatch/dist/client/assets/useRunViaApiTabs-DMsq4RV1.js +50 -0
  380. package/langwatch/dist/client/assets/useShowLangy-C1pPUZqz.js +2 -0
  381. package/langwatch/dist/client/assets/useSimulationUpdateListener-ufWGuGhO.js +2 -0
  382. package/langwatch/dist/client/assets/useTargetName-DRCsNovZ.js +2 -0
  383. package/langwatch/dist/client/assets/useTargetNameMap-2sQCSyzN.js +2 -0
  384. package/langwatch/dist/client/assets/useTraceDetailsDrawer-CWSKPTh_.js +2 -0
  385. package/langwatch/dist/client/assets/useTraceUpdateListener-DqLF7KuU.js +2 -0
  386. package/langwatch/dist/client/assets/useUrlScopeFilter-BmRsU3rU.js +2 -0
  387. package/langwatch/dist/client/assets/useVariantMetrics-CK9aOmIb.js +2 -0
  388. package/langwatch/dist/client/assets/useWorkflowStore-CWWkoMW1.js +8 -0
  389. package/langwatch/dist/client/assets/users-B9jauEWz.js +2 -0
  390. package/langwatch/dist/client/assets/users-C8IaWy9-.js +2 -0
  391. package/langwatch/dist/client/assets/users-DIbzKO8Q.js +2 -0
  392. package/langwatch/dist/client/assets/v3-C9Ud_O3k.js +2 -0
  393. package/langwatch/dist/client/assets/variables-Dox25KUK.js +396 -0
  394. package/langwatch/dist/client/assets/viewStore-BCIvcW8n.js +2 -0
  395. package/langwatch/dist/client/assets/virtual-keys-D-qkAFBv.js +2 -0
  396. package/langwatch/dist/client/assets/welcome-CnjW7kg3.js +16 -0
  397. package/langwatch/dist/client/assets/wizard-CUCaNag_.js +2 -0
  398. package/langwatch/dist/client/assets/workbench-N1DutXtL.js +2 -0
  399. package/langwatch/dist/client/assets/workflows-D2XRYWpS.js +3 -0
  400. package/langwatch/dist/client/assets/wrap-D_XqGHIU.js +2 -0
  401. package/langwatch/dist/client/index.html +4 -4
  402. package/langwatch/dist/scenario-child-process.js +7 -0
  403. package/langwatch/e2e/auth-regression/better-auth-sso-smoketest.ts +72 -0
  404. package/langwatch/ee/LICENSE.md +52 -18
  405. package/langwatch/ee/README.md +15 -6
  406. package/langwatch/ee/admin/routes/__tests__/admin.integration.test.ts +1 -1
  407. package/langwatch/ee/admin/routes/admin.ts +1 -1
  408. package/langwatch/ee/audit-log/auditLog.ts +51 -0
  409. package/langwatch/ee/billing/__tests__/planLimits.unit.test.ts +6 -6
  410. package/langwatch/ee/billing/__tests__/planProvider.unit.test.ts +21 -33
  411. package/langwatch/ee/billing/__tests__/subscription.service.unit.test.ts +1 -0
  412. package/langwatch/ee/billing/__tests__/usage-limit.service.unit.test.ts +17 -17
  413. package/langwatch/ee/billing/planLimits.ts +1 -37
  414. package/langwatch/ee/billing/planProvider.ts +0 -13
  415. package/langwatch/ee/governance/reactors/__tests__/gatewayBudgetSync.reactor.unit.test.ts +39 -0
  416. package/langwatch/ee/governance/reactors/__tests__/governanceKpisSync.reactor.unit.test.ts +33 -0
  417. package/langwatch/ee/governance/reactors/__tests__/governanceOcsfEventsSync.reactor.unit.test.ts +33 -0
  418. package/langwatch/ee/governance/reactors/__tests__/governanceReactorsPreEnqueueGate.unit.test.ts +243 -0
  419. package/langwatch/ee/governance/reactors/gatewayBudgetSync.reactor.ts +391 -185
  420. package/langwatch/ee/governance/reactors/governanceKpisSync.reactor.ts +14 -7
  421. package/langwatch/ee/governance/reactors/governanceOcsfEventsSync.reactor.ts +97 -81
  422. package/langwatch/ee/governance/services/governanceAttributeKeys.ts +17 -0
  423. package/langwatch/ee/licensing/__tests__/constants.unit.test.ts +4 -6
  424. package/langwatch/ee/licensing/__tests__/defaults.unit.test.ts +63 -86
  425. package/langwatch/ee/licensing/__tests__/fixtures/testLicenses.ts +18 -0
  426. package/langwatch/ee/licensing/__tests__/licenseGenerationService.unit.test.ts +52 -16
  427. package/langwatch/ee/licensing/__tests__/licenseHandler.integration.test.ts +199 -15
  428. package/langwatch/ee/licensing/__tests__/mintedPlan.unit.test.ts +110 -0
  429. package/langwatch/ee/licensing/__tests__/planMapping.unit.test.ts +4 -29
  430. package/langwatch/ee/licensing/__tests__/planTemplates.unit.test.ts +0 -61
  431. package/langwatch/ee/licensing/__tests__/validation.unit.test.ts +69 -0
  432. package/langwatch/ee/licensing/constants.ts +11 -59
  433. package/langwatch/ee/licensing/defaults.ts +20 -32
  434. package/langwatch/ee/licensing/licenseGenerationService.ts +6 -19
  435. package/langwatch/ee/licensing/licenseHandler.ts +109 -92
  436. package/langwatch/ee/licensing/mintedPlan.ts +57 -0
  437. package/langwatch/ee/licensing/ossBaselineFloor.ts +45 -0
  438. package/langwatch/ee/licensing/planInfo.ts +0 -13
  439. package/langwatch/ee/licensing/planMapping.ts +0 -13
  440. package/langwatch/ee/licensing/planTemplates.ts +8 -42
  441. package/langwatch/ee/licensing/types.ts +24 -29
  442. package/langwatch/ee/licensing/validation.ts +13 -1
  443. package/langwatch/ee/scim/__tests__/scim-token.service.unit.test.ts +110 -0
  444. package/langwatch/ee/scim/__tests__/scim.costCenter.integration.test.ts +171 -0
  445. package/langwatch/ee/scim/__tests__/scim.service.unit.test.ts +415 -0
  446. package/langwatch/ee/scim/routes.ts +585 -0
  447. package/langwatch/ee/scim/scim-group.service.ts +465 -0
  448. package/langwatch/ee/scim/scim-role-resolver.ts +48 -0
  449. package/langwatch/ee/scim/scim-role-resolver.unit.test.ts +93 -0
  450. package/langwatch/ee/scim/scim-token.service.ts +71 -0
  451. package/langwatch/ee/scim/scim.service.ts +554 -0
  452. package/langwatch/ee/scim/scim.types.ts +149 -0
  453. package/langwatch/ee/scim/webhooks.ts +170 -0
  454. package/langwatch/ee/sso/__tests__/fallbackName.test.ts +142 -0
  455. package/langwatch/ee/sso/__tests__/matching.test.ts +126 -0
  456. package/langwatch/ee/sso/__tests__/parseIssuerUrl.test.ts +59 -0
  457. package/langwatch/ee/sso/__tests__/sso-gate.test.ts +459 -0
  458. package/langwatch/ee/sso/__tests__/sso-license.repository.test.ts +53 -0
  459. package/langwatch/ee/sso/__tests__/ssoPathGate.test.ts +182 -0
  460. package/langwatch/ee/sso/__tests__/ssoRouteTableCanary.test.ts +186 -0
  461. package/langwatch/ee/sso/matching.ts +48 -0
  462. package/langwatch/ee/sso/providers.ts +271 -0
  463. package/langwatch/ee/sso/sso-gate.ts +294 -0
  464. package/langwatch/ee/sso/sso-license.repository.ts +47 -0
  465. package/langwatch/ee/sso/ssoPathGate.ts +127 -0
  466. package/langwatch/package.json +1 -1
  467. package/langwatch/prisma/migrations/20260802120000_organization_user_disabled_at/migration.sql +7 -0
  468. package/langwatch/prisma/schema.prisma +8 -0
  469. package/langwatch/scripts/check-feature-parity.ts +0 -4
  470. package/langwatch/src/__tests__/noBinarySourceFiles.unit.test.ts +56 -0
  471. package/langwatch/src/app/api/agents/[[...route]]/app.ts +0 -2
  472. package/langwatch/src/app/api/agents/__tests__/agents-rest-api.integration.test.ts +0 -22
  473. package/langwatch/src/app/api/dashboards/[[...route]]/app.ts +0 -2
  474. package/langwatch/src/app/api/dashboards/__tests__/dashboard-rest-api.integration.test.ts +0 -18
  475. package/langwatch/src/app/api/dataset/[[...route]]/app.ts +0 -33
  476. package/langwatch/src/app/api/dataset/__tests__/dataset-rest-api.integration.test.ts +0 -24
  477. package/langwatch/src/app/api/dataset/__tests__/dataset-upload-api.integration.test.ts +0 -25
  478. package/langwatch/src/app/api/evaluators/[[...route]]/app.v1.ts +0 -2
  479. package/langwatch/src/app/api/export/scenario-runs/[[...route]]/app.ts +250 -0
  480. package/langwatch/src/app/api/export/scenario-runs/__tests__/scenario-run-export-route.integration.test.ts +336 -0
  481. package/langwatch/src/app/api/graphs/[[...route]]/app.ts +0 -2
  482. package/langwatch/src/app/api/middleware/__tests__/error-handler.unit.test.ts +4 -4
  483. package/langwatch/src/app/api/middleware/index.ts +0 -1
  484. package/langwatch/src/app/api/monitors/[[...route]]/app.ts +0 -2
  485. package/langwatch/src/app/api/projects/[[...route]]/app.ts +28 -8
  486. package/langwatch/src/app/api/prompts/[[...route]]/app.v1.ts +0 -2
  487. package/langwatch/src/app/api/scenario-events/[[...route]]/app.ts +0 -5
  488. package/langwatch/src/app/api/scenarios/[[...route]]/app.v1.ts +0 -2
  489. package/langwatch/src/app/api/shared/errors.ts +14 -0
  490. package/langwatch/src/app/api/simulation-runs/__tests__/simulation-run-platform-url.integration.test.ts +6 -3
  491. package/langwatch/src/app/api/suites/[[...route]]/app.ts +0 -2
  492. package/langwatch/src/app/api/teams/[[...route]]/app.ts +22 -1
  493. package/langwatch/src/app/api/teams/__tests__/teams-rest-api.integration.test.ts +146 -0
  494. package/langwatch/src/app/api/traces/[[...route]]/app.v1.ts +114 -0
  495. package/langwatch/src/app/api/triggers/[[...route]]/app.ts +0 -2
  496. package/langwatch/src/components/AddMembersForm.tsx +25 -5
  497. package/langwatch/src/components/AddOrEditDatasetDrawer.tsx +1 -9
  498. package/langwatch/src/components/ComparisonLeaderboardDrawer.tsx +496 -0
  499. package/langwatch/src/components/LicenseStatus.tsx +14 -16
  500. package/langwatch/src/components/__tests__/ComparisonLeaderboardDrawer.gate.integration.test.tsx +146 -0
  501. package/langwatch/src/components/__tests__/LicenseStatus.integration.test.tsx +129 -0
  502. package/langwatch/src/components/__tests__/UpgradeModal.integration.test.tsx +358 -68
  503. package/langwatch/src/components/agents/AgentCodeEditorDrawer.tsx +7 -14
  504. package/langwatch/src/components/agents/AgentHttpEditorDrawer.tsx +7 -14
  505. package/langwatch/src/components/agents/WorkflowSelectorDrawer.tsx +1 -15
  506. package/langwatch/src/components/analytics/DashboardNameDrawer.tsx +20 -26
  507. package/langwatch/src/components/auth/AuthCard.tsx +41 -0
  508. package/langwatch/src/components/batch-evaluation-results/BatchEvaluationResults.tsx +72 -0
  509. package/langwatch/src/components/batch-evaluation-results/BatchEvaluationResultsTable.tsx +109 -2
  510. package/langwatch/src/components/batch-evaluation-results/ComparisonCharts.tsx +241 -77
  511. package/langwatch/src/components/batch-evaluation-results/ComparisonLeaderboardChart.tsx +355 -0
  512. package/langwatch/src/components/batch-evaluation-results/ComparisonTable.tsx +437 -75
  513. package/langwatch/src/components/batch-evaluation-results/LeaderboardStep.tsx +105 -0
  514. package/langwatch/src/components/batch-evaluation-results/LeaderboardTrustPanel.tsx +464 -0
  515. package/langwatch/src/components/batch-evaluation-results/LeaderboardVerdictPanel.tsx +354 -0
  516. package/langwatch/src/components/batch-evaluation-results/PairwiseLeaderboard.tsx +553 -0
  517. package/langwatch/src/components/batch-evaluation-results/ParetoScatterChart.tsx +512 -0
  518. package/langwatch/src/components/batch-evaluation-results/TradeoffSummaryLine.tsx +58 -0
  519. package/langwatch/src/components/batch-evaluation-results/WinRateChart.tsx +12 -4
  520. package/langwatch/src/components/batch-evaluation-results/__tests__/ComparisonCharts.filter-overflow.integration.test.tsx +8 -1
  521. package/langwatch/src/components/batch-evaluation-results/__tests__/ComparisonCharts.leaderboard-gate.integration.test.tsx +192 -0
  522. package/langwatch/src/components/batch-evaluation-results/__tests__/ComparisonCharts.test.tsx +8 -1
  523. package/langwatch/src/components/batch-evaluation-results/__tests__/ComparisonTable.group-by-metadata.integration.test.tsx +352 -0
  524. package/langwatch/src/components/batch-evaluation-results/__tests__/bootstrapMeanCI.unit.test.ts +98 -0
  525. package/langwatch/src/components/batch-evaluation-results/__tests__/buildAxisLabels.unit.test.ts +134 -0
  526. package/langwatch/src/components/batch-evaluation-results/__tests__/buildPairwiseComparisons.test.ts +95 -0
  527. package/langwatch/src/components/batch-evaluation-results/__tests__/buildTrustChecks.unit.test.ts +551 -0
  528. package/langwatch/src/components/batch-evaluation-results/__tests__/computeBTLeaderboard.test.ts +428 -0
  529. package/langwatch/src/components/batch-evaluation-results/__tests__/computeBandClipping.unit.test.ts +125 -0
  530. package/langwatch/src/components/batch-evaluation-results/__tests__/computeComparability.unit.test.ts +208 -0
  531. package/langwatch/src/components/batch-evaluation-results/__tests__/computeJudgeBiasChecks.unit.test.ts +186 -0
  532. package/langwatch/src/components/batch-evaluation-results/__tests__/computeLeaderboardVerdict.test.ts +288 -0
  533. package/langwatch/src/components/batch-evaluation-results/__tests__/computeParetoDominance.unit.test.ts +599 -0
  534. package/langwatch/src/components/batch-evaluation-results/__tests__/computeSampleAdequacy.unit.test.ts +212 -0
  535. package/langwatch/src/components/batch-evaluation-results/__tests__/computeScoreBarScale.unit.test.ts +104 -0
  536. package/langwatch/src/components/batch-evaluation-results/__tests__/computeVariantMetrics.test.ts +99 -0
  537. package/langwatch/src/components/batch-evaluation-results/__tests__/detectComparisonColumns.test.ts +133 -0
  538. package/langwatch/src/components/batch-evaluation-results/__tests__/formatLeaderboardHeadline.unit.test.ts +252 -0
  539. package/langwatch/src/components/batch-evaluation-results/__tests__/formatTradeoffSummary.unit.test.ts +219 -0
  540. package/langwatch/src/components/batch-evaluation-results/__tests__/leaderboardCache.unit.test.ts +128 -0
  541. package/langwatch/src/components/batch-evaluation-results/__tests__/panelAgreement.unit.test.ts +165 -0
  542. package/langwatch/src/components/batch-evaluation-results/__tests__/paretoScatterPoints.unit.test.ts +95 -0
  543. package/langwatch/src/components/batch-evaluation-results/__tests__/scoreSeparation.unit.test.ts +314 -0
  544. package/langwatch/src/components/batch-evaluation-results/__tests__/variantMetricsSymmetry.unit.test.ts +129 -0
  545. package/langwatch/src/components/batch-evaluation-results/__tests__/verdictSafety.unit.test.ts +438 -0
  546. package/langwatch/src/components/batch-evaluation-results/__tests__/winMatrixHasPairwiseDetail.unit.test.ts +126 -0
  547. package/langwatch/src/components/batch-evaluation-results/bootstrapMeanCI.ts +78 -0
  548. package/langwatch/src/components/batch-evaluation-results/buildPairwiseComparisons.ts +30 -0
  549. package/langwatch/src/components/batch-evaluation-results/chartAxisLabels.ts +98 -0
  550. package/langwatch/src/components/batch-evaluation-results/computeBTLeaderboard.ts +814 -0
  551. package/langwatch/src/components/batch-evaluation-results/computeComparability.ts +305 -0
  552. package/langwatch/src/components/batch-evaluation-results/computeJudgeBiasChecks.ts +175 -0
  553. package/langwatch/src/components/batch-evaluation-results/computeLeaderboardVerdict.ts +277 -0
  554. package/langwatch/src/components/batch-evaluation-results/computeParetoDominance.ts +283 -0
  555. package/langwatch/src/components/batch-evaluation-results/computeSampleAdequacy.ts +91 -0
  556. package/langwatch/src/components/batch-evaluation-results/computeVariantMetrics.ts +236 -0
  557. package/langwatch/src/components/batch-evaluation-results/computeWinMatrixShape.ts +61 -0
  558. package/langwatch/src/components/batch-evaluation-results/formatLeaderboardHeadline.ts +139 -0
  559. package/langwatch/src/components/batch-evaluation-results/formatTradeoffSummary.ts +126 -0
  560. package/langwatch/src/components/batch-evaluation-results/mulberry32.ts +19 -0
  561. package/langwatch/src/components/batch-evaluation-results/scoreSeparation.ts +102 -0
  562. package/langwatch/src/components/batch-evaluation-results/types.ts +82 -9
  563. package/langwatch/src/components/batch-evaluation-results/useBTLeaderboard.ts +137 -0
  564. package/langwatch/src/components/batch-evaluation-results/usePairwiseSort.ts +78 -0
  565. package/langwatch/src/components/batch-evaluation-results/useResultsGrouping.ts +119 -0
  566. package/langwatch/src/components/batch-evaluation-results/useShowComparisonLeaderboard.ts +43 -0
  567. package/langwatch/src/components/batch-evaluation-results/useVariantMetrics.ts +106 -0
  568. package/langwatch/src/components/checks/DynamicZodForm.tsx +9 -0
  569. package/langwatch/src/components/drawerRegistry.ts +5 -0
  570. package/langwatch/src/components/evaluations/OnlineEvaluationDrawer.tsx +13 -20
  571. package/langwatch/src/components/evaluators/EvaluatorEditorShared.tsx +16 -20
  572. package/langwatch/src/components/evaluators/WorkflowSelectorForEvaluatorDrawer.tsx +1 -15
  573. package/langwatch/src/components/experiments/CreateExperimentButton.tsx +13 -17
  574. package/langwatch/src/components/license/LicenseDetailsCard.tsx +72 -23
  575. package/langwatch/src/components/license/LicenseGeneratorForm.tsx +0 -60
  576. package/langwatch/src/components/license/LicenseLoadError.tsx +23 -0
  577. package/langwatch/src/components/license/OverSeatsCallout.tsx +68 -0
  578. package/langwatch/src/components/license/ResourceLimitsDisplay.tsx +0 -74
  579. package/langwatch/src/components/license/__tests__/OverSeatsCallout.integration.test.tsx +56 -0
  580. package/langwatch/src/components/license/__tests__/ResourceLimitsDisplay.unit.test.ts +8 -135
  581. package/langwatch/src/components/license/__tests__/licenseStatusUtils.unit.test.ts +68 -13
  582. package/langwatch/src/components/license/__tests__/planFormDefaults.unit.test.ts +11 -11
  583. package/langwatch/src/components/license/__tests__/useLicenseActions.integration.test.ts +185 -0
  584. package/langwatch/src/components/license/licenseStatusUtils.ts +21 -17
  585. package/langwatch/src/components/license/planFormDefaults.ts +3 -18
  586. package/langwatch/src/components/license/useLicenseActions.ts +26 -3
  587. package/langwatch/src/components/me/PersonalRecentTracesTable.tsx +4 -0
  588. package/langwatch/src/components/ops/projections/BulkReplayWizard.tsx +23 -1
  589. package/langwatch/src/components/plans/PlansComparisonPage.tsx +18 -0
  590. package/langwatch/src/components/plans/__tests__/PlansComparisonPage.integration.test.tsx +17 -0
  591. package/langwatch/src/components/plans/__tests__/planCurrentResolver.unit.test.ts +19 -0
  592. package/langwatch/src/components/plans/planCurrentResolver.ts +13 -0
  593. package/langwatch/src/components/projects/CreateProjectDrawer.tsx +36 -40
  594. package/langwatch/src/components/prompts/PromptEditorDrawer.tsx +9 -15
  595. package/langwatch/src/components/prompts/__tests__/PromptEditorDrawer.test.tsx +0 -1
  596. package/langwatch/src/components/scenarios/ScenarioCreateModal.tsx +3 -5
  597. package/langwatch/src/components/scenarios/ScenarioFormDrawer.tsx +2 -32
  598. package/langwatch/src/components/settings/CreateTeamDrawer.tsx +31 -35
  599. package/langwatch/src/components/settings/EnterpriseCapabilitiesSection.tsx +236 -0
  600. package/langwatch/src/components/settings/InfoWithoutSelecting.tsx +25 -0
  601. package/langwatch/src/components/settings/OrganizationUserRoleField.tsx +21 -2
  602. package/langwatch/src/components/settings/__tests__/EnterpriseCapabilitiesSection.integration.test.tsx +173 -0
  603. package/langwatch/src/components/settings/__tests__/seatTypeCopy.unit.test.ts +94 -0
  604. package/langwatch/src/components/settings/__tests__/seatTypeExplanation.integration.test.tsx +126 -0
  605. package/langwatch/src/components/settings/seatTypeCopy.ts +29 -0
  606. package/langwatch/src/components/subscription/SubscriptionPage.tsx +0 -1
  607. package/langwatch/src/components/subscription/__tests__/subscription-test-setup.ts +0 -13
  608. package/langwatch/src/components/subscription/billing-plans.ts +3 -12
  609. package/langwatch/src/components/suites/RunHistoryFilters.tsx +55 -3
  610. package/langwatch/src/components/suites/RunHistoryPanel.tsx +44 -0
  611. package/langwatch/src/components/suites/ScenarioRunExportDialog.tsx +92 -0
  612. package/langwatch/src/components/suites/SuiteFormDrawer.tsx +4 -20
  613. package/langwatch/src/components/suites/__tests__/AllRunsPanel.integration.test.tsx +3 -0
  614. package/langwatch/src/components/suites/__tests__/RunHistoryEmptyState.integration.test.tsx +45 -0
  615. package/langwatch/src/components/suites/__tests__/RunHistoryLiveWindow.integration.test.tsx +135 -0
  616. package/langwatch/src/components/suites/__tests__/ScenarioRunExportUi.integration.test.tsx +227 -0
  617. package/langwatch/src/components/suites/__tests__/SuiteDetailPanel.integration.test.tsx +3 -0
  618. package/langwatch/src/components/suites/run-history-transforms.ts +1 -28
  619. package/langwatch/src/components/suites/useExportScenarioRuns.ts +333 -0
  620. package/langwatch/src/components/suites/useRunHistoryPagination.ts +14 -0
  621. package/langwatch/src/components/upgrade-modal/LimitContent.tsx +3 -154
  622. package/langwatch/src/env-create.mjs +4 -0
  623. package/langwatch/src/features/errors/logic/codes.ts +2 -1
  624. package/langwatch/src/features/errors/logic/presentation.ts +8 -3
  625. package/langwatch/src/features/langy/__tests__/presentLangyToolError.unit.test.ts +1 -1
  626. package/langwatch/src/features/langy/logic/langyToolFailure.ts +4 -7
  627. package/langwatch/src/features/traces-v2/components/TraceDrawer/conversationView/TurnSteps.tsx +1 -1
  628. package/langwatch/src/features/traces-v2/components/TraceDrawer/drawerHeader/DrawerHeader.tsx +34 -0
  629. package/langwatch/src/features/traces-v2/components/TraceDrawer/drawerHeader/__tests__/utils.unit.test.ts +74 -0
  630. package/langwatch/src/features/traces-v2/components/TraceDrawer/terminalView/TerminalView.tsx +57 -3
  631. package/langwatch/src/features/traces-v2/components/TraceDrawer/terminalView/__tests__/TerminalView.integration.test.tsx +43 -3
  632. package/langwatch/src/features/traces-v2/components/TraceTable/columns.ts +7 -0
  633. package/langwatch/src/features/traces-v2/components/TraceTable/registry/cells/trace/ContextSizeCell.tsx +48 -0
  634. package/langwatch/src/features/traces-v2/components/TraceTable/registry/cells/trace/__tests__/ContextSizeCell.integration.test.tsx +57 -0
  635. package/langwatch/src/features/traces-v2/components/TraceTable/registry/cells/trace/index.ts +2 -0
  636. package/langwatch/src/features/traces-v2/components/shared/TokenBreakdownTooltip.tsx +22 -0
  637. package/langwatch/src/features/traces-v2/lens/capabilities.ts +2 -0
  638. package/langwatch/src/features/traces-v2/types/trace.ts +2 -0
  639. package/langwatch/src/hooks/__tests__/useLicenseEnforcement.unit.test.tsx +18 -30
  640. package/langwatch/src/hooks/__tests__/useOrganizationTeamProject.personal-workspace.integration.test.tsx +30 -0
  641. package/langwatch/src/hooks/__tests__/usePostHogIdentify.unit.test.ts +3 -3
  642. package/langwatch/src/hooks/useMemberDisableAction.ts +53 -0
  643. package/langwatch/src/hooks/useOrganizationTeamProject.ts +8 -7
  644. package/langwatch/src/optimization_studio/components/Evaluate.tsx +39 -46
  645. package/langwatch/src/optimization_studio/components/workflow/NewWorkflowForm.tsx +22 -30
  646. package/langwatch/src/pages/[project]/analytics/custom/index.tsx +1 -6
  647. package/langwatch/src/pages/api/experiment/__tests__/init.unit.test.ts +2 -87
  648. package/langwatch/src/pages/api/experiment/init.ts +7 -60
  649. package/langwatch/src/pages/auth/__tests__/forgot-password.integration.test.tsx +38 -3
  650. package/langwatch/src/pages/auth/forgot-password.tsx +19 -23
  651. package/langwatch/src/pages/auth/reset-password.tsx +2 -23
  652. package/langwatch/src/pages/settings/__tests__/authentication.integration.test.tsx +7 -0
  653. package/langwatch/src/pages/settings/__tests__/team-settings.refused-save.integration.test.tsx +253 -0
  654. package/langwatch/src/pages/settings/authentication.tsx +7 -2
  655. package/langwatch/src/pages/settings/license.tsx +4 -3
  656. package/langwatch/src/pages/settings/members.tsx +126 -34
  657. package/langwatch/src/pages/settings/teams/[team].tsx +73 -20
  658. package/langwatch/src/pages/settings/usage.tsx +7 -8
  659. package/langwatch/src/prompts/prompt-playground/components/sidebar/AddPromptButton.tsx +3 -8
  660. package/langwatch/src/server/api/routers/__tests__/annotation.tenant-references.unit.test.ts +1 -1
  661. package/langwatch/src/server/api/routers/__tests__/apiKey.myBindings.unit.test.ts +1 -1
  662. package/langwatch/src/server/api/routers/__tests__/apiKey.nameById.unit.test.ts +1 -1
  663. package/langwatch/src/server/api/routers/__tests__/apiKey.restricted-permissions.unit.test.ts +4 -1
  664. package/langwatch/src/server/api/routers/__tests__/automations.router.integration.test.ts +1 -1
  665. package/langwatch/src/server/api/routers/__tests__/bugReports.gating.unit.test.ts +1 -1
  666. package/langwatch/src/server/api/routers/__tests__/enterprise-guards.integration.test.ts +0 -4
  667. package/langwatch/src/server/api/routers/__tests__/evaluators.tenant-workflow.unit.test.ts +1 -1
  668. package/langwatch/src/server/api/routers/__tests__/graphs.tenant-dashboard.unit.test.ts +1 -1
  669. package/langwatch/src/server/api/routers/__tests__/langy.turnErrors.unit.test.ts +1 -1
  670. package/langwatch/src/server/api/routers/__tests__/langyGithub.access-order.unit.test.ts +1 -1
  671. package/langwatch/src/server/api/routers/__tests__/license.integration.test.ts +1 -17
  672. package/langwatch/src/server/api/routers/__tests__/licenseEnforcement.reportLimitBlocked.unit.test.ts +1 -1
  673. package/langwatch/src/server/api/routers/__tests__/monitors.copy.integration.test.ts +1 -11
  674. package/langwatch/src/server/api/routers/__tests__/organization.acceptInvite.unit.test.ts +1 -1
  675. package/langwatch/src/server/api/routers/__tests__/organization.setMemberDisabled.integration.test.ts +306 -0
  676. package/langwatch/src/server/api/routers/__tests__/personal-workspace-invariants.integration.test.ts +794 -0
  677. package/langwatch/src/server/api/routers/__tests__/plan.getActivePlan.integration.test.ts +0 -1
  678. package/langwatch/src/server/api/routers/__tests__/project.getHasFirstMessage.unit.test.ts +1 -1
  679. package/langwatch/src/server/api/routers/__tests__/project.regenerateApiKey.unit.test.ts +2 -2
  680. package/langwatch/src/server/api/routers/__tests__/prompts.copy.integration.test.ts +0 -58
  681. package/langwatch/src/server/api/routers/__tests__/prompts.duplicate.integration.test.ts +0 -54
  682. package/langwatch/src/server/api/routers/__tests__/publicEnv.test.ts +60 -0
  683. package/langwatch/src/server/api/routers/__tests__/secrets.reserved-names.unit.test.ts +1 -1
  684. package/langwatch/src/server/api/routers/__tests__/team.update.multi-binding.unit.test.ts +1 -1
  685. package/langwatch/src/server/api/routers/__tests__/traces.4991-full-resolution.unit.test.ts +1 -1
  686. package/langwatch/src/server/api/routers/__tests__/tracesV2.transcript-read.unit.test.ts +121 -0
  687. package/langwatch/src/server/api/routers/__tests__/translate.unit.test.ts +1 -1
  688. package/langwatch/src/server/api/routers/__tests__/user.changePassword.unit.test.ts +105 -0
  689. package/langwatch/src/server/api/routers/__tests__/user.deactivation.unit.test.ts +1 -1
  690. package/langwatch/src/server/api/routers/__tests__/user.register.unit.test.ts +67 -5
  691. package/langwatch/src/server/api/routers/__tests__/workflows.generateCommitMessage.unit.test.ts +1 -1
  692. package/langwatch/src/server/api/routers/agents.ts +0 -6
  693. package/langwatch/src/server/api/routers/analytics/__tests__/dataForFilter.unit.test.ts +1 -1
  694. package/langwatch/src/server/api/routers/apiKey.ts +1 -1
  695. package/langwatch/src/server/api/routers/automations.ts +0 -4
  696. package/langwatch/src/server/api/routers/bugReports.ts +1 -1
  697. package/langwatch/src/server/api/routers/copyEvaluatorToProject.ts +2 -5
  698. package/langwatch/src/server/api/routers/dashboards.ts +0 -2
  699. package/langwatch/src/server/api/routers/dataset.ts +0 -9
  700. package/langwatch/src/server/api/routers/emailSuppression.ts +1 -1
  701. package/langwatch/src/server/api/routers/evaluators.ts +0 -4
  702. package/langwatch/src/server/api/routers/experiments.ts +0 -14
  703. package/langwatch/src/server/api/routers/export.ts +65 -24
  704. package/langwatch/src/server/api/routers/graphs.ts +0 -2
  705. package/langwatch/src/server/api/routers/group.ts +6 -0
  706. package/langwatch/src/server/api/routers/langyEgress.ts +1 -1
  707. package/langwatch/src/server/api/routers/langyGithub.ts +1 -1
  708. package/langwatch/src/server/api/routers/license.ts +44 -36
  709. package/langwatch/src/server/api/routers/licenseEnforcement.ts +0 -21
  710. package/langwatch/src/server/api/routers/modelProviders.ts +1 -1
  711. package/langwatch/src/server/api/routers/monitors.ts +0 -6
  712. package/langwatch/src/server/api/routers/onboarding/__tests__/onboarding.personal-workspace.integration.test.ts +8 -15
  713. package/langwatch/src/server/api/routers/onboarding/onboarding.router.unit.test.ts +1 -1
  714. package/langwatch/src/server/api/routers/onboarding/setProductInterest.integration.test.ts +1 -1
  715. package/langwatch/src/server/api/routers/ops.ts +2 -0
  716. package/langwatch/src/server/api/routers/organization.ts +67 -1
  717. package/langwatch/src/server/api/routers/project.ts +74 -36
  718. package/langwatch/src/server/api/routers/prompts/prompts.trpc-router.ts +0 -10
  719. package/langwatch/src/server/api/routers/publicEnv.ts +7 -3
  720. package/langwatch/src/server/api/routers/scenarios/__tests__/simulation-runner.router.unit.test.ts +1 -1
  721. package/langwatch/src/server/api/routers/scenarios/scenario-crud.router.ts +0 -4
  722. package/langwatch/src/server/api/routers/scimToken.ts +1 -1
  723. package/langwatch/src/server/api/routers/suites/suite.router.ts +0 -3
  724. package/langwatch/src/server/api/routers/team.ts +48 -39
  725. package/langwatch/src/server/api/routers/tracesV2.schemas.ts +2 -0
  726. package/langwatch/src/server/api/routers/tracesV2.ts +76 -20
  727. package/langwatch/src/server/api/routers/user.ts +16 -6
  728. package/langwatch/src/server/api/routers/workflows.ts +0 -7
  729. package/langwatch/src/server/api/trpc.ts +1 -1
  730. package/langwatch/src/server/api-key/__tests__/api-key.service.legacy-ceiling.unit.test.ts +379 -0
  731. package/langwatch/src/server/api-key/__tests__/api-key.service.safety.unit.test.ts +3 -0
  732. package/langwatch/src/server/api-key/__tests__/api-key.service.unit.test.ts +3 -0
  733. package/langwatch/src/server/api-key/api-key.service.ts +63 -22
  734. package/langwatch/src/server/api-router.ts +5 -3
  735. package/langwatch/src/server/app-layer/__tests__/tracing.unit.test.ts +142 -0
  736. package/langwatch/src/server/app-layer/clients/clickhouse/__tests__/cold-scan-detector.coverage.unit.test.ts +2 -0
  737. package/langwatch/src/server/app-layer/clients/clickhouse/windowed-read.ts +15 -0
  738. package/langwatch/src/server/app-layer/dependencies.ts +8 -0
  739. package/langwatch/src/server/app-layer/evaluations/repositories/__tests__/evaluation-run.resolver-window.unit.test.ts +103 -0
  740. package/langwatch/src/server/app-layer/evaluations/repositories/evaluation-run.clickhouse.repository.ts +35 -1
  741. package/langwatch/src/server/app-layer/groups/group.service.ts +37 -0
  742. package/langwatch/src/server/app-layer/groups/repositories/group.prisma.repository.ts +9 -0
  743. package/langwatch/src/server/app-layer/groups/repositories/group.repository.ts +8 -0
  744. package/langwatch/src/server/app-layer/langy/__tests__/langyConversationMemory.unit.test.ts +1 -1
  745. package/langwatch/src/server/app-layer/langy/__tests__/langyTurnContext.unit.test.ts +0 -0
  746. package/langwatch/src/server/app-layer/langy/langyConversationMemory.ts +1 -1
  747. package/langwatch/src/server/app-layer/logs/repositories/__tests__/canonical-log-record.clickhouse.repository.unit.test.ts +54 -0
  748. package/langwatch/src/server/app-layer/logs/repositories/canonical-log-record.clickhouse.repository.ts +29 -12
  749. package/langwatch/src/server/app-layer/ops/__tests__/integration/pending-counter-reconcile.integration.test.ts +240 -0
  750. package/langwatch/src/server/app-layer/ops/__tests__/integration/replay-full-rebuild.integration.test.ts +390 -0
  751. package/langwatch/src/server/app-layer/ops/__tests__/replay.service.unit.test.ts +105 -1
  752. package/langwatch/src/server/app-layer/ops/replay.service.ts +47 -0
  753. package/langwatch/src/server/app-layer/ops/repositories/__tests__/queue.redis.repository.reconcile-pending.unit.test.ts +752 -0
  754. package/langwatch/src/server/app-layer/ops/repositories/queue.redis.repository.ts +597 -48
  755. package/langwatch/src/server/app-layer/organizations/__tests__/organization.service.unit.test.ts +1 -0
  756. package/langwatch/src/server/app-layer/organizations/organization.service.ts +16 -0
  757. package/langwatch/src/server/app-layer/organizations/repositories/organization.prisma.repository.ts +63 -2
  758. package/langwatch/src/server/app-layer/organizations/repositories/organization.repository.ts +15 -0
  759. package/langwatch/src/server/app-layer/presets.ts +27 -13
  760. package/langwatch/src/server/app-layer/projects/__tests__/project-service-update.unit.test.ts +100 -0
  761. package/langwatch/src/server/app-layer/projects/project.service.ts +145 -6
  762. package/langwatch/src/server/app-layer/projects/repositories/project.prisma.repository.ts +2 -16
  763. package/langwatch/src/server/app-layer/projects/repositories/project.repository.ts +2 -13
  764. package/langwatch/src/server/app-layer/simulations/__tests__/scenario-run-export-sweep.integration.test.ts +370 -0
  765. package/langwatch/src/server/app-layer/simulations/repositories/simulation.clickhouse.repository.ts +302 -7
  766. package/langwatch/src/server/app-layer/simulations/repositories/simulation.repository.ts +62 -0
  767. package/langwatch/src/server/app-layer/subscription/__tests__/composite-plan-provider.unit.test.ts +2 -28
  768. package/langwatch/src/server/app-layer/subscription/__tests__/self-hosted-plan-provider.unit.test.ts +101 -0
  769. package/langwatch/src/server/app-layer/subscription/self-hosted-plan-provider.ts +34 -0
  770. package/langwatch/src/server/app-layer/teams/team.service.ts +27 -0
  771. package/langwatch/src/server/app-layer/traces/__tests__/claude-code-span-enrichment.unit.test.ts +179 -0
  772. package/langwatch/src/server/app-layer/traces/__tests__/coding-agent-span-filter.unit.test.ts +50 -0
  773. package/langwatch/src/server/app-layer/traces/__tests__/coding-agent-transcript.derivation.unit.test.ts +331 -0
  774. package/langwatch/src/server/app-layer/traces/__tests__/trace-io-extraction.service.unit.test.ts +20 -0
  775. package/langwatch/src/server/app-layer/traces/canonicalisation/__tests__/structuredIO.test.ts +22 -1
  776. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/__tests__/claudeCode.unit.test.ts +217 -0
  777. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/__tests__/codex.unit.test.ts +133 -0
  778. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/__tests__/vercel.unit.test.ts +79 -0
  779. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/_constants.ts +9 -0
  780. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/claudeCode.ts +429 -6
  781. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/codex.ts +158 -70
  782. package/langwatch/src/server/app-layer/traces/canonicalisation/extractors/vercel.ts +26 -8
  783. package/langwatch/src/server/app-layer/traces/claude-code-span-enrichment.ts +89 -1
  784. package/langwatch/src/server/app-layer/traces/coding-agent-span-filter.ts +23 -1
  785. package/langwatch/src/server/app-layer/traces/coding-agent-transcript.derivation.ts +330 -75
  786. package/langwatch/src/server/app-layer/traces/repositories/__tests__/span-storage.resolver-window.unit.test.ts +108 -0
  787. package/langwatch/src/server/app-layer/traces/repositories/__tests__/trace-list.clickhouse.repository.integration.test.ts +31 -2
  788. package/langwatch/src/server/app-layer/traces/repositories/span-storage.clickhouse.repository.ts +36 -1
  789. package/langwatch/src/server/app-layer/traces/repositories/trace-list.clickhouse.repository.ts +7 -0
  790. package/langwatch/src/server/app-layer/traces/trace-io-extraction.service.ts +8 -1
  791. package/langwatch/src/server/app-layer/traces/trace-list.service.ts +10 -0
  792. package/langwatch/src/server/app-layer/tracing.ts +47 -0
  793. package/langwatch/src/server/app-layer/usage/usage.service.ts +0 -80
  794. package/langwatch/src/server/better-auth/__tests__/hooks.test.ts +72 -0
  795. package/langwatch/src/server/better-auth/__tests__/index.test.ts +31 -9
  796. package/langwatch/src/server/better-auth/__tests__/resetRecoversOauthUser.test.ts +128 -0
  797. package/langwatch/src/server/better-auth/__tests__/ssoGate.hook.test.ts +321 -0
  798. package/langwatch/src/server/better-auth/hooks.ts +46 -1
  799. package/langwatch/src/server/better-auth/index.ts +123 -284
  800. package/langwatch/src/server/clickhouse/__tests__/replicatedEngineGuard.unit.test.ts +301 -0
  801. package/langwatch/src/server/clickhouse/goose.ts +8 -0
  802. package/langwatch/src/server/clickhouse/migrations/00064_replicate_gateway_budget_scope_totals.sql +291 -0
  803. package/langwatch/src/server/clickhouse/migrations/00065_replicate_trace_analytics_rollup.sql +143 -0
  804. package/langwatch/src/server/clickhouse/migrations/00066_replicate_evaluation_analytics_rollup.sql +115 -0
  805. package/langwatch/src/server/datasets/__tests__/dataset-chunking.unit.test.ts +0 -0
  806. package/langwatch/src/server/evaluations/evaluators.generated.ts +83 -63
  807. package/langwatch/src/server/event-sourcing/pipeline/__tests__/staticBuilder.validations.unit.test.ts +46 -0
  808. package/langwatch/src/server/event-sourcing/pipeline/processManagerDefinition.ts +14 -0
  809. package/langwatch/src/server/event-sourcing/pipeline/staticBuilder.ts +8 -0
  810. package/langwatch/src/server/event-sourcing/pipelines/automations/subscribers/__tests__/graphTriggerActivity.groupKey.unit.test.ts +55 -0
  811. package/langwatch/src/server/event-sourcing/pipelines/automations/subscribers/graphTriggerActivity.subscriber.ts +23 -0
  812. package/langwatch/src/server/event-sourcing/pipelines/blob-maintenance/process-manager/blobCleanup.process.ts +6 -4
  813. package/langwatch/src/server/event-sourcing/pipelines/coding-agent-processing/schemas/constants.ts +6 -4
  814. package/langwatch/src/server/event-sourcing/pipelines/evaluation-processing/pipeline.ts +9 -1
  815. package/langwatch/src/server/event-sourcing/pipelines/log-processing/__tests__/logCommandCoalescing.unit.test.ts +174 -0
  816. package/langwatch/src/server/event-sourcing/pipelines/log-processing/pipeline.ts +7 -0
  817. package/langwatch/src/server/event-sourcing/pipelines/log-processing/schemas/constants.ts +19 -0
  818. package/langwatch/src/server/event-sourcing/pipelines/metric-processing/__tests__/metricCommandCoalescing.unit.test.ts +137 -0
  819. package/langwatch/src/server/event-sourcing/pipelines/metric-processing/pipeline.ts +7 -0
  820. package/langwatch/src/server/event-sourcing/pipelines/metric-processing/schemas/constants.ts +19 -0
  821. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/__tests__/aiSdkStructuredOutput.integration.test.ts +199 -0
  822. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/pipeline.ts +9 -1
  823. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/projections/__tests__/spanStorageGroupKey.unit.test.ts +98 -0
  824. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/projections/__tests__/traceSummaryClaudeCodeLift.unit.test.ts +187 -1
  825. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/projections/spanStorage.mapProjection.ts +10 -1
  826. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/projections/spanStorageGroupKey.ts +63 -0
  827. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/projections/traceSummary.foldProjection.ts +85 -18
  828. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/reactors/__tests__/projectMetadata.groupKey.unit.test.ts +140 -0
  829. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/reactors/projectMetadata.reactor.ts +23 -0
  830. package/langwatch/src/server/event-sourcing/projections/__tests__/projectionRouter.mapReactorCollapse.unit.test.ts +260 -0
  831. package/langwatch/src/server/event-sourcing/projections/foldProjection.types.ts +6 -3
  832. package/langwatch/src/server/event-sourcing/projections/global/__tests__/billingMeterDispatch.groupKey.unit.test.ts +139 -0
  833. package/langwatch/src/server/event-sourcing/projections/global/billingMeterDispatch.reactor.ts +27 -1
  834. package/langwatch/src/server/event-sourcing/projections/projectionRouter.ts +58 -41
  835. package/langwatch/src/server/event-sourcing/queues/groupQueue/__tests__/blobSweeper.integration.test.ts +149 -0
  836. package/langwatch/src/server/event-sourcing/queues/groupQueue/__tests__/groupQueue.decodeDrop.integration.test.ts +12 -1
  837. package/langwatch/src/server/event-sourcing/queues/groupQueue/__tests__/groupQueue.integration.test.ts +45 -0
  838. package/langwatch/src/server/event-sourcing/queues/groupQueue/blobSweeper.ts +130 -22
  839. package/langwatch/src/server/event-sourcing/queues/groupQueue/scripts.ts +46 -0
  840. package/langwatch/src/server/event-sourcing/replay/__tests__/traceAnalyticsRollupReplay.integration.test.ts +356 -0
  841. package/langwatch/src/server/event-sourcing/replay/replayService.ts +7 -0
  842. package/langwatch/src/server/event-sourcing/services/queues/__tests__/queueManager.commandGroupKey.test.ts +114 -2
  843. package/langwatch/src/server/event-sourcing/services/queues/queueManager.ts +13 -9
  844. package/langwatch/src/server/experiments-v3/execution/__tests__/buildTargetMetadata.unit.test.ts +93 -0
  845. package/langwatch/src/server/experiments-v3/execution/__tests__/orchestratorStorageDispatch.unit.test.ts +57 -0
  846. package/langwatch/src/server/experiments-v3/execution/__tests__/resultMapper.test.ts +180 -13
  847. package/langwatch/src/server/experiments-v3/execution/orchestrator.ts +40 -8
  848. package/langwatch/src/server/experiments-v3/execution/resultMapper.ts +81 -22
  849. package/langwatch/src/server/experiments-v3/execution/types.ts +8 -0
  850. package/langwatch/src/server/export/scenario-runs/__tests__/csv-serializer.unit.test.ts +732 -0
  851. package/langwatch/src/server/export/scenario-runs/__tests__/scenario-run-export.service.unit.test.ts +303 -0
  852. package/langwatch/src/server/export/scenario-runs/csv-serializer.ts +383 -0
  853. package/langwatch/src/server/export/scenario-runs/errors.ts +44 -0
  854. package/langwatch/src/server/export/scenario-runs/scenario-run-export.service.ts +200 -0
  855. package/langwatch/src/server/export/scenario-runs/types.ts +64 -0
  856. package/langwatch/src/server/featureFlag/frontendFeatureFlags.ts +4 -0
  857. package/langwatch/src/server/featureFlag/registry.ts +7 -0
  858. package/langwatch/src/server/gateway/virtualKey.service.ts +2 -2
  859. package/langwatch/src/server/license-enforcement/__tests__/constants.unit.test.ts +2 -10
  860. package/langwatch/src/server/license-enforcement/__tests__/license-enforcement.repository.integration.test.ts +17 -194
  861. package/langwatch/src/server/license-enforcement/__tests__/license-enforcement.repository.unit.test.ts +3 -301
  862. package/langwatch/src/server/license-enforcement/__tests__/license-enforcement.service.unit.test.ts +51 -137
  863. package/langwatch/src/server/license-enforcement/__tests__/license-limit-guard.unit.test.ts +46 -13
  864. package/langwatch/src/server/license-enforcement/__tests__/usage-stats.service.unit.test.ts +1 -3
  865. package/langwatch/src/server/license-enforcement/constants.ts +0 -26
  866. package/langwatch/src/server/license-enforcement/index.ts +0 -5
  867. package/langwatch/src/server/license-enforcement/license-enforcement.repository.ts +4 -227
  868. package/langwatch/src/server/license-enforcement/license-enforcement.service.ts +0 -52
  869. package/langwatch/src/server/license-enforcement/types.ts +8 -17
  870. package/langwatch/src/server/license-enforcement/usage-stats.service.ts +0 -32
  871. package/langwatch/src/server/modelProviders/__tests__/governanceSignup.providerScope.integration.test.ts +1 -1
  872. package/langwatch/src/server/rbac/__tests__/apiKeyCeilingStaleness.unit.test.ts +5 -0
  873. package/langwatch/src/server/rbac/__tests__/role-binding-resolver.ceiling.unit.test.ts +108 -3
  874. package/langwatch/src/server/rbac/role-binding-resolver.ts +147 -1
  875. package/langwatch/src/server/role/__tests__/role-service-rolebinding.unit.test.ts +2 -0
  876. package/langwatch/src/server/role/role.service.ts +15 -1
  877. package/langwatch/src/server/role-bindings/__tests__/role-binding.service.tenant.unit.test.ts +2 -0
  878. package/langwatch/src/server/role-bindings/personal-team-scope.ts +105 -0
  879. package/langwatch/src/server/role-bindings/role-binding.service.ts +10 -2
  880. package/langwatch/src/server/routes/__tests__/github-langy-install.integration.test.ts +1 -1
  881. package/langwatch/src/server/routes/auth.ts +6 -1
  882. package/langwatch/src/server/routes/github-langy.ts +1 -1
  883. package/langwatch/src/server/scenarios/__tests__/scenario-archive.integration.test.ts +11 -15
  884. package/langwatch/src/server/scenarios/scenario-run-category.ts +48 -0
  885. package/langwatch/src/server/stored-objects/__tests__/coerce-content-to-array.unit.test.ts +0 -0
  886. package/langwatch/src/server/stored-objects/__tests__/scenario-events-ingest.integration.test.ts +2 -6
  887. package/langwatch/src/server/teams/team.service.ts +14 -1
  888. package/langwatch/src/server/tracer/types.ts +3 -0
  889. package/langwatch/src/server/traces/__tests__/trace-service-claude-enrichment.unit.test.ts +85 -0
  890. package/langwatch/src/server/traces/mappers/__tests__/trace-summary.mapper.test.ts +106 -0
  891. package/langwatch/src/server/traces/mappers/trace-summary.mapper.ts +59 -0
  892. package/langwatch/src/server/traces/projection/catalog.ts +3 -0
  893. package/langwatch/src/server/traces/trace.service.ts +21 -1
  894. package/langwatch/src/server/workers/__tests__/livenessThread.unit.test.ts +133 -0
  895. package/langwatch/src/server/workers/startWorkers.ts +250 -29
  896. package/langwatch/src/utils/__tests__/api.unit.test.ts +15 -15
  897. package/langwatch/src/utils/constants.ts +1 -0
  898. package/langwatch/src/utils/lambdaFetch.ts +0 -0
  899. package/langwatch/test-setup.ts +9 -0
  900. package/mcp-server/dist/chunk-FMQIE5DL.js +2328 -0
  901. package/mcp-server/dist/create-mcp-server.js +1 -1
  902. package/mcp-server/dist/discover-evaluator-schema-HYPFWGNN.js +2191 -0
  903. package/mcp-server/dist/http-server-UBX7YFXE.js +24466 -0
  904. package/mcp-server/dist/index.js +49 -33
  905. package/package.json +1 -1
  906. package/packages/server/dist/cli.cjs +1 -1
  907. package/langwatch/dist/client/assets/AddAnnotationQueueDrawer-BeOD83jA.js +0 -2
  908. package/langwatch/dist/client/assets/AddDatasetRecordDrawer-jHTYLVuB.js +0 -6
  909. package/langwatch/dist/client/assets/AddOrEditAnnotationScore-DW5VXwj8.js +0 -2
  910. package/langwatch/dist/client/assets/AddOrEditAnnotationScoreDrawer-6ycw-4n0.js +0 -2
  911. package/langwatch/dist/client/assets/AddOrEditDatasetDrawer-DKQT3n1Q.js +0 -3
  912. package/langwatch/dist/client/assets/AddParticipants-7HKlJHjI.js +0 -2
  913. package/langwatch/dist/client/assets/AgentHistoryDrawer-B1kjJyfj.js +0 -2
  914. package/langwatch/dist/client/assets/AgentHttpEditorDrawer-Dkex2eS8.js +0 -5
  915. package/langwatch/dist/client/assets/AgentListDrawer-B-ab-fJ_.js +0 -2
  916. package/langwatch/dist/client/assets/AgentTypeSelectorDrawer-CBUwY7Q0.js +0 -2
  917. package/langwatch/dist/client/assets/AgentWorkflowEditorDrawer-DZr-iX29.js +0 -2
  918. package/langwatch/dist/client/assets/AgentWorkflowTargetEditorDrawer-C1AYXbvP.js +0 -2
  919. package/langwatch/dist/client/assets/AiGatewayLayout-BFUOyL-l.js +0 -2
  920. package/langwatch/dist/client/assets/AnnotationsTable-CnwGxhJg.js +0 -2
  921. package/langwatch/dist/client/assets/AreaChart-BZjKjRMD.js +0 -2
  922. package/langwatch/dist/client/assets/AutomationDrawer-BTtX7UXo.js +0 -112
  923. package/langwatch/dist/client/assets/BatchEvaluationSummary-CFBL50E9.js +0 -2
  924. package/langwatch/dist/client/assets/BudgetEditDrawer-DhNs7V2e.js +0 -2
  925. package/langwatch/dist/client/assets/CartesianChart-CgGSWzzH.js +0 -54
  926. package/langwatch/dist/client/assets/CascadeArchiveDialog-BOcl2osO.js +0 -2
  927. package/langwatch/dist/client/assets/ChartTooltip-BKs8as3o.js +0 -4
  928. package/langwatch/dist/client/assets/ChatWindow-B-UHoZDM.js +0 -5
  929. package/langwatch/dist/client/assets/CodeEvaluatorEditorDrawer-jdmrD4H5.js +0 -9
  930. package/langwatch/dist/client/assets/CodexCodingDefaultsAsk-CKLyE8Ty.js +0 -2
  931. package/langwatch/dist/client/assets/ColorfulBlockIcons-Ctm_Gy50.js +0 -6
  932. package/langwatch/dist/client/assets/ColumnTypeIcon-Bh1MI0_N.js +0 -2
  933. package/langwatch/dist/client/assets/ConfirmDialog-CbyD4lof.js +0 -2
  934. package/langwatch/dist/client/assets/ContactSalesBlock-3LFiXNMY.js +0 -2
  935. package/langwatch/dist/client/assets/Conversation-C27uRW0p.js +0 -2
  936. package/langwatch/dist/client/assets/CopyInput-BJ8UDgiW.js +0 -2
  937. package/langwatch/dist/client/assets/CopyableInputWithPrefix-DhfQEE7R.js +0 -2
  938. package/langwatch/dist/client/assets/CreateProjectDrawer-f6ESIihF.js +0 -2
  939. package/langwatch/dist/client/assets/CreateTeamDrawer-CsScDzr3.js +0 -2
  940. package/langwatch/dist/client/assets/CustomGraph-DOp8hQmM.js +0 -2
  941. package/langwatch/dist/client/assets/DashboardLayout-BhHe0vIT.js +0 -96
  942. package/langwatch/dist/client/assets/DashboardNameDrawer-WriiQpWZ.js +0 -2
  943. package/langwatch/dist/client/assets/DataPrivacyRuleDrawer-BWcEQSs7.js +0 -2
  944. package/langwatch/dist/client/assets/DatasetEditorTable-BLbB_Sn-.js +0 -2
  945. package/langwatch/dist/client/assets/DatasetPickerList-CDIBTAQW.js +0 -2
  946. package/langwatch/dist/client/assets/DatasetPreviewTable-UuBrd6hv.js +0 -2
  947. package/langwatch/dist/client/assets/DatasetSelector-DJI4ZOko.js +0 -2
  948. package/langwatch/dist/client/assets/DefaultModelOverrideDrawer-DfGbPivl.js +0 -2
  949. package/langwatch/dist/client/assets/DeleteConfirmationDialog-w7WZ7lHP.js +0 -2
  950. package/langwatch/dist/client/assets/DocsLinks-vsvIA7dY.js +0 -2
  951. package/langwatch/dist/client/assets/DynamicZodForm-lW0sHL84.js +0 -2
  952. package/langwatch/dist/client/assets/EditAutomationFilterDrawer-UZGlf7Jf.js +0 -3
  953. package/langwatch/dist/client/assets/EditModelProviderDrawer-FxE8Cjfj.js +0 -4
  954. package/langwatch/dist/client/assets/EditProjectDrawer-DvGgMwQg.js +0 -2
  955. package/langwatch/dist/client/assets/EmojiPickerModal-DOTbYgFl.js +0 -3
  956. package/langwatch/dist/client/assets/EnterpriseLockedSurface-CM8Sj7hf.js +0 -2
  957. package/langwatch/dist/client/assets/ErrorBarContext-Bpz3-JDH.js +0 -2
  958. package/langwatch/dist/client/assets/EvaluatorApiUsageDialog-Bnv6z6m_.js +0 -107
  959. package/langwatch/dist/client/assets/EvaluatorCategorySelectorDrawer-DPt4B9Ey.js +0 -2
  960. package/langwatch/dist/client/assets/EvaluatorEditorDrawer-C1OQ89no.js +0 -2
  961. package/langwatch/dist/client/assets/EvaluatorEditorShared-Dlnmyfw9.js +0 -43
  962. package/langwatch/dist/client/assets/EvaluatorHistoryDrawer-BFqreRNY.js +0 -2
  963. package/langwatch/dist/client/assets/EvaluatorListDrawer-B5GkvEER.js +0 -2
  964. package/langwatch/dist/client/assets/EvaluatorMappingsSection-uZ95zEz_.js +0 -2
  965. package/langwatch/dist/client/assets/EvaluatorSelection-CLClnlPT.js +0 -2
  966. package/langwatch/dist/client/assets/EvaluatorSelectionBox-VWh5DBap.js +0 -2
  967. package/langwatch/dist/client/assets/EvaluatorTypeSelectorContent-BTrBItgE.js +0 -2
  968. package/langwatch/dist/client/assets/EvaluatorTypeSelectorDrawer-0T-zwQQZ.js +0 -2
  969. package/langwatch/dist/client/assets/ExecutionState-BPNxLkdI.js +0 -2
  970. package/langwatch/dist/client/assets/FeatureFlagsDrawer-CpSauosT.js +0 -2
  971. package/langwatch/dist/client/assets/FieldInfoTooltip-BlO6fteF.js +0 -2
  972. package/langwatch/dist/client/assets/FieldsFilters-B46wbf2n.js +0 -2
  973. package/langwatch/dist/client/assets/FilterDisplay-BzhnJIar.js +0 -2
  974. package/langwatch/dist/client/assets/FilterSidebar-CbZF27X2.js +0 -2
  975. package/langwatch/dist/client/assets/FormatMoney-vCZvmGG1.js +0 -2
  976. package/langwatch/dist/client/assets/FoundryDrawer-DskBXiS5.js +0 -2
  977. package/langwatch/dist/client/assets/FullLogo-Db9M_uOO.js +0 -2
  978. package/langwatch/dist/client/assets/GovernanceLayout-DiDbO74a.js +0 -2
  979. package/langwatch/dist/client/assets/GraphsLayout-BCvqg3RK.js +0 -2
  980. package/langwatch/dist/client/assets/GroupBindingInputRow-DQP7aETW.js +0 -2
  981. package/langwatch/dist/client/assets/GuardrailsDrawer-CHV6LBxp.js +0 -91
  982. package/langwatch/dist/client/assets/History-hXXVv0A2.js +0 -17
  983. package/langwatch/dist/client/assets/HorizontalFormControl-lYiaIlzD.js +0 -2
  984. package/langwatch/dist/client/assets/HoverableBigText-CIhevUVt.js +0 -2
  985. package/langwatch/dist/client/assets/InstallCliCard-CJKSPLJ_.js +0 -2
  986. package/langwatch/dist/client/assets/IntegratePaneShell-BpcA5j4P.js +0 -8
  987. package/langwatch/dist/client/assets/InviteMemberDrawer-DiuPqGoS.js +0 -2
  988. package/langwatch/dist/client/assets/IsolatedErrorBoundary-CZ4MnYEN.js +0 -2
  989. package/langwatch/dist/client/assets/LLMModelCostDrawer-D1G0lU1N.js +0 -2
  990. package/langwatch/dist/client/assets/LangyContextTarget-CIlp_Zew.js +0 -2
  991. package/langwatch/dist/client/assets/LegacyTracesDeprecationBanner-Cd0jbm0t.js +0 -2
  992. package/langwatch/dist/client/assets/Legend-DY68SncN.js +0 -6
  993. package/langwatch/dist/client/assets/Line-B2wakHWw.js +0 -2
  994. package/langwatch/dist/client/assets/LineChart-Bb84FSVR.js +0 -2
  995. package/langwatch/dist/client/assets/ListTable-8idtTXBY.js +0 -2
  996. package/langwatch/dist/client/assets/LoadingScreen-DQ62wqSN.js +0 -2
  997. package/langwatch/dist/client/assets/Markdown-C9extmbX.js +0 -35
  998. package/langwatch/dist/client/assets/MenuLink-CVzOs3K8.js +0 -2
  999. package/langwatch/dist/client/assets/MessageCard--GCYkR2M.js +0 -2
  1000. package/langwatch/dist/client/assets/MetadataTag-CSCPlbDN.js +0 -5
  1001. package/langwatch/dist/client/assets/ModelProviderCustomModelInput-DUwvNeux.js +0 -2
  1002. package/langwatch/dist/client/assets/ModelProviderScreen-BVBKstQm.js +0 -2
  1003. package/langwatch/dist/client/assets/ModelSelector-4R-dc-Ny.js +0 -2
  1004. package/langwatch/dist/client/assets/MyLayout-DCMYTSgX.js +0 -2
  1005. package/langwatch/dist/client/assets/NavigationFooter-1VNOUoV6.js +0 -2
  1006. package/langwatch/dist/client/assets/NewWorkflowForm-CsYSc1Vr.js +0 -2
  1007. package/langwatch/dist/client/assets/NoDataInfoBlock-C8x5bzL0.js +0 -2
  1008. package/langwatch/dist/client/assets/OnboardingContainer-e4kVlnyx.js +0 -2
  1009. package/langwatch/dist/client/assets/OnlineEvaluationDrawer-D2jYsSON.js +0 -2
  1010. package/langwatch/dist/client/assets/OpsPageShell-Ch1rtwuD.js +0 -2
  1011. package/langwatch/dist/client/assets/OttlEditor-baChQv3o.js +0 -3
  1012. package/langwatch/dist/client/assets/OverflownText-CY4Y__oL.js +0 -2
  1013. package/langwatch/dist/client/assets/ProjectAvatar-DtI9dT1f.js +0 -43
  1014. package/langwatch/dist/client/assets/ProjectLangyLayout-Cl7GB9zi.js +0 -82
  1015. package/langwatch/dist/client/assets/PromptEditorDrawer-BLIu4fKV.js +0 -2
  1016. package/langwatch/dist/client/assets/PromptListDrawer-BHC9jUMJ.js +0 -2
  1017. package/langwatch/dist/client/assets/PropertySectionTitle-Da2IdhM3.js +0 -37
  1018. package/langwatch/dist/client/assets/ProviderModelSelector-Cg5Lbc1U.js +0 -2
  1019. package/langwatch/dist/client/assets/ProviderScopeChips-D7HJW6Ht.js +0 -2
  1020. package/langwatch/dist/client/assets/PushToCopiesDialog-B_hvn6aW.js +0 -2
  1021. package/langwatch/dist/client/assets/ReferenceDot-DbjBc6Dh.js +0 -2
  1022. package/langwatch/dist/client/assets/RenderInputOutput-BntIB-Ae.js +0 -261
  1023. package/langwatch/dist/client/assets/ScenarioFormDrawer-BORe6ffA.js +0 -2
  1024. package/langwatch/dist/client/assets/ScenarioInputMappingSection-DVpK_-Qh.js +0 -2
  1025. package/langwatch/dist/client/assets/ScenarioRunDetailDrawer-MJhw77cs.js +0 -3
  1026. package/langwatch/dist/client/assets/ScopeChipPicker-B3xHf0Ii.js +0 -2
  1027. package/langwatch/dist/client/assets/SearchInput-C7YbWRUQ.js +0 -2
  1028. package/langwatch/dist/client/assets/SectionNavigationLayout-CIP_2Nxf.js +0 -2
  1029. package/langwatch/dist/client/assets/SelectDatasetDrawer-D_nCx9JT.js +0 -2
  1030. package/langwatch/dist/client/assets/SelectionActionBar-fxhOYCmO.js +0 -2
  1031. package/langwatch/dist/client/assets/SeriesFilterDrawer-zoWjjTxC.js +0 -2
  1032. package/langwatch/dist/client/assets/SettingsLayout-sixsNIX_.js +0 -2
  1033. package/langwatch/dist/client/assets/SetupWithAgentButton-Bhxb1yOj.js +0 -4
  1034. package/langwatch/dist/client/assets/ShikiCommandBox-CN1W-H2m.js +0 -5
  1035. package/langwatch/dist/client/assets/SpanDetails-DavcMtlr.js +0 -3
  1036. package/langwatch/dist/client/assets/SubscriptionPage-gPKGn08f.js +0 -2
  1037. package/langwatch/dist/client/assets/SuiteFormDrawer-C_5urLUY.js +0 -2
  1038. package/langwatch/dist/client/assets/TabButton-Cp8UA45p.js +0 -3
  1039. package/langwatch/dist/client/assets/TableCell-Cbtwk2YR.js +0 -2
  1040. package/langwatch/dist/client/assets/TargetTypeSelectorDrawer-B0xHR5hC.js +0 -2
  1041. package/langwatch/dist/client/assets/TeamForm-DvN0gccP.js +0 -2
  1042. package/langwatch/dist/client/assets/TeamUserRoleField-DD6lt16j.js +0 -2
  1043. package/langwatch/dist/client/assets/TraceDetails-DZtIKcmo.js +0 -9
  1044. package/langwatch/dist/client/assets/TraceDetailsDrawer-DKgyPTw5.js +0 -2
  1045. package/langwatch/dist/client/assets/TraceIdPeek-7T88rBev.js +0 -2
  1046. package/langwatch/dist/client/assets/TracesMapping-CYIUxk62.js +0 -2
  1047. package/langwatch/dist/client/assets/UpgradeModalContent-eXy8pG4-.js +0 -2
  1048. package/langwatch/dist/client/assets/UploadCSVDrawer-BTttuVHZ.js +0 -3
  1049. package/langwatch/dist/client/assets/VariablesSection-hjZ5pmeK.js +0 -2
  1050. package/langwatch/dist/client/assets/VersionBadge-BPxGh4w7.js +0 -2
  1051. package/langwatch/dist/client/assets/ViaClaudeDesktopScreen-B9EYtw_g.js +0 -1161
  1052. package/langwatch/dist/client/assets/ViewAutomationDrawer-H_lJU8lG.js +0 -2
  1053. package/langwatch/dist/client/assets/VirtualKeySecretReveal-5GeVsP9d.js +0 -54
  1054. package/langwatch/dist/client/assets/WelcomeLayout-CDTLOa4d.js +0 -2
  1055. package/langwatch/dist/client/assets/WithFeatureFlagGuard-OePuXWRG.js +0 -2
  1056. package/langwatch/dist/client/assets/WithPermissionGuard-Cr6Aljmy.js +0 -2
  1057. package/langwatch/dist/client/assets/WorkflowCard-SFB2TN6O.js +0 -2
  1058. package/langwatch/dist/client/assets/WorkflowSelectorForEvaluatorDrawer-C9JwDruB.js +0 -2
  1059. package/langwatch/dist/client/assets/_...path_-Cgdgmf5W.js +0 -2
  1060. package/langwatch/dist/client/assets/_Uint8Array-DZ50H-2q.js +0 -2
  1061. package/langwatch/dist/client/assets/__...path__-CwRP2Csi.js +0 -22
  1062. package/langwatch/dist/client/assets/_baseAssignValue-BqKt0w0a.js +0 -2
  1063. package/langwatch/dist/client/assets/_baseClone-DCKy3Vq2.js +0 -2
  1064. package/langwatch/dist/client/assets/_baseEach-BGeacxUS.js +0 -2
  1065. package/langwatch/dist/client/assets/_baseFor-BQgMStOx.js +0 -2
  1066. package/langwatch/dist/client/assets/_experiment_-UwR3aJGK.js +0 -2
  1067. package/langwatch/dist/client/assets/_id_-7nn1sxUS.js +0 -2
  1068. package/langwatch/dist/client/assets/_id_-BGN_cxTM.js +0 -2
  1069. package/langwatch/dist/client/assets/_id_-C39KWPCF.js +0 -2
  1070. package/langwatch/dist/client/assets/_id_-CLpZ89Xl.js +0 -2
  1071. package/langwatch/dist/client/assets/_id_-CYndCW2V.js +0 -2
  1072. package/langwatch/dist/client/assets/_id_-CfWpUbg4.js +0 -2
  1073. package/langwatch/dist/client/assets/_id_-npXkLrUc.js +0 -2
  1074. package/langwatch/dist/client/assets/_project_-B7G8spwK.js +0 -8
  1075. package/langwatch/dist/client/assets/_runId_-BSik_ZD4.js +0 -7
  1076. package/langwatch/dist/client/assets/_shell-BGaZUKLi.js +0 -2
  1077. package/langwatch/dist/client/assets/_slug_-BN6BJfW8.js +0 -17
  1078. package/langwatch/dist/client/assets/_slug_-C7DGk6aN.js +0 -2
  1079. package/langwatch/dist/client/assets/_slug_-DOlOZ10W.js +0 -2
  1080. package/langwatch/dist/client/assets/_team_-B9rXOt0D.js +0 -2
  1081. package/langwatch/dist/client/assets/_workflow_-BJIdrL-L.js +0 -25
  1082. package/langwatch/dist/client/assets/_workflow_-BKcndaRn.js +0 -3
  1083. package/langwatch/dist/client/assets/accept-CSdmIcux.js +0 -2
  1084. package/langwatch/dist/client/assets/activity-QICCt22J.js +0 -1
  1085. package/langwatch/dist/client/assets/agents--fK5G7M5.js +0 -2
  1086. package/langwatch/dist/client/assets/alerts-QICCt22J.js +0 -1
  1087. package/langwatch/dist/client/assets/all-yOqzcthm.js +0 -2
  1088. package/langwatch/dist/client/assets/analytics-CjMLTwIY.js +0 -2
  1089. package/langwatch/dist/client/assets/annotation-scores-sPTr7fKF.js +0 -2
  1090. package/langwatch/dist/client/assets/annotations-Ye3ttmrc.js +0 -2
  1091. package/langwatch/dist/client/assets/anomaly-rules-DwSc-85q.js +0 -2
  1092. package/langwatch/dist/client/assets/api-keys-CKyHUAXs.js +0 -4
  1093. package/langwatch/dist/client/assets/asaplangy-6A4CIIRR.js +0 -5
  1094. package/langwatch/dist/client/assets/audit-log-DQ9_D13G.js +0 -2
  1095. package/langwatch/dist/client/assets/auth-CHp-bSLm.js +0 -2
  1096. package/langwatch/dist/client/assets/authentication-CktawfTg.js +0 -2
  1097. package/langwatch/dist/client/assets/authorize-BSFPddoX.js +0 -2
  1098. package/langwatch/dist/client/assets/authorize-YWRIgnuS.js +0 -2
  1099. package/langwatch/dist/client/assets/automations-CI-QD_zf.js +0 -2
  1100. package/langwatch/dist/client/assets/automations-QICCt22J.js +0 -1
  1101. package/langwatch/dist/client/assets/billing-plans-DUVLJ_Sk.js +0 -2
  1102. package/langwatch/dist/client/assets/blank-CqHTkVM2.js +0 -2
  1103. package/langwatch/dist/client/assets/blobs-B_lHV3eu.js +0 -2
  1104. package/langwatch/dist/client/assets/blockDiagram-677ZJIJ3-CQSMftlX.js +0 -133
  1105. package/langwatch/dist/client/assets/budgets-D0yk2zkk.js +0 -3
  1106. package/langwatch/dist/client/assets/bug-reports-D48JQaYJ.js +0 -2
  1107. package/langwatch/dist/client/assets/cache-rules-BLbEe56I.js +0 -2
  1108. package/langwatch/dist/client/assets/choose-CR8H5_AF.js +0 -2
  1109. package/langwatch/dist/client/assets/chunk-EX3LRPZG-CULySKMF.js +0 -232
  1110. package/langwatch/dist/client/assets/chunk-FWX5IMBZ-vsHlz4qh.js +0 -3
  1111. package/langwatch/dist/client/assets/chunk-PUDLZKDR-ByJfzd90.js +0 -157
  1112. package/langwatch/dist/client/assets/chunk-RYQCIY6F-DW5yDiZP.js +0 -2
  1113. package/langwatch/dist/client/assets/chunk-V7JOEXUC-rGVlZXkP.js +0 -207
  1114. package/langwatch/dist/client/assets/classDiagram-OUVF2IWQ-DjpCOWYp.js +0 -2
  1115. package/langwatch/dist/client/assets/classDiagram-v2-EOCWNBFH-DjpCOWYp.js +0 -2
  1116. package/langwatch/dist/client/assets/codeAgentConfig-DlJOMg8p.js +0 -7
  1117. package/langwatch/dist/client/assets/codingDefaultSync-C3S2VHmn.js +0 -2
  1118. package/langwatch/dist/client/assets/configure-BPQgl6jf.js +0 -4
  1119. package/langwatch/dist/client/assets/constants-Bb5Vi_Bd.js +0 -2
  1120. package/langwatch/dist/client/assets/custom-D79e_fnJ.js +0 -12
  1121. package/langwatch/dist/client/assets/custom_evaluator-DgcItmbH.js +0 -31
  1122. package/langwatch/dist/client/assets/dagre-BqI7WPId.js +0 -2
  1123. package/langwatch/dist/client/assets/dagre-VKFMJZFB-BJj7ndf9.js +0 -5
  1124. package/langwatch/dist/client/assets/data-privacy-BuolZ3DI.js +0 -2
  1125. package/langwatch/dist/client/assets/data-retention-yWQxxUQF.js +0 -2
  1126. package/langwatch/dist/client/assets/datasets-u_OgZHiv.js +0 -2
  1127. package/langwatch/dist/client/assets/debounce-BJsF8wQY.js +0 -2
  1128. package/langwatch/dist/client/assets/defaultModelState-DY_b79Yj.js +0 -2
  1129. package/langwatch/dist/client/assets/dejaview-DSjI4vi2.js +0 -2
  1130. package/langwatch/dist/client/assets/departments-C3oaBPyA.js +0 -2
  1131. package/langwatch/dist/client/assets/devices-O_ZVZdxA.js +0 -2
  1132. package/langwatch/dist/client/assets/dist-Dd3SzC15.js +0 -6
  1133. package/langwatch/dist/client/assets/drawerFromUrl-DaNSDEzf.js +0 -2
  1134. package/langwatch/dist/client/assets/edit-CswmqyLU.js +0 -62
  1135. package/langwatch/dist/client/assets/email-suppressions-B8AuxWio.js +0 -2
  1136. package/langwatch/dist/client/assets/erDiagram-Q63AITRT-DIiR5G9i.js +0 -86
  1137. package/langwatch/dist/client/assets/error-nKFTkytv.js +0 -2
  1138. package/langwatch/dist/client/assets/errors-e711UMq7.js +0 -2
  1139. package/langwatch/dist/client/assets/evaluations-Cg9PywKJ.js +0 -2
  1140. package/langwatch/dist/client/assets/evaluations-xuA_g6-G.js +0 -2
  1141. package/langwatch/dist/client/assets/evaluators-6oHFfk5m.js +0 -146
  1142. package/langwatch/dist/client/assets/evaluators-CBPI9nP9.js +0 -2
  1143. package/langwatch/dist/client/assets/experiments-DHsdWtPG.js +0 -1
  1144. package/langwatch/dist/client/assets/feature-flags-e-cVnxOK.js +0 -2
  1145. package/langwatch/dist/client/assets/fetchSSE-5rVPow_l.js +0 -3
  1146. package/langwatch/dist/client/assets/fieldset-BNLAUiqD.js +0 -2
  1147. package/langwatch/dist/client/assets/flowDiagram-23GEKE2U-DlrfK-aL.js +0 -1
  1148. package/langwatch/dist/client/assets/forgot-password-B_FXHTn9.js +0 -2
  1149. package/langwatch/dist/client/assets/formatMoney-DRwvOSzZ.js +0 -2
  1150. package/langwatch/dist/client/assets/formatTargetOutput-CkKef3lk.js +0 -2
  1151. package/langwatch/dist/client/assets/foundry-U39hnXil.js +0 -477
  1152. package/langwatch/dist/client/assets/gateway-DZnsUBnP.js +0 -2
  1153. package/langwatch/dist/client/assets/getEvaluator-irVFciCL.js +0 -2
  1154. package/langwatch/dist/client/assets/getRadiusAndStrokeWidthFromDot-BFtcAGI_.js +0 -2
  1155. package/langwatch/dist/client/assets/governance-BBQIXSQ_.js +0 -2
  1156. package/langwatch/dist/client/assets/graphlib-Bg9XziCe.js +0 -2
  1157. package/langwatch/dist/client/assets/grid-DVy6ELOp.js +0 -2
  1158. package/langwatch/dist/client/assets/groups-DYnJ4U2W.js +0 -2
  1159. package/langwatch/dist/client/assets/guardrails-DdKPd-Zs.js +0 -2
  1160. package/langwatch/dist/client/assets/handled-error-CI7XXA3n.js +0 -2
  1161. package/langwatch/dist/client/assets/http-DSF_1QKT.js +0 -7
  1162. package/langwatch/dist/client/assets/identifierUtils-B50FmQLB.js +0 -2
  1163. package/langwatch/dist/client/assets/immer-CFru3D02.js +0 -14
  1164. package/langwatch/dist/client/assets/index-CPtTUYLD.js +0 -68
  1165. package/langwatch/dist/client/assets/ingestion-source-detail-BLfzu5Yv.js +0 -19
  1166. package/langwatch/dist/client/assets/ingestion-sources-BcwE_tRu.js +0 -12
  1167. package/langwatch/dist/client/assets/integrations-D220c59Q.js +0 -2
  1168. package/langwatch/dist/client/assets/isArrayLikeObject-DUy1V36n.js +0 -2
  1169. package/langwatch/dist/client/assets/isSymbol-COuSxi_J.js +0 -2
  1170. package/langwatch/dist/client/assets/langyHomeSuggestions-6NtCcdnH.js +0 -2
  1171. package/langwatch/dist/client/assets/license-Be6bs3wD.js +0 -2
  1172. package/langwatch/dist/client/assets/licenseStatusUtils-YSS0xL-G.js +0 -2
  1173. package/langwatch/dist/client/assets/lu-DlSq9Be4.js +0 -2
  1174. package/langwatch/dist/client/assets/map-7tkBBrDN.js +0 -2
  1175. package/langwatch/dist/client/assets/mappingValidation-C-AT88B0.js +0 -2
  1176. package/langwatch/dist/client/assets/me-BHRwGQAJ.js +0 -7
  1177. package/langwatch/dist/client/assets/me-DyaTjlbw.js +0 -2
  1178. package/langwatch/dist/client/assets/members-Dn5oJBlv.js +0 -2
  1179. package/langwatch/dist/client/assets/mermaid.core-krP_t-L5.js +0 -12
  1180. package/langwatch/dist/client/assets/messages-CN1bd906.js +0 -2
  1181. package/langwatch/dist/client/assets/metrics-Do8QhcIC.js +0 -2
  1182. package/langwatch/dist/client/assets/mindmap-definition-LN4V7U3C-DBef2D4I.js +0 -97
  1183. package/langwatch/dist/client/assets/model-costs-D6eiVgIz.js +0 -2
  1184. package/langwatch/dist/client/assets/model-providers-CiSkvGtd.js +0 -2
  1185. package/langwatch/dist/client/assets/modelProviderHelpers-P2Cogc-H.js +0 -2
  1186. package/langwatch/dist/client/assets/my-queue-D1aRcnMh.js +0 -2
  1187. package/langwatch/dist/client/assets/normalizeComparison-BY-r_dYf.js +0 -2
  1188. package/langwatch/dist/client/assets/not-found-BiyummjJ.js +0 -2
  1189. package/langwatch/dist/client/assets/now-flOUcolU.js +0 -2
  1190. package/langwatch/dist/client/assets/onboarding-D3dMDvS6.js +0 -2
  1191. package/langwatch/dist/client/assets/online-evaluations-Dk2ygUi2.js +0 -2
  1192. package/langwatch/dist/client/assets/ops-Djcw5_lX.js +0 -2
  1193. package/langwatch/dist/client/assets/organizations-F6Q6gYJ3.js +0 -2
  1194. package/langwatch/dist/client/assets/pages-BXwixFEM.js +0 -2
  1195. package/langwatch/dist/client/assets/persistence-DZOtzFnQ.js +0 -2
  1196. package/langwatch/dist/client/assets/personalProject-DMRX2-SI.js +0 -2
  1197. package/langwatch/dist/client/assets/plans-C_VYB2VX.js +0 -2
  1198. package/langwatch/dist/client/assets/preconditionFieldUtils-B7QfymK4.js +0 -2
  1199. package/langwatch/dist/client/assets/product-D0RNZ3Ls.js +0 -2
  1200. package/langwatch/dist/client/assets/project-ZTQzA2gY.js +0 -2
  1201. package/langwatch/dist/client/assets/projections-DocSauqq.js +0 -2
  1202. package/langwatch/dist/client/assets/projects-ClyGKBO9.js +0 -2
  1203. package/langwatch/dist/client/assets/promptHandle-Cen_6YRW.js +0 -2
  1204. package/langwatch/dist/client/assets/prompts-CLb2R5Fd.js +0 -8
  1205. package/langwatch/dist/client/assets/radio-group-CWz2nJi3.js +0 -2
  1206. package/langwatch/dist/client/assets/registry-B64xvGV5.js +0 -2
  1207. package/langwatch/dist/client/assets/reports-C-XbHSdJ.js +0 -2
  1208. package/langwatch/dist/client/assets/request-C3Wgq2B3.js +0 -2
  1209. package/langwatch/dist/client/assets/requirementDiagram-TGXJPOKE-9g84jNsR.js +0 -85
  1210. package/langwatch/dist/client/assets/reset-password-ohopJtIH.js +0 -2
  1211. package/langwatch/dist/client/assets/role-bindings-BQ31P1EO.js +0 -2
  1212. package/langwatch/dist/client/assets/roles-CQDx2TP6.js +0 -2
  1213. package/langwatch/dist/client/assets/routing-policies-uvNo9gfx.js +0 -5
  1214. package/langwatch/dist/client/assets/scenarios-CpA_eExG.js +0 -2
  1215. package/langwatch/dist/client/assets/scheduler-CgzNzJjP.js +0 -2
  1216. package/langwatch/dist/client/assets/schedules-QICCt22J.js +0 -1
  1217. package/langwatch/dist/client/assets/scim-BivWilDe.js +0 -2
  1218. package/langwatch/dist/client/assets/secrets-Dp2ang1r.js +0 -2
  1219. package/langwatch/dist/client/assets/segment-group-DQ4SkpwM.js +0 -2
  1220. package/langwatch/dist/client/assets/segmented-control-BNxU6DEN.js +0 -2
  1221. package/langwatch/dist/client/assets/select-D17PWjH9.js +0 -2
  1222. package/langwatch/dist/client/assets/send-Dd5105kW.js +0 -2
  1223. package/langwatch/dist/client/assets/sequenceView-FFm7w152.js +0 -5
  1224. package/langwatch/dist/client/assets/seriesOptions-CDRg_FIS.js +0 -1015
  1225. package/langwatch/dist/client/assets/settings-aFAaBCpo.js +0 -2
  1226. package/langwatch/dist/client/assets/setup-BqCpBMpq.js +0 -2
  1227. package/langwatch/dist/client/assets/shikiAdapter-CbWAxLvq.js +0 -3
  1228. package/langwatch/dist/client/assets/showSuiteRunError-B2iiQdeh.js +0 -2
  1229. package/langwatch/dist/client/assets/signin-C6AzSXTw.js +0 -2
  1230. package/langwatch/dist/client/assets/signup-Co9SguQP.js +0 -2
  1231. package/langwatch/dist/client/assets/stateDiagram-2N3HPSRC-CDfCuyr-.js +0 -2
  1232. package/langwatch/dist/client/assets/stateDiagram-v2-6OUMAXLB-mNUL4OCz.js +0 -2
  1233. package/langwatch/dist/client/assets/subscription-BYrIJoC0.js +0 -3
  1234. package/langwatch/dist/client/assets/subscriptions-CrupW2oH.js +0 -2
  1235. package/langwatch/dist/client/assets/suggestionUI-0NFK2m-V.js +0 -106
  1236. package/langwatch/dist/client/assets/swimlanes-5IMT3BWC-aY42sUsR.js +0 -3
  1237. package/langwatch/dist/client/assets/swimlanesDiagram-G3AALYLV-BQgl3Mwz.js +0 -9
  1238. package/langwatch/dist/client/assets/switch-DGatWO8v.js +0 -2
  1239. package/langwatch/dist/client/assets/switch-mtnuJtgJ.js +0 -2
  1240. package/langwatch/dist/client/assets/tabs-U8n5D55_.js +0 -2
  1241. package/langwatch/dist/client/assets/teams-CMzKSSEB.js +0 -2
  1242. package/langwatch/dist/client/assets/teams-DBNLpvFi.js +0 -2
  1243. package/langwatch/dist/client/assets/tool-catalog-DgWWHys3.js +0 -7
  1244. package/langwatch/dist/client/assets/toolIcons-DmISNQ_S.js +0 -2
  1245. package/langwatch/dist/client/assets/tooltip-gjZ4s2dt.js +0 -2
  1246. package/langwatch/dist/client/assets/topic-clustering-wc06nKYO.js +0 -2
  1247. package/langwatch/dist/client/assets/topics-DbjuJKH7.js +0 -2
  1248. package/langwatch/dist/client/assets/traceStore-By6b3pBZ.js +0 -55
  1249. package/langwatch/dist/client/assets/traces-DjQaBgiE.js +0 -289
  1250. package/langwatch/dist/client/assets/tracesMapping-DpjIOyAg.js +0 -3
  1251. package/langwatch/dist/client/assets/tracking-D4oUOPlm.js +0 -2
  1252. package/langwatch/dist/client/assets/types-CCALFpCT.js +0 -2
  1253. package/langwatch/dist/client/assets/types-DfJmP3wn.js +0 -2
  1254. package/langwatch/dist/client/assets/types-X7bcC-zw.js +0 -2
  1255. package/langwatch/dist/client/assets/usage-B3fH-bNu.js +0 -2
  1256. package/langwatch/dist/client/assets/usage-YeRzOlEs.js +0 -2
  1257. package/langwatch/dist/client/assets/use-generic-onboarding-flow-DZY28ya2.js +0 -2
  1258. package/langwatch/dist/client/assets/useActivePlan-fRQ_etI2.js +0 -2
  1259. package/langwatch/dist/client/assets/useAllPromptsForProject-DCZJ0_-p.js +0 -2
  1260. package/langwatch/dist/client/assets/useAnnotationQueues-ByLqaEs6.js +0 -2
  1261. package/langwatch/dist/client/assets/useAvailableEvaluators-BKFN_L8t.js +0 -2
  1262. package/langwatch/dist/client/assets/useCompoundLicenseCheck-BqNF-zzC.js +0 -2
  1263. package/langwatch/dist/client/assets/useCyclingVerb-DSHVFfHS.js +0 -2
  1264. package/langwatch/dist/client/assets/useDepartmentColumn-D1DF_PiG.js +0 -2
  1265. package/langwatch/dist/client/assets/useEvaluationsV3Store-Bc6Q5CKo.js +0 -2
  1266. package/langwatch/dist/client/assets/useExportTraces-BqLmfd8N.js +0 -2
  1267. package/langwatch/dist/client/assets/useFeatureFlag-Do1Ecu3l.js +0 -2
  1268. package/langwatch/dist/client/assets/useInviteActions-DwPlKWmS.js +0 -2
  1269. package/langwatch/dist/client/assets/useLicenseEnforcement-DOI0dcqD.js +0 -2
  1270. package/langwatch/dist/client/assets/usePersonalContext-CggG6KVI.js +0 -2
  1271. package/langwatch/dist/client/assets/useProjectSpanNames-jFO9A6Re.js +0 -2
  1272. package/langwatch/dist/client/assets/useProjectsForCopy-B8F_BY79.js +0 -2
  1273. package/langwatch/dist/client/assets/useRunViaApiTabs-Cr0_nbbp.js +0 -50
  1274. package/langwatch/dist/client/assets/useShowLangy-kmjRxLHs.js +0 -2
  1275. package/langwatch/dist/client/assets/useSimulationUpdateListener-BQB61L8b.js +0 -2
  1276. package/langwatch/dist/client/assets/useTargetName-nPyk8kf-.js +0 -2
  1277. package/langwatch/dist/client/assets/useTargetNameMap-C2bPHyhD.js +0 -2
  1278. package/langwatch/dist/client/assets/useTraceDetailsDrawer-CL82mHNA.js +0 -2
  1279. package/langwatch/dist/client/assets/useTraceUpdateListener-r6BQdcuk.js +0 -2
  1280. package/langwatch/dist/client/assets/useUrlScopeFilter-DFlXMn0U.js +0 -2
  1281. package/langwatch/dist/client/assets/useWorkflowStore-DGHQA8ai.js +0 -8
  1282. package/langwatch/dist/client/assets/users-D5W8Qjjj.js +0 -2
  1283. package/langwatch/dist/client/assets/users-DFyHT5UO.js +0 -2
  1284. package/langwatch/dist/client/assets/users-rKylpyh9.js +0 -2
  1285. package/langwatch/dist/client/assets/v3-NB4P-Pc3.js +0 -2
  1286. package/langwatch/dist/client/assets/variables-DF2_abiB.js +0 -396
  1287. package/langwatch/dist/client/assets/viewStore-DtvCfAUF.js +0 -2
  1288. package/langwatch/dist/client/assets/virtual-keys-DW1kPrjW.js +0 -2
  1289. package/langwatch/dist/client/assets/welcome-DJsfSWej.js +0 -16
  1290. package/langwatch/dist/client/assets/wizard-D2X_QMNx.js +0 -2
  1291. package/langwatch/dist/client/assets/workbench-fZ1KK4fN.js +0 -2
  1292. package/langwatch/dist/client/assets/workflows-CY65pvqY.js +0 -3
  1293. package/langwatch/dist/client/assets/wrap-DlWOPhPw.js +0 -2
  1294. package/langwatch/src/app/api/middleware/__tests__/resource-limit-enforcement.integration.test.ts +0 -278
  1295. package/langwatch/src/app/api/middleware/__tests__/resource-limit.unit.test.ts +0 -299
  1296. package/langwatch/src/app/api/middleware/resource-limit.ts +0 -147
  1297. package/langwatch/src/app/api/scenario-events/[[...route]]/scenario-set-limit.ts +0 -54
  1298. package/langwatch/src/app/api/scenario-events/__tests__/scenario-set-limit.unit.test.ts +0 -195
  1299. package/langwatch/src/app/api/scenario-events/scenario-set-limit.stress.test.ts +0 -216
  1300. package/langwatch/src/components/__tests__/UpgradeModal.unit.test.tsx +0 -103
  1301. package/langwatch/src/hooks/useCompoundLicenseCheck.ts +0 -41
  1302. package/langwatch/src/pages/api/experiment/init.stress.test.ts +0 -130
  1303. package/langwatch/src/server/api/routers/__tests__/project.create.planLimit.integration.test.ts +0 -370
  1304. package/langwatch/src/server/api/routers/__tests__/team.createTeamWithMembers.planLimit.integration.test.ts +0 -251
  1305. package/langwatch/src/server/app-layer/usage/__tests__/usage-service-checkScenarioSetLimit.unit.test.ts +0 -322
  1306. package/langwatch/src/server/app-layer/usage/errors.ts +0 -24
  1307. package/langwatch/src/server/auditLog.ts +0 -49
  1308. package/langwatch/src/server/better-auth/__tests__/fallbackName.test.ts +0 -141
  1309. package/langwatch/src/server/better-auth/__tests__/parseIssuerUrl.test.ts +0 -58
  1310. package/langwatch/src/server/better-auth/__tests__/sso.test.ts +0 -125
  1311. package/langwatch/src/server/better-auth/sso.ts +0 -47
  1312. package/langwatch/src/server/event-sourcing/pipelines/trace-processing/projections/__tests__/traceSummary.coalesce.unit.test.ts +0 -33
  1313. package/langwatch/src/server/license-enforcement/__tests__/limit-breakdown.unit.test.ts +0 -101
  1314. package/langwatch/src/server/license-enforcement/__tests__/personal-workspaces-excluded.integration.test.ts +0 -391
  1315. package/langwatch/src/server/license-enforcement/enforcement.middleware.ts +0 -103
  1316. package/langwatch/src/server/license-enforcement/limit-breakdown.ts +0 -96
  1317. package/langwatch/src/server/routes/scim.ts +0 -583
  1318. package/langwatch/src/server/routes/webhooks.ts +0 -168
  1319. package/langwatch/src/server/scim/__tests__/scim-token.service.unit.test.ts +0 -109
  1320. package/langwatch/src/server/scim/__tests__/scim.costCenter.integration.test.ts +0 -170
  1321. package/langwatch/src/server/scim/__tests__/scim.service.unit.test.ts +0 -414
  1322. package/langwatch/src/server/scim/scim-group.service.ts +0 -464
  1323. package/langwatch/src/server/scim/scim-role-resolver.ts +0 -47
  1324. package/langwatch/src/server/scim/scim-role-resolver.unit.test.ts +0 -92
  1325. package/langwatch/src/server/scim/scim-token.service.ts +0 -70
  1326. package/langwatch/src/server/scim/scim.service.ts +0 -553
  1327. package/langwatch/src/server/scim/scim.types.ts +0 -148
  1328. package/mcp-server/dist/chunk-DSB77X63.js +0 -2328
  1329. package/mcp-server/dist/discover-evaluator-schema-OFEADIJY.js +0 -2175
  1330. package/mcp-server/dist/http-server-YVM4PRTC.js +0 -24466
@@ -1,25 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-WNeJk3KQ.js","assets/rolldown-runtime-DAXXjFlN.js","assets/react-BUD3sqOU.js"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{t as n}from"./react-BUD3sqOU.js";import{a as r,dn as i,i as a,jn as o,n as s}from"./portal-Sdfvrza9.js";import{S as c}from"./shiki-CS25xJLQ.js";import{t as l}from"./jsx-runtime-CFwixLRt.js";import{r as u,t as d}from"./skeleton-0JSrjbwm.js";import{t as f}from"./heading-C0sACr0w.js";import{n as p,t as m}from"./v-stack-hkuSkmCA.js";import{$n as h,D as g,Mt as _,Pn as v,Sn as y,T as b,Zn as x,ln as S,mn as C,tr as w,x as T}from"./ProjectAvatar-DtI9dT1f.js";import{p as E,t as D}from"./select-D17PWjH9.js";import{t as O}from"./badge-Cpc3eA-C.js";import{t as k}from"./tooltip-gjZ4s2dt.js";import{a as A,f as j,n as M}from"./toaster-BsYkODqs.js";import{$ as N,L as P,Q as ee,X as F,Y as te,Z as I,a as ne,et as L,i as re,j as ie,nt as ae,o as oe}from"./Markdown-C9extmbX.js";import{t as se}from"./grid-DVy6ELOp.js";import{a as ce,r as le,t as ue}from"./field-BadoNaN5.js";import{J as de,Jt as fe,Kt as pe,N as me,R as he,Ut as ge,X as _e,Y as ve,i as ye,qt as be,t as xe,z as Se}from"./DashboardLayout-BhHe0vIT.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./alert-CPsXih3K.js";import{n as Oe}from"./personalProject-DMRX2-SI.js";import{a as ke,i as Ae,n as je,r as Me,t as Ne}from"./empty-state-T8EYr5NF.js";import{T as Pe,h as Fe,n as Ie,w as R}from"./fetchSSE-5rVPow_l.js";import{t as Le}from"./grid-item-CKAuKzga.js";import{n as Re,t as ze}from"./errors-e711UMq7.js";import{t as z}from"./spacer-C38e7o6r.js";import{i as Be,o as Ve,r as He,t as Ue}from"./tabs-U8n5D55_.js";import{D as We,et as Ge,tt as Ke}from"./immer-CFru3D02.js";import{n as B}from"./api-l6Cnm0vQ.js";import{f as qe,p as Je}from"./trpcError-CFsR-0nB.js";import{w as Ye}from"./variables-DF2_abiB.js";import{a as Xe,c as Ze,i as Qe,n as $e,r as et,s as tt,t as nt,u as rt}from"./History-hXXVv0A2.js";import{l as it,n as at,o as ot,r as st,s as ct,t as lt,u as ut}from"./PropertySectionTitle-Da2IdhM3.js";import{r as dt}from"./next-router-CWLrMXvP.js";import{un as ft,ut as pt}from"./lu-DlSq9Be4.js";import{n as mt,o as ht,s as gt,t as _t,u as vt}from"./index.esm-Cpy5fWo1.js";import{D as yt,En as bt,Ft as xt,H as St,In as Ct,Mr as V,Nt as wt,Pr as Tt,Pt as Et,Rn as Dt,St as H,Tn as Ot,Vt as U,W as kt,cn as At,t as jt,zt as Mt}from"./index-CPtTUYLD.js";import{t as Nt}from"./next-head-B6Im7q_p.js";import{t as Pt}from"./react-B5vhk-dA.js";import{t as Ft}from"./prop-types-DeUPn3oD.js";import{t as It}from"./arrow-right-B4BUj4mB.js";import{t as Lt}from"./arrow-up-D_DfWcfb.js";import{t as Rt}from"./bar-chart-2-CoC_jxW-.js";import{t as zt}from"./book-open-d9AKoJH3.js";import{a as Bt,n as Vt,r as Ht}from"./ColorfulBlockIcons-Ctm_Gy50.js";import{t as Ut}from"./check-CcrJKf5P.js";import{a as Wt,i as Gt}from"./EvaluationStatus-CV8eYyuh.js";import{t as Kt}from"./code-kZIt0FhA.js";import{t as qt}from"./copy-DPUyWClX.js";import{t as Jt}from"./database-BBiIYDDI.js";import{t as Yt}from"./download-CuvC-TAo.js";import{t as Xt}from"./external-link-D1QPrDiK.js";import{c as Zt,l as Qt,o as $t,s as en,u as tn}from"./AddOrEditDatasetDrawer-DKQT3n1Q.js";import{t as nn}from"./flag-x5s6thWb.js";import{t as rn}from"./github-DPxohpyk.js";import{t as an}from"./info-DRDUmL_M.js";import{t as on}from"./more-vertical-CnKfgTmQ.js";import{t as sn}from"./play-DcPx4Q13.js";import{t as cn}from"./plus-10dP8Fmk.js";import{t as ln}from"./trash-2-Bq5tW_xF.js";import{t as un}from"./trending-up-CTX3qy-C.js";import{t as dn}from"./upload-C_eEH6OA.js";import{t as fn}from"./x-ePIIvo_k.js";import{i as pn,n as mn}from"./stringCasing-Cx6SsTTf.js";import{t as hn}from"./tracking-D4oUOPlm.js";import{t as gn}from"./LogoIcon-CyQDrYa_.js";import{a as _n,d as vn,f as yn,h as bn,i as xn,m as Sn,n as Cn,o as wn,p as W,r as Tn,s as En,t as Dn}from"./esm-FFYU9Hcy.js";import{t as On}from"./slugify-BfBxP6u_.js";import{t as kn}from"./useLicenseEnforcement-DOI0dcqD.js";import{t as An}from"./index.module-CJLn6vye.js";import{t as jn}from"./HorizontalFormControl-lYiaIlzD.js";import{t as Mn}from"./trace-eelqoZyE.js";import{t as Nn}from"./switch-DGatWO8v.js";import{t as Pn}from"./DatasetPreviewTable-UuBrd6hv.js";import{t as Fn}from"./next-dynamic-DcKsrHUa.js";import"./OverflownText-CY4Y__oL.js";import{t as In}from"./SmallLabel-Dh74EKHT.js";import{t as Ln}from"./RenderInputOutput-BntIB-Ae.js";import{t as Rn}from"./formatMilliseconds-P4cwJ3go.js";import{n as zn,t as Bn}from"./HoverableBigText-CIhevUVt.js";import{n as Vn,t as Hn}from"./evaluators-6oHFfk5m.js";import{t as Un}from"./getEvaluator-irVFciCL.js";import{a as Wn,n as Gn}from"./SpanDetails-DavcMtlr.js";import{r as Kn,s as qn}from"./identifierUtils-B50FmQLB.js";import{t as Jn}from"./VariablesSection-hjZ5pmeK.js";import{n as Yn}from"./WorkflowCard-SFB2TN6O.js";import{i as Xn,n as Zn,o as Qn,r as $n,s as er,t as tr}from"./nodeUtils-DBBk3sXl.js";import{a as nr,i as rr,n as ir}from"./ModelSelector-4R-dc-Ny.js";import{t as ar}from"./fast-deep-equal-C5UQ1xXE.js";import{t as or}from"./TraceIdPeek-7T88rBev.js";import{t as sr}from"./papaparse.min-cQwnxGCG.js";import{t as cr}from"./DatasetEditorTable-BLbB_Sn-.js";import{n as lr}from"./UploadCSVDrawer-BTttuVHZ.js";import{i as ur,n as dr,r as fr,t as pr}from"./codeAgentConfig-DlJOMg8p.js";import{n as mr,t as hr}from"./http-DSF_1QKT.js";import{t as gr}from"./EmojiPickerModal-DOTbYgFl.js";import{t as _r}from"./DatasetPickerList-CDIBTAQW.js";import{t as vr}from"./evaluatorEditorCallbacks-DSx3aJ6w.js";import{n as yr,t as br}from"./DynamicZodForm-lW0sHL84.js";import{t as xr}from"./EvaluatorMappingsSection-uZ95zEz_.js";import{n as Sr}from"./EvaluatorSelection-CLClnlPT.js";import{t as Cr}from"./langwatchEndpointEnv-nAxLDTZN.js";import{a as wr,i as Tr,o as Er,r as Dr,t as Or}from"./PromptEditorDrawer-BLIu4fKV.js";import{t as kr}from"./liquid.browser-BZOkdhgf.js";import{a as Ar,i as jr,n as Mr,o as Nr,r as Pr,t as Fr}from"./ExecutionState-BPNxLkdI.js";import{a as Ir,c as Lr,i as Rr,n as G,r as zr,s as Br,t as Vr}from"./useWorkflowStore-DGHQA8ai.js";import{t as Hr}from"./formatMoney-DRwvOSzZ.js";import"./FormatMoney-vCZvmGG1.js";import{n as Ur,r as Wr}from"./BatchEvaluationSummary-CFBL50E9.js";import{t as Gr}from"./useAvailableEvaluators-BKFN_L8t.js";import{n as Kr,r as qr,t as Jr}from"./useRunViaApiTabs-Cr0_nbbp.js";/* empty css */var K=e(n()),q=e(Ft());function Yr(){return Yr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yr.apply(this,arguments)}function Xr(e,t){if(e==null)return{};var n=Zr(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Zr(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Qr=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Xr(e,[`color`,`size`]);return K.createElement(`svg`,Yr({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),K.createElement(`polyline`,{points:`12 19 5 12 12 5`}))});Qr.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Qr.displayName=`ArrowLeft`;function $r(){return $r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$r.apply(this,arguments)}function ei(e,t){if(e==null)return{};var n=ti(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ti(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ni=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=ei(e,[`color`,`size`]);return K.createElement(`svg`,$r({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`circle`,{cx:`12`,cy:`12`,r:`10`}),K.createElement(`polyline`,{points:`16 12 12 8 8 12`}),K.createElement(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`8`}))});ni.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},ni.displayName=`ArrowUpCircle`;function ri(){return ri=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ri.apply(this,arguments)}function ii(e,t){if(e==null)return{};var n=ai(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ai(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var oi=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=ii(e,[`color`,`size`]);return K.createElement(`svg`,ri({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`polyline`,{points:`9 11 12 14 22 4`}),K.createElement(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`}))});oi.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},oi.displayName=`CheckSquare`;function si(){return si=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},si.apply(this,arguments)}function ci(e,t){if(e==null)return{};var n=li(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function li(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ui=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=ci(e,[`color`,`size`]);return K.createElement(`svg`,si({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`polyline`,{points:`11 17 6 12 11 7`}),K.createElement(`polyline`,{points:`18 17 13 12 18 7`}))});ui.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},ui.displayName=`ChevronsLeft`;function di(){return di=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},di.apply(this,arguments)}function fi(e,t){if(e==null)return{};var n=pi(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pi(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var mi=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=fi(e,[`color`,`size`]);return K.createElement(`svg`,di({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`path`,{d:`M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7m0-18H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7m0-18v18`}))});mi.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},mi.displayName=`Columns`;function hi(){return hi=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hi.apply(this,arguments)}function gi(e,t){if(e==null)return{};var n=_i(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _i(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var vi=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=gi(e,[`color`,`size`]);return K.createElement(`svg`,hi({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}))});vi.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},vi.displayName=`Folder`;function yi(){return yi=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yi.apply(this,arguments)}function bi(e,t){if(e==null)return{};var n=xi(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xi(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Si=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=bi(e,[`color`,`size`]);return K.createElement(`svg`,yi({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`circle`,{cx:`12`,cy:`12`,r:`1`}),K.createElement(`circle`,{cx:`19`,cy:`12`,r:`1`}),K.createElement(`circle`,{cx:`5`,cy:`12`,r:`1`}))});Si.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Si.displayName=`MoreHorizontal`;function Ci(){return Ci=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ci.apply(this,arguments)}function wi(e,t){if(e==null)return{};var n=Ti(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ti(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ei=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=wi(e,[`color`,`size`]);return K.createElement(`svg`,Ci({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`polyline`,{points:`1 4 1 10 7 10`}),K.createElement(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`}))});Ei.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Ei.displayName=`RotateCcw`;function Di(){return Di=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Di.apply(this,arguments)}function Oi(e,t){if(e==null)return{};var n=ki(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ki(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ai=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Oi(e,[`color`,`size`]);return K.createElement(`svg`,Di({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`polyline`,{points:`23 4 23 10 17 10`}),K.createElement(`path`,{d:`M20.49 15a9 9 0 1 1-2.12-9.36L23 10`}))});Ai.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Ai.displayName=`RotateCw`;function ji(){return ji=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ji.apply(this,arguments)}function Mi(e,t){if(e==null)return{};var n=Ni(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ni(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Pi=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Mi(e,[`color`,`size`]);return K.createElement(`svg`,ji({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`circle`,{cx:`18`,cy:`5`,r:`3`}),K.createElement(`circle`,{cx:`6`,cy:`12`,r:`3`}),K.createElement(`circle`,{cx:`18`,cy:`19`,r:`3`}),K.createElement(`line`,{x1:`8.59`,y1:`13.51`,x2:`15.42`,y2:`17.49`}),K.createElement(`line`,{x1:`15.41`,y1:`6.51`,x2:`8.59`,y2:`10.49`}))});Pi.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Pi.displayName=`Share2`;function Fi(){return Fi=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fi.apply(this,arguments)}function Ii(e,t){if(e==null)return{};var n=Li(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Li(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ri=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Ii(e,[`color`,`size`]);return K.createElement(`svg`,Fi({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}))});Ri.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Ri.displayName=`Square`;function zi(){return zi=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zi.apply(this,arguments)}function Bi(e,t){if(e==null)return{};var n=Vi(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vi(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Hi=(0,K.forwardRef)(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Bi(e,[`color`,`size`]);return K.createElement(`svg`,zi({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),K.createElement(`polyline`,{points:`4 17 10 11 4 5`}),K.createElement(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`}))});Hi.propTypes={color:q.default.string,size:q.default.oneOfType([q.default.string,q.default.number])},Hi.displayName=`Terminal`;var Ui=(0,K.createContext)({dragDropManager:void 0});function J(e){return`Minified Redux error #`+e+`; visit https://redux.js.org/Errors?code=`+e+` for the full message or use the non-minified dev environment for full errors. `}var Wi=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Gi=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},Ki={INIT:`@@redux/INIT`+Gi(),REPLACE:`@@redux/REPLACE`+Gi(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Gi()}};function qi(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ji(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(J(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(J(1));return n(Ji)(e,t)}if(typeof e!=`function`)throw Error(J(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(J(3));return a}function d(e){if(typeof e!=`function`)throw Error(J(4));if(c)throw Error(J(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(J(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!qi(e))throw Error(J(7));if(e.type===void 0)throw Error(J(8));if(c)throw Error(J(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(J(10));i=e,f({type:Ki.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(J(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[Wi]=function(){return this},e}return f({type:Ki.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[Wi]=m,r}function Y(e,t,...n){if(Yi()&&t===void 0)throw Error(`invariant requires an error message argument`);if(!e){let e;if(t===void 0)e=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{let r=0;e=Error(t.replace(/%s/g,function(){return n[r++]})),e.name=`Invariant Violation`}throw e.framesToPop=1,e}}function Yi(){return typeof process<`u`&&!0}function Xi(e,t,n){return t.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:n||null,e)}function Zi(e,t){return e.filter(e=>e!==t)}function Qi(e){return typeof e==`object`}function $i(e,t){let n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);let i=[];return n.forEach((e,t)=>{e===1&&i.push(t)}),i}function ea(e,t){return e.filter(e=>t.indexOf(e)>-1)}var ta=`dnd-core/INIT_COORDS`,na=`dnd-core/BEGIN_DRAG`,ra=`dnd-core/PUBLISH_DRAG_SOURCE`,ia=`dnd-core/HOVER`,aa=`dnd-core/DROP`,oa=`dnd-core/END_DRAG`;function sa(e,t){return{type:ta,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}var ca={type:ta,payload:{clientOffset:null,sourceClientOffset:null}};function la(e){return function(t=[],n={publishSource:!0}){let{publishSource:r=!0,clientOffset:i,getSourceClientOffset:a}=n,o=e.getMonitor(),s=e.getRegistry();e.dispatch(sa(i)),ua(t,o,s);let c=pa(t,o);if(c==null){e.dispatch(ca);return}let l=null;if(i){if(!a)throw Error(`getSourceClientOffset must be defined`);da(a),l=a(c)}e.dispatch(sa(i,l));let u=s.getSource(c).beginDrag(o,c);if(u!=null)return fa(u),s.pinSource(c),{type:na,payload:{itemType:s.getSourceType(c),item:u,sourceId:c,clientOffset:i||null,sourceClientOffset:l||null,isSourcePublic:!!r}}}}function ua(e,t,n){Y(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){Y(n.getSource(e),`Expected sourceIds to be registered.`)})}function da(e){Y(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function fa(e){Y(Qi(e),`Item must be an object.`)}function pa(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ha(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ma(e,t,n[t])})}return e}function ga(e){return function(t={}){let n=e.getMonitor(),r=e.getRegistry();_a(n),ba(n).forEach((i,a)=>{let o={type:aa,payload:{dropResult:ha({},t,va(i,a,r,n))}};e.dispatch(o)})}}function _a(e){Y(e.isDragging(),`Cannot call drop while not dragging.`),Y(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function va(e,t,n,r){let i=n.getTarget(e),a=i?i.drop(r,e):void 0;return ya(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function ya(e){Y(e===void 0||Qi(e),`Drop result must either be an object or undefined.`)}function ba(e){let t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function xa(e){return function(){let t=e.getMonitor(),n=e.getRegistry();Sa(t);let r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:oa}}}function Sa(e){Y(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Ca(e,t){return t===null?e===null:Array.isArray(e)?e.some(e=>e===t):e===t}function wa(e){return function(t,{clientOffset:n}={}){Ta(t);let r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Da(r,a,i.getItemType()),Ea(r,i,a),Oa(r,i,a),{type:ia,payload:{targetIds:r,clientOffset:n||null}}}}function Ta(e){Y(Array.isArray(e),`Expected targetIds to be an array.`)}function Ea(e,t,n){Y(t.isDragging(),`Cannot call hover while not dragging.`),Y(!t.didDrop(),`Cannot call hover after drop.`);for(let t=0;t<e.length;t++){let r=e[t];Y(e.lastIndexOf(r)===t,`Expected targetIds to be unique in the passed array.`),Y(n.getTarget(r),`Expected targetIds to be registered.`)}}function Da(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];Ca(t.getTargetType(i),n)||e.splice(r,1)}}function Oa(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function ka(e){return function(){if(e.getMonitor().isDragging())return{type:ra}}}function Aa(e){return{beginDrag:la(e),publishDragSource:ka(e),hover:wa(e),drop:ga(e),endDrag:xa(e)}}var ja=class{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){let e=this,{dispatch:t}=this.store;function n(n){return(...r)=>{let i=n.apply(e,r);i!==void 0&&t(i)}}let r=Aa(this);return Object.keys(r).reduce((e,t)=>{let i=r[t];return e[t]=n(i),e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}};function Ma(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Na(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Pa(e){let{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:Na(Ma(t,r),n)}function Fa(e){let{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:Na(t,n)}var Ia=[],La=[];Ia.__IS_NONE__=!0,La.__IS_ALL__=!0;function Ra(e,t){return e===Ia?!1:e===La||t===void 0?!0:ea(t,e).length>0}var za=class{subscribeToStateChange(e,t={}){let{handlerIds:n}=t;Y(typeof e==`function`,`listener must be a function.`),Y(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);let r=this.store.getState().stateId;return this.store.subscribe(()=>{let t=this.store.getState(),i=t.stateId;try{i===r||i===r+1&&!Ra(t.dirtyHandlerIds,n)||e()}finally{r=i}})}subscribeToOffsetChange(e){Y(typeof e==`function`,`listener must be a function.`);let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{let n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return Y(t,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return Y(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Ca(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return Y(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:n}=t;if(!this.isDragging())return!1;let r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Ca(r,i))return!1;let a=this.getTargetIds();if(!a.length)return!1;let o=a.indexOf(e);return n?o===a.length-1:o>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Pa(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Fa(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}},Ba=typeof global<`u`?global:self,Va=Ba.MutationObserver||Ba.WebKitMutationObserver;function Ha(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ua(e){let t=1,n=new Va(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var Wa=typeof Va==`function`?Ua:Ha,Ga=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Wa(this.flush),this.requestErrorThrow=Ha(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Ka=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},qa=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new Ka(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},Ja=new Ga,Ya=new qa(Ja.registerPendingError);function Xa(e){Ja.enqueueTask(Ya.create(e))}var Za=`dnd-core/ADD_SOURCE`,Qa=`dnd-core/ADD_TARGET`,$a=`dnd-core/REMOVE_SOURCE`,eo=`dnd-core/REMOVE_TARGET`;function to(e){return{type:Za,payload:{sourceId:e}}}function no(e){return{type:Qa,payload:{targetId:e}}}function ro(e){return{type:$a,payload:{sourceId:e}}}function io(e){return{type:eo,payload:{targetId:e}}}function ao(e){Y(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),Y(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),Y(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function oo(e){Y(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),Y(typeof e.hover==`function`,`Expected hover to be a function.`),Y(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function so(e,t){if(t&&Array.isArray(e)){e.forEach(e=>so(e,!1));return}Y(typeof e==`string`||typeof e==`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var X;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(X||={});var co=0;function lo(){return co++}function uo(e){let t=lo().toString();switch(e){case X.SOURCE:return`S${t}`;case X.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function fo(e){switch(e[0]){case`S`:return X.SOURCE;case`T`:return X.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function po(e,t){let n=e.entries(),r=!1;do{let{done:e,value:[,i]}=n.next();if(i===t)return!0;r=!!e}while(!r);return!1}var mo=class{addSource(e,t){so(e),ao(t);let n=this.addHandler(X.SOURCE,e,t);return this.store.dispatch(to(n)),n}addTarget(e,t){so(e,!0),oo(t);let n=this.addHandler(X.TARGET,e,t);return this.store.dispatch(no(n)),n}containsHandler(e){return po(this.dragSources,e)||po(this.dropTargets,e)}getSource(e,t=!1){return Y(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return Y(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}getSourceType(e){return Y(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}getTargetType(e){return Y(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}isSourceId(e){return fo(e)===X.SOURCE}isTargetId(e){return fo(e)===X.TARGET}removeSource(e){Y(this.getSource(e),`Expected an existing source.`),this.store.dispatch(ro(e)),Xa(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){Y(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(io(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);Y(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){Y(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){let r=uo(e);return this.types.set(r,t),e===X.SOURCE?this.dragSources.set(r,n):e===X.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}},ho=(e,t)=>e===t;function go(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function _o(e,t,n=ho){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function vo(e=Ia,t){switch(t.type){case ia:break;case Za:case Qa:case eo:case $a:return Ia;case na:case ra:case oa:case aa:default:return La}let{targetIds:n=[],prevTargetIds:r=[]}=t.payload,i=$i(n,r);if(!(i.length>0||!_o(n,r)))return Ia;let a=r[r.length-1],o=n[n.length-1];return a!==o&&(a&&i.push(a),o&&i.push(o)),i}function yo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){yo(e,t,n[t])})}return e}var xo={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function So(e=xo,t){let{payload:n}=t;switch(t.type){case ta:case na:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case ia:return go(e.clientOffset,n.clientOffset)?e:bo({},e,{clientOffset:n.clientOffset});case oa:case aa:return xo;default:return e}}function Co(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Co(e,t,n[t])})}return e}var To={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Eo(e=To,t){let{payload:n}=t;switch(t.type){case na:return wo({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case ra:return wo({},e,{isSourcePublic:!0});case ia:return wo({},e,{targetIds:n.targetIds});case eo:return e.targetIds.indexOf(n.targetId)===-1?e:wo({},e,{targetIds:Zi(e.targetIds,n.targetId)});case aa:return wo({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case oa:return wo({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Do(e=0,t){switch(t.type){case Za:case Qa:return e+1;case $a:case eo:return e-1;default:return e}}function Oo(e=0){return e+1}function ko(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ao(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ko(e,t,n[t])})}return e}function jo(e={},t){return{dirtyHandlerIds:vo(e.dirtyHandlerIds,{type:t.type,payload:Ao({},t.payload,{prevTargetIds:Xi(e,`dragOperation.targetIds`,[])})}),dragOffset:So(e.dragOffset,t),refCount:Do(e.refCount,t),dragOperation:Eo(e.dragOperation,t),stateId:Oo(e.stateId)}}function Mo(e,t=void 0,n={},r=!1){let i=No(r),a=new ja(i,new za(i,new mo(i))),o=e(a,t,n);return a.receiveBackend(o),a}function No(e){let t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return Ji(jo,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}var Z=l();function Po(e,t){if(e==null)return{};var n=Fo(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Fo(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Io=0,Lo=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),Ro=(0,K.memo)(function(e){var{children:t}=e;let[n,r]=zo(Po(e,[`children`]));return(0,K.useEffect)(()=>{if(r){let e=Vo();return++Io,()=>{--Io===0&&(e[Lo]=null)}}},[]),(0,Z.jsx)(Ui.Provider,{value:n,children:t})});function zo(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[Bo(e.backend,e.context,e.options,e.debugMode),!e.context]}function Bo(e,t=Vo(),n,r){let i=t;return i[Lo]||(i[Lo]={dragDropManager:Mo(e,t,n,r)}),i[Lo]}function Vo(){return typeof global<`u`?global:window}var Ho=typeof window<`u`?K.useLayoutEffect:K.useEffect,Uo=e(ar(),1);function Wo(e,t,n){let[r,i]=(0,K.useState)(()=>t(e)),a=(0,K.useCallback)(()=>{let a=t(e);(0,Uo.default)(r,a)||(i(a),n&&n())},[r,e,n]);return Ho(a),[r,a]}function Go(e,t,n){let[r,i]=Wo(e,t,n);return Ho(function(){let t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),r}function Ko(e,t,n){return Go(t,e||(()=>({})),()=>n.reconnect())}function qo(e,t){let n=[...t||[]];return t==null&&typeof e!=`function`&&n.push(e),(0,K.useMemo)(()=>typeof e==`function`?e():e,n)}function Jo(e){return(0,K.useMemo)(()=>e.hooks.dragSource(),[e])}function Yo(e){return(0,K.useMemo)(()=>e.hooks.dragPreview(),[e])}var Xo=!1,Zo=!1,Qo=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){Y(!Xo,`You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return Xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Xo=!1}}isDragging(){if(!this.sourceId)return!1;Y(!Zo,`You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return Zo=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Zo=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},$o=!1,es=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;Y(!$o,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return $o=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{$o=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function ts(e,t,n){let r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function ns(e,t,n){let r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function rs(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let o=0;o<a.length;o++){let c=a[o];if(!s(c))return!1;let l=e[c],u=t[c];if(i=n?n.call(r,l,u,c):void 0,i===!1||i===void 0&&l!==u)return!1}return!0}function is(e){return typeof e==`object`&&!!e&&Object.prototype.hasOwnProperty.call(e,`current`)}function as(e){if(typeof e.type==`string`)return;let t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function os(e){return(t=null,n=null)=>{if(!(0,K.isValidElement)(t)){let r=t;return e(r,n),r}let r=t;return as(r),ls(r,n?t=>e(t,n):e)}}function ss(e){let t={};return Object.keys(e).forEach(n=>{let r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{let e=os(r);t[n]=()=>e}}),t}function cs(e,t){typeof e==`function`?e(t):e.current=t}function ls(e,t){let n=e.ref;return Y(typeof n!=`string`,`Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,K.cloneElement)(e,{ref:e=>{cs(n,e),cs(t,e)}}):(0,K.cloneElement)(e,{ref:t})}var us=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){let t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!rs(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!rs(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&=(this.dragSourceUnsubscribe(),void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=ss({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,is(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,is(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}},ds=class{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!rs(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=ss({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,is(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function fs(){let{dragDropManager:e}=(0,K.useContext)(Ui);return Y(e!=null,`Expected drag drop context`),e}function ps(e,t){let n=fs(),r=(0,K.useMemo)(()=>new us(n.getBackend()),[n]);return Ho(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),Ho(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function ms(){let e=fs();return(0,K.useMemo)(()=>new Qo(e),[e])}var hs=class{beginDrag(){let e=this.spec,t=this.monitor,n=null;return n=typeof e.item==`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}canDrag(){let e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag==`function`?e.canDrag(t):!0}isDragging(e,t){let n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function gs(e,t,n){let r=(0,K.useMemo)(()=>new hs(e,t,n),[t,n]);return(0,K.useEffect)(()=>{r.spec=e},[e]),r}function _s(e){return(0,K.useMemo)(()=>{let t=e.type;return Y(t!=null,`spec.type must be defined`),t},[e])}function vs(e,t,n){let r=fs(),i=gs(e,t,n),a=_s(e);Ho(function(){if(a!=null){let[e,o]=ns(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[r,t,n,i,a])}function ys(e,t){let n=qo(e,t);Y(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);let r=ms(),i=ps(n.options,n.previewOptions);return vs(n,r,i),[Ko(n.collect,r,i),Jo(i),Yo(i)]}function bs(e){let t=fs().getMonitor(),[n,r]=Wo(t,e);return(0,K.useEffect)(()=>t.subscribeToOffsetChange(r)),(0,K.useEffect)(()=>t.subscribeToStateChange(r)),n}function xs(e){return(0,K.useMemo)(()=>e.hooks.dropTarget(),[e])}function Ss(e){let t=fs(),n=(0,K.useMemo)(()=>new ds(t.getBackend()),[t]);return Ho(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Cs(){let e=fs();return(0,K.useMemo)(()=>new es(e),[e])}function ws(e){let{accept:t}=e;return(0,K.useMemo)(()=>(Y(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]),[t])}var Ts=class{canDrop(){let e=this.spec,t=this.monitor;return e.canDrop?e.canDrop(t.getItem(),t):!0}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function Es(e,t){let n=(0,K.useMemo)(()=>new Ts(e,t),[t]);return(0,K.useEffect)(()=>{n.spec=e},[e]),n}function Ds(e,t,n){let r=fs(),i=Es(e,t),a=ws(e);Ho(function(){let[e,o]=ts(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[r,t,i,n,a.map(e=>e.toString()).join(`|`)])}function Os(e,t){let n=qo(e,t),r=Cs(),i=Ss(n.options);return Ds(n,r,i),[Ko(n.collect,r,i),xs(i)]}function ks(e){let t=null;return()=>(t??=e(),t)}function As(e,t){return e.filter(e=>e!==t)}function js(e,t){let n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);let i=[];return n.forEach(e=>i.push(e)),i}var Ms=class{enter(e){let t=this.entered.length,n=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=js(this.entered.filter(n),[e]),t===0&&this.entered.length>0}leave(e){let t=this.entered.length;return this.entered=As(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}},Ns=class{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(n=>{let r=this.config.exposeProperties[n];r!=null&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}},Ps=t({FILE:()=>Fs,HTML:()=>Rs,TEXT:()=>Ls,URL:()=>Is}),Fs=`__NATIVE_FILE__`,Is=`__NATIVE_URL__`,Ls=`__NATIVE_TEXT__`,Rs=`__NATIVE_HTML__`;function zs(e,t,n){return t.reduce((t,n)=>t||e.getData(n),``)??n}var Bs={[Fs]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:[`Files`]},[Rs]:{exposeProperties:{html:(e,t)=>zs(e,t,``),dataTransfer:e=>e},matchesTypes:[`Html`,`text/html`]},[Is]:{exposeProperties:{urls:(e,t)=>zs(e,t,``).split(`
3
- `),dataTransfer:e=>e},matchesTypes:[`Url`,`text/uri-list`]},[Ls]:{exposeProperties:{text:(e,t)=>zs(e,t,``),dataTransfer:e=>e},matchesTypes:[`Text`,`text/plain`]}};function Vs(e,t){let n=Bs[e];if(!n)throw Error(`native type ${e} has no configuration`);let r=new Ns(n);return r.loadDataTransfer(t),r}function Hs(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys(Bs).filter(e=>{let n=Bs[e];return n?.matchesTypes?n.matchesTypes.some(e=>t.indexOf(e)>-1):!1})[0]||null}var Us=ks(()=>/firefox/i.test(navigator.userAgent)),Ws=ks(()=>!!window.safari),Gs=class{interpolate(e){let{xs:t,ys:n,c1s:r,c2s:i,c3s:a}=this,o=t.length-1;if(e===t[o])return n[o];let s=0,c=a.length-1,l;for(;s<=c;){l=Math.floor(.5*(s+c));let r=t[l];if(r<e)s=l+1;else if(r>e)c=l-1;else return n[l]}o=Math.max(0,c);let u=e-t[o],d=u*u;return n[o]+r[o]*u+i[o]*d+a[o]*u*d}constructor(e,t){let{length:n}=e,r=[];for(let e=0;e<n;e++)r.push(e);r.sort((t,n)=>e[t]<e[n]?-1:1);let i=[],a=[],o=[],s,c;for(let r=0;r<n-1;r++)s=e[r+1]-e[r],c=t[r+1]-t[r],a.push(s),i.push(c),o.push(c/s);let l=[o[0]];for(let e=0;e<a.length-1;e++){let t=o[e],n=o[e+1];if(t*n<=0)l.push(0);else{s=a[e];let r=a[e+1],i=s+r;l.push(3*i/((i+r)/t+(i+s)/n))}}l.push(o[o.length-1]);let u=[],d=[],f;for(let e=0;e<l.length-1;e++){f=o[e];let t=l[e],n=1/a[e],r=t+l[e+1]-f-f;u.push((f-t-r)*n),d.push(r*n*n)}this.xs=e,this.ys=t,this.c1s=l,this.c2s=u,this.c3s=d}},Ks=1;function qs(e){let t=e.nodeType===Ks?e:e.parentElement;if(!t)return null;let{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function Js(e){return{x:e.clientX,y:e.clientY}}function Ys(e){return e.nodeName===`IMG`&&(Us()||!document.documentElement?.contains(e))}function Xs(e,t,n,r){let i=e?t.width:n,a=e?t.height:r;return Ws()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function Zs(e,t,n,r,i){let a=Ys(t),o=qs(a?e:t),s={x:n.x-o.x,y:n.y-o.y},{offsetWidth:c,offsetHeight:l}=e,{anchorX:u,anchorY:d}=r,{dragPreviewWidth:f,dragPreviewHeight:p}=Xs(a,t,c,l),m=()=>{let e=new Gs([0,.5,1],[s.y,s.y/l*p,s.y+p-l]).interpolate(d);return Ws()&&a&&(e+=(window.devicePixelRatio-1)*p),e},h=()=>new Gs([0,.5,1],[s.x,s.x/c*f,s.x+f-c]).interpolate(u),{offsetX:g,offsetY:_}=i,v=g===0||g,y=_===0||_;return{x:v?g:h(),y:y?_:m()}}var Qs=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<`u`)return window}get document(){if(this.globalContext?.document)return this.globalContext.document;if(this.window)return this.window.document}get rootElement(){return this.optionsArgs?.rootElement||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}};function $s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ec(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){$s(e,t,n[t])})}return e}var tc=class{profile(){return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:this.dragStartSourceIds?.length||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:this.dragOverTargetIds?.length||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){let e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw Error(`Cannot have two HTML5 backends at the same time.`);e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){let e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;(t=this.window)==null||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,t,n){return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,n){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);let r=t=>this.handleDragStart(t,e),i=e=>this.handleSelectStart(e);return t.setAttribute(`draggable`,`true`),t.addEventListener(`dragstart`,r),t.addEventListener(`selectstart`,i),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener(`dragstart`,r),t.removeEventListener(`selectstart`,i),t.setAttribute(`draggable`,`false`)}}connectDropTarget(e,t){let n=t=>this.handleDragEnter(t,e),r=t=>this.handleDragOver(t,e),i=t=>this.handleDrop(t,e);return t.addEventListener(`dragenter`,n),t.addEventListener(`dragover`,r),t.addEventListener(`drop`,i),()=>{t.removeEventListener(`dragenter`,n),t.removeEventListener(`dragover`,r),t.removeEventListener(`drop`,i)}}addEventListeners(e){e.addEventListener&&(e.addEventListener(`dragstart`,this.handleTopDragStart),e.addEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.addEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.addEventListener(`dragenter`,this.handleTopDragEnter),e.addEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.addEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.addEventListener(`dragover`,this.handleTopDragOver),e.addEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.addEventListener(`drop`,this.handleTopDrop),e.addEventListener(`drop`,this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener(`dragstart`,this.handleTopDragStart),e.removeEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.removeEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.removeEventListener(`dragenter`,this.handleTopDragEnter),e.removeEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.removeEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.removeEventListener(`dragover`,this.handleTopDragOver),e.removeEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.removeEventListener(`drop`,this.handleTopDrop),e.removeEventListener(`drop`,this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){let e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return ec({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return ec({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(Ps).some(t=>Ps[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=Vs(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(()=>this.rootElement?.addEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0),1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)==null||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||=[],this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{let t=this.sourceNodes.get(e);return t&&qs(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>!!(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{let e=this.currentDragSourceNode;e==null||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{this.hoverRafId===null&&typeof requestAnimationFrame<`u`&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<`u`&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;let{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;let n=Js(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});let{dataTransfer:r}=e,i=Hs(r);if(this.monitor.isDragging()){if(r&&typeof r.setDragImage==`function`){let e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),i=this.sourcePreviewNodes.get(e)||t;if(i){let{anchorX:e,anchorY:a,offsetX:o,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),c=Zs(t,i,n,{anchorX:e,anchorY:a},{offsetX:o,offsetY:s});r.setDragImage(i,c.x,c.y)}}try{r?.setData(`application/json`,{})}catch{}this.setCurrentDragSourceNode(e.target);let{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(i)this.beginDragNativeItem(i);else if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute(`draggable`)))return;else e.preventDefault()},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;let{dataTransfer:n}=e,r=Hs(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=e=>{let{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:Js(e)}),t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}},this.handleTopDragOver=e=>{let{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}this.altKeyPressed=e.altKey,this.lastClientOffset=Js(e),this.scheduleHover(t),(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var t;e.preventDefault(),(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}else Hs(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:Js(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{let t=e.target;typeof t.dragDrop==`function`&&(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Qs(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Ms(this.isNodeInDocument)}},nc;function rc(){return nc||(nc=new Image,nc.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),nc}var ic=function(e,t,n){return new tc(e,t,n)},ac=()=>{let{evaluationStatus:e,hasPendingChanges:t}=G(R(e=>({evaluationStatus:e.state.evaluation?.status,hasPendingChanges:e.hasPendingChanges})));(0,K.useEffect)(()=>{let n=e===`running`||e===`waiting`?`An evaluation is running, are you sure you want to leave?`:void 0,r=e=>{if(n||t())return e.preventDefault(),e.returnValue=n,n};return window.addEventListener(`beforeunload`,r),()=>{window.removeEventListener(`beforeunload`,r)}},[e,t])},oc=()=>{let e=dt(),t=typeof e.query.workflow==`string`?e.query.workflow:void 0,{project:n}=U();return{workflow:B.workflow.getById.useQuery({workflowId:t??``,projectId:n?.id??``},{enabled:!!n&&!!t,staleTime:1/0})}},sc;function cc(){let{project:e}=U(),{workflow:t}=oc(),n=B.workflow.autosave.useMutation(),[a,o]=(0,K.useState)(!1),{setWorkflow:c,setAutosavedWorkflow:l,hasPendingChanges:u,getWorkflow:d,getAutosavedWorkflow:f,setCurrentVersionId:m}=G(({setWorkflow:e,setAutosavedWorkflow:t,hasPendingChanges:n,getWorkflow:r,getAutosavedWorkflow:i,setCurrentVersionId:a})=>({setWorkflow:e,setAutosavedWorkflow:t,hasPendingChanges:n,getWorkflow:r,getAutosavedWorkflow:i,setCurrentVersionId:a})),h=G(R(e=>e.getWorkflow())),g=B.useContext(),_=An(()=>{if(!e||!t.data)return;let r=d();if(u()){let i=Ir(f(),r,!1);n.mutate({projectId:e.id,workflowId:t.data.id,dsl:zr(r),setAsLatestVersion:i},{onSuccess:n=>{n.version!==r.version&&c({version:n.version}),m(n.id),o(!0),clearTimeout(sc),sc=setTimeout(()=>{o(!1)},5e3),(async()=>{await g.workflow.getVersions.refetch({workflowId:t.data.id,projectId:e.id,returnDSL:`previousVersion`}),l(r)})()}})}else l(r)},1e3,{leading:!1,trailing:!0,maxWait:3e4});return(0,K.useEffect)(()=>{t.data&&(o(!1),_())},[h]),(0,Z.jsx)(i,{paddingLeft:2,children:n.isLoading?(0,Z.jsxs)(s,{children:[(0,Z.jsx)(r,{size:`xs`}),(0,Z.jsx)(p,{fontSize:`13px`,children:`Saving...`})]}):n.isError?(0,Z.jsxs)(s,{color:`status.error`,children:[(0,Z.jsx)(fn,{size:16}),(0,Z.jsx)(p,{fontSize:`13px`,children:`Failed to autosave`})]}):a?(0,Z.jsxs)(s,{children:[(0,Z.jsx)(i,{color:`status.success`,children:(0,Z.jsx)(Ut,{width:`16px`,height:`16px`})}),(0,Z.jsx)(p,{fontSize:`13px`,children:`Saved`})]}):null})}function lc(e){let t=e.config;return`inputs`in t&&Array.isArray(t.inputs)&&t.inputs.length>0?t.inputs.map(e=>({identifier:e.identifier,type:e.type})):[{identifier:`input`,type:`str`}]}function uc(e){let t=e.config;return`outputs`in t&&Array.isArray(t.outputs)&&t.outputs.length>0?t.outputs.map(e=>({identifier:e.identifier,type:e.type})):[{identifier:`output`,type:`str`}]}function dc(e){let t=[{identifier:`agent_type`,type:`str`,value:e.type}],n=e.config;switch(e.type){case`http`:{n.url&&t.push({identifier:`url`,type:`str`,value:n.url}),n.method&&t.push({identifier:`method`,type:`str`,value:n.method}),n.bodyTemplate&&t.push({identifier:`body_template`,type:`str`,value:n.bodyTemplate}),n.outputPath&&t.push({identifier:`output_path`,type:`str`,value:n.outputPath}),n.timeoutMs&&t.push({identifier:`timeout_ms`,type:`str`,value:n.timeoutMs});let e=n.auth;if(e?.type&&e.type!==`none`&&(t.push({identifier:`auth_type`,type:`str`,value:e.type}),e.token&&t.push({identifier:`auth_token`,type:`str`,value:e.token}),e.header&&t.push({identifier:`auth_header`,type:`str`,value:e.header}),e.value&&t.push({identifier:`auth_value`,type:`str`,value:e.value}),e.username&&t.push({identifier:`auth_username`,type:`str`,value:e.username}),e.password&&t.push({identifier:`auth_password`,type:`str`,value:e.password})),n.headers&&typeof n.headers==`object`){let e=Array.isArray(n.headers)?Object.fromEntries(n.headers.filter(e=>e.key).map(e=>[e.key,e.value])):n.headers;t.push({identifier:`headers`,type:`str`,value:e})}break}case`code`:{let e=n.parameters?.find(e=>e.identifier===`code`);e&&t.push({identifier:`code`,type:`code`,value:e.value});break}case`workflow`:n.workflow_id&&t.push({identifier:`workflow_id`,type:`str`,value:n.workflow_id}),n.version_id&&t.push({identifier:`version_id`,type:`str`,value:n.version_id});break}return t}function fc(e){return{name:e.name,agent:`agents/${e.id}`,agentType:e.type,inputs:lc(e),outputs:uc(e),parameters:dc(e)}}function Q(e,t){return e.parameters?.find(e=>e.identifier===t)?.value}function pc(e){let t=Q(e,`code`);return typeof t==`string`?t:void 0}function mc(e){if(Q(e,`agent_type`)!==`http`)return;let t=Q(e,`headers`),n=t&&typeof t==`object`?Object.entries(t).map(([e,t])=>({key:e,value:t})):void 0,r=Q(e,`auth_type`),i=typeof r==`string`?{type:r,token:Q(e,`auth_token`),header:Q(e,`auth_header`),value:Q(e,`auth_value`),username:Q(e,`auth_username`),password:Q(e,`auth_password`)}:void 0;return{url:Q(e,`url`),method:Q(e,`method`),bodyTemplate:Q(e,`body_template`),outputPath:Q(e,`output_path`),headers:n,auth:i}}function hc(e,t){let n=fc(t);return e.name===n.name&&JSON.stringify(e.parameters??[])===JSON.stringify(n.parameters??[])&&JSON.stringify(e.inputs??[])===JSON.stringify(n.inputs??[])&&JSON.stringify(e.outputs??[])===JSON.stringify(n.outputs??[])}function gc({nodeId:e,nodes:t,edges:n}){let r=new Set,i=[e];for(;i.length>0;){let e=i.shift();!e||r.has(e)||(r.add(e),i.push(...n.filter(t=>t.source===e).map(e=>e.target)))}return t.filter(e=>!r.has(e.id)&&e.id!==`end`).map(e=>{let t=e.type===`entry`;return{id:e.id,name:t?`Entry`:e.data.name??e.id,type:e.type,fields:e.data.outputs?.map(e=>({name:e.identifier,type:e.type}))??[]}}).filter(e=>e.fields.length>0)}function _c({nodeId:e,edges:t,inputs:n}){let r={};return t.filter(t=>t.target===e).forEach(e=>{let t=e.targetHandle?.split(`.`)[1],n=e.sourceHandle?.split(`.`)[1];t&&n&&e.source&&(r[t]={type:`source`,sourceId:e.source,path:[n]})}),n.forEach(e=>{e.value!=null&&e.value!==``&&!r[e.identifier]&&(r[e.identifier]={type:`value`,value:String(e.value)})}),r}function vc({nodeId:e,identifier:t,mapping:n,currentEdges:r,currentInputs:i}){let a=r.filter(n=>!(n.target===e&&n.targetHandle===`inputs.${t}`)),o=i.map(e=>{if(e.identifier!==t)return e;if(n?.type===`value`)return{...e,value:n.value};let{value:r,...i}=e;return i});if(n?.type===`source`){let r={id:`edge-${t}-${Date.now()}`,source:n.sourceId,target:e,sourceHandle:`outputs.${n.path.join(`.`)}`,targetHandle:`inputs.${t}`,type:`default`};return{edges:[...a,r],inputs:o}}return{edges:a,inputs:o}}var yc={cm:!0,mm:!0,in:!0,px:!0,pt:!0,pc:!0,em:!0,ex:!0,ch:!0,rem:!0,vw:!0,vh:!0,vmin:!0,vmax:!0,"%":!0};function bc(e){if(typeof e==`number`)return{value:e,unit:`px`};var t,n=(e.match(/^[0-9.]*/)||``).toString();t=n.includes(`.`)?parseFloat(n):parseInt(n,10);var r=(e.match(/[^0-9]*$/)||``).toString();return yc[r]?{value:t,unit:r}:(console.warn(`React Spinners: ${e} is not a valid css value. Defaulting to ${t}px.`),{value:t,unit:`px`})}function xc(e){var t=bc(e);return`${t.value}${t.unit}`}var Sc=function(e,t,n){var r=`react-spinners-${e}-${n}`;if(typeof window>`u`||!window.document)return r;var i=document.createElement(`style`);document.head.appendChild(i);var a=i.sheet,o=`
4
- @keyframes ${r} {
5
- ${t}
6
- }
7
- `;return a&&a.insertRule(o,0),r},Cc=function(){return Cc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Cc.apply(this,arguments)},wc=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Tc=Sc(`PulseLoader`,`0% {transform: scale(1); opacity: 1} 45% {transform: scale(0.1); opacity: 0.7} 80% {transform: scale(1); opacity: 1}`,`pulse`);function Ec(e){var t=e.loading,n=t===void 0?!0:t,r=e.color,i=r===void 0?`#000000`:r,a=e.speedMultiplier,o=a===void 0?1:a,s=e.cssOverride,c=s===void 0?{}:s,l=e.size,u=l===void 0?15:l,d=e.margin,f=d===void 0?2:d,p=wc(e,[`loading`,`color`,`speedMultiplier`,`cssOverride`,`size`,`margin`]),m=Cc({display:`inherit`},c),h=function(e){return{backgroundColor:i,width:xc(u),height:xc(u),margin:xc(f),borderRadius:`100%`,display:`inline-block`,animation:`${Tc} ${.75/o}s ${e*.12/o}s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08)`,animationFillMode:`both`}};return n?K.createElement(`span`,Cc({style:m},p),K.createElement(`span`,{style:h(1)}),K.createElement(`span`,{style:h(2)}),K.createElement(`span`,{style:h(3)})):null}var Dc=()=>{let{selectedNode:e,propertiesExpanded:t,setSelectedNode:n,setPropertiesExpanded:r}=G(e=>({selectedNode:e.nodes.find(e=>e.selected),propertiesExpanded:e.propertiesExpanded,setSelectedNode:e.setSelectedNode,setPropertiesExpanded:e.setPropertiesExpanded}));return(0,K.useCallback)(({componentId:i,execution_state:o})=>{if(i===e?.id&&t)return;let s=`component-error-${i}`,{title:c,description:l,traceId:u}=Ar({state:o,fallbackTitle:`That step didn't run`});M.create({title:c,id:s,description:(0,Z.jsxs)(m,{align:`start`,children:[l&&(0,Z.jsx)(p,{children:l}),(0,Z.jsx)(a,{unstyled:!0,color:`white`,cursor:`pointer`,textDecoration:`underline`,size:`sm`,onClick:()=>{n(i),r(!0),M.dismiss(s)},children:`Go to component`})]}),type:`error`,duration:5e3,meta:{closable:!0,traceId:u}})},[e?.id,t,n,r])},Oc=qe(`langwatch:studio:componentExecution`),kc=()=>{let{postEvent:e,socketStatus:t}=jr(),[n,r]=(0,K.useState)(null),{node:i,setSelectedNode:a,setPropertiesExpanded:o,setTriggerValidation:s,getWorkflow:c,setComponentExecutionState:l}=G(e=>({node:e.nodes.find(e=>e.id===n?.component_id),setSelectedNode:e.setSelectedNode,setPropertiesExpanded:e.setPropertiesExpanded,setTriggerValidation:e.setTriggerValidation,getWorkflow:e.getWorkflow,setComponentExecutionState:e.setComponentExecutionState})),u=Dc();(0,K.useEffect)(()=>{if(n&&i&&i.data.execution_state?.trace_id===n.trace_id&&i.data.execution_state?.status===n.timeout_on_status){Oc.warn({componentId:i.id,trace_id:n.trace_id,timeout_on_status:n.timeout_on_status},`component execution timeout triggered`);let e={status:`error`,error:`Timeout`,timestamps:{finished_at:Date.now()}};l(i.id,e),u({componentId:i.id,execution_state:e})}},[n,i,l,u]);let d=(0,K.useCallback)(()=>t===`connected`?!0:(M.create({title:`Studio is not connected yet`,type:`error`,meta:{closable:!0}}),!1),[t]);return{startComponentExecution:(0,K.useCallback)(({node:t,inputs:n})=>{if(!d())return;let{missingFields:i,inputs:u}=Ac({node:t,inputs:n});if(i.length>0){Oc.warn({nodeId:t.id,missingFields:i.map(e=>e.identifier)},`component execution blocked: required fields missing`),a(t.id),o(!0),s(!0);return}let f=Mn();Oc.info({nodeId:t.id,trace_id:f},`component execution starting`),l(t.id,{status:`waiting`,trace_id:f,inputs:u,cost:void 0,timestamps:void 0});let p=c();e({type:`execute_component`,payload:{trace_id:f,workflow:{...p,nodes:Nr(p.nodes)},node_id:t.id,inputs:u,origin:`workflow`}}),setTimeout(()=>{r({component_id:t.id,trace_id:f,timeout_on_status:`waiting`})},2e4)},[d,l,c,e,a,o,s]),stopComponentExecution:(0,K.useCallback)(({trace_id:t,node_id:n,current_state:i})=>{if(d()){if(Oc.info({nodeId:n,trace_id:t},`component execution stopping`),i?.status===`waiting`){l(n,{status:`idle`,trace_id:void 0});return}e({type:`stop_execution`,payload:{trace_id:t,node_id:n}}),setTimeout(()=>{r({component_id:n,trace_id:t,timeout_on_status:`running`})},2e3)}},[d,e,l])}};function Ac({node:e,inputs:t}){let n=new Set(e.data.inputs?.map(e=>e.identifier)??[]),r=e.data.inputs?.filter(e=>!e.optional)??[],i=e.data.inputs?.reduce((e,t)=>(t.value!==void 0&&(e[t.identifier]=t.value),e),{}),a=Object.fromEntries(Object.entries({...i,...e?.data.execution_state?.inputs??{},...t??{}}).filter(([e])=>n.has(e)));return{missingFields:r.filter(e=>!(e.identifier in a)||a[e.identifier]===void 0||a[e.identifier]===``),inputs:a}}var jc=Je(e=>({untilNodeId:void 0,open:t=>e({untilNodeId:t}),close:()=>e({untilNodeId:void 0})}));function Mc(e){return!!e.localConfig||!!e.localPromptConfig}function Nc(e){let t=e.data;return t.localConfig?.name??t.name??t.cls??e.id}function Pc({node:e,namespace:t,inputs:n,selected:r,showGateDropTarget:i}){return(0,Z.jsxs)(Z.Fragment,{children:[n.map(e=>(0,Z.jsxs)(s,{gap:1,paddingX:2,paddingY:1,background:`bg.muted`,borderRadius:`8px`,width:`full`,position:`relative`,children:[(0,Z.jsx)(_n,{type:`target`,id:`${t}.${e.identifier}`,position:Sn.Left,style:{marginLeft:`-10px`,width:`8px`,height:`8px`,background:`var(--chakra-colors-bg)`,borderRadius:`100%`,border:`1px solid #FF8309`,boxShadow:`0px 0px ${r?`4px`:`2px`} 0px #FF8309`}}),(0,Z.jsx)(p,{children:e.identifier}),(0,Z.jsx)(p,{color:`fg.subtle`,children:`:`}),(0,Z.jsx)(Ic,{type:e.type}),(0,Z.jsx)(z,{}),e.optional&&(0,Z.jsx)(p,{color:`fg.subtle`,children:`(optional)`})]},e.identifier)),i&&(0,Z.jsxs)(s,{gap:1,paddingX:2,paddingY:1,background:`green.50`,borderRadius:`8px`,width:`full`,position:`relative`,"data-testid":`branch-gate-drop-target`,children:[(0,Z.jsx)(_n,{type:`target`,id:`${t}.gate`,position:Sn.Left,style:{marginLeft:`-10px`,width:`9px`,height:`9px`,background:`var(--chakra-colors-bg)`,borderRadius:`100%`,border:`1px solid #22C55E`,boxShadow:`0px 0px 4px 0px #22C55E`}}),(0,Z.jsx)(p,{color:`green.fg`,children:`gate`}),(0,Z.jsx)(p,{color:`green.fg`,children:`:`}),(0,Z.jsx)(Ic,{type:`bool`})]},`__branch_gate__`)]})}function Fc({namespace:e,outputs:t,selected:n,hideOutputHandles:r}){return(0,Z.jsx)(Z.Fragment,{children:t.map(t=>(0,Z.jsxs)(s,{gap:1,paddingX:2,paddingY:1,background:`bg.muted`,borderRadius:`8px`,width:`full`,position:`relative`,children:[!r&&(0,Z.jsx)(_n,{type:`source`,id:`${e}.${t.identifier}`,position:Sn.Right,style:{marginRight:`-10px`,width:`8px`,height:`8px`,background:`var(--chakra-colors-bg)`,borderRadius:`100%`,border:`1px solid #2B6CB0`,boxShadow:`0px 0px ${n?`4px`:`2px`} 0px #2B6CB0`}}),(0,Z.jsx)(p,{children:t.identifier}),(0,Z.jsx)(p,{color:`fg.subtle`,children:`:`}),(0,Z.jsx)(Ic,{type:t.type})]},t.identifier))})}function Ic({type:e}){return(0,Z.jsx)(p,{color:`cyan.fg`,fontStyle:`italic`,children:e})}function Lc({fontSize:e,children:t}){return(0,Z.jsx)(p,{fontSize:e??`9px`,textTransform:`uppercase`,color:`fg.muted`,fontWeight:`bold`,paddingTop:1,children:t})}var Rc=`#2F8FFB`,zc=e=>e.type!==`entry`&&e.type!==`prompting_technique`,$=(0,K.forwardRef)(function(e,t){let{node:n,hoveredNodeId:r,setHoveredNodeId:o,setSelectedNode:c,setPropertiesExpanded:l,deleteNode:d,duplicateNode:f,branchConnectionInProgress:h,branchConnectionSourceId:g}=G(R(({nodes:t,hoveredNodeId:n,setHoveredNodeId:r,setSelectedNode:i,setPropertiesExpanded:a,setNodes:o,deleteNode:s,duplicateNode:c,branchConnectionInProgress:l,branchConnectionSourceId:u})=>({node:t.find(t=>t.id===e.id),hoveredNodeId:n,setHoveredNodeId:r,setSelectedNode:i,setPropertiesExpanded:a,setNodes:o,deleteNode:s,duplicateNode:c,branchConnectionInProgress:l,branchConnectionSourceId:u}))),_=r===e.id,v=h&&Lr({node:{id:e.id,type:e.type,data:e.data},sourceId:g}),y=W();(0,K.useEffect)(()=>{y(e.id)},[e.id,v,y]);let{isDragging:b,item:x}=bs(e=>({item:e.getItem(),itemType:e.getItemType(),isDragging:e.isDragging()})),S=(0,K.useMemo)(()=>b&&x?.node?.type===`prompting_technique`&&e.type!==`signature`,[b,x,e.type]),C=e.data.parameters?.filter(e=>e.type===`llm`)??[],w=Et(`0px 0px 4px 0px rgba(0, 0, 0, ${_?`0.2`:`0.1`})`,`0px 0px 4px 0px rgba(0, 0, 0, ${_?`0.5`:`0.3`})`);return(0,Z.jsxs)(m,{className:`js-component-node`,position:`relative`,opacity:S?.4:1,ref:t,borderRadius:`12px`,backgroundColor:e.backgroundColor??`bg.panel`,padding:`10px`,gap:2,align:`start`,color:`fg.muted`,fontSize:`11px`,minWidth:140+6.5*Math.min(Nc(e).length,24)+`px`,boxShadow:w,border:`1px solid`,borderColor:`border`,outline:e.selected||_?`1.5px solid`:`none`,outlineColor:e.selected?Rc:_?`gray.emphasized`:`none`,onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(void 0),onDoubleClick:()=>{c(e.id),n&&zc(n)&&l(!0)},children:[e.selected&&![`entry`,`end`].includes(e.type)&&(0,Z.jsxs)(P.Root,{positioning:{placement:`top-start`},children:[(0,Z.jsx)(P.Trigger,{asChild:!0,children:(0,Z.jsx)(a,{background:`bg`,position:`absolute`,top:`-28px`,right:1,paddingX:1,paddingY:1,borderRadius:6,minWidth:`auto`,minHeight:`auto`,boxShadow:`sm`,width:`auto`,height:`auto`,children:(0,Z.jsx)(Si,{size:11})})}),(0,Z.jsx)(wn,{children:(0,Z.jsxs)(P.Content,{children:[(0,Z.jsxs)(P.Item,{value:`duplicate`,onClick:()=>f(e.id),children:[(0,Z.jsx)(qt,{size:14}),`Duplicate`]}),(0,Z.jsxs)(P.Item,{value:`delete`,onClick:()=>d(e.id),children:[(0,Z.jsx)(ln,{size:14}),`Delete`]})]})})]}),(0,Z.jsxs)(s,{gap:2,width:`full`,children:[(0,Z.jsx)(Vt,{type:e.type,cls:e.data.cls,behave_as:e.data.behave_as,size:`md`}),(0,Z.jsx)(p,{fontSize:`12px`,fontWeight:500,minWidth:`0`,flexShrink:1,lineClamp:1,wordBreak:`break-all`,width:`full`,children:Nc(e)}),Mc(e.data)&&(0,Z.jsx)(k,{content:`Unsaved changes`,positioning:{placement:`top`},openDelay:0,showArrow:!0,children:(0,Z.jsx)(u,{size:`8px`,bg:`orange.solid`,flexShrink:0,"data-testid":`unsaved-changes-indicator`})}),n&&zc(n)?(0,Z.jsx)(Bc,{node:n,marginRight:`-6px`,marginLeft:`-4px`}):(0,Z.jsx)(i,{width:`54px`})]}),e.children,C.filter(e=>e.value).map(e=>(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsx)(Lc,{children:`LLM`}),(0,Z.jsx)(s,{width:`full`,children:(0,Z.jsx)(at,{model:(e?.value).model,fontSize:`11px`})})]},e.identifier)),(e.data.inputs||v)&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Lc,{children:e.inputsTitle??`Inputs`}),(0,Z.jsx)(Pc,{node:n,namespace:`inputs`,inputs:e.data.inputs??[],selected:!!e.selected||_,showGateDropTarget:v})]}),e.data.outputs&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Lc,{children:e.outputsTitle??`Outputs`}),(0,Z.jsx)(Fc,{namespace:`outputs`,outputs:e.data.outputs,selected:!!e.selected||_,hideOutputHandles:e.hideOutputHandles})]}),e.fieldsAfter]})});function Bc({node:e,iconSize:t=14,componentOnly:n=!1,...o}){let{startComponentExecution:s,stopComponentExecution:c}=kc(),l=jc(e=>e.open),[u]=Ct(e?.data.execution_state?.status===`waiting`,600),{propertiesExpanded:d,setPropertiesExpanded:f,setSelectedNode:p}=G(({propertiesExpanded:e,setPropertiesExpanded:t,setSelectedNode:n})=>({propertiesExpanded:e,setPropertiesExpanded:t,setSelectedNode:n})),m=e?.data.execution_state&&!d;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{content:m?`Execution results`:``,positioning:{placement:`top`},showArrow:!0,children:(0,Z.jsxs)(Tt,{minWidth:`24px`,minHeight:`24px`,maxWidth:`24px`,maxHeight:`24px`,marginRight:`-4px`,marginLeft:`-4px`,role:m?`button`:void 0,cursor:e?.data.execution_state?`pointer`:void 0,onClick:()=>{m?(p(e.id),f(!0)):f(!1)},children:[u&&e?.data.execution_state?.status===`waiting`&&(0,Z.jsx)(i,{marginLeft:`-4px`,marginRight:`-4px`,children:(0,Z.jsx)(Ec,{size:2,speedMultiplier:.5})}),(!u&&e?.data.execution_state?.status===`waiting`||e?.data.execution_state?.status===`running`)&&(0,Z.jsx)(r,{size:`xs`}),e?.data.execution_state?.status===`error`||tr(e)&&e?.data.execution_state?.status===`success`&&(e?.data.execution_state?.outputs?.status===`error`||e?.data.execution_state?.outputs?.passed===!1)?(0,Z.jsx)(i,{color:`red.500`,children:(0,Z.jsx)(fn,{size:t})}):e?.data.execution_state?.status===`success`?(0,Z.jsx)(i,{color:tr(e)&&e?.data.execution_state?.outputs?.status===`skipped`?`yellow.500`:`green.500`,children:(0,Z.jsx)(Ut,{size:t})}):e?.data.execution_state?.status===`skipped`?(0,Z.jsx)(i,{color:`gray.400`,"data-testid":`node-status-skipped`,children:(0,Z.jsx)(Wt,{size:t})}):null]})}),e?.data.execution_state?.status===`running`||e?.data.execution_state?.status===`waiting`?(0,Z.jsx)(a,{variant:`ghost`,size:`xs`,onClick:()=>{e&&c({node_id:e.id,trace_id:e.data.execution_state?.trace_id??``,current_state:e.data.execution_state})},...o,children:(0,Z.jsx)(Ri,{size:t})}):n?(0,Z.jsx)(a,{variant:`ghost`,size:`xs`,onClick:t=>{t.stopPropagation(),t.preventDefault(),e&&s({node:e})},children:(0,Z.jsx)(sn,{size:t})}):(0,Z.jsxs)(P.Root,{positioning:{placement:`top-start`},children:[(0,Z.jsx)(P.Trigger,{asChild:!0,children:(0,Z.jsx)(a,{variant:`ghost`,size:`xs`,paddingX:2,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),...o,children:(0,Z.jsx)(sn,{size:t})})}),(0,Z.jsxs)(P.Content,{children:[(0,Z.jsxs)(P.Item,{value:`run-manual`,onClick:()=>e&&s({node:e}),children:[(0,Z.jsx)(sn,{size:14}),`Run with manual input`]}),(0,Z.jsxs)(P.Item,{value:`run-workflow`,onClick:()=>e&&l(e.id),children:[(0,Z.jsx)(sn,{size:14}),`Run workflow until here`]})]})]})]})}function Vc({llmConfig:e,onChange:t,modelOption:n,requiresCustomKey:r,showProviderKeyMessage:a=!0,outputs:o,onOutputsChange:c,showStructuredOutputs:l=!1,noModelsConfigured:u=!1}){let[d,f]=(0,K.useState)(!1),{model:p}=e??{},m=n?.isDisabled??!1;return u?(0,Z.jsx)(nr,{size:`sm`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(_.Root,{positioning:{placement:`bottom-start`},closeOnInteractOutside:!1,open:d,onOpenChange:({open:e})=>f(e),children:[(0,Z.jsx)(v,{asChild:!0,children:(0,Z.jsxs)(s,{width:`full`,paddingY:2,paddingX:3,borderRadius:`md`,border:`1px solid`,borderColor:`border`,cursor:`pointer`,_hover:{bg:`bg.subtle`},transition:`background 0.15s`,justify:`space-between`,opacity:n?.isDisabled?.5:1,onClick:()=>f(e=>!e),children:[(0,Z.jsx)(at,{model:p??``}),(0,Z.jsx)(i,{color:`fg.muted`,children:(0,Z.jsx)(Ge,{size:16})})]})}),(0,Z.jsx)(st,{values:e,onChange:t,outputs:o,onOutputsChange:c,showStructuredOutputs:l})]}),(r||m)&&a&&(0,Z.jsx)(yr,{runWhat:`run this component`,nodeProvidersWithoutCustomKeys:[p?.split(`/`)[0]??`unknown`]})]})}var Hc={topP:`top_p`,frequencyPenalty:`frequency_penalty`,presencePenalty:`presence_penalty`,maxTokens:`max_tokens`,topK:`top_k`,minP:`min_p`,repetitionPenalty:`repetition_penalty`};function Uc(e){let t={...e};for(let[e,n]of Object.entries(Hc))if(e in t&&t[e]!==void 0){let r=t[e];delete t[e],t[n]=r}return t}function Wc({llmConfig:e,onChange:t,showProviderKeyMessage:n=!0,outputs:r,onOutputsChange:i,showStructuredOutputs:a=!1}){let o=e?.model??``,{modelOption:s,isEmpty:c}=rr(ir,o,`chat`),{hasCodeNodes:l}=G(e=>({hasCodeNodes:e.nodes.some(e=>e.type===`code`)})),{modelProviders:u}=U(),d=Object.values(u??{}).some(e=>o.split(`/`)[0]===e.provider&&(e.enabled||e.customKeys)),f=l&&!d;return(0,Z.jsx)(Vc,{llmConfig:e,onChange:(0,K.useCallback)(e=>{t(Uc(e))},[t]),modelOption:s,requiresCustomKey:f,showProviderKeyMessage:n,outputs:r,onOutputsChange:i,showStructuredOutputs:a,noModelsConfigured:c})}function Gc({node:e,title:t,field:n,readOnly:r=!1,onChange:i}){let{setNode:o}=G(R(e=>({setNode:e.setNode}))),{control:c,handleSubmit:l,formState:{errors:u},setValue:d,watch:f}=gt({defaultValues:{fields:e.data[n]??[]}}),{fields:h,append:g,remove:_,replace:v}=ht({control:c,name:`fields`}),y=(n===`inputs`?[`str`,`image`,`float`,`bool`,`dict`,`list`]:[`str`,`float`,`bool`,`dict`,`list`]).map(e=>({value:e,label:qn(e)})),b=W(),x=t=>{o({id:e.id,data:{[n]:t.fields}}),b(e.id),i?.(t)},S=async e=>{i?.(e),x(e)},C=JSON.stringify((e.data[n]??[]).map(e=>[e.identifier,e.type,e.optional??!1]));(0,K.useEffect)(()=>{let t=e.data[n]??[];if(JSON.stringify((c._formValues.fields??[]).map(e=>[e.identifier,e.type,e.optional??!1]))===C)return;v(t);let r=setTimeout(()=>{b(e.id)},0);return()=>clearTimeout(r)},[C]);let w=f(`fields`);return(0,Z.jsxs)(m,{as:`form`,align:`start`,gap:3,width:`full`,onSubmit:l(x),onChange:l(S),children:[(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(lt,{children:t}),(0,Z.jsx)(z,{}),r?null:(0,Z.jsx)(a,{size:`xs`,variant:`ghost`,"data-testid":`add-${n}-field-button`,onClick:()=>g({identifier:``,type:`str`}),children:(0,Z.jsx)(cn,{size:16})})]}),h.map((e,t)=>{let i=c.register(`fields.${t}.identifier`,{required:`Required`,pattern:{value:/^[a-zA-Z_][a-zA-Z0-9_-]*$/,message:`Only letters, numbers, and underscores are allowed`},validate:e=>c._formValues.fields.map(e=>e.identifier).filter(t=>t===e).length===1||`Duplicate identifier`});return(0,Z.jsxs)(ce,{invalid:!!u.fields?.[t]?.identifier,children:[(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsxs)(s,{background:`bg.muted`,paddingRight:2,borderRadius:`8px`,width:`full`,children:[r?(0,Z.jsx)(p,{fontFamily:`monospace`,fontSize:`13px`,width:`full`,padding:`8px 0px 8px 12px`,children:e.identifier}):(0,Z.jsx)(V,{...i,onChange:e=>{e.target.value=e.target.value.replace(/ /g,`_`).toLowerCase(),i.onChange(e)},width:`full`,fontFamily:`monospace`,fontSize:`13px`,border:`none`,background:`transparent`,padding:`6px 0px 6px 12px`}),(0,Z.jsx)(s,{paddingX:1,paddingY:1,height:`full`,children:(0,Z.jsx)(Kn,{value:w[t]?.type??`str`,options:y,readOnly:r,onChange:e=>{d(`fields.${t}.type`,e,{shouldDirty:!0}),l(S)()},testId:`field-type-select-${n}-${t}`})})]}),r?null:(0,Z.jsx)(a,{colorPalette:`gray`,size:`sm`,height:`40px`,"data-testid":`remove-${n}-${t}-field`,onClick:()=>{_(t),l(x)()},disabled:h.length===1,children:(0,Z.jsx)(ln,{size:18})})]}),(0,Z.jsx)(ue,{children:u.fields?.[t]?.identifier?.message})]},e.id)})]})}function Kc({node:e,field:t}){e.data.parameters;let{setNode:n}=G(R(t=>({parameters:t.nodes.find(t=>t.id===e.id)?.data.parameters,setNode:t.setNode}))),{control:r,handleSubmit:i,formState:{errors:a},setValue:o,watch:c}=gt({defaultValues:{fields:e.data[t]??[]}}),{fields:l}=ht({control:r,name:`fields`}),u=W(),d=(0,K.useCallback)(r=>{n({id:e.id,data:{[t]:r.fields}}),u(e.id)},[e.id,t,n,u]),f=An((0,K.useCallback)(()=>{i(d)()},[i,d]),100,{leading:!0,trailing:!1});return(0,K.useEffect)(()=>{let e=c(()=>{f()});return()=>e.unsubscribe()},[c,f]),(0,Z.jsx)(m,{as:`form`,align:`start`,gap:3,width:`full`,children:l.map((e,t)=>e.type===`llm`?(0,Z.jsx)(Wc,{llmConfig:e.value??{model:ie},onChange:e=>{o(`fields.${t}.value`,e,{shouldValidate:!0})}},e.id):e.type===`code`?null:(0,Z.jsx)(ce,{invalid:!!a.fields?.[t]?.identifier,children:(0,Z.jsxs)(m,{align:`start`,gap:3,width:`full`,children:[(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(lt,{children:mn(e.identifier)}),e.optional&&(0,Z.jsx)(p,{color:`fg.muted`,fontSize:`12px`,children:`(optional)`}),e.desc&&(0,Z.jsx)(k,{content:e.desc,children:(0,Z.jsx)(an,{size:14})})]}),(0,Z.jsx)(s,{width:`full`,children:e.type===`float`||e.type===`int`?(0,Z.jsx)(V,{type:`number`,step:e.type===`float`?`0.1`:void 0,size:`sm`,...r.register(`fields.${t}.value`)}):(0,Z.jsx)(V,{type:`text`,size:`sm`,...r.register(`fields.${t}.value`)})}),(0,Z.jsx)(ue,{children:a.fields?.[t]?.identifier?.message})]})},e.id))})}function qc({node:e,header:t,children:n,fieldsAfter:r,hideParameters:i,hideInputs:o,inputsTitle:c,hideOutputs:l,inputsReadOnly:u,outputsTitle:d,outputsReadOnly:f,hideDescription:h,hideHeader:g,..._}){let v=wr(),{deselectAllNodes:y,propertiesExpanded:b,setPropertiesExpanded:x,setNode:S,nodes:C}=G(R(e=>({deselectAllNodes:e.deselectAllNodes,propertiesExpanded:e.propertiesExpanded,setPropertiesExpanded:e.setPropertiesExpanded,setNode:e.setNode,nodes:e.nodes}))),[w,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(void 0),O=e=>!(`data`in e),k=(e,t)=>{let n=er({name:e,currentNodeId:t,existingNodeIds:C.map(e=>e.id)});if(!n.valid){M.create({title:`Invalid name`,description:n.error,type:`error`});return}let r=Qn(e);S({id:t,data:{name:e}},r)},A=g||v;return(0,Z.jsxs)(m,{align:`start`,gap:6,padding:3,...!v&&{maxWidth:`550px`,width:`25vw`,minWidth:`350px`},height:`full`,...!v&&{overflowY:`auto`},..._,children:[!A&&(0,Z.jsxs)(m,{gap:2,width:`full`,align:`start`,children:[(0,Z.jsxs)(s,{paddingY:1,paddingLeft:2,width:`full`,justify:`space-between`,gap:0,alignItems:`flex-start`,children:[(0,Z.jsx)(s,{gap:2,children:t||(O(e)?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vt,{type:e.type,cls:e.data.cls,size:`lg`}),w?(0,Z.jsx)(V,{fontSize:`15px`,marginLeft:1,fontWeight:500,variant:`outline`,background:`transparent`,value:E??Nc(e),borderRadius:5,paddingLeft:1,margin:0,size:`sm`,onBlur:()=>{T(!1),E&&k(E,e.id)},onChange:e=>{D(e.target.value)},onKeyDown:t=>{t.key===`Enter`&&(T(!1),E&&k(E,e.id)),t.key===`Escape`&&(T(!1),D(void 0))}}):(0,Z.jsx)(zn,{lineClamp:2,fontSize:`15px`,fontWeight:500,onClick:()=>{e.type!==`prompting_technique`&&T(!0)},cursor:e.type===`prompting_technique`?void 0:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,expandable:!1,children:Nc(e)})]}))}),(0,Z.jsxs)(s,{gap:0,marginRight:`-4px`,hidden:w,children:[!O(e)&&zc(e)&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{gap:2,onClick:()=>{b||x(!0)},children:(0,Z.jsx)(Bc,{node:e,size:`sm`,iconSize:16})}),(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,color:`fg.muted`,onClick:()=>{x(!b)},children:(0,Z.jsx)(mi,{size:16})})]}),(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,color:`fg.muted`,onClick:()=>{b?x(!1):y()},children:(0,Z.jsx)(fn,{size:16})})]})]}),!h&&e.data?.description&&(0,Z.jsx)(p,{fontSize:`12px`,color:`fg.muted`,paddingX:2,children:e.data?.description})]}),n,!O(e)&&(0,Z.jsxs)(Z.Fragment,{children:[!i&&(0,Z.jsx)(Kc,{node:e,field:`parameters`}),!o&&(0,Z.jsx)(Gc,{node:e,field:`inputs`,title:c??`Inputs`,readOnly:u}),!l&&(0,Z.jsx)(Gc,{node:e,field:`outputs`,title:d??`Outputs`,readOnly:f})]}),r]})}function Jc(e){return!!e?.startsWith(`agents/`)}function Yc(e){return e.replace(`agents/`,``)}function Xc(e){return e}function Zc(e,t,n,r,i,a){return{name:`HTTP`,description:`HTTP API endpoint`,url:e,method:t,bodyTemplate:n,outputPath:r,headers:i.length>0?i:void 0,auth:a?.type===`none`?void 0:a}}function Qc({node:e}){let t=e.data.agent;return Jc(t)?(0,Z.jsx)($c,{node:e,agentRef:t}):(0,Z.jsx)(qc,{node:e})}function $c({node:e,agentRef:t}){let{project:n}=U(),o=W(),{nodes:c,edges:l,setNode:u,setEdges:d,getWorkflow:f,deselectAllNodes:h}=G(R(({setNode:e,setEdges:t,getWorkflow:n,deselectAllNodes:r})=>({nodes:n().nodes,edges:n().edges,setNode:e,setEdges:t,getWorkflow:n,deselectAllNodes:r}))),g=Yc(t),_=B.agents.getById.useQuery({id:g,projectId:n?.id??``},{enabled:!!n?.id}),v=B.agents.update.useMutation(),y=B.useContext(),b=_.data,x=b?.type??e.data.agentType,S=b?.name??``,C=b?.config,w=e.data.localConfig,T=gt({defaultValues:{name:w?.name??e.data.name??S}}),E=mc(e.data),D=x===`http`&&C?Xc(C):void 0,k=w?.settings,[A,j]=(0,K.useState)(k?.url??E?.url??D?.url??``),[M,N]=(0,K.useState)(k?.method??E?.method??D?.method??`POST`),[P,ee]=(0,K.useState)(k?.bodyTemplate??E?.bodyTemplate??D?.bodyTemplate??``),[F,te]=(0,K.useState)(k?.outputPath??E?.outputPath??D?.outputPath??``),[I,ne]=(0,K.useState)(k?.headers??E?.headers??D?.headers??[]),[L,re]=(0,K.useState)(k?.auth??E?.auth??D?.auth??{type:`none`}),ie=pc(e.data),ae=x===`code`&&C?C:void 0,[oe,se]=(0,K.useState)(k?.code??ie??(ae?fr(ae):pr)),[ue,de]=(0,K.useState)(!1),fe=(0,K.useCallback)(e=>{if(T.reset({name:e.name}),e.type===`http`){let t=Xc(e.config);j(t.url||``),N(t.method??`POST`),ee(t.bodyTemplate??``),te(t.outputPath??``),ne(t.headers??[]),re(t.auth??{type:`none`})}else e.type===`code`&&se(fr(e.config))},[T]),pe=(0,K.useRef)(null),me=b?JSON.stringify({name:b.name,config:b.config}):null;(0,K.useEffect)(()=>{if(!b||!me||pe.current===me||w?.settings)return;let t=pe.current===null;pe.current=me,!(t&&hc(e.data,b))&&(fe(b),u({id:e.id,data:fc(b)}))},[me,w?.settings]);let he=An(t=>{u({id:e.id,data:{localConfig:{name:T.getValues(`name`),settings:t}}})},300,{trailing:!0}),ge=b?.name??e.data.name??``,_e=An(t=>{t.name===ge?w?.settings||u({id:e.id,data:{localConfig:void 0}}):u({id:e.id,data:{localConfig:{name:t.name,settings:w?.settings}}})},300,{trailing:!0});(0,K.useEffect)(()=>{let e=T.watch(e=>{e.name!==void 0&&_e(e)});return()=>e.unsubscribe()},[T,_e]);let ve=(0,K.useCallback)(e=>j(e),[]),ye=(0,K.useCallback)(e=>N(e),[]),be=(0,K.useCallback)(e=>ee(e),[]),xe=(0,K.useCallback)(e=>te(e),[]),Se=(0,K.useCallback)(e=>re(e),[]),Ce=(0,K.useCallback)(e=>ne(e),[]);(0,K.useEffect)(()=>{if(x!==`http`)return;let t=mc(e.data)??(b?Xc(b.config):void 0);t&&(A!==(t.url??``)||M!==(t.method??`POST`)||P!==(t.bodyTemplate??``)||F!==(t.outputPath??``)||JSON.stringify(I)!==JSON.stringify(t.headers??[])||JSON.stringify(L)!==JSON.stringify(t.auth??{type:`none`}))&&he({url:A,method:M,bodyTemplate:P,outputPath:F,headers:I,auth:L})},[A,M,P,F,I,L,x,b,e.data.parameters,he]),(0,K.useEffect)(()=>{if(x!==`code`)return;let t=pc(e.data)??(b?fr(b.config):void 0);t!==void 0&&oe!==t&&he({code:oe})},[oe,x,b,e.data.parameters,he]);let we=(0,K.useMemo)(()=>gc({nodeId:e.id,nodes:c,edges:l}),[l,c,e.id]),Te=(0,K.useMemo)(()=>_c({nodeId:e.id,edges:l,inputs:e.data.inputs??[]}),[l,e.id,e.data.inputs]),Ee=(0,K.useCallback)((t,n)=>{let r=f(),i=r.nodes.find(t=>t.id===e.id)?.data.inputs??[],a=vc({nodeId:e.id,identifier:t,mapping:n,currentEdges:r.edges,currentInputs:i});d(a.edges),u({id:e.id,data:{inputs:a.inputs}}),o(e.id)},[f,e.id,d,u,o]),De=(e.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),Oe=(e.data.outputs??[]).map(e=>({identifier:e.identifier,type:e.type})),ke=(0,K.useCallback)(t=>{let n=e.data.inputs??[],r=t.map(e=>{let t=n.find(t=>t.identifier===e.identifier);return{identifier:e.identifier,type:e.type,...t?.value==null?{}:{value:t.value}}});u({id:e.id,data:{inputs:r}}),o(e.id)},[e.id,e.data.inputs,u,o]),Ae=(0,K.useCallback)(t=>{let n=t.map(e=>({identifier:e.identifier,type:e.type}));u({id:e.id,data:{outputs:n}}),o(e.id)},[e.id,u,o]),je=(0,K.useCallback)(()=>h(),[h]),Me=(0,K.useCallback)(()=>{if(!n?.id||!b)return;let t=n.id,r=T.getValues().name.trim(),i;x===`http`?i=Zc(A,M,P,F,I,L):x===`code`&&(i=dr({code:oe,inputs:(e.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),outputs:(e.data.outputs??[]).map(e=>({identifier:e.identifier,type:e.type}))})),v.mutate({id:g,projectId:t,name:r,...i?{config:i}:{}},{onSuccess:()=>{let n={...b,name:r,...i?{config:i}:{}};pe.current=JSON.stringify({name:n.name,config:n.config}),y.agents.getById.setData({id:g,projectId:t},n),u({id:e.id,data:{...fc(n),localConfig:void 0}})}})},[n?.id,g,b,x,T,A,M,P,F,I,L,oe,e.data.inputs,e.data.outputs,v,y,u,e.id]),Ne=(0,K.useCallback)(()=>{if(_e.cancel(),he.cancel(),b){fe(b),pe.current=JSON.stringify({name:b.name,config:b.config}),u({id:e.id,data:{...fc(b),localConfig:void 0}});return}T.reset({name:e.data.name??``});let t=pc(e.data);t!==void 0&&se(t);let n=mc(e.data);n&&(j(n.url??``),N(n.method??`POST`),ee(n.bodyTemplate??``),te(n.outputPath??``),ne(n.headers??[]),re(n.auth??{type:`none`})),u({id:e.id,data:{localConfig:void 0}})},[T,b,fe,u,e.id,e.data,_e,he]),Pe=!!w,{handleTest:Fe}=hr({url:A,method:M,headers:I,auth:L,outputPath:F});return Er((0,K.useMemo)(()=>(0,Z.jsxs)(s,{width:`full`,children:[Pe&&(0,Z.jsx)(a,{variant:`outline`,size:`sm`,onClick:Ne,"data-testid":`agent-discard-button`,children:`Discard`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{variant:`outline`,size:`sm`,onClick:Me,loading:v.isPending,"data-testid":`agent-save-button`,children:`Save`}),(0,Z.jsx)(a,{colorPalette:`blue`,size:`sm`,onClick:je,"data-testid":`agent-apply-button`,children:`Apply`})]}),[Pe,Ne,je,Me,v.isPending])),_.isLoading&&!e.data.parameters?.length?(0,Z.jsx)(s,{justify:`center`,paddingY:8,width:`full`,children:(0,Z.jsx)(r,{size:`md`})}):(0,Z.jsxs)(qc,{node:e,hideParameters:!0,hideInputs:!0,hideOutputs:!0,paddingX:0,children:[(0,Z.jsxs)(m,{align:`stretch`,gap:2,width:`full`,paddingX:4,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(p,{fontWeight:`medium`,fontSize:`sm`,children:`Name`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(O,{colorPalette:`purple`,size:`sm`,children:x===`http`?`HTTP`:x===`code`?`Code`:x===`workflow`?`Workflow`:`Agent`})]}),(0,Z.jsx)(V,{...T.register(`name`),size:`sm`,placeholder:`Agent name`})]}),x===`http`&&(0,Z.jsx)(mr,{url:A,onUrlChange:ve,method:M,onMethodChange:ye,bodyTemplate:P,onBodyTemplateChange:be,outputPath:F,onOutputPathChange:xe,auth:L,onAuthChange:Se,headers:I,onHeadersChange:Ce,onTest:Fe}),x===`code`&&(0,Z.jsx)(m,{gap:4,align:`stretch`,paddingX:4,width:`full`,children:(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(le,{fontSize:`sm`,children:`Python Code`}),(0,Z.jsx)(p,{fontSize:`xs`,color:`fg.muted`,marginBottom:1,children:"Define a Python class with a `__call__` method that takes inputs and returns outputs."}),(0,Z.jsx)(ur,{code:oe,onChange:e=>se(e),language:`python`,externalModal:!0,onEditClick:()=>de(!0)})]})}),x===`workflow`&&(0,Z.jsx)(i,{paddingX:4,children:(0,Z.jsx)(p,{fontSize:`sm`,color:`fg.muted`,children:`This agent is backed by a workflow. Edit the workflow in Studio to modify its behavior.`})}),(0,Z.jsx)(i,{width:`full`,paddingX:4,children:(0,Z.jsx)(Jn,{variables:De,onChange:ke,showMappings:!0,mappings:Te,onMappingChange:Ee,availableSources:we,canAddRemove:!0,readOnly:!1,title:`Inputs`})}),(0,Z.jsx)(i,{width:`full`,paddingX:4,children:(0,Z.jsx)(ct,{outputs:Oe,onChange:Ae,canAddRemove:!0,readOnly:!1,title:`Outputs`,availableTypes:ot})}),x===`code`&&(0,Z.jsx)(it,{code:oe,setCode:e=>se(e),open:ue,onClose:()=>de(!1)})]})}function el({node:e}){let{nodes:t,edges:n,setNode:r,setNodeParameter:a,setEdges:o,getWorkflow:s}=G(R(e=>({nodes:e.getWorkflow().nodes,edges:e.getWorkflow().edges,setNode:e.setNode,setNodeParameter:e.setNodeParameter,setEdges:e.setEdges,getWorkflow:e.getWorkflow}))),c=W(),l=e.data.parameters?.find(e=>e.identifier===`code`&&e.type===`code`)?.value??``,u=(e.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),d=(e.data.outputs??[]).map(e=>({identifier:e.identifier,type:e.type})),f=(0,K.useMemo)(()=>gc({nodeId:e.id,nodes:t,edges:n}),[n,t,e.id]),p=(0,K.useMemo)(()=>_c({nodeId:e.id,edges:n,inputs:e.data.inputs??[]}),[n,e.id,e.data.inputs]),m=(0,K.useCallback)((t,n)=>{let i=s(),a=i.nodes.find(t=>t.id===e.id)?.data.inputs??[],l=vc({nodeId:e.id,identifier:t,mapping:n,currentEdges:i.edges,currentInputs:a});o(l.edges),r({id:e.id,data:{inputs:l.inputs}}),c(e.id)},[s,e.id,o,r,c]),h=(0,K.useCallback)(t=>{a(e.id,{identifier:`code`,type:`code`,value:t})},[e.id,a]),g=(0,K.useCallback)(t=>{let n=e.data.inputs??[],i=t.map(e=>{let t=n.find(t=>t.identifier===e.identifier);return{identifier:e.identifier,type:e.type,...t?.value==null?{}:{value:t.value}}});r({id:e.id,data:{inputs:i}}),c(e.id)},[e.id,e.data.inputs,r,c]),_=(0,K.useCallback)(t=>{let n=t.map(e=>({identifier:e.identifier,type:e.type}));r({id:e.id,data:{outputs:n}}),c(e.id)},[e.id,r,c]);return(0,Z.jsxs)(qc,{node:e,hideParameters:!0,hideInputs:!0,hideOutputs:!0,paddingX:4,children:[(0,Z.jsx)(ur,{code:l,onChange:h,language:`python`,inputs:u.map(e=>({identifier:e.identifier,type:e.type})),outputs:d.map(e=>({identifier:e.identifier,type:e.type})),viewStateKey:`code-node:${e.id}`}),(0,Z.jsx)(i,{width:`full`,children:(0,Z.jsx)(Jn,{variables:u,onChange:g,showMappings:!0,mappings:p,onMappingChange:m,availableSources:f,canAddRemove:!0,readOnly:!1,title:`Inputs`})}),(0,Z.jsx)(i,{width:`full`,children:(0,Z.jsx)(ct,{outputs:d,onChange:_,canAddRemove:!0,readOnly:!1,title:`Outputs`,availableTypes:ot})})]})}var tl=e=>{let{project:t}=U();if(!e)return{version:null,latestVersion:null};let n=e.data.version_id,r=B.workflow.getVersions.useQuery({projectId:t?.id??``,workflowId:e.data.workflow_id??``,returnDSL:!0},{enabled:!!t?.id&&!!e.data.workflow_id}),i=r.data?.find(e=>String(e.id).trim()===String(n).trim()),a=r.data?.find(e=>e.isPublishedVersion===!0);return!i||!t?{currentVersion:null,publishedVersion:null}:{currentVersion:i,publishedVersion:a}};function nl({node:e}){return(0,Z.jsx)(qc,{node:e,hideParameters:!0,inputsReadOnly:!0,outputsReadOnly:!0,children:(0,Z.jsx)(rl,{node:e})})}var rl=({node:e})=>{let{currentVersion:t,publishedVersion:n}=tl(e),{project:r}=U(),{setNode:i,deselectAllNodes:o}=G(R(({setNode:e,deselectAllNodes:t})=>({setNode:e,deselectAllNodes:t}))),c=W(),l=()=>{let{inputs:t,outputs:r}=Xn((n?.dsl).edges,(n?.dsl).nodes);i({id:e.id,data:{inputs:t,outputs:r,version_id:n?.id}}),c(e.id),o(),M.create({title:`Updated to latest version`,type:`success`,duration:3e3})};return(0,Z.jsxs)(s,{width:`full`,gap:3,children:[t&&(0,Z.jsx)($e,{version:t,minWidth:`44px`}),(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:1,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(p,{fontWeight:600,fontSize:`13px`,lineClamp:1,children:t?.commitMessage}),(0,Z.jsx)(jt,{href:`/${r?.slug}/studio/${e.data.workflow_id}`,isExternal:!0,children:(0,Z.jsx)(Xt,{size:14})}),t?.isPublishedVersion?(0,Z.jsx)(O,{colorPalette:`green`,size:`sm`,paddingX:2,children:`Latest version`}):(0,Z.jsx)(a,{size:`xs`,variant:`outline`,colorPalette:`gray`,onClick:()=>{l()},children:`Update to latest version`})]}),(0,Z.jsxs)(s,{children:[(0,Z.jsx)(h,{size:`2xs`,children:(0,Z.jsx)(x,{name:`jim`,bg:`orange.400`,color:`white`})}),(0,Z.jsx)(p,{fontSize:`12px`,lineClamp:1,children:t?.author?.name}),(0,Z.jsx)(p,{fontSize:`12px`,flexShrink:0,children:`·`}),(0,Z.jsx)(p,{fontSize:`12px`,flexShrink:0,children:t?.updatedAt&&yt(t.updatedAt.getTime())})]})]})]})},il=[{identifier:`details`,type:`str`,optional:!0},{identifier:`passed`,type:`bool`,optional:!0},{identifier:`score`,type:`float`,optional:!0},{identifier:`label`,type:`str`,optional:!0}],al={bool:`Boolean`,float:`Number`,str:`Text`},ol={passed:`Whether the evaluation passed or not.`,score:`Any numerical score.`,label:`A category, for categorical evaluations.`,details:`The reasoning behind the result, usually the LLM as judge explanation.`};function sl({node:e}){let{node:t,edges:n,setNode:r,workflowType:a}=G(R(t=>({node:t.nodes.find(t=>t.id===e.id),edges:t.edges,setNode:t.setNode,workflowType:t.workflow_type}))),o=W(),c=t.data.behave_as===`evaluator`||a===`evaluator`;(0,K.useEffect)(()=>{if(!c)return;let e=t.data.inputs??[];t.data.behave_as===`evaluator`&&e.length===il.length&&il.every((t,n)=>{let r=e[n];return r&&r.identifier===t.identifier&&r.type===t.type&&!!r.optional==!!t.optional})||(r({id:t.id,data:{...t.data,behave_as:`evaluator`,inputs:il}}),o(t.id))},[c,t.id,t.data,r,o]);let l=n.some(e=>e.target===t.id&&(e.targetHandle===`inputs.score`||e.targetHandle===`inputs.passed`)),u=(t.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),d=(0,K.useCallback)(e=>{let n=t.data.inputs??[],i=e.map(e=>{let t=n.find(t=>t.identifier===e.identifier);return{identifier:e.identifier,type:e.type,...t?.optional==null?{}:{optional:t.optional},...t?.value==null?{}:{value:t.value}}});r({id:t.id,data:{inputs:i}}),o(t.id)},[t.id,t.data.inputs,r,o]);return(0,Z.jsxs)(qc,{node:t,hideInputs:!0,hideOutputs:!0,hideParameters:!0,children:[c?(0,Z.jsxs)(i,{width:`full`,display:`flex`,flexDirection:`column`,gap:4,children:[(0,Z.jsx)(p,{fontSize:`14px`,fontWeight:`semibold`,children:`Results`}),(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:`Evaluators return up to these four results. Connect the ones your workflow produces; unconnected results are simply omitted.`}),(0,Z.jsx)(i,{display:`flex`,flexDirection:`column`,gap:3,children:il.map(e=>(0,Z.jsxs)(i,{width:`full`,children:[(0,Z.jsxs)(s,{gap:2,align:`baseline`,children:[(0,Z.jsx)(p,{fontFamily:`mono`,fontSize:`14px`,fontWeight:`medium`,children:e.identifier}),(0,Z.jsx)(p,{fontSize:`12px`,color:`fg.subtle`,children:al[e.type]??e.type})]}),(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:ol[e.identifier]})]},e.identifier))})]}):(0,Z.jsx)(i,{width:`full`,children:(0,Z.jsx)(Jn,{variables:u,onChange:d,showMappings:!1,isMappingDisabled:!0,canAddRemove:!0,readOnly:!1,title:`Results`})}),c&&!l&&(0,Z.jsxs)(we,{children:[(0,Z.jsx)(Ee,{}),(0,Z.jsx)(De,{children:(0,Z.jsxs)(p,{children:[`Connect at least one result, usually a `,(0,Z.jsx)(`b`,{children:`passed`}),` or a`,` `,(0,Z.jsx)(`b`,{children:`score`}),`, for this evaluator to be useful.`]})})]})]})}var cl=({dataset:e,preview:t=!1})=>{let{project:n}=U(),r=B.datasetRecord.getHead.useQuery({projectId:n?.id??``,datasetId:e?.id??``},{enabled:!!n&&!!e?.id&&e?.id!==``,refetchOnWindowFocus:!1,refetchOnMount:!1,staleTime:1e3*60*60,retry:(e,t)=>t?.data?.code===`PRECONDITION_FAILED`?!1:e<3,trpc:{context:{skipBatch:!0}}}),i=r.data?.dataset&&`datasetRecords`in r.data.dataset?en(r.data.dataset):void 0,a=(0,K.useMemo)(()=>{if(e?.id)return i?{records:i.datasetRecords,columnTypes:i.columnTypes.slice(0,t?5:void 0)}:void 0;if(e?.inline)return{records:tn(e.inline.records),columnTypes:e.inline.columnTypes}},[e?.id,e?.inline,i,t]),o=(0,K.useMemo)(()=>new Set(a?.columnTypes.map(e=>e.name)),[a?.columnTypes]);return{rows:(0,K.useMemo)(()=>(a?a.records.slice(0,t?5:void 0):void 0)?.map(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e===`id`||o.has(e)))),[a,t,o])??[],columns:a?.columnTypes??[],query:r,total:e?.inline?.records?Object.values(e?.inline.records)[0]?.length??0:r.data?.total}},ll=[{name:`input`,type:`string`},{name:`expected_output`,type:`string`}];function ul({open:e,onClose:t,node:n,editingDataset:r=void 0}){let[o,c]=(0,K.useState)(),l=(0,K.useRef)(null),u=w(),{openDrawer:d}=kt(),f=W();(0,K.useEffect)(()=>{c(e?r:void 0)},[e]);let{attachEntryDataset:m}=G(({attachEntryDataset:e})=>({attachEntryDataset:e})),h=(e,t)=>{m(n.id,e,$t(t)),f(n.id)},g=e=>{h({id:e.datasetId,name:e.name},e.columnTypes),t()};return(0,Z.jsxs)(H.Root,{open:e,onOpenChange:({open:e})=>!e&&t(),size:`full`,children:[(0,Z.jsxs)(H.Content,{bg:`bg`,css:{marginX:`32px`,marginTop:`32px`,width:`calc(100vw - 64px)`,minHeight:`0`,height:`calc(100vh - 64px)`,borderRadius:`8px`,overflowY:`auto`},"data-testid":`dataset-modal`,children:[(0,Z.jsx)(H.CloseTrigger,{zIndex:10}),o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H.Header,{children:(0,Z.jsx)(s,{width:`full`,paddingRight:10,children:(0,Z.jsxs)(a,{fontSize:`14px`,fontWeight:`bold`,color:`fg.muted`,variant:`plain`,"data-testid":`back-to-datasets`,onClick:()=>c(void 0),children:[(0,Z.jsx)(Qr,{size:16}),` Datasets`]})})}),(0,Z.jsx)(H.Body,{paddingBottom:`32px`,children:(0,Z.jsx)(i,{ref:l,width:`full`,height:`full`,children:e&&o.id?(0,Z.jsx)(cr,{datasetId:o.id,editorPortalRef:l,floatingSelectionBar:!0,onColumnsChanged:e=>{h(o,e)}}):e&&o.inline?(0,Z.jsx)(cr,{title:o.name??`Draft Dataset`,editorPortalRef:l,floatingSelectionBar:!0,inMemoryDataset:{name:o.name,columnTypes:o.inline.columnTypes,datasetRecords:tn(o.inline.records)},onUpdateDataset:e=>{let t=Zt({...e,name:o?.name??e.name});h(t,e.columnTypes),c(t)},headerActions:(0,Z.jsxs)(a,{size:`sm`,colorPalette:`blue`,variant:`outline`,"data-testid":`save-draft-as-dataset`,onClick:()=>{o?.inline&&d(`addOrEditDataset`,{datasetToSave:{name:o.name,columnTypes:o.inline.columnTypes,datasetRecords:tn(o.inline.records)},onSuccess:e=>{h({id:e.datasetId,name:e.name},e.columnTypes),t()}})},children:[(0,Z.jsx)(Jt,{size:14}),` Save as dataset`]})}):null})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H.Header,{children:(0,Z.jsxs)(s,{gap:2,children:[(0,Z.jsx)(Jt,{size:20}),(0,Z.jsx)(p,{fontSize:`lg`,fontWeight:`semibold`,children:`Choose dataset`})]})}),(0,Z.jsxs)(H.Body,{paddingBottom:`32px`,display:`flex`,flexDirection:`column`,children:[(0,Z.jsxs)(s,{paddingBottom:4,children:[(0,Z.jsx)(p,{color:`fg.muted`,fontSize:`sm`,children:`Pick an existing dataset for this workflow, upload a CSV, or start a new draft.`}),(0,Z.jsx)(z,{}),(0,Z.jsxs)(a,{size:`sm`,variant:`outline`,"data-testid":`upload-csv-dataset`,onClick:()=>u.onOpen(),children:[(0,Z.jsx)(dn,{size:14}),` Upload CSV`]}),(0,Z.jsxs)(a,{size:`sm`,colorPalette:`blue`,"data-testid":`new-draft-dataset`,onClick:()=>{let e={name:`Draft Dataset`,inline:{records:Object.fromEntries(ll.map(e=>[e.name,[``,``,``]])),columnTypes:ll}};h(e,ll),c(e)},children:[(0,Z.jsx)(cn,{size:14}),` New dataset`]})]}),e&&(0,Z.jsx)(_r,{enabled:e,onSelect:g})]})]})]}),u.open&&(0,Z.jsx)(lr,{isOpen:u.open,onClose:u.onClose,enableDirectUpload:!1,onSuccess:e=>{u.onClose(),g({datasetId:e.datasetId,name:e.name,columnTypes:e.columnTypes})}})]})}function dl({node:e}){let{open:t,onOpen:n,onClose:r}=w(),[i,o]=(0,K.useState)(),{total:c}=cl({dataset:`dataset`in e.data?e.data.dataset:void 0,preview:!0}),{setNode:l,setSelectedNode:u,endNodeId:d}=G(R(e=>({setNode:e.setNode,setSelectedNode:e.setSelectedNode,endNodeId:e.nodes.find(e=>e.type===`end`)?.id}))),f=W(),h=e.data.dataset,g=(e.data.outputs??[]).map(e=>({identifier:e.identifier,type:e.type})),_=Object.fromEntries((e.data.outputs??[]).filter(e=>typeof e.value==`string`).map(e=>[e.identifier,e.value])),v=(0,K.useCallback)(t=>{let n=e.data.outputs??[],r=t.map(e=>({...n.find(t=>t.identifier===e.identifier)??{},identifier:e.identifier,type:e.type}));l({id:e.id,data:{outputs:r}}),f(e.id)},[e.id,e.data.outputs,l,f]),y=(0,K.useCallback)((t,n)=>{let r=(e.data.outputs??[]).map(e=>e.identifier===t?{...e,value:n===``?void 0:n}:e);l({id:e.id,data:{outputs:r}})},[e.id,e.data.outputs,l]),b=(0,K.useCallback)(()=>{l({id:e.id,data:{...e.data,dataset:void 0}})},[l,e.id,e.data]),x=(0,K.useCallback)(()=>{d&&u(d)},[d,u]);return(0,Z.jsxs)(qc,{node:e,hideOutputs:!0,hideInputs:!0,hideParameters:!0,paddingX:4,children:[(0,Z.jsx)(Jn,{variables:g,onChange:v,showMappings:!1,values:_,onValueChange:y,canAddRemove:!0,readOnly:!1,title:`Inputs`}),(0,Z.jsxs)(m,{width:`full`,align:`start`,children:[(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(lt,{children:`Attached Dataset`}),(0,Z.jsx)(z,{}),!h&&(0,Z.jsxs)(a,{size:`xs`,variant:`ghost`,marginBottom:-1,"data-testid":`attach-dataset-button`,onClick:()=>{o(void 0),n()},children:[(0,Z.jsx)(vi,{size:14}),(0,Z.jsx)(p,{children:`Attach...`})]})]}),h?(0,Z.jsxs)(s,{width:`full`,paddingX:3,paddingY:2,borderRadius:`md`,border:`1px solid`,borderColor:`border`,"data-testid":`entry-dataset-card`,children:[(0,Z.jsx)(Jt,{size:14,style:{flexShrink:0}}),(0,Z.jsx)(p,{fontSize:`13px`,truncate:!0,children:h.name??`Dataset`}),c!=null&&(0,Z.jsxs)(p,{fontSize:`13px`,color:`fg.subtle`,flexShrink:0,children:[`(`,c,` `,c===1?`row`:`rows`,`)`]}),(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{size:`xs`,variant:`ghost`,onClick:()=>{o(e.data.dataset),n()},children:`Open`}),(0,Z.jsx)(a,{size:`xs`,variant:`ghost`,onClick:()=>{o(void 0),n()},children:`Replace`}),(0,Z.jsx)(k,{content:`Detach dataset (inputs are kept)`,children:(0,Z.jsx)(a,{size:`xs`,variant:`ghost`,"data-testid":`detach-dataset-button`,onClick:b,children:(0,Z.jsx)(fn,{size:14})})})]}):(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:`Optional. Attaching a dataset adds its columns to the inputs and provides the rows for evaluations.`})]}),(0,Z.jsx)(ul,{open:t,onClose:r,node:e,editingDataset:i}),d&&(0,Z.jsxs)(m,{align:`start`,gap:2,width:`full`,children:[(0,Z.jsx)(lt,{children:`Workflow Outputs`}),(0,Z.jsxs)(a,{size:`sm`,variant:`outline`,"data-testid":`go-to-end-node`,onClick:x,children:[(0,Z.jsx)(nn,{size:14}),(0,Z.jsx)(p,{children:`Go to end node`}),(0,Z.jsx)(It,{size:14})]})]})]})}function fl({evaluatorType:e,description:t,isWorkflowEvaluator:n,workflow:r,form:a,settingsSchema:o,hasSettings:s,effectiveEvaluatorDef:c,mappingsConfig:l,variant:u=`drawer`}){return(0,Z.jsx)(mt,{...a,children:(0,Z.jsxs)(m,{gap:4,align:`stretch`,flex:1,paddingX:4,paddingY:2,overflowY:`auto`,children:[t&&(0,Z.jsx)(p,{fontSize:`sm`,color:`fg.muted`,children:t}),(0,Z.jsxs)(ce,{required:!0,children:[(0,Z.jsx)(le,{children:`Evaluator Name`}),(0,Z.jsx)(V,{...a.register(`name`),placeholder:`Enter evaluator name`,"data-testid":`evaluator-name-input`})]}),s&&e&&o&&(0,Z.jsx)(pl,{schema:o,evaluatorType:e,errors:a.formState.errors.settings}),n&&r&&(0,Z.jsxs)(m,{gap:4,paddingTop:4,align:`stretch`,children:[(0,Z.jsx)(p,{fontSize:`sm`,color:`fg.muted`,children:`This evaluator is powered by a workflow. Click below to open the workflow editor:`}),(0,Z.jsx)(jt,{href:`/${r.projectSlug}/studio/${r.id}`,"data-testid":`open-workflow-link`,target:`_blank`,children:(0,Z.jsx)(Yn,{name:r.name,icon:r.icon,updatedAt:r.updatedAt,action:(0,Z.jsx)(A,{size:16,color:`var(--chakra-colors-fg-muted)`}),width:`300px`})})]}),!s&&!l&&!n&&(0,Z.jsx)(p,{fontSize:`sm`,color:`fg.muted`,children:`This evaluator does not have any settings to configure.`}),l&&(0,Z.jsx)(i,{children:(0,Z.jsx)(xr,{evaluatorDef:c,level:l.level,providedSources:l.availableSources,initialMappings:l.initialMappings,onMappingChange:l.onMappingChange,scrollToMissingOnMount:!0,variant:u})})]})})}function pl({schema:e,evaluatorType:t,errors:n}){let r=vt({name:`settings.has_golden_answer`});return(0,Z.jsx)(br,{schema:e,evaluatorType:t,prefix:`settings`,errors:n,variant:`default`,skipFields:t===`langevals/pairwise_compare`&&r===!1?[`prompt`]:void 0})}function ml(e){return!!e?.startsWith(`evaluators/`)}function hl(e){return e.replace(`evaluators/`,``)}function gl({node:e}){let t=e.data.evaluator;return ml(t)?(0,Z.jsx)(_l,{node:e,evaluatorRef:t}):(0,Z.jsx)(vl,{node:e})}function _l({node:e,evaluatorRef:t}){let{project:n}=U(),i=W(),{nodes:o,edges:c,setNode:l,setEdges:u,getWorkflow:d,deselectAllNodes:f}=G(R(({setNode:e,setEdges:t,getWorkflow:n,deselectAllNodes:r})=>({nodes:n().nodes,edges:n().edges,setNode:e,setEdges:t,getWorkflow:n,deselectAllNodes:r}))),p=hl(t),m=B.evaluators.getById.useQuery({id:p,projectId:n?.id??``},{enabled:!!n?.id}),h=B.evaluators.update.useMutation(),g=m.data?.config,_=g?.evaluatorType,v=m.data?.name??``,y=g?.settings??{},b=_?Hn[_]:void 0,x=(0,K.useMemo)(()=>{if(_)return Vn.shape[_]?.shape?.settings},[_]),S=!!x&&x instanceof At&&Object.keys(x.shape).length>0,C=(0,K.useMemo)(()=>{let e=m.data?.fields;return e&&e.length>0?{requiredFields:e.filter(e=>!e.optional).map(e=>e.identifier),optionalFields:e.filter(e=>e.optional).map(e=>e.identifier)}:b},[m.data?.fields,b]),w=m.data?.type===`workflow`,T=w&&m.data?.workflowId?{id:m.data.workflowId,name:m.data.workflowName??`Workflow`,icon:m.data.workflowIcon,updatedAt:m.data.updatedAt,projectSlug:n?.slug??``}:void 0,E=e.data.localConfig,D=gt({defaultValues:{name:E?.name??v,settings:E?.settings??y}});(0,K.useEffect)(()=>{if(m.data){let t=e.data.localConfig;D.reset({name:t?.name??m.data.name,settings:t?.settings??m.data.config?.settings??{}})}},[m.data,D]);let O=An(t=>{let n=t.name!==v,r=JSON.stringify(t.settings)!==JSON.stringify(y);l(n||r?{id:e.id,data:{localConfig:{name:t.name,settings:t.settings}}}:{id:e.id,data:{localConfig:void 0}})},300,{trailing:!0});(0,K.useEffect)(()=>{let e=D.watch(e=>{e.name!==void 0&&e.settings!==void 0&&O(e)});return()=>e.unsubscribe()},[D,O]);let k=(0,K.useMemo)(()=>gc({nodeId:e.id,nodes:o,edges:c}),[c,o,e.id]),A=(0,K.useMemo)(()=>_c({nodeId:e.id,edges:c,inputs:e.data.inputs??[]}),[c,e.id,e.data.inputs]),j=(0,K.useCallback)((t,n)=>{let r=d(),a=r.nodes.find(t=>t.id===e.id)?.data.inputs??[],o=vc({nodeId:e.id,identifier:t,mapping:n,currentEdges:r.edges,currentInputs:a});u(o.edges),l({id:e.id,data:{inputs:o.inputs}}),i(e.id)},[d,e.id,u,l,i]),M=(0,K.useMemo)(()=>({availableSources:k,initialMappings:A,onMappingChange:j}),[k,A,j]),N=(0,K.useCallback)(()=>f(),[f]),P=(0,K.useCallback)(()=>{if(!n?.id||!_)return;let t=D.getValues();h.mutate({id:p,projectId:n.id,name:t.name.trim(),config:{evaluatorType:_,settings:t.settings}},{onSuccess:()=>{l({id:e.id,data:{localConfig:void 0}}),m.refetch()}})},[n?.id,p,_,D,h,l,e.id]),ee=(0,K.useCallback)(()=>{O.cancel(),D.reset({name:v,settings:y}),l({id:e.id,data:{localConfig:void 0}})},[D,v,y,l,e.id,O]),F=!!E;return Er((0,K.useMemo)(()=>(0,Z.jsxs)(s,{width:`full`,children:[F&&(0,Z.jsx)(a,{variant:`outline`,size:`sm`,onClick:ee,"data-testid":`evaluator-discard-button`,children:`Discard`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{variant:`outline`,size:`sm`,onClick:P,loading:h.isPending,"data-testid":`evaluator-save-button`,children:`Save`}),(0,Z.jsx)(a,{colorPalette:`blue`,size:`sm`,onClick:N,"data-testid":`evaluator-apply-button`,children:`Apply`})]}),[F,ee,N,P,h.isPending])),m.isLoading?(0,Z.jsx)(s,{justify:`center`,paddingY:8,width:`full`,children:(0,Z.jsx)(r,{size:`md`})}):(0,Z.jsx)(fl,{evaluatorType:_,description:b?.description,isWorkflowEvaluator:w,workflow:T,form:D,settingsSchema:x,hasSettings:S,effectiveEvaluatorDef:C,mappingsConfig:M,variant:`studio`})}function vl({node:e}){let{project:t}=U(),{setNode:n}=G(({setNode:e})=>({setNode:e})),r=B.modelProvider.getResolvedDefault.useQuery({projectId:t?.id??``,featureKey:`prompt.create_default`},{enabled:!!t?.id}),i=B.modelProvider.getResolvedDefault.useQuery({projectId:t?.id??``,featureKey:`analytics.topic_clustering_embeddings`},{enabled:!!t?.id}),a=gt({defaultValues:{settings:Object.fromEntries((e.data.parameters??[]).map(({identifier:e,value:t})=>[e,t]))}}),o=e.data.evaluator,s=o&&o in Hn?Vn.shape[o]?.shape.settings:void 0,c=Gr();(0,K.useEffect)(()=>{if(!o||!c||!(o in c)||e.data.parameters)return;let t=c[o],n=(e,t)=>{e&&Object.entries(e).forEach(([e,r])=>{typeof r==`object`&&!Array.isArray(r)&&r!==null?n(r,`${t}.${e}`):a.setValue(`${t}.${e}`,r)})};n(Un(t,{defaultModel:r.data?.model??null,embeddingsModel:i.data?.model??null}),`settings`)},[o,r.data?.model,i.data?.model]);let l=(0,K.useCallback)(t=>{n({id:e.id,data:{parameters:Object.entries(t.settings).map(([e,t])=>({identifier:e,type:`str`,value:t}))}})},[e.id,n]),u=An((0,K.useCallback)(()=>{a.handleSubmit(l)()},[a,l]),100,{leading:!0,trailing:!1});(0,K.useEffect)(()=>{let e=a.watch(()=>{u()});return()=>e.unsubscribe()},[a,u]);let d=o&&s instanceof At&&Object.keys(s.shape).length>0;return(0,Z.jsx)(qc,{node:e,hideParameters:!!d,children:d&&s&&(0,Z.jsx)(mt,{...a,children:(0,Z.jsx)(m,{width:`full`,gap:3,children:(0,Z.jsx)(br,{schema:s,evaluatorType:o,prefix:`settings`,errors:a.formState.errors.settings,variant:`studio`})})})})}function yl(e,t){return e?.find(e=>e.identifier===t)?.value}function bl(e){let t=yl(e,`auth_type`);if(!(!t||t===`none`))switch(t){case`bearer`:return{type:`bearer`,token:yl(e,`auth_token`)??``};case`api_key`:return{type:`api_key`,header:yl(e,`auth_header`)??``,value:yl(e,`auth_value`)??``};case`basic`:return{type:`basic`,username:yl(e,`auth_username`)??``,password:yl(e,`auth_password`)??``};default:return}}function xl(e){let t=yl(e,`headers`);return!t||typeof t!=`object`?[]:Array.isArray(t)?t:Object.entries(t).map(([e,t])=>({key:e,value:t}))}function Sl({node:e}){let{nodes:t,edges:n,setNode:r,setNodeParameter:a,setEdges:o,getWorkflow:s}=G(R(e=>({nodes:e.getWorkflow().nodes,edges:e.getWorkflow().edges,setNode:e.setNode,setNodeParameter:e.setNodeParameter,setEdges:e.setEdges,getWorkflow:e.getWorkflow}))),c=W(),l=yl(e.data.parameters,`url`)??``,u=yl(e.data.parameters,`method`)??`POST`,d=yl(e.data.parameters,`body_template`)??``,f=yl(e.data.parameters,`output_path`)??``,p=bl(e.data.parameters),m=xl(e.data.parameters),h=(e.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),g=(e.data.outputs??[]).map(e=>({identifier:e.identifier,type:e.type})),_=(0,K.useMemo)(()=>gc({nodeId:e.id,nodes:t,edges:n}),[n,t,e.id]),v=(0,K.useMemo)(()=>_c({nodeId:e.id,edges:n,inputs:e.data.inputs??[]}),[n,e.id,e.data.inputs]),y=(0,K.useCallback)((t,n)=>{let i=s(),a=i.nodes.find(t=>t.id===e.id)?.data.inputs??[],l=vc({nodeId:e.id,identifier:t,mapping:n,currentEdges:i.edges,currentInputs:a});o(l.edges),r({id:e.id,data:{inputs:l.inputs}}),c(e.id)},[s,e.id,o,r,c]),b=(0,K.useCallback)((t,n)=>{a(e.id,{identifier:t,type:`str`,value:n})},[e.id,a]),x=(0,K.useCallback)(e=>b(`url`,e),[b]),S=(0,K.useCallback)(e=>b(`method`,e),[b]),C=(0,K.useCallback)(e=>b(`body_template`,e),[b]),w=(0,K.useCallback)(e=>b(`output_path`,e),[b]),T=(0,K.useCallback)(e=>{let t=e;b(`auth_type`,t?.type??`none`),b(`auth_token`,t?.token??``),b(`auth_header`,t?.header??``),b(`auth_value`,t?.value??``),b(`auth_username`,t?.username??``),b(`auth_password`,t?.password??``)},[b]),E=(0,K.useCallback)(e=>{b(`headers`,Object.fromEntries(e.filter(e=>e.key).map(e=>[e.key,e.value])))},[b]),D=(0,K.useCallback)(t=>{let n=e.data.inputs??[],i=t.map(e=>{let t=n.find(t=>t.identifier===e.identifier);return{identifier:e.identifier,type:e.type,...t?.value==null?{}:{value:t.value}}});r({id:e.id,data:{inputs:i}}),c(e.id)},[e.id,e.data.inputs,r,c]),O=(0,K.useCallback)(t=>{let n=t.map(e=>({identifier:e.identifier,type:e.type}));r({id:e.id,data:{outputs:n}}),c(e.id)},[e.id,r,c]),{handleTest:k}=hr({url:l,method:u,headers:m,auth:p,outputPath:f});return(0,Z.jsxs)(qc,{node:e,hideParameters:!0,hideInputs:!0,hideOutputs:!0,paddingX:0,children:[(0,Z.jsx)(mr,{url:l,onUrlChange:x,method:u,onMethodChange:S,bodyTemplate:d,onBodyTemplateChange:C,outputPath:f,onOutputPathChange:w,auth:p,onAuthChange:T,headers:m,onHeadersChange:E,onTest:k}),(0,Z.jsx)(i,{width:`full`,paddingX:4,children:(0,Z.jsx)(Jn,{variables:h,onChange:D,showMappings:!0,mappings:v,onMappingChange:y,availableSources:_,canAddRemove:!0,readOnly:!1,title:`Inputs`})}),(0,Z.jsx)(i,{width:`full`,paddingX:4,children:(0,Z.jsx)(ct,{outputs:g,onChange:O,canAddRemove:!0,readOnly:!1,title:`Outputs`,availableTypes:ot})})]})}var Cl=new kr;function wl(e,t){if(e.trim()===``)return{missingVariables:[]};let n=`{% if ${e} %}x{% endif %}`;try{Cl.parse(n)}catch(e){return{error:Tl(e),missingVariables:[]}}let r=[];try{r=Cl.variablesSync(n)}catch{r=[]}let i=new Set(t);return{missingVariables:r.filter(e=>!i.has(e))}}function Tl(e){let t=e instanceof Error?e.message:String(e);return(t.split(`
8
- `)[0]??t).replace(/,\s*line:\d+,\s*col:\d+.*$/,``).trim()}var El=Fn(()=>c(()=>import(`./dist-WNeJk3KQ.js`),__vite__mapDeps([0,1,2])),{ssr:!1,loading:()=>(0,Z.jsx)(i,{height:`22px`,flex:`1`})}),Dl=`liquid-condition`,Ol=`liquid-condition`,kl=!1;function Al(e){kl||(kl=!0,e.languages.register({id:Dl}),e.languages.setMonarchTokensProvider(Dl,{ignoreCase:!1,tokenizer:{root:[[/\b(and|or|not|contains)\b/,`keyword`],[/\b(true|false|nil|null|empty|blank)\b/,`constant`],[/"([^"\\]|\\.)*"/,`string`],[/'([^'\\]|\\.)*'/,`string`],[/\d+(\.\d+)?/,`number`],[/(==|!=|>=|<=|>|<)/,`operators`],[/[A-Za-z_]\w*(\.[A-Za-z_]\w*)*/,`identifier`]]}}))}function jl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ml({value:e,onChange:t,placeholder:n,availableVariables:r=[]}){let{colorMode:a}=wt(),o=(0,K.useRef)(null),c=(0,K.useRef)(null),l=(0,K.useMemo)(()=>wl(e,r),[e,r]),u=(0,K.useCallback)(e=>{t((e??``).replace(/\r?\n/g,` `))},[t]),d=(0,K.useCallback)(()=>{let t=c.current,n=o.current?.getModel();if(!t||!n)return;let r=[];l.error&&r.push({severity:t.MarkerSeverity.Error,message:l.error,startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:Math.max(2,e.length+1)});for(let n of l.missingVariables){let i=RegExp(`\\b${jl(n)}\\b`,`g`),a;for(;(a=i.exec(e))!==null;)r.push({severity:t.MarkerSeverity.Warning,message:`Unknown input "${n}" — add it below or fix the name.`,startLineNumber:1,startColumn:a.index+1,endLineNumber:1,endColumn:a.index+1+n.length})}t.editor.setModelMarkers(n,Ol,r)},[l,e]),f=(0,K.useCallback)((e,t)=>{o.current=e,c.current=t,d()},[d]);return(0,K.useEffect)(()=>{d()},[d]),(0,Z.jsxs)(m,{width:`full`,align:`start`,gap:1,children:[(0,Z.jsxs)(s,{width:`full`,height:`38px`,border:`1px solid`,borderColor:l.error?`red.400`:l.missingVariables.length>0?`orange.400`:`border`,borderRadius:`md`,paddingX:`8px`,gap:`6px`,overflow:`hidden`,"data-testid":`if-else-condition-input`,children:[(0,Z.jsx)(p,{fontFamily:`mono`,fontSize:`13px`,color:`fg.muted`,userSelect:`none`,children:`{%`}),(0,Z.jsx)(i,{flex:`1`,minWidth:`0`,height:`22px`,children:(0,Z.jsx)(El,{height:`22px`,language:Dl,theme:ut(a===`dark`?`dark`:`light`),value:e,beforeMount:Al,onMount:f,onChange:u,options:{lineNumbers:`off`,minimap:{enabled:!1},folding:!1,glyphMargin:!1,lineDecorationsWidth:0,lineNumbersMinChars:0,renderLineHighlight:`none`,scrollBeyondLastLine:!1,scrollbar:{vertical:`hidden`,horizontal:`hidden`,handleMouseWheel:!1},overviewRulerLanes:0,hideCursorInOverviewRuler:!0,wordWrap:`off`,fontSize:13,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, monospace`,placeholder:n,fixedOverflowWidgets:!0,contextmenu:!1,automaticLayout:!0}})}),(0,Z.jsx)(p,{fontFamily:`mono`,fontSize:`13px`,color:`fg.muted`,userSelect:`none`,children:`%}`})]}),l.error?(0,Z.jsx)(p,{fontSize:`12px`,color:`red.500`,"data-testid":`if-else-condition-error`,children:l.error}):l.missingVariables.length>0?(0,Z.jsxs)(p,{fontSize:`12px`,color:`orange.600`,"data-testid":`if-else-condition-warning`,children:[`Unknown input`,l.missingVariables.length>1?`s`:``,`:`,` `,l.missingVariables.join(`, `)]}):null]})}var Nl=`https://shopify.github.io/liquid/basics/operators/`;function Pl(e){switch(e){case`str`:return`: str`;case`float`:return`: float`;case`bool`:return`: bool`;default:return``}}function Fl(e){let t=e.map(e=>`${e.identifier}${Pl(e.type)}`).join(`, `),n=e[0]?.identifier;return`def execute(${t}) -> bool:\n # Return True to take the true branch, False otherwise.\n ${n?`return ${n} != ""`:`return True`}\n`}function Il({node:e}){let{nodes:t,edges:n,setNode:r,setNodeParameter:a,setEdges:o,getWorkflow:c}=G(R(e=>({nodes:e.getWorkflow().nodes,edges:e.getWorkflow().edges,setNode:e.setNode,setNodeParameter:e.setNodeParameter,setEdges:e.setEdges,getWorkflow:e.getWorkflow}))),l=W(),u=(e.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),d=(0,K.useMemo)(()=>gc({nodeId:e.id,nodes:t,edges:n}),[n,t,e.id]),f=(0,K.useMemo)(()=>_c({nodeId:e.id,edges:n,inputs:e.data.inputs??[]}),[n,e.id,e.data.inputs]),h=(0,K.useCallback)((t,n)=>{let i=c(),a=i.nodes.find(t=>t.id===e.id)?.data.inputs??[],s=vc({nodeId:e.id,identifier:t,mapping:n,currentEdges:i.edges,currentInputs:a});o(s.edges),r({id:e.id,data:{inputs:s.inputs}}),l(e.id)},[c,e.id,o,r,l]),g=(0,K.useCallback)(t=>{let n=e.data.inputs??[],i=t.map(e=>{let t=n.find(t=>t.identifier===e.identifier);return{identifier:e.identifier,type:e.type,...t?.value==null?{}:{value:t.value}}});r({id:e.id,data:{inputs:i}}),l(e.id)},[e.id,e.data.inputs,r,l]),_=(0,K.useCallback)(t=>e.data.parameters?.find(e=>e.identifier===t)?.value??``,[e.data.parameters]),v=_(`condition`),y=_(`code`),b=_(`condition_language`)===`python`,x=(0,K.useCallback)(t=>{a(e.id,{identifier:`condition`,type:`str`,value:t})},[a,e.id]),S=(0,K.useCallback)(t=>{a(e.id,{identifier:`code`,type:`code`,value:t})},[a,e.id]),C=(0,K.useCallback)(t=>{a(e.id,{identifier:`condition_language`,type:`str`,value:t?`python`:`liquid`}),t&&!y.trim()&&a(e.id,{identifier:`code`,type:`code`,value:Fl(e.data.inputs??[])})},[a,e.id,y,e.data.inputs]);return(0,Z.jsxs)(qc,{node:e,hideParameters:!0,hideInputs:!0,hideOutputs:!0,paddingX:4,children:[(0,Z.jsxs)(m,{width:`full`,align:`start`,gap:2,children:[(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(lt,{children:`Condition`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(Nn,{size:`sm`,checked:b,onCheckedChange:({checked:e})=>C(e),"data-testid":`if-else-code-toggle`,children:`Code`})]}),b?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ur,{code:y,onChange:S,language:`python`,inputs:(e.data.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),viewStateKey:`if-else-condition:${e.id}`}),(0,Z.jsx)(p,{fontSize:`12px`,color:`fg.muted`,children:`Python over the inputs, must return True or False. The not-taken branch is skipped.`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ml,{value:v,onChange:x,placeholder:`e.g. context != ""`,availableVariables:(e.data.inputs??[]).map(e=>e.identifier)}),(0,Z.jsxs)(p,{fontSize:`12px`,color:`fg.muted`,children:[(0,Z.jsxs)(j,{href:Nl,target:`_blank`,rel:`noreferrer`,color:`fg.muted`,textDecoration:`underline`,children:[`Liquid condition`,(0,Z.jsx)(Xt,{size:11,style:{display:`inline`,marginLeft:`2px`}})]}),` `,`over the inputs. The not-taken branch is skipped.`]})]})]}),(0,Z.jsx)(i,{width:`full`,children:(0,Z.jsx)(Jn,{variables:u,onChange:g,showMappings:!0,mappings:f,onMappingChange:h,availableSources:d,canAddRemove:!0,readOnly:!1,title:`Inputs`})})]})}function Ll({node:e}){return(0,Z.jsx)(qc,{node:e,hideInputs:!0,hideOutputs:!0})}function Rl({node:e}){return(0,Z.jsx)(qc,{node:e,hideInputs:!0,hideOutputs:!0})}function zl(){let e=G(e=>e.setNode),t=W();return(0,K.useCallback)((n,r)=>{e(n,r),t(n.id)},[e,t])}function Bl(e,t){if(e.length!==t.length)return!1;let n=new Map(e.map(e=>[e.identifier,e.type]));return t.every(e=>n.get(e.identifier)===e.type)}function Vl({oldFields:e,newFields:t,connectedEdges:n,handlePrefix:r}){let i=new Set(t.map(e=>e.identifier)),a=t.map(t=>{let n=e.find(e=>e.identifier===t.identifier);return{identifier:t.identifier,type:t.type,...n?.value==null?{}:{value:n.value},...`json_schema`in t&&t.json_schema!=null?{json_schema:t.json_schema}:{}}}),o=e.filter(e=>!i.has(e.identifier)&&n.some(t=>t.targetHandle===`${r}.${e.identifier}`||t.sourceHandle===`${r}.${e.identifier}`));return[...a,...o]}function Hl({nodeId:e,oldFields:t,newFields:n,edges:r,connectedEdges:i}){let a=r,o=!1;for(let r=0;r<Math.min(t.length,n.length);r++){let s=t[r]?.identifier,c=n[r]?.identifier;if(!s||!c||s===c)continue;let l=i.some(e=>e.targetHandle===`inputs.${s}`),u=t.some(e=>e.identifier===c);l&&!u&&(o=!0,a=a.map(t=>t.target===e&&t.targetHandle===`inputs.${s}`?{...t,targetHandle:`inputs.${c}`}:t))}return o?a:null}function Ul({node:e}){let t=e,n=zl(),r=W(),{nodes:i,edges:a,setEdges:o,getWorkflow:s,deselectAllNodes:c}=G(R(e=>({nodes:e.getWorkflow().nodes,edges:e.getWorkflow().edges,setEdges:e.setEdges,getWorkflow:e.getWorkflow,deselectAllNodes:e.deselectAllNodes}))),l=(0,K.useMemo)(()=>gc({nodeId:e.id,nodes:i,edges:a}),[a,i,e.id]),u=(0,K.useMemo)(()=>_c({nodeId:e.id,edges:a,inputs:t.data.inputs??[]}),[a,e.id,t.data.inputs]),d=(0,K.useCallback)((t,i)=>{let a=s(),c=a.nodes.find(t=>t.id===e.id)?.data.inputs??[],l=vc({nodeId:e.id,identifier:t,mapping:i,currentEdges:a.edges,currentInputs:c});o(l.edges),n({id:e.id,data:{inputs:l.inputs}}),r(e.id)},[s,e.id,o,n,r]),f=t.data.localPromptConfig,p=(0,K.useMemo)(()=>T(t.data),[t.data]),m=(0,K.useCallback)(i=>{if(!i){n({id:e.id,data:{localPromptConfig:void 0}});return}let a={localPromptConfig:i},c=(t.data.parameters??[]).map(e=>e.identifier===`llm`?{...e,value:i.llm}:e);c.some(e=>e.identifier===`llm`)&&(a.parameters=c);let l=t.data.inputs??[],u=t.data.outputs??[];if(i.inputs&&!Bl(l,i.inputs)){let t=s().edges,n=t.filter(t=>t.target===e.id&&t.targetHandle?.startsWith(`inputs.`));a.inputs=Vl({oldFields:l,newFields:i.inputs,connectedEdges:n,handlePrefix:`inputs`});let r=Hl({nodeId:e.id,oldFields:l,newFields:i.inputs,edges:t,connectedEdges:n});r&&o(r)}if(i.outputs&&!Bl(u,i.outputs)){let t=s().edges.filter(t=>t.source===e.id&&t.sourceHandle?.startsWith(`outputs.`));a.outputs=Vl({oldFields:u,newFields:i.outputs,connectedEdges:t,handlePrefix:`outputs`})}n({id:e.id,data:a}),r(e.id)},[e.id,t.data.inputs,t.data.outputs,t.data.parameters,n,r,s,o]),h=(0,K.useCallback)(e=>{if(!e)return;let n=t.data.inputs??[];return e.map(e=>{let t=n.find(t=>t.identifier===e.identifier);return{identifier:e.identifier,type:e.type,...t?.value==null?{}:{value:t.value}}})},[t.data.inputs]),g=(0,K.useCallback)(t=>{let i={promptId:t.id,promptVersionId:t.versionId,localPromptConfig:void 0,name:t.name},a=h(t.inputs);a&&(i.inputs=a);let o=h(t.outputs);o&&(i.outputs=o),n({id:e.id,data:i}),r(e.id)},[e.id,n,r,h]),_=(0,K.useCallback)(t=>{let i={promptVersionId:t.versionId},a=h(t.inputs);a&&(i.inputs=a);let o=h(t.outputs);o&&(i.outputs=o),n({id:e.id,data:i}),r(e.id)},[e.id,n,r,h]);return(0,Z.jsx)(Or,{headless:!0,onClose:c,promptId:t.data.promptId,promptVersionId:t.data.promptVersionId,initialLocalConfig:f,inlineConfigFallback:p,onLocalConfigChange:m,onSave:g,onVersionChange:_,availableSources:l,inputMappings:u,onInputMappingsChange:d})}var Wl=e(o()),Gl=({fields:e=[],onExecute:t,title:n=`Inputs`,buttonText:r=`Execute`})=>{let i=(0,K.useMemo)(()=>Object.fromEntries(e.map(e=>[e.identifier,typeof e.value==`object`?JSON.stringify(e.value):e.value??``])),[JSON.stringify(e)]),o=gt({defaultValues:i,resolver:t=>{let n={},r=e.filter(e=>!e.optional).filter(e=>!t[e.identifier]||t[e.identifier]===``);for(let e of r)n[e.identifier]={type:`required`,message:`This field is required`};return{values:Object.keys(n).length>0?{}:t,errors:n}}}),c=o.watch();(0,K.useEffect)(()=>{JSON.stringify(c)!==JSON.stringify(i)&&o.reset(i)},[i]);let l=(0,K.useCallback)(e=>{t(e)},[t]);return(0,Z.jsx)(`form`,{onSubmit:o.handleSubmit(l),children:(0,Z.jsxs)(m,{align:`start`,gap:3,width:`full`,children:[(0,Z.jsx)(f,{as:`h3`,fontSize:`16px`,fontWeight:`bold`,textTransform:`uppercase`,color:`fg.muted`,paddingBottom:4,children:n}),e.map(e=>e.identifier?(0,Z.jsxs)(jn,{label:e.identifier,helper:``,invalid:!!o.formState.errors[e.identifier],children:[(0,Z.jsx)(Ke,{...o.register(e.identifier),placeholder:e.type===`image`?`image url`:e.type===`str`?void 0:e.type}),(0,Z.jsx)(ue,{children:o.formState.errors[e.identifier]?.message})]},e.identifier):null),(0,Z.jsx)(s,{width:`full`,justify:`end`,children:(0,Z.jsxs)(a,{type:`submit`,colorPalette:`green`,loading:o.formState.isSubmitting,loadingText:r,children:[r,` `,(0,Z.jsx)(sn,{size:16})]})})]})})},Kl=({node:e})=>{let{inputs:t,missingFields:n}=Ac({node:e}),[r,a]=(0,K.useState)(!1),{triggerValidation:o,setTriggerValidation:s}=G(e=>({triggerValidation:e.triggerValidation,setTriggerValidation:e.setTriggerValidation})),{startComponentExecution:c}=kc(),l=(0,K.useMemo)(()=>e.data.inputs?.map(e=>({identifier:e.identifier,type:e.type,optional:!n.some(t=>t.identifier===e.identifier),value:t[e.identifier]}))??[],[e.data.inputs,n,t]),u=(0,K.useCallback)(t=>{c({node:e,inputs:t})},[e,c]);return(0,K.useEffect)(()=>{let e=setTimeout(()=>{a(!0)},700);return()=>clearTimeout(e)},[]),(0,K.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>{l.length>0&&u(Object.fromEntries(l.map(e=>[e.identifier,typeof e.value==`object`?JSON.stringify(e.value):e.value?.toString()??``])))},r?0:700);return s(!1),()=>clearTimeout(e)},[r,l,u,s,o]),(0,Z.jsx)(i,{background:`bg`,height:`full`,padding:6,border:`1px solid`,borderColor:`border.emphasized`,borderRadius:`8px 0 0 8px`,borderRightWidth:0,boxShadow:`0 0 10px rgba(0,0,0,0.05)`,overflowY:`auto`,children:(0,Z.jsx)(Gl,{fields:l,onExecute:u,title:`Inputs`,buttonText:`Execute`})})},ql=e(y()),Jl=({executionState:e,isTracingEnabled:t=!1,nodeType:n})=>{let[r]=Ct(e?.status===`waiting`,600),i=e?.status===`success`||e?.status===`error`;return(0,Z.jsxs)(m,{align:`start`,gap:3,children:[(0,Z.jsxs)(s,{align:`center`,width:`full`,paddingBottom:3,children:[(0,Z.jsx)(f,{as:`h3`,fontSize:`16px`,fontWeight:`bold`,textTransform:`uppercase`,color:`fg.muted`,paddingBottom:4,children:`Outputs`}),(0,Z.jsx)(z,{}),e?.timestamps&&i&&(0,Z.jsx)(Yl,{executionState:e,isTracingEnabled:t})]}),Xl(e,r,n)]})},Yl=({executionState:e,isTracingEnabled:t})=>{let{openDrawer:n}=kt(),r=e.timestamps?.started_at&&e.timestamps?.finished_at;return(0,Z.jsxs)(s,{gap:3,children:[e.cost!==void 0&&(0,Z.jsx)(p,{color:`fg.muted`,children:(0,ql.default)(e.cost).format(`$0.00[000]a`)}),r&&(0,Z.jsxs)(Z.Fragment,{children:[e.cost!==void 0&&(0,Z.jsx)(p,{color:`fg.subtle`,children:`·`}),(0,Z.jsx)(Gn,{span:{error:e?.status===`error`?e.error:void 0,timestamps:{started_at:e.timestamps?.started_at??0,finished_at:e.timestamps?.finished_at??0}}})]}),t&&e?.trace_id&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{color:`fg.subtle`,children:`·`}),(0,Z.jsx)(a,{size:`sm`,onClick:()=>{n(`traceDetails`,{traceId:e.trace_id??``})},children:`Full Trace`})]})]})},Xl=(e,t,n)=>e?(0,Z.jsxs)(Z.Fragment,{children:[Zl(e,t),Ql(e),$l(e,n)]}):(0,Z.jsx)(p,{color:`fg.muted`,children:`Waiting for execution`}),Zl=(e,t)=>t&&e.status===`waiting`?(0,Z.jsx)(p,{children:`Waiting for runner`}):!t&&e.status===`waiting`||e.status===`running`?(0,Z.jsx)(p,{children:`Running...`}):null,Ql=e=>e.status===`error`?(0,Z.jsxs)(m,{width:`full`,align:`start`,gap:3,children:[(0,Z.jsx)(p,{fontSize:`13px`,fontWeight:`bold`,textTransform:`uppercase`,color:`fg.muted`,children:`Error`}),(0,Z.jsx)(eu,{color:`red.700`,value:e.error??`No error message captured`})]}):null,$l=(e,t)=>{if(e.status!==`success`||!e.outputs)return null;if(t===`if_else`){let t=e.outputs,n=`true`in t?t.true:!t.false;return(0,Z.jsxs)(m,{width:`full`,align:`start`,gap:3,children:[(0,Z.jsx)(p,{fontSize:`13px`,fontWeight:`bold`,textTransform:`uppercase`,color:`gray.600`,children:`Condition`}),(0,Z.jsx)(eu,{value:n})]})}return Object.entries(e.outputs).filter(([e,t])=>t!==null).map(([e,n])=>{let r=t===`evaluator`&&e===`passed`&&n===!1||e===`status`&&n===`error`,i=t===`evaluator`&&e===`status`&&n===`skipped`,a=t===`evaluator`&&e===`passed`&&n===!0;return(0,Z.jsxs)(m,{width:`full`,align:`start`,gap:3,color:i?`yellow.600`:r?`red.600`:a?`green.600`:void 0,children:[(0,Z.jsx)(p,{fontSize:`13px`,fontWeight:`bold`,textTransform:`uppercase`,color:i?`yellow.600`:r?`red.600`:a?`green.600`:`gray.600`,children:e}),(0,Z.jsx)(eu,{value:n})]},e)})},eu=({value:e,...t})=>(0,Z.jsx)(i,{as:`pre`,borderRadius:`6px`,padding:4,borderWidth:`1px`,borderColor:`border.emphasized`,width:`full`,whiteSpace:`pre-wrap`,...t,children:(0,Z.jsx)(S,{field:`output`,children:(0,Z.jsx)(Ln,{value:e,showTools:!0})})}),tu=({node:e})=>{let{enableTracing:t}=G(R(e=>({enableTracing:e.enable_tracing})));return(0,Z.jsx)(i,{background:`bg`,height:`full`,padding:6,border:`1px solid`,borderColor:`border.emphasized`,borderRadius:`0 8px 8px 0`,borderLeftWidth:0,boxShadow:`0 0 10px rgba(0,0,0,0.05)`,overflowY:`auto`,children:(0,Z.jsx)(Jl,{executionState:e.data.execution_state,isTracingEnabled:t,nodeType:e.type})})};function nu(e){return e.type!==`entry`&&e.type!==`end`}function ru({node:e,children:t,onClose:n,footer:r}){let{deselectAllNodes:o,propertiesExpanded:c,setPropertiesExpanded:l,duplicateNode:u,deleteNode:d}=G(R(e=>({deselectAllNodes:e.deselectAllNodes,propertiesExpanded:e.propertiesExpanded,setPropertiesExpanded:e.setPropertiesExpanded,duplicateNode:e.duplicateNode,deleteNode:e.deleteNode}))),[f,p]=(0,K.useState)(null),m=r??f,h=e!==void 0,g=e!==void 0&&nu(e);(0,K.useEffect)(()=>{e||l(!1)},[e,l]),(0,K.useEffect)(()=>{let e=e=>{let t=document.querySelector(`.chakra-popover__popper`)!==null;e.key===`Escape`&&c&&!t&&(l(!1),e.stopPropagation(),e.preventDefault())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[c,l]);let _=()=>{c?l(!1):(o(),n())},{width:v,height:y}=Dt(),b=Math.round((v??0)/2-256),x=(y??0)-49-1,S=Pt.div,C=e?(0,Z.jsxs)(s,{width:`full`,justify:`space-between`,gap:0,children:[(0,Z.jsxs)(s,{gap:2,overflow:`hidden`,flex:1,minWidth:0,children:[(0,Z.jsx)(Vt,{type:e.type,cls:e.data.cls,size:`lg`}),(0,Z.jsx)(zn,{lineClamp:2,fontSize:`15px`,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,expandable:!1,children:Nc(e)})]}),(0,Z.jsxs)(s,{gap:0,flexShrink:0,children:[g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Bc,{node:e,size:`sm`,iconSize:16}),(0,Z.jsx)(k,{content:c?`Collapse input and output panels`:`Expand input and output panels`,showArrow:!0,positioning:{placement:`top`},openDelay:0,closeDelay:0,children:(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,color:`fg.muted`,onClick:()=>l(!c),children:(0,Z.jsx)(mi,{size:16})})})]}),nu(e)&&(0,Z.jsxs)(P.Root,{positioning:{placement:`bottom-end`},children:[(0,Z.jsx)(P.Trigger,{asChild:!0,children:(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,color:`fg.muted`,"aria-label":`Node actions`,children:(0,Z.jsx)(Si,{size:16})})}),(0,Z.jsxs)(P.Content,{children:[(0,Z.jsxs)(P.Item,{value:`duplicate`,onClick:()=>u(e.id),children:[(0,Z.jsx)(qt,{size:14}),`Duplicate`]}),(0,Z.jsxs)(P.Item,{value:`delete`,onClick:()=>{d(e.id),l(!1),o(),n()},children:[(0,Z.jsx)(ln,{size:14}),`Delete`]})]})]}),(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,color:`fg.muted`,onClick:_,children:(0,Z.jsx)(fn,{size:16})})]})]}):null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Oe.Root,{open:h&&!c,onOpenChange:({open:e})=>{e||_()},size:`md`,closeOnInteractOutside:!1,modal:!1,children:(0,Z.jsxs)(Oe.Content,{bg:`bg`,marginTop:`56px`,children:[e&&(0,Z.jsx)(Oe.Header,{paddingTop:4,paddingBottom:3,paddingLeft:4,paddingRight:3,children:C}),(0,Z.jsx)(Oe.Body,{display:`flex`,flexDirection:`column`,overflow:`auto`,padding:0,children:(0,Z.jsx)(Dr.Provider,{value:p,children:t})}),m&&(0,Z.jsx)(Oe.Footer,{borderTopWidth:`1px`,borderColor:`border`,paddingX:4,paddingY:3,children:m})]})}),c&&e&&(0,Wl.createPortal)((0,Z.jsxs)(i,{position:`fixed`,top:`49px`,left:0,width:`100vw`,height:`${x}px`,zIndex:1500,children:[(0,Z.jsxs)(S,{initial:{right:0,height:`${x}px`,marginTop:0,borderRadius:0,boxShadow:`0 0 0 rgba(0,0,0,0)`},animate:{right:`${b}px`,height:`${x-40}px`,marginTop:`20px`,borderRadius:`8px`,boxShadow:`0 0 10px rgba(0,0,0,0.1)`},transition:{duration:.4,ease:`easeInOut`,delay:.1},style:{position:`absolute`,top:0,right:0,width:`512px`,display:`flex`,flexDirection:`column`,background:`var(--chakra-colors-bg)`,border:`1px solid`,borderColor:`var(--chakra-colors-border-emphasized)`,zIndex:100,overflow:`hidden`},children:[(0,Z.jsx)(i,{paddingY:2,paddingX:3,borderBottomWidth:`1px`,borderColor:`border`,flexShrink:0,children:C}),(0,Z.jsx)(i,{flex:1,overflowY:`auto`,overflowX:`hidden`,children:(0,Z.jsx)(Dr.Provider,{value:p,children:t})}),m&&(0,Z.jsx)(i,{borderTopWidth:`1px`,borderColor:`border`,paddingX:4,paddingY:3,flexShrink:0,children:m})]}),(0,Z.jsx)(i,{className:`fade-in`,position:`absolute`,top:0,left:0,height:`100%`,width:`100%`,background:`rgba(0,0,0,0.1)`,zIndex:98,onClick:()=>l(!1)}),(0,Z.jsx)(i,{position:`absolute`,top:0,left:0,height:`100%`,width:`calc(50% - 256px)`,overflow:`hidden`,zIndex:99,children:(0,Z.jsx)(S,{style:{width:`100%`,height:`100%`,paddingTop:`40px`,paddingBottom:`40px`,paddingLeft:`40px`},initial:{x:`110%`},animate:{x:`0%`},transition:{duration:.1,ease:`easeOut`,delay:.5},className:`js-outer-box`,onClick:e=>{e.target.classList.contains(`js-outer-box`)&&l(!1)},children:(0,Z.jsx)(Kl,{node:e})})}),(0,Z.jsx)(i,{position:`absolute`,top:0,right:0,height:`100%`,width:`calc(50% - 256px)`,overflow:`hidden`,zIndex:99,children:(0,Z.jsx)(S,{style:{width:`100%`,height:`100%`,paddingTop:`40px`,paddingBottom:`40px`,paddingRight:`40px`},initial:{x:`-110%`},animate:{x:`0%`},transition:{duration:.1,ease:`easeOut`,delay:.5},className:`js-outer-box`,onClick:e=>{e.target.classList.contains(`js-outer-box`)&&l(!1)},children:(0,Z.jsx)(tu,{node:e})})})]}),document.body)]})}var iu={entry:dl,end:sl,signature:Ul,code:el,http:Sl,agent:Qc,custom:nl,retriever:Rl,prompting_technique:Ll,evaluator:gl,if_else:Il};function au(){let{selectedNode:e,deselectAllNodes:t,isDraggingNode:n,clickedNodeId:r}=G(R(e=>({selectedNode:e.nodes.find(e=>e.selected),deselectAllNodes:e.deselectAllNodes,isDraggingNode:e.isDraggingNode,clickedNodeId:e.clickedNodeId}))),{currentDrawer:i}=kt(),a=e?.type===`evaluator`&&!e.data.evaluator,o=e?.type===`agent`&&!e.data.agent,s=!!i,c=e&&r===e.id,l=!s&&!a&&!o&&!n&&c?e:void 0,u=l?iu[l.type]:void 0;return(0,Z.jsx)(Tr,{children:(0,Z.jsx)(ru,{node:l,onClose:t,children:l&&u&&(0,Z.jsx)(u,{node:l},l.id)})})}function ou(e){let{hoveredNodeId:t,nodes:n}=G(({hoveredNodeId:e,nodes:t})=>({hoveredNodeId:e,nodes:t})),r=!!e.selected||0,[i]=bn(e),a=Et(`#DDDDDD`,`#3d3d4d`);return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Tn,{path:i,markerEnd:e.markerEnd,style:{stroke:r?Rc:a,strokeWidth:r?1.5:2}})})}var su=()=>{let{postEvent:e,socketStatus:t}=jr(),{getWorkflow:n,setEvaluationState:r,setOpenResultsPanelRequest:i}=G(e=>({getWorkflow:e.getWorkflow,setEvaluationState:e.setEvaluationState,setOpenResultsPanelRequest:e.setOpenResultsPanelRequest})),a=(0,K.useRef)(n);a.current=n;let o=(0,K.useRef)(r);o.current=r;let s=(0,K.useCallback)(()=>t===`connected`?!0:(M.create({title:`Studio is not connected yet`,type:`error`,duration:5e3,meta:{closable:!0}}),!1),[t]),c=(0,K.useRef)([]);(0,K.useEffect)(()=>()=>{c.current.forEach(clearTimeout),c.current=[]},[]);let l=(0,K.useCallback)(({run_id:e,timeout_on_status:t,delayMs:n})=>{let r=setTimeout(()=>{let n=a.current();n.state.evaluation?.run_id===e&&n.state.evaluation?.status===t&&(o.current({status:`error`,error:`Timeout`,timestamps:{finished_at:Date.now()}}),M.create({title:`Timeout ${t===`waiting`?`starting`:`stopping`} evaluation execution`,type:`error`,duration:5e3,meta:{closable:!0}}))},n);c.current.push(r)},[]);return{startEvaluationExecution:(0,K.useCallback)(({workflow_version_id:t,evaluate_on:a,dataset_entry:o})=>{if(!s())return;let c=`run_${Ie()}`;i(`closed`),r({status:`waiting`,run_id:c,progress:0,total:0});let u=n();e({type:`execute_evaluation`,payload:{run_id:c,workflow:{...u,nodes:Nr(u.nodes)},workflow_version_id:t,evaluate_on:a,dataset_entry:o,origin:`evaluation`}}),l({run_id:c,timeout_on_status:`waiting`,delayMs:2e4})},[s,i,r,n,e,l]),stopEvaluationExecution:(0,K.useCallback)(({run_id:t})=>{if(!s())return;let i=n();if(i.state.evaluation?.status===`waiting`){r({status:`idle`,run_id:void 0});return}e({type:`stop_evaluation_execution`,payload:{workflow:{...i,nodes:Nr(i.nodes)},run_id:t}}),l({run_id:t,timeout_on_status:`running`,delayMs:1e4})},[s,r,e,n,l])}},cu=({workflow:e,extra_llms:t})=>{let{modelProviders:n}=U(),r=Object.values(n??{}).filter(e=>!e.enabled&&!e.customKeys),i=e.nodes.filter(e=>e.data.parameters?.find(e=>e.type===`llm`)),a=new Set((e=>e.flatMap(e=>`data`in e&&typeof e.data==`object`?e.data.parameters?.filter(e=>e.type===`llm`).map(e=>e.value?.model?.split(`/`)[0]):[]).filter(e=>e!==void 0&&e!==``))(i));for(let e of t??[]){let t=e.model?.split(`/`)[0];t&&a.add(t)}let o=Array.from(a).filter(e=>r.some(t=>t.provider===e));return{nodeProvidersWithoutCustomKeys:o,hasProvidersWithoutCustomKeys:o.length>0}};function lu(){let{open:e,onToggle:t,onClose:n,setOpen:r}=w(),{project:i}=U(),{evaluationState:o}=G(({state:e})=>({evaluationState:e.evaluation})),s=o?.status===`running`,c=gt({defaultValues:{version:``,commitMessage:``,evaluateOn:void 0}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{content:s?`Evaluation is running`:``,children:(0,Z.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>{hn(`evaluate_click`,{project_id:i?.id}),c.reset({version:``,commitMessage:``,evaluateOn:void 0}),t()},disabled:s,children:[(0,Z.jsx)(oi,{size:16}),` Evaluate`]})}),(0,Z.jsx)(H.Root,{open:e,onOpenChange:({open:e})=>r(e),children:e&&(0,Z.jsx)(uu,{form:c,onClose:n})})]})}function uu({form:e,onClose:t}){let{project:n}=U(),{checkAndProceed:r}=kn(`experiments`),{workflowId:i,getWorkflow:o,evaluationState:c,deselectAllNodes:l,setOpenResultsPanelRequest:u,setLastCommittedWorkflow:d,setCurrentVersionId:f,currentVersionId:h,checkCanCommitNewVersion:g}=G(({workflow_id:e,getWorkflow:t,state:n,deselectAllNodes:r,setOpenResultsPanelRequest:i,setLastCommittedWorkflow:a,setCurrentVersionId:o,currentVersionId:s,checkCanCommitNewVersion:c})=>({workflowId:e,getWorkflow:t,evaluationState:n.evaluation,deselectAllNodes:r,setOpenResultsPanelRequest:i,setLastCommittedWorkflow:a,setCurrentVersionId:o,currentVersionId:s,checkCanCommitNewVersion:c})),{hasProvidersWithoutCustomKeys:_,nodeProvidersWithoutCustomKeys:v}=cu({workflow:o()}),y=o().nodes.find(e=>e.type===`entry`),{total:b,query:x}=cl({dataset:y?.data.dataset,preview:!0}),S=vt({control:e.control,name:`evaluateOn`}),C=vt({control:e.control,name:`commitMessage`});(0,K.useEffect)(()=>{S||e.setValue(`evaluateOn`,b&&b>50?j[1]:j[0])},[e,b,S]);let w=y?.data.dataset?.name,T=y?.data.train_size??.8,E=y?.data.test_size??.2,D=T<1||E<1,{train:O,test:A}=Qt(Array.from({length:b??0},(e,t)=>t),{trainSize:T,testSize:E}),j=[{label:`Full dataset`,value:`full`,description:`Full ${w} dataset`},{label:`Test entries`,value:`test`,description:D?`${Math.round(E*100)}% of ${w} dataset`:`${A.length} entries`},{label:`Train entries`,value:`train`,description:D?`${Math.round(T*100)}% of ${w} dataset`:`${O.length} entries`},{label:`Specific entry`,value:`specific`,description:`Specific entry from ${w} dataset`}],N=(0,K.useMemo)(()=>S?.value===`full`?b:S?.value===`test`?A.length:S?.value===`train`?O.length:+(S?.value===`specific`),[S,b,O.length,A.length]),P=g(),ee=B.useContext(),F=B.workflow.commitVersion.useMutation(),{startEvaluationExecution:te}=su(),[I,ne]=(0,K.useState)(!1);(0,K.useEffect)(()=>{I&&c?.status===`running`&&(t(),l(),u(`evaluations`))},[c?.status,I,t,l,u]);let L=(0,K.useCallback)(async({version:e,commitMessage:t,evaluateOn:a})=>{if(!(!n||!i)&&N&&a&&!(N>=300&&!confirm(`Going to evaluate ${N} entries. Are you sure?`))){if(N>=5e3){alert(`A maximum of 5000 entries can be evaluated at a time. Please contact support if you need to evaluate more.`);return}await r(async()=>{let r;if(P)try{r=(await F.mutateAsync({projectId:n.id,workflowId:i,commitMessage:t,dsl:{...o(),version:e}})).id,d(o()),f(r)}catch(e){throw M.create({title:`Error saving version`,type:`error`,duration:5e3,meta:{closable:!0}}),e}else r=h;if(!r){M.create({title:`Version ID not found for evaluation`,type:`error`,duration:5e3,meta:{closable:!0}});return}ee.workflow.getVersions.invalidate(),te({workflow_version_id:r,evaluate_on:a.value,dataset_entry:a.value===`specific`?a.datasetEntry:void 0}),ne(!0)})}},[P,r,F,h,N,o,n,f,d,te,ee.workflow.getVersions,i]);if(c?.status===`running`)return null;let re=P&&!C,ie=b===void 0&&x.isFetching,ae=_?`Set up your API keys to run evaluations`:ie?!1:!N||N<1?`You need at least 1 dataset entry to run evaluations`:re?`You need to provide a version description`:!1;return(0,Z.jsx)(mt,{...e,children:(0,Z.jsxs)(H.Content,{bg:`bg`,as:`form`,onSubmit:e.handleSubmit(L),borderTop:`5px solid`,borderTopColor:`green.400`,children:[(0,Z.jsxs)(H.Header,{children:[(0,Z.jsx)(H.Title,{fontWeight:600,children:`Evaluate Workflow`}),(0,Z.jsx)(H.CloseTrigger,{})]}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:4,children:[(0,Z.jsx)(m,{align:`start`,width:`full`,children:(0,Z.jsx)(Qe,{})}),(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:2,children:[(0,Z.jsx)(In,{children:`Evaluate on`}),(0,Z.jsx)(_t,{control:e.control,name:`evaluateOn`,rules:{required:`Evaluate on is required`},render:({field:e})=>(0,Z.jsx)(du,{field:e,options:j,total:b})})]})]})}),(0,Z.jsx)(H.Footer,{borderTop:`1px solid`,borderColor:`border`,marginTop:4,children:(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:3,children:[_&&(0,Z.jsx)(yr,{runWhat:`run evaluations`,nodeProvidersWithoutCustomKeys:v}),(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(p,{fontWeight:500,children:ie?`Loading dataset...`:`${N??0} entries`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(k,{content:ae,children:(0,Z.jsxs)(a,{variant:`outline`,type:`submit`,disabled:!!ae,loading:ie||F.isLoading||c?.status===`waiting`,children:[(0,Z.jsx)(oi,{size:16}),P?`Save & Run Evaluation`:`Run Evaluation`]})})]})]})})]})})}var du=({field:e,options:t,total:n})=>{let r=E({items:t});return(0,Z.jsxs)(m,{width:`100%`,gap:2,children:[(0,Z.jsxs)(D.Root,{...e,collection:r,value:e.value?.value?[e.value.value]:[],onChange:void 0,onValueChange:n=>{let r=t.find(e=>e.value===n.value[0]);e.onChange({target:{name:e.name,value:r}})},width:`100%`,children:[(0,Z.jsx)(D.Trigger,{children:(0,Z.jsx)(D.ValueText,{placeholder:`Select dataset split`})}),(0,Z.jsx)(D.Content,{children:t.map(e=>(0,Z.jsx)(D.Item,{item:e,children:(0,Z.jsxs)(m,{align:`start`,width:`full`,children:[(0,Z.jsx)(p,{children:e.label}),(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:e.description})]})},e.value))})]}),e.value?.value===`specific`&&(0,Z.jsx)(V,{type:`text`,placeholder:`Enter row index (0-${(n??0)-1})`,value:String(e.value.datasetEntry??``),onChange:t=>{let n=t.target.value;if(n===``||/^[0-9]*$/.test(n)){let t=n===``?void 0:parseInt(n);e.onChange({target:{name:e.name,value:{...e.value,datasetEntry:t,label:t===void 0?`Specific entry`:`Entry ${t}`}}})}}})]})};function fu(){let{openDrawer:e,closeDrawer:t}=kt(),{setNode:n,deleteNode:r,setSelectedNode:i}=G(e=>({setNode:e.setNode,deleteNode:e.deleteNode,setSelectedNode:e.setSelectedNode})),a=(0,K.useRef)(null);return{handleAgentDragEnd:(0,K.useCallback)(o=>{a.current=o.node.id,St(`agentList`,{onSelect:e=>{if(a.current){n({id:a.current,data:fc(e)});let r=a.current;a.current=null,t(),i(r)}},onCreateNew:()=>{let r=e=>{if(a.current){n({id:a.current,data:fc(e)});let r=a.current;a.current=null,t(),i(r)}};St(`agentHttpEditor`,{onSave:r}),St(`agentCodeEditor`,{onSave:r}),St(`workflowSelector`,{onSave:r}),e(`agentTypeSelector`)},onClose:()=>{a.current&&=(r(a.current),null),t()}}),setTimeout(()=>{e(`agentList`,void 0,{resetStack:!0})},0)},[e,t,n,r,i]),pendingAgentRef:a}}var pu={contexts:`list`,expected_contexts:`list`,conversation:`list`};function mu(e){let t=Hn[e];if(!t)return{inputs:[{identifier:`output`,type:`str`},{identifier:`expected_output`,type:`str`,optional:!0}],outputs:[{identifier:`passed`,type:`bool`}]};let n=[...(t.requiredFields??[]).map(e=>({identifier:e,type:pu[e]??`str`})),...(t.optionalFields??[]).map(e=>({identifier:e,type:pu[e]??`str`,optional:!0}))],r=[];return t.result.score&&r.push({identifier:`score`,type:`float`}),t.result.passed&&r.push({identifier:`passed`,type:`bool`}),t.result.label&&r.push({identifier:`label`,type:`str`}),{inputs:n,outputs:r}}function hu(){let{openDrawer:e,closeDrawer:t}=kt(),{setNode:n,deleteNode:r,setSelectedNode:i}=G(e=>({setNode:e.setNode,deleteNode:e.deleteNode,setSelectedNode:e.setSelectedNode})),a=(0,K.useRef)(null);return{handleEvaluatorDragEnd:(0,K.useCallback)(o=>{a.current=o.node.id,St(`evaluatorList`,{onSelect:e=>{if(a.current){let r=(e.fields??[]).map(e=>({identifier:e.identifier,type:e.type,...e.optional?{optional:!0}:{}})),o=(e.outputFields??[]).map(e=>({identifier:e.identifier,type:e.type}));n({id:a.current,data:{name:e.name,evaluator:`evaluators/${e.id}`,inputs:r,outputs:o}});let s=a.current;a.current=null,t(),i(s)}},onCreateNew:()=>{let r=e=>{if(a.current){let{inputs:r,outputs:o}=e.evaluatorType?mu(e.evaluatorType):{inputs:[],outputs:[{identifier:`passed`,type:`bool`}]};n({id:a.current,data:{name:e.name,evaluator:`evaluators/${e.id}`,inputs:r,outputs:o}});let s=a.current;return a.current=null,t(),i(s),!0}};St(`evaluatorEditor`,vr({onSave:r})),St(`workflowSelectorForEvaluator`,{onSave:r}),e(`evaluatorCategorySelector`)},onClose:()=>{a.current&&=(r(a.current),null),t()}}),setTimeout(()=>{e(`evaluatorList`,void 0,{resetStack:!0})},0)},[e,t,n,r,i]),pendingEvaluatorRef:a}}function gu(){let{openDrawer:e,closeDrawer:t}=kt(),{setNode:n,deleteNode:r,setSelectedNode:i}=G(e=>({setNode:e.setNode,deleteNode:e.deleteNode,setSelectedNode:e.setSelectedNode})),a=(0,K.useRef)(null);return{handlePromptDragEnd:(0,K.useCallback)(o=>{a.current=o.node.id,St(`promptList`,{onSelect:e=>{if(a.current){let r=a.current;n({id:r,data:{name:e.name,promptId:e.id,promptVersionId:e.versionId,configId:e.id,versionMetadata:e.versionId?{versionId:e.versionId,versionNumber:e.version??0,versionCreatedAt:new Date().toISOString()}:void 0,inputs:(e.inputs??[]).map(e=>({identifier:e.identifier,type:e.type})),outputs:(e.outputs??[]).map(e=>({identifier:e.identifier,type:e.type}))}}),a.current=null,t(),i(r)}else t()},onCreateNew:()=>{let e=a.current;a.current=null,t(),e&&i(e)},onClose:()=>{a.current&&=(r(a.current),null),t()}}),setTimeout(()=>{e(`promptList`,void 0,{resetStack:!0})},0)},[e,t,n,r,i]),pendingPromptRef:a}}var _u=e=>Object.entries(e).filter(([e,t])=>!(t.requiredFields.includes(`conversation`)||t.optionalFields.includes(`conversation`)||e.startsWith(`example/`))).map(([t])=>vu(t,e)),vu=(e,t)=>{let n=t[e];if(!n)throw Error(`Evaluator type ${e} not found`);let r=[],i=[];n.requiredFields.forEach(e=>{r.push({identifier:e,type:e===`contexts`||e===`expected_contexts`?`list[str]`:`str`})}),n.optionalFields.forEach(e=>{r.push({identifier:e,type:e===`contexts`||e===`expected_contexts`?`list[str]`:`str`,optional:!0})});let a=[`conversation`,`input`,`contexts`,`output`,`expected_output`,`expected_contexts`];return r=r.sort((e,t)=>a.indexOf(e.identifier)-a.indexOf(t.identifier)),n.result.score&&i.push({identifier:`score`,type:`float`}),n.result.passed&&i.push({identifier:`passed`,type:`bool`}),n.result.label&&i.push({identifier:`label`,type:`str`}),{cls:`LangWatchEvaluator`,evaluator:e,name:(Sr[n.name]??n.name).replace(`Evaluator`,``).trim(),description:n.description,inputs:r,outputs:i}},yu=b.version.configData,bu=yu.messages.find(e=>e.role===`system`),xu=yu.messages.filter(e=>e.role!==`system`),Su=yu.inputs[0],Cu=yu.outputs[0],wu={name:`Prompt`,description:`LLM calling node`,parameters:[{identifier:`llm`,type:`llm`,value:{model:`openai/gpt-4o`,temperature:0,max_tokens:2048}},{identifier:`prompting_technique`,type:`prompting_technique`,value:void 0},{identifier:`instructions`,type:`str`,value:bu.content},{identifier:`messages`,type:`chat_messages`,value:xu},{identifier:`demonstrations`,type:`dataset`,value:void 0}],inputs:yu.inputs.map(e=>({identifier:e.identifier,type:e.type})),outputs:yu.outputs.map(e=>({identifier:e.identifier,type:e.type}))},Tu={name:`Code`,description:`Python code block`,parameters:[{identifier:`code`,type:`code`,value:`class Code:
9
- def __call__(self, ${Su?.identifier??`input`}: str = None):
10
- # Your code goes here
11
-
12
- return {"${Cu?.identifier??`output`}": "Hello world!"}
13
- `}],inputs:yu.inputs.map(e=>({identifier:e.identifier,type:e.type})),outputs:yu.outputs.map(e=>({identifier:e.identifier,type:e.type}))},Eu=[{cls:`ChainOfThought`,name:`ChainOfThought`,description:`Drag and drop to an LLM signature to add a chain of thought prompting technique, adding a reasoning step to the LLM.`,parameters:[]}],Du=[`langevals/exact_match`,`langevals/llm_answer_match`,`ragas/factual_correctness`,`lingua/language_detection`,`langevals/llm_boolean`,`langevals/llm_score`,`langevals/llm_category`,`ragas/faithfulness`,`ragas/context_precision`,`ragas/context_recall`,`ragas/context_f1`,`ragas/response_relevancy`,`ragas/response_context_precision`,`ragas/response_context_recall`,`ragas/summarization_score`,`langevals/basic`,`azure/prompt_injection`,`openai/moderation`,`presidio/pii_detection`,`langevals/valid_format`,`ragas/rubrics_based_scoring`,`ragas/sql_query_equivalence`,`ragas/bleu_score`,`ragas/rouge_score`],Ou={signature:wu,code:Tu,http:{name:`HTTP Call`,description:`Make an HTTP request to an external API`,parameters:[{identifier:`url`,type:`str`,value:`https://api.example.com/endpoint`},{identifier:`method`,type:`str`,value:`POST`},{identifier:`body_template`,type:`str`,value:`{
14
- "input": "{{input}}"
15
- }`},{identifier:`output_path`,type:`str`,value:``}],inputs:[{identifier:`input`,type:`str`}],outputs:[{identifier:`output`,type:`str`}]},agent:{name:`Agent`,description:`Connect to an agent (HTTP, code, or workflow)`,inputs:[{identifier:`input`,type:`str`}],outputs:[{identifier:`output`,type:`str`}]},ifElse:{name:`If/Else`,description:`Route execution down the true or false branch based on a condition over the inputs`,parameters:[{identifier:`condition`,type:`str`,value:`input != ""`},{identifier:`condition_language`,type:`str`,value:`liquid`}],inputs:[{identifier:`input`,type:`str`}],outputs:[{identifier:`true`,type:`bool`},{identifier:`false`,type:`bool`}]},promptingTechniques:Eu,evaluators:[..._u(Object.fromEntries(Object.entries(Hn).filter(([e,t])=>Du.includes(e)).sort(([e,t],[n,r])=>Du.indexOf(e)-Du.indexOf(n))))]},ku=(0,K.forwardRef)(function(e,t){return(0,Z.jsx)($,{ref:t,...e,children:(0,Z.jsx)(Au,{node:e})})}),Au=({node:e})=>{let{currentVersion:t}=tl(e),n=W();return(0,K.useEffect)(()=>{if(t){let t=setTimeout(()=>{n(e.id)},0);return()=>clearTimeout(t)}},[t]),t?(0,Z.jsx)(Z.Fragment,{children:e?.data.isCustom&&!t?.isPublishedVersion&&(0,Z.jsxs)(we,{padding:`4px`,children:[(0,Z.jsx)(Ee,{}),(0,Z.jsx)(De,{children:(0,Z.jsx)(p,{children:`Version outdated`})})]})}):null},ju=(0,K.forwardRef)(function(e,t){return(0,Z.jsx)($,{ref:t,...e,inputsTitle:`Results`})}),Mu=(0,K.forwardRef)(function(e,t){let n=e.data,{total:r}=cl({dataset:n.dataset,preview:!0});return(0,Z.jsx)($,{ref:t,...e,outputsTitle:`Inputs`,hidePlayButton:!0,children:n.dataset&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Lc,{children:`Attached Dataset`}),(0,Z.jsxs)(s,{gap:1.5,paddingX:2,paddingY:1,borderRadius:`md`,background:`bg.muted`,maxWidth:`full`,"data-testid":`entry-dataset-marker`,children:[(0,Z.jsx)(Jt,{size:12,style:{flexShrink:0}}),(0,Z.jsx)(p,{fontSize:`11px`,truncate:!0,children:n.dataset.name??`Dataset`}),r!=null&&(0,Z.jsxs)(p,{fontSize:`11px`,color:`fg.subtle`,flexShrink:0,children:[`(`,r,` `,r===1?`row`:`rows`,`)`]})]})]})})}),Nu=(0,K.forwardRef)(function(e,t){return(0,Z.jsx)($,{ref:t,...e})});(0,K.forwardRef)(function(e,t){return(0,Z.jsx)($,{ref:t,...e,data:{...e.data,name:e.data.cls},hideOutputHandles:!0})});var Pu=(0,K.forwardRef)(function(e,t){return null});function Fu({id:e,children:t}){let[n,r]=Os(()=>({accept:`prompting_technique`,drop:(t,n)=>({id:e}),collect:e=>({isOver:e.isOver()})}));return(0,Z.jsx)(i,{ref:r,children:t})}function Iu({children:e,decoratedBy:t}){let{node:n,setNode:r,deleteNode:a,deselectAllNodes:o}=G(e=>({node:t?.ref?e.nodes.find(e=>e.id===t.ref):void 0,setNode:e.setNode,deleteNode:e.deleteNode,deselectAllNodes:e.deselectAllNodes})),c=Et(`0px 0px 4px 0px rgba(0, 0, 0, 0.1)`,`0px 0px 4px 0px rgba(0, 0, 0, 0.3)`);return n?(0,Z.jsxs)(m,{position:`relative`,padding:`2px`,backgroundColor:`bg.subtle`,borderRadius:`12px`,color:`fg.muted`,fontSize:`10px`,boxShadow:c,outline:n.selected?`1.5px solid`:`none`,outlineColor:n.selected?Rc:`none`,gap:0,onClick:e=>{let t=e.target;for(;t&&!t.classList.contains(`js-component-node`);)t=t.parentElement;t||(e.stopPropagation(),o(),r({id:n.id,selected:!0}))},children:[n.selected&&(0,Z.jsxs)(P.Root,{positioning:{placement:`top-start`},children:[(0,Z.jsx)(P.Trigger,{asChild:!0,children:(0,Z.jsx)(i,{background:`bg`,position:`absolute`,top:`-26px`,right:1,paddingX:1,paddingY:1,borderRadius:6,minWidth:`auto`,minHeight:`auto`,boxShadow:`sm`,children:(0,Z.jsx)(Si,{size:11})})}),(0,Z.jsx)(wn,{nodeId:n.id,children:(0,Z.jsx)(P.Content,{children:(0,Z.jsxs)(P.Item,{value:`delete`,onClick:()=>{a(n.id)},children:[(0,Z.jsx)(ln,{size:14}),`Delete`]})})})]}),(0,Z.jsxs)(s,{gap:2,width:`full`,paddingX:3,paddingY:2,children:[(0,Z.jsx)(Vt,{type:n.type,cls:n.data.cls,size:`xs`}),(0,Z.jsx)(p,{fontSize:`12px`,fontWeight:500,children:n.data.cls})]}),e]}):e}var Lu={entry:Mu,signature:(0,K.forwardRef)(function(e,t){return(0,Z.jsx)(Iu,{decoratedBy:Object.fromEntries(e.data.parameters?.map(e=>[e.identifier,e])??[]).prompting_technique?.value,children:(0,Z.jsx)(Fu,{id:e.id,children:(0,Z.jsx)($,{ref:t,...e})})})}),evaluator:Nu,end:ju,code:$,http:$,agent:$,retriever:$,prompting_technique:Pu,custom:ku,if_else:$},Ru=e=>{let{setNodes:t,nodes:n}=G(e=>({setNodes:e.setNodes,nodes:e.nodes})),r=(0,K.useCallback)(()=>{let{name:t,id:r}=Zn(n.map(e=>e.id),e.component.name??`Component`);return{id:r,type:e.type,data:{...e.component,name:t,...e.behave_as?{behave_as:e.behave_as}:{},...e.type===`code`?{parameters:Rr(e.component.parameters??[],Qn(e.component.name??``),r)}:{}}}},[n,e.component,e.type,e.behave_as]),{screenToFlowPosition:a}=yn(),o=(e,r,i)=>{let o=a({x:r,y:i});e&&(e.position={x:o.x-(e.width??0)/2,y:o.y-(e.height??0)/2},t([...n,e]))},[c,l,u]=ys({type:`node`,item:()=>({node:r()}),collect:e=>({isDragging:!!e.isDragging(),clientOffset:e.getClientOffset()}),end:(t,n)=>{let r=n.getDropResult();t&&r&&o(t.node,r.x,r.y),t&&r&&e.onDragEnd?.(t)}});return(0,K.useEffect)(()=>{u(rc(),{captureDraggingState:!0})},[u]),(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(k,{showArrow:!0,positioning:{gutter:16,placement:`right`},content:e.disableDrag?`You cannot add the same component as your workflow`:e.component.description??``,children:(0,Z.jsx)(i,{background:`bg`,ref:e.disableDrag?void 0:l,borderRadius:4,padding:1,cursor:e.disableDrag?`not-allowed`:`grab`,width:`full`,opacity:c.isDragging?.5:1,children:(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(Vt,{type:e.type,cls:e.component.cls,behave_as:e.behave_as,size:`md`}),(0,Z.jsx)(zn,{lineClamp:1,expandable:!1,children:e.component.name}),(0,Z.jsx)(z,{}),(0,Z.jsx)(i,{color:`fg.subtle`,children:(0,Z.jsx)(pt,{size:18})})]})})})})};function zu({onDragEnd:e}){return(0,Z.jsx)(Ru,{component:{...Ou.agent,name:`Agent`,description:`Drag and drop to add an agent node. Pick an existing agent or create a new one.`},type:`agent`,onDragEnd:e})}function Bu({onDragEnd:e}){let t=Ou.evaluators[0];return t?(0,Z.jsx)(Ru,{component:{...t,name:`Evaluator`,description:`Drag and drop to add an evaluator node. Pick an existing evaluator or create a new one.`},type:`evaluator`,onDragEnd:e}):null}function Vu({onDragEnd:e}){let{project:t}=U(),n=B.modelProvider.getResolvedDefault.useQuery({projectId:t?.id??``,featureKey:`workflows.create_default`},{enabled:!!t?.id});return(0,Z.jsx)(Ru,{component:g({},Ou.signature,{parameters:[{identifier:`llm`,type:`llm`,value:{model:n.data?.model??ie}}]}),type:`signature`,onDragEnd:e})}function Hu({isOpen:e,setIsOpen:t}){return(0,Z.jsx)(a,{size:`sm`,display:e?`none`:`block`,background:`bg`,borderRadius:4,borderColor:`border.emphasized`,variant:`outline`,onClick:()=>{t(!e)},children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(Bt,{size:13}),(0,Z.jsx)(p,{children:`Components`})]})})}var Uu=({isOpen:e,setIsOpen:t})=>{let{propertiesExpanded:n,getWorkflow:r}=G(e=>({propertiesExpanded:e.propertiesExpanded,getWorkflow:e.getWorkflow})),o=r(),{project:c}=U(),{handlePromptDragEnd:l}=gu(),{handleEvaluatorDragEnd:u}=hu(),{handleAgentDragEnd:d}=fu(),{data:f}=B.optimization.getComponents.useQuery({projectId:c?.id??``},{enabled:!!c?.id&&!!o?.workflow_id,refetchOnWindowFocus:!0}),h=e=>{let t=e.publishedId??``,n=e.versions?.find(e=>e.id===t),{inputs:r,outputs:i}=Xn(n?.dsl.edges,n?.dsl.nodes);return{name:e.name??`Custom Component`,inputs:r,outputs:i,isCustom:!0,workflow_id:e.id,published_id:t,version_id:t}};return(0,Z.jsx)(i,{display:e?`block`:`none`,opacity:+!n,visibility:n?`hidden`:`visible`,position:n?`absolute`:e?`relative`:`absolute`,top:0,left:0,background:`bg`,borderRight:`1px solid`,borderColor:`border`,zIndex:100,height:`calc(100vh - 49px)`,fontSize:`14px`,width:`300px`,minWidth:`300px`,children:(0,Z.jsxs)(m,{width:`full`,height:`full`,gap:0,children:[(0,Z.jsxs)(m,{width:`full`,height:`full`,gap:4,align:`start`,overflowY:`auto`,padding:3,paddingBottom:`56px`,children:[(0,Z.jsx)(p,{fontWeight:`500`,padding:1,children:`Components`}),(0,Z.jsx)(Vu,{onDragEnd:l}),(0,Z.jsx)(Ru,{component:Ou.code,type:`code`}),(0,Z.jsx)(Ru,{component:Ou.http,type:`http`}),(0,Z.jsx)(Ru,{component:Ou.ifElse,type:`if_else`}),(0,Z.jsx)(zu,{onDragEnd:d}),(0,Z.jsx)(Bu,{onDragEnd:u}),f&&f.length>0&&f.some(e=>e.isComponent)&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{fontWeight:`500`,padding:1,children:`Custom Components`}),f.filter(e=>e.isComponent).map(e=>{let t=e.id===o?.workflow_id;return(0,Z.jsx)(Ru,{component:h(e),type:`custom`,disableDrag:t},e.id)})]})]}),(0,Z.jsxs)(s,{width:`full`,padding:3,paddingLeft:5,gap:4,background:`bg`,children:[(0,Z.jsx)(k,{showArrow:!0,content:`Star us on GitHub`,children:(0,Z.jsx)(j,{href:`https://github.com/langwatch/langwatch`,target:`_blank`,children:(0,Z.jsx)(Wn,{width:`20px`,height:`20px`,children:(0,Z.jsx)(rn,{})})})}),(0,Z.jsx)(k,{showArrow:!0,content:`Join our community`,children:(0,Z.jsx)(j,{href:`https://discord.gg/kT4PhDS2gH`,target:`_blank`,children:(0,Z.jsx)(Wn,{width:`20px`,height:`20px`,children:(0,Z.jsx)(me,{})})})}),(0,Z.jsx)(k,{showArrow:!0,content:`Documentation`,children:(0,Z.jsx)(j,{href:`https://docs.langwatch.ai/optimization-studio/llm-nodes`,target:`_blank`,children:(0,Z.jsx)(zt,{size:20})})}),(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{size:`sm`,variant:`ghost`,onClick:()=>{t(!e)},children:(0,Z.jsx)(ui,{size:18})})]})]})})};function Wu(){let{isDragging:e,item:t,currentOffset:n}=bs(e=>({item:e.getItem(),itemType:e.getItemType(),currentOffset:e.getClientOffset(),isDragging:e.isDragging()})),r=(0,K.useRef)(null);if((0,K.useEffect)(()=>{if(t?.node&&r.current){let{width:e,height:n}=r.current.getBoundingClientRect();t.node.width=e,t.node.height=n}},[e,t]),!e||!t?.node)return null;let i=Lu[t.node.type];return(0,Z.jsx)(`div`,{style:{position:`fixed`,pointerEvents:`none`,zIndex:200,left:n?.x??0,top:n?.y??0,transform:`translate(-50%, -50%)`,opacity:.5},children:(0,Z.jsx)(i,{ref:r,id:t.node.id,type:t.node.type,data:t.node.data,draggable:!1,width:t.node.width,height:t.node.height,deletable:!1,selectable:!1,selected:!1,sourcePosition:void 0,targetPosition:void 0,dragHandle:void 0,parentId:void 0,zIndex:200,dragging:!0,isConnectable:!1,positionAbsoluteX:0,positionAbsoluteY:0})})}var Gu=()=>{let{postEvent:e,socketStatus:t}=jr(),[n,r]=(0,K.useState)(null),{getWorkflow:i,setOptimizationState:a,setOpenResultsPanelRequest:o}=G(e=>({getWorkflow:e.getWorkflow,setOptimizationState:e.setOptimizationState,setOpenResultsPanelRequest:e.setOpenResultsPanelRequest})),s=(0,K.useCallback)(()=>t===`connected`?!0:(M.create({title:`Studio is not connected yet`,type:`error`,duration:5e3,meta:{closable:!0}}),!1),[t]);return(0,K.useEffect)(()=>{let e=i();n&&e.state.optimization?.run_id===n.run_id&&e.state.optimization?.status===n.timeout_on_status&&(a({status:`error`,error:`Timeout`,timestamps:{finished_at:Date.now()}}),M.create({title:`Timeout ${n.timeout_on_status===`waiting`?`starting`:`stopping`} optimization execution`,type:`error`,duration:5e3,meta:{closable:!0}}))},[n,a,i]),{startOptimizationExecution:(0,K.useCallback)(({workflow_version_id:t,optimizer:n,params:c})=>{if(!s())return;let l=`run_${Ie()}`;o(`closed`),a({status:`waiting`,run_id:l,stdout:``});let u=i();e({type:`execute_optimization`,payload:{run_id:l,workflow:{...u,nodes:Nr(u.nodes)},workflow_version_id:t,optimizer:n,params:c}}),setTimeout(()=>{r({run_id:l,timeout_on_status:`waiting`})},2e4)},[s,o,a,i,e]),stopOptimizationExecution:(0,K.useCallback)(({run_id:t})=>{if(!s())return;let n=i();if(n.state.optimization?.status===`waiting`){a({status:`idle`,run_id:void 0});return}e({type:`stop_optimization_execution`,payload:{workflow:{...n,nodes:Nr(n.nodes)},run_id:t}}),setTimeout(()=>{r({run_id:t,timeout_on_status:`running`})},1e4)},[s,a,e,i])}};bt({llm:Fe.optional().nullable(),num_candidates:Ot().optional(),max_bootstrapped_demos:Ot().optional(),max_labeled_demos:Ot().optional(),max_rounds:Ot().optional(),num_candidate_programs:Ot().optional()});var Ku={MIPROv2:{name:`Prompt + Demonstrations (MIPRO v2)`,description:`Generates several prompt alternatives plus few shot examples (demonstrations) to try and improve the LLM performance.`,minimum_train_set:10,params:{llm:null,num_candidates:7,max_bootstrapped_demos:4,max_labeled_demos:16}},MIPROv2ZeroShot:{name:`Prompt Only (MIPRO v2)`,description:`Generates several prompt alternatives to try and improve the LLM performance.`,minimum_train_set:10,params:{llm:null,num_candidates:7}},BootstrapFewShotWithRandomSearch:{name:`Demonstrations Only (BootstrapFewShotWithRandomSearch)`,description:`Generates several few shot examples (demonstrations) candidates and randomly searches to find the best.`,minimum_train_set:50,params:{max_bootstrapped_demos:4,max_labeled_demos:16,max_rounds:1,num_candidate_programs:10}}},qu=Object.entries(Ku).map(([e,t])=>({label:t.name,value:e,description:t.description}));function Ju(){let{open:e,onToggle:t,onClose:n,setOpen:r}=w(),{project:i}=U(),{optimizationState:o}=G(({state:e})=>({optimizationState:e.optimization})),s=B.workflow.engineMode.useQuery({projectId:i?.id??``},{enabled:!!i?.id,staleTime:6e4}),c=gt({defaultValues:{version:``,commitMessage:``,optimizer:qu[0],params:{}}});if(s.data&&!s.data.optimizeEnabled)return null;let l=o?.status===`running`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{content:l?`Optimization is running`:``,children:(0,Z.jsxs)(a,{colorPalette:`green`,size:`sm`,onClick:()=>{hn(`optimize_click`,{project_id:i?.id}),t()},disabled:l,children:[(0,Z.jsx)(un,{size:16}),`Optimize`]})}),(0,Z.jsx)(H.Root,{open:e,onOpenChange:({open:e})=>r(e),children:e&&(0,Z.jsx)(Yu,{form:c,onClose:n})})]})}function Yu({form:e,onClose:t}){let{project:n}=U(),{workflowId:r,getWorkflow:i,nodes:o,optimizationState:c,deselectAllNodes:l,setOpenResultsPanelRequest:u,setLastCommittedWorkflow:f,setCurrentVersionId:h,currentVersionId:g,checkCanCommitNewVersion:_}=G(({workflow_id:e,getWorkflow:t,nodes:n,state:r,deselectAllNodes:i,setOpenResultsPanelRequest:a,setLastCommittedWorkflow:o,setCurrentVersionId:s,currentVersionId:c,checkCanCommitNewVersion:l})=>({workflowId:e,getWorkflow:t,nodes:n,optimizationState:r.optimization,deselectAllNodes:i,setOpenResultsPanelRequest:a,setLastCommittedWorkflow:o,setCurrentVersionId:s,currentVersionId:c,checkCanCommitNewVersion:l})),v=i().nodes.find(e=>e.type===`entry`),{total:y}=cl({dataset:v?.data.dataset,preview:!0}),b=Ku[e.watch(`optimizer`).value],x=e.watch(`params`);(0,K.useEffect)(()=>{b&&e.setValue(`params`,Object.entries({...b.params,...x}).reduce((e,[t,n])=>(e[t]=n||b.params[t],e),{}))},[e,b]);let S=v?.data.train_size??.8,C=v?.data.test_size??.2,{train:w}=Qt(Array.from({length:y??0},(e,t)=>t),{trainSize:S,testSize:C}),{versions:T}=et({project:n,form:e,allowSaveIfAutoSaveIsCurrentButNotLatest:!1}),E=_(),D=B.workflow.commitVersion.useMutation(),{startOptimizationExecution:O}=Gu(),[A,j]=(0,K.useState)(!1);(0,K.useEffect)(()=>{A&&c?.status===`running`&&(t(),l(),u(`optimizations`))},[c?.status,A,t,l,u]);let N=(0,K.useCallback)(async({version:e,commitMessage:t,optimizer:a,params:o})=>{if(!n||!r||!w.length||w.length>=300&&!confirm(`Going to optimize on ${w.length} entries. Are you sure?`))return;if(w.length>=3e3){alert(`Optimiziation is limited to a maximum of 3000 entries total. Please contact support if you need to optimize on more.`);return}let s;if(E)try{s=(await D.mutateAsync({projectId:n.id,workflowId:r,commitMessage:t,dsl:{...i(),version:e}})).id,f(i()),h(s),M.create({title:`Version saved`,description:`New version has been saved successfully`,type:`success`})}catch(e){throw M.create({title:`Error`,description:`Failed to save version`,type:`error`}),e}else s=g;if(!s){M.create({title:`Version ID not found for optimization`,description:`Failed to find version ID for optimization`,type:`error`});return}T.refetch(),O({workflow_version_id:s,optimizer:a.value,params:o}),j(!0)},[E,D,g,i,n,h,f,O,w.length,T,r]),{hasProvidersWithoutCustomKeys:P,nodeProvidersWithoutCustomKeys:ee}=cu({workflow:i(),extra_llms:`llm`in b.params&&`llm`in x&&x.llm?[x.llm]:void 0});if(c?.status===`running`)return null;if(!T.data)return(0,Z.jsxs)(H.Content,{bg:`bg`,borderTop:`5px solid`,borderColor:`green.400`,children:[(0,Z.jsx)(H.Header,{fontWeight:600,children:`Optimize Workflow`}),(0,Z.jsx)(H.CloseTrigger,{}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(m,{align:`start`,width:`full`,children:[(0,Z.jsx)(d,{width:`full`,height:`20px`}),(0,Z.jsx)(d,{width:`full`,height:`20px`})]})}),(0,Z.jsx)(H.Footer,{})]});let F=o.some(tr),te=w.length<20?`You need at least 20 entries to run the automated optimizer`:P?`Set up your API keys to run optimizations`:F?!1:`You need at least one evaluator node in your workflow to run optimizations`,I=e.watch(`params.llm`);return(0,Z.jsx)(mt,{...e,children:(0,Z.jsxs)(H.Content,{bg:`bg`,as:`form`,onSubmit:e.handleSubmit(N),borderTop:`5px solid`,borderColor:`green.400`,children:[(0,Z.jsx)(H.Header,{fontWeight:600,children:`Optimize Workflow`}),(0,Z.jsx)(H.CloseTrigger,{}),(0,Z.jsxs)(H.Body,{display:`flex`,flexDirection:`column`,gap:4,children:[(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:4,children:[(0,Z.jsx)(m,{align:`start`,width:`full`,children:(0,Z.jsx)(Qe,{})}),(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:2,children:[(0,Z.jsx)(In,{children:`Optimizer`}),(0,Z.jsx)(_t,{control:e.control,name:`optimizer`,rules:{required:`Optimizer is required`},render:({field:e})=>(0,Z.jsx)(Xu,{field:e})})]})]}),(0,Z.jsx)(m,{width:`full`,align:`start`,children:`llm`in b.params&&(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:2,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(In,{children:`Teacher LLM`}),(0,Z.jsx)(k,{content:`The LLM that will be used to generate the prompts and/or demonstrations. You can, for example, use a more powerful LLM to teach a smaller one.`,children:(0,Z.jsx)(an,{size:16})})]}),(0,Z.jsx)(_t,{control:e.control,name:`params.llm`,render:({field:e})=>(0,Z.jsx)(Wc,{showProviderKeyMessage:!1,llmConfig:I??{model:ie},onChange:t=>{e.onChange(t)}})})]})}),(0,Z.jsxs)(se,{templateColumns:`repeat(2, 1fr)`,gap:5,children:[`num_candidates`in b.params&&(0,Z.jsx)(Le,{children:(0,Z.jsxs)(m,{align:`start`,gap:2,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(In,{children:`Number of Candidate Prompts`}),(0,Z.jsx)(k,{content:`Each candidate and demonstrations combination will be evaluated against the optimization set.`,children:(0,Z.jsx)(an,{size:16})})]}),(0,Z.jsx)(V,{...e.register(`params.num_candidates`),type:`number`,min:1,max:100})]})}),`max_bootstrapped_demos`in b.params&&(0,Z.jsx)(Le,{children:(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:2,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(In,{children:`Max Bootstrapped Demos`}),(0,Z.jsx)(k,{content:`Maximum number of few shot demonstrations generated on the fly by the optimizer`,children:(0,Z.jsx)(an,{size:16})})]}),(0,Z.jsx)(V,{...e.register(`params.max_bootstrapped_demos`),type:`number`,min:1,max:100})]})}),`max_labeled_demos`in b.params&&(0,Z.jsx)(Le,{children:(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:2,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(In,{children:`Max Labeled Demos`}),(0,Z.jsx)(k,{content:`Maximum number of few shot demonstrations coming from the original dataset. Caveat: the output field of the LLM node must have exactly the same name as the dataset column.`,children:(0,Z.jsx)(an,{size:16})})]}),(0,Z.jsx)(V,{...e.register(`params.max_labeled_demos`),type:`number`,min:1,max:100})]})})]}),P?(0,Z.jsx)(yr,{runWhat:`run optimizations`,nodeProvidersWithoutCustomKeys:ee}):F?null:(0,Z.jsxs)(we,{status:`warning`,children:[(0,Z.jsx)(Ee,{}),(0,Z.jsx)(De,{children:(0,Z.jsx)(p,{children:`You need at least one evaluator node in your workflow to be able to run optimizations`})})]})]}),(0,Z.jsx)(H.Footer,{borderTop:`1px solid`,borderColor:`border`,marginTop:4,children:(0,Z.jsx)(m,{align:`start`,width:`full`,gap:3,children:(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(m,{align:`start`,gap:0,children:(0,Z.jsxs)(p,{fontWeight:500,children:[w.length,` optimization set entries`]})}),(0,Z.jsx)(z,{}),(0,Z.jsx)(k,{content:te,children:(0,Z.jsxs)(a,{variant:`outline`,type:`submit`,loading:D.isLoading||c?.status===`waiting`,disabled:!!te,children:[(0,Z.jsx)(oi,{size:16}),E?`Save & Run Optimization`:`Run Optimization`]})})]})})})]})})}var Xu=({field:e})=>{let t=E({items:qu});return(0,Z.jsxs)(D.Root,{...e,collection:t,value:e.value?.value?[e.value.value]:[],onChange:void 0,onValueChange:t=>{let n=qu.find(e=>e.value===t.value[0]);e.onChange({target:{name:e.name,value:n}})},width:`100%`,children:[(0,Z.jsx)(D.Trigger,{children:(0,Z.jsx)(D.ValueText,{placeholder:`Select optimizer`})}),(0,Z.jsx)(D.Content,{children:qu.map(e=>(0,Z.jsx)(D.Item,{item:e,children:(0,Z.jsxs)(m,{align:`start`,width:`full`,children:[(0,Z.jsx)(p,{children:e.label}),(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:e.description})]})},e.value))})]})};function Zu(){return(0,Z.jsxs)(m,{gap:4,children:[(0,Z.jsx)(Qu,{}),(0,Z.jsx)($u,{})]})}function Qu(){let{evaluationState:e,setOpenResultsPanelRequest:t}=G(({state:e,setOpenResultsPanelRequest:t})=>({evaluationState:e.evaluation,setOpenResultsPanelRequest:t})),{stopEvaluationExecution:n}=su();return e?.status===`running`?(0,Z.jsx)(ed,{description:`Running evaluation`,progress:(0,Z.jsx)(Wr,{evaluationState:e}),onClick:()=>{t(`evaluations`)},onCancel:()=>{n({run_id:e?.run_id??``})}}):null}function $u(){let{optimizationState:e,setOpenResultsPanelRequest:t}=G(({state:e,setOpenResultsPanelRequest:t})=>({optimizationState:e.optimization,setOpenResultsPanelRequest:t})),{stopOptimizationExecution:n}=Gu();return e?.status===`running`?(0,Z.jsx)(ed,{description:`Running optimization`,progress:(0,Z.jsx)(td,{}),onClick:()=>{t(`optimizations`)},onCancel:()=>{n({run_id:e?.run_id??``})}}):null}function ed({description:e,progress:t,onClick:n,onCancel:r}){return(0,Z.jsx)(we,{position:`absolute`,bottom:`3`,right:`3`,zIndex:100,width:`fit-content`,background:`bg`,padding:1,borderRadius:`md`,border:`1px solid`,borderColor:`border`,onClick:n,color:`fg`,children:(0,Z.jsxs)(m,{align:`start`,gap:1,children:[(0,Z.jsxs)(m,{align:`start`,gap:1,paddingY:2,paddingX:3,children:[(0,Z.jsxs)(s,{gap:2,children:[(0,Z.jsx)(Ee,{}),(0,Z.jsx)(Ce,{children:`Please wait...`})]}),(0,Z.jsxs)(s,{minWidth:`300px`,children:[(0,Z.jsx)(Te,{fontSize:`14px`,children:e}),(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{size:`sm`,onClick:e=>{e.stopPropagation(),r()},children:`Cancel`})]})]}),t]})})}function td({size:e=`xs`}){return(0,Z.jsx)(s,{width:`full`,gap:4,children:(0,Z.jsx)(be,{size:e,width:`full`,colorPalette:`blue`,value:null,animated:!0,striped:!0,children:(0,Z.jsx)(fe,{borderRadius:`sm`,children:(0,Z.jsx)(pe,{})})})})}var nd=e=>{let t=new Date().toISOString().split(`T`)[0];return`workflow--${e.replace(/\s*-?\s*Workflow\s*$/i,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}-${t}.json`};function rd({isDisabled:e}){let t=w(),n=w(),{project:r}=U(),{workflowId:i}=G(({workflow_id:e})=>({workflowId:e})),o=B.useContext(),s=B.optimization.toggleSaveAsComponent.useMutation({onSuccess:()=>{o.optimization.getComponents.invalidate(),M.create({title:`Component status updated`,type:`success`,duration:5e3,meta:{closable:!0}})}}),c=B.optimization.toggleSaveAsEvaluator.useMutation({onSuccess:()=>{o.optimization.getComponents.invalidate(),M.create({title:`Evaluator status updated`,type:`success`,duration:5e3,meta:{closable:!0}})}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P.Root,{children:[(0,Z.jsx)(P.Trigger,{asChild:!0,children:(0,Z.jsxs)(a,{disabled:e,size:`sm`,colorPalette:`blue`,children:[`Publish `,(0,Z.jsx)(C,{})]})}),(0,Z.jsx)(P.Content,{children:r&&(0,Z.jsx)(ad,{project:r,onTogglePublish:t.onToggle,onToggleApi:n.onToggle})})]}),(0,Z.jsx)(H.Root,{open:t.open,onOpenChange:({open:e})=>t.setOpen(e),size:`md`,children:t.open&&(0,Z.jsx)(od,{onClose:t.onClose,onApiToggle:n.onToggle,toggleSaveAsComponent:()=>{!i||!r?.id||s.mutate({workflowId:i,projectId:r.id,isComponent:!0,isEvaluator:!1})},toggleSaveAsEvaluator:()=>{!i||!r?.id||c.mutate({workflowId:i,projectId:r.id,isEvaluator:!0,isComponent:!1})}})}),(0,Z.jsx)(H.Root,{open:n.open,onOpenChange:({open:e})=>n.setOpen(e),size:`lg`,children:n.open&&(0,Z.jsx)(sd,{})})]})}var id=async(e,t)=>{let n={...e};try{if(t&&t.datasetRecords.length>0){let e=en(t);e.datasetId=void 0;let r=Zt(e);n.nodes?.[0]?.data&&(n.nodes[0].data.dataset=r)}n.workflow_id=``,n.experiment_id=``,n.state={};let r=window.URL.createObjectURL(new Blob([JSON.stringify(n)])),i=document.createElement(`a`);i.href=r;let a=nd(e.name);i.setAttribute(`download`,a),document.body.appendChild(i),i.click(),i.remove()}catch{M.create({title:`Error exporting workflow`,description:`An error occurred while exporting the workflow.`,type:`error`,meta:{closable:!0}})}};function ad({project:e,onTogglePublish:t,onToggleApi:n}){let{workflowId:r,workflow_type:i,getWorkflow:a}=G(({workflow_id:e,workflow_type:t,getWorkflow:n})=>({workflowId:e,workflow_type:t,getWorkflow:n})),{canSaveNewVersion:o,versionToBeEvaluated:c}=et({project:e,allowSaveIfAutoSaveIsCurrentButNotLatest:!1}),l=B.useContext(),u=B.optimization.getPublishedWorkflow.useQuery({workflowId:r??``,projectId:e?.id??``},{enabled:!!e?.id}),d=u.data?u.data.dsl:a(),f=(d?.nodes[0]?.data)?.dataset?.id,m=B.datasetRecord.getAll.useQuery({datasetId:f??``,projectId:e?.id??``},{enabled:!!f&&!!e?.id}),h=B.optimization.disableAsComponent.useMutation({onSuccess:()=>{l.optimization.getComponents.invalidate(),M.create({title:`Component status updated`,type:`success`,duration:5e3,meta:{closable:!0}})}}),g=B.optimization.disableAsEvaluator.useMutation({onSuccess:()=>{l.optimization.getComponents.invalidate(),M.create({title:`Evaluator status updated`,type:`success`,duration:5e3,meta:{closable:!0}})}}),_=!o&&u.data?.version===c.version?`Current version is already published`:void 0,v=()=>{!r||!e?.id||h.mutate({workflowId:r,projectId:e.id})},y=()=>{!r||!e?.id||g.mutate({workflowId:r,projectId:e.id})},b=u.data?.version?void 0:`Publish a version to enable this option`,x=async()=>{await id(d,m.data??void 0)};return(0,Z.jsxs)(Z.Fragment,{children:[u.data?.version&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(s,{px:3,children:[(0,Z.jsx)(In,{children:`Published Version`}),(0,Z.jsx)(p,{fontSize:`xs`,children:u.data?.version})]}),(0,Z.jsx)(ae,{})]}),(0,Z.jsx)(k,{content:_,positioning:{placement:`right`},children:(0,Z.jsxs)(P.Item,{onClick:t,disabled:!!_,value:`publish`,children:[(0,Z.jsx)(Lt,{size:16}),` `,(0,Z.jsx)(p,{textTransform:`capitalize`,children:`Publish ${i}`})]})}),(0,Z.jsxs)(P.Item,{hidden:i===`workflow`||!u.data?.isEvaluator,onClick:y,value:`evaluator`,children:[(0,Z.jsx)(Gt,{size:16}),` Unpublish Evaluator`]}),(0,Z.jsxs)(P.Item,{hidden:i===`workflow`||!u.data?.isComponent,value:`component`,onClick:v,children:[(0,Z.jsx)(Gt,{size:16}),` Unpublish Component`]}),(0,Z.jsx)(k,{content:b,positioning:{placement:`right`},children:(0,Z.jsxs)(P.Item,{onClick:n,disabled:!!b,value:`api-reference`,children:[(0,Z.jsx)(Kt,{size:16}),` View API Reference`]})}),(0,Z.jsxs)(P.Item,{onClick:()=>void x(),value:`export-workflow`,children:[(0,Z.jsx)(Pi,{size:16}),` Export Workflow`]})]})}function od({onClose:e,onApiToggle:t,toggleSaveAsComponent:n,toggleSaveAsEvaluator:r}){let{project:i}=U(),{workflowId:o,getWorkflow:c,workflow_type:l,setLastCommittedWorkflow:u,setCurrentVersionId:f,currentVersionId:h,checkCanCommitNewVersion:g}=G(({workflow_id:e,getWorkflow:t,workflow_type:n,setLastCommittedWorkflow:r,setCurrentVersionId:i,currentVersionId:a,checkCanCommitNewVersion:o})=>({workflowId:e,getWorkflow:t,workflow_type:n,setLastCommittedWorkflow:r,setCurrentVersionId:i,currentVersionId:a,checkCanCommitNewVersion:o})),{hasProvidersWithoutCustomKeys:_,nodeProvidersWithoutCustomKeys:v}=cu({workflow:c()}),y=gt({defaultValues:{version:``,commitMessage:``}}),b=y.watch(`version`),{versions:x,versionToBeEvaluated:S}=et({project:i,form:y,allowSaveIfAutoSaveIsCurrentButNotLatest:!1}),C=g(),w=B.workflow.publish.useMutation(),[T,E]=(0,K.useState)(!1),D=B.workflow.commitVersion.useMutation(),O=B.optimization.getPublishedWorkflow.useQuery({workflowId:o??``,projectId:i?.id??``},{enabled:!!i?.id}),A=(0,K.useCallback)(async({version:e,commitMessage:t})=>{if(!i||!o)return;let a;if(C)try{a=(await D.mutateAsync({projectId:i.id,workflowId:o,commitMessage:t,dsl:{...c(),version:e}})).id,u(c()),f(a)}catch(e){throw M.create({title:`Error saving version`,type:`error`,duration:5e3,meta:{closable:!0}}),e}else a=h;if(!a){M.create({title:`Version ID not found for publishing`,type:`error`,duration:5e3,meta:{closable:!0}});return}x.refetch(),O.refetch(),w.mutate({projectId:i?.id??``,workflowId:o??``,versionId:a},{onSuccess:()=>{E(!0),l===`evaluator`?r():l===`component`&&n()},onError:()=>{M.create({title:`Error publishing workflow`,type:`error`,duration:5e3,meta:{closable:!0}})}})},[C,D,h,c,i,w,O,f,u,x,o,l,n,r]),j=()=>{t(),e()};if(!x.data)return(0,Z.jsxs)(H.Content,{bg:`bg`,borderTop:`5px solid`,borderColor:`green.400`,children:[(0,Z.jsx)(H.Header,{children:(0,Z.jsx)(H.Title,{fontWeight:600,children:`Publish Workflow`})}),(0,Z.jsx)(H.CloseTrigger,{}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(m,{align:`start`,width:`full`,children:[(0,Z.jsx)(d,{width:`full`,height:`20px`}),(0,Z.jsx)(d,{width:`full`,height:`20px`})]})}),(0,Z.jsx)(H.Footer,{})]});let N=_?`Set up your API keys to publish a new version`:!1;return(0,Z.jsx)(mt,{...y,children:(0,Z.jsxs)(H.Content,{bg:`bg`,as:`form`,onSubmit:y.handleSubmit(A),borderTop:`5px solid`,borderColor:`green.400`,children:[(0,Z.jsx)(H.Header,{children:(0,Z.jsx)(H.Title,{fontWeight:600,children:`Publish Workflow`})}),(0,Z.jsx)(H.CloseTrigger,{}),(0,Z.jsx)(H.Body,{children:(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:10,children:[(0,Z.jsx)(p,{fontSize:`15px`,color:`black`,children:`Publish your workflow to make it available via API, as a component to other workflows, or as a custom evaluator.`}),(0,Z.jsx)(Qe,{})]})}),(0,Z.jsx)(H.Footer,{borderTop:`1px solid`,borderColor:`border`,marginTop:4,children:(0,Z.jsxs)(m,{align:`start`,width:`full`,gap:3,children:[_&&(0,Z.jsx)(yr,{runWhat:`publish`,nodeProvidersWithoutCustomKeys:v}),!T&&(0,Z.jsx)(k,{content:N,children:(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(z,{}),(0,Z.jsxs)(a,{variant:`outline`,type:`submit`,loading:D.isLoading||w.isLoading,disabled:!!N,children:[(0,Z.jsx)(ni,{size:16}),` `,N?`Publish`:`Publish Version ${C?b:S.version??``}`]})]})}),T&&(0,Z.jsxs)(m,{align:`start`,width:`full`,children:[(0,Z.jsxs)(we,{status:`success`,children:[(0,Z.jsx)(Ee,{}),(0,Z.jsx)(De,{children:(0,Z.jsx)(Te,{children:`New version published`})})]}),(0,Z.jsx)(m,{width:`full`,align:`start`,children:(0,Z.jsxs)(a,{colorPalette:`green`,onClick:()=>j(),variant:`outline`,children:[(0,Z.jsx)(Kt,{size:16}),` View API Reference`]})})]})]})})]})})}var sd=()=>{let{workflowId:e}=G(({workflow_id:e})=>({workflowId:e})),{project:t}=U(),n=B.optimization.getPublishedWorkflow.useQuery({workflowId:e??``,projectId:t?.id??``},{enabled:!!t?.id});if(!n.data)return;let r=$n(n.data?.dsl?.edges,n.data?.dsl?.nodes),a=JSON.stringify(r.reduce((e,t)=>{let n=t.sourceHandle?.split(`.`)[1];return n&&(e[n]=``),e},{}),null,2);return(0,Z.jsxs)(H.Content,{bg:`bg`,children:[(0,Z.jsx)(H.Header,{children:(0,Z.jsx)(H.Title,{children:`Workflow API`})}),(0,Z.jsx)(H.CloseTrigger,{}),(0,Z.jsxs)(H.Body,{children:[(0,Z.jsx)(p,{paddingBottom:8,children:`Incorporate the following JSON payload within the body of your HTTP POST request to get the workflow result.`}),(0,Z.jsx)(i,{padding:4,backgroundColor:`#272822`,children:(0,Z.jsx)(oe,{code:`# Set your API key
16
- LANGWATCH_API_KEY="${t?.apiKey??`your_langwatch_api_key`}"
17
-
18
- # Use curl to send the POST request, e.g.:
19
- curl -X POST "${Cr()}/api/workflows/${e}/run" \\
20
- -H "X-Auth-Token: $LANGWATCH_API_KEY" \\
21
- -H "Content-Type: application/json" \\
22
- -d @- <<EOF
23
- ${a}
24
- EOF`,language:`bash`})}),(0,Z.jsxs)(p,{marginTop:4,children:[`To retrieve your API key, click`,` `,(0,Z.jsx)(jt,{href:`/${t?.slug}/setup`,textDecoration:`underline`,isExternal:!0,children:`here`}),`.`]}),(0,Z.jsxs)(p,{marginTop:4,children:[`To access the API details and view more information, please refer to the official documentation`,` `,(0,Z.jsx)(jt,{href:`https://docs.langwatch.ai`,textDecoration:`underline`,isExternal:!0,children:`here`}),`.`]})]}),(0,Z.jsx)(H.Footer,{})]})},cd=e(sr());function ld(e){let t=new Set(e.flatMap(e=>Object.keys(e.inputs??{}))),n={passed:!1,score:!1,label:!1,details:!1};for(let t of e)t.score!==void 0&&t.score!==null&&(n.score=!0),t.passed!==void 0&&t.passed!==null&&(n.passed=!0),t.label!==void 0&&t.label!==null&&(n.label=!0),t.details!==void 0&&t.details!==null&&(n.details=!0);return!n.passed&&!n.score&&!n.label&&(n.score=!0),{evaluationInputsColumns:t,evaluationResultsColumns:new Set(Object.entries(n).filter(([e,t])=>t).map(([e])=>e))}}var ud={error:`rgba(255, 0, 0, 0.2)`,skipped:`rgba(255, 255, 0, 0.2)`,true:`rgba(0, 128, 0, 0.15)`,false:`rgba(255, 0, 0, 0.15)`};function dd({evaluator:e,results:t,datasetByIndex:n,datasetColumns:r,predictedColumns:o,isFinished:c,size:l=`md`,workflowId:u}){let d=ld(t),f=(0,K.useRef)(null),p=(0,K.useRef)(!0),{openDrawer:m}=kt(),[h,g]=(0,K.useState)(void 0),_=l===`sm`?28:34,v=Math.max(...Object.values(n).map(e=>e.index+1),0),y=(0,K.useMemo)(()=>{let r=new Map(t.map(e=>[e.index,e]));return Array.from({length:v}).map((t,i)=>({rowNumber:i+1,datasetEntry:n[i],evaluationsForEntry:{[e]:r.get(i)}}))},[v,n,e,t]),b=(0,K.useMemo)(()=>{let i=[];i.push({id:`rowNumber`,header:``,minWidth:60,render:e=>e.rowNumber,text:()=>void 0});let c=Object.values(n)[0];for(let e of Array.from(r)){let t=typeof c?.entry?.[e]==`string`&&ne(c.entry[e]);i.push({id:`dataset_${e}`,header:`Dataset Input (${e})`,minWidth:150,render:n=>{let r=n.datasetEntry?.entry?.[e];if(t){let e=ne(r??``);if(e)return(0,Z.jsx)(re,{src:e,minWidth:`24px`,minHeight:`24px`,maxHeight:`${_-6}px`,maxWidth:`100%`})}return md(r)},text:t=>fd(t.datasetEntry?.entry?.[e]??`-`)})}if(Object.entries(o??{}).forEach(([e,t])=>{for(let n of Array.from(t)){let t=t=>{let r=t.datasetEntry;if(r?.error)return r.error;let i=(r?.predicted)?.[e]?.[n];return i===void 0&&e===`end`&&(i=r?.predicted?.[n]),i};i.push({id:`predicted_${e}_${n}`,header:pd(n),minWidth:150,render:e=>md(t(e)),text:e=>fd(t(e)??`-`),cellState:e=>e.datasetEntry?.error?`error`:void 0})}}),t.length>0&&d.evaluationInputsColumns.size>0)for(let t of Array.from(d.evaluationInputsColumns))i.push({id:`eval_input_${t}`,header:pd(t),minWidth:150,render:n=>{let{datasetEntry:r,evaluationsForEntry:i}=n;if(r?.error)return`Error`;let a=i[e]?.inputs?.[t];return i[e]?fd(a??`-`):`-`},text:n=>n.datasetEntry?.error?n.datasetEntry.error:fd(n.evaluationsForEntry[e]?.inputs?.[t]??`-`),cellState:e=>e.datasetEntry?.error?`error`:void 0});i.push({id:`cost`,header:`Cost`,minWidth:120,render:t=>{let n=(t.datasetEntry?.cost??0)+(t.evaluationsForEntry[e]?.cost??0);return n?Hr({amount:n,currency:`USD`},`$0.00[00]`):`-`},text:t=>{let n=t.datasetEntry?.cost??0,r=t.evaluationsForEntry[e]?.cost??0;if(!n&&!r)return`-`;let i=e=>Hr({amount:e,currency:`USD`},`$0.00[00]`);return`Prediction: ${n?i(n):`-`}, Evaluation: ${r?i(r):`-`}`}}),i.push({id:`duration`,header:`Duration`,minWidth:120,render:t=>{let n=(t.datasetEntry?.duration??0)+(t.evaluationsForEntry[e]?.duration??0);return n?Rn(n):`-`},text:t=>{let n=t.datasetEntry?.duration??0,r=t.evaluationsForEntry[e]?.duration??0;return!n&&!r?`-`:`Prediction: ${n?Rn(n):`-`}, Evaluation: ${r?Rn(r):`-`}`}});let l=[`score`,`passed`,`label`,`details`].filter(e=>d.evaluationResultsColumns.has(e));for(let t of l){let n=t===`details`,r=e=>e===!1?`false`:e===!0?`true`:Number.isNaN(Number(e))?e??`-`:(0,ql.default)(Number(e)).format(`0.[00]`);i.push({id:`eval_result_${t}`,header:pd(t),minWidth:n?240:120,render:i=>{let a=i.evaluationsForEntry[e];return n?(0,Z.jsx)(zn,{lineClamp:1,maxWidth:`300px`,whiteSpace:`pre-wrap`,children:a?.[t]}):a?.status===`error`?`Error`:a?.status===`skipped`?`Skipped`:r(a?.[t])},text:i=>{let a=i.evaluationsForEntry[e];return!n&&a?.status===`error`?a?.details??`Error`:!n&&a?.status===`skipped`?a?.details??`Skipped`:`${r(a?.[t])}`},cellState:r=>{let i=r.evaluationsForEntry[e];if(!n){if(i?.status===`error`)return`error`;if(i?.status===`skipped`)return`skipped`;if(i?.[t]===!0)return`true`;if(i?.[t]===!1)return`false`}}})}return Object.values(n).some(e=>e.traceId&&e.traceId!==`0`)&&i.push({id:`trace`,header:`Trace`,minWidth:90,render:e=>{let t=e.datasetEntry?.traceId;return t?(0,Z.jsxs)(s,{gap:1,children:[(0,Z.jsx)(a,{size:`xs`,colorPalette:`gray`,onClick:e=>{e.preventDefault(),e.stopPropagation(),m(`traceDetails`,{traceId:t,selectedTab:`traceDetails`})},children:`View`}),(0,Z.jsx)(or,{traceId:t})]}):`-`},text:()=>void 0}),i},[r,o,t.length,d,e,m,n,_]);(0,K.useEffect)(()=>{let e=f.current;if(!e)return;let t=()=>{p.current=e.scrollTop+e.clientHeight>=e.scrollHeight-24};return t(),e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,K.useEffect)(()=>{let e=f.current;if(!e||!p.current)return;let t=setTimeout(()=>{e.scrollTop=e.scrollHeight},100);return()=>clearTimeout(t)},[v,t.length]);let x=We({count:y.length,getScrollElement:()=>f.current,estimateSize:(0,K.useCallback)(()=>_,[_]),overscan:20}),S=(0,K.useCallback)((e,t)=>{let n=e.text?.(t);!n||n===`-`||g(n)},[]),C=x.getVirtualItems(),w=C.length>0?C[0]?.start??0:0,T=C.length>0?x.getTotalSize()-(C[C.length-1]?.end??0):0;return(0,Z.jsxs)(i,{children:[(0,Z.jsx)(i,{ref:f,width:`100%`,height:`60vh`,overflow:`auto`,"data-testid":`batch-evaluation-results-table`,css:{"& table":{width:`100%`,borderCollapse:`collapse`,fontSize:l===`sm`?`12px`:`13px`},"& th":{position:`sticky`,top:0,zIndex:2,background:`var(--chakra-colors-bg-subtle)`,borderBottom:`1px solid var(--chakra-colors-border-muted)`,borderRight:`1px solid var(--chakra-colors-border-muted)`,padding:`4px 8px`,textAlign:`left`,fontWeight:600,whiteSpace:`nowrap`},"& td":{borderBottom:`1px solid var(--chakra-colors-border-muted)`,borderRight:`1px solid var(--chakra-colors-border-muted)`,padding:`4px 8px`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:`300px`,cursor:`pointer`,height:`${_}px`}},children:(0,Z.jsxs)(`table`,{children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsx)(`tr`,{children:b.map(e=>(0,Z.jsx)(`th`,{style:{minWidth:e.minWidth},children:e.header},e.id))})}),(0,Z.jsxs)(`tbody`,{children:[w>0&&(0,Z.jsx)(`tr`,{children:(0,Z.jsx)(`td`,{colSpan:b.length,style:{height:w,padding:0,border:`none`}})}),C.map(e=>{let t=y[e.index];return t?(0,Z.jsx)(`tr`,{"data-index":e.index,children:b.map(e=>{let n=e.cellState?.(t),r=e.text?.(t);return(0,Z.jsx)(`td`,{title:r&&r.length<1e3?r:void 0,style:{minWidth:e.minWidth,background:n?ud[n]:void 0},onClick:()=>S(e,t),children:e.render(t)},e.id)})},e.index):null}),T>0&&(0,Z.jsx)(`tr`,{children:(0,Z.jsx)(`td`,{colSpan:b.length,style:{height:T,padding:0,border:`none`}})})]})]})}),(0,Z.jsx)(Bn,{open:!!h,onOpenChange:e=>g(e?h:void 0),textExpanded:h})]})}function fd(e){return typeof e==`object`?JSON.stringify(e):`${e}`}function pd(e){return e.replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function md(e){return e==null?`-`:fd(e)}var hd=({project:e,experiment:t,runId:n,isFinished:r})=>{let[i,a]=(0,K.useState)(!0),o=(0,K.useRef)(Date.now());(0,K.useEffect)(()=>{o.current=Date.now()},[e.id,t.id,n]);let s=B.experiments.getExperimentBatchEvaluationRun.useQuery({projectId:e.id,experimentId:t.id,runId:n??``},{enabled:!!n,refetchInterval:i?1e3:!1,refetchOnMount:!1,refetchOnWindowFocus:!1});(0,K.useEffect)(()=>{if(r){let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)}else a(!0)},[r]);let c=s.data?.dataset.reduce((e,t)=>(e[t.index]=t,e),{}),l=new Set(Object.values(c??{}).flatMap(e=>Object.keys(e.entry??{}))),u=!Object.values(c??{}).every(e=>Object.values(e?.predicted??{}).every(e=>typeof e==`object`&&!Array.isArray(e))),d=Object.values(c??{}).map(e=>e.predicted).filter(Boolean);u&&(d=d.map(e=>({end:e})));let f={};for(let e of d)for(let[t,n]of Object.entries(e))for(let e of Object.keys(n))f[t]||(f[t]=new Set),f[t].add(e);let p=Object.values(c??{}).some(e=>e.error);Object.keys(f).length===0&&p&&(f={"":new Set([`error`])});let m=s.data?.evaluations.reduce((e,t)=>{let n=t.targetId?`${t.targetId}:${t.evaluator}`:t.evaluator;return e[n]||(e[n]=[]),e[n].push(t),e},{}),h=new Map((s.data?.targets??[]).map(e=>[e.id,e]));return m=Object.fromEntries(Object.entries(m??{}).sort((e,t)=>e[0].localeCompare(t[0]))),Object.keys(m??{}).length===0&&(s.data?.dataset.length??0)>0&&(m={Predictions:[]}),{run:s.error&&o.current>Date.now()-5e3?{...s,data:void 0,error:void 0,isLoading:!0}:s,datasetByIndex:c,datasetColumns:l,predictedColumns:f,resultsByEvaluator:m,targetsMap:h}},gd=({project:e,experiment:t,runId:n,isFinished:r})=>{let{run:i,datasetByIndex:a,datasetColumns:o,predictedColumns:s,resultsByEvaluator:c,targetsMap:l}=hd({project:e,experiment:t,runId:n,isFinished:r}),u=async()=>{try{await f()}catch(e){ze({error:e,fallbackTitle:`Couldn't download the CSV`}),console.error(e)}},d=!!n&&!!i.data&&!!a,f=async()=>{if(!d)throw Error(`Results not loaded yet`);let e=Object.fromEntries(Object.entries(c).map(([e,t])=>[e,ld(t)])),r=Math.max(...Object.values(a).map(e=>e.index+1)),l=Array.from(o),u=Object.entries(s).flatMap(([e,t])=>Array.from(t).map(t=>`${e}.${t}`)),f=Object.entries(e),p=[...l,...u,`Cost`,`Duration`,...f.flatMap(([e,{evaluationInputsColumns:t,evaluationResultsColumns:n}])=>[...Array.from(t).map(t=>`${e} ${t}`),...Array.from(n).map(t=>`${e} ${t}`)])].map(e=>e.toLowerCase().replaceAll(` `,`_`)),m=e=>typeof e==`object`?JSON.stringify(e):e??``,h=Array.from({length:r}).map((e,t)=>{let n=a[t],r=[];for(let e of l)r.push(String(m(n?.entry?.[e]??``)));for(let e of u){let[t,i]=e.split(`.`),a=(n?.predicted)?.[t]?.[i];a===void 0&&t===`end`&&(a=n?.predicted?.[i]),r.push(String(m(a??``)))}r.push(n?.cost==null?``:String(n.cost)),r.push(n?.duration==null?``:String(n.duration));for(let[e,{evaluationInputsColumns:n,evaluationResultsColumns:i}]of f){let a=c[e]?.find(e=>e.index===t);for(let e of Array.from(n)){let t=a?.inputs?.[e];r.push(String(typeof t==`object`?JSON.stringify(t):t??``))}for(let e of Array.from(i)){if(e!==`details`&&a?.status===`error`){r.push(`Error`);continue}if(e!==`details`&&a?.status===`skipped`){r.push(`Skipped`);continue}let t=a?.[e];e===`details`?r.push(t==null?``:String(t)):t===!1?r.push(`false`):t===!0?r.push(`true`):isNaN(Number(t))?r.push(t==null?``:String(t)):r.push((0,ql.default)(Number(t)).format(`0.[00]`))}}return r}),g=cd.default.unparse({fields:p,data:h}),_=window.URL.createObjectURL(new Blob([g])),v=document.createElement(`a`);v.href=_;let y=`${new Date(i.data.timestamps.createdAt).toISOString().split(`T`)[0]}_${t.name}_${n}.csv`;v.setAttribute(`download`,y),document.body.appendChild(v),v.click(),v.remove()};return{downloadCSV:u,isDownloadCSVEnabled:d}};K.memo(function({project:e,experiment:t,runId:n,isFinished:r,size:i=`md`}){let{run:a,datasetByIndex:o,datasetColumns:c,predictedColumns:l,resultsByEvaluator:u,targetsMap:f}=hd({project:e,experiment:t,runId:n,isFinished:r}),h=(e,t)=>{if(e.includes(`:`)){let[n,r]=e.split(`:`);return`${(n?f.get(n):void 0)?.name??n} - ${t.find(e=>e.name)?.name??r}`}return t.find(e=>e.name)?.name??e},{downloadCSV:g,isDownloadCSVEnabled:_}=gd({project:e,experiment:t,runId:n,isFinished:r}),[v,y]=(0,K.useState)(0);return a.error?(0,Z.jsxs)(we,{status:`error`,children:[(0,Z.jsx)(Ee,{}),`Error loading evaluation results`]}):!u||!o?(0,Z.jsx)(m,{gap:0,width:`full`,height:`full`,minWidth:`0`,children:(0,Z.jsxs)(Be,{size:i,width:`full`,height:`full`,display:`flex`,flexDirection:`column`,minHeight:`0`,overflowX:`auto`,padding:0,colorPalette:`blue`,children:[(0,Z.jsx)(He,{children:(0,Z.jsx)(Ve,{value:`skeleton`,children:(0,Z.jsx)(d,{width:`60px`,height:`22px`})})}),(0,Z.jsx)(Ue,{value:`skeleton`,minWidth:`full`,minHeight:`0`,overflowY:`auto`,children:(0,Z.jsxs)(N,{size:i===`sm`?`xs`:`sm`,variant:`grid`,children:[(0,Z.jsxs)(ee,{children:[(0,Z.jsxs)(L,{children:[(0,Z.jsx)(I,{rowSpan:2,width:`50px`,children:(0,Z.jsx)(d,{width:`100%`,height:`52px`})}),(0,Z.jsx)(I,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(I,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(I,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})})]}),(0,Z.jsxs)(L,{children:[(0,Z.jsx)(I,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(I,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(I,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})})]})]}),(0,Z.jsx)(te,{children:(0,Z.jsxs)(L,{children:[(0,Z.jsx)(F,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(F,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(F,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})}),(0,Z.jsx)(F,{children:(0,Z.jsx)(d,{width:`100%`,height:`18px`})})]})})]})})]})}):Object.keys(u).length===0?(0,Z.jsx)(p,{padding:4,children:r?`No results`:`Waiting for the first results to arrive...`}):(0,Z.jsxs)(Be,{size:i,width:`full`,height:`full`,display:`flex`,flexDirection:`column`,minHeight:`0`,position:`relative`,value:Object.keys(u)[v],onValueChange:e=>y(Object.keys(u).indexOf(e.value)),defaultValue:Object.keys(u)[0],colorPalette:`blue`,children:[(0,Z.jsxs)(s,{top:1,right:2,borderBottom:`1px solid`,borderColor:`border`,children:[(0,Z.jsx)(He,{minWidth:0,children:Object.entries(u).map(([e,t])=>(0,Z.jsx)(Ve,{value:e,css:{"& span":{textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,minWidth:0}},children:h(e,t)},e))}),(0,Z.jsx)(z,{}),(0,Z.jsx)(p,{color:`fg.subtle`,fontSize:`12px`,flexShrink:0,children:n}),i===`sm`&&(0,Z.jsxs)(P.Root,{positioning:{placement:`bottom-end`},children:[(0,Z.jsx)(P.Trigger,{flexShrink:0,paddingRight:1,marginRight:1,children:(0,Z.jsx)(on,{size:16})}),(0,Z.jsxs)(P.Content,{children:[(0,Z.jsxs)(P.Item,{value:`open-experiment`,onClick:()=>void window.open(`/${e.slug}/experiments/${t.slug}?runId=${n}`,`_blank`),children:[(0,Z.jsx)(Xt,{size:16}),` Open Experiment Full Page`]}),(0,Z.jsxs)(P.Item,{value:`export-csv`,onClick:()=>void g(),disabled:!_,children:[(0,Z.jsx)(Yt,{size:16}),` Export to CSV`]})]})]})]}),Object.entries(u).map(([e,n],a)=>v===a?(0,Z.jsx)(Ue,{value:e,padding:0,minWidth:`full`,minHeight:`0`,overflow:`auto`,children:(0,Z.jsx)(dd,{evaluator:e,results:n,datasetByIndex:o,datasetColumns:c,predictedColumns:l,isFinished:r,size:i,workflowId:t.workflowId})},e):null)]})});function _d({isRunMissing:e,setKeepFetching:t}){let n=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!e){t(!1);return}t(!0),n.current||=setTimeout(()=>{n.current=null,t(!1)},5e3)},[e,t]),(0,K.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[])}var vd=({project:e,experiment:t,selectedRunId:n,setSelectedRunId:r})=>{let[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(!1),c=B.experiments.getExperimentBatchEvaluationRuns.useQuery({projectId:e?.id??``,experimentId:t?.id??``},{refetchInterval:o?1:i?3e3:1e4,enabled:!!e&&!!t}),l=dt(),{selectedRunId_:u,selectedRun:d}=(0,K.useMemo)(()=>{let e=n??(typeof l.query.runId==`string`?l.query.runId:null)??c.data?.runs[0]?.runId;return{selectedRunId_:e,selectedRun:c.data?.runs.find(t=>t.runId===e)}},[n,l.query.runId,c.data?.runs]);_d({isRunMissing:!!n&&!d,setKeepFetching:s});let f=(0,K.useCallback)(e=>{r?r(e):l.push({query:{...l.query,runId:e}})},[l,r]),p=(0,K.useMemo)(()=>d?Ur(d.timestamps,new Date().getTime())!==void 0:!1,[d]);return(0,K.useEffect)(()=>{c.data?.runs.some(e=>Ur(e.timestamps,new Date().getTime())===void 0)?a(!0):a(!1)},[c.data?.runs]),{batchEvaluationRuns:c,selectedRun:d,selectedRunId:u,setSelectedRunId:f,isFinished:p}},yd=qe(`langwatch:studio:evaluation`),bd=()=>{let{setEvaluationState:e,getWorkflow:t,setWorkflow:n}=G(R(e=>({setEvaluationState:e.setEvaluationState,getWorkflow:e.getWorkflow,setWorkflow:e.setWorkflow}))),{postEvent:r,isLoading:i}=jr(),{project:a}=U(),o=B.workflow.commitVersion.useMutation(),{previousVersion:s,nextVersion:c,latestVersion:l}=et({project:a,form:gt({defaultValues:{version:``,commitMessage:``}}),allowSaveIfAutoSaveIsCurrentButNotLatest:!0}),u=B.workflow.generateCommitMessage.useMutation(),d=B.modelProvider.getResolvedDefault.useQuery({projectId:a?.id??``,featureKey:`workflows.commit_message`},{enabled:!!a?.id}),f=B.useContext(),[p,m]=(0,K.useState)(null);return(0,K.useEffect)(()=>{let n=t();p&&n.state.evaluation?.run_id===p.run_id&&n.state.evaluation?.status===p.timeout_on_status&&(yd.warn({run_id:p.run_id,timeout_on_status:p.timeout_on_status},`evaluation timeout triggered`),e({status:`error`,error:`Timeout`,timestamps:{finished_at:Date.now()}}),M.create({title:`Timeout ${p.timeout_on_status===`waiting`?`starting`:`stopping`} evaluation execution`,type:`error`,duration:5e3,meta:{closable:!0}}))},[p,e,t]),{runEvaluation:(0,K.useCallback)(async({onStart:i,workflow_version_id:p,evaluate_on:m,dataset_entry:h}={})=>{if(!a)return;let g=t().workflow_id;if(!g){M.create({title:`Error running evaluation: workflow not found`,type:`error`,duration:5e3,meta:{closable:!0}});return}let _=`run_${Ie()}`,v=t();yd.info({run_id:_,workflowId:g,evaluate_on:m??`full`},`evaluation starting`);let y=l?.autoSaved&&(s?.dsl?Ir(v,s.dsl,!1):!0),b=p??(l?.autoSaved?s?.id:l?.id);if(y&&!p){let e=s?`autosaved`:`first version`;if(s?.dsl&&d.data!=null)try{e=await u.mutateAsync({projectId:a?.id??``,prevDsl:s?.dsl,newDsl:t()})??`autosaved`}catch(e){yd.error({error:e},`evaluation: error auto-generating version description`)}try{b=(await o.mutateAsync({projectId:a.id,workflowId:g,commitMessage:e,dsl:zr({...v,version:c})})).id,yd.info({version:c,versionId:b},`evaluation: auto-committed new version`),n({version:c}),f.workflow.getVersions.invalidate()}catch(e){yd.error({error:e},`evaluation: error saving version`),M.create({title:`Error saving version`,type:`error`,duration:5e3,meta:{closable:!0}});return}}i?.(),e({status:`waiting`,run_id:_,progress:0,total:0}),r({type:`execute_evaluation`,payload:{run_id:_,workflow:{...v,nodes:Nr(v.nodes)},workflow_version_id:b??``,evaluate_on:m??`full`,dataset_entry:h,origin:`evaluation`}})},[a,t,l,s,e,r,u,d.data,o,c,n,f.workflow.getVersions]),stopEvaluation:(0,K.useCallback)(({run_id:n})=>{yd.info({run_id:n},`evaluation stopping`);let i=t();if(i.state.evaluation?.status===`waiting`){e({status:`idle`,run_id:void 0});return}r({type:`stop_evaluation_execution`,payload:{workflow:{...i,nodes:Nr(i.nodes)},run_id:n}}),setTimeout(()=>{m({run_id:n,timeout_on_status:`running`})},1e4)},[e,t,m,r]),isLoading:i||u.isLoading||o.isLoading}};function xd(e,t,n){let r=`outputs.${e}`,i=t.filter(e=>e.source===`entry`&&e.sourceHandle===r);return i.length===0?!1:i.some(e=>{let t=n.find(t=>t.id===e.target);return t&&!tr(t)})}function Sd(e){if(!e?.nodes)return[];let t=e.nodes.find(e=>e.type===`entry`);if(!t)return[];let n=t.data?.outputs;if(!n||!Array.isArray(n))return[];let r=e.edges??[],i=e.nodes;return r.length===0?n.map(e=>({identifier:e.identifier,type:e.type})):n.filter(e=>xd(e.identifier,r,i)).map(e=>({identifier:e.identifier,type:e.type}))}function Cd({hasProject:e,workflowId:t}){return e&&!!t}function wd({projectSlug:e,experimentSlug:t,runId:n}){return(0,Z.jsx)(k,{content:`Open the full results page for this run`,positioning:{placement:`top`},openDelay:100,children:(0,Z.jsx)(a,{size:`sm`,variant:`outline`,asChild:!0,children:(0,Z.jsxs)(jt,{href:`/${e}/experiments/${t}?runId=${n}`,target:`_blank`,rel:`noreferrer`,"data-testid":`open-full-results`,children:[(0,Z.jsx)(Xt,{size:14}),`Open full results`]})})})}function Td({workflowId:e,entryFields:t,datasetColumns:n,datasetName:r,projectSlug:i}){let o=typeof window<`u`?window.location.origin:`https://app.langwatch.ai`,{dataSource:s,setDataSource:c,tabs:l}=Jr(({lang:a,dataSource:s})=>Kr({kind:`workflow`,identifier:e,baseUrl:o,entryFields:t,datasetColumns:n,datasetName:r,dataSource:s,projectSlug:i,lang:a}));return(0,Z.jsx)(Ye,{snippets:[],targets:[],tabs:l,controls:(0,Z.jsx)(qr,{value:s,onChange:c}),title:`Run via API`,description:`Trigger this workflow's evaluation through the LangWatch API and read the per-row results back.`,children:(0,Z.jsx)(Ye.Trigger,{children:(0,Z.jsxs)(a,{size:`sm`,variant:`outline`,"data-testid":`run-via-api`,children:[(0,Z.jsx)(Hi,{size:14}),`Run via API`]})})})}function Ed({isCollapsed:e,collapsePanel:t}){let{workflowId:n,experimentId:r,evaluationState:i}=G(({workflow_id:e,experiment_id:t,state:n})=>({workflowId:e,experimentId:t,evaluationState:n.evaluation}));return(0,Z.jsxs)(s,{display:e?`none`:void 0,background:`bg`,borderTop:`2px solid`,borderColor:`border`,width:`full`,fontSize:`14px`,height:`full`,align:`start`,position:`relative`,children:[(0,Z.jsx)(a,{variant:`ghost`,onClick:()=>t(!0),position:`absolute`,top:1,right:1,size:`xs`,zIndex:1,children:(0,Z.jsx)(fn,{size:16})}),(0,Z.jsxs)(Be,{value:`evaluations`,width:`full`,height:`full`,display:`flex`,flexDirection:`column`,size:`sm`,colorPalette:`blue`,children:[(0,Z.jsx)(He,{borderBottomWidth:`2px`,children:(0,Z.jsx)(Ve,{value:`evaluations`,children:`Evaluations`})}),(0,Z.jsx)(Ue,{value:`evaluations`,padding:0,height:`calc(100% - 32px)`,children:!e&&(0,Z.jsx)(Dd,{workflowId:n,experimentId:r,evaluationState:i})})]})]})}function Dd({workflowId:e,experimentId:t,evaluationState:n,sidebarProps:r}){let{project:a}=U(),[o,c]=(0,K.useState)(!1),l=B.experiments.getExperimentBySlugOrId.useQuery({projectId:a?.id??``,experimentId:t,experimentSlug:t?void 0:On(e??``)},{enabled:Cd({hasProject:!!a,workflowId:e}),refetchOnWindowFocus:!1,refetchInterval:o?1:void 0});(0,K.useEffect)(()=>{if(n?.status===`running`&&!l.data)c(!0);else{let e=setTimeout(()=>{c(!1)},l.data?0:15e3);return()=>clearTimeout(e)}},[n?.status,l.data]);let[u,d]=(0,K.useState)(n?.run_id);(0,K.useEffect)(()=>{d(n?.run_id)},[n?.run_id]);let{stopEvaluation:f}=bd(),{getWorkflow:h}=G(({getWorkflow:e})=>({getWorkflow:e})),{selectedRun:g,isFinished:_,batchEvaluationRuns:v,selectedRunId:y}=vd({project:a,experiment:l.data,selectedRunId:u,setSelectedRunId:d}),b=B.experiments.getExperimentBatchEvaluationRun.useQuery({projectId:a?.id??``,experimentId:l.data?.id??``,runId:y??``},{enabled:!!a&&!!l.data&&!!y,refetchInterval:_?!1:1e3}),x=b.data?tt(b.data):null,S=(v.data?.runs??[]).map(e=>({runId:e.runId,workflowVersion:e.workflowVersion,timestamps:e.timestamps,progress:e.progress,total:e.total,summary:{datasetCost:e.summary.datasetCost,evaluationsCost:e.summary.evaluationsCost,evaluations:Object.fromEntries(Object.entries(e.summary.evaluations).map(([e,t])=>[e,{name:t.name,averageScore:t.averageScore,averagePassed:t.averagePassed}]))}})),C=S.find(e=>e.runId===y);if(l.isError&&l.error.data?.httpStatus===404||v.data?.runs.length===0||!l.data||!a)return o?(0,Z.jsx)(p,{padding:4,children:`Loading...`}):(0,Z.jsx)(Tt,{width:`full`,height:`full`,children:(0,Z.jsx)(Ae,{marginTop:`-60px`,children:(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(Me,{children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(ke,{children:`Waiting for evaluation results`}),(0,Z.jsx)(je,{children:`Run your first evaluation to see the results here`})]})})});if(l.isError)return(0,Z.jsxs)(we,{status:`error`,children:[(0,Z.jsx)(Ee,{}),`Error loading evaluation results`]});let w=n?.run_id,T=h(),E=Sd(T),D=T.nodes.find(e=>e.type===`entry`)?.data?.dataset,O=D?.inline?.columnTypes.map(e=>e.name)??[];return(0,Z.jsxs)(s,{align:`stretch`,width:`full`,height:`full`,gap:0,children:[(0,Z.jsx)(Ze,{runs:S,selectedRunId:y,onSelectRun:d,isLoading:v.isLoading,size:`sm`,...r}),(0,Z.jsxs)(m,{gap:0,width:`full`,height:`full`,minWidth:`0`,minHeight:`0`,children:[(0,Z.jsx)(i,{flex:1,width:`full`,minHeight:`0`,overflow:`hidden`,children:(0,Z.jsx)(rt,{data:x,isLoading:b.isLoading})}),C&&(0,Z.jsx)(Xe,{run:C,showProgress:(!g||g.runId===w)&&!!w&&n?.status===`running`,onStop:()=>f({run_id:w??``}),actions:(0,Z.jsxs)(s,{gap:2,children:[e&&(0,Z.jsx)(Td,{workflowId:e,entryFields:E,datasetColumns:O,datasetName:D?.name,projectSlug:a.slug}),y&&(0,Z.jsx)(wd,{projectSlug:a.slug,experimentSlug:l.data.slug,runId:y})]})})]})]})}var Od=e=>e==null?``:typeof e==`string`?e:JSON.stringify(e);function kd(){let{untilNodeId:e,close:t}=jc(R(({untilNodeId:e,close:t})=>({untilNodeId:e,close:t}))),{nodes:n,setNode:r,deselectAllNodes:i,setPropertiesExpanded:o}=G(R(({nodes:e,setNode:t,deselectAllNodes:n,setPropertiesExpanded:r})=>({nodes:e,setNode:t,deselectAllNodes:n,setPropertiesExpanded:r}))),{startWorkflowExecution:c}=Mr(),l=n.find(e=>e.type===`entry`),u=l?.data,d=n.find(t=>t.id===e),f=u?.outputs??[],h=u?.dataset,{rows:g,columns:_}=cl({dataset:h}),[v,y]=(0,K.useState)(`fields`),[b,x]=(0,K.useState)({}),[S,C]=(0,K.useState)(void 0),w=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(!e){y(`fields`),C(void 0),w.current=!1;return}if(w.current)return;let t=l?.data?.manual_run_values,n=g[0];x(Object.fromEntries((u?.outputs??[]).map(e=>{let r=n?.[e.identifier],i=t?.[e.identifier]??Od(r??e.value);return[e.identifier,i]})))},[e,JSON.stringify(g[0]??null)]),(0,K.useEffect)(()=>{e&&(i(),o(!1))},[e,i,o]);let T=n=>{e&&(l&&f.length>0&&r({id:l.id,data:{...l.data,manual_run_values:n}}),t(),c({untilNodeId:e,inputs:f.length>0?[n]:void 0}))};return(0,Z.jsx)(H.Root,{open:!!e,onOpenChange:({open:e})=>{e||t()},size:v===`table`?`xl`:`md`,children:(0,Z.jsxs)(H.Content,{"data-testid":`run-until-here-dialog`,children:[(0,Z.jsx)(H.CloseTrigger,{}),(0,Z.jsx)(H.Header,{children:(0,Z.jsxs)(m,{align:`start`,gap:1,children:[(0,Z.jsx)(H.Title,{children:`Run until here`}),(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:v===`table`?`Pick the dataset row to run with.`:d?`Runs "${Nc(d)}" and everything it depends on with these values.`:`Runs the selected node and everything it depends on with these values.`})]})}),(0,Z.jsx)(H.Body,{children:v===`table`?(0,Z.jsx)(Pn,{rows:g.map((e,t)=>({...e,id:Od(e.id),isSelected:t===S})),columns:_,background:`bg.panel`,onRowClick:e=>C(e)}):f.length>0?(0,Z.jsx)(m,{width:`full`,align:`start`,gap:3,children:f.map(e=>(0,Z.jsxs)(ce,{width:`full`,children:[(0,Z.jsx)(le,{fontSize:`12px`,fontFamily:`mono`,color:`fg.muted`,children:e.identifier}),(0,Z.jsx)(V,{size:`sm`,"data-testid":`run-until-here-input-${e.identifier}`,value:b[e.identifier]??``,onChange:t=>{w.current=!0,x(n=>({...n,[e.identifier]:t.target.value}))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T(b))}})]},e.identifier))}):(0,Z.jsx)(p,{fontSize:`13px`,color:`fg.muted`,children:`The entry point has no inputs, the run starts with an empty entry.`})}),(0,Z.jsx)(H.Footer,{children:v===`table`?(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>{y(`fields`),C(void 0)},children:`Cancel`}),S!==void 0&&(0,Z.jsx)(a,{colorPalette:`orange`,size:`sm`,"data-testid":`run-with-selected-row`,onClick:()=>{if(S===void 0)return;let e=g[S];e&&T(Object.fromEntries(f.map(t=>[t.identifier,Od(e[t.identifier])])))},children:`Run with selected row`})]}):(0,Z.jsxs)(s,{width:`full`,children:[h&&g.length>0&&(0,Z.jsx)(a,{variant:`outline`,size:`sm`,"data-testid":`select-dataset-value`,onClick:()=>y(`table`),children:`Select dataset value`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(a,{variant:`ghost`,size:`sm`,onClick:t,children:`Cancel`}),(0,Z.jsx)(a,{colorPalette:`orange`,size:`sm`,"data-testid":`run-until-here-run`,onClick:()=>T(b),children:`Run`})]})})]})})}function Ad(){let{undo:e,redo:t,pastStates:n,futureStates:r,clear:i,pause:o,resume:s}=Vr.temporal.getState(),{workflow:c}=oc();return(0,K.useEffect)(()=>{let n=n=>{let r=navigator.userAgent.includes(`Mac`);n.metaKey&&n.shiftKey&&n.key===`z`||n.ctrlKey&&n.key===`y`?t():(r&&n.metaKey&&!n.shiftKey&&n.key===`z`||!r&&n.ctrlKey&&n.key===`z`)&&e()};return window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`keydown`,n)}},[e,t]),(0,K.useEffect)(()=>{let e;return c.isFetched?e=setTimeout(()=>{s(),i()},1e3):o(),()=>{e&&clearTimeout(e)}},[c.isFetched]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(a,{color:`fg.muted`,size:`xs`,variant:`ghost`,onClick:()=>e(),disabled:n.length===0,children:(0,Z.jsx)(Ei,{width:`16px`})}),(0,Z.jsx)(a,{color:`fg.muted`,size:`xs`,variant:`ghost`,onClick:()=>t(),disabled:r.length===0,children:(0,Z.jsx)(Ai,{width:`16px`})})]})}function jd(){let{name:e,icon:t,description:n,setWorkflow:r}=G(R(e=>({name:e.name,icon:e.icon,description:e.description,setWorkflow:e.setWorkflow}))),[i,o]=(0,K.useState)(!1),[c,l]=(0,K.useState)(e),[u,d]=(0,K.useState)(n),f=w(),h=(0,K.useRef)(null);(0,K.useEffect)(()=>{i||(l(e),d(n))},[e,n,i]),(0,K.useEffect)(()=>{i&&setTimeout(()=>h.current?.focus(),50)},[i]);let g=(0,K.useCallback)(()=>{let t={};c!==e&&(t.name=c),u!==n&&(t.description=u),Object.keys(t).length>0&&r(t),o(!1)},[c,u,e,n,r]);return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(_.Root,{open:i,onOpenChange:({open:e})=>{e||g(),o(e)},positioning:{placement:`bottom`},children:[(0,Z.jsx)(_.Trigger,{asChild:!0,children:(0,Z.jsxs)(s,{cursor:`pointer`,_hover:{opacity:.8},gap:1.5,children:[(0,Z.jsx)(Ht,{icon:t,size:`md`,background:`none`,border:`none`}),(0,Z.jsx)(p,{lineClamp:1,fontSize:`15px`,wordBreak:`break-all`,children:e})]})}),(0,Z.jsxs)(_.Content,{width:`320px`,children:[(0,Z.jsx)(_.Arrow,{}),(0,Z.jsx)(_.Body,{padding:3,children:(0,Z.jsxs)(m,{gap:3,align:`stretch`,children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(le,{fontSize:`xs`,color:`fg.muted`,children:`Name and Icon`}),(0,Z.jsxs)(s,{children:[(0,Z.jsx)(gr,{open:f.open,onClose:f.onClose,onChange:e=>{r({icon:e}),f.onClose()},transform:`translateY(48%)`}),(0,Z.jsx)(k,{content:`Change icon`,positioning:{placement:`top`},openDelay:200,children:(0,Z.jsx)(a,{variant:`outline`,size:`sm`,onClick:f.onOpen,fontSize:`18px`,flexShrink:0,children:t})}),(0,Z.jsx)(V,{ref:h,size:`sm`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g()}})]})]}),(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(le,{fontSize:`xs`,color:`fg.muted`,children:`Description`}),(0,Z.jsx)(Ke,{size:`sm`,value:u,onChange:e=>d(e.target.value),placeholder:`Add a description...`,rows:2})]})]})})]})]})})}function Md({children:e}){let[t,n]=Os(()=>({accept:`node`,drop:(e,t)=>{let n=t.getClientOffset();if(n){let{x:e,y:t}=n;return{name:`Studio`,x:e,y:t}}return{name:`Studio`}},collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}));return(0,Z.jsx)(i,{ref:n,width:`full`,height:`full`,children:e})}function Nd(){let{name:e,nodes:t,edges:n,onNodesChange:r,onNodesDelete:o,onEdgesChange:c,onConnect:l,onConnectStart:u,onConnectEnd:d,setIsDraggingNode:f,setClickedNodeId:h,openResultsPanelRequest:g,setOpenResultsPanelRequest:_,executionStatus:v}=G(R(e=>(typeof window<`u`&&(window.state=e),{name:e.name,nodes:e.nodes,edges:e.edges,onNodesChange:e.onNodesChange,onNodesDelete:e.onNodesDelete,onEdgesChange:e.onEdgesChange,onConnect:e.onConnect,onConnectStart:e.onConnectStart,onConnectEnd:e.onConnectEnd,setIsDraggingNode:e.setIsDraggingNode,setClickedNodeId:e.setClickedNodeId,openResultsPanelRequest:e.openResultsPanelRequest,setOpenResultsPanelRequest:e.setOpenResultsPanelRequest,executionStatus:e.state.execution?.status}))),{project:y}=U(),{socketStatus:b}=jr(),{closeDrawer:x,currentDrawer:S}=kt(),[C,w]=(0,K.useState)(!0),T=(0,K.useRef)(null),[E,D]=(0,K.useState)(!1),O=()=>{let e=T.current;e&&e.collapse()},k=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(g!==void 0&&k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),g===`evaluations`){T.current?.expand(0),T.current?.resize(6);let e=()=>{let t=T.current;if(!t)return;let n=t.getSize();n<70&&(t.resize(n+10),k.current=window.requestAnimationFrame(e))};e()}g===`closed`&&!E&&T.current?.collapse(),_(void 0)},[g]),(0,K.useEffect)(()=>()=>{k.current!==null&&window.cancelAnimationFrame(k.current)},[]),(0,K.useEffect)(()=>{Mt()},[]),ac(),(0,Z.jsxs)(`div`,{style:{width:`100vw`,height:`100vh`},children:[(0,Z.jsx)(Nt,{children:(0,Z.jsxs)(`title`,{children:[`LangWatch - Optimization Studio - `,e]})}),(0,Z.jsx)(En,{children:(0,Z.jsx)(Ro,{backend:ic,children:(0,Z.jsxs)(Pr,{children:[(0,Z.jsx)(Wu,{}),(0,Z.jsxs)(m,{width:`full`,height:`full`,gap:0,children:[(0,Z.jsxs)(s,{width:`full`,background:`bg`,padding:2,borderBottom:`1px solid`,borderColor:`border.emphasized`,children:[(0,Z.jsxs)(s,{width:`full`,children:[(0,Z.jsx)(jt,{href:`/${y?.slug}/workflows`,children:(0,Z.jsx)(gn,{width:24,height:24})}),(0,Z.jsx)(Fr,{}),![`waiting`,`running`].includes(v??``)&&(0,Z.jsx)(cc,{})]}),(0,Z.jsxs)(s,{width:`full`,justify:`center`,children:[(0,Z.jsx)(jd,{}),(0,Z.jsx)(Fd,{status:b,tooltip:b===`connecting-python`?(0,Z.jsxs)(m,{align:`start`,gap:1,padding:2,children:[(0,Z.jsxs)(s,{children:[(0,Z.jsx)(Fd,{status:b===`connecting-python`?`connected`:`connecting`}),(0,Z.jsx)(p,{children:`Socket Connection`})]}),(0,Z.jsxs)(s,{children:[(0,Z.jsx)(Fd,{status:`connecting`}),(0,Z.jsx)(p,{children:`Python Runtime`})]})]}):pn(b)})]}),(0,Z.jsxs)(s,{width:`full`,justify:`end`,children:[(0,Z.jsx)(Ad,{}),(0,Z.jsx)(nt,{}),(0,Z.jsx)(i,{}),(0,Z.jsx)(lu,{}),(0,Z.jsx)(Ju,{}),(0,Z.jsx)(rd,{isDisabled:b!==`connected`})]})]}),(0,Z.jsx)(i,{width:`full`,height:`full`,position:`relative`,children:(0,Z.jsxs)(Pe,{width:`full`,height:`full`,children:[(0,Z.jsx)(Uu,{isOpen:C,setIsOpen:w}),(0,Z.jsxs)(ve,{direction:`vertical`,children:[(0,Z.jsxs)(de,{style:{position:`relative`},children:[(0,Z.jsxs)(s,{position:`absolute`,bottom:3,left:3,zIndex:100,children:[(0,Z.jsx)(Hu,{isOpen:C,setIsOpen:w}),(0,Z.jsx)(a,{size:`sm`,display:E?`block`:`none`,background:`bg`,borderRadius:4,borderColor:`border.emphasized`,variant:`outline`,onClick:()=>{T.current?.expand(70)},children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(Rt,{size:14}),(0,Z.jsx)(p,{children:`Results`})]})})]}),E&&(0,Z.jsx)(Zu,{}),(0,Z.jsx)(Md,{children:(0,Z.jsx)(Id,{nodes:t,edges:n,onNodesChange:r,onEdgesChange:c,onNodesDelete:()=>setTimeout(o,0),onConnect:e=>{let t=l(e);t?.error&&M.create({title:`Error`,description:t.error,type:`error`,duration:5e3,meta:{closable:!0}})},onConnectStart:(e,t)=>u({nodeId:t.nodeId,handleId:t.handleId}),onConnectEnd:()=>d(),isValidConnection:e=>Br({nodes:t,connection:e}),selectNodesOnDrag:!1,onNodeDragStart:()=>{f(!0)},onNodeDragStop:()=>{f(!1)},onPaneClick:()=>{S&&x()},onNodeClick:(e,t)=>{S&&x(),h(t.id)},fitView:!0,fitViewOptions:{maxZoom:1.2},children:(0,Z.jsx)(xn,{position:`bottom-left`,orientation:`horizontal`,style:{marginLeft:C?E?`122px`:`16px`:E?`262px`:`180px`,marginBottom:`15px`}})})})]}),(0,Z.jsx)(_e,{style:{position:`relative`,marginTop:`-20px`},children:(0,Z.jsx)(Tt,{paddingY:2,children:(0,Z.jsx)(i,{width:`30px`,height:`3px`,borderRadius:`full`,background:`bg.emphasized`})})}),(0,Z.jsx)(de,{collapsible:!0,minSize:6,ref:T,onCollapse:()=>D(!0),onExpand:()=>D(!1),defaultSize:0,children:(0,Z.jsx)(Ed,{isCollapsed:E,collapsePanel:O})})]}),(0,Z.jsx)(au,{})]})})]})]})})}),(0,Z.jsx)(he,{marginTop:56}),(0,Z.jsx)(kd,{}),(0,Z.jsx)(Se,{}),(0,Z.jsx)(ye,{})]})}function Pd(){let e=Et(xt(`gray.100`),xt(`gray.900`)),t=Et(`#E5E7EB`,`#2d2d3d`);return(0,Z.jsx)(Dn,{variant:Cn.Dots,gap:12,size:2,bgColor:e,color:t})}function Fd({status:e,tooltip:t}){return(0,Z.jsx)(k,{content:t,children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(i,{minWidth:`12px`,maxWidth:`12px`,minHeight:`12px`,maxHeight:`12px`,background:e===`connected`?`green.500`:e===`disconnected`?`red.300`:`yellow.500`,borderRadius:`full`}),e!==`connected`&&e!=`disconnected`&&(0,Z.jsxs)(s,{children:[(0,Z.jsx)(p,{children:`Connecting...`}),(0,Z.jsx)(r,{size:`sm`})]})]})})}function Id({children:e,defaultZoom:t=1,yAdjust:n=-360,...r}){let i=(0,K.useMemo)(()=>Lu,[]),a=(0,K.useMemo)(()=>({default:ou}),[]),{colorMode:o}=wt();return(0,Z.jsxs)(vn,{nodeTypes:i,edgeTypes:a,colorMode:o,deleteKeyCode:[`Backspace`,`Delete`],defaultViewport:{zoom:t,x:100,y:Math.round(((typeof window<`u`?window.innerHeight-n:0)||300)/2)},proOptions:{hideAttribution:!0},...r,children:[(0,Z.jsx)(Pd,{}),e]})}function Ld(){let{workflow:e}=oc(),{project:t}=U(),{reset:n,setWorkflow:r,setAutosavedWorkflow:i,setLastCommittedWorkflow:o,setCurrentVersionId:s}=G(({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})=>({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})),{clear:c}=Vr.temporal.getState(),l=B.useContext();return(0,K.useEffect)(()=>()=>{l.workflow.getById.invalidate()},[]),(0,K.useEffect)(()=>{let t=e.data?.currentVersion?.dsl;t?(i(void 0),r({...t,workflow_id:e.data?.id,nodes:(t.nodes??[]).map(e=>({...e,selected:!1}))}),o(t),i(Vr.getState().getWorkflow()),s(e.data?.currentVersion?.id)):(n(),c())},[!!e.data]),e.isError?(0,Z.jsx)(xe,{children:(0,Z.jsx)(Re,{error:e.error,fallbackTitle:`Couldn't open this workflow`,icon:(0,Z.jsx)(ge,{size:44,strokeWidth:1.5}),fullHeight:!1,children:t&&(0,Z.jsx)(jt,{href:`/${t.slug}/workflows`,children:(0,Z.jsx)(a,{colorPalette:`orange`,children:`Back to workflows`})})})}):(0,Z.jsx)(Nd,{})}export{Ld as default};
25
- //# sourceMappingURL=_workflow_-BJIdrL-L.js.map
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatWindow-B-UHoZDM.js","assets/rolldown-runtime-DAXXjFlN.js","assets/react-BUD3sqOU.js","assets/portal-Sdfvrza9.js","assets/jsx-runtime-CFwixLRt.js","assets/v-stack-hkuSkmCA.js","assets/fetchSSE-5rVPow_l.js","assets/trpcError-CFsR-0nB.js","assets/index-CPtTUYLD.js","assets/components-CxJbXUhe.js","assets/lib-C55MVODY.js","assets/shiki-CS25xJLQ.js","assets/skeleton-0JSrjbwm.js","assets/heading-C0sACr0w.js","assets/toaster-BsYkODqs.js","assets/dismissable-layer-DBn7OJNY.js","assets/IsolatedErrorBoundary-CZ4MnYEN.js","assets/initial-focus-Bd40-gsw.js","assets/icon-D6xQEiPb.js","assets/dialog.anatomy-DGW-Ydq0.js","assets/split-presence-props-CBmNxzZm.js","assets/icon-button-Wlb_dGXL.js","assets/errors-e711UMq7.js","assets/alert-CPsXih3K.js","assets/index.esm-Cpy5fWo1.js","assets/lu-DlSq9Be4.js","assets/field-uFetMRUQ.js","assets/api-l6Cnm0vQ.js","assets/usePublicEnv-ue4-Igop.js","assets/auth-client-MjRW2PVA.js","assets/next-router-CWLrMXvP.js","assets/defaultOptions-DTVx3qsT.js","assets/index-BmwDapuG.css","assets/prop-types-DeUPn3oD.js","assets/input-group-D7qfFB6C.js","assets/group-DnfJg5ii.js","assets/input-element-CGeOK8ZY.js","assets/SmallLabel-Dh74EKHT.js","assets/nodeUtils-DBBk3sXl.js","assets/stringCasing-Cx6SsTTf.js","assets/ExecutionState-BPNxLkdI.js","assets/handled-error-CI7XXA3n.js","assets/trace-eelqoZyE.js","assets/registry-B64xvGV5.js","assets/loadModelCatalog-DyXUQbVY.js","assets/useWorkflowStore-DGHQA8ai.js","assets/debounce-BJsF8wQY.js","assets/now-flOUcolU.js","assets/isSymbol-COuSxi_J.js","assets/esm-FFYU9Hcy.js","assets/src-BC8fyS2p.js","assets/string-f6JzSHaO.js","assets/value-C__Wy4Z2.js","assets/fast-deep-equal-C5UQ1xXE.js","assets/codeSignature-C0d4aZg9.js","assets/dist-D6F8L7pm.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-BUD3sqOU.js";import{dn as n}from"./portal-Sdfvrza9.js";import{S as r}from"./shiki-CS25xJLQ.js";import{t as i}from"./jsx-runtime-CFwixLRt.js";import{r as a}from"./card-By_Mbslh.js";import{n as o}from"./api-l6Cnm0vQ.js";import{r as s}from"./next-router-CWLrMXvP.js";import{Vt as c}from"./index-CPtTUYLD.js";import{t as l}from"./FullLogo-Db9M_uOO.js";import{t as u}from"./LoadingScreen-DQ62wqSN.js";import{t as d}from"./next-dynamic-DcKsrHUa.js";var f=e(t()),p=i(),m=d(()=>r(()=>import(`./ChatWindow-B-UHoZDM.js`).then(e=>e.ChatBox),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])),{ssr:!1,loading:()=>(0,p.jsx)(u,{})});function h(){let e=s(),{project:t}=c(),r=e.query.workflow,i=o.optimization.getPublishedWorkflow.useQuery({workflowId:r,projectId:t?.id??``},{enabled:!!t?.id&&!!r}),[d,h]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{h(!0)},[]),!d||!e.isReady||i.isLoading?(0,p.jsx)(u,{}):i.data?(0,p.jsx)(n,{height:`100vh`,children:(0,p.jsxs)(n,{height:`full`,bg:`bg.muted`,p:16,pt:4,children:[(0,p.jsx)(l,{}),(0,p.jsx)(a,{height:`90%`,bg:`bg.panel`,p:5,mt:4,children:(0,p.jsx)(m,{useApi:!0,workflowId:r,nodes:i.data.dsl?.nodes,edges:i.data.dsl?.edges})})]})}):(0,p.jsx)(n,{p:8,children:`Workflow not found.`})}function g(){return(0,p.jsx)(h,{})}export{g as default};
3
- //# sourceMappingURL=_workflow_-BKcndaRn.js.map