@flowgram.ai/form-materials 0.2.31 → 0.3.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 (81) hide show
  1. package/bin/index.ts +11 -5
  2. package/bin/materials.ts +1 -1
  3. package/dist/esm/index.js +1256 -1363
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/index.d.mts +232 -202
  6. package/dist/index.d.ts +232 -202
  7. package/dist/index.js +1399 -1507
  8. package/dist/index.js.map +1 -1
  9. package/package.json +5 -4
  10. package/src/components/batch-variable-selector/config.json +6 -2
  11. package/src/components/batch-variable-selector/index.tsx +1 -1
  12. package/src/components/code-editor/theme/light.ts +1 -1
  13. package/src/components/code-editor-mini/config.json +7 -0
  14. package/src/components/code-editor-mini/index.tsx +31 -0
  15. package/src/components/condition-row/config.json +10 -2
  16. package/src/components/condition-row/hooks/useOp.tsx +3 -1
  17. package/src/components/condition-row/hooks/useRule.ts +2 -2
  18. package/src/components/condition-row/index.tsx +2 -1
  19. package/src/components/condition-row/types.ts +3 -1
  20. package/src/components/constant-input/config.json +6 -3
  21. package/src/components/constant-input/index.tsx +10 -71
  22. package/src/components/constant-input/types.ts +6 -10
  23. package/src/components/display-flow-value/config.json +8 -0
  24. package/src/components/display-flow-value/index.tsx +59 -0
  25. package/src/components/display-inputs-values/config.json +9 -0
  26. package/src/components/display-inputs-values/index.tsx +27 -0
  27. package/src/components/display-inputs-values/styles.ts +12 -0
  28. package/src/components/display-outputs/config.json +10 -0
  29. package/src/components/display-outputs/index.tsx +58 -0
  30. package/src/components/display-outputs/styles.ts +12 -0
  31. package/src/components/display-schema-tag/config.json +10 -0
  32. package/src/components/display-schema-tag/index.tsx +44 -0
  33. package/src/components/display-schema-tag/styles.ts +28 -0
  34. package/src/components/display-schema-tree/config.json +11 -0
  35. package/src/components/display-schema-tree/index.tsx +74 -0
  36. package/src/components/display-schema-tree/styles.tsx +90 -0
  37. package/src/components/dynamic-value-input/config.json +11 -2
  38. package/src/components/dynamic-value-input/hooks.ts +53 -0
  39. package/src/components/dynamic-value-input/index.tsx +30 -28
  40. package/src/components/index.ts +6 -0
  41. package/src/components/inputs-values/config.json +2 -1
  42. package/src/components/inputs-values/types.ts +3 -1
  43. package/src/components/json-schema-editor/config.json +3 -3
  44. package/src/components/json-schema-editor/default-value.tsx +1 -1
  45. package/src/components/json-schema-editor/hooks.tsx +1 -1
  46. package/src/components/json-schema-editor/index.tsx +1 -1
  47. package/src/components/json-schema-editor/types.ts +1 -1
  48. package/src/components/type-selector/config.json +6 -2
  49. package/src/components/type-selector/index.tsx +47 -11
  50. package/src/components/variable-selector/config.json +6 -2
  51. package/src/components/variable-selector/index.tsx +1 -1
  52. package/src/components/variable-selector/use-variable-tree.tsx +14 -20
  53. package/src/effects/provide-json-schema-outputs/config.json +4 -5
  54. package/src/effects/provide-json-schema-outputs/index.ts +1 -3
  55. package/src/effects/sync-variable-title/index.ts +1 -0
  56. package/src/form-plugins/infer-inputs-plugin/config.json +3 -1
  57. package/src/form-plugins/infer-inputs-plugin/index.ts +2 -2
  58. package/src/index.ts +1 -1
  59. package/src/{utils → shared}/index.ts +1 -1
  60. package/src/shared/json-schema-preset/config.json +9 -0
  61. package/src/shared/json-schema-preset/create-type-preset-plugin.tsx +26 -0
  62. package/src/shared/json-schema-preset/index.tsx +39 -0
  63. package/src/shared/json-schema-preset/manager.ts +18 -0
  64. package/src/shared/json-schema-preset/type-definition/array.tsx +23 -0
  65. package/src/shared/json-schema-preset/type-definition/boolean.tsx +32 -0
  66. package/src/shared/json-schema-preset/type-definition/index.tsx +24 -0
  67. package/src/shared/json-schema-preset/type-definition/integer.tsx +24 -0
  68. package/src/shared/json-schema-preset/type-definition/number.tsx +24 -0
  69. package/src/shared/json-schema-preset/type-definition/object.tsx +23 -0
  70. package/src/shared/json-schema-preset/type-definition/string.tsx +18 -0
  71. package/src/typings/flow-value/config.json +4 -4
  72. package/src/typings/flow-value/index.ts +1 -1
  73. package/src/typings/index.ts +0 -1
  74. package/src/components/type-selector/constants.tsx +0 -364
  75. package/src/typings/json-schema/config.json +0 -5
  76. package/src/typings/json-schema/index.ts +0 -36
  77. package/src/utils/json-schema/config.json +0 -5
  78. package/src/utils/json-schema/index.ts +0 -180
  79. /package/src/{utils → shared}/format-legacy-refs/config.json +0 -0
  80. /package/src/{utils → shared}/format-legacy-refs/index.ts +0 -0
  81. /package/src/{utils → shared}/format-legacy-refs/readme.md +0 -0
package/dist/esm/index.js CHANGED
@@ -1,552 +1,604 @@
1
1
  // src/components/variable-selector/index.tsx
2
- import React3, { useMemo } from "react";
2
+ import React11, { useMemo } from "react";
3
3
  import { Popover } from "@douyinfe/semi-ui";
4
4
  import { IconChevronDownStroked, IconIssueStroked } from "@douyinfe/semi-icons";
5
5
 
6
6
  // src/components/variable-selector/use-variable-tree.tsx
7
- import React2, { useCallback } from "react";
8
- import { ASTMatch as ASTMatch2, useAvailableVariables } from "@flowgram.ai/editor";
9
- import { Icon as Icon2 } from "@douyinfe/semi-ui";
7
+ import React10, { useCallback } from "react";
8
+ import { JsonSchemaUtils as JsonSchemaUtils2 } from "@flowgram.ai/json-schema";
9
+ import { ASTMatch, useAvailableVariables } from "@flowgram.ai/editor";
10
+ import { Icon } from "@douyinfe/semi-ui";
10
11
 
11
- // src/components/type-selector/constants.tsx
12
+ // src/shared/format-legacy-refs/index.ts
13
+ import { isObject } from "lodash";
14
+ function formatLegacyRefOnSubmit(value) {
15
+ if (isObject(value)) {
16
+ if (isLegacyFlowRefValueSchema(value)) {
17
+ return formatLegacyRefToNewRef(value);
18
+ }
19
+ return Object.fromEntries(
20
+ Object.entries(value).map(([key, value2]) => [
21
+ key,
22
+ formatLegacyRefOnSubmit(value2)
23
+ ])
24
+ );
25
+ }
26
+ if (Array.isArray(value)) {
27
+ return value.map(formatLegacyRefOnSubmit);
28
+ }
29
+ return value;
30
+ }
31
+ function formatLegacyRefOnInit(value) {
32
+ if (isObject(value)) {
33
+ if (isNewFlowRefValueSchema(value)) {
34
+ return formatNewRefToLegacyRef(value);
35
+ }
36
+ return Object.fromEntries(
37
+ Object.entries(value).map(([key, value2]) => [
38
+ key,
39
+ formatLegacyRefOnInit(value2)
40
+ ])
41
+ );
42
+ }
43
+ if (Array.isArray(value)) {
44
+ return value.map(formatLegacyRefOnInit);
45
+ }
46
+ return value;
47
+ }
48
+ function isLegacyFlowRefValueSchema(value) {
49
+ return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
50
+ }
51
+ function isNewFlowRefValueSchema(value) {
52
+ return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
53
+ }
54
+ function formatLegacyRefToNewRef(value) {
55
+ const keyPath = value.content.split(".");
56
+ if (keyPath[1] === "outputs") {
57
+ return {
58
+ type: "ref",
59
+ content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
60
+ };
61
+ }
62
+ return {
63
+ type: "ref",
64
+ content: keyPath
65
+ };
66
+ }
67
+ function formatNewRefToLegacyRef(value) {
68
+ return {
69
+ type: "ref",
70
+ content: value.content.join(".")
71
+ };
72
+ }
73
+
74
+ // src/shared/json-schema-preset/index.tsx
75
+ import React9 from "react";
76
+ import {
77
+ JsonSchemaUtils,
78
+ useTypeManager as useOriginTypeManager,
79
+ TypePresetProvider as OriginTypePresetProvider
80
+ } from "@flowgram.ai/json-schema";
81
+
82
+ // src/shared/json-schema-preset/type-definition/index.tsx
83
+ import { jsonSchemaTypeManager } from "@flowgram.ai/json-schema";
84
+
85
+ // src/shared/json-schema-preset/type-definition/string.tsx
12
86
  import React from "react";
13
- import Icon from "@douyinfe/semi-icons";
14
- var VariableTypeIcons = {
15
- custom: /* @__PURE__ */ React.createElement(
16
- "svg",
87
+ import { Input } from "@douyinfe/semi-ui";
88
+ var stringRegistry = {
89
+ type: "string",
90
+ ConstantRenderer: (props) => /* @__PURE__ */ React.createElement(Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
91
+ };
92
+
93
+ // src/shared/json-schema-preset/type-definition/object.tsx
94
+ import React4 from "react";
95
+
96
+ // src/components/code-editor-mini/index.tsx
97
+ import React3 from "react";
98
+ import styled from "styled-components";
99
+
100
+ // src/components/code-editor/index.tsx
101
+ import React2, { useEffect, useRef } from "react";
102
+ import {
103
+ ActiveLinePlaceholder,
104
+ createRenderer,
105
+ EditorProvider
106
+ } from "@coze-editor/editor/react";
107
+ import preset from "@coze-editor/editor/preset-code";
108
+ import { EditorView } from "@codemirror/view";
109
+
110
+ // src/components/code-editor/utils.ts
111
+ function getSuffixByLanguageId(languageId) {
112
+ if (languageId === "python") {
113
+ return ".py";
114
+ }
115
+ if (languageId === "typescript") {
116
+ return ".ts";
117
+ }
118
+ if (languageId === "shell") {
119
+ return ".sh";
120
+ }
121
+ if (languageId === "json") {
122
+ return ".json";
123
+ }
124
+ return "";
125
+ }
126
+
127
+ // src/components/code-editor/language-features.ts
128
+ import { languages } from "@coze-editor/editor/preset-code";
129
+ import { typescript } from "@coze-editor/editor/language-typescript";
130
+ import { shell } from "@coze-editor/editor/language-shell";
131
+ import { python } from "@coze-editor/editor/language-python";
132
+ import { json } from "@coze-editor/editor/language-json";
133
+ import { mixLanguages } from "@coze-editor/editor";
134
+ languages.register("python", python);
135
+ languages.register("shell", shell);
136
+ languages.register("typescript", typescript);
137
+ languages.register("json", {
138
+ // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
139
+ language: mixLanguages({
140
+ outerLanguage: json.language
141
+ }),
142
+ languageService: json.languageService
143
+ });
144
+ var tsWorkerInit = false;
145
+ var initTsWorker = () => {
146
+ if (tsWorkerInit) {
147
+ return;
148
+ }
149
+ tsWorkerInit = true;
150
+ const tsWorker = new Worker(
151
+ new URL(`@coze-editor/editor/language-typescript/worker`, import.meta.url),
152
+ { type: "module" }
153
+ );
154
+ typescript.languageService.initialize(tsWorker, {
155
+ compilerOptions: {
156
+ // eliminate Promise error
157
+ lib: ["es2015", "dom"],
158
+ noImplicitAny: false
159
+ }
160
+ });
161
+ };
162
+
163
+ // src/components/code-editor/theme/index.ts
164
+ import { themes } from "@coze-editor/editor/preset-code";
165
+
166
+ // src/components/code-editor/theme/light.ts
167
+ import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
168
+ var colors = {
169
+ background: "#F7F7FC",
170
+ // syntax
171
+ comment: "#000A298A",
172
+ key: "#00818C",
173
+ string: "#D1009D",
174
+ number: "#C74200",
175
+ boolean: "#2B57D9",
176
+ null: "#2B57D9",
177
+ separator: "#0F1529D1"
178
+ };
179
+ var lightTheme = createTheme({
180
+ variant: "light",
181
+ settings: {
182
+ background: "#fff",
183
+ foreground: "#000",
184
+ caret: "#000",
185
+ selection: "#d9d9d9",
186
+ gutterBackground: "#f0f0f0",
187
+ gutterForeground: "#666",
188
+ gutterBorderColor: "transparent",
189
+ gutterBorderWidth: 0,
190
+ lineHighlight: "#e1e1e180",
191
+ bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
192
+ tooltip: {
193
+ backgroundColor: "#f0f0f0",
194
+ color: "#000",
195
+ border: "1px solid #ccc"
196
+ },
197
+ link: {
198
+ color: "#007bff"
199
+ },
200
+ completionItemHover: {
201
+ backgroundColor: "#f0f0f0"
202
+ },
203
+ completionItemSelected: {
204
+ backgroundColor: "#e0e0e0"
205
+ },
206
+ completionItemIcon: {
207
+ color: "#333"
208
+ },
209
+ completionItemLabel: {
210
+ color: "#333"
211
+ },
212
+ completionItemInfo: {
213
+ color: "#333"
214
+ },
215
+ completionItemDetail: {
216
+ color: "#666"
217
+ }
218
+ },
219
+ styles: [
220
+ // JSON
17
221
  {
18
- viewBox: "0 0 24 24",
19
- fill: "none",
20
- xmlns: "http://www.w3.org/2000/svg",
21
- width: "1em",
22
- height: "1em",
23
- focusable: "false",
24
- "aria-hidden": "true"
222
+ tag: t.comment,
223
+ color: colors.comment
25
224
  },
26
- /* @__PURE__ */ React.createElement(
27
- "path",
28
- {
29
- fillRule: "evenodd",
30
- clipRule: "evenodd",
31
- d: "M5.1 18L4.5032 20.1702C4.24999 21.0909 4.94281 22 5.89773 22C6.54881 22 7.11964 21.565 7.29227 20.9372L8.1 18H12.1L11.5032 20.1702C11.25 21.0909 11.9428 22 12.8977 22C13.5488 22 14.1196 21.565 14.2923 20.9372L15.1 18H19.5C20.3284 18 21 17.3284 21 16.5C21 15.6716 20.3284 15 19.5 15H15.925L17.575 9H20.5C21.3284 9 22 8.32843 22 7.5C22 6.67157 21.3284 6 20.5 6H18.4L18.9968 3.8298C19.25 2.90906 18.5572 2 17.6023 2C16.9512 2 16.3804 2.43504 16.2077 3.06281L15.4 6H11.4L11.9968 3.8298C12.25 2.90906 11.5572 2 10.6023 2C9.95119 2 9.38036 2.43504 9.20773 3.06281L8.4 6H4.5C3.67157 6 3 6.67157 3 7.5C3 8.32843 3.67157 9 4.5 9H7.575L5.925 15H3.5C2.67157 15 2 15.6716 2 16.5C2 17.3284 2.67157 18 3.5 18H5.1ZM8.925 15L10.575 9H14.575L12.925 15H8.925Z",
32
- fill: "currentColor"
33
- }
34
- )
35
- ),
36
- object: /* @__PURE__ */ React.createElement(
37
- "svg",
38
225
  {
39
- width: "1em",
40
- height: "1em",
41
- viewBox: "0 0 16 16",
42
- fill: "none",
43
- xmlns: "http://www.w3.org/2000/svg"
226
+ tag: [t.propertyName],
227
+ color: colors.key
44
228
  },
45
- /* @__PURE__ */ React.createElement(
46
- "path",
47
- {
48
- d: "M5.33893 1.5835C5.66613 1.5835 5.93137 1.88142 5.93137 2.20862C5.93137 2.53582 5.66613 2.76838 5.33893 2.76838H4.9099C4.34717 2.76838 4.08062 3.07557 4.08062 3.71921V6.58633C4.08062 7.30996 3.80723 7.84734 3.26798 8.19105C3.11426 8.28902 3.10884 8.55273 3.26068 8.65359C3.80476 9.01503 4.08062 9.53994 4.08062 10.2434V13.1251C4.08062 13.7395 4.34717 14.0613 4.9099 14.0613H5.33893C5.66613 14.0613 5.93137 14.3435 5.93137 14.6707C5.93137 14.9979 5.66613 15.2462 5.33893 15.2462H4.64335C3.99177 15.2462 3.48828 15.0268 3.13287 14.6172C2.80708 14.2369 2.64419 13.7103 2.64419 13.0666V10.3165C2.64419 9.8923 2.55534 9.58511 2.37764 9.39494C2.26816 9.27135 1.80618 9.17938 1.38154 9.11602C1.02726 9.06315 0.759057 8.76744 0.765747 8.4093C0.772379 8.0543 1.03439 7.7566 1.38545 7.70346C1.80778 7.63952 2.26906 7.54968 2.37764 7.43477C2.55534 7.22997 2.64419 6.92278 2.64419 6.51319V3.77772C2.64419 3.11945 2.80708 2.59284 3.13287 2.21251C3.48828 1.78829 3.99177 1.5835 4.64335 1.5835H5.33893Z",
49
- fill: "currentColor"
50
- }
51
- ),
52
- /* @__PURE__ */ React.createElement(
53
- "path",
54
- {
55
- d: "M10.962 15.2463C10.6348 15.2463 10.3696 14.9483 10.3696 14.6211C10.3696 14.2939 10.6348 14.0614 10.962 14.0614H11.391C11.9538 14.0614 12.2203 13.7542 12.2203 13.1105V10.2434C12.2203 9.51979 12.4937 8.98241 13.033 8.6387C13.1867 8.54073 13.1921 8.27703 13.0403 8.17616C12.4962 7.81472 12.2203 7.28982 12.2203 6.58638V3.70463C12.2203 3.09024 11.9538 2.76842 11.391 2.76842L10.962 2.76842C10.6348 2.76842 10.3696 2.48627 10.3696 2.15907C10.3696 1.83188 10.6348 1.58354 10.962 1.58354L11.6576 1.58354C12.3092 1.58354 12.8127 1.80296 13.1681 2.21255C13.4939 2.59289 13.6568 3.1195 13.6568 3.76314V6.51324C13.6568 6.93745 13.7456 7.24464 13.9233 7.43481C14.03 7.5553 14.4328 7.64858 14.8186 7.71393C15.1718 7.77376 15.4401 8.06977 15.4334 8.42791C15.4268 8.78291 15.1646 9.08018 14.814 9.13633C14.4306 9.19774 14.0291 9.28303 13.9233 9.39499C13.7456 9.59978 13.6568 9.90697 13.6568 10.3166V13.052C13.6568 13.7103 13.4939 14.2369 13.1681 14.6172C12.8127 15.0415 12.3092 15.2463 11.6576 15.2463H10.962Z",
56
- fill: "currentColor"
57
- }
58
- )
59
- ),
60
- boolean: /* @__PURE__ */ React.createElement(
61
- "svg",
62
229
  {
63
- width: "1em",
64
- height: "1em",
65
- viewBox: "0 0 16 16",
66
- fill: "none",
67
- xmlns: "http://www.w3.org/2000/svg"
230
+ tag: [t.string],
231
+ color: colors.string
68
232
  },
69
- /* @__PURE__ */ React.createElement(
70
- "path",
71
- {
72
- fillRule: "evenodd",
73
- clipRule: "evenodd",
74
- d: "M10.668 4.66683H5.33463C3.49369 4.66683 2.0013 6.15921 2.0013 8.00016C2.0013 9.84111 3.49369 11.3335 5.33463 11.3335H10.668C12.5089 11.3335 14.0013 9.84111 14.0013 8.00016C14.0013 6.15921 12.5089 4.66683 10.668 4.66683ZM5.33463 3.3335C2.75731 3.3335 0.667969 5.42283 0.667969 8.00016C0.667969 10.5775 2.75731 12.6668 5.33463 12.6668H10.668C13.2453 12.6668 15.3346 10.5775 15.3346 8.00016C15.3346 5.42283 13.2453 3.3335 10.668 3.3335H5.33463Z",
75
- fill: "currentColor"
76
- }
77
- ),
78
- /* @__PURE__ */ React.createElement(
79
- "path",
80
- {
81
- fillRule: "evenodd",
82
- clipRule: "evenodd",
83
- d: "M8.66797 8.00016C8.66797 6.89559 9.5634 6.00016 10.668 6.00016C11.7725 6.00016 12.668 6.89559 12.668 8.00016C12.668 9.10473 11.7725 10.0002 10.668 10.0002C9.5634 10.0002 8.66797 9.10473 8.66797 8.00016ZM10.668 7.3335C10.2998 7.3335 10.0013 7.63197 10.0013 8.00016C10.0013 8.36835 10.2998 8.66683 10.668 8.66683C11.0362 8.66683 11.3346 8.36835 11.3346 8.00016C11.3346 7.63197 11.0362 7.3335 10.668 7.3335Z",
84
- fill: "currentColor"
85
- }
86
- )
87
- ),
88
- string: /* @__PURE__ */ React.createElement(
89
- "svg",
90
233
  {
91
- width: "1em",
92
- height: "1em",
93
- viewBox: "0 0 16 16",
94
- fill: "none",
95
- xmlns: "http://www.w3.org/2000/svg"
234
+ tag: [t.number],
235
+ color: colors.number
96
236
  },
97
- /* @__PURE__ */ React.createElement(
98
- "path",
99
- {
100
- d: "M9.3342 3.33321C8.96601 3.33321 8.66753 3.63169 8.66753 3.99988C8.66753 4.36807 8.96601 4.66655 9.3342 4.66655H14.6675C15.0357 4.66655 15.3342 4.36807 15.3342 3.99988C15.3342 3.63169 15.0357 3.33321 14.6675 3.33321H9.3342Z",
101
- fill: "currentColor"
102
- }
103
- ),
104
- /* @__PURE__ */ React.createElement(
105
- "path",
106
- {
107
- d: "M10.0009 7.99988C10.0009 7.63169 10.2993 7.33321 10.6675 7.33321H14.6675C15.0357 7.33321 15.3342 7.63169 15.3342 7.99988C15.3342 8.36807 15.0357 8.66655 14.6675 8.66655H10.6675C10.2993 8.66655 10.0009 8.36807 10.0009 7.99988Z",
108
- fill: "currentColor"
109
- }
110
- ),
111
- /* @__PURE__ */ React.createElement(
112
- "path",
113
- {
114
- d: "M12.0009 11.3332C11.6327 11.3332 11.3342 11.6317 11.3342 11.9999C11.3342 12.3681 11.6327 12.6665 12.0009 12.6665H14.6675C15.0357 12.6665 15.3342 12.3681 15.3342 11.9999C15.3342 11.6317 15.0357 11.3332 14.6675 11.3332H12.0009Z",
115
- fill: "currentColor"
116
- }
117
- ),
118
- /* @__PURE__ */ React.createElement(
119
- "path",
120
- {
121
- d: "M9.86659 14.1482L8.23444 10.1844H3.18136C3.13868 10.1844 3.09685 10.1808 3.05616 10.1738L1.66589 14.1129C1.53049 14.4965 1.10971 14.6978 0.726058 14.5624C0.342408 14.427 0.141166 14.0062 0.276572 13.6225L4.37566 2.00848C4.71323 1.05202 6.05321 1.01763 6.4394 1.95552L11.2289 13.5872C11.3838 13.9634 11.2044 14.394 10.8282 14.5489C10.452 14.7038 10.0215 14.5244 9.86659 14.1482ZM5.44412 3.40791L3.57241 8.71109H7.62778L5.44412 3.40791Z",
122
- fill: "currentColor"
123
- }
124
- )
125
- ),
126
- integer: /* @__PURE__ */ React.createElement(
127
- "svg",
128
237
  {
129
- width: "1em",
130
- height: "1em",
131
- viewBox: "0 0 16 16",
132
- fill: "none",
133
- xmlns: "http://www.w3.org/2000/svg"
238
+ tag: [t.bool],
239
+ color: colors.boolean
134
240
  },
135
- /* @__PURE__ */ React.createElement(
136
- "path",
137
- {
138
- d: "M15.132 11.4601C15.644 11.0121 15.9 10.3921 15.9 9.60007C15.9 8.60807 15.5 7.93607 14.7 7.58407C15.412 7.23207 15.768 6.62407 15.768 5.76007C15.768 5.05607 15.536 4.48007 15.072 4.03207C14.608 3.59207 14.012 3.37207 13.284 3.37207C12.588 3.37207 12.008 3.58007 11.544 3.99607C11.064 4.42007 10.808 4.98807 10.776 5.70007H12C12.064 4.88407 12.492 4.47607 13.284 4.47607C14.124 4.47607 14.544 4.91607 14.544 5.79607C14.544 6.66007 14.112 7.09207 13.248 7.09207H13.044V8.16007H13.248C14.2 8.16007 14.676 8.62807 14.676 9.56407C14.676 10.5081 14.212 10.9801 13.284 10.9801C12.9 10.9801 12.584 10.8761 12.336 10.6681C12.064 10.4441 11.916 10.1161 11.892 9.68407H10.668C10.692 10.4761 10.964 11.0841 11.484 11.5081C11.948 11.8921 12.548 12.0841 13.284 12.0841C14.036 12.0841 14.652 11.8761 15.132 11.4601Z",
139
- fill: "currentColor"
140
- }
141
- ),
142
- /* @__PURE__ */ React.createElement(
143
- "path",
144
- {
145
- d: "M4.46875 12.0003V10.9083L7.75675 6.91228C8.06075 6.54428 8.21275 6.16428 8.21275 5.77228C8.21275 4.90828 7.79675 4.47628 6.96475 4.47628C6.60475 4.47628 6.31275 4.57628 6.08875 4.77628C5.83275 5.00828 5.70475 5.34828 5.70475 5.79628H4.48075C4.48075 5.07628 4.71275 4.49228 5.17675 4.04428C5.64075 3.60428 6.23675 3.38428 6.96475 3.38428C7.70075 3.38428 8.29675 3.60028 8.75275 4.03228C9.20875 4.47228 9.43675 5.05628 9.43675 5.78428C9.43675 6.13628 9.36875 6.45628 9.23275 6.74428C9.12075 6.97628 8.92075 7.27228 8.63275 7.63228L5.95675 10.9083H9.43675V12.0003H4.46875Z",
146
- fill: "currentColor"
147
- }
148
- ),
149
- /* @__PURE__ */ React.createElement(
150
- "path",
151
- {
152
- d: "M1.668 12.0001V4.78805L0 6.25205V4.89605L1.668 3.45605H2.892V12.0001H1.668Z",
153
- fill: "currentColor"
154
- }
155
- )
156
- ),
157
- number: /* @__PURE__ */ React.createElement(
158
- "svg",
159
241
  {
160
- width: "1em",
161
- height: "1em",
162
- viewBox: "0 0 16 16",
163
- fill: "none",
164
- xmlns: "http://www.w3.org/2000/svg"
242
+ tag: [t.null],
243
+ color: colors.null
165
244
  },
166
- /* @__PURE__ */ React.createElement(
167
- "path",
168
- {
169
- d: "M3.44151 5.3068C3.44151 3.83404 4.71542 2.64014 6.18818 2.64014C7.66094 2.64014 8.93484 3.83404 8.93484 5.3068V10.6135C8.93484 12.0862 7.66094 13.2801 6.18818 13.2801C4.71542 13.2801 3.44151 12.0862 3.44151 10.6135V5.3068ZM7.60151 5.3068C7.60151 4.57042 6.92456 3.97347 6.18818 3.97347C5.4518 3.97347 4.77484 4.57042 4.77484 5.3068V10.6135C4.77484 11.3498 5.4518 11.9468 6.18818 11.9468C6.92456 11.9468 7.60151 11.3498 7.60151 10.6135V5.3068Z",
170
- fill: "currentColor"
171
- }
172
- ),
173
- /* @__PURE__ */ React.createElement(
174
- "path",
175
- {
176
- d: "M12.9882 2.64014C11.5154 2.64014 10.2415 3.83404 10.2415 5.3068V10.6135C10.2415 12.0862 11.5154 13.2801 12.9882 13.2801C14.4609 13.2801 15.7348 12.0862 15.7348 10.6135V5.3068C15.7348 3.83404 14.4609 2.64014 12.9882 2.64014ZM14.4015 10.6135C14.4015 11.3498 13.7246 11.9468 12.9882 11.9468C12.2518 11.9468 11.5748 11.3498 11.5748 10.6135V5.3068C11.5748 4.57042 12.2518 3.97347 12.9882 3.97347C13.7246 3.97347 14.4015 4.57042 14.4015 5.3068V10.6135Z",
177
- fill: "currentColor"
178
- }
179
- ),
180
- /* @__PURE__ */ React.createElement(
181
- "path",
182
- {
183
- d: "M1.21484 13.2001C1.76713 13.2001 2.21484 12.7524 2.21484 12.2001C2.21484 11.6479 1.76713 11.2001 1.21484 11.2001C0.662559 11.2001 0.214844 11.6479 0.214844 12.2001C0.214844 12.7524 0.662559 13.2001 1.21484 13.2001Z",
184
- fill: "currentColor"
185
- }
186
- )
187
- ),
188
- array: /* @__PURE__ */ React.createElement(
189
- "svg",
190
245
  {
191
- width: "1em",
192
- height: "1em",
193
- viewBox: "0 0 16 16",
194
- fill: "none",
195
- xmlns: "http://www.w3.org/2000/svg"
246
+ tag: [t.separator],
247
+ color: colors.separator
196
248
  },
197
- /* @__PURE__ */ React.createElement(
198
- "path",
199
- {
200
- d: "M5.23759 1.00342H2.00391V14.997H5.23759V13.6251H3.35127V2.37534H5.23759V1.00342Z",
201
- fill: "currentColor"
202
- }
203
- ),
204
- /* @__PURE__ */ React.createElement(
205
- "path",
206
- {
207
- d: "M10.7624 1.00342H13.9961V14.997H10.7624V13.6251H12.6487V2.37534H10.7624V1.00342Z",
208
- fill: "currentColor"
209
- }
210
- )
211
- ),
212
- stream: /* @__PURE__ */ React.createElement(
213
- "svg",
249
+ // markdown
214
250
  {
215
- viewBox: "0 0 1024 1024",
216
- version: "1.1",
217
- xmlns: "http://www.w3.org/2000/svg",
218
- width: "1em",
219
- height: "1em"
251
+ tag: [t.heading],
252
+ color: "#3e76ef"
220
253
  },
221
- /* @__PURE__ */ React.createElement(
222
- "path",
223
- {
224
- d: "M879.674 544.51l-158.254-0.221c-8.534 2.287-17.305-2.776-19.588-11.307l-23.862-75.877-74.742 350.891c0 0-1.523 18.507-11.518 18.507s-26.9 0.281-26.9 0.281c-8.259 2.213-16.748-2.687-18.961-10.949l-92.741-457.648-70.305 330.634c-2.261 8.291-11.94 15.206-20.385 12.986l-24.876 0.339c-8.723 2.293-17.685-2.789-20.023-11.349L270.629 544.51 143.993 544.51c-8.831 0-15.993-7.159-15.993-15.993l0-31.986c0-8.831 7.162-15.993 15.993-15.993l157.429-0.516c9.565-0.304 17.685 0.788 20.023 9.351l24.386 76.092 68.642-358.907c0 0 3.4-10.894 14.397-10.894 10.994 0 34.107-0.448 34.107-0.448 8.262-2.213 16.751 2.687 18.965 10.949l91.912 454.126 67.948-326.182c2.213-8.262 8.707-15.161 16.965-12.948l27.316-0.333c8.531-2.287 17.301 2.776 19.588 11.31l46.665 148.4 127.337 0c8.835 0 15.993 7.162 15.993 15.993l0 31.986C895.667 537.352 888.508 544.51 879.674 544.51z",
225
- fill: "currentColor"
226
- }
227
- )
228
- ),
229
- map: /* @__PURE__ */ React.createElement(
230
- "svg",
231
254
  {
232
- viewBox: "0 0 1024 1024",
233
- version: "1.1",
234
- xmlns: "http://www.w3.org/2000/svg",
235
- width: "1em",
236
- height: "1em"
255
+ tag: [t.processingInstruction],
256
+ color: "#3e76ef"
237
257
  },
238
- /* @__PURE__ */ React.createElement(
239
- "path",
240
- {
241
- d: "M877.860571 938.642286h-645.851428c-27.574857 0-54.052571-11.337143-73.508572-31.744a110.957714 110.957714 0 0 1-30.500571-76.8V193.828571c0-28.745143 10.971429-56.32 30.500571-76.726857a101.888 101.888 0 0 1 73.508572-31.817143h574.171428c27.501714 0 53.979429 11.337143 73.508572 31.744 19.529143 20.333714 30.500571 48.054857 30.500571 76.8v522.020572a34.157714 34.157714 0 0 1-6.948571 22.820571c-37.156571 19.382857-57.636571 39.350857-57.636572 72.630857 0 39.716571 19.894857 50.029714 57.636572 72.777143a34.816 34.816 0 0 1-8.045714 49.298286 32.256 32.256 0 0 1-17.334858 5.193143z m-32.256-254.537143V193.828571a40.228571 40.228571 0 0 0-39.497142-41.179428H232.009143a40.301714 40.301714 0 0 0-39.497143 41.252571V699.245714c17.773714-9.874286 37.449143-14.994286 57.417143-14.921143h595.675428v-0.073142z m-595.675428 187.245714h566.198857c-22.893714-11.190857-27.940571-39.497143-28.013714-59.977143 0-20.260571 3.218286-43.885714 28.013714-59.904h-566.125714c-31.670857 0-57.417143 26.843429-57.417143 59.977143 0 33.060571 25.746286 59.904 57.344 59.904z",
242
- fill: "currentColor"
243
- }
244
- ),
245
- /* @__PURE__ */ React.createElement(
246
- "path",
247
- {
248
- d: "M320 128m32.036571 0l-0.073142 0q32.036571 0 32.036571 32.036571l0 511.926858q0 32.036571-32.036571 32.036571l0.073142 0q-32.036571 0-32.036571-32.036571l0-511.926858q0-32.036571 32.036571-32.036571Z",
249
- fill: "currentColor"
250
- }
251
- )
252
- )
258
+ // shell
259
+ // curl
260
+ {
261
+ tag: [t.standard(t.variableName)],
262
+ color: "#00804A"
263
+ },
264
+ // -X
265
+ {
266
+ tag: [t.attributeName],
267
+ color: "#C74200"
268
+ },
269
+ // url in string (includes quotes), e.g. "https://..."
270
+ {
271
+ tag: [t.special(t.string)],
272
+ color: "#2B57D9"
273
+ }
274
+ ]
275
+ });
276
+
277
+ // src/components/code-editor/theme/dark.ts
278
+ import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
279
+ var colors2 = {
280
+ background: "#151B27",
281
+ // syntax
282
+ comment: "#FFFFFF63",
283
+ key: "#39E5D7",
284
+ string: "#FF94D2",
285
+ number: "#FF9933",
286
+ boolean: "#78B0FF",
287
+ null: "#78B0FF",
288
+ separator: "#FFFFFFC9"
253
289
  };
254
- var ArrayIcons = {
255
- object: /* @__PURE__ */ React.createElement(
256
- "svg",
290
+ var darkTheme = createTheme2({
291
+ variant: "dark",
292
+ settings: {
293
+ background: colors2.background,
294
+ foreground: "#fff",
295
+ caret: "#AEAFAD",
296
+ selection: "#d9d9d942",
297
+ gutterBackground: colors2.background,
298
+ gutterForeground: "#FFFFFF63",
299
+ gutterBorderColor: "transparent",
300
+ gutterBorderWidth: 0,
301
+ lineHighlight: "#272e3d36",
302
+ bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
303
+ tooltip: {
304
+ backgroundColor: "#363D4D",
305
+ color: "#fff",
306
+ border: "none"
307
+ },
308
+ link: {
309
+ color: "#4daafc"
310
+ },
311
+ completionItemHover: {
312
+ backgroundColor: "#FFFFFF0F"
313
+ },
314
+ completionItemSelected: {
315
+ backgroundColor: "#FFFFFF17"
316
+ },
317
+ completionItemIcon: {
318
+ color: "#FFFFFFC9"
319
+ },
320
+ completionItemLabel: {
321
+ color: "#FFFFFFC9"
322
+ },
323
+ completionItemInfo: {
324
+ color: "#FFFFFFC9"
325
+ },
326
+ completionItemDetail: {
327
+ color: "#FFFFFF63"
328
+ }
329
+ },
330
+ styles: [
331
+ // json
257
332
  {
258
- width: "1em",
259
- height: "1em",
260
- viewBox: "0 0 16 16",
261
- fill: "none",
262
- xmlns: "http://www.w3.org/2000/svg"
333
+ tag: t2.comment,
334
+ color: colors2.comment
263
335
  },
264
- /* @__PURE__ */ React.createElement(
265
- "path",
266
- {
267
- fillRule: "evenodd",
268
- clipRule: "evenodd",
269
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM3.82031 5.9091C3.82031 5.18535 4.40703 4.59863 5.13078 4.59863C5.85453 4.59863 6.44124 5.18535 6.44124 5.9091C6.44124 6.56485 5.9596 7.1081 5.33078 7.2044V8.70018H5.32877C5.32982 8.75093 5.33078 8.80912 5.33078 8.87034V9.72111C5.33078 10.0195 5.57268 10.2614 5.87109 10.2614H6.24124C6.55613 10.2614 6.8114 10.5167 6.8114 10.8316C6.8114 11.1465 6.55613 11.4017 6.24124 11.4017H5.87109C4.94291 11.4017 4.19047 10.6493 4.19047 9.72111V6.82186C3.96158 6.58607 3.82031 6.26397 3.82031 5.9091ZM7.33679 5.9091C7.33679 5.59421 7.59205 5.33894 7.90694 5.33894H11.6085C11.9234 5.33894 12.1786 5.59421 12.1786 5.9091C12.1786 6.22399 11.9234 6.47925 11.6085 6.47925H7.90694C7.59205 6.47925 7.33679 6.22399 7.33679 5.9091ZM7.33679 9.86846C7.33679 9.55357 7.59205 9.2983 7.90694 9.2983H11.6085C11.9234 9.2983 12.1786 9.55357 12.1786 9.86846C12.1786 10.1833 11.9234 10.4386 11.6085 10.4386H7.90694C7.59205 10.4386 7.33679 10.1833 7.33679 9.86846Z",
270
- fill: "currentColor"
271
- }
272
- )
273
- ),
274
- boolean: /* @__PURE__ */ React.createElement(
275
- "svg",
276
336
  {
277
- width: "1em",
278
- height: "1em",
279
- viewBox: "0 0 16 16",
280
- fill: "none",
281
- xmlns: "http://www.w3.org/2000/svg"
337
+ tag: [t2.propertyName],
338
+ color: colors2.key
282
339
  },
283
- /* @__PURE__ */ React.createElement(
284
- "path",
285
- {
286
- fillRule: "evenodd",
287
- clipRule: "evenodd",
288
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM2.75 7.99993C2.75 6.14518 4.25358 4.6416 6.10833 4.6416H9.775C11.6298 4.6416 13.1333 6.14518 13.1333 7.99993C13.1333 9.85469 11.6298 11.3583 9.775 11.3583H6.10833C4.25358 11.3583 2.75 9.85469 2.75 7.99993ZM6.10833 5.85827C4.92552 5.85827 3.96667 6.81713 3.96667 7.99993C3.96667 9.18274 4.92552 10.1416 6.10833 10.1416H9.775C10.9578 10.1416 11.9167 9.18274 11.9167 7.99993C11.9167 6.81713 10.9578 5.85827 9.775 5.85827H6.10833ZM8.25 7.99993C8.25 7.1577 8.93277 6.47493 9.775 6.47493C10.6172 6.47493 11.3 7.1577 11.3 7.99993C11.3 8.84217 10.6172 9.52493 9.775 9.52493C8.93277 9.52493 8.25 8.84217 8.25 7.99993ZM9.775 7.6916C9.60471 7.6916 9.46667 7.82965 9.46667 7.99993C9.46667 8.17022 9.60471 8.30827 9.775 8.30827C9.94529 8.30827 10.0833 8.17022 10.0833 7.99993C10.0833 7.82965 9.94529 7.6916 9.775 7.6916Z",
289
- fill: "currentColor"
290
- }
291
- )
292
- ),
293
- string: /* @__PURE__ */ React.createElement(
294
- "svg",
295
340
  {
296
- width: "1em",
297
- height: "1em",
298
- viewBox: "0 0 16 16",
299
- fill: "none",
300
- xmlns: "http://www.w3.org/2000/svg"
341
+ tag: [t2.string],
342
+ color: colors2.string
301
343
  },
302
- /* @__PURE__ */ React.createElement(
303
- "path",
304
- {
305
- fillRule: "evenodd",
306
- clipRule: "evenodd",
307
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM5.23701 4.07158C5.50364 3.3161 6.56205 3.28894 6.86709 4.02974L10 11.6383C10.1329 11.9609 9.979 12.3302 9.65631 12.4631C9.33363 12.596 8.96434 12.4421 8.83147 12.1194L7.8021 9.61951H4.61903L3.7474 12.0891C3.63126 12.4182 3.27034 12.5908 2.94127 12.4747C2.6122 12.3585 2.43958 11.9976 2.55573 11.6685L5.23701 4.07158ZM6.08814 5.45704L5.06505 8.35579H7.28174L6.08814 5.45704ZM8.81938 6.07534C8.81938 5.75166 9.08177 5.48926 9.40545 5.48926H12.8941C13.2178 5.48926 13.4802 5.75166 13.4802 6.07534C13.4802 6.39902 13.2178 6.66142 12.8941 6.66142H9.40545C9.08177 6.66142 8.81938 6.39902 8.81938 6.07534ZM10.2668 9.69181C10.2668 9.36812 10.5292 9.10573 10.8529 9.10573H12.8941C13.2178 9.10573 13.4802 9.36812 13.4802 9.69181C13.4802 10.0155 13.2178 10.2779 12.8941 10.2779H10.8529C10.5292 10.2779 10.2668 10.0155 10.2668 9.69181Z",
308
- fill: "currentColor"
309
- }
310
- )
311
- ),
312
- integer: /* @__PURE__ */ React.createElement(
313
- "svg",
314
344
  {
315
- width: "1em",
316
- height: "1em",
317
- viewBox: "0 0 16 16",
318
- fill: "none",
319
- xmlns: "http://www.w3.org/2000/svg"
345
+ tag: [t2.number],
346
+ color: colors2.number
320
347
  },
321
- /* @__PURE__ */ React.createElement(
322
- "path",
323
- {
324
- fillRule: "evenodd",
325
- clipRule: "evenodd",
326
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM10.3614 5.22374C10.7161 4.90585 11.1581 4.75 11.6762 4.75C12.2173 4.75 12.6723 4.91467 13.0281 5.25207L13.0291 5.253C13.3852 5.59688 13.561 6.03946 13.561 6.56767C13.561 6.89 13.4945 7.17448 13.3539 7.41445C13.2572 7.57972 13.1279 7.71948 12.9685 7.83428C13.1575 7.95643 13.3099 8.11182 13.4225 8.30109C13.5793 8.5644 13.6531 8.88311 13.6531 9.24936C13.6531 9.83787 13.4612 10.3151 13.0656 10.6612C12.6982 10.9795 12.2305 11.1341 11.6762 11.1341C11.1356 11.1341 10.6805 10.9925 10.324 10.6977C9.92124 10.3691 9.71723 9.90026 9.69942 9.31256L9.69473 9.15802H10.846L10.8539 9.2997C10.8689 9.5698 10.9591 9.75553 11.1096 9.87941L11.1106 9.88027C11.2519 9.99882 11.4365 10.0631 11.6762 10.0631C11.9765 10.0631 12.1743 9.98692 12.2984 9.86071C12.4229 9.73404 12.4984 9.53136 12.4984 9.22422C12.4984 8.92116 12.4215 8.72127 12.2939 8.59581C12.1658 8.46989 11.961 8.39373 11.6511 8.39373H11.3586V7.34788H11.6511C11.9297 7.34788 12.111 7.27834 12.2238 7.16555C12.3366 7.05276 12.4062 6.87138 12.4062 6.59281C12.4062 6.30696 12.3378 6.12041 12.2277 6.00501C12.1188 5.89092 11.9446 5.82098 11.6762 5.82098C11.4248 5.82098 11.2539 5.88537 11.1407 5.99325C11.0268 6.10185 10.9497 6.27522 10.9291 6.5375L10.9183 6.67577H9.76788L9.77492 6.51904C9.79886 5.98644 9.99237 5.54989 10.3614 5.22374ZM5.91032 5.26037C6.26612 4.92297 6.72112 4.7583 7.26219 4.7583C7.80751 4.7583 8.26297 4.91938 8.61401 5.25194L8.61501 5.25289C8.96719 5.59272 9.13852 6.04185 9.13852 6.58435C9.13852 6.84997 9.08709 7.09565 8.9817 7.31883L8.98114 7.31999C8.89563 7.49712 8.74775 7.71415 8.54418 7.96862L8.54322 7.96981L6.87446 10.0127H9.13852V11.0753H5.36909V10.1089L7.69946 7.27679C7.89456 7.04062 7.98374 6.80773 7.98374 6.57597C7.98374 6.29602 7.91626 6.11385 7.8078 6.00122C7.70036 5.88964 7.52811 5.8209 7.26219 5.8209C7.04017 5.8209 6.87439 5.88173 6.75075 5.99193C6.61227 6.11766 6.53226 6.30918 6.53226 6.59273V6.74273H5.37747V6.59273C5.37747 6.05443 5.55248 5.60586 5.90934 5.2613L5.91032 5.26037ZM3.50907 4.80865H4.56964V11.0754H3.41486V6.2201L2.25 7.24249V5.89561L3.50907 4.80865Z",
327
- fill: "currentColor"
328
- }
329
- )
330
- ),
331
- number: /* @__PURE__ */ React.createElement(
332
- "svg",
333
348
  {
334
- width: "1em",
335
- height: "1em",
336
- viewBox: "0 0 16 16",
337
- fill: "none",
338
- xmlns: "http://www.w3.org/2000/svg"
349
+ tag: [t2.bool],
350
+ color: colors2.boolean
339
351
  },
340
- /* @__PURE__ */ React.createElement(
341
- "path",
342
- {
343
- fillRule: "evenodd",
344
- clipRule: "evenodd",
345
- d: "M3.6139 1.58154H0V14.4191H3.6139V13.1269H1.36702V2.87375H3.6139V1.58154ZM3.41656 13.3271V13.3269H1.17155V13.3271H3.41656ZM0.199219 14.2191H0.197344V1.78154H3.41656V1.78174H0.199219V14.2191ZM16 1.58154H12.3861V2.87375H14.633V13.1269H12.3861V14.4191H16V1.58154ZM12.5834 1.78154V2.67375H12.5853V1.78174H15.8027V1.78154H12.5834ZM12.5853 14.2191V13.3271H14.8322V2.67394H14.8303V13.3269H12.5834V14.2191H12.5853ZM6.86771 4.5C5.87019 4.5 5.00104 5.30767 5.00104 6.31667V9.63333C5.00104 10.6423 5.87019 11.45 6.86771 11.45C7.86523 11.45 8.73438 10.6423 8.73438 9.63333V6.31667C8.73438 5.30767 7.86523 4.5 6.86771 4.5ZM11.1177 4.5C10.1202 4.5 9.25104 5.30767 9.25104 6.31667V9.63333C9.25104 10.6423 10.1202 11.45 11.1177 11.45C12.1152 11.45 12.9844 10.6423 12.9844 9.63333V6.31667C12.9844 5.30767 12.1152 4.5 11.1177 4.5ZM6.13438 6.31667C6.13438 5.9503 6.47884 5.63333 6.86771 5.63333C7.25657 5.63333 7.60104 5.9503 7.60104 6.31667V9.63333C7.60104 9.9997 7.25657 10.3167 6.86771 10.3167C6.47884 10.3167 6.13438 9.9997 6.13438 9.63333V6.31667ZM10.3844 6.31667C10.3844 5.9503 10.7288 5.63333 11.1177 5.63333C11.5066 5.63333 11.851 5.9503 11.851 6.31667V9.63333C11.851 9.9997 11.5066 10.3167 11.1177 10.3167C10.7288 10.3167 10.3844 9.9997 10.3844 9.63333V6.31667ZM3.75938 9.85C3.33135 9.85 2.98438 10.197 2.98438 10.625C2.98438 11.053 3.33135 11.4 3.75938 11.4C4.1874 11.4 4.53438 11.053 4.53438 10.625C4.53438 10.197 4.1874 9.85 3.75938 9.85Z",
346
- fill: "currentColor"
347
- }
348
- )
349
- )
350
- };
351
- var getSchemaIcon = (value) => {
352
- if (value?.type === "array") {
353
- return ArrayIcons[value.items?.type || "object"];
354
- }
355
- return VariableTypeIcons[value?.type || "object"];
356
- };
357
- var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
358
- var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
359
- var baseOptions = [
360
- {
361
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "string" }) }), firstUppercase("string")),
362
- value: "string"
363
- },
364
- {
365
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "integer" }) }), firstUppercase("integer")),
366
- value: "integer"
367
- },
368
- {
369
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "number" }) }), firstUppercase("number")),
370
- value: "number"
371
- },
372
- {
373
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "boolean" }) }), firstUppercase("boolean")),
374
- value: "boolean"
375
- },
376
- {
377
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "object" }) }), firstUppercase("object")),
378
- value: "object"
379
- }
380
- ];
381
- var options = [
382
- ...baseOptions,
383
- {
384
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "array" }) }), firstUppercase("array")),
385
- value: "array",
386
- children: baseOptions.map((_opt) => ({
387
- ..._opt,
388
- value: `${_opt.value}`,
389
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(
390
- Icon,
391
- {
392
- size: "small",
393
- svg: getSchemaIcon({ type: "array", items: { type: _opt.value } })
394
- }
395
- ), firstUppercase(_opt.value))
396
- }))
397
- }
398
- ];
399
-
400
- // src/utils/json-schema/index.ts
401
- import { get } from "lodash";
402
- import { ASTFactory, ASTKind, ASTMatch } from "@flowgram.ai/editor";
403
- var JsonSchemaUtils;
404
- ((JsonSchemaUtils2) => {
405
- function schemaToAST(jsonSchema) {
406
- const { type, extra } = jsonSchema || {};
407
- const { weak = false } = extra || {};
408
- if (!type) {
409
- return void 0;
352
+ {
353
+ tag: [t2.null],
354
+ color: colors2.null
355
+ },
356
+ {
357
+ tag: [t2.separator],
358
+ color: colors2.separator
359
+ },
360
+ // markdown
361
+ {
362
+ tag: [t2.heading],
363
+ color: "#6b6bff"
364
+ },
365
+ {
366
+ tag: [t2.processingInstruction],
367
+ color: "#6b6bff"
368
+ },
369
+ // shell
370
+ // curl
371
+ {
372
+ tag: [t2.standard(t2.variableName)],
373
+ color: "#3BEB84"
374
+ },
375
+ // -X
376
+ {
377
+ tag: [t2.attributeName],
378
+ color: "#FF9933"
379
+ },
380
+ // url in string (includes quotes), e.g. "https://..."
381
+ {
382
+ tag: [t2.special(t2.string)],
383
+ color: "#78B0FF"
410
384
  }
411
- switch (type) {
412
- case "object":
413
- if (weak) {
414
- return { kind: ASTKind.Object, weak: true };
415
- }
416
- return ASTFactory.createObject({
417
- properties: Object.entries(jsonSchema.properties || {}).sort((a, b) => (get(a?.[1], "extra.index") || 0) - (get(b?.[1], "extra.index") || 0)).map(([key, _property]) => ({
418
- key,
419
- type: schemaToAST(_property),
420
- meta: {
421
- title: _property.title,
422
- description: _property.description
423
- }
424
- }))
425
- });
426
- case "array":
427
- if (weak) {
428
- return { kind: ASTKind.Array, weak: true };
429
- }
430
- return ASTFactory.createArray({
431
- items: schemaToAST(jsonSchema.items)
432
- });
433
- case "map":
434
- if (weak) {
435
- return { kind: ASTKind.Map, weak: true };
436
- }
437
- return ASTFactory.createMap({
438
- valueType: schemaToAST(jsonSchema.additionalProperties)
439
- });
440
- case "string":
441
- return ASTFactory.createString();
442
- case "number":
443
- return ASTFactory.createNumber();
444
- case "boolean":
445
- return ASTFactory.createBoolean();
446
- case "integer":
447
- return ASTFactory.createInteger();
448
- default:
449
- return ASTFactory.createCustomType({ typeName: type });
450
- }
451
- }
452
- JsonSchemaUtils2.schemaToAST = schemaToAST;
453
- function astToSchema(typeAST, options2) {
454
- const { drilldown = true } = options2 || {};
455
- if (ASTMatch.isString(typeAST)) {
456
- return {
457
- type: "string"
458
- };
385
+ ]
386
+ });
387
+
388
+ // src/components/code-editor/theme/index.ts
389
+ themes.register("dark", darkTheme);
390
+ themes.register("light", lightTheme);
391
+
392
+ // src/components/code-editor/index.tsx
393
+ var OriginCodeEditor = createRenderer(preset, [
394
+ EditorView.theme({
395
+ "&.cm-focused": {
396
+ outline: "none"
459
397
  }
460
- if (ASTMatch.isBoolean(typeAST)) {
461
- return {
462
- type: "boolean"
463
- };
398
+ })
399
+ ]);
400
+ function CodeEditor({
401
+ value,
402
+ onChange,
403
+ languageId = "python",
404
+ theme = "light",
405
+ children,
406
+ placeholder,
407
+ activeLinePlaceholder,
408
+ options,
409
+ readonly
410
+ }) {
411
+ const editorRef = useRef(null);
412
+ useEffect(() => {
413
+ if (languageId === "typescript") {
414
+ initTsWorker();
464
415
  }
465
- if (ASTMatch.isNumber(typeAST)) {
466
- return {
467
- type: "number"
468
- };
416
+ }, [languageId]);
417
+ useEffect(() => {
418
+ if (editorRef.current?.getValue() !== value) {
419
+ editorRef.current?.setValue(String(value || ""));
469
420
  }
470
- if (ASTMatch.isInteger(typeAST)) {
471
- return {
472
- type: "integer"
473
- };
421
+ }, [value]);
422
+ return /* @__PURE__ */ React2.createElement(EditorProvider, null, /* @__PURE__ */ React2.createElement(
423
+ OriginCodeEditor,
424
+ {
425
+ defaultValue: value,
426
+ options: {
427
+ uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
428
+ languageId,
429
+ theme,
430
+ placeholder,
431
+ readOnly: readonly,
432
+ editable: !readonly,
433
+ ...options || {}
434
+ },
435
+ didMount: (editor) => {
436
+ editorRef.current = editor;
437
+ },
438
+ onChange: (e) => onChange?.(e.value)
439
+ },
440
+ activeLinePlaceholder && /* @__PURE__ */ React2.createElement(ActiveLinePlaceholder, null, activeLinePlaceholder),
441
+ children
442
+ ));
443
+ }
444
+
445
+ // src/components/code-editor-mini/index.tsx
446
+ var UIMini = styled.div`
447
+ .ͼ1 .cm-content {
448
+ padding: 0;
449
+ }
450
+ `;
451
+ function CodeEditorMini(props) {
452
+ return /* @__PURE__ */ React3.createElement(UIMini, null, /* @__PURE__ */ React3.createElement(
453
+ CodeEditor,
454
+ {
455
+ ...props,
456
+ options: {
457
+ lineNumbersGutter: false,
458
+ foldGutter: false,
459
+ ...props.options || {}
460
+ }
474
461
  }
475
- if (ASTMatch.isObject(typeAST)) {
476
- return {
477
- type: "object",
478
- properties: drilldown ? Object.fromEntries(
479
- typeAST.properties.map((property) => {
480
- const schema = astToSchema(property.type);
481
- if (property.meta?.title && schema) {
482
- schema.title = property.meta.title;
483
- }
484
- if (property.meta?.description && schema) {
485
- schema.description = property.meta.description;
486
- }
487
- return [property.key, schema];
488
- })
489
- ) : {}
490
- };
462
+ ));
463
+ }
464
+
465
+ // src/shared/json-schema-preset/type-definition/object.tsx
466
+ var objectRegistry = {
467
+ type: "object",
468
+ ConstantRenderer: (props) => /* @__PURE__ */ React4.createElement(
469
+ CodeEditorMini,
470
+ {
471
+ value: props.value,
472
+ onChange: (v) => props.onChange?.(v),
473
+ languageId: "json",
474
+ placeholder: "Please Input Object",
475
+ readonly: props.readonly
491
476
  }
492
- if (ASTMatch.isArray(typeAST)) {
493
- return {
494
- type: "array",
495
- items: drilldown ? astToSchema(typeAST.items) : void 0
496
- };
477
+ )
478
+ };
479
+
480
+ // src/shared/json-schema-preset/type-definition/number.tsx
481
+ import React5 from "react";
482
+ import { InputNumber } from "@douyinfe/semi-ui";
483
+ var numberRegistry = {
484
+ type: "number",
485
+ ConstantRenderer: (props) => /* @__PURE__ */ React5.createElement(
486
+ InputNumber,
487
+ {
488
+ placeholder: "Please Input Number",
489
+ size: "small",
490
+ disabled: props.readonly,
491
+ hideButtons: true,
492
+ ...props
497
493
  }
498
- if (ASTMatch.isMap(typeAST)) {
499
- return {
500
- type: "map",
501
- items: drilldown ? astToSchema(typeAST.valueType) : void 0
502
- };
503
- }
504
- if (ASTMatch.isCustomType(typeAST)) {
505
- return {
506
- type: typeAST.typeName
507
- };
494
+ )
495
+ };
496
+
497
+ // src/shared/json-schema-preset/type-definition/integer.tsx
498
+ import React6 from "react";
499
+ import { InputNumber as InputNumber2 } from "@douyinfe/semi-ui";
500
+ var integerRegistry = {
501
+ type: "integer",
502
+ ConstantRenderer: (props) => /* @__PURE__ */ React6.createElement(
503
+ InputNumber2,
504
+ {
505
+ placeholder: "Please Input Integer",
506
+ size: "small",
507
+ disabled: props.readonly,
508
+ precision: 0,
509
+ ...props
508
510
  }
509
- return void 0;
511
+ )
512
+ };
513
+
514
+ // src/shared/json-schema-preset/type-definition/boolean.tsx
515
+ import React7 from "react";
516
+ import { Select } from "@douyinfe/semi-ui";
517
+ var booleanRegistry = {
518
+ type: "boolean",
519
+ ConstantRenderer: (props) => {
520
+ const { value, onChange, ...rest } = props;
521
+ return /* @__PURE__ */ React7.createElement(
522
+ Select,
523
+ {
524
+ placeholder: "Please Select Boolean",
525
+ size: "small",
526
+ disabled: props.readonly,
527
+ optionList: [
528
+ { label: "True", value: 1 },
529
+ { label: "False", value: 0 }
530
+ ],
531
+ value: value ? 1 : 0,
532
+ onChange: (value2) => onChange?.(!!value2),
533
+ ...rest
534
+ }
535
+ );
510
536
  }
511
- JsonSchemaUtils2.astToSchema = astToSchema;
512
- function isASTMatchSchema(typeAST, schema) {
513
- if (Array.isArray(schema)) {
514
- return typeAST.isTypeEqual(
515
- ASTFactory.createUnion({
516
- types: schema.map((_schema) => schemaToAST(_schema)).filter(Boolean)
517
- })
518
- );
537
+ };
538
+
539
+ // src/shared/json-schema-preset/type-definition/array.tsx
540
+ import React8 from "react";
541
+ var arrayRegistry = {
542
+ type: "array",
543
+ ConstantRenderer: (props) => /* @__PURE__ */ React8.createElement(
544
+ CodeEditorMini,
545
+ {
546
+ value: props.value,
547
+ languageId: "json",
548
+ onChange: (v) => props.onChange?.(v),
549
+ placeholder: "Please Input Array",
550
+ readonly: props.readonly
519
551
  }
520
- return typeAST.isTypeEqual(schemaToAST(schema));
521
- }
522
- JsonSchemaUtils2.isASTMatchSchema = isASTMatchSchema;
523
- })(JsonSchemaUtils || (JsonSchemaUtils = {}));
552
+ )
553
+ };
554
+
555
+ // src/shared/json-schema-preset/type-definition/index.tsx
556
+ var jsonSchemaTypePreset = [
557
+ stringRegistry,
558
+ objectRegistry,
559
+ numberRegistry,
560
+ integerRegistry,
561
+ booleanRegistry,
562
+ arrayRegistry
563
+ ];
564
+ jsonSchemaTypePreset.forEach((_type) => jsonSchemaTypeManager.register(_type));
565
+
566
+ // src/shared/json-schema-preset/create-type-preset-plugin.tsx
567
+ import {
568
+ BaseTypeManager,
569
+ jsonSchemaContainerModule
570
+ } from "@flowgram.ai/json-schema";
571
+ import { definePluginCreator } from "@flowgram.ai/editor";
572
+ var createTypePresetPlugin = definePluginCreator({
573
+ onInit(ctx, opts) {
574
+ const typeManager = ctx.get(BaseTypeManager);
575
+ jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
576
+ opts.types.forEach((_type) => typeManager.register(_type));
577
+ },
578
+ containerModules: [jsonSchemaContainerModule]
579
+ });
580
+
581
+ // src/shared/json-schema-preset/index.tsx
582
+ var useTypeManager = () => useOriginTypeManager();
583
+ var JsonSchemaTypePresetProvider = ({
584
+ types = [],
585
+ children
586
+ }) => /* @__PURE__ */ React9.createElement(OriginTypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
524
587
 
525
588
  // src/components/variable-selector/use-variable-tree.tsx
526
589
  function useVariableTree(params) {
527
590
  const { includeSchema, excludeSchema, customSkip } = params;
591
+ const typeManager = useTypeManager();
528
592
  const variables = useAvailableVariables();
529
593
  const getVariableTypeIcon = useCallback((variable) => {
530
594
  if (variable.meta?.icon) {
531
595
  if (typeof variable.meta.icon === "string") {
532
- return /* @__PURE__ */ React2.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
596
+ return /* @__PURE__ */ React10.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
533
597
  }
534
598
  return variable.meta.icon;
535
599
  }
536
- const _type = variable.type;
537
- if (ASTMatch2.isArray(_type)) {
538
- return /* @__PURE__ */ React2.createElement(
539
- Icon2,
540
- {
541
- size: "small",
542
- svg: ArrayIcons[_type.items?.kind.toLowerCase()] || VariableTypeIcons.array
543
- }
544
- );
545
- }
546
- if (ASTMatch2.isCustomType(_type)) {
547
- return /* @__PURE__ */ React2.createElement(Icon2, { size: "small", svg: VariableTypeIcons[_type.typeName.toLowerCase()] });
548
- }
549
- return /* @__PURE__ */ React2.createElement(Icon2, { size: "small", svg: VariableTypeIcons[variable.type?.kind.toLowerCase()] });
600
+ const schema = JsonSchemaUtils2.astToSchema(variable.type, { drilldownObject: false });
601
+ return /* @__PURE__ */ React10.createElement(Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
550
602
  }, []);
551
603
  const renderVariable = (variable, parentFields = []) => {
552
604
  let type = variable?.type;
@@ -554,15 +606,16 @@ function useVariableTree(params) {
554
606
  return null;
555
607
  }
556
608
  let children;
557
- if (ASTMatch2.isObject(type)) {
609
+ if (ASTMatch.isObject(type)) {
558
610
  children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
559
611
  }
560
612
  const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
561
613
  const key = keyPath.join(".");
562
- const isSchemaInclude = includeSchema ? JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
563
- const isSchemaExclude = excludeSchema ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
614
+ const isSchemaInclude = includeSchema ? JsonSchemaUtils2.isASTMatchSchema(type, includeSchema) : true;
615
+ const isSchemaExclude = excludeSchema ? JsonSchemaUtils2.isASTMatchSchema(type, excludeSchema) : false;
564
616
  const isCustomSkip = customSkip ? customSkip(variable) : false;
565
- const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip;
617
+ const isMetaDisabled = variable.meta?.disabled;
618
+ const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
566
619
  if (!isSchemaMatch && !children?.length) {
567
620
  return null;
568
621
  }
@@ -582,9 +635,9 @@ function useVariableTree(params) {
582
635
  }
583
636
 
584
637
  // src/components/variable-selector/styles.tsx
585
- import styled, { css } from "styled-components";
638
+ import styled2, { css } from "styled-components";
586
639
  import { Tag, TreeSelect } from "@douyinfe/semi-ui";
587
- var UIRootTitle = styled.div`
640
+ var UIRootTitle = styled2.div`
588
641
  margin-right: 4px;
589
642
  min-width: 20px;
590
643
  overflow: hidden;
@@ -592,7 +645,7 @@ var UIRootTitle = styled.div`
592
645
  white-space: nowrap;
593
646
  color: var(--semi-color-text-2);
594
647
  `;
595
- var UIVarName = styled.div`
648
+ var UIVarName = styled2.div`
596
649
  overflow: hidden;
597
650
  text-overflow: ellipsis;
598
651
  white-space: nowrap;
@@ -601,7 +654,7 @@ var UIVarName = styled.div`
601
654
  min-width: 50%;
602
655
  `}
603
656
  `;
604
- var UITag = styled(Tag)`
657
+ var UITag = styled2(Tag)`
605
658
  width: 100%;
606
659
  display: flex;
607
660
  align-items: center;
@@ -616,7 +669,7 @@ var UITag = styled(Tag)`
616
669
  height: 22px;
617
670
  }
618
671
  `;
619
- var UITreeSelect = styled(TreeSelect)`
672
+ var UITreeSelect = styled2(TreeSelect)`
620
673
  outline: ${({ $error }) => $error ? "1px solid red" : "none"};
621
674
 
622
675
  & .semi-tree-select-selection {
@@ -632,7 +685,7 @@ var UITreeSelect = styled(TreeSelect)`
632
685
  padding-left: 10px;
633
686
  }
634
687
  `;
635
- var UIPopoverContent = styled.div`
688
+ var UIPopoverContent = styled2.div`
636
689
  padding: 10px;
637
690
  display: inline-flex;
638
691
  align-items: center;
@@ -665,11 +718,11 @@ var VariableSelector = ({
665
718
  }, [value]);
666
719
  const renderIcon = (icon) => {
667
720
  if (typeof icon === "string") {
668
- return /* @__PURE__ */ React3.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
721
+ return /* @__PURE__ */ React11.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
669
722
  }
670
723
  return icon;
671
724
  };
672
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
725
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
673
726
  UITreeSelect,
674
727
  {
675
728
  dropdownMatchSelectWidth: false,
@@ -686,10 +739,10 @@ var VariableSelector = ({
686
739
  },
687
740
  renderSelectedItem: (_option) => {
688
741
  if (!_option?.keyPath) {
689
- return /* @__PURE__ */ React3.createElement(
742
+ return /* @__PURE__ */ React11.createElement(
690
743
  UITag,
691
744
  {
692
- prefixIcon: /* @__PURE__ */ React3.createElement(IconIssueStroked, null),
745
+ prefixIcon: /* @__PURE__ */ React11.createElement(IconIssueStroked, null),
693
746
  color: "amber",
694
747
  closable: !readonly,
695
748
  onClose: () => onChange(void 0)
@@ -698,13 +751,13 @@ var VariableSelector = ({
698
751
  );
699
752
  }
700
753
  const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
701
- const rootTitle = /* @__PURE__ */ React3.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
702
- return /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement(
754
+ const rootTitle = /* @__PURE__ */ React11.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
755
+ return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement(
703
756
  Popover,
704
757
  {
705
- content: /* @__PURE__ */ React3.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ React3.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
758
+ content: /* @__PURE__ */ React11.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ React11.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
706
759
  },
707
- /* @__PURE__ */ React3.createElement(
760
+ /* @__PURE__ */ React11.createElement(
708
761
  UITag,
709
762
  {
710
763
  prefixIcon: rootIcon,
@@ -712,12 +765,12 @@ var VariableSelector = ({
712
765
  onClose: () => onChange(void 0)
713
766
  },
714
767
  rootTitle,
715
- !_option.isRoot && /* @__PURE__ */ React3.createElement(UIVarName, { $inSelector: true }, _option.label)
768
+ !_option.isRoot && /* @__PURE__ */ React11.createElement(UIVarName, { $inSelector: true }, _option.label)
716
769
  )
717
770
  ));
718
771
  },
719
772
  showClear: false,
720
- arrowIcon: /* @__PURE__ */ React3.createElement(IconChevronDownStroked, { size: "small" }),
773
+ arrowIcon: /* @__PURE__ */ React11.createElement(IconChevronDownStroked, { size: "small" }),
721
774
  triggerRender,
722
775
  placeholder: config?.placeholder ?? "Select Variable..."
723
776
  }
@@ -725,8 +778,10 @@ var VariableSelector = ({
725
778
  };
726
779
 
727
780
  // src/components/type-selector/index.tsx
728
- import React4, { useMemo as useMemo2 } from "react";
729
- import { Cascader, IconButton } from "@douyinfe/semi-ui";
781
+ import React12, { useMemo as useMemo2 } from "react";
782
+ import { Cascader, Icon as Icon2, IconButton } from "@douyinfe/semi-ui";
783
+ var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
784
+ var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
730
785
  var getTypeSelectValue = (value) => {
731
786
  if (value?.type === "array" && value?.items) {
732
787
  return [value.type, ...getTypeSelectValue(value.items) || []];
@@ -743,20 +798,37 @@ var parseTypeSelectValue = (value) => {
743
798
  function TypeSelector(props) {
744
799
  const { value, onChange, readonly, disabled, style } = props;
745
800
  const selectValue = useMemo2(() => getTypeSelectValue(value), [value]);
746
- return /* @__PURE__ */ React4.createElement(
801
+ const typeManager = useTypeManager();
802
+ const icon = typeManager.getDisplayIcon(value || {});
803
+ const options = useMemo2(
804
+ () => typeManager.getTypeRegistriesWithParentType().map((_type) => {
805
+ const isArray2 = _type.type === "array";
806
+ return {
807
+ label: /* @__PURE__ */ React12.createElement("div", { style: labelStyle }, /* @__PURE__ */ React12.createElement(Icon2, { size: "small", svg: _type.icon }), firstUppercase(_type.type)),
808
+ value: _type.type,
809
+ children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
810
+ label: /* @__PURE__ */ React12.createElement("div", { style: labelStyle }, /* @__PURE__ */ React12.createElement(
811
+ Icon2,
812
+ {
813
+ size: "small",
814
+ svg: typeManager.getDisplayIcon({
815
+ type: "array",
816
+ items: { type: _type2.type }
817
+ })
818
+ }
819
+ ), firstUppercase(_type2.type)),
820
+ value: _type2.type
821
+ })) : []
822
+ };
823
+ }),
824
+ []
825
+ );
826
+ return /* @__PURE__ */ React12.createElement(
747
827
  Cascader,
748
828
  {
749
829
  disabled: readonly || disabled,
750
830
  size: "small",
751
- triggerRender: () => /* @__PURE__ */ React4.createElement(
752
- IconButton,
753
- {
754
- size: "small",
755
- style,
756
- disabled: readonly || disabled,
757
- icon: getSchemaIcon(value)
758
- }
759
- ),
831
+ triggerRender: () => /* @__PURE__ */ React12.createElement(IconButton, { size: "small", style, disabled: readonly || disabled, icon }),
760
832
  treeData: options,
761
833
  value: selectValue,
762
834
  leafOnly: true,
@@ -768,7 +840,7 @@ function TypeSelector(props) {
768
840
  }
769
841
 
770
842
  // src/components/json-schema-editor/index.tsx
771
- import React9, { useMemo as useMemo5, useState as useState4 } from "react";
843
+ import React17, { useMemo as useMemo5, useState as useState4 } from "react";
772
844
  import { Button, Checkbox, IconButton as IconButton3 } from "@douyinfe/semi-ui";
773
845
  import {
774
846
  IconExpand,
@@ -780,36 +852,36 @@ import {
780
852
  } from "@douyinfe/semi-icons";
781
853
 
782
854
  // src/components/json-schema-editor/styles.tsx
783
- import React5 from "react";
784
- import styled2, { css as css2 } from "styled-components";
855
+ import React13 from "react";
856
+ import styled3, { css as css2 } from "styled-components";
785
857
  import Icon3 from "@douyinfe/semi-icons";
786
- var UIContainer = styled2.div`
858
+ var UIContainer = styled3.div`
787
859
  /* & .semi-input {
788
860
  background-color: #fff;
789
861
  border-radius: 6px;
790
862
  height: 24px;
791
863
  } */
792
864
  `;
793
- var UIRow = styled2.div`
865
+ var UIRow = styled3.div`
794
866
  display: flex;
795
867
  align-items: center;
796
868
  gap: 6px;
797
869
  `;
798
- var UICollapseTrigger = styled2.div`
870
+ var UICollapseTrigger = styled3.div`
799
871
  cursor: pointer;
800
872
  margin-right: 5px;
801
873
  `;
802
- var UIExpandDetail = styled2.div`
874
+ var UIExpandDetail = styled3.div`
803
875
  display: flex;
804
876
  flex-direction: column;
805
877
  `;
806
- var UILabel = styled2.div`
878
+ var UILabel = styled3.div`
807
879
  font-size: 12px;
808
880
  color: #999;
809
881
  font-weight: 400;
810
882
  margin-bottom: 2px;
811
883
  `;
812
- var UIProperties = styled2.div`
884
+ var UIProperties = styled3.div`
813
885
  display: grid;
814
886
  grid-template-columns: auto 1fr;
815
887
 
@@ -818,7 +890,7 @@ var UIProperties = styled2.div`
818
890
  margin-top: 10px;
819
891
  `}
820
892
  `;
821
- var UIPropertyLeft = styled2.div`
893
+ var UIPropertyLeft = styled3.div`
822
894
  grid-column: 1;
823
895
  position: relative;
824
896
  width: 16px;
@@ -855,7 +927,7 @@ var UIPropertyLeft = styled2.div`
855
927
  `;
856
928
  }}
857
929
  `;
858
- var UIPropertyRight = styled2.div`
930
+ var UIPropertyRight = styled3.div`
859
931
  grid-column: 2;
860
932
  margin-bottom: 10px;
861
933
 
@@ -863,7 +935,7 @@ var UIPropertyRight = styled2.div`
863
935
  margin-bottom: 0px;
864
936
  }
865
937
  `;
866
- var UIPropertyMain = styled2.div`
938
+ var UIPropertyMain = styled3.div`
867
939
  display: flex;
868
940
  flex-direction: column;
869
941
  gap: 10px;
@@ -893,22 +965,22 @@ var UIPropertyMain = styled2.div`
893
965
  `;
894
966
  }}
895
967
  `;
896
- var UICollapsible = styled2.div`
968
+ var UICollapsible = styled3.div`
897
969
  display: none;
898
970
 
899
971
  ${({ $collapse }) => $collapse && css2`
900
972
  display: block;
901
973
  `}
902
974
  `;
903
- var UIName = styled2.div`
975
+ var UIName = styled3.div`
904
976
  flex-grow: 1;
905
977
  `;
906
- var UIType = styled2.div``;
907
- var UIRequired = styled2.div``;
908
- var UIActions = styled2.div`
978
+ var UIType = styled3.div``;
979
+ var UIRequired = styled3.div``;
980
+ var UIActions = styled3.div`
909
981
  white-space: nowrap;
910
982
  `;
911
- var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
983
+ var iconAddChildrenSvg = /* @__PURE__ */ React13.createElement(
912
984
  "svg",
913
985
  {
914
986
  className: "icon-icon icon-icon-coz_add_node ",
@@ -918,7 +990,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
918
990
  fill: "currentColor",
919
991
  xmlns: "http://www.w3.org/2000/svg"
920
992
  },
921
- /* @__PURE__ */ React5.createElement(
993
+ /* @__PURE__ */ React13.createElement(
922
994
  "path",
923
995
  {
924
996
  fillRule: "evenodd",
@@ -926,19 +998,19 @@ var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
926
998
  d: "M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
927
999
  }
928
1000
  ),
929
- /* @__PURE__ */ React5.createElement("path", { d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z" })
1001
+ /* @__PURE__ */ React13.createElement("path", { d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z" })
930
1002
  );
931
- var IconAddChildren = () => /* @__PURE__ */ React5.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
932
- var DefaultValueWrapper = styled2.div`
1003
+ var IconAddChildren = () => /* @__PURE__ */ React13.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
1004
+ var DefaultValueWrapper = styled3.div`
933
1005
  margin: 0;
934
1006
  `;
935
- var JSONViewerWrapper = styled2.div`
1007
+ var JSONViewerWrapper = styled3.div`
936
1008
  padding: 0 0 24px;
937
1009
  &:first-child {
938
1010
  margin-top: 0px;
939
1011
  }
940
1012
  `;
941
- var JSONHeader = styled2.div`
1013
+ var JSONHeader = styled3.div`
942
1014
  display: flex;
943
1015
  justify-content: space-between;
944
1016
  align-items: center;
@@ -947,17 +1019,17 @@ var JSONHeader = styled2.div`
947
1019
  height: 36px;
948
1020
  padding: 0 8px 0 12px;
949
1021
  `;
950
- var JSONHeaderLeft = styled2.div`
1022
+ var JSONHeaderLeft = styled3.div`
951
1023
  display: flex;
952
1024
  align-items: center;
953
1025
  gap: 10px;
954
1026
  `;
955
- var JSONHeaderRight = styled2.div`
1027
+ var JSONHeaderRight = styled3.div`
956
1028
  display: flex;
957
1029
  align-items: center;
958
1030
  gap: 10px;
959
1031
  `;
960
- var ConstantInputWrapper = styled2.div`
1032
+ var ConstantInputWrapper = styled3.div`
961
1033
  flex-grow: 1;
962
1034
 
963
1035
  & .semi-tree-select,
@@ -968,7 +1040,7 @@ var ConstantInputWrapper = styled2.div`
968
1040
  `;
969
1041
 
970
1042
  // src/components/json-schema-editor/hooks.tsx
971
- import { useEffect, useMemo as useMemo3, useRef, useState } from "react";
1043
+ import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2, useState } from "react";
972
1044
  import { omit } from "lodash";
973
1045
  var _id = 0;
974
1046
  function genId() {
@@ -1002,8 +1074,8 @@ function usePropertiesEdit(value, onChange) {
1002
1074
  [isDrilldownObject]
1003
1075
  );
1004
1076
  const [propertyList, setPropertyList] = useState(initPropertyList);
1005
- const mountRef = useRef(false);
1006
- useEffect(() => {
1077
+ const mountRef = useRef2(false);
1078
+ useEffect2(() => {
1007
1079
  if (mountRef.current) {
1008
1080
  setPropertyList((_list) => {
1009
1081
  const nameMap = /* @__PURE__ */ new Map();
@@ -1071,7 +1143,7 @@ function usePropertiesEdit(value, onChange) {
1071
1143
  (_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
1072
1144
  );
1073
1145
  };
1074
- useEffect(() => {
1146
+ useEffect2(() => {
1075
1147
  if (!isDrilldownObject) {
1076
1148
  setPropertyList([]);
1077
1149
  }
@@ -1086,7 +1158,7 @@ function usePropertiesEdit(value, onChange) {
1086
1158
  }
1087
1159
 
1088
1160
  // src/components/json-schema-editor/default-value.tsx
1089
- import React7, { useRef as useRef2, useState as useState2, useCallback as useCallback2 } from "react";
1161
+ import React15, { useRef as useRef3, useState as useState2, useCallback as useCallback2 } from "react";
1090
1162
  import { IconButton as IconButton2, JsonViewer, Tooltip } from "@douyinfe/semi-ui";
1091
1163
  import { IconBrackets } from "@douyinfe/semi-icons";
1092
1164
 
@@ -1110,100 +1182,37 @@ function getValueType(value) {
1110
1182
  }
1111
1183
 
1112
1184
  // src/components/constant-input/index.tsx
1113
- import React6, { useMemo as useMemo4 } from "react";
1114
- import { Input, InputNumber, Select } from "@douyinfe/semi-ui";
1115
- var defaultStrategies = [
1116
- {
1117
- hit: (schema) => schema?.type === "string",
1118
- Renderer: (props) => /* @__PURE__ */ React6.createElement(Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
1119
- },
1120
- {
1121
- hit: (schema) => schema?.type === "number",
1122
- Renderer: (props) => /* @__PURE__ */ React6.createElement(
1123
- InputNumber,
1124
- {
1125
- placeholder: "Please Input Number",
1126
- size: "small",
1127
- disabled: props.readonly,
1128
- hideButtons: true,
1129
- ...props
1130
- }
1131
- )
1132
- },
1133
- {
1134
- hit: (schema) => schema?.type === "integer",
1135
- Renderer: (props) => /* @__PURE__ */ React6.createElement(
1136
- InputNumber,
1137
- {
1138
- placeholder: "Please Input Integer",
1139
- size: "small",
1140
- disabled: props.readonly,
1141
- hideButtons: true,
1142
- precision: 0,
1143
- ...props
1144
- }
1145
- )
1146
- },
1147
- {
1148
- hit: (schema) => schema?.type === "boolean",
1149
- Renderer: (props) => {
1150
- const { value, onChange, ...rest } = props;
1151
- return /* @__PURE__ */ React6.createElement(
1152
- Select,
1153
- {
1154
- placeholder: "Please Select Boolean",
1155
- size: "small",
1156
- disabled: props.readonly,
1157
- optionList: [
1158
- { label: "True", value: 1 },
1159
- { label: "False", value: 0 }
1160
- ],
1161
- value: value ? 1 : 0,
1162
- onChange: (value2) => onChange?.(!!value2),
1163
- ...rest
1164
- }
1165
- );
1166
- }
1167
- }
1168
- ];
1185
+ import React14, { useMemo as useMemo4 } from "react";
1186
+ import { Input as Input2 } from "@douyinfe/semi-ui";
1169
1187
  function ConstantInput(props) {
1170
- const {
1171
- value,
1172
- onChange,
1173
- schema,
1174
- strategies: extraStrategies,
1175
- fallbackRenderer,
1176
- readonly,
1177
- ...rest
1178
- } = props;
1179
- const strategies = useMemo4(
1180
- // user's extraStrategies first
1181
- () => [...extraStrategies || [], ...defaultStrategies],
1182
- [extraStrategies]
1183
- );
1188
+ const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
1189
+ const typeManager = useTypeManager();
1184
1190
  const Renderer2 = useMemo4(() => {
1185
- const strategy = strategies.find((_strategy) => _strategy.hit(schema));
1191
+ const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
1192
+ if (!strategy) {
1193
+ return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
1194
+ }
1186
1195
  return strategy?.Renderer;
1187
1196
  }, [strategies, schema]);
1188
1197
  if (!Renderer2) {
1189
1198
  if (fallbackRenderer) {
1190
- return React6.createElement(fallbackRenderer, {
1199
+ return React14.createElement(fallbackRenderer, {
1191
1200
  value,
1192
1201
  onChange,
1193
1202
  readonly,
1194
1203
  ...rest
1195
1204
  });
1196
1205
  }
1197
- return /* @__PURE__ */ React6.createElement(Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
1206
+ return /* @__PURE__ */ React14.createElement(Input2, { size: "small", disabled: true, placeholder: "Unsupported type" });
1198
1207
  }
1199
- return /* @__PURE__ */ React6.createElement(Renderer2, { value, onChange, readonly, ...rest });
1208
+ return /* @__PURE__ */ React14.createElement(Renderer2, { value, onChange, readonly, ...rest });
1200
1209
  }
1201
1210
 
1202
1211
  // src/components/json-schema-editor/default-value.tsx
1203
1212
  function DefaultValue(props) {
1204
1213
  const { value, schema, type, onChange, placeholder, jsonFormatText } = props;
1205
- const wrapperRef = useRef2(null);
1206
- const JsonViewerRef = useRef2(null);
1214
+ const wrapperRef = useRef3(null);
1215
+ const JsonViewerRef = useRef3(null);
1207
1216
  const [internalJsonValue, setInternalJsonValue] = useState2(
1208
1217
  getValueType(value) === "string" ? value : ""
1209
1218
  );
@@ -1230,16 +1239,16 @@ function DefaultValue(props) {
1230
1239
  console.error("Invalid JSON:", error);
1231
1240
  }
1232
1241
  }, [internalJsonValue, onChange]);
1233
- return type === "object" ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(JSONHeader, null, /* @__PURE__ */ React7.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ React7.createElement(JSONHeaderRight, null, /* @__PURE__ */ React7.createElement(Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ React7.createElement(
1242
+ return type === "object" ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(JSONHeader, null, /* @__PURE__ */ React15.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ React15.createElement(JSONHeaderRight, null, /* @__PURE__ */ React15.createElement(Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ React15.createElement(
1234
1243
  IconButton2,
1235
1244
  {
1236
- icon: /* @__PURE__ */ React7.createElement(IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
1245
+ icon: /* @__PURE__ */ React15.createElement(IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
1237
1246
  size: "small",
1238
1247
  type: "tertiary",
1239
1248
  theme: "borderless",
1240
1249
  onClick: handleFormatJson
1241
1250
  }
1242
- )))), /* @__PURE__ */ React7.createElement(
1251
+ )))), /* @__PURE__ */ React15.createElement(
1243
1252
  JSONViewerWrapper,
1244
1253
  {
1245
1254
  ref: wrapperRef,
@@ -1253,7 +1262,7 @@ function DefaultValue(props) {
1253
1262
  setJsonReadOnly(false);
1254
1263
  }
1255
1264
  },
1256
- /* @__PURE__ */ React7.createElement(
1265
+ /* @__PURE__ */ React15.createElement(
1257
1266
  JsonViewer,
1258
1267
  {
1259
1268
  ref: JsonViewerRef,
@@ -1271,7 +1280,7 @@ function DefaultValue(props) {
1271
1280
  onChange: handleJsonChange
1272
1281
  }
1273
1282
  )
1274
- )) : /* @__PURE__ */ React7.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React7.createElement(
1283
+ )) : /* @__PURE__ */ React15.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React15.createElement(
1275
1284
  ConstantInput,
1276
1285
  {
1277
1286
  value,
@@ -1283,15 +1292,15 @@ function DefaultValue(props) {
1283
1292
  }
1284
1293
 
1285
1294
  // src/components/json-schema-editor/components/blur-input.tsx
1286
- import React8, { useEffect as useEffect2, useState as useState3 } from "react";
1287
- import Input2 from "@douyinfe/semi-ui/lib/es/input";
1295
+ import React16, { useEffect as useEffect3, useState as useState3 } from "react";
1296
+ import Input3 from "@douyinfe/semi-ui/lib/es/input";
1288
1297
  function BlurInput(props) {
1289
1298
  const [value, setValue] = useState3("");
1290
- useEffect2(() => {
1299
+ useEffect3(() => {
1291
1300
  setValue(props.value);
1292
1301
  }, [props.value]);
1293
- return /* @__PURE__ */ React8.createElement(
1294
- Input2,
1302
+ return /* @__PURE__ */ React16.createElement(
1303
+ Input3,
1295
1304
  {
1296
1305
  ...props,
1297
1306
  value,
@@ -1310,7 +1319,7 @@ function JsonSchemaEditor(props) {
1310
1319
  value,
1311
1320
  onChangeProps
1312
1321
  );
1313
- return /* @__PURE__ */ React9.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React9.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React9.createElement(
1322
+ return /* @__PURE__ */ React17.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React17.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React17.createElement(
1314
1323
  PropertyEdit,
1315
1324
  {
1316
1325
  readonly,
@@ -1325,13 +1334,13 @@ function JsonSchemaEditor(props) {
1325
1334
  onRemoveProperty(_property.key);
1326
1335
  }
1327
1336
  }
1328
- ))), /* @__PURE__ */ React9.createElement(
1337
+ ))), /* @__PURE__ */ React17.createElement(
1329
1338
  Button,
1330
1339
  {
1331
1340
  disabled: readonly,
1332
1341
  size: "small",
1333
1342
  style: { marginTop: 10, marginLeft: 16 },
1334
- icon: /* @__PURE__ */ React9.createElement(IconPlus, null),
1343
+ icon: /* @__PURE__ */ React17.createElement(IconPlus, null),
1335
1344
  onClick: onAddProperty
1336
1345
  },
1337
1346
  config?.addButtonText ?? "Add"
@@ -1364,7 +1373,7 @@ function PropertyEdit(props) {
1364
1373
  });
1365
1374
  };
1366
1375
  const showCollapse = isDrilldownObject && propertyList.length > 0;
1367
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
1376
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
1368
1377
  UIPropertyLeft,
1369
1378
  {
1370
1379
  type,
@@ -1376,8 +1385,8 @@ function PropertyEdit(props) {
1376
1385
  $parentExpand,
1377
1386
  $parentType
1378
1387
  },
1379
- showCollapse && /* @__PURE__ */ React9.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React9.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React9.createElement(IconChevronRight, { size: "small" }))
1380
- ), /* @__PURE__ */ React9.createElement(UIPropertyRight, null, /* @__PURE__ */ React9.createElement(
1388
+ showCollapse && /* @__PURE__ */ React17.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React17.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React17.createElement(IconChevronRight, { size: "small" }))
1389
+ ), /* @__PURE__ */ React17.createElement(UIPropertyRight, null, /* @__PURE__ */ React17.createElement(
1381
1390
  UIPropertyMain,
1382
1391
  {
1383
1392
  $showCollapse: showCollapse,
@@ -1385,7 +1394,7 @@ function PropertyEdit(props) {
1385
1394
  $expand: expand,
1386
1395
  type
1387
1396
  },
1388
- /* @__PURE__ */ React9.createElement(UIRow, null, /* @__PURE__ */ React9.createElement(UIName, null, /* @__PURE__ */ React9.createElement(
1397
+ /* @__PURE__ */ React17.createElement(UIRow, null, /* @__PURE__ */ React17.createElement(UIName, null, /* @__PURE__ */ React17.createElement(
1389
1398
  BlurInput,
1390
1399
  {
1391
1400
  disabled: readonly,
@@ -1394,7 +1403,7 @@ function PropertyEdit(props) {
1394
1403
  value: name,
1395
1404
  onChange: (value2) => onChange("name", value2)
1396
1405
  }
1397
- )), /* @__PURE__ */ React9.createElement(UIType, null, /* @__PURE__ */ React9.createElement(
1406
+ )), /* @__PURE__ */ React17.createElement(UIType, null, /* @__PURE__ */ React17.createElement(
1398
1407
  TypeSelector,
1399
1408
  {
1400
1409
  value: typeSelectorValue,
@@ -1406,47 +1415,47 @@ function PropertyEdit(props) {
1406
1415
  });
1407
1416
  }
1408
1417
  }
1409
- )), /* @__PURE__ */ React9.createElement(UIRequired, null, /* @__PURE__ */ React9.createElement(
1418
+ )), /* @__PURE__ */ React17.createElement(UIRequired, null, /* @__PURE__ */ React17.createElement(
1410
1419
  Checkbox,
1411
1420
  {
1412
1421
  disabled: readonly,
1413
1422
  checked: isPropertyRequired,
1414
1423
  onChange: (e) => onChange("isPropertyRequired", e.target.checked)
1415
1424
  }
1416
- )), /* @__PURE__ */ React9.createElement(UIActions, null, /* @__PURE__ */ React9.createElement(
1425
+ )), /* @__PURE__ */ React17.createElement(UIActions, null, /* @__PURE__ */ React17.createElement(
1417
1426
  IconButton3,
1418
1427
  {
1419
1428
  disabled: readonly,
1420
1429
  size: "small",
1421
1430
  theme: "borderless",
1422
- icon: expand ? /* @__PURE__ */ React9.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React9.createElement(IconExpand, { size: "small" }),
1431
+ icon: expand ? /* @__PURE__ */ React17.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React17.createElement(IconExpand, { size: "small" }),
1423
1432
  onClick: () => {
1424
1433
  setExpand((_expand) => !_expand);
1425
1434
  }
1426
1435
  }
1427
- ), isDrilldownObject && /* @__PURE__ */ React9.createElement(
1436
+ ), isDrilldownObject && /* @__PURE__ */ React17.createElement(
1428
1437
  IconButton3,
1429
1438
  {
1430
1439
  disabled: readonly,
1431
1440
  size: "small",
1432
1441
  theme: "borderless",
1433
- icon: /* @__PURE__ */ React9.createElement(IconAddChildren, null),
1442
+ icon: /* @__PURE__ */ React17.createElement(IconAddChildren, null),
1434
1443
  onClick: () => {
1435
1444
  onAddProperty();
1436
1445
  setCollapse(true);
1437
1446
  }
1438
1447
  }
1439
- ), /* @__PURE__ */ React9.createElement(
1448
+ ), /* @__PURE__ */ React17.createElement(
1440
1449
  IconButton3,
1441
1450
  {
1442
1451
  disabled: readonly,
1443
1452
  size: "small",
1444
1453
  theme: "borderless",
1445
- icon: /* @__PURE__ */ React9.createElement(IconMinus, { size: "small" }),
1454
+ icon: /* @__PURE__ */ React17.createElement(IconMinus, { size: "small" }),
1446
1455
  onClick: onRemove
1447
1456
  }
1448
1457
  ))),
1449
- expand && /* @__PURE__ */ React9.createElement(UIExpandDetail, null, /* @__PURE__ */ React9.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ React9.createElement(
1458
+ expand && /* @__PURE__ */ React17.createElement(UIExpandDetail, null, /* @__PURE__ */ React17.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ React17.createElement(
1450
1459
  BlurInput,
1451
1460
  {
1452
1461
  disabled: readonly,
@@ -1455,7 +1464,7 @@ function PropertyEdit(props) {
1455
1464
  onChange: (value2) => onChange("description", value2),
1456
1465
  placeholder: config?.descPlaceholder ?? "Help LLM to understand the property"
1457
1466
  }
1458
- ), $level === 0 && type && type !== "array" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ React9.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React9.createElement(
1467
+ ), $level === 0 && type && type !== "array" && /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ React17.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React17.createElement(
1459
1468
  DefaultValue,
1460
1469
  {
1461
1470
  value: defaultValue,
@@ -1466,7 +1475,7 @@ function PropertyEdit(props) {
1466
1475
  onChange: (value2) => onChange("default", value2)
1467
1476
  }
1468
1477
  ))))
1469
- ), showCollapse && /* @__PURE__ */ React9.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React9.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React9.createElement(
1478
+ ), showCollapse && /* @__PURE__ */ React17.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React17.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React17.createElement(
1470
1479
  PropertyEdit,
1471
1480
  {
1472
1481
  readonly,
@@ -1491,87 +1500,25 @@ function PropertyEdit(props) {
1491
1500
  }
1492
1501
 
1493
1502
  // src/components/batch-variable-selector/index.tsx
1494
- import React10 from "react";
1503
+ import React18 from "react";
1495
1504
  import { PrivateScopeProvider } from "@flowgram.ai/editor";
1496
1505
  var batchVariableSchema = {
1497
1506
  type: "array",
1498
1507
  extra: { weak: true }
1499
1508
  };
1500
1509
  function BatchVariableSelector(props) {
1501
- return /* @__PURE__ */ React10.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React10.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1510
+ return /* @__PURE__ */ React18.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React18.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1502
1511
  }
1503
1512
 
1504
1513
  // src/components/dynamic-value-input/index.tsx
1505
- import React11, { useMemo as useMemo6, useState as useState5 } from "react";
1506
- import { useScopeAvailable } from "@flowgram.ai/editor";
1514
+ import React19 from "react";
1515
+ import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
1507
1516
  import { IconButton as IconButton4 } from "@douyinfe/semi-ui";
1508
1517
  import { IconSetting } from "@douyinfe/semi-icons";
1509
1518
 
1510
- // src/utils/format-legacy-refs/index.ts
1511
- import { isObject } from "lodash";
1512
- function formatLegacyRefOnSubmit(value) {
1513
- if (isObject(value)) {
1514
- if (isLegacyFlowRefValueSchema(value)) {
1515
- return formatLegacyRefToNewRef(value);
1516
- }
1517
- return Object.fromEntries(
1518
- Object.entries(value).map(([key, value2]) => [
1519
- key,
1520
- formatLegacyRefOnSubmit(value2)
1521
- ])
1522
- );
1523
- }
1524
- if (Array.isArray(value)) {
1525
- return value.map(formatLegacyRefOnSubmit);
1526
- }
1527
- return value;
1528
- }
1529
- function formatLegacyRefOnInit(value) {
1530
- if (isObject(value)) {
1531
- if (isNewFlowRefValueSchema(value)) {
1532
- return formatNewRefToLegacyRef(value);
1533
- }
1534
- return Object.fromEntries(
1535
- Object.entries(value).map(([key, value2]) => [
1536
- key,
1537
- formatLegacyRefOnInit(value2)
1538
- ])
1539
- );
1540
- }
1541
- if (Array.isArray(value)) {
1542
- return value.map(formatLegacyRefOnInit);
1543
- }
1544
- return value;
1545
- }
1546
- function isLegacyFlowRefValueSchema(value) {
1547
- return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
1548
- }
1549
- function isNewFlowRefValueSchema(value) {
1550
- return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
1551
- }
1552
- function formatLegacyRefToNewRef(value) {
1553
- const keyPath = value.content.split(".");
1554
- if (keyPath[1] === "outputs") {
1555
- return {
1556
- type: "ref",
1557
- content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
1558
- };
1559
- }
1560
- return {
1561
- type: "ref",
1562
- content: keyPath
1563
- };
1564
- }
1565
- function formatNewRefToLegacyRef(value) {
1566
- return {
1567
- type: "ref",
1568
- content: value.content.join(".")
1569
- };
1570
- }
1571
-
1572
1519
  // src/components/dynamic-value-input/styles.tsx
1573
- import styled3 from "styled-components";
1574
- var UIContainer2 = styled3.div`
1520
+ import styled4 from "styled-components";
1521
+ var UIContainer2 = styled4.div`
1575
1522
  display: flex;
1576
1523
  align-items: center;
1577
1524
  border-radius: 4px;
@@ -1581,7 +1528,7 @@ var UIContainer2 = styled3.div`
1581
1528
 
1582
1529
  background-color: var(--semi-color-fill-0);
1583
1530
  `;
1584
- var UIMain = styled3.div`
1531
+ var UIMain = styled4.div`
1585
1532
  flex-grow: 1;
1586
1533
  overflow: hidden;
1587
1534
  min-width: 0;
@@ -1599,14 +1546,14 @@ var UIMain = styled3.div`
1599
1546
  border-radius: 0;
1600
1547
  }
1601
1548
  `;
1602
- var UIType2 = styled3.div`
1549
+ var UIType2 = styled4.div`
1603
1550
  border-right: 1px solid #e5e5e5;
1604
1551
 
1605
1552
  & .semi-button {
1606
1553
  border-radius: 0;
1607
1554
  }
1608
1555
  `;
1609
- var UITrigger = styled3.div`
1556
+ var UITrigger = styled4.div`
1610
1557
  border-left: 1px solid #e5e5e5;
1611
1558
 
1612
1559
  & .semi-button {
@@ -1614,6 +1561,39 @@ var UITrigger = styled3.div`
1614
1561
  }
1615
1562
  `;
1616
1563
 
1564
+ // src/components/dynamic-value-input/hooks.ts
1565
+ import { useMemo as useMemo6, useState as useState5 } from "react";
1566
+ import { useScopeAvailable } from "@flowgram.ai/editor";
1567
+ function useRefVariable(value) {
1568
+ const available = useScopeAvailable();
1569
+ const refVariable = useMemo6(() => {
1570
+ if (value?.type === "ref") {
1571
+ return available.getByKeyPath(value.content);
1572
+ }
1573
+ }, [value, available]);
1574
+ return refVariable;
1575
+ }
1576
+ function useSelectSchema(schemaFromProps, constantProps, value) {
1577
+ let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: "string" };
1578
+ if (value?.type === "constant") {
1579
+ defaultSelectSchema = value?.schema || defaultSelectSchema;
1580
+ }
1581
+ const [selectSchema, setSelectSchema] = useState5(defaultSelectSchema);
1582
+ return [selectSchema, setSelectSchema];
1583
+ }
1584
+ function useIncludeSchema(schemaFromProps) {
1585
+ const includeSchema = useMemo6(() => {
1586
+ if (!schemaFromProps) {
1587
+ return;
1588
+ }
1589
+ if (schemaFromProps?.type === "number") {
1590
+ return [schemaFromProps, { type: "integer" }];
1591
+ }
1592
+ return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
1593
+ }, [schemaFromProps]);
1594
+ return includeSchema;
1595
+ }
1596
+
1617
1597
  // src/components/dynamic-value-input/index.tsx
1618
1598
  function DynamicValueInput({
1619
1599
  value,
@@ -1623,44 +1603,46 @@ function DynamicValueInput({
1623
1603
  schema: schemaFromProps,
1624
1604
  constantProps
1625
1605
  }) {
1626
- const available = useScopeAvailable();
1627
- const refVariable = useMemo6(() => {
1628
- if (value?.type === "ref") {
1629
- return available.getByKeyPath(value.content);
1630
- }
1631
- }, [value, available]);
1632
- const [selectSchema, setSelectSchema] = useState5(
1633
- schemaFromProps || constantProps?.schema || { type: "string" }
1634
- );
1606
+ const refVariable = useRefVariable(value);
1607
+ const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
1608
+ const includeSchema = useIncludeSchema(schemaFromProps);
1635
1609
  const renderTypeSelector = () => {
1636
1610
  if (schemaFromProps) {
1637
- return /* @__PURE__ */ React11.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1611
+ return /* @__PURE__ */ React19.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1638
1612
  }
1639
1613
  if (value?.type === "ref") {
1640
- const schema = refVariable?.type ? JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
1641
- return /* @__PURE__ */ React11.createElement(TypeSelector, { value: schema, readonly: true });
1614
+ const schema = refVariable?.type ? JsonSchemaUtils3.astToSchema(refVariable?.type) : void 0;
1615
+ return /* @__PURE__ */ React19.createElement(TypeSelector, { value: schema, readonly: true });
1642
1616
  }
1643
- return /* @__PURE__ */ React11.createElement(
1617
+ return /* @__PURE__ */ React19.createElement(
1644
1618
  TypeSelector,
1645
1619
  {
1646
1620
  value: selectSchema,
1647
- onChange: (_v) => setSelectSchema(_v || { type: "string" }),
1621
+ onChange: (_v) => {
1622
+ setSelectSchema(_v || { type: "string" });
1623
+ let content;
1624
+ if (_v?.type === "object") {
1625
+ content = "{}";
1626
+ }
1627
+ if (_v?.type === "array") {
1628
+ content = "[]";
1629
+ }
1630
+ if (_v?.type === "boolean") {
1631
+ content = false;
1632
+ }
1633
+ onChange({
1634
+ type: "constant",
1635
+ content,
1636
+ schema: _v || { type: "string" }
1637
+ });
1638
+ },
1648
1639
  readonly
1649
1640
  }
1650
1641
  );
1651
1642
  };
1652
- const includeSchema = useMemo6(() => {
1653
- if (!schemaFromProps) {
1654
- return;
1655
- }
1656
- if (schemaFromProps?.type === "number") {
1657
- return [schemaFromProps, { type: "integer" }];
1658
- }
1659
- return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
1660
- }, [schemaFromProps]);
1661
1643
  const renderMain = () => {
1662
1644
  if (value?.type === "ref") {
1663
- return /* @__PURE__ */ React11.createElement(
1645
+ return /* @__PURE__ */ React19.createElement(
1664
1646
  VariableSelector,
1665
1647
  {
1666
1648
  style: { width: "100%" },
@@ -1672,7 +1654,7 @@ function DynamicValueInput({
1672
1654
  );
1673
1655
  }
1674
1656
  const constantSchema = schemaFromProps || selectSchema || { type: "string" };
1675
- return /* @__PURE__ */ React11.createElement(
1657
+ return /* @__PURE__ */ React19.createElement(
1676
1658
  ConstantInput,
1677
1659
  {
1678
1660
  value: value?.content,
@@ -1680,7 +1662,7 @@ function DynamicValueInput({
1680
1662
  schema: constantSchema || { type: "string" },
1681
1663
  readonly,
1682
1664
  strategies: [...constantProps?.strategies || []],
1683
- fallbackRenderer: () => /* @__PURE__ */ React11.createElement(
1665
+ fallbackRenderer: () => /* @__PURE__ */ React19.createElement(
1684
1666
  VariableSelector,
1685
1667
  {
1686
1668
  style: { width: "100%" },
@@ -1693,7 +1675,7 @@ function DynamicValueInput({
1693
1675
  }
1694
1676
  );
1695
1677
  };
1696
- const renderTrigger = () => /* @__PURE__ */ React11.createElement(
1678
+ const renderTrigger = () => /* @__PURE__ */ React19.createElement(
1697
1679
  VariableSelector,
1698
1680
  {
1699
1681
  style: { width: "100%" },
@@ -1701,31 +1683,31 @@ function DynamicValueInput({
1701
1683
  onChange: (_v) => onChange({ type: "ref", content: _v }),
1702
1684
  includeSchema,
1703
1685
  readonly,
1704
- triggerRender: () => /* @__PURE__ */ React11.createElement(IconButton4, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React11.createElement(IconSetting, { size: "small" }) })
1686
+ triggerRender: () => /* @__PURE__ */ React19.createElement(IconButton4, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React19.createElement(IconSetting, { size: "small" }) })
1705
1687
  }
1706
1688
  );
1707
- return /* @__PURE__ */ React11.createElement(UIContainer2, { style }, /* @__PURE__ */ React11.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React11.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React11.createElement(UITrigger, null, renderTrigger()));
1689
+ return /* @__PURE__ */ React19.createElement(UIContainer2, { style }, /* @__PURE__ */ React19.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React19.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React19.createElement(UITrigger, null, renderTrigger()));
1708
1690
  }
1709
1691
 
1710
1692
  // src/components/condition-row/index.tsx
1711
- import React13, { useMemo as useMemo9 } from "react";
1712
- import { Input as Input3 } from "@douyinfe/semi-ui";
1693
+ import React21, { useMemo as useMemo9 } from "react";
1694
+ import { Input as Input4 } from "@douyinfe/semi-ui";
1713
1695
 
1714
1696
  // src/components/condition-row/styles.tsx
1715
- import styled4 from "styled-components";
1716
- var UIContainer3 = styled4.div`
1697
+ import styled5 from "styled-components";
1698
+ var UIContainer3 = styled5.div`
1717
1699
  display: flex;
1718
1700
  align-items: center;
1719
1701
  gap: 4px;
1720
1702
  `;
1721
- var UIOperator = styled4.div``;
1722
- var UILeft = styled4.div`
1703
+ var UIOperator = styled5.div``;
1704
+ var UILeft = styled5.div`
1723
1705
  width: 100%;
1724
1706
  `;
1725
- var UIRight = styled4.div`
1707
+ var UIRight = styled5.div`
1726
1708
  width: 100%;
1727
1709
  `;
1728
- var UIValues = styled4.div`
1710
+ var UIValues = styled5.div`
1729
1711
  flex-grow: 1;
1730
1712
  display: flex;
1731
1713
  flex-direction: column;
@@ -1735,6 +1717,7 @@ var UIValues = styled4.div`
1735
1717
 
1736
1718
  // src/components/condition-row/hooks/useRule.ts
1737
1719
  import { useMemo as useMemo7 } from "react";
1720
+ import { JsonSchemaUtils as JsonSchemaUtils4 } from "@flowgram.ai/json-schema";
1738
1721
  import { useScopeAvailable as useScopeAvailable2 } from "@flowgram.ai/editor";
1739
1722
 
1740
1723
  // src/components/condition-row/constants.ts
@@ -1862,18 +1845,18 @@ function useRule(left) {
1862
1845
  }, [available, left]);
1863
1846
  const rule = useMemo7(() => {
1864
1847
  if (!variable) return void 0;
1865
- const schema = JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
1848
+ const schema = JsonSchemaUtils4.astToSchema(variable.type, { drilldown: false });
1866
1849
  return rules[schema?.type];
1867
1850
  }, [variable?.type]);
1868
1851
  return { rule };
1869
1852
  }
1870
1853
 
1871
1854
  // src/components/condition-row/hooks/useOp.tsx
1872
- import React12, { useMemo as useMemo8 } from "react";
1855
+ import React20, { useMemo as useMemo8 } from "react";
1873
1856
  import { Button as Button2, Select as Select2 } from "@douyinfe/semi-ui";
1874
1857
  import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
1875
- function useOp({ rule, op, onChange }) {
1876
- const options2 = useMemo8(
1858
+ function useOp({ rule, op, onChange, readonly }) {
1859
+ const options = useMemo8(
1877
1860
  () => Object.keys(rule || {}).map((_op) => ({
1878
1861
  ...opConfigs[_op] || {},
1879
1862
  value: _op
@@ -1881,17 +1864,18 @@ function useOp({ rule, op, onChange }) {
1881
1864
  [rule]
1882
1865
  );
1883
1866
  const opConfig = useMemo8(() => opConfigs[op], [op]);
1884
- const renderOpSelect = () => /* @__PURE__ */ React12.createElement(
1867
+ const renderOpSelect = () => /* @__PURE__ */ React20.createElement(
1885
1868
  Select2,
1886
1869
  {
1887
1870
  style: { height: 22 },
1871
+ disabled: readonly,
1888
1872
  size: "small",
1889
1873
  value: op,
1890
- optionList: options2,
1874
+ optionList: options,
1891
1875
  onChange: (v) => {
1892
1876
  onChange(v);
1893
1877
  },
1894
- triggerRender: ({ value }) => /* @__PURE__ */ React12.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React12.createElement(IconChevronDownStroked2, { size: "small" }))
1878
+ triggerRender: ({ value }) => /* @__PURE__ */ React20.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React20.createElement(IconChevronDownStroked2, { size: "small" }))
1895
1879
  }
1896
1880
  );
1897
1881
  return { renderOpSelect, opConfig };
@@ -1904,13 +1888,14 @@ function ConditionRow({ style, value, onChange, readonly }) {
1904
1888
  const { renderOpSelect, opConfig } = useOp({
1905
1889
  rule,
1906
1890
  op: operator,
1907
- onChange: (v) => onChange({ ...value, operator: v })
1891
+ onChange: (v) => onChange({ ...value, operator: v }),
1892
+ readonly
1908
1893
  });
1909
1894
  const targetSchema = useMemo9(() => {
1910
1895
  const targetType = rule?.[operator] || null;
1911
1896
  return targetType ? { type: targetType, extra: { weak: true } } : null;
1912
1897
  }, [rule, opConfig]);
1913
- return /* @__PURE__ */ React13.createElement(UIContainer3, { style }, /* @__PURE__ */ React13.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React13.createElement(UIValues, null, /* @__PURE__ */ React13.createElement(UILeft, null, /* @__PURE__ */ React13.createElement(
1898
+ return /* @__PURE__ */ React21.createElement(UIContainer3, { style }, /* @__PURE__ */ React21.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React21.createElement(UIValues, null, /* @__PURE__ */ React21.createElement(UILeft, null, /* @__PURE__ */ React21.createElement(
1914
1899
  VariableSelector,
1915
1900
  {
1916
1901
  readonly,
@@ -1924,7 +1909,7 @@ function ConditionRow({ style, value, onChange, readonly }) {
1924
1909
  }
1925
1910
  })
1926
1911
  }
1927
- )), /* @__PURE__ */ React13.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React13.createElement(
1912
+ )), /* @__PURE__ */ React21.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React21.createElement(
1928
1913
  DynamicValueInput,
1929
1914
  {
1930
1915
  readonly: readonly || !rule,
@@ -1932,8 +1917,8 @@ function ConditionRow({ style, value, onChange, readonly }) {
1932
1917
  schema: targetSchema,
1933
1918
  onChange: (v) => onChange({ ...value, right: v })
1934
1919
  }
1935
- ) : /* @__PURE__ */ React13.createElement(
1936
- Input3,
1920
+ ) : /* @__PURE__ */ React21.createElement(
1921
+ Input4,
1937
1922
  {
1938
1923
  size: "small",
1939
1924
  disabled: true,
@@ -1944,14 +1929,14 @@ function ConditionRow({ style, value, onChange, readonly }) {
1944
1929
  }
1945
1930
 
1946
1931
  // src/components/batch-outputs/index.tsx
1947
- import React14 from "react";
1948
- import { Button as Button3, Input as Input4 } from "@douyinfe/semi-ui";
1932
+ import React22 from "react";
1933
+ import { Button as Button3, Input as Input5 } from "@douyinfe/semi-ui";
1949
1934
  import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
1950
1935
 
1951
1936
  // src/hooks/use-object-list/index.tsx
1952
- import { useEffect as useEffect3, useState as useState6 } from "react";
1937
+ import { useEffect as useEffect4, useState as useState6 } from "react";
1953
1938
  import { nanoid } from "nanoid";
1954
- import { difference, get as get2, isObject as isObject2, set } from "lodash";
1939
+ import { difference, get, isObject as isObject2, set } from "lodash";
1955
1940
  function genId2() {
1956
1941
  return nanoid();
1957
1942
  }
@@ -1961,9 +1946,9 @@ function useObjectList({
1961
1946
  sortIndexKey
1962
1947
  }) {
1963
1948
  const [list, setList] = useState6([]);
1964
- useEffect3(() => {
1949
+ useEffect4(() => {
1965
1950
  setList((_prevList) => {
1966
- const newKeys = Object.entries(value || {}).sort((a, b) => get2(a[1], sortIndexKey || 0) - get2(b[1], sortIndexKey || 0)).map(([key]) => key);
1951
+ const newKeys = Object.entries(value || {}).sort((a, b) => get(a[1], sortIndexKey || 0) - get(b[1], sortIndexKey || 0)).map(([key]) => key);
1967
1952
  const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
1968
1953
  const addKeys = difference(newKeys, oldKeys);
1969
1954
  return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
@@ -2045,14 +2030,14 @@ function useObjectList({
2045
2030
  }
2046
2031
 
2047
2032
  // src/components/batch-outputs/styles.tsx
2048
- import styled5 from "styled-components";
2049
- var UIRows = styled5.div`
2033
+ import styled6 from "styled-components";
2034
+ var UIRows = styled6.div`
2050
2035
  display: flex;
2051
2036
  flex-direction: column;
2052
2037
  gap: 10px;
2053
2038
  margin-bottom: 10px;
2054
2039
  `;
2055
- var UIRow2 = styled5.div`
2040
+ var UIRow2 = styled6.div`
2056
2041
  display: flex;
2057
2042
  align-items: center;
2058
2043
  gap: 5px;
@@ -2062,8 +2047,8 @@ var UIRow2 = styled5.div`
2062
2047
  function BatchOutputs(props) {
2063
2048
  const { readonly, style } = props;
2064
2049
  const { list, add, updateKey, updateValue, remove } = useObjectList(props);
2065
- return /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React14.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React14.createElement(
2066
- Input4,
2050
+ return /* @__PURE__ */ React22.createElement("div", null, /* @__PURE__ */ React22.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React22.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React22.createElement(
2051
+ Input5,
2067
2052
  {
2068
2053
  style: { width: 100 },
2069
2054
  disabled: readonly,
@@ -2071,7 +2056,7 @@ function BatchOutputs(props) {
2071
2056
  value: item.key,
2072
2057
  onChange: (v) => updateKey(item.id, v)
2073
2058
  }
2074
- ), /* @__PURE__ */ React14.createElement(
2059
+ ), /* @__PURE__ */ React22.createElement(
2075
2060
  VariableSelector,
2076
2061
  {
2077
2062
  style: { flexGrow: 1 },
@@ -2079,25 +2064,25 @@ function BatchOutputs(props) {
2079
2064
  value: item.value?.content,
2080
2065
  onChange: (v) => updateValue(item.id, { type: "ref", content: v })
2081
2066
  }
2082
- ), /* @__PURE__ */ React14.createElement(
2067
+ ), /* @__PURE__ */ React22.createElement(
2083
2068
  Button3,
2084
2069
  {
2085
2070
  disabled: readonly,
2086
- icon: /* @__PURE__ */ React14.createElement(IconDelete, null),
2071
+ icon: /* @__PURE__ */ React22.createElement(IconDelete, null),
2087
2072
  size: "small",
2088
2073
  onClick: () => remove(item.id)
2089
2074
  }
2090
- )))), /* @__PURE__ */ React14.createElement(Button3, { disabled: readonly, icon: /* @__PURE__ */ React14.createElement(IconPlus2, null), size: "small", onClick: add }, "Add"));
2075
+ )))), /* @__PURE__ */ React22.createElement(Button3, { disabled: readonly, icon: /* @__PURE__ */ React22.createElement(IconPlus2, null), size: "small", onClick: add }, "Add"));
2091
2076
  }
2092
2077
 
2093
2078
  // src/components/prompt-editor/index.tsx
2094
- import React15, { useEffect as useEffect4, useRef as useRef3 } from "react";
2095
- import { Renderer, EditorProvider, ActiveLinePlaceholder } from "@coze-editor/editor/react";
2096
- import preset from "@coze-editor/editor/preset-prompt";
2079
+ import React23, { useEffect as useEffect5, useRef as useRef4 } from "react";
2080
+ import { Renderer, EditorProvider as EditorProvider2, ActiveLinePlaceholder as ActiveLinePlaceholder2 } from "@coze-editor/editor/react";
2081
+ import preset2 from "@coze-editor/editor/preset-prompt";
2097
2082
 
2098
2083
  // src/components/prompt-editor/styles.tsx
2099
- import styled6, { css as css3 } from "styled-components";
2100
- var UIContainer4 = styled6.div`
2084
+ import styled7, { css as css3 } from "styled-components";
2085
+ var UIContainer4 = styled7.div`
2101
2086
  background-color: var(--semi-color-fill-0);
2102
2087
  padding-left: 10px;
2103
2088
  padding-right: 6px;
@@ -2111,7 +2096,7 @@ var UIContainer4 = styled6.div`
2111
2096
  import { useLayoutEffect } from "react";
2112
2097
  import { useInjector } from "@coze-editor/editor/react";
2113
2098
  import { astDecorator } from "@coze-editor/editor";
2114
- import { EditorView } from "@codemirror/view";
2099
+ import { EditorView as EditorView2 } from "@codemirror/view";
2115
2100
  function MarkdownHighlight() {
2116
2101
  const injector = useInjector();
2117
2102
  useLayoutEffect(
@@ -2142,7 +2127,7 @@ function MarkdownHighlight() {
2142
2127
  };
2143
2128
  }
2144
2129
  }),
2145
- EditorView.theme({
2130
+ EditorView2.theme({
2146
2131
  ".heading": {
2147
2132
  color: "#00818C",
2148
2133
  fontWeight: "bold"
@@ -2179,7 +2164,7 @@ var language_support_default = LanguageSupport;
2179
2164
  import { useLayoutEffect as useLayoutEffect3 } from "react";
2180
2165
  import { useInjector as useInjector3 } from "@coze-editor/editor/react";
2181
2166
  import { astDecorator as astDecorator2 } from "@coze-editor/editor";
2182
- import { EditorView as EditorView2 } from "@codemirror/view";
2167
+ import { EditorView as EditorView3 } from "@codemirror/view";
2183
2168
  function JinjaHighlight() {
2184
2169
  const injector = useInjector3();
2185
2170
  useLayoutEffect3(
@@ -2204,7 +2189,7 @@ function JinjaHighlight() {
2204
2189
  };
2205
2190
  }
2206
2191
  }),
2207
- EditorView2.theme({
2192
+ EditorView3.theme({
2208
2193
  ".jinja-statement-bracket": {
2209
2194
  color: "#D1009D"
2210
2195
  },
@@ -2235,19 +2220,19 @@ function PromptEditor(props) {
2235
2220
  children,
2236
2221
  disableMarkdownHighlight
2237
2222
  } = props || {};
2238
- const editorRef = useRef3(null);
2239
- useEffect4(() => {
2223
+ const editorRef = useRef4(null);
2224
+ useEffect5(() => {
2240
2225
  if (editorRef.current?.getValue() !== value?.content) {
2241
2226
  editorRef.current?.setValue(String(value?.content || ""));
2242
2227
  }
2243
2228
  }, [value]);
2244
- return /* @__PURE__ */ React15.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ React15.createElement(EditorProvider, null, /* @__PURE__ */ React15.createElement(
2229
+ return /* @__PURE__ */ React23.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ React23.createElement(EditorProvider2, null, /* @__PURE__ */ React23.createElement(
2245
2230
  Renderer,
2246
2231
  {
2247
2232
  didMount: (editor) => {
2248
2233
  editorRef.current = editor;
2249
2234
  },
2250
- plugins: preset,
2235
+ plugins: preset2,
2251
2236
  defaultValue: String(value?.content),
2252
2237
  options: {
2253
2238
  readOnly: readonly,
@@ -2258,14 +2243,14 @@ function PromptEditor(props) {
2258
2243
  onChange({ type: "template", content: e.value });
2259
2244
  }
2260
2245
  }
2261
- ), activeLinePlaceholder && /* @__PURE__ */ React15.createElement(ActiveLinePlaceholder, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ React15.createElement(markdown_default, null), /* @__PURE__ */ React15.createElement(language_support_default, null), /* @__PURE__ */ React15.createElement(jinja_default, null), children));
2246
+ ), activeLinePlaceholder && /* @__PURE__ */ React23.createElement(ActiveLinePlaceholder2, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ React23.createElement(markdown_default, null), /* @__PURE__ */ React23.createElement(language_support_default, null), /* @__PURE__ */ React23.createElement(jinja_default, null), children));
2262
2247
  }
2263
2248
 
2264
2249
  // src/components/prompt-editor-with-variables/index.tsx
2265
- import React18 from "react";
2250
+ import React26 from "react";
2266
2251
 
2267
2252
  // src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
2268
- import React16, { useEffect as useEffect5, useState as useState7 } from "react";
2253
+ import React24, { useEffect as useEffect6, useState as useState7 } from "react";
2269
2254
  import { Popover as Popover2, Tree } from "@douyinfe/semi-ui";
2270
2255
  import {
2271
2256
  Mention,
@@ -2293,20 +2278,20 @@ function VariableTree() {
2293
2278
  setPosition(e.state.selection.main.head);
2294
2279
  setVisible(e.value);
2295
2280
  }
2296
- useEffect5(() => {
2281
+ useEffect6(() => {
2297
2282
  if (!editor) {
2298
2283
  return;
2299
2284
  }
2300
2285
  }, [editor, visible]);
2301
2286
  const treeData = useVariableTree({});
2302
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React16.createElement(
2287
+ return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React24.createElement(
2303
2288
  Popover2,
2304
2289
  {
2305
2290
  visible,
2306
2291
  trigger: "custom",
2307
2292
  position: "topLeft",
2308
2293
  rePosKey: posKey,
2309
- content: /* @__PURE__ */ React16.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React16.createElement(
2294
+ content: /* @__PURE__ */ React24.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React24.createElement(
2310
2295
  Tree,
2311
2296
  {
2312
2297
  treeData,
@@ -2316,7 +2301,7 @@ function VariableTree() {
2316
2301
  }
2317
2302
  ))
2318
2303
  },
2319
- /* @__PURE__ */ React16.createElement(
2304
+ /* @__PURE__ */ React24.createElement(
2320
2305
  PositionMirror,
2321
2306
  {
2322
2307
  position,
@@ -2328,7 +2313,7 @@ function VariableTree() {
2328
2313
 
2329
2314
  // src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
2330
2315
  import ReactDOM from "react-dom";
2331
- import React17, { useLayoutEffect as useLayoutEffect4 } from "react";
2316
+ import React25, { useLayoutEffect as useLayoutEffect4 } from "react";
2332
2317
  import { isEqual, last } from "lodash";
2333
2318
  import {
2334
2319
  Disposable,
@@ -2340,16 +2325,16 @@ import { IconIssueStroked as IconIssueStroked2 } from "@douyinfe/semi-icons";
2340
2325
  import { useInjector as useInjector4 } from "@coze-editor/editor/react";
2341
2326
  import {
2342
2327
  Decoration,
2343
- EditorView as EditorView3,
2328
+ EditorView as EditorView4,
2344
2329
  MatchDecorator,
2345
2330
  ViewPlugin,
2346
2331
  WidgetType
2347
2332
  } from "@codemirror/view";
2348
2333
 
2349
2334
  // src/components/prompt-editor-with-variables/styles.tsx
2350
- import styled7 from "styled-components";
2335
+ import styled8 from "styled-components";
2351
2336
  import { Tag as Tag2 } from "@douyinfe/semi-ui";
2352
- var UIRootTitle2 = styled7.div`
2337
+ var UIRootTitle2 = styled8.div`
2353
2338
  margin-right: 4px;
2354
2339
  min-width: 20px;
2355
2340
  overflow: hidden;
@@ -2357,12 +2342,12 @@ var UIRootTitle2 = styled7.div`
2357
2342
  white-space: nowrap;
2358
2343
  color: var(--semi-color-text-2);
2359
2344
  `;
2360
- var UIVarName2 = styled7.div`
2345
+ var UIVarName2 = styled8.div`
2361
2346
  overflow: hidden;
2362
2347
  text-overflow: ellipsis;
2363
2348
  white-space: nowrap;
2364
2349
  `;
2365
- var UITag2 = styled7(Tag2)`
2350
+ var UITag2 = styled8(Tag2)`
2366
2351
  display: inline-flex;
2367
2352
  align-items: center;
2368
2353
  justify-content: flex-start;
@@ -2376,7 +2361,7 @@ var UITag2 = styled7(Tag2)`
2376
2361
  margin: 0 5px;
2377
2362
  }
2378
2363
  `;
2379
- var UIPopoverContent2 = styled7.div`
2364
+ var UIPopoverContent2 = styled8.div`
2380
2365
  padding: 10px;
2381
2366
  display: inline-flex;
2382
2367
  align-items: center;
@@ -2390,7 +2375,7 @@ var VariableTagWidget = class extends WidgetType {
2390
2375
  this.toDispose = new DisposableCollection();
2391
2376
  this.renderIcon = (icon) => {
2392
2377
  if (typeof icon === "string") {
2393
- return /* @__PURE__ */ React17.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2378
+ return /* @__PURE__ */ React25.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2394
2379
  }
2395
2380
  return icon;
2396
2381
  };
@@ -2403,21 +2388,21 @@ var VariableTagWidget = class extends WidgetType {
2403
2388
  renderVariable(v) {
2404
2389
  if (!v) {
2405
2390
  this.renderReact(
2406
- /* @__PURE__ */ React17.createElement(UITag2, { prefixIcon: /* @__PURE__ */ React17.createElement(IconIssueStroked2, null), color: "amber" }, "Unknown")
2391
+ /* @__PURE__ */ React25.createElement(UITag2, { prefixIcon: /* @__PURE__ */ React25.createElement(IconIssueStroked2, null), color: "amber" }, "Unknown")
2407
2392
  );
2408
2393
  return;
2409
2394
  }
2410
2395
  const rootField = last(v.parentFields) || v;
2411
2396
  const isRoot = v.parentFields.length === 0;
2412
- const rootTitle = /* @__PURE__ */ React17.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
2397
+ const rootTitle = /* @__PURE__ */ React25.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
2413
2398
  const rootIcon = this.renderIcon(rootField?.meta.icon);
2414
2399
  this.renderReact(
2415
- /* @__PURE__ */ React17.createElement(
2400
+ /* @__PURE__ */ React25.createElement(
2416
2401
  Popover3,
2417
2402
  {
2418
- content: /* @__PURE__ */ React17.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ React17.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2403
+ content: /* @__PURE__ */ React25.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ React25.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2419
2404
  },
2420
- /* @__PURE__ */ React17.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ React17.createElement(UIVarName2, null, v?.key))
2405
+ /* @__PURE__ */ React25.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ React25.createElement(UIVarName2, null, v?.key))
2421
2406
  )
2422
2407
  );
2423
2408
  }
@@ -2478,508 +2463,163 @@ function VariableTagInject() {
2478
2463
  {
2479
2464
  decorations: (p) => p.decorations,
2480
2465
  provide(p) {
2481
- return EditorView3.atomicRanges.of(
2466
+ return EditorView4.atomicRanges.of(
2482
2467
  (view) => view.plugin(p)?.decorations ?? Decoration.none
2483
2468
  );
2484
2469
  }
2485
2470
  }
2486
2471
  )
2487
2472
  ]);
2488
- }, [injector]);
2489
- return null;
2490
- }
2491
-
2492
- // src/components/prompt-editor-with-variables/index.tsx
2493
- function PromptEditorWithVariables(props) {
2494
- return /* @__PURE__ */ React18.createElement(PromptEditor, { ...props }, /* @__PURE__ */ React18.createElement(VariableTree, null), /* @__PURE__ */ React18.createElement(VariableTagInject, null));
2495
- }
2496
-
2497
- // src/components/prompt-editor-with-inputs/index.tsx
2498
- import React21 from "react";
2499
-
2500
- // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2501
- import React20, { useEffect as useEffect6, useState as useState8 } from "react";
2502
- import { Popover as Popover4 } from "@douyinfe/semi-ui";
2503
- import {
2504
- Mention as Mention2,
2505
- getCurrentMentionReplaceRange as getCurrentMentionReplaceRange2,
2506
- useEditor as useEditor2,
2507
- PositionMirror as PositionMirror2
2508
- } from "@coze-editor/editor/react";
2509
-
2510
- // src/components/prompt-editor-with-inputs/inputs-picker.tsx
2511
- import React19, { useMemo as useMemo10 } from "react";
2512
- import { last as last2 } from "lodash";
2513
- import {
2514
- ASTMatch as ASTMatch3,
2515
- useScopeAvailable as useScopeAvailable3
2516
- } from "@flowgram.ai/editor";
2517
- import { Tree as Tree2 } from "@douyinfe/semi-ui";
2518
- function InputsPicker({
2519
- inputsValues,
2520
- onSelect
2521
- }) {
2522
- const available = useScopeAvailable3();
2523
- const getArrayDrilldown = (type, depth = 1) => {
2524
- if (ASTMatch3.isArray(type.items)) {
2525
- return getArrayDrilldown(type.items, depth + 1);
2526
- }
2527
- return { type: type.items, depth };
2528
- };
2529
- const renderVariable = (variable, keyPath) => {
2530
- let type = variable?.type;
2531
- let children;
2532
- if (ASTMatch3.isObject(type)) {
2533
- children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
2534
- }
2535
- if (ASTMatch3.isArray(type)) {
2536
- const drilldown = getArrayDrilldown(type);
2537
- if (ASTMatch3.isObject(drilldown.type)) {
2538
- children = (drilldown.type.properties || []).map(
2539
- (_property) => renderVariable(_property, [
2540
- ...keyPath,
2541
- ...new Array(drilldown.depth).fill("[0]"),
2542
- _property.key
2543
- ])
2544
- ).filter(Boolean);
2545
- }
2546
- }
2547
- const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
2548
- return {
2549
- key,
2550
- label: last2(keyPath),
2551
- value: key,
2552
- children
2553
- };
2554
- };
2555
- const treeData = useMemo10(
2556
- () => Object.entries(inputsValues).map(([key, value]) => {
2557
- if (value?.type === "ref") {
2558
- const variable = available.getByKeyPath(value.content || []);
2559
- if (variable) {
2560
- return renderVariable(variable, [key]);
2561
- }
2562
- }
2563
- return {
2564
- key,
2565
- value: key,
2566
- label: key
2567
- };
2568
- }),
2569
- []
2570
- );
2571
- return /* @__PURE__ */ React19.createElement(Tree2, { treeData, onSelect: (v) => onSelect(v) });
2572
- }
2573
-
2574
- // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2575
- function InputsTree({ inputsValues }) {
2576
- const [posKey, setPosKey] = useState8("");
2577
- const [visible, setVisible] = useState8(false);
2578
- const [position, setPosition] = useState8(-1);
2579
- const editor = useEditor2();
2580
- function insert(variablePath) {
2581
- const range = getCurrentMentionReplaceRange2(editor.$view.state);
2582
- if (!range) {
2583
- return;
2584
- }
2585
- editor.replaceText({
2586
- ...range,
2587
- text: "{{" + variablePath + "}}"
2588
- });
2589
- setVisible(false);
2590
- }
2591
- function handleOpenChange(e) {
2592
- setPosition(e.state.selection.main.head);
2593
- setVisible(e.value);
2594
- }
2595
- useEffect6(() => {
2596
- if (!editor) {
2597
- return;
2598
- }
2599
- }, [editor, visible]);
2600
- return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React20.createElement(
2601
- Popover4,
2602
- {
2603
- visible,
2604
- trigger: "custom",
2605
- position: "topLeft",
2606
- rePosKey: posKey,
2607
- content: /* @__PURE__ */ React20.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React20.createElement(
2608
- InputsPicker,
2609
- {
2610
- inputsValues,
2611
- onSelect: (v) => {
2612
- insert(v);
2613
- }
2614
- }
2615
- ))
2616
- },
2617
- /* @__PURE__ */ React20.createElement(
2618
- PositionMirror2,
2619
- {
2620
- position,
2621
- onChange: () => setPosKey(String(Math.random()))
2622
- }
2623
- )
2624
- ));
2625
- }
2626
-
2627
- // src/components/prompt-editor-with-inputs/index.tsx
2628
- function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2629
- return /* @__PURE__ */ React21.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React21.createElement(InputsTree, { inputsValues }));
2630
- }
2631
-
2632
- // src/components/code-editor/index.tsx
2633
- import React22, { useEffect as useEffect7, useRef as useRef4 } from "react";
2634
- import {
2635
- ActiveLinePlaceholder as ActiveLinePlaceholder2,
2636
- createRenderer,
2637
- EditorProvider as EditorProvider2
2638
- } from "@coze-editor/editor/react";
2639
- import preset2 from "@coze-editor/editor/preset-code";
2640
- import { EditorView as EditorView4 } from "@codemirror/view";
2641
-
2642
- // src/components/code-editor/utils.ts
2643
- function getSuffixByLanguageId(languageId) {
2644
- if (languageId === "python") {
2645
- return ".py";
2646
- }
2647
- if (languageId === "typescript") {
2648
- return ".ts";
2649
- }
2650
- if (languageId === "shell") {
2651
- return ".sh";
2652
- }
2653
- if (languageId === "json") {
2654
- return ".json";
2655
- }
2656
- return "";
2657
- }
2658
-
2659
- // src/components/code-editor/language-features.ts
2660
- import { languages } from "@coze-editor/editor/preset-code";
2661
- import { typescript } from "@coze-editor/editor/language-typescript";
2662
- import { shell } from "@coze-editor/editor/language-shell";
2663
- import { python } from "@coze-editor/editor/language-python";
2664
- import { json } from "@coze-editor/editor/language-json";
2665
- import { mixLanguages } from "@coze-editor/editor";
2666
- languages.register("python", python);
2667
- languages.register("shell", shell);
2668
- languages.register("typescript", typescript);
2669
- languages.register("json", {
2670
- // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
2671
- language: mixLanguages({
2672
- outerLanguage: json.language
2673
- }),
2674
- languageService: json.languageService
2675
- });
2676
- var tsWorkerInit = false;
2677
- var initTsWorker = () => {
2678
- if (tsWorkerInit) {
2679
- return;
2680
- }
2681
- tsWorkerInit = true;
2682
- const tsWorker = new Worker(
2683
- new URL(`@coze-editor/editor/language-typescript/worker`, import.meta.url),
2684
- { type: "module" }
2685
- );
2686
- typescript.languageService.initialize(tsWorker, {
2687
- compilerOptions: {
2688
- // eliminate Promise error
2689
- lib: ["es2015", "dom"],
2690
- noImplicitAny: false
2691
- }
2692
- });
2693
- };
2694
-
2695
- // src/components/code-editor/theme/index.ts
2696
- import { themes } from "@coze-editor/editor/preset-code";
2697
-
2698
- // src/components/code-editor/theme/light.ts
2699
- import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
2700
- var colors = {
2701
- background: "#F7F7FC",
2702
- // syntax
2703
- comment: "#000A298A",
2704
- key: "#00818C",
2705
- string: "#D1009D",
2706
- number: "#C74200",
2707
- boolean: "#2B57D9",
2708
- null: "#2B57D9",
2709
- separator: "#0F1529D1"
2710
- };
2711
- var lightTheme = createTheme({
2712
- variant: "light",
2713
- settings: {
2714
- background: "#fff",
2715
- foreground: "#000",
2716
- caret: "#000",
2717
- selection: "#d9d9d9",
2718
- gutterBackground: "#f0f0f0",
2719
- gutterForeground: "#666",
2720
- gutterBorderColor: "transparent",
2721
- gutterBorderWidth: 0,
2722
- lineHighlight: "#f0f0f0",
2723
- bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
2724
- tooltip: {
2725
- backgroundColor: "#f0f0f0",
2726
- color: "#000",
2727
- border: "1px solid #ccc"
2728
- },
2729
- link: {
2730
- color: "#007bff"
2731
- },
2732
- completionItemHover: {
2733
- backgroundColor: "#f0f0f0"
2734
- },
2735
- completionItemSelected: {
2736
- backgroundColor: "#e0e0e0"
2737
- },
2738
- completionItemIcon: {
2739
- color: "#333"
2740
- },
2741
- completionItemLabel: {
2742
- color: "#333"
2743
- },
2744
- completionItemInfo: {
2745
- color: "#333"
2746
- },
2747
- completionItemDetail: {
2748
- color: "#666"
2749
- }
2750
- },
2751
- styles: [
2752
- // JSON
2753
- {
2754
- tag: t.comment,
2755
- color: colors.comment
2756
- },
2757
- {
2758
- tag: [t.propertyName],
2759
- color: colors.key
2760
- },
2761
- {
2762
- tag: [t.string],
2763
- color: colors.string
2764
- },
2765
- {
2766
- tag: [t.number],
2767
- color: colors.number
2768
- },
2769
- {
2770
- tag: [t.bool],
2771
- color: colors.boolean
2772
- },
2773
- {
2774
- tag: [t.null],
2775
- color: colors.null
2776
- },
2777
- {
2778
- tag: [t.separator],
2779
- color: colors.separator
2780
- },
2781
- // markdown
2782
- {
2783
- tag: [t.heading],
2784
- color: "#3e76ef"
2785
- },
2786
- {
2787
- tag: [t.processingInstruction],
2788
- color: "#3e76ef"
2789
- },
2790
- // shell
2791
- // curl
2792
- {
2793
- tag: [t.standard(t.variableName)],
2794
- color: "#00804A"
2795
- },
2796
- // -X
2797
- {
2798
- tag: [t.attributeName],
2799
- color: "#C74200"
2800
- },
2801
- // url in string (includes quotes), e.g. "https://..."
2802
- {
2803
- tag: [t.special(t.string)],
2804
- color: "#2B57D9"
2805
- }
2806
- ]
2807
- });
2808
-
2809
- // src/components/code-editor/theme/dark.ts
2810
- import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
2811
- var colors2 = {
2812
- background: "#151B27",
2813
- // syntax
2814
- comment: "#FFFFFF63",
2815
- key: "#39E5D7",
2816
- string: "#FF94D2",
2817
- number: "#FF9933",
2818
- boolean: "#78B0FF",
2819
- null: "#78B0FF",
2820
- separator: "#FFFFFFC9"
2821
- };
2822
- var darkTheme = createTheme2({
2823
- variant: "dark",
2824
- settings: {
2825
- background: colors2.background,
2826
- foreground: "#fff",
2827
- caret: "#AEAFAD",
2828
- selection: "#d9d9d942",
2829
- gutterBackground: colors2.background,
2830
- gutterForeground: "#FFFFFF63",
2831
- gutterBorderColor: "transparent",
2832
- gutterBorderWidth: 0,
2833
- lineHighlight: "#272e3d36",
2834
- bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
2835
- tooltip: {
2836
- backgroundColor: "#363D4D",
2837
- color: "#fff",
2838
- border: "none"
2839
- },
2840
- link: {
2841
- color: "#4daafc"
2842
- },
2843
- completionItemHover: {
2844
- backgroundColor: "#FFFFFF0F"
2845
- },
2846
- completionItemSelected: {
2847
- backgroundColor: "#FFFFFF17"
2848
- },
2849
- completionItemIcon: {
2850
- color: "#FFFFFFC9"
2851
- },
2852
- completionItemLabel: {
2853
- color: "#FFFFFFC9"
2854
- },
2855
- completionItemInfo: {
2856
- color: "#FFFFFFC9"
2857
- },
2858
- completionItemDetail: {
2859
- color: "#FFFFFF63"
2860
- }
2861
- },
2862
- styles: [
2863
- // json
2864
- {
2865
- tag: t2.comment,
2866
- color: colors2.comment
2867
- },
2868
- {
2869
- tag: [t2.propertyName],
2870
- color: colors2.key
2871
- },
2872
- {
2873
- tag: [t2.string],
2874
- color: colors2.string
2875
- },
2876
- {
2877
- tag: [t2.number],
2878
- color: colors2.number
2879
- },
2880
- {
2881
- tag: [t2.bool],
2882
- color: colors2.boolean
2883
- },
2884
- {
2885
- tag: [t2.null],
2886
- color: colors2.null
2887
- },
2888
- {
2889
- tag: [t2.separator],
2890
- color: colors2.separator
2891
- },
2892
- // markdown
2893
- {
2894
- tag: [t2.heading],
2895
- color: "#6b6bff"
2896
- },
2897
- {
2898
- tag: [t2.processingInstruction],
2899
- color: "#6b6bff"
2900
- },
2901
- // shell
2902
- // curl
2903
- {
2904
- tag: [t2.standard(t2.variableName)],
2905
- color: "#3BEB84"
2906
- },
2907
- // -X
2908
- {
2909
- tag: [t2.attributeName],
2910
- color: "#FF9933"
2911
- },
2912
- // url in string (includes quotes), e.g. "https://..."
2913
- {
2914
- tag: [t2.special(t2.string)],
2915
- color: "#78B0FF"
2916
- }
2917
- ]
2918
- });
2473
+ }, [injector]);
2474
+ return null;
2475
+ }
2919
2476
 
2920
- // src/components/code-editor/theme/index.ts
2921
- themes.register("dark", darkTheme);
2922
- themes.register("light", lightTheme);
2477
+ // src/components/prompt-editor-with-variables/index.tsx
2478
+ function PromptEditorWithVariables(props) {
2479
+ return /* @__PURE__ */ React26.createElement(PromptEditor, { ...props }, /* @__PURE__ */ React26.createElement(VariableTree, null), /* @__PURE__ */ React26.createElement(VariableTagInject, null));
2480
+ }
2923
2481
 
2924
- // src/components/code-editor/index.tsx
2925
- var OriginCodeEditor = createRenderer(preset2, [
2926
- EditorView4.theme({
2927
- "&.cm-focused": {
2928
- outline: "none"
2929
- }
2930
- })
2931
- ]);
2932
- function CodeEditor({
2933
- value,
2934
- onChange,
2935
- languageId = "python",
2936
- theme = "light",
2937
- children,
2938
- placeholder,
2939
- activeLinePlaceholder,
2940
- options: options2,
2941
- readonly
2482
+ // src/components/prompt-editor-with-inputs/index.tsx
2483
+ import React29 from "react";
2484
+
2485
+ // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2486
+ import React28, { useEffect as useEffect7, useState as useState8 } from "react";
2487
+ import { Popover as Popover4 } from "@douyinfe/semi-ui";
2488
+ import {
2489
+ Mention as Mention2,
2490
+ getCurrentMentionReplaceRange as getCurrentMentionReplaceRange2,
2491
+ useEditor as useEditor2,
2492
+ PositionMirror as PositionMirror2
2493
+ } from "@coze-editor/editor/react";
2494
+
2495
+ // src/components/prompt-editor-with-inputs/inputs-picker.tsx
2496
+ import React27, { useMemo as useMemo10 } from "react";
2497
+ import { last as last2 } from "lodash";
2498
+ import {
2499
+ ASTMatch as ASTMatch2,
2500
+ useScopeAvailable as useScopeAvailable3
2501
+ } from "@flowgram.ai/editor";
2502
+ import { Tree as Tree2 } from "@douyinfe/semi-ui";
2503
+ function InputsPicker({
2504
+ inputsValues,
2505
+ onSelect
2942
2506
  }) {
2943
- const editorRef = useRef4(null);
2944
- useEffect7(() => {
2945
- if (languageId === "typescript") {
2946
- initTsWorker();
2507
+ const available = useScopeAvailable3();
2508
+ const getArrayDrilldown = (type, depth = 1) => {
2509
+ if (ASTMatch2.isArray(type.items)) {
2510
+ return getArrayDrilldown(type.items, depth + 1);
2947
2511
  }
2948
- }, [languageId]);
2512
+ return { type: type.items, depth };
2513
+ };
2514
+ const renderVariable = (variable, keyPath) => {
2515
+ let type = variable?.type;
2516
+ let children;
2517
+ if (ASTMatch2.isObject(type)) {
2518
+ children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
2519
+ }
2520
+ if (ASTMatch2.isArray(type)) {
2521
+ const drilldown = getArrayDrilldown(type);
2522
+ if (ASTMatch2.isObject(drilldown.type)) {
2523
+ children = (drilldown.type.properties || []).map(
2524
+ (_property) => renderVariable(_property, [
2525
+ ...keyPath,
2526
+ ...new Array(drilldown.depth).fill("[0]"),
2527
+ _property.key
2528
+ ])
2529
+ ).filter(Boolean);
2530
+ }
2531
+ }
2532
+ const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
2533
+ return {
2534
+ key,
2535
+ label: last2(keyPath),
2536
+ value: key,
2537
+ children
2538
+ };
2539
+ };
2540
+ const treeData = useMemo10(
2541
+ () => Object.entries(inputsValues).map(([key, value]) => {
2542
+ if (value?.type === "ref") {
2543
+ const variable = available.getByKeyPath(value.content || []);
2544
+ if (variable) {
2545
+ return renderVariable(variable, [key]);
2546
+ }
2547
+ }
2548
+ return {
2549
+ key,
2550
+ value: key,
2551
+ label: key
2552
+ };
2553
+ }),
2554
+ []
2555
+ );
2556
+ return /* @__PURE__ */ React27.createElement(Tree2, { treeData, onSelect: (v) => onSelect(v) });
2557
+ }
2558
+
2559
+ // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2560
+ function InputsTree({ inputsValues }) {
2561
+ const [posKey, setPosKey] = useState8("");
2562
+ const [visible, setVisible] = useState8(false);
2563
+ const [position, setPosition] = useState8(-1);
2564
+ const editor = useEditor2();
2565
+ function insert(variablePath) {
2566
+ const range = getCurrentMentionReplaceRange2(editor.$view.state);
2567
+ if (!range) {
2568
+ return;
2569
+ }
2570
+ editor.replaceText({
2571
+ ...range,
2572
+ text: "{{" + variablePath + "}}"
2573
+ });
2574
+ setVisible(false);
2575
+ }
2576
+ function handleOpenChange(e) {
2577
+ setPosition(e.state.selection.main.head);
2578
+ setVisible(e.value);
2579
+ }
2949
2580
  useEffect7(() => {
2950
- if (editorRef.current?.getValue() !== value) {
2951
- editorRef.current?.setValue(String(value || ""));
2581
+ if (!editor) {
2582
+ return;
2952
2583
  }
2953
- }, [value]);
2954
- return /* @__PURE__ */ React22.createElement(EditorProvider2, null, /* @__PURE__ */ React22.createElement(
2955
- OriginCodeEditor,
2584
+ }, [editor, visible]);
2585
+ return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React28.createElement(
2586
+ Popover4,
2956
2587
  {
2957
- defaultValue: value,
2958
- options: {
2959
- uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
2960
- languageId,
2961
- theme,
2962
- placeholder,
2963
- readOnly: readonly,
2964
- editable: !readonly,
2965
- ...options2 || {}
2966
- },
2967
- didMount: (editor) => {
2968
- editorRef.current = editor;
2969
- },
2970
- onChange: (e) => onChange?.(e.value)
2588
+ visible,
2589
+ trigger: "custom",
2590
+ position: "topLeft",
2591
+ rePosKey: posKey,
2592
+ content: /* @__PURE__ */ React28.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React28.createElement(
2593
+ InputsPicker,
2594
+ {
2595
+ inputsValues,
2596
+ onSelect: (v) => {
2597
+ insert(v);
2598
+ }
2599
+ }
2600
+ ))
2971
2601
  },
2972
- activeLinePlaceholder && /* @__PURE__ */ React22.createElement(ActiveLinePlaceholder2, null, activeLinePlaceholder),
2973
- children
2602
+ /* @__PURE__ */ React28.createElement(
2603
+ PositionMirror2,
2604
+ {
2605
+ position,
2606
+ onChange: () => setPosKey(String(Math.random()))
2607
+ }
2608
+ )
2974
2609
  ));
2975
2610
  }
2976
2611
 
2612
+ // src/components/prompt-editor-with-inputs/index.tsx
2613
+ function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2614
+ return /* @__PURE__ */ React29.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React29.createElement(InputsTree, { inputsValues }));
2615
+ }
2616
+
2977
2617
  // src/components/json-editor-with-variables/index.tsx
2978
- import React25 from "react";
2618
+ import React32 from "react";
2979
2619
  import { transformerCreator } from "@coze-editor/editor/preset-code";
2980
2620
 
2981
2621
  // src/components/json-editor-with-variables/extensions/variable-tree.tsx
2982
- import React23, { useEffect as useEffect8, useState as useState9 } from "react";
2622
+ import React30, { useEffect as useEffect8, useState as useState9 } from "react";
2983
2623
  import { Popover as Popover5, Tree as Tree3 } from "@douyinfe/semi-ui";
2984
2624
  import {
2985
2625
  Mention as Mention3,
@@ -3013,14 +2653,14 @@ function VariableTree2() {
3013
2653
  }
3014
2654
  }, [editor, visible]);
3015
2655
  const treeData = useVariableTree({});
3016
- return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Mention3, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React23.createElement(
2656
+ return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(Mention3, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React30.createElement(
3017
2657
  Popover5,
3018
2658
  {
3019
2659
  visible,
3020
2660
  trigger: "custom",
3021
2661
  position: "topLeft",
3022
2662
  rePosKey: posKey,
3023
- content: /* @__PURE__ */ React23.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React23.createElement(
2663
+ content: /* @__PURE__ */ React30.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React30.createElement(
3024
2664
  Tree3,
3025
2665
  {
3026
2666
  treeData,
@@ -3030,7 +2670,7 @@ function VariableTree2() {
3030
2670
  }
3031
2671
  ))
3032
2672
  },
3033
- /* @__PURE__ */ React23.createElement(
2673
+ /* @__PURE__ */ React30.createElement(
3034
2674
  PositionMirror3,
3035
2675
  {
3036
2676
  position,
@@ -3041,7 +2681,7 @@ function VariableTree2() {
3041
2681
  }
3042
2682
 
3043
2683
  // src/components/json-editor-with-variables/extensions/variable-tag.tsx
3044
- import React24, { useLayoutEffect as useLayoutEffect5 } from "react";
2684
+ import React31, { useLayoutEffect as useLayoutEffect5 } from "react";
3045
2685
  import { createRoot } from "react-dom/client";
3046
2686
  import { isEqual as isEqual2, last as last3 } from "lodash";
3047
2687
  import {
@@ -3061,9 +2701,9 @@ import {
3061
2701
  } from "@codemirror/view";
3062
2702
 
3063
2703
  // src/components/json-editor-with-variables/styles.tsx
3064
- import styled8 from "styled-components";
2704
+ import styled9 from "styled-components";
3065
2705
  import { Tag as Tag3 } from "@douyinfe/semi-ui";
3066
- var UIRootTitle3 = styled8.div`
2706
+ var UIRootTitle3 = styled9.div`
3067
2707
  margin-right: 4px;
3068
2708
  min-width: 20px;
3069
2709
  overflow: hidden;
@@ -3071,12 +2711,12 @@ var UIRootTitle3 = styled8.div`
3071
2711
  white-space: nowrap;
3072
2712
  color: var(--semi-color-text-2);
3073
2713
  `;
3074
- var UIVarName3 = styled8.div`
2714
+ var UIVarName3 = styled9.div`
3075
2715
  overflow: hidden;
3076
2716
  text-overflow: ellipsis;
3077
2717
  white-space: nowrap;
3078
2718
  `;
3079
- var UITag3 = styled8(Tag3)`
2719
+ var UITag3 = styled9(Tag3)`
3080
2720
  display: inline-flex;
3081
2721
  align-items: center;
3082
2722
  justify-content: flex-start;
@@ -3090,7 +2730,7 @@ var UITag3 = styled8(Tag3)`
3090
2730
  margin: 0 5px;
3091
2731
  }
3092
2732
  `;
3093
- var UIPopoverContent3 = styled8.div`
2733
+ var UIPopoverContent3 = styled9.div`
3094
2734
  padding: 10px;
3095
2735
  display: inline-flex;
3096
2736
  align-items: center;
@@ -3104,7 +2744,7 @@ var VariableTagWidget2 = class extends WidgetType2 {
3104
2744
  this.toDispose = new DisposableCollection2();
3105
2745
  this.renderIcon = (icon) => {
3106
2746
  if (typeof icon === "string") {
3107
- return /* @__PURE__ */ React24.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2747
+ return /* @__PURE__ */ React31.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
3108
2748
  }
3109
2749
  return icon;
3110
2750
  };
@@ -3114,20 +2754,20 @@ var VariableTagWidget2 = class extends WidgetType2 {
3114
2754
  renderVariable(v) {
3115
2755
  if (!v) {
3116
2756
  this.root.render(
3117
- /* @__PURE__ */ React24.createElement(UITag3, { prefixIcon: /* @__PURE__ */ React24.createElement(IconIssueStroked3, null), color: "amber" }, "Unknown")
2757
+ /* @__PURE__ */ React31.createElement(UITag3, { prefixIcon: /* @__PURE__ */ React31.createElement(IconIssueStroked3, null), color: "amber" }, "Unknown")
3118
2758
  );
3119
2759
  return;
3120
2760
  }
3121
2761
  const rootField = last3(v.parentFields);
3122
- const rootTitle = /* @__PURE__ */ React24.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2762
+ const rootTitle = /* @__PURE__ */ React31.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
3123
2763
  const rootIcon = this.renderIcon(rootField?.meta.icon);
3124
2764
  this.root.render(
3125
- /* @__PURE__ */ React24.createElement(
2765
+ /* @__PURE__ */ React31.createElement(
3126
2766
  Popover6,
3127
2767
  {
3128
- content: /* @__PURE__ */ React24.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ React24.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
2768
+ content: /* @__PURE__ */ React31.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ React31.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
3129
2769
  },
3130
- /* @__PURE__ */ React24.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React24.createElement(UIVarName3, null, v?.key))
2770
+ /* @__PURE__ */ React31.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React31.createElement(UIVarName3, null, v?.key))
3131
2771
  )
3132
2772
  );
3133
2773
  }
@@ -3229,7 +2869,7 @@ var transformer = transformerCreator((text) => {
3229
2869
  return text;
3230
2870
  });
3231
2871
  function JsonEditorWithVariables(props) {
3232
- return /* @__PURE__ */ React25.createElement(
2872
+ return /* @__PURE__ */ React32.createElement(
3233
2873
  CodeEditor,
3234
2874
  {
3235
2875
  languageId: "json",
@@ -3240,40 +2880,40 @@ function JsonEditorWithVariables(props) {
3240
2880
  ...props.options || {}
3241
2881
  }
3242
2882
  },
3243
- /* @__PURE__ */ React25.createElement(VariableTree2, null),
3244
- /* @__PURE__ */ React25.createElement(VariableTagInject2, null)
2883
+ /* @__PURE__ */ React32.createElement(VariableTree2, null),
2884
+ /* @__PURE__ */ React32.createElement(VariableTagInject2, null)
3245
2885
  );
3246
2886
  }
3247
2887
 
3248
2888
  // src/components/inputs-values/index.tsx
3249
- import React27 from "react";
2889
+ import React34 from "react";
3250
2890
  import { Button as Button4, IconButton as IconButton5 } from "@douyinfe/semi-ui";
3251
2891
  import { IconDelete as IconDelete2, IconPlus as IconPlus3 } from "@douyinfe/semi-icons";
3252
2892
 
3253
2893
  // src/components/inputs-values/styles.tsx
3254
- import styled9 from "styled-components";
3255
- var UIRows2 = styled9.div`
2894
+ import styled10 from "styled-components";
2895
+ var UIRows2 = styled10.div`
3256
2896
  display: flex;
3257
2897
  flex-direction: column;
3258
2898
  gap: 10px;
3259
2899
  margin-bottom: 10px;
3260
2900
  `;
3261
- var UIRow3 = styled9.div`
2901
+ var UIRow3 = styled10.div`
3262
2902
  display: flex;
3263
2903
  align-items: center;
3264
2904
  gap: 5px;
3265
2905
  `;
3266
2906
 
3267
2907
  // src/components/inputs-values/components/blur-input.tsx
3268
- import React26, { useEffect as useEffect9, useState as useState10 } from "react";
3269
- import Input5 from "@douyinfe/semi-ui/lib/es/input";
2908
+ import React33, { useEffect as useEffect9, useState as useState10 } from "react";
2909
+ import Input6 from "@douyinfe/semi-ui/lib/es/input";
3270
2910
  function BlurInput2(props) {
3271
2911
  const [value, setValue] = useState10("");
3272
2912
  useEffect9(() => {
3273
2913
  setValue(props.value);
3274
2914
  }, [props.value]);
3275
- return /* @__PURE__ */ React26.createElement(
3276
- Input5,
2915
+ return /* @__PURE__ */ React33.createElement(
2916
+ Input6,
3277
2917
  {
3278
2918
  ...props,
3279
2919
  value,
@@ -3300,7 +2940,7 @@ function InputsValues({
3300
2940
  onChange,
3301
2941
  sortIndexKey: "extra.index"
3302
2942
  });
3303
- return /* @__PURE__ */ React27.createElement("div", null, /* @__PURE__ */ React27.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React27.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React27.createElement(
2943
+ return /* @__PURE__ */ React34.createElement("div", null, /* @__PURE__ */ React34.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React34.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React34.createElement(
3304
2944
  BlurInput2,
3305
2945
  {
3306
2946
  style: { width: 100, minWidth: 100, maxWidth: 100 },
@@ -3310,7 +2950,7 @@ function InputsValues({
3310
2950
  onChange: (v) => updateKey(item.id, v),
3311
2951
  placeholder: "Input Key"
3312
2952
  }
3313
- ), /* @__PURE__ */ React27.createElement(
2953
+ ), /* @__PURE__ */ React34.createElement(
3314
2954
  DynamicValueInput,
3315
2955
  {
3316
2956
  style: { flexGrow: 1 },
@@ -3324,46 +2964,290 @@ function InputsValues({
3324
2964
  strategies: [...constantProps?.strategies || []]
3325
2965
  }
3326
2966
  }
3327
- ), /* @__PURE__ */ React27.createElement(
2967
+ ), /* @__PURE__ */ React34.createElement(
3328
2968
  IconButton5,
3329
2969
  {
3330
2970
  disabled: readonly,
3331
2971
  theme: "borderless",
3332
- icon: /* @__PURE__ */ React27.createElement(IconDelete2, { size: "small" }),
2972
+ icon: /* @__PURE__ */ React34.createElement(IconDelete2, { size: "small" }),
3333
2973
  size: "small",
3334
2974
  onClick: () => remove(item.id)
3335
2975
  }
3336
- )))), /* @__PURE__ */ React27.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React27.createElement(IconPlus3, null), size: "small", onClick: add }, "Add"));
2976
+ )))), /* @__PURE__ */ React34.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React34.createElement(IconPlus3, null), size: "small", onClick: add }, "Add"));
2977
+ }
2978
+
2979
+ // src/components/display-schema-tree/index.tsx
2980
+ import React35 from "react";
2981
+
2982
+ // src/components/display-schema-tree/styles.tsx
2983
+ import styled11, { css as css4 } from "styled-components";
2984
+ var TreeRow = styled11.div`
2985
+ display: flex;
2986
+ align-items: center;
2987
+
2988
+ .tree-icon {
2989
+ margin-right: 8px;
2990
+ width: 14px;
2991
+ height: 14px;
2992
+ }
2993
+
2994
+ height: 27px;
2995
+ white-space: nowrap;
2996
+ `;
2997
+ var HorizontalLine = styled11.div`
2998
+ position: relative;
2999
+
3000
+ &::before,
3001
+ &::after {
3002
+ content: '';
3003
+ position: absolute;
3004
+ background-color: var(--semi-color-text-3);
3005
+ }
3006
+
3007
+ &::after {
3008
+ top: 0px;
3009
+ right: 6px;
3010
+ width: 15px;
3011
+ height: 1px;
3012
+ }
3013
+ `;
3014
+ var TreeTitle = styled11.div`
3015
+ // overflow: hidden;
3016
+ // text-overflow: ellipsis;
3017
+ `;
3018
+ var TreeLevel = styled11.div`
3019
+ padding-left: 30px;
3020
+ position: relative;
3021
+
3022
+ /* &::before {
3023
+ content: '';
3024
+ position: absolute;
3025
+ background-color: var(--semi-color-text-3);
3026
+ top: 0px;
3027
+ bottom: 0px;
3028
+ left: -22px;
3029
+ width: 1px;
3030
+ } */
3031
+ `;
3032
+ var TreeItem = styled11.div`
3033
+ position: relative;
3034
+
3035
+ &::before {
3036
+ content: '';
3037
+ position: absolute;
3038
+ background-color: var(--semi-color-text-3);
3039
+ }
3040
+
3041
+ &:not(:last-child)::before {
3042
+ width: 1px;
3043
+ top: 0;
3044
+ bottom: 0;
3045
+ left: -22px;
3046
+ }
3047
+
3048
+ &:last-child::before {
3049
+ width: 1px;
3050
+ top: 0;
3051
+ height: 14px;
3052
+ left: -22px;
3053
+ }
3054
+
3055
+ ${(props) => props.depth === 0 && css4`
3056
+ &::before {
3057
+ width: 0px !important;
3058
+ }
3059
+ `}
3060
+ `;
3061
+
3062
+ // src/components/display-schema-tree/index.tsx
3063
+ function DisplaySchemaTree(props) {
3064
+ return /* @__PURE__ */ React35.createElement(SchemaTree, { ...props });
3065
+ }
3066
+ function SchemaTree(props) {
3067
+ const {
3068
+ value: schema = {},
3069
+ drilldown = true,
3070
+ depth = 0,
3071
+ showIcon = true,
3072
+ parentKey = ""
3073
+ } = props || {};
3074
+ const typeManager = useTypeManager();
3075
+ const config = typeManager.getTypeBySchema(schema);
3076
+ const title = typeManager.getComplexText(schema);
3077
+ const icon = typeManager?.getDisplayIcon(schema);
3078
+ let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
3079
+ const childEntries = Object.entries(properties || {});
3080
+ return /* @__PURE__ */ React35.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ React35.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ React35.createElement(HorizontalLine, null), showIcon && icon && React35.cloneElement(icon, {
3081
+ className: "tree-icon"
3082
+ }), /* @__PURE__ */ React35.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ React35.createElement(React35.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ React35.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ React35.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
3083
+ }
3084
+
3085
+ // src/components/display-outputs/index.tsx
3086
+ import React37, { useEffect as useEffect10 } from "react";
3087
+ import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
3088
+ import { useCurrentScope as useCurrentScope3, useRefresh } from "@flowgram.ai/editor";
3089
+
3090
+ // src/components/display-schema-tag/index.tsx
3091
+ import React36 from "react";
3092
+ import { Popover as Popover7 } from "@douyinfe/semi-ui";
3093
+
3094
+ // src/components/display-schema-tag/styles.ts
3095
+ import styled12 from "styled-components";
3096
+ import { Tag as Tag4 } from "@douyinfe/semi-ui";
3097
+ var PopoverContent = styled12.div`
3098
+ padding: 10px;
3099
+ `;
3100
+ var StyledTag = styled12(Tag4)`
3101
+ padding: 4px;
3102
+
3103
+ .tag-icon {
3104
+ width: 12px;
3105
+ height: 12px;
3106
+ }
3107
+ `;
3108
+ var TitleSpan = styled12.span`
3109
+ display: inline-block;
3110
+ margin-left: 4px;
3111
+ margin-top: -1px;
3112
+ overflow: hidden;
3113
+ text-overflow: ellipsis;
3114
+ `;
3115
+
3116
+ // src/components/display-schema-tag/index.tsx
3117
+ function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
3118
+ const typeManager = useTypeManager();
3119
+ const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
3120
+ return /* @__PURE__ */ React36.createElement(
3121
+ Popover7,
3122
+ {
3123
+ content: /* @__PURE__ */ React36.createElement(PopoverContent, null, /* @__PURE__ */ React36.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
3124
+ },
3125
+ /* @__PURE__ */ React36.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React36.cloneElement(icon, {
3126
+ className: "tag-icon"
3127
+ }), title && /* @__PURE__ */ React36.createElement(TitleSpan, null, title))
3128
+ );
3129
+ }
3130
+
3131
+ // src/components/display-outputs/styles.ts
3132
+ import styled13 from "styled-components";
3133
+ var DisplayOutputsWrapper = styled13.div`
3134
+ display: flex;
3135
+ gap: 5px;
3136
+ flex-wrap: wrap;
3137
+ `;
3138
+
3139
+ // src/components/display-outputs/index.tsx
3140
+ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3141
+ const scope = useCurrentScope3();
3142
+ const refresh = useRefresh();
3143
+ useEffect10(() => {
3144
+ if (!displayFromScope) {
3145
+ return () => null;
3146
+ }
3147
+ const disposable = scope.output.onListOrAnyVarChange(() => {
3148
+ refresh();
3149
+ });
3150
+ return () => {
3151
+ disposable.dispose();
3152
+ };
3153
+ }, [displayFromScope]);
3154
+ const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
3155
+ acm = {
3156
+ ...acm,
3157
+ ...JsonSchemaUtils5.astToSchema(curr.type)?.properties || {}
3158
+ };
3159
+ return acm;
3160
+ }, {}) : value?.properties || {};
3161
+ const childEntries = Object.entries(properties || {});
3162
+ return /* @__PURE__ */ React37.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React37.createElement(DisplaySchemaTag, { key, title: key, value: schema, showIconInTree })));
3163
+ }
3164
+
3165
+ // src/components/display-flow-value/index.tsx
3166
+ import React38, { useMemo as useMemo11 } from "react";
3167
+ import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
3168
+ import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
3169
+ function DisplayFlowValue({ value, title, showIconInTree }) {
3170
+ const available = useScopeAvailable4();
3171
+ const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
3172
+ const schema = useMemo11(() => {
3173
+ if (value?.type === "ref") {
3174
+ return JsonSchemaUtils6.astToSchema(variable?.type);
3175
+ }
3176
+ if (value?.type === "template") {
3177
+ return { type: "string" };
3178
+ }
3179
+ if (value?.type === "constant") {
3180
+ if (value?.schema) {
3181
+ return value?.schema;
3182
+ }
3183
+ if (typeof value?.content === "string") {
3184
+ return { type: "string" };
3185
+ }
3186
+ if (typeof value?.content === "number") {
3187
+ return { type: "number" };
3188
+ }
3189
+ if (typeof value?.content === "boolean") {
3190
+ return { type: "boolean" };
3191
+ }
3192
+ }
3193
+ return { type: "unknown" };
3194
+ }, [value, variable?.hash]);
3195
+ return /* @__PURE__ */ React38.createElement(
3196
+ DisplaySchemaTag,
3197
+ {
3198
+ title,
3199
+ value: schema,
3200
+ showIconInTree,
3201
+ warning: value?.type === "ref" && !variable
3202
+ }
3203
+ );
3204
+ }
3205
+
3206
+ // src/components/display-inputs-values/index.tsx
3207
+ import React39 from "react";
3208
+
3209
+ // src/components/display-inputs-values/styles.ts
3210
+ import styled14 from "styled-components";
3211
+ var DisplayInputsWrapper = styled14.div`
3212
+ display: flex;
3213
+ gap: 5px;
3214
+ flex-wrap: wrap;
3215
+ `;
3216
+
3217
+ // src/components/display-inputs-values/index.tsx
3218
+ function DisplayInputsValues({ value, showIconInTree }) {
3219
+ const childEntries = Object.entries(value || {});
3220
+ return /* @__PURE__ */ React39.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => /* @__PURE__ */ React39.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree })));
3337
3221
  }
3338
3222
 
3339
3223
  // src/effects/provide-batch-input/index.ts
3340
3224
  import {
3341
- ASTFactory as ASTFactory2,
3225
+ ASTFactory,
3342
3226
  createEffectFromVariableProvider,
3343
3227
  getNodeForm
3344
3228
  } from "@flowgram.ai/editor";
3345
3229
  var provideBatchInputEffect = createEffectFromVariableProvider({
3346
3230
  private: true,
3347
3231
  parse: (value, ctx) => [
3348
- ASTFactory2.createVariableDeclaration({
3232
+ ASTFactory.createVariableDeclaration({
3349
3233
  key: `${ctx.node.id}_locals`,
3350
3234
  meta: {
3351
3235
  title: getNodeForm(ctx.node)?.getValueIn("title"),
3352
3236
  icon: ctx.node.getNodeRegistry().info?.icon
3353
3237
  },
3354
- type: ASTFactory2.createObject({
3238
+ type: ASTFactory.createObject({
3355
3239
  properties: [
3356
- ASTFactory2.createProperty({
3240
+ ASTFactory.createProperty({
3357
3241
  key: "item",
3358
- initializer: ASTFactory2.createEnumerateExpression({
3359
- enumerateFor: ASTFactory2.createKeyPathExpression({
3242
+ initializer: ASTFactory.createEnumerateExpression({
3243
+ enumerateFor: ASTFactory.createKeyPathExpression({
3360
3244
  keyPath: value.content || []
3361
3245
  })
3362
3246
  })
3363
3247
  }),
3364
- ASTFactory2.createProperty({
3248
+ ASTFactory.createProperty({
3365
3249
  key: "index",
3366
- type: ASTFactory2.createNumber()
3250
+ type: ASTFactory.createNumber()
3367
3251
  })
3368
3252
  ]
3369
3253
  })
@@ -3466,20 +3350,21 @@ function traverseRef(name, value, cb) {
3466
3350
  }
3467
3351
 
3468
3352
  // src/effects/provide-json-schema-outputs/index.ts
3353
+ import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
3469
3354
  import {
3470
- ASTFactory as ASTFactory3,
3355
+ ASTFactory as ASTFactory2,
3471
3356
  createEffectFromVariableProvider as createEffectFromVariableProvider2,
3472
3357
  getNodeForm as getNodeForm2
3473
3358
  } from "@flowgram.ai/editor";
3474
3359
  var provideJsonSchemaOutputs = createEffectFromVariableProvider2({
3475
3360
  parse: (value, ctx) => [
3476
- ASTFactory3.createVariableDeclaration({
3361
+ ASTFactory2.createVariableDeclaration({
3477
3362
  key: `${ctx.node.id}`,
3478
3363
  meta: {
3479
3364
  title: getNodeForm2(ctx.node)?.getValueIn("title") || ctx.node.id,
3480
3365
  icon: ctx.node.getNodeRegistry().info?.icon
3481
3366
  },
3482
- type: JsonSchemaUtils.schemaToAST(value)
3367
+ type: JsonSchemaUtils7.schemaToAST(value)
3483
3368
  })
3484
3369
  ]
3485
3370
  });
@@ -3496,6 +3381,7 @@ var syncVariableTitle = [
3496
3381
  context.node.getData(FlowNodeVariableData).allScopes.forEach((_scope) => {
3497
3382
  _scope.output.variables.forEach((_var) => {
3498
3383
  _var.updateMeta({
3384
+ ..._var.meta || {},
3499
3385
  title: value || context.node.id,
3500
3386
  icon: context.node.getNodeRegistry().info?.icon
3501
3387
  });
@@ -3507,7 +3393,7 @@ var syncVariableTitle = [
3507
3393
 
3508
3394
  // src/form-plugins/batch-outputs-plugin/index.ts
3509
3395
  import {
3510
- ASTFactory as ASTFactory4,
3396
+ ASTFactory as ASTFactory3,
3511
3397
  createEffectFromVariableProvider as createEffectFromVariableProvider3,
3512
3398
  defineFormPluginCreator,
3513
3399
  getNodeForm as getNodeForm3,
@@ -3518,18 +3404,18 @@ import {
3518
3404
  } from "@flowgram.ai/editor";
3519
3405
  var provideBatchOutputsEffect = createEffectFromVariableProvider3({
3520
3406
  parse: (value, ctx) => [
3521
- ASTFactory4.createVariableDeclaration({
3407
+ ASTFactory3.createVariableDeclaration({
3522
3408
  key: `${ctx.node.id}`,
3523
3409
  meta: {
3524
3410
  title: getNodeForm3(ctx.node)?.getValueIn("title"),
3525
3411
  icon: ctx.node.getNodeRegistry().info?.icon
3526
3412
  },
3527
- type: ASTFactory4.createObject({
3413
+ type: ASTFactory3.createObject({
3528
3414
  properties: Object.entries(value).map(
3529
- ([_key, value2]) => ASTFactory4.createProperty({
3415
+ ([_key, value2]) => ASTFactory3.createProperty({
3530
3416
  key: _key,
3531
- initializer: ASTFactory4.createWrapArrayExpression({
3532
- wrapFor: ASTFactory4.createKeyPathExpression({
3417
+ initializer: ASTFactory3.createWrapArrayExpression({
3418
+ wrapFor: ASTFactory3.createKeyPathExpression({
3533
3419
  keyPath: value2?.content || []
3534
3420
  })
3535
3421
  })
@@ -3581,7 +3467,8 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
3581
3467
  });
3582
3468
 
3583
3469
  // src/form-plugins/infer-inputs-plugin/index.ts
3584
- import { get as get3, set as set2 } from "lodash";
3470
+ import { get as get2, set as set2 } from "lodash";
3471
+ import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
3585
3472
  import {
3586
3473
  defineFormPluginCreator as defineFormPluginCreator2,
3587
3474
  getNodePrivateScope as getNodePrivateScope2,
@@ -3597,7 +3484,7 @@ var createInferInputsPlugin = defineFormPluginCreator2({
3597
3484
  formData,
3598
3485
  targetKey,
3599
3486
  infer(
3600
- get3(formData, sourceKey),
3487
+ get2(formData, sourceKey),
3601
3488
  scope === "private" ? getNodePrivateScope2(ctx.node) : getNodeScope2(ctx.node)
3602
3489
  )
3603
3490
  );
@@ -3638,7 +3525,7 @@ var infer = (values, scope) => {
3638
3525
  }
3639
3526
  if (isRef2(values)) {
3640
3527
  const variable = scope.available.getByKeyPath(values?.content);
3641
- const schema = variable?.type ? JsonSchemaUtils.astToSchema(variable?.type) : void 0;
3528
+ const schema = variable?.type ? JsonSchemaUtils8.astToSchema(variable?.type) : void 0;
3642
3529
  return schema;
3643
3530
  }
3644
3531
  if (isTemplate2(values)) {
@@ -3659,31 +3546,36 @@ var infer = (values, scope) => {
3659
3546
  }
3660
3547
  };
3661
3548
  export {
3662
- ArrayIcons,
3663
3549
  BatchOutputs,
3664
3550
  BatchVariableSelector,
3665
3551
  CodeEditor,
3552
+ CodeEditorMini,
3666
3553
  ConditionRow,
3667
3554
  ConstantInput,
3555
+ DisplayFlowValue,
3556
+ DisplayInputsValues,
3557
+ DisplayOutputs,
3558
+ DisplaySchemaTag,
3559
+ DisplaySchemaTree,
3668
3560
  DynamicValueInput,
3669
3561
  InputsValues,
3670
3562
  JsonEditorWithVariables,
3671
3563
  JsonSchemaEditor,
3564
+ JsonSchemaTypePresetProvider,
3672
3565
  JsonSchemaUtils,
3673
3566
  PromptEditor,
3674
3567
  PromptEditorWithInputs,
3675
3568
  PromptEditorWithVariables,
3676
3569
  TypeSelector,
3677
3570
  VariableSelector,
3678
- VariableTypeIcons,
3679
3571
  autoRenameRefEffect,
3680
3572
  createBatchOutputsFormPlugin,
3681
3573
  createInferInputsPlugin,
3574
+ createTypePresetPlugin,
3682
3575
  formatLegacyRefOnInit,
3683
3576
  formatLegacyRefOnSubmit,
3684
3577
  formatLegacyRefToNewRef,
3685
3578
  formatNewRefToLegacyRef,
3686
- getSchemaIcon,
3687
3579
  getTypeSelectValue,
3688
3580
  isLegacyFlowRefValueSchema,
3689
3581
  isNewFlowRefValueSchema,
@@ -3692,6 +3584,7 @@ export {
3692
3584
  provideBatchOutputsEffect,
3693
3585
  provideJsonSchemaOutputs,
3694
3586
  syncVariableTitle,
3587
+ useTypeManager,
3695
3588
  useVariableTree
3696
3589
  };
3697
3590
  //# sourceMappingURL=index.js.map