@flowgram.ai/form-materials 0.1.0-alpha.11 → 0.1.0-alpha.12

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 (121) hide show
  1. package/bin/index.ts +11 -5
  2. package/bin/materials.ts +10 -1
  3. package/dist/esm/index.js +1917 -1371
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/index.d.mts +320 -113
  6. package/dist/index.d.ts +320 -113
  7. package/dist/index.js +2023 -1484
  8. package/dist/index.js.map +1 -1
  9. package/package.json +5 -4
  10. package/src/components/assign-row/components/blur-input.tsx +27 -0
  11. package/src/components/assign-row/config.json +11 -0
  12. package/src/components/assign-row/index.tsx +84 -0
  13. package/src/components/assign-row/types.ts +25 -0
  14. package/src/components/assign-rows/config.json +11 -0
  15. package/src/components/assign-rows/index.tsx +59 -0
  16. package/src/components/batch-outputs/config.json +2 -1
  17. package/src/components/batch-outputs/index.tsx +4 -12
  18. package/src/components/batch-variable-selector/config.json +6 -2
  19. package/src/components/batch-variable-selector/index.tsx +1 -1
  20. package/src/components/code-editor/index.tsx +7 -0
  21. package/src/components/code-editor/language-features.ts +22 -1
  22. package/src/components/code-editor/theme/light.ts +1 -1
  23. package/src/components/code-editor-mini/config.json +7 -0
  24. package/src/components/code-editor-mini/index.tsx +31 -0
  25. package/src/components/condition-row/config.json +10 -2
  26. package/src/components/condition-row/constants.ts +6 -8
  27. package/src/components/condition-row/hooks/useOp.tsx +3 -1
  28. package/src/components/condition-row/hooks/useRule.ts +2 -2
  29. package/src/components/condition-row/index.tsx +2 -1
  30. package/src/components/condition-row/types.ts +3 -1
  31. package/src/components/constant-input/config.json +6 -3
  32. package/src/components/constant-input/index.tsx +18 -62
  33. package/src/components/constant-input/types.ts +6 -9
  34. package/src/components/display-flow-value/config.json +8 -0
  35. package/src/components/display-flow-value/index.tsx +59 -0
  36. package/src/components/display-inputs-values/config.json +9 -0
  37. package/src/components/display-inputs-values/index.tsx +27 -0
  38. package/src/components/display-inputs-values/styles.ts +12 -0
  39. package/src/components/display-outputs/config.json +10 -0
  40. package/src/components/display-outputs/index.tsx +64 -0
  41. package/src/components/display-outputs/styles.ts +12 -0
  42. package/src/components/display-schema-tag/config.json +10 -0
  43. package/src/components/display-schema-tag/index.tsx +44 -0
  44. package/src/components/display-schema-tag/styles.ts +28 -0
  45. package/src/components/display-schema-tree/config.json +11 -0
  46. package/src/components/display-schema-tree/index.tsx +74 -0
  47. package/src/components/display-schema-tree/styles.tsx +90 -0
  48. package/src/components/dynamic-value-input/config.json +11 -2
  49. package/src/components/dynamic-value-input/hooks.ts +53 -0
  50. package/src/components/dynamic-value-input/index.tsx +64 -13
  51. package/src/components/dynamic-value-input/styles.tsx +28 -2
  52. package/src/components/index.ts +9 -0
  53. package/src/components/inputs-values/components/blur-input.tsx +27 -0
  54. package/src/components/inputs-values/config.json +13 -0
  55. package/src/components/inputs-values/index.tsx +73 -0
  56. package/src/components/inputs-values/styles.tsx +19 -0
  57. package/src/components/inputs-values/types.ts +22 -0
  58. package/src/components/json-schema-editor/config.json +2 -2
  59. package/src/components/json-schema-editor/default-value.tsx +1 -1
  60. package/src/components/json-schema-editor/hooks.tsx +1 -1
  61. package/src/components/json-schema-editor/index.tsx +15 -2
  62. package/src/components/json-schema-editor/types.ts +1 -1
  63. package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +1 -1
  64. package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +6 -3
  65. package/src/components/type-selector/config.json +6 -2
  66. package/src/components/type-selector/index.tsx +55 -12
  67. package/src/components/variable-selector/config.json +6 -2
  68. package/src/components/variable-selector/index.tsx +34 -13
  69. package/src/components/variable-selector/styles.tsx +18 -8
  70. package/src/components/variable-selector/use-variable-tree.tsx +19 -22
  71. package/src/effects/index.ts +3 -1
  72. package/src/effects/listen-ref-schema-change/config.json +10 -0
  73. package/src/effects/listen-ref-schema-change/index.ts +56 -0
  74. package/src/effects/listen-ref-value-change/config.json +9 -0
  75. package/src/effects/listen-ref-value-change/index.ts +53 -0
  76. package/src/effects/provide-json-schema-outputs/config.json +4 -5
  77. package/src/effects/provide-json-schema-outputs/index.ts +1 -3
  78. package/src/effects/sync-variable-title/index.ts +1 -0
  79. package/src/effects/validate-when-variable-sync/config.json +5 -0
  80. package/src/effects/validate-when-variable-sync/index.ts +35 -0
  81. package/src/form-plugins/index.ts +3 -1
  82. package/src/form-plugins/infer-assign-plugin/config.json +7 -0
  83. package/src/form-plugins/infer-assign-plugin/index.ts +90 -0
  84. package/src/form-plugins/infer-inputs-plugin/config.json +9 -0
  85. package/src/form-plugins/infer-inputs-plugin/index.ts +108 -0
  86. package/src/hooks/index.tsx +6 -0
  87. package/src/hooks/use-object-list/config.json +8 -0
  88. package/src/hooks/use-object-list/index.tsx +136 -0
  89. package/src/index.ts +3 -1
  90. package/src/{typings/json-schema → plugins/disable-declaration-plugin}/config.json +1 -1
  91. package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +31 -0
  92. package/src/plugins/disable-declaration-plugin/index.tsx +6 -0
  93. package/src/plugins/index.ts +7 -0
  94. package/src/plugins/json-schema-preset/config.json +9 -0
  95. package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +28 -0
  96. package/src/plugins/json-schema-preset/index.tsx +41 -0
  97. package/src/plugins/json-schema-preset/manager.ts +18 -0
  98. package/src/plugins/json-schema-preset/type-definition/array.tsx +24 -0
  99. package/src/plugins/json-schema-preset/type-definition/boolean.tsx +32 -0
  100. package/src/plugins/json-schema-preset/type-definition/index.tsx +24 -0
  101. package/src/plugins/json-schema-preset/type-definition/integer.tsx +24 -0
  102. package/src/plugins/json-schema-preset/type-definition/number.tsx +24 -0
  103. package/src/plugins/json-schema-preset/type-definition/object.tsx +24 -0
  104. package/src/plugins/json-schema-preset/type-definition/string.tsx +18 -0
  105. package/src/{utils → shared}/index.ts +0 -1
  106. package/src/typings/flow-value/config.json +3 -1
  107. package/src/typings/flow-value/index.ts +11 -0
  108. package/src/typings/index.ts +0 -1
  109. package/src/validate/index.tsx +6 -0
  110. package/src/validate/validate-flow-value/config.json +7 -0
  111. package/src/validate/validate-flow-value/index.tsx +73 -0
  112. package/src/components/batch-outputs/use-list.ts +0 -86
  113. package/src/components/type-selector/constants.tsx +0 -364
  114. package/src/effects/provide-batch-outputs/config.json +0 -5
  115. package/src/effects/provide-batch-outputs/index.ts +0 -38
  116. package/src/typings/json-schema/index.ts +0 -36
  117. package/src/utils/json-schema/config.json +0 -5
  118. package/src/utils/json-schema/index.ts +0 -180
  119. /package/src/{utils → shared}/format-legacy-refs/config.json +0 -0
  120. /package/src/{utils → shared}/format-legacy-refs/index.ts +0 -0
  121. /package/src/{utils → shared}/format-legacy-refs/readme.md +0 -0
package/dist/index.js CHANGED
@@ -30,589 +30,610 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- ArrayIcons: () => ArrayIcons,
33
+ AssignRow: () => AssignRow,
34
+ AssignRows: () => AssignRows,
34
35
  BatchOutputs: () => BatchOutputs,
35
36
  BatchVariableSelector: () => BatchVariableSelector,
36
37
  CodeEditor: () => CodeEditor,
38
+ CodeEditorMini: () => CodeEditorMini,
37
39
  ConditionRow: () => ConditionRow,
38
40
  ConstantInput: () => ConstantInput,
41
+ DisplayFlowValue: () => DisplayFlowValue,
42
+ DisplayInputsValues: () => DisplayInputsValues,
43
+ DisplayOutputs: () => DisplayOutputs,
44
+ DisplaySchemaTag: () => DisplaySchemaTag,
45
+ DisplaySchemaTree: () => DisplaySchemaTree,
39
46
  DynamicValueInput: () => DynamicValueInput,
47
+ InputsValues: () => InputsValues,
40
48
  JsonEditorWithVariables: () => JsonEditorWithVariables,
41
49
  JsonSchemaEditor: () => JsonSchemaEditor,
42
- JsonSchemaUtils: () => JsonSchemaUtils,
50
+ JsonSchemaTypePresetProvider: () => JsonSchemaTypePresetProvider,
51
+ JsonSchemaUtils: () => import_json_schema3.JsonSchemaUtils,
43
52
  PromptEditor: () => PromptEditor,
44
53
  PromptEditorWithInputs: () => PromptEditorWithInputs,
45
54
  PromptEditorWithVariables: () => PromptEditorWithVariables,
46
55
  TypeSelector: () => TypeSelector,
47
56
  VariableSelector: () => VariableSelector,
48
- VariableTypeIcons: () => VariableTypeIcons,
49
57
  autoRenameRefEffect: () => autoRenameRefEffect,
50
58
  createBatchOutputsFormPlugin: () => createBatchOutputsFormPlugin,
59
+ createDisableDeclarationPlugin: () => createDisableDeclarationPlugin,
60
+ createInferAssignPlugin: () => createInferAssignPlugin,
61
+ createInferInputsPlugin: () => createInferInputsPlugin,
62
+ createTypePresetPlugin: () => createTypePresetPlugin,
51
63
  formatLegacyRefOnInit: () => formatLegacyRefOnInit,
52
64
  formatLegacyRefOnSubmit: () => formatLegacyRefOnSubmit,
53
65
  formatLegacyRefToNewRef: () => formatLegacyRefToNewRef,
54
66
  formatNewRefToLegacyRef: () => formatNewRefToLegacyRef,
55
- getSchemaIcon: () => getSchemaIcon,
56
67
  getTypeSelectValue: () => getTypeSelectValue,
57
68
  isLegacyFlowRefValueSchema: () => isLegacyFlowRefValueSchema,
58
69
  isNewFlowRefValueSchema: () => isNewFlowRefValueSchema,
70
+ listenRefSchemaChange: () => listenRefSchemaChange,
71
+ listenRefValueChange: () => listenRefValueChange,
59
72
  parseTypeSelectValue: () => parseTypeSelectValue,
60
73
  provideBatchInputEffect: () => provideBatchInputEffect,
61
74
  provideBatchOutputsEffect: () => provideBatchOutputsEffect,
62
75
  provideJsonSchemaOutputs: () => provideJsonSchemaOutputs,
63
76
  syncVariableTitle: () => syncVariableTitle,
64
- useVariableTree: () => useVariableTree
77
+ useTypeManager: () => useTypeManager,
78
+ useVariableTree: () => useVariableTree,
79
+ validateFlowValue: () => validateFlowValue,
80
+ validateWhenVariableSync: () => validateWhenVariableSync
65
81
  });
66
82
  module.exports = __toCommonJS(src_exports);
67
83
 
84
+ // ../../../common/temp/node_modules/.pnpm/tsup@8.3.5_typescript@5.8.3/node_modules/tsup/assets/cjs_shims.js
85
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
86
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
87
+
68
88
  // src/components/variable-selector/index.tsx
69
- var import_react3 = __toESM(require("react"));
70
- var import_semi_icons2 = require("@douyinfe/semi-icons");
89
+ var import_react12 = __toESM(require("react"));
90
+ var import_semi_ui7 = require("@douyinfe/semi-ui");
91
+ var import_semi_icons = require("@douyinfe/semi-icons");
71
92
 
72
93
  // src/components/variable-selector/use-variable-tree.tsx
73
- var import_react2 = __toESM(require("react"));
74
- var import_editor2 = require("@flowgram.ai/editor");
75
- var import_semi_ui = require("@douyinfe/semi-ui");
94
+ var import_react11 = __toESM(require("react"));
95
+ var import_json_schema4 = require("@flowgram.ai/json-schema");
96
+ var import_editor4 = require("@flowgram.ai/editor");
97
+ var import_semi_ui5 = require("@douyinfe/semi-ui");
98
+
99
+ // src/plugins/json-schema-preset/index.tsx
100
+ var import_react10 = __toESM(require("react"));
101
+ var import_json_schema3 = require("@flowgram.ai/json-schema");
102
+
103
+ // src/plugins/json-schema-preset/type-definition/index.tsx
104
+ var import_json_schema = require("@flowgram.ai/json-schema");
76
105
 
77
- // src/components/type-selector/constants.tsx
106
+ // src/plugins/json-schema-preset/type-definition/string.tsx
78
107
  var import_react = __toESM(require("react"));
79
- var import_semi_icons = __toESM(require("@douyinfe/semi-icons"));
80
- var VariableTypeIcons = {
81
- custom: /* @__PURE__ */ import_react.default.createElement(
82
- "svg",
83
- {
84
- viewBox: "0 0 24 24",
85
- fill: "none",
86
- xmlns: "http://www.w3.org/2000/svg",
87
- width: "1em",
88
- height: "1em",
89
- focusable: "false",
90
- "aria-hidden": "true"
108
+ var import_semi_ui = require("@douyinfe/semi-ui");
109
+ var stringRegistry = {
110
+ type: "string",
111
+ ConstantRenderer: (props) => /* @__PURE__ */ import_react.default.createElement(import_semi_ui.Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
112
+ };
113
+
114
+ // src/plugins/json-schema-preset/type-definition/object.tsx
115
+ var import_react5 = __toESM(require("react"));
116
+
117
+ // src/components/code-editor-mini/index.tsx
118
+ var import_react4 = __toESM(require("react"));
119
+ var import_styled_components = __toESM(require("styled-components"));
120
+
121
+ // src/components/code-editor/index.tsx
122
+ var import_react2 = __toESM(require("react"));
123
+ var import_react3 = require("@coze-editor/editor/react");
124
+ var import_preset_code5 = __toESM(require("@coze-editor/editor/preset-code"));
125
+ var import_view = require("@codemirror/view");
126
+
127
+ // src/components/code-editor/utils.ts
128
+ function getSuffixByLanguageId(languageId) {
129
+ if (languageId === "python") {
130
+ return ".py";
131
+ }
132
+ if (languageId === "typescript") {
133
+ return ".ts";
134
+ }
135
+ if (languageId === "shell") {
136
+ return ".sh";
137
+ }
138
+ if (languageId === "json") {
139
+ return ".json";
140
+ }
141
+ return "";
142
+ }
143
+
144
+ // src/components/code-editor/language-features.ts
145
+ var import_preset_code = require("@coze-editor/editor/preset-code");
146
+ var import_language_typescript = require("@coze-editor/editor/language-typescript");
147
+ var import_language_shell = require("@coze-editor/editor/language-shell");
148
+ var import_language_python = require("@coze-editor/editor/language-python");
149
+ var import_language_json = require("@coze-editor/editor/language-json");
150
+ var import_editor = require("@coze-editor/editor");
151
+ import_preset_code.languages.register("python", import_language_python.python);
152
+ import_preset_code.languages.register("shell", import_language_shell.shell);
153
+ import_preset_code.languages.register("typescript", import_language_typescript.typescript);
154
+ import_preset_code.languages.register("json", {
155
+ // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
156
+ language: (0, import_editor.mixLanguages)({
157
+ outerLanguage: import_language_json.json.language
158
+ }),
159
+ languageService: import_language_json.json.languageService
160
+ });
161
+ var tsWorkerInit = false;
162
+ var initTsWorker = () => {
163
+ if (tsWorkerInit) {
164
+ return;
165
+ }
166
+ tsWorkerInit = true;
167
+ const tsWorker = new Worker(
168
+ new URL(`@coze-editor/editor/language-typescript/worker`, importMetaUrl),
169
+ { type: "module" }
170
+ );
171
+ import_language_typescript.typescript.languageService.initialize(tsWorker, {
172
+ compilerOptions: {
173
+ // eliminate Promise error
174
+ lib: ["es2015", "dom"],
175
+ noImplicitAny: false
176
+ }
177
+ });
178
+ };
179
+
180
+ // src/components/code-editor/theme/index.ts
181
+ var import_preset_code4 = require("@coze-editor/editor/preset-code");
182
+
183
+ // src/components/code-editor/theme/light.ts
184
+ var import_preset_code2 = require("@coze-editor/editor/preset-code");
185
+ var colors = {
186
+ background: "#F7F7FC",
187
+ // syntax
188
+ comment: "#000A298A",
189
+ key: "#00818C",
190
+ string: "#D1009D",
191
+ number: "#C74200",
192
+ boolean: "#2B57D9",
193
+ null: "#2B57D9",
194
+ separator: "#0F1529D1"
195
+ };
196
+ var lightTheme = (0, import_preset_code2.createTheme)({
197
+ variant: "light",
198
+ settings: {
199
+ background: "#fff",
200
+ foreground: "#000",
201
+ caret: "#000",
202
+ selection: "#d9d9d9",
203
+ gutterBackground: "#f0f0f0",
204
+ gutterForeground: "#666",
205
+ gutterBorderColor: "transparent",
206
+ gutterBorderWidth: 0,
207
+ lineHighlight: "#e1e1e180",
208
+ bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
209
+ tooltip: {
210
+ backgroundColor: "#f0f0f0",
211
+ color: "#000",
212
+ border: "1px solid #ccc"
91
213
  },
92
- /* @__PURE__ */ import_react.default.createElement(
93
- "path",
94
- {
95
- fillRule: "evenodd",
96
- clipRule: "evenodd",
97
- 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",
98
- fill: "currentColor"
99
- }
100
- )
101
- ),
102
- object: /* @__PURE__ */ import_react.default.createElement(
103
- "svg",
104
- {
105
- width: "1em",
106
- height: "1em",
107
- viewBox: "0 0 16 16",
108
- fill: "none",
109
- xmlns: "http://www.w3.org/2000/svg"
214
+ link: {
215
+ color: "#007bff"
110
216
  },
111
- /* @__PURE__ */ import_react.default.createElement(
112
- "path",
113
- {
114
- 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",
115
- fill: "currentColor"
116
- }
117
- ),
118
- /* @__PURE__ */ import_react.default.createElement(
119
- "path",
120
- {
121
- 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",
122
- fill: "currentColor"
123
- }
124
- )
125
- ),
126
- boolean: /* @__PURE__ */ import_react.default.createElement(
127
- "svg",
128
- {
129
- width: "1em",
130
- height: "1em",
131
- viewBox: "0 0 16 16",
132
- fill: "none",
133
- xmlns: "http://www.w3.org/2000/svg"
217
+ completionItemHover: {
218
+ backgroundColor: "#f0f0f0"
134
219
  },
135
- /* @__PURE__ */ import_react.default.createElement(
136
- "path",
137
- {
138
- fillRule: "evenodd",
139
- clipRule: "evenodd",
140
- 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",
141
- fill: "currentColor"
142
- }
143
- ),
144
- /* @__PURE__ */ import_react.default.createElement(
145
- "path",
146
- {
147
- fillRule: "evenodd",
148
- clipRule: "evenodd",
149
- 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",
150
- fill: "currentColor"
151
- }
152
- )
153
- ),
154
- string: /* @__PURE__ */ import_react.default.createElement(
155
- "svg",
156
- {
157
- width: "1em",
158
- height: "1em",
159
- viewBox: "0 0 16 16",
160
- fill: "none",
161
- xmlns: "http://www.w3.org/2000/svg"
220
+ completionItemSelected: {
221
+ backgroundColor: "#e0e0e0"
162
222
  },
163
- /* @__PURE__ */ import_react.default.createElement(
164
- "path",
165
- {
166
- 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",
167
- fill: "currentColor"
168
- }
169
- ),
170
- /* @__PURE__ */ import_react.default.createElement(
171
- "path",
172
- {
173
- 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",
174
- fill: "currentColor"
175
- }
176
- ),
177
- /* @__PURE__ */ import_react.default.createElement(
178
- "path",
179
- {
180
- 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",
181
- fill: "currentColor"
182
- }
183
- ),
184
- /* @__PURE__ */ import_react.default.createElement(
185
- "path",
186
- {
187
- 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",
188
- fill: "currentColor"
189
- }
190
- )
191
- ),
192
- integer: /* @__PURE__ */ import_react.default.createElement(
193
- "svg",
194
- {
195
- width: "1em",
196
- height: "1em",
197
- viewBox: "0 0 16 16",
198
- fill: "none",
199
- xmlns: "http://www.w3.org/2000/svg"
223
+ completionItemIcon: {
224
+ color: "#333"
200
225
  },
201
- /* @__PURE__ */ import_react.default.createElement(
202
- "path",
203
- {
204
- 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",
205
- fill: "currentColor"
206
- }
207
- ),
208
- /* @__PURE__ */ import_react.default.createElement(
209
- "path",
210
- {
211
- 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",
212
- fill: "currentColor"
213
- }
214
- ),
215
- /* @__PURE__ */ import_react.default.createElement(
216
- "path",
217
- {
218
- d: "M1.668 12.0001V4.78805L0 6.25205V4.89605L1.668 3.45605H2.892V12.0001H1.668Z",
219
- fill: "currentColor"
220
- }
221
- )
222
- ),
223
- number: /* @__PURE__ */ import_react.default.createElement(
224
- "svg",
225
- {
226
- width: "1em",
227
- height: "1em",
228
- viewBox: "0 0 16 16",
229
- fill: "none",
230
- xmlns: "http://www.w3.org/2000/svg"
226
+ completionItemLabel: {
227
+ color: "#333"
231
228
  },
232
- /* @__PURE__ */ import_react.default.createElement(
233
- "path",
234
- {
235
- 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",
236
- fill: "currentColor"
237
- }
238
- ),
239
- /* @__PURE__ */ import_react.default.createElement(
240
- "path",
241
- {
242
- 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",
243
- fill: "currentColor"
244
- }
245
- ),
246
- /* @__PURE__ */ import_react.default.createElement(
247
- "path",
248
- {
249
- 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",
250
- fill: "currentColor"
251
- }
252
- )
253
- ),
254
- array: /* @__PURE__ */ import_react.default.createElement(
255
- "svg",
256
- {
257
- width: "1em",
258
- height: "1em",
259
- viewBox: "0 0 16 16",
260
- fill: "none",
261
- xmlns: "http://www.w3.org/2000/svg"
229
+ completionItemInfo: {
230
+ color: "#333"
262
231
  },
263
- /* @__PURE__ */ import_react.default.createElement(
264
- "path",
265
- {
266
- d: "M5.23759 1.00342H2.00391V14.997H5.23759V13.6251H3.35127V2.37534H5.23759V1.00342Z",
267
- fill: "currentColor"
268
- }
269
- ),
270
- /* @__PURE__ */ import_react.default.createElement(
271
- "path",
272
- {
273
- d: "M10.7624 1.00342H13.9961V14.997H10.7624V13.6251H12.6487V2.37534H10.7624V1.00342Z",
274
- fill: "currentColor"
275
- }
276
- )
277
- ),
278
- stream: /* @__PURE__ */ import_react.default.createElement(
279
- "svg",
280
- {
281
- viewBox: "0 0 1024 1024",
282
- version: "1.1",
283
- xmlns: "http://www.w3.org/2000/svg",
284
- width: "1em",
285
- height: "1em"
232
+ completionItemDetail: {
233
+ color: "#666"
234
+ }
235
+ },
236
+ styles: [
237
+ // JSON
238
+ {
239
+ tag: import_preset_code2.tags.comment,
240
+ color: colors.comment
286
241
  },
287
- /* @__PURE__ */ import_react.default.createElement(
288
- "path",
289
- {
290
- 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",
291
- fill: "currentColor"
292
- }
293
- )
294
- ),
295
- map: /* @__PURE__ */ import_react.default.createElement(
296
- "svg",
297
- {
298
- viewBox: "0 0 1024 1024",
299
- version: "1.1",
300
- xmlns: "http://www.w3.org/2000/svg",
301
- width: "1em",
302
- height: "1em"
242
+ {
243
+ tag: [import_preset_code2.tags.propertyName],
244
+ color: colors.key
303
245
  },
304
- /* @__PURE__ */ import_react.default.createElement(
305
- "path",
306
- {
307
- 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",
308
- fill: "currentColor"
309
- }
310
- ),
311
- /* @__PURE__ */ import_react.default.createElement(
312
- "path",
313
- {
314
- 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",
315
- fill: "currentColor"
316
- }
317
- )
318
- )
319
- };
320
- var ArrayIcons = {
321
- object: /* @__PURE__ */ import_react.default.createElement(
322
- "svg",
323
- {
324
- width: "1em",
325
- height: "1em",
326
- viewBox: "0 0 16 16",
327
- fill: "none",
328
- xmlns: "http://www.w3.org/2000/svg"
246
+ {
247
+ tag: [import_preset_code2.tags.string],
248
+ color: colors.string
329
249
  },
330
- /* @__PURE__ */ import_react.default.createElement(
331
- "path",
332
- {
333
- fillRule: "evenodd",
334
- clipRule: "evenodd",
335
- 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",
336
- fill: "currentColor"
337
- }
338
- )
339
- ),
340
- boolean: /* @__PURE__ */ import_react.default.createElement(
341
- "svg",
342
- {
343
- width: "1em",
344
- height: "1em",
345
- viewBox: "0 0 16 16",
346
- fill: "none",
347
- xmlns: "http://www.w3.org/2000/svg"
250
+ {
251
+ tag: [import_preset_code2.tags.number],
252
+ color: colors.number
348
253
  },
349
- /* @__PURE__ */ import_react.default.createElement(
350
- "path",
351
- {
352
- fillRule: "evenodd",
353
- clipRule: "evenodd",
354
- 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",
355
- fill: "currentColor"
356
- }
357
- )
358
- ),
359
- string: /* @__PURE__ */ import_react.default.createElement(
360
- "svg",
361
- {
362
- width: "1em",
363
- height: "1em",
364
- viewBox: "0 0 16 16",
365
- fill: "none",
366
- xmlns: "http://www.w3.org/2000/svg"
254
+ {
255
+ tag: [import_preset_code2.tags.bool],
256
+ color: colors.boolean
367
257
  },
368
- /* @__PURE__ */ import_react.default.createElement(
369
- "path",
370
- {
371
- fillRule: "evenodd",
372
- clipRule: "evenodd",
373
- 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",
374
- fill: "currentColor"
375
- }
376
- )
377
- ),
378
- integer: /* @__PURE__ */ import_react.default.createElement(
379
- "svg",
380
- {
381
- width: "1em",
382
- height: "1em",
383
- viewBox: "0 0 16 16",
384
- fill: "none",
385
- xmlns: "http://www.w3.org/2000/svg"
258
+ {
259
+ tag: [import_preset_code2.tags.null],
260
+ color: colors.null
386
261
  },
387
- /* @__PURE__ */ import_react.default.createElement(
388
- "path",
389
- {
390
- fillRule: "evenodd",
391
- clipRule: "evenodd",
392
- 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",
393
- fill: "currentColor"
394
- }
395
- )
396
- ),
397
- number: /* @__PURE__ */ import_react.default.createElement(
398
- "svg",
399
- {
400
- width: "1em",
401
- height: "1em",
402
- viewBox: "0 0 16 16",
403
- fill: "none",
404
- xmlns: "http://www.w3.org/2000/svg"
262
+ {
263
+ tag: [import_preset_code2.tags.separator],
264
+ color: colors.separator
405
265
  },
406
- /* @__PURE__ */ import_react.default.createElement(
407
- "path",
408
- {
409
- fillRule: "evenodd",
410
- clipRule: "evenodd",
411
- 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",
412
- fill: "currentColor"
413
- }
414
- )
415
- )
416
- };
417
- var getSchemaIcon = (value) => {
418
- if (value?.type === "array") {
419
- return ArrayIcons[value.items?.type || "object"];
420
- }
421
- return VariableTypeIcons[value?.type || "object"];
266
+ // markdown
267
+ {
268
+ tag: [import_preset_code2.tags.heading],
269
+ color: "#3e76ef"
270
+ },
271
+ {
272
+ tag: [import_preset_code2.tags.processingInstruction],
273
+ color: "#3e76ef"
274
+ },
275
+ // shell
276
+ // curl
277
+ {
278
+ tag: [import_preset_code2.tags.standard(import_preset_code2.tags.variableName)],
279
+ color: "#00804A"
280
+ },
281
+ // -X
282
+ {
283
+ tag: [import_preset_code2.tags.attributeName],
284
+ color: "#C74200"
285
+ },
286
+ // url in string (includes quotes), e.g. "https://..."
287
+ {
288
+ tag: [import_preset_code2.tags.special(import_preset_code2.tags.string)],
289
+ color: "#2B57D9"
290
+ }
291
+ ]
292
+ });
293
+
294
+ // src/components/code-editor/theme/dark.ts
295
+ var import_preset_code3 = require("@coze-editor/editor/preset-code");
296
+ var colors2 = {
297
+ background: "#151B27",
298
+ // syntax
299
+ comment: "#FFFFFF63",
300
+ key: "#39E5D7",
301
+ string: "#FF94D2",
302
+ number: "#FF9933",
303
+ boolean: "#78B0FF",
304
+ null: "#78B0FF",
305
+ separator: "#FFFFFFC9"
422
306
  };
423
- var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
424
- var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
425
- var baseOptions = [
426
- {
427
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "string" }) }), firstUppercase("string")),
428
- value: "string"
429
- },
430
- {
431
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "integer" }) }), firstUppercase("integer")),
432
- value: "integer"
433
- },
434
- {
435
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "number" }) }), firstUppercase("number")),
436
- value: "number"
437
- },
438
- {
439
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "boolean" }) }), firstUppercase("boolean")),
440
- value: "boolean"
441
- },
442
- {
443
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "object" }) }), firstUppercase("object")),
444
- value: "object"
445
- }
446
- ];
447
- var options = [
448
- ...baseOptions,
449
- {
450
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "array" }) }), firstUppercase("array")),
451
- value: "array",
452
- children: baseOptions.map((_opt) => ({
453
- ..._opt,
454
- value: `${_opt.value}`,
455
- label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(
456
- import_semi_icons.default,
457
- {
458
- size: "small",
459
- svg: getSchemaIcon({ type: "array", items: { type: _opt.value } })
460
- }
461
- ), firstUppercase(_opt.value))
462
- }))
463
- }
464
- ];
465
-
466
- // src/utils/json-schema/index.ts
467
- var import_lodash = require("lodash");
468
- var import_editor = require("@flowgram.ai/editor");
469
- var JsonSchemaUtils;
470
- ((JsonSchemaUtils2) => {
471
- function schemaToAST(jsonSchema) {
472
- const { type, extra } = jsonSchema || {};
473
- const { weak = false } = extra || {};
474
- if (!type) {
475
- return void 0;
307
+ var darkTheme = (0, import_preset_code3.createTheme)({
308
+ variant: "dark",
309
+ settings: {
310
+ background: colors2.background,
311
+ foreground: "#fff",
312
+ caret: "#AEAFAD",
313
+ selection: "#d9d9d942",
314
+ gutterBackground: colors2.background,
315
+ gutterForeground: "#FFFFFF63",
316
+ gutterBorderColor: "transparent",
317
+ gutterBorderWidth: 0,
318
+ lineHighlight: "#272e3d36",
319
+ bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
320
+ tooltip: {
321
+ backgroundColor: "#363D4D",
322
+ color: "#fff",
323
+ border: "none"
324
+ },
325
+ link: {
326
+ color: "#4daafc"
327
+ },
328
+ completionItemHover: {
329
+ backgroundColor: "#FFFFFF0F"
330
+ },
331
+ completionItemSelected: {
332
+ backgroundColor: "#FFFFFF17"
333
+ },
334
+ completionItemIcon: {
335
+ color: "#FFFFFFC9"
336
+ },
337
+ completionItemLabel: {
338
+ color: "#FFFFFFC9"
339
+ },
340
+ completionItemInfo: {
341
+ color: "#FFFFFFC9"
342
+ },
343
+ completionItemDetail: {
344
+ color: "#FFFFFF63"
476
345
  }
477
- switch (type) {
478
- case "object":
479
- if (weak) {
480
- return { kind: import_editor.ASTKind.Object, weak: true };
481
- }
482
- return import_editor.ASTFactory.createObject({
483
- properties: Object.entries(jsonSchema.properties || {}).sort((a, b) => ((0, import_lodash.get)(a?.[1], "extra.index") || 0) - ((0, import_lodash.get)(b?.[1], "extra.index") || 0)).map(([key, _property]) => ({
484
- key,
485
- type: schemaToAST(_property),
486
- meta: {
487
- title: _property.title,
488
- description: _property.description
489
- }
490
- }))
491
- });
492
- case "array":
493
- if (weak) {
494
- return { kind: import_editor.ASTKind.Array, weak: true };
495
- }
496
- return import_editor.ASTFactory.createArray({
497
- items: schemaToAST(jsonSchema.items)
498
- });
499
- case "map":
500
- if (weak) {
501
- return { kind: import_editor.ASTKind.Map, weak: true };
502
- }
503
- return import_editor.ASTFactory.createMap({
504
- valueType: schemaToAST(jsonSchema.additionalProperties)
505
- });
506
- case "string":
507
- return import_editor.ASTFactory.createString();
508
- case "number":
509
- return import_editor.ASTFactory.createNumber();
510
- case "boolean":
511
- return import_editor.ASTFactory.createBoolean();
512
- case "integer":
513
- return import_editor.ASTFactory.createInteger();
514
- default:
515
- return import_editor.ASTFactory.createCustomType({ typeName: type });
516
- }
517
- }
518
- JsonSchemaUtils2.schemaToAST = schemaToAST;
519
- function astToSchema(typeAST, options2) {
520
- const { drilldown = true } = options2 || {};
521
- if (import_editor.ASTMatch.isString(typeAST)) {
522
- return {
523
- type: "string"
524
- };
346
+ },
347
+ styles: [
348
+ // json
349
+ {
350
+ tag: import_preset_code3.tags.comment,
351
+ color: colors2.comment
352
+ },
353
+ {
354
+ tag: [import_preset_code3.tags.propertyName],
355
+ color: colors2.key
356
+ },
357
+ {
358
+ tag: [import_preset_code3.tags.string],
359
+ color: colors2.string
360
+ },
361
+ {
362
+ tag: [import_preset_code3.tags.number],
363
+ color: colors2.number
364
+ },
365
+ {
366
+ tag: [import_preset_code3.tags.bool],
367
+ color: colors2.boolean
368
+ },
369
+ {
370
+ tag: [import_preset_code3.tags.null],
371
+ color: colors2.null
372
+ },
373
+ {
374
+ tag: [import_preset_code3.tags.separator],
375
+ color: colors2.separator
376
+ },
377
+ // markdown
378
+ {
379
+ tag: [import_preset_code3.tags.heading],
380
+ color: "#6b6bff"
381
+ },
382
+ {
383
+ tag: [import_preset_code3.tags.processingInstruction],
384
+ color: "#6b6bff"
385
+ },
386
+ // shell
387
+ // curl
388
+ {
389
+ tag: [import_preset_code3.tags.standard(import_preset_code3.tags.variableName)],
390
+ color: "#3BEB84"
391
+ },
392
+ // -X
393
+ {
394
+ tag: [import_preset_code3.tags.attributeName],
395
+ color: "#FF9933"
396
+ },
397
+ // url in string (includes quotes), e.g. "https://..."
398
+ {
399
+ tag: [import_preset_code3.tags.special(import_preset_code3.tags.string)],
400
+ color: "#78B0FF"
525
401
  }
526
- if (import_editor.ASTMatch.isBoolean(typeAST)) {
527
- return {
528
- type: "boolean"
529
- };
402
+ ]
403
+ });
404
+
405
+ // src/components/code-editor/theme/index.ts
406
+ import_preset_code4.themes.register("dark", darkTheme);
407
+ import_preset_code4.themes.register("light", lightTheme);
408
+
409
+ // src/components/code-editor/index.tsx
410
+ var OriginCodeEditor = (0, import_react3.createRenderer)(import_preset_code5.default, [
411
+ import_view.EditorView.theme({
412
+ "&.cm-focused": {
413
+ outline: "none"
530
414
  }
531
- if (import_editor.ASTMatch.isNumber(typeAST)) {
532
- return {
533
- type: "number"
534
- };
415
+ })
416
+ ]);
417
+ function CodeEditor({
418
+ value,
419
+ onChange,
420
+ languageId = "python",
421
+ theme = "light",
422
+ children,
423
+ placeholder,
424
+ activeLinePlaceholder,
425
+ options,
426
+ readonly
427
+ }) {
428
+ const editorRef = (0, import_react2.useRef)(null);
429
+ (0, import_react2.useEffect)(() => {
430
+ if (languageId === "typescript") {
431
+ initTsWorker();
535
432
  }
536
- if (import_editor.ASTMatch.isInteger(typeAST)) {
537
- return {
538
- type: "integer"
539
- };
433
+ }, [languageId]);
434
+ (0, import_react2.useEffect)(() => {
435
+ if (editorRef.current?.getValue() !== value) {
436
+ editorRef.current?.setValue(String(value || ""));
540
437
  }
541
- if (import_editor.ASTMatch.isObject(typeAST)) {
542
- return {
543
- type: "object",
544
- properties: drilldown ? Object.fromEntries(
545
- typeAST.properties.map((property) => {
546
- const schema = astToSchema(property.type);
547
- if (property.meta?.title && schema) {
548
- schema.title = property.meta.title;
549
- }
550
- if (property.meta?.description && schema) {
551
- schema.description = property.meta.description;
552
- }
553
- return [property.key, schema];
554
- })
555
- ) : {}
556
- };
438
+ }, [value]);
439
+ return /* @__PURE__ */ import_react2.default.createElement(import_react3.EditorProvider, null, /* @__PURE__ */ import_react2.default.createElement(
440
+ OriginCodeEditor,
441
+ {
442
+ defaultValue: value,
443
+ options: {
444
+ uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
445
+ languageId,
446
+ theme,
447
+ placeholder,
448
+ readOnly: readonly,
449
+ editable: !readonly,
450
+ ...options || {}
451
+ },
452
+ didMount: (editor) => {
453
+ editorRef.current = editor;
454
+ },
455
+ onChange: (e) => onChange?.(e.value)
456
+ },
457
+ activeLinePlaceholder && /* @__PURE__ */ import_react2.default.createElement(import_react3.ActiveLinePlaceholder, null, activeLinePlaceholder),
458
+ children
459
+ ));
460
+ }
461
+
462
+ // src/components/code-editor-mini/index.tsx
463
+ var UIMini = import_styled_components.default.div`
464
+ .ͼ1 .cm-content {
465
+ padding: 0;
466
+ }
467
+ `;
468
+ function CodeEditorMini(props) {
469
+ return /* @__PURE__ */ import_react4.default.createElement(UIMini, null, /* @__PURE__ */ import_react4.default.createElement(
470
+ CodeEditor,
471
+ {
472
+ ...props,
473
+ options: {
474
+ lineNumbersGutter: false,
475
+ foldGutter: false,
476
+ ...props.options || {}
477
+ }
557
478
  }
558
- if (import_editor.ASTMatch.isArray(typeAST)) {
559
- return {
560
- type: "array",
561
- items: drilldown ? astToSchema(typeAST.items) : void 0
562
- };
479
+ ));
480
+ }
481
+
482
+ // src/plugins/json-schema-preset/type-definition/object.tsx
483
+ var objectRegistry = {
484
+ type: "object",
485
+ ConstantRenderer: (props) => /* @__PURE__ */ import_react5.default.createElement(
486
+ CodeEditorMini,
487
+ {
488
+ value: props.value,
489
+ onChange: (v) => props.onChange?.(v),
490
+ languageId: "json",
491
+ placeholder: "Please Input Object",
492
+ readonly: props.readonly
563
493
  }
564
- if (import_editor.ASTMatch.isMap(typeAST)) {
565
- return {
566
- type: "map",
567
- items: drilldown ? astToSchema(typeAST.valueType) : void 0
568
- };
494
+ )
495
+ };
496
+
497
+ // src/plugins/json-schema-preset/type-definition/number.tsx
498
+ var import_react6 = __toESM(require("react"));
499
+ var import_semi_ui2 = require("@douyinfe/semi-ui");
500
+ var numberRegistry = {
501
+ type: "number",
502
+ ConstantRenderer: (props) => /* @__PURE__ */ import_react6.default.createElement(
503
+ import_semi_ui2.InputNumber,
504
+ {
505
+ placeholder: "Please Input Number",
506
+ size: "small",
507
+ disabled: props.readonly,
508
+ hideButtons: true,
509
+ ...props
569
510
  }
570
- if (import_editor.ASTMatch.isCustomType(typeAST)) {
571
- return {
572
- type: typeAST.typeName
573
- };
511
+ )
512
+ };
513
+
514
+ // src/plugins/json-schema-preset/type-definition/integer.tsx
515
+ var import_react7 = __toESM(require("react"));
516
+ var import_semi_ui3 = require("@douyinfe/semi-ui");
517
+ var integerRegistry = {
518
+ type: "integer",
519
+ ConstantRenderer: (props) => /* @__PURE__ */ import_react7.default.createElement(
520
+ import_semi_ui3.InputNumber,
521
+ {
522
+ placeholder: "Please Input Integer",
523
+ size: "small",
524
+ disabled: props.readonly,
525
+ precision: 0,
526
+ ...props
574
527
  }
575
- return void 0;
528
+ )
529
+ };
530
+
531
+ // src/plugins/json-schema-preset/type-definition/boolean.tsx
532
+ var import_react8 = __toESM(require("react"));
533
+ var import_semi_ui4 = require("@douyinfe/semi-ui");
534
+ var booleanRegistry = {
535
+ type: "boolean",
536
+ ConstantRenderer: (props) => {
537
+ const { value, onChange, ...rest } = props;
538
+ return /* @__PURE__ */ import_react8.default.createElement(
539
+ import_semi_ui4.Select,
540
+ {
541
+ placeholder: "Please Select Boolean",
542
+ size: "small",
543
+ disabled: props.readonly,
544
+ optionList: [
545
+ { label: "True", value: 1 },
546
+ { label: "False", value: 0 }
547
+ ],
548
+ value: value ? 1 : 0,
549
+ onChange: (value2) => onChange?.(!!value2),
550
+ ...rest
551
+ }
552
+ );
576
553
  }
577
- JsonSchemaUtils2.astToSchema = astToSchema;
578
- function isASTMatchSchema(typeAST, schema) {
579
- if (Array.isArray(schema)) {
580
- return typeAST.isTypeEqual(
581
- import_editor.ASTFactory.createUnion({
582
- types: schema.map((_schema) => schemaToAST(_schema)).filter(Boolean)
583
- })
584
- );
554
+ };
555
+
556
+ // src/plugins/json-schema-preset/type-definition/array.tsx
557
+ var import_react9 = __toESM(require("react"));
558
+ var arrayRegistry = {
559
+ type: "array",
560
+ ConstantRenderer: (props) => /* @__PURE__ */ import_react9.default.createElement(
561
+ CodeEditorMini,
562
+ {
563
+ value: props.value,
564
+ languageId: "json",
565
+ onChange: (v) => props.onChange?.(v),
566
+ placeholder: "Please Input Array",
567
+ readonly: props.readonly
585
568
  }
586
- return typeAST.isTypeEqual(schemaToAST(schema));
569
+ )
570
+ };
571
+
572
+ // src/plugins/json-schema-preset/type-definition/index.tsx
573
+ var jsonSchemaTypePreset = [
574
+ stringRegistry,
575
+ objectRegistry,
576
+ numberRegistry,
577
+ integerRegistry,
578
+ booleanRegistry,
579
+ arrayRegistry
580
+ ];
581
+ jsonSchemaTypePreset.forEach((_type) => import_json_schema.jsonSchemaTypeManager.register(_type));
582
+
583
+ // src/plugins/json-schema-preset/create-type-preset-plugin.tsx
584
+ var import_json_schema2 = require("@flowgram.ai/json-schema");
585
+ var import_editor2 = require("@flowgram.ai/editor");
586
+ var createTypePresetPlugin = (0, import_editor2.definePluginCreator)({
587
+ onInit(ctx, opts) {
588
+ const typeManager = ctx.get(import_json_schema2.BaseTypeManager);
589
+ jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
590
+ opts.types?.forEach((_type) => typeManager.register(_type));
591
+ opts.unregisterTypes?.forEach((_type) => typeManager.unregister(_type));
592
+ },
593
+ containerModules: [import_json_schema2.jsonSchemaContainerModule]
594
+ });
595
+
596
+ // src/plugins/json-schema-preset/index.tsx
597
+ var useTypeManager = () => (0, import_json_schema3.useTypeManager)();
598
+ var JsonSchemaTypePresetProvider = ({
599
+ types = [],
600
+ children
601
+ }) => /* @__PURE__ */ import_react10.default.createElement(import_json_schema3.TypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
602
+
603
+ // src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts
604
+ var import_editor3 = require("@flowgram.ai/editor");
605
+ var createDisableDeclarationPlugin = (0, import_editor3.definePluginCreator)({
606
+ onInit(ctx) {
607
+ const variableEngine = ctx.get(import_editor3.VariableEngine);
608
+ const handleEvent = (action) => {
609
+ if (import_editor3.ASTMatch.isVariableDeclaration(action.ast)) {
610
+ if (!action.ast.meta?.disabled) {
611
+ action.ast.updateMeta({
612
+ ...action.ast.meta || {},
613
+ disabled: true
614
+ });
615
+ }
616
+ }
617
+ };
618
+ variableEngine.onGlobalEvent("NewAST", handleEvent);
619
+ variableEngine.onGlobalEvent("UpdateAST", handleEvent);
587
620
  }
588
- JsonSchemaUtils2.isASTMatchSchema = isASTMatchSchema;
589
- })(JsonSchemaUtils || (JsonSchemaUtils = {}));
621
+ });
590
622
 
591
623
  // src/components/variable-selector/use-variable-tree.tsx
592
624
  function useVariableTree(params) {
593
- const { includeSchema, excludeSchema } = params;
594
- const variables = (0, import_editor2.useAvailableVariables)();
595
- const getVariableTypeIcon = (0, import_react2.useCallback)((variable) => {
625
+ const { includeSchema, excludeSchema, customSkip } = params;
626
+ const typeManager = useTypeManager();
627
+ const variables = (0, import_editor4.useAvailableVariables)();
628
+ const getVariableTypeIcon = (0, import_react11.useCallback)((variable) => {
596
629
  if (variable.meta?.icon) {
597
630
  if (typeof variable.meta.icon === "string") {
598
- return /* @__PURE__ */ import_react2.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
631
+ return /* @__PURE__ */ import_react11.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
599
632
  }
600
633
  return variable.meta.icon;
601
634
  }
602
- const _type = variable.type;
603
- if (import_editor2.ASTMatch.isArray(_type)) {
604
- return /* @__PURE__ */ import_react2.default.createElement(
605
- import_semi_ui.Icon,
606
- {
607
- size: "small",
608
- svg: ArrayIcons[_type.items?.kind.toLowerCase()] || VariableTypeIcons.array
609
- }
610
- );
611
- }
612
- if (import_editor2.ASTMatch.isCustomType(_type)) {
613
- return /* @__PURE__ */ import_react2.default.createElement(import_semi_ui.Icon, { size: "small", svg: VariableTypeIcons[_type.typeName.toLowerCase()] });
614
- }
615
- return /* @__PURE__ */ import_react2.default.createElement(import_semi_ui.Icon, { size: "small", svg: VariableTypeIcons[variable.type?.kind.toLowerCase()] });
635
+ const schema = import_json_schema4.JsonSchemaUtils.astToSchema(variable.type, { drilldownObject: false });
636
+ return /* @__PURE__ */ import_react11.default.createElement(import_semi_ui5.Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
616
637
  }, []);
617
638
  const renderVariable = (variable, parentFields = []) => {
618
639
  let type = variable?.type;
@@ -620,14 +641,16 @@ function useVariableTree(params) {
620
641
  return null;
621
642
  }
622
643
  let children;
623
- if (import_editor2.ASTMatch.isObject(type)) {
644
+ if (import_editor4.ASTMatch.isObject(type)) {
624
645
  children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
625
646
  }
626
647
  const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
627
648
  const key = keyPath.join(".");
628
- const isSchemaInclude = includeSchema ? JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
629
- const isSchemaExclude = excludeSchema ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
630
- const isSchemaMatch = isSchemaInclude && !isSchemaExclude;
649
+ const isSchemaInclude = includeSchema ? import_json_schema4.JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
650
+ const isSchemaExclude = excludeSchema ? import_json_schema4.JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
651
+ const isCustomSkip = customSkip ? customSkip(variable) : false;
652
+ const isMetaDisabled = variable.meta?.disabled;
653
+ const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
631
654
  if (!isSchemaMatch && !children?.length) {
632
655
  return null;
633
656
  }
@@ -639,16 +662,17 @@ function useVariableTree(params) {
639
662
  icon: getVariableTypeIcon(variable),
640
663
  children,
641
664
  disabled: !isSchemaMatch,
642
- rootMeta: parentFields[0]?.meta
665
+ rootMeta: parentFields[0]?.meta || variable.meta,
666
+ isRoot: !parentFields?.length
643
667
  };
644
668
  };
645
669
  return [...variables.slice(0).reverse()].map((_variable) => renderVariable(_variable)).filter(Boolean);
646
670
  }
647
671
 
648
672
  // src/components/variable-selector/styles.tsx
649
- var import_styled_components = __toESM(require("styled-components"));
650
- var import_semi_ui2 = require("@douyinfe/semi-ui");
651
- var UIRootTitle = import_styled_components.default.div`
673
+ var import_styled_components2 = __toESM(require("styled-components"));
674
+ var import_semi_ui6 = require("@douyinfe/semi-ui");
675
+ var UIRootTitle = import_styled_components2.default.div`
652
676
  margin-right: 4px;
653
677
  min-width: 20px;
654
678
  overflow: hidden;
@@ -656,13 +680,16 @@ var UIRootTitle = import_styled_components.default.div`
656
680
  white-space: nowrap;
657
681
  color: var(--semi-color-text-2);
658
682
  `;
659
- var UIVarName = import_styled_components.default.div`
683
+ var UIVarName = import_styled_components2.default.div`
660
684
  overflow: hidden;
661
685
  text-overflow: ellipsis;
662
686
  white-space: nowrap;
663
- min-width: 50%;
687
+
688
+ ${({ $inSelector }) => $inSelector && import_styled_components2.css`
689
+ min-width: 50%;
690
+ `}
664
691
  `;
665
- var UITag = (0, import_styled_components.default)(import_semi_ui2.Tag)`
692
+ var UITag = (0, import_styled_components2.default)(import_semi_ui6.Tag)`
666
693
  width: 100%;
667
694
  display: flex;
668
695
  align-items: center;
@@ -674,17 +701,14 @@ var UITag = (0, import_styled_components.default)(import_semi_ui2.Tag)`
674
701
 
675
702
  &.semi-tag {
676
703
  margin: 0;
704
+ height: 22px;
677
705
  }
678
706
  `;
679
- var UITreeSelect = (0, import_styled_components.default)(import_semi_ui2.TreeSelect)`
707
+ var UITreeSelect = (0, import_styled_components2.default)(import_semi_ui6.TreeSelect)`
680
708
  outline: ${({ $error }) => $error ? "1px solid red" : "none"};
681
709
 
682
- height: 22px;
683
- min-height: 22px;
684
- line-height: 22px;
685
-
686
710
  & .semi-tree-select-selection {
687
- padding: 0 2px;
711
+ padding: 0px;
688
712
  height: 22px;
689
713
  }
690
714
 
@@ -696,6 +720,13 @@ var UITreeSelect = (0, import_styled_components.default)(import_semi_ui2.TreeSel
696
720
  padding-left: 10px;
697
721
  }
698
722
  `;
723
+ var UIPopoverContent = import_styled_components2.default.div`
724
+ padding: 10px;
725
+ display: inline-flex;
726
+ align-items: center;
727
+ justify-content: flex-start;
728
+ white-space: nowrap;
729
+ `;
699
730
 
700
731
  // src/components/variable-selector/index.tsx
701
732
  var VariableSelector = ({
@@ -710,7 +741,7 @@ var VariableSelector = ({
710
741
  triggerRender
711
742
  }) => {
712
743
  const treeData = useVariableTree({ includeSchema, excludeSchema });
713
- const treeValue = (0, import_react3.useMemo)(() => {
744
+ const treeValue = (0, import_react12.useMemo)(() => {
714
745
  if (typeof value === "string") {
715
746
  console.warn(
716
747
  "The Value of VariableSelector is a string, it should be an ARRAY. \n",
@@ -722,11 +753,11 @@ var VariableSelector = ({
722
753
  }, [value]);
723
754
  const renderIcon = (icon) => {
724
755
  if (typeof icon === "string") {
725
- return /* @__PURE__ */ import_react3.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
756
+ return /* @__PURE__ */ import_react12.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
726
757
  }
727
758
  return icon;
728
759
  };
729
- return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, /* @__PURE__ */ import_react3.default.createElement(
760
+ return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement(
730
761
  UITreeSelect,
731
762
  {
732
763
  dropdownMatchSelectWidth: false,
@@ -743,10 +774,10 @@ var VariableSelector = ({
743
774
  },
744
775
  renderSelectedItem: (_option) => {
745
776
  if (!_option?.keyPath) {
746
- return /* @__PURE__ */ import_react3.default.createElement(
777
+ return /* @__PURE__ */ import_react12.default.createElement(
747
778
  UITag,
748
779
  {
749
- prefixIcon: /* @__PURE__ */ import_react3.default.createElement(import_semi_icons2.IconIssueStroked, null),
780
+ prefixIcon: /* @__PURE__ */ import_react12.default.createElement(import_semi_icons.IconIssueStroked, null),
750
781
  color: "amber",
751
782
  closable: !readonly,
752
783
  onClose: () => onChange(void 0)
@@ -754,28 +785,38 @@ var VariableSelector = ({
754
785
  config?.notFoundContent ?? "Undefined"
755
786
  );
756
787
  }
757
- return /* @__PURE__ */ import_react3.default.createElement(
758
- UITag,
788
+ const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
789
+ const rootTitle = /* @__PURE__ */ import_react12.default.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
790
+ return /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement(
791
+ import_semi_ui7.Popover,
759
792
  {
760
- prefixIcon: renderIcon(_option.rootMeta?.icon || _option?.icon),
761
- closable: !readonly,
762
- onClose: () => onChange(void 0)
793
+ content: /* @__PURE__ */ import_react12.default.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ import_react12.default.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
763
794
  },
764
- /* @__PURE__ */ import_react3.default.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} -` : null),
765
- /* @__PURE__ */ import_react3.default.createElement(UIVarName, null, _option.label)
766
- );
795
+ /* @__PURE__ */ import_react12.default.createElement(
796
+ UITag,
797
+ {
798
+ prefixIcon: rootIcon,
799
+ closable: !readonly,
800
+ onClose: () => onChange(void 0)
801
+ },
802
+ rootTitle,
803
+ !_option.isRoot && /* @__PURE__ */ import_react12.default.createElement(UIVarName, { $inSelector: true }, _option.label)
804
+ )
805
+ ));
767
806
  },
768
807
  showClear: false,
769
- arrowIcon: /* @__PURE__ */ import_react3.default.createElement(import_semi_icons2.IconChevronDownStroked, { size: "small" }),
808
+ arrowIcon: /* @__PURE__ */ import_react12.default.createElement(import_semi_icons.IconChevronDownStroked, { size: "small" }),
770
809
  triggerRender,
771
- placeholder: config?.placeholder ?? "Select Variable..."
810
+ placeholder: config?.placeholder ?? "Select Variable"
772
811
  }
773
812
  ));
774
813
  };
775
814
 
776
815
  // src/components/type-selector/index.tsx
777
- var import_react4 = __toESM(require("react"));
778
- var import_semi_ui3 = require("@douyinfe/semi-ui");
816
+ var import_react13 = __toESM(require("react"));
817
+ var import_semi_ui8 = require("@douyinfe/semi-ui");
818
+ var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
819
+ var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
779
820
  var getTypeSelectValue = (value) => {
780
821
  if (value?.type === "array" && value?.items) {
781
822
  return [value.type, ...getTypeSelectValue(value.items) || []];
@@ -790,69 +831,94 @@ var parseTypeSelectValue = (value) => {
790
831
  return { type };
791
832
  };
792
833
  function TypeSelector(props) {
793
- const { value, onChange, disabled, style } = props;
794
- const selectValue = (0, import_react4.useMemo)(() => getTypeSelectValue(value), [value]);
795
- return /* @__PURE__ */ import_react4.default.createElement(
796
- import_semi_ui3.Cascader,
797
- {
798
- disabled,
834
+ const { value, onChange, readonly, disabled, style } = props;
835
+ const selectValue = (0, import_react13.useMemo)(() => getTypeSelectValue(value), [value]);
836
+ const typeManager = useTypeManager();
837
+ const icon = typeManager.getDisplayIcon(value || {});
838
+ const options = (0, import_react13.useMemo)(
839
+ () => typeManager.getTypeRegistriesWithParentType().map((_type) => {
840
+ const isArray2 = _type.type === "array";
841
+ return {
842
+ label: /* @__PURE__ */ import_react13.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react13.default.createElement(import_semi_ui8.Icon, { size: "small", svg: _type.icon }), firstUppercase(_type.type)),
843
+ value: _type.type,
844
+ children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
845
+ label: /* @__PURE__ */ import_react13.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react13.default.createElement(
846
+ import_semi_ui8.Icon,
847
+ {
848
+ size: "small",
849
+ svg: typeManager.getDisplayIcon({
850
+ type: "array",
851
+ items: { type: _type2.type }
852
+ })
853
+ }
854
+ ), firstUppercase(_type2.type)),
855
+ value: _type2.type
856
+ })) : []
857
+ };
858
+ }),
859
+ []
860
+ );
861
+ return /* @__PURE__ */ import_react13.default.createElement(
862
+ import_semi_ui8.Cascader,
863
+ {
864
+ disabled: readonly || disabled,
799
865
  size: "small",
800
- triggerRender: () => /* @__PURE__ */ import_react4.default.createElement(import_semi_ui3.Button, { size: "small", style }, getSchemaIcon(value)),
866
+ triggerRender: () => /* @__PURE__ */ import_react13.default.createElement(import_semi_ui8.IconButton, { size: "small", style, disabled: readonly || disabled, icon }),
801
867
  treeData: options,
802
868
  value: selectValue,
803
869
  leafOnly: true,
804
870
  onChange: (value2) => {
805
- onChange(parseTypeSelectValue(value2));
871
+ onChange?.(parseTypeSelectValue(value2));
806
872
  }
807
873
  }
808
874
  );
809
875
  }
810
876
 
811
877
  // src/components/json-schema-editor/index.tsx
812
- var import_react10 = __toESM(require("react"));
813
- var import_semi_ui6 = require("@douyinfe/semi-ui");
814
- var import_semi_icons5 = require("@douyinfe/semi-icons");
878
+ var import_react19 = __toESM(require("react"));
879
+ var import_semi_ui11 = require("@douyinfe/semi-ui");
880
+ var import_semi_icons4 = require("@douyinfe/semi-icons");
815
881
 
816
882
  // src/components/json-schema-editor/styles.tsx
817
- var import_react5 = __toESM(require("react"));
818
- var import_styled_components2 = __toESM(require("styled-components"));
819
- var import_semi_icons3 = __toESM(require("@douyinfe/semi-icons"));
820
- var UIContainer = import_styled_components2.default.div`
883
+ var import_react14 = __toESM(require("react"));
884
+ var import_styled_components3 = __toESM(require("styled-components"));
885
+ var import_semi_icons2 = __toESM(require("@douyinfe/semi-icons"));
886
+ var UIContainer = import_styled_components3.default.div`
821
887
  /* & .semi-input {
822
888
  background-color: #fff;
823
889
  border-radius: 6px;
824
890
  height: 24px;
825
891
  } */
826
892
  `;
827
- var UIRow = import_styled_components2.default.div`
893
+ var UIRow = import_styled_components3.default.div`
828
894
  display: flex;
829
895
  align-items: center;
830
896
  gap: 6px;
831
897
  `;
832
- var UICollapseTrigger = import_styled_components2.default.div`
898
+ var UICollapseTrigger = import_styled_components3.default.div`
833
899
  cursor: pointer;
834
900
  margin-right: 5px;
835
901
  `;
836
- var UIExpandDetail = import_styled_components2.default.div`
902
+ var UIExpandDetail = import_styled_components3.default.div`
837
903
  display: flex;
838
904
  flex-direction: column;
839
905
  `;
840
- var UILabel = import_styled_components2.default.div`
906
+ var UILabel = import_styled_components3.default.div`
841
907
  font-size: 12px;
842
908
  color: #999;
843
909
  font-weight: 400;
844
910
  margin-bottom: 2px;
845
911
  `;
846
- var UIProperties = import_styled_components2.default.div`
912
+ var UIProperties = import_styled_components3.default.div`
847
913
  display: grid;
848
914
  grid-template-columns: auto 1fr;
849
915
 
850
- ${({ $shrink }) => $shrink && import_styled_components2.css`
916
+ ${({ $shrink }) => $shrink && import_styled_components3.css`
851
917
  padding-left: 10px;
852
918
  margin-top: 10px;
853
919
  `}
854
920
  `;
855
- var UIPropertyLeft = import_styled_components2.default.div`
921
+ var UIPropertyLeft = import_styled_components3.default.div`
856
922
  grid-column: 1;
857
923
  position: relative;
858
924
  width: 16px;
@@ -862,7 +928,7 @@ var UIPropertyLeft = import_styled_components2.default.div`
862
928
  if ($parentType && $isLast) {
863
929
  height = "24px";
864
930
  }
865
- return $showLine && import_styled_components2.css`
931
+ return $showLine && import_styled_components3.css`
866
932
  &::before {
867
933
  /* 竖线 */
868
934
  content: '';
@@ -889,7 +955,7 @@ var UIPropertyLeft = import_styled_components2.default.div`
889
955
  `;
890
956
  }}
891
957
  `;
892
- var UIPropertyRight = import_styled_components2.default.div`
958
+ var UIPropertyRight = import_styled_components3.default.div`
893
959
  grid-column: 2;
894
960
  margin-bottom: 10px;
895
961
 
@@ -897,7 +963,7 @@ var UIPropertyRight = import_styled_components2.default.div`
897
963
  margin-bottom: 0px;
898
964
  }
899
965
  `;
900
- var UIPropertyMain = import_styled_components2.default.div`
966
+ var UIPropertyMain = import_styled_components3.default.div`
901
967
  display: flex;
902
968
  flex-direction: column;
903
969
  gap: 10px;
@@ -916,33 +982,33 @@ var UIPropertyMain = import_styled_components2.default.div`
916
982
  background: #d9d9d9;
917
983
  display: block;
918
984
  }`;
919
- return $expand && import_styled_components2.css`
985
+ return $expand && import_styled_components3.css`
920
986
  background-color: #f5f5f5;
921
987
  padding: 10px;
922
988
  border-radius: 4px;
923
989
 
924
- ${$showCollapse && $collapse && (type === "array" || type === "object") && import_styled_components2.css`
990
+ ${$showCollapse && $collapse && (type === "array" || type === "object") && import_styled_components3.css`
925
991
  ${beforeElement}
926
992
  `}
927
993
  `;
928
994
  }}
929
995
  `;
930
- var UICollapsible = import_styled_components2.default.div`
996
+ var UICollapsible = import_styled_components3.default.div`
931
997
  display: none;
932
998
 
933
- ${({ $collapse }) => $collapse && import_styled_components2.css`
999
+ ${({ $collapse }) => $collapse && import_styled_components3.css`
934
1000
  display: block;
935
1001
  `}
936
1002
  `;
937
- var UIName = import_styled_components2.default.div`
1003
+ var UIName = import_styled_components3.default.div`
938
1004
  flex-grow: 1;
939
1005
  `;
940
- var UIType = import_styled_components2.default.div``;
941
- var UIRequired = import_styled_components2.default.div``;
942
- var UIActions = import_styled_components2.default.div`
1006
+ var UIType = import_styled_components3.default.div``;
1007
+ var UIRequired = import_styled_components3.default.div``;
1008
+ var UIActions = import_styled_components3.default.div`
943
1009
  white-space: nowrap;
944
1010
  `;
945
- var iconAddChildrenSvg = /* @__PURE__ */ import_react5.default.createElement(
1011
+ var iconAddChildrenSvg = /* @__PURE__ */ import_react14.default.createElement(
946
1012
  "svg",
947
1013
  {
948
1014
  className: "icon-icon icon-icon-coz_add_node ",
@@ -952,7 +1018,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ import_react5.default.createElement(
952
1018
  fill: "currentColor",
953
1019
  xmlns: "http://www.w3.org/2000/svg"
954
1020
  },
955
- /* @__PURE__ */ import_react5.default.createElement(
1021
+ /* @__PURE__ */ import_react14.default.createElement(
956
1022
  "path",
957
1023
  {
958
1024
  fillRule: "evenodd",
@@ -960,19 +1026,19 @@ var iconAddChildrenSvg = /* @__PURE__ */ import_react5.default.createElement(
960
1026
  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"
961
1027
  }
962
1028
  ),
963
- /* @__PURE__ */ import_react5.default.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" })
1029
+ /* @__PURE__ */ import_react14.default.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" })
964
1030
  );
965
- var IconAddChildren = () => /* @__PURE__ */ import_react5.default.createElement(import_semi_icons3.default, { size: "small", svg: iconAddChildrenSvg });
966
- var DefaultValueWrapper = import_styled_components2.default.div`
1031
+ var IconAddChildren = () => /* @__PURE__ */ import_react14.default.createElement(import_semi_icons2.default, { size: "small", svg: iconAddChildrenSvg });
1032
+ var DefaultValueWrapper = import_styled_components3.default.div`
967
1033
  margin: 0;
968
1034
  `;
969
- var JSONViewerWrapper = import_styled_components2.default.div`
1035
+ var JSONViewerWrapper = import_styled_components3.default.div`
970
1036
  padding: 0 0 24px;
971
1037
  &:first-child {
972
1038
  margin-top: 0px;
973
1039
  }
974
1040
  `;
975
- var JSONHeader = import_styled_components2.default.div`
1041
+ var JSONHeader = import_styled_components3.default.div`
976
1042
  display: flex;
977
1043
  justify-content: space-between;
978
1044
  align-items: center;
@@ -981,17 +1047,17 @@ var JSONHeader = import_styled_components2.default.div`
981
1047
  height: 36px;
982
1048
  padding: 0 8px 0 12px;
983
1049
  `;
984
- var JSONHeaderLeft = import_styled_components2.default.div`
1050
+ var JSONHeaderLeft = import_styled_components3.default.div`
985
1051
  display: flex;
986
1052
  align-items: center;
987
1053
  gap: 10px;
988
1054
  `;
989
- var JSONHeaderRight = import_styled_components2.default.div`
1055
+ var JSONHeaderRight = import_styled_components3.default.div`
990
1056
  display: flex;
991
1057
  align-items: center;
992
1058
  gap: 10px;
993
1059
  `;
994
- var ConstantInputWrapper = import_styled_components2.default.div`
1060
+ var ConstantInputWrapper = import_styled_components3.default.div`
995
1061
  flex-grow: 1;
996
1062
 
997
1063
  & .semi-tree-select,
@@ -1002,8 +1068,8 @@ var ConstantInputWrapper = import_styled_components2.default.div`
1002
1068
  `;
1003
1069
 
1004
1070
  // src/components/json-schema-editor/hooks.tsx
1005
- var import_react6 = require("react");
1006
- var import_lodash2 = require("lodash");
1071
+ var import_react15 = require("react");
1072
+ var import_lodash = require("lodash");
1007
1073
  var _id = 0;
1008
1074
  function genId() {
1009
1075
  return _id++;
@@ -1018,9 +1084,9 @@ function getDrilldownSchema(value, path) {
1018
1084
  return { schema: value, path };
1019
1085
  }
1020
1086
  function usePropertiesEdit(value, onChange) {
1021
- const drilldown = (0, import_react6.useMemo)(() => getDrilldownSchema(value), [value, value?.type, value?.items]);
1087
+ const drilldown = (0, import_react15.useMemo)(() => getDrilldownSchema(value), [value, value?.type, value?.items]);
1022
1088
  const isDrilldownObject = drilldown.schema?.type === "object";
1023
- const initPropertyList = (0, import_react6.useMemo)(
1089
+ const initPropertyList = (0, import_react15.useMemo)(
1024
1090
  () => isDrilldownObject ? Object.entries(drilldown.schema?.properties || {}).sort(([, a], [, b]) => (a.extra?.index ?? 0) - (b.extra?.index ?? 0)).map(
1025
1091
  ([name, _value], index) => ({
1026
1092
  key: genId(),
@@ -1035,9 +1101,9 @@ function usePropertiesEdit(value, onChange) {
1035
1101
  ) : [],
1036
1102
  [isDrilldownObject]
1037
1103
  );
1038
- const [propertyList, setPropertyList] = (0, import_react6.useState)(initPropertyList);
1039
- const mountRef = (0, import_react6.useRef)(false);
1040
- (0, import_react6.useEffect)(() => {
1104
+ const [propertyList, setPropertyList] = (0, import_react15.useState)(initPropertyList);
1105
+ const mountRef = (0, import_react15.useRef)(false);
1106
+ (0, import_react15.useEffect)(() => {
1041
1107
  if (mountRef.current) {
1042
1108
  setPropertyList((_list) => {
1043
1109
  const nameMap = /* @__PURE__ */ new Map();
@@ -1076,7 +1142,7 @@ function usePropertiesEdit(value, onChange) {
1076
1142
  if (!_property.name) {
1077
1143
  continue;
1078
1144
  }
1079
- nextProperties[_property.name] = (0, import_lodash2.omit)(_property, ["key", "name", "isPropertyRequired"]);
1145
+ nextProperties[_property.name] = (0, import_lodash.omit)(_property, ["key", "name", "isPropertyRequired"]);
1080
1146
  if (_property.isPropertyRequired) {
1081
1147
  nextRequired.push(_property.name);
1082
1148
  }
@@ -1105,7 +1171,7 @@ function usePropertiesEdit(value, onChange) {
1105
1171
  (_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
1106
1172
  );
1107
1173
  };
1108
- (0, import_react6.useEffect)(() => {
1174
+ (0, import_react15.useEffect)(() => {
1109
1175
  if (!isDrilldownObject) {
1110
1176
  setPropertyList([]);
1111
1177
  }
@@ -1120,9 +1186,9 @@ function usePropertiesEdit(value, onChange) {
1120
1186
  }
1121
1187
 
1122
1188
  // src/components/json-schema-editor/default-value.tsx
1123
- var import_react8 = __toESM(require("react"));
1124
- var import_semi_ui5 = require("@douyinfe/semi-ui");
1125
- var import_semi_icons4 = require("@douyinfe/semi-icons");
1189
+ var import_react17 = __toESM(require("react"));
1190
+ var import_semi_ui10 = require("@douyinfe/semi-ui");
1191
+ var import_semi_icons3 = require("@douyinfe/semi-icons");
1126
1192
 
1127
1193
  // src/components/json-schema-editor/utils.ts
1128
1194
  function getValueType(value) {
@@ -1144,100 +1210,54 @@ function getValueType(value) {
1144
1210
  }
1145
1211
 
1146
1212
  // src/components/constant-input/index.tsx
1147
- var import_react7 = __toESM(require("react"));
1148
- var import_semi_ui4 = require("@douyinfe/semi-ui");
1149
- var defaultStrategies = [
1150
- {
1151
- hit: (schema) => schema?.type === "string",
1152
- Renderer: (props) => /* @__PURE__ */ import_react7.default.createElement(import_semi_ui4.Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
1153
- },
1154
- {
1155
- hit: (schema) => schema?.type === "number",
1156
- Renderer: (props) => /* @__PURE__ */ import_react7.default.createElement(
1157
- import_semi_ui4.InputNumber,
1158
- {
1159
- placeholder: "Please Input Number",
1160
- size: "small",
1161
- disabled: props.readonly,
1162
- hideButtons: true,
1163
- ...props
1164
- }
1165
- )
1166
- },
1167
- {
1168
- hit: (schema) => schema?.type === "integer",
1169
- Renderer: (props) => /* @__PURE__ */ import_react7.default.createElement(
1170
- import_semi_ui4.InputNumber,
1171
- {
1172
- placeholder: "Please Input Integer",
1173
- size: "small",
1174
- disabled: props.readonly,
1175
- hideButtons: true,
1176
- precision: 0,
1177
- ...props
1178
- }
1179
- )
1180
- },
1181
- {
1182
- hit: (schema) => schema?.type === "boolean",
1183
- Renderer: (props) => {
1184
- const { value, onChange, ...rest } = props;
1185
- return /* @__PURE__ */ import_react7.default.createElement(
1186
- import_semi_ui4.Select,
1187
- {
1188
- placeholder: "Please Select Boolean",
1189
- size: "small",
1190
- disabled: props.readonly,
1191
- optionList: [
1192
- { label: "True", value: 1 },
1193
- { label: "False", value: 0 }
1194
- ],
1195
- value: value ? 1 : 0,
1196
- onChange: (value2) => onChange?.(!!value2),
1197
- ...rest
1198
- }
1199
- );
1200
- }
1201
- }
1202
- ];
1213
+ var import_react16 = __toESM(require("react"));
1214
+ var import_semi_ui9 = require("@douyinfe/semi-ui");
1203
1215
  function ConstantInput(props) {
1204
- const { value, onChange, schema, strategies: extraStrategies, readonly, ...rest } = props;
1205
- const strategies = (0, import_react7.useMemo)(
1206
- () => [...defaultStrategies, ...extraStrategies || []],
1207
- [extraStrategies]
1208
- );
1209
- const Renderer2 = (0, import_react7.useMemo)(() => {
1210
- const strategy = strategies.find((_strategy) => _strategy.hit(schema));
1216
+ const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
1217
+ const typeManager = useTypeManager();
1218
+ const Renderer2 = (0, import_react16.useMemo)(() => {
1219
+ const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
1220
+ if (!strategy) {
1221
+ return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
1222
+ }
1211
1223
  return strategy?.Renderer;
1212
1224
  }, [strategies, schema]);
1213
1225
  if (!Renderer2) {
1214
- return /* @__PURE__ */ import_react7.default.createElement(import_semi_ui4.Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
1226
+ if (fallbackRenderer) {
1227
+ return import_react16.default.createElement(fallbackRenderer, {
1228
+ value,
1229
+ onChange,
1230
+ readonly,
1231
+ ...rest
1232
+ });
1233
+ }
1234
+ return /* @__PURE__ */ import_react16.default.createElement(import_semi_ui9.Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
1215
1235
  }
1216
- return /* @__PURE__ */ import_react7.default.createElement(Renderer2, { value, onChange, readonly, ...rest });
1236
+ return /* @__PURE__ */ import_react16.default.createElement(Renderer2, { value, onChange, readonly, ...rest });
1217
1237
  }
1218
1238
 
1219
1239
  // src/components/json-schema-editor/default-value.tsx
1220
1240
  function DefaultValue(props) {
1221
1241
  const { value, schema, type, onChange, placeholder, jsonFormatText } = props;
1222
- const wrapperRef = (0, import_react8.useRef)(null);
1223
- const JsonViewerRef = (0, import_react8.useRef)(null);
1224
- const [internalJsonValue, setInternalJsonValue] = (0, import_react8.useState)(
1242
+ const wrapperRef = (0, import_react17.useRef)(null);
1243
+ const JsonViewerRef = (0, import_react17.useRef)(null);
1244
+ const [internalJsonValue, setInternalJsonValue] = (0, import_react17.useState)(
1225
1245
  getValueType(value) === "string" ? value : ""
1226
1246
  );
1227
- const handleJsonChange = (0, import_react8.useCallback)((val) => {
1247
+ const handleJsonChange = (0, import_react17.useCallback)((val) => {
1228
1248
  if (val !== internalJsonValue) {
1229
1249
  setInternalJsonValue(val);
1230
1250
  }
1231
1251
  }, []);
1232
- const handleEditComplete = (0, import_react8.useCallback)(() => {
1252
+ const handleEditComplete = (0, import_react17.useCallback)(() => {
1233
1253
  onChange(internalJsonValue);
1234
1254
  requestAnimationFrame(() => {
1235
1255
  wrapperRef.current?.blur();
1236
1256
  });
1237
1257
  setJsonReadOnly(true);
1238
1258
  }, [internalJsonValue, onChange]);
1239
- const [jsonReadOnly, setJsonReadOnly] = (0, import_react8.useState)(true);
1240
- const handleFormatJson = (0, import_react8.useCallback)(() => {
1259
+ const [jsonReadOnly, setJsonReadOnly] = (0, import_react17.useState)(true);
1260
+ const handleFormatJson = (0, import_react17.useCallback)(() => {
1241
1261
  try {
1242
1262
  const parsed = JSON.parse(internalJsonValue);
1243
1263
  const formatted = JSON.stringify(parsed, null, 4);
@@ -1247,16 +1267,16 @@ function DefaultValue(props) {
1247
1267
  console.error("Invalid JSON:", error);
1248
1268
  }
1249
1269
  }, [internalJsonValue, onChange]);
1250
- return type === "object" ? /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement(JSONHeader, null, /* @__PURE__ */ import_react8.default.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ import_react8.default.createElement(JSONHeaderRight, null, /* @__PURE__ */ import_react8.default.createElement(import_semi_ui5.Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ import_react8.default.createElement(
1251
- import_semi_ui5.IconButton,
1270
+ return type === "object" ? /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(JSONHeader, null, /* @__PURE__ */ import_react17.default.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ import_react17.default.createElement(JSONHeaderRight, null, /* @__PURE__ */ import_react17.default.createElement(import_semi_ui10.Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ import_react17.default.createElement(
1271
+ import_semi_ui10.IconButton,
1252
1272
  {
1253
- icon: /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
1273
+ icon: /* @__PURE__ */ import_react17.default.createElement(import_semi_icons3.IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
1254
1274
  size: "small",
1255
1275
  type: "tertiary",
1256
1276
  theme: "borderless",
1257
1277
  onClick: handleFormatJson
1258
1278
  }
1259
- )))), /* @__PURE__ */ import_react8.default.createElement(
1279
+ )))), /* @__PURE__ */ import_react17.default.createElement(
1260
1280
  JSONViewerWrapper,
1261
1281
  {
1262
1282
  ref: wrapperRef,
@@ -1270,8 +1290,8 @@ function DefaultValue(props) {
1270
1290
  setJsonReadOnly(false);
1271
1291
  }
1272
1292
  },
1273
- /* @__PURE__ */ import_react8.default.createElement(
1274
- import_semi_ui5.JsonViewer,
1293
+ /* @__PURE__ */ import_react17.default.createElement(
1294
+ import_semi_ui10.JsonViewer,
1275
1295
  {
1276
1296
  ref: JsonViewerRef,
1277
1297
  value: getValueType(value) === "string" ? value : "",
@@ -1288,7 +1308,7 @@ function DefaultValue(props) {
1288
1308
  onChange: handleJsonChange
1289
1309
  }
1290
1310
  )
1291
- )) : /* @__PURE__ */ import_react8.default.createElement(ConstantInputWrapper, null, /* @__PURE__ */ import_react8.default.createElement(
1311
+ )) : /* @__PURE__ */ import_react17.default.createElement(ConstantInputWrapper, null, /* @__PURE__ */ import_react17.default.createElement(
1292
1312
  ConstantInput,
1293
1313
  {
1294
1314
  value,
@@ -1300,14 +1320,14 @@ function DefaultValue(props) {
1300
1320
  }
1301
1321
 
1302
1322
  // src/components/json-schema-editor/components/blur-input.tsx
1303
- var import_react9 = __toESM(require("react"));
1323
+ var import_react18 = __toESM(require("react"));
1304
1324
  var import_input = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
1305
1325
  function BlurInput(props) {
1306
- const [value, setValue] = (0, import_react9.useState)("");
1307
- (0, import_react9.useEffect)(() => {
1326
+ const [value, setValue] = (0, import_react18.useState)("");
1327
+ (0, import_react18.useEffect)(() => {
1308
1328
  setValue(props.value);
1309
1329
  }, [props.value]);
1310
- return /* @__PURE__ */ import_react9.default.createElement(
1330
+ return /* @__PURE__ */ import_react18.default.createElement(
1311
1331
  import_input.default,
1312
1332
  {
1313
1333
  ...props,
@@ -1322,14 +1342,15 @@ function BlurInput(props) {
1322
1342
 
1323
1343
  // src/components/json-schema-editor/index.tsx
1324
1344
  function JsonSchemaEditor(props) {
1325
- const { value = { type: "object" }, config = {}, onChange: onChangeProps } = props;
1345
+ const { value = { type: "object" }, config = {}, onChange: onChangeProps, readonly } = props;
1326
1346
  const { propertyList, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(
1327
1347
  value,
1328
1348
  onChangeProps
1329
1349
  );
1330
- return /* @__PURE__ */ import_react10.default.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ import_react10.default.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ import_react10.default.createElement(
1350
+ return /* @__PURE__ */ import_react19.default.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ import_react19.default.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ import_react19.default.createElement(
1331
1351
  PropertyEdit,
1332
1352
  {
1353
+ readonly,
1333
1354
  key: _property.key,
1334
1355
  value: _property,
1335
1356
  config,
@@ -1341,12 +1362,13 @@ function JsonSchemaEditor(props) {
1341
1362
  onRemoveProperty(_property.key);
1342
1363
  }
1343
1364
  }
1344
- ))), /* @__PURE__ */ import_react10.default.createElement(
1345
- import_semi_ui6.Button,
1365
+ ))), /* @__PURE__ */ import_react19.default.createElement(
1366
+ import_semi_ui11.Button,
1346
1367
  {
1368
+ disabled: readonly,
1347
1369
  size: "small",
1348
1370
  style: { marginTop: 10, marginLeft: 16 },
1349
- icon: /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconPlus, null),
1371
+ icon: /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconPlus, null),
1350
1372
  onClick: onAddProperty
1351
1373
  },
1352
1374
  config?.addButtonText ?? "Add"
@@ -1356,6 +1378,7 @@ function PropertyEdit(props) {
1356
1378
  const {
1357
1379
  value,
1358
1380
  config,
1381
+ readonly,
1359
1382
  $level = 0,
1360
1383
  onChange: onChangeProps,
1361
1384
  onRemove,
@@ -1366,10 +1389,10 @@ function PropertyEdit(props) {
1366
1389
  $parentType = "",
1367
1390
  $showLine
1368
1391
  } = props;
1369
- const [expand, setExpand] = (0, import_react10.useState)(false);
1370
- const [collapse, setCollapse] = (0, import_react10.useState)(false);
1392
+ const [expand, setExpand] = (0, import_react19.useState)(false);
1393
+ const [collapse, setCollapse] = (0, import_react19.useState)(false);
1371
1394
  const { name, type, items, default: defaultValue, description, isPropertyRequired } = value || {};
1372
- const typeSelectorValue = (0, import_react10.useMemo)(() => ({ type, items }), [type, items]);
1395
+ const typeSelectorValue = (0, import_react19.useMemo)(() => ({ type, items }), [type, items]);
1373
1396
  const { propertyList, isDrilldownObject, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
1374
1397
  const onChange = (key, _value) => {
1375
1398
  onChangeProps?.({
@@ -1378,7 +1401,7 @@ function PropertyEdit(props) {
1378
1401
  });
1379
1402
  };
1380
1403
  const showCollapse = isDrilldownObject && propertyList.length > 0;
1381
- return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement(
1404
+ return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
1382
1405
  UIPropertyLeft,
1383
1406
  {
1384
1407
  type,
@@ -1390,8 +1413,8 @@ function PropertyEdit(props) {
1390
1413
  $parentExpand,
1391
1414
  $parentType
1392
1415
  },
1393
- showCollapse && /* @__PURE__ */ import_react10.default.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconChevronRight, { size: "small" }))
1394
- ), /* @__PURE__ */ import_react10.default.createElement(UIPropertyRight, null, /* @__PURE__ */ import_react10.default.createElement(
1416
+ showCollapse && /* @__PURE__ */ import_react19.default.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconChevronRight, { size: "small" }))
1417
+ ), /* @__PURE__ */ import_react19.default.createElement(UIPropertyRight, null, /* @__PURE__ */ import_react19.default.createElement(
1395
1418
  UIPropertyMain,
1396
1419
  {
1397
1420
  $showCollapse: showCollapse,
@@ -1399,18 +1422,20 @@ function PropertyEdit(props) {
1399
1422
  $expand: expand,
1400
1423
  type
1401
1424
  },
1402
- /* @__PURE__ */ import_react10.default.createElement(UIRow, null, /* @__PURE__ */ import_react10.default.createElement(UIName, null, /* @__PURE__ */ import_react10.default.createElement(
1425
+ /* @__PURE__ */ import_react19.default.createElement(UIRow, null, /* @__PURE__ */ import_react19.default.createElement(UIName, null, /* @__PURE__ */ import_react19.default.createElement(
1403
1426
  BlurInput,
1404
1427
  {
1428
+ disabled: readonly,
1405
1429
  placeholder: config?.placeholder ?? "Input Variable Name",
1406
1430
  size: "small",
1407
1431
  value: name,
1408
1432
  onChange: (value2) => onChange("name", value2)
1409
1433
  }
1410
- )), /* @__PURE__ */ import_react10.default.createElement(UIType, null, /* @__PURE__ */ import_react10.default.createElement(
1434
+ )), /* @__PURE__ */ import_react19.default.createElement(UIType, null, /* @__PURE__ */ import_react19.default.createElement(
1411
1435
  TypeSelector,
1412
1436
  {
1413
1437
  value: typeSelectorValue,
1438
+ readonly,
1414
1439
  onChange: (_value) => {
1415
1440
  onChangeProps?.({
1416
1441
  ...value || {},
@@ -1418,51 +1443,56 @@ function PropertyEdit(props) {
1418
1443
  });
1419
1444
  }
1420
1445
  }
1421
- )), /* @__PURE__ */ import_react10.default.createElement(UIRequired, null, /* @__PURE__ */ import_react10.default.createElement(
1422
- import_semi_ui6.Checkbox,
1446
+ )), /* @__PURE__ */ import_react19.default.createElement(UIRequired, null, /* @__PURE__ */ import_react19.default.createElement(
1447
+ import_semi_ui11.Checkbox,
1423
1448
  {
1449
+ disabled: readonly,
1424
1450
  checked: isPropertyRequired,
1425
1451
  onChange: (e) => onChange("isPropertyRequired", e.target.checked)
1426
1452
  }
1427
- )), /* @__PURE__ */ import_react10.default.createElement(UIActions, null, /* @__PURE__ */ import_react10.default.createElement(
1428
- import_semi_ui6.IconButton,
1453
+ )), /* @__PURE__ */ import_react19.default.createElement(UIActions, null, /* @__PURE__ */ import_react19.default.createElement(
1454
+ import_semi_ui11.IconButton,
1429
1455
  {
1456
+ disabled: readonly,
1430
1457
  size: "small",
1431
1458
  theme: "borderless",
1432
- icon: expand ? /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconShrink, { size: "small" }) : /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconExpand, { size: "small" }),
1459
+ icon: expand ? /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconShrink, { size: "small" }) : /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconExpand, { size: "small" }),
1433
1460
  onClick: () => {
1434
1461
  setExpand((_expand) => !_expand);
1435
1462
  }
1436
1463
  }
1437
- ), isDrilldownObject && /* @__PURE__ */ import_react10.default.createElement(
1438
- import_semi_ui6.IconButton,
1464
+ ), isDrilldownObject && /* @__PURE__ */ import_react19.default.createElement(
1465
+ import_semi_ui11.IconButton,
1439
1466
  {
1467
+ disabled: readonly,
1440
1468
  size: "small",
1441
1469
  theme: "borderless",
1442
- icon: /* @__PURE__ */ import_react10.default.createElement(IconAddChildren, null),
1470
+ icon: /* @__PURE__ */ import_react19.default.createElement(IconAddChildren, null),
1443
1471
  onClick: () => {
1444
1472
  onAddProperty();
1445
1473
  setCollapse(true);
1446
1474
  }
1447
1475
  }
1448
- ), /* @__PURE__ */ import_react10.default.createElement(
1449
- import_semi_ui6.IconButton,
1476
+ ), /* @__PURE__ */ import_react19.default.createElement(
1477
+ import_semi_ui11.IconButton,
1450
1478
  {
1479
+ disabled: readonly,
1451
1480
  size: "small",
1452
1481
  theme: "borderless",
1453
- icon: /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconMinus, { size: "small" }),
1482
+ icon: /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconMinus, { size: "small" }),
1454
1483
  onClick: onRemove
1455
1484
  }
1456
1485
  ))),
1457
- expand && /* @__PURE__ */ import_react10.default.createElement(UIExpandDetail, null, /* @__PURE__ */ import_react10.default.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ import_react10.default.createElement(
1486
+ expand && /* @__PURE__ */ import_react19.default.createElement(UIExpandDetail, null, /* @__PURE__ */ import_react19.default.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ import_react19.default.createElement(
1458
1487
  BlurInput,
1459
1488
  {
1489
+ disabled: readonly,
1460
1490
  size: "small",
1461
1491
  value: description,
1462
1492
  onChange: (value2) => onChange("description", value2),
1463
1493
  placeholder: config?.descPlaceholder ?? "Help LLM to understand the property"
1464
1494
  }
1465
- ), $level === 0 && type && type !== "array" && /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ import_react10.default.createElement(DefaultValueWrapper, null, /* @__PURE__ */ import_react10.default.createElement(
1495
+ ), $level === 0 && type && type !== "array" && /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ import_react19.default.createElement(DefaultValueWrapper, null, /* @__PURE__ */ import_react19.default.createElement(
1466
1496
  DefaultValue,
1467
1497
  {
1468
1498
  value: defaultValue,
@@ -1473,9 +1503,10 @@ function PropertyEdit(props) {
1473
1503
  onChange: (value2) => onChange("default", value2)
1474
1504
  }
1475
1505
  ))))
1476
- ), showCollapse && /* @__PURE__ */ import_react10.default.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ import_react10.default.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ import_react10.default.createElement(
1506
+ ), showCollapse && /* @__PURE__ */ import_react19.default.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ import_react19.default.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ import_react19.default.createElement(
1477
1507
  PropertyEdit,
1478
1508
  {
1509
+ readonly,
1479
1510
  key: _property.key,
1480
1511
  value: _property,
1481
1512
  config,
@@ -1497,29 +1528,35 @@ function PropertyEdit(props) {
1497
1528
  }
1498
1529
 
1499
1530
  // src/components/batch-variable-selector/index.tsx
1500
- var import_react11 = __toESM(require("react"));
1501
- var import_editor3 = require("@flowgram.ai/editor");
1531
+ var import_react20 = __toESM(require("react"));
1532
+ var import_editor5 = require("@flowgram.ai/editor");
1502
1533
  var batchVariableSchema = {
1503
1534
  type: "array",
1504
1535
  extra: { weak: true }
1505
1536
  };
1506
1537
  function BatchVariableSelector(props) {
1507
- return /* @__PURE__ */ import_react11.default.createElement(import_editor3.PrivateScopeProvider, null, /* @__PURE__ */ import_react11.default.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1538
+ return /* @__PURE__ */ import_react20.default.createElement(import_editor5.PrivateScopeProvider, null, /* @__PURE__ */ import_react20.default.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1508
1539
  }
1509
1540
 
1510
1541
  // src/components/dynamic-value-input/index.tsx
1511
- var import_react12 = __toESM(require("react"));
1512
- var import_semi_ui7 = require("@douyinfe/semi-ui");
1513
- var import_semi_icons6 = require("@douyinfe/semi-icons");
1542
+ var import_react22 = __toESM(require("react"));
1543
+ var import_json_schema5 = require("@flowgram.ai/json-schema");
1544
+ var import_semi_ui12 = require("@douyinfe/semi-ui");
1545
+ var import_semi_icons5 = require("@douyinfe/semi-icons");
1514
1546
 
1515
1547
  // src/components/dynamic-value-input/styles.tsx
1516
- var import_styled_components3 = __toESM(require("styled-components"));
1517
- var UIContainer2 = import_styled_components3.default.div`
1548
+ var import_styled_components4 = __toESM(require("styled-components"));
1549
+ var UIContainer2 = import_styled_components4.default.div`
1518
1550
  display: flex;
1519
1551
  align-items: center;
1520
- gap: 5px;
1552
+ border-radius: 4px;
1553
+ border: 1px solid var(--semi-color-border);
1554
+
1555
+ overflow: hidden;
1556
+
1557
+ background-color: var(--semi-color-fill-0);
1521
1558
  `;
1522
- var UIMain = import_styled_components3.default.div`
1559
+ var UIMain = import_styled_components4.default.div`
1523
1560
  flex-grow: 1;
1524
1561
  overflow: hidden;
1525
1562
  min-width: 0;
@@ -1528,9 +1565,62 @@ var UIMain = import_styled_components3.default.div`
1528
1565
  & .semi-input-number,
1529
1566
  & .semi-select {
1530
1567
  width: 100%;
1568
+ border: none;
1569
+ border-radius: 0;
1570
+ }
1571
+
1572
+ & .semi-input-wrapper {
1573
+ border: none;
1574
+ border-radius: 0;
1575
+ }
1576
+ `;
1577
+ var UIType2 = import_styled_components4.default.div`
1578
+ border-right: 1px solid #e5e5e5;
1579
+
1580
+ & .semi-button {
1581
+ border-radius: 0;
1582
+ }
1583
+ `;
1584
+ var UITrigger = import_styled_components4.default.div`
1585
+ border-left: 1px solid #e5e5e5;
1586
+
1587
+ & .semi-button {
1588
+ border-radius: 0;
1531
1589
  }
1532
1590
  `;
1533
- var UITrigger = import_styled_components3.default.div``;
1591
+
1592
+ // src/components/dynamic-value-input/hooks.ts
1593
+ var import_react21 = require("react");
1594
+ var import_editor6 = require("@flowgram.ai/editor");
1595
+ function useRefVariable(value) {
1596
+ const available = (0, import_editor6.useScopeAvailable)();
1597
+ const refVariable = (0, import_react21.useMemo)(() => {
1598
+ if (value?.type === "ref") {
1599
+ return available.getByKeyPath(value.content);
1600
+ }
1601
+ }, [value, available]);
1602
+ return refVariable;
1603
+ }
1604
+ function useSelectSchema(schemaFromProps, constantProps, value) {
1605
+ let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: "string" };
1606
+ if (value?.type === "constant") {
1607
+ defaultSelectSchema = value?.schema || defaultSelectSchema;
1608
+ }
1609
+ const [selectSchema, setSelectSchema] = (0, import_react21.useState)(defaultSelectSchema);
1610
+ return [selectSchema, setSelectSchema];
1611
+ }
1612
+ function useIncludeSchema(schemaFromProps) {
1613
+ const includeSchema = (0, import_react21.useMemo)(() => {
1614
+ if (!schemaFromProps) {
1615
+ return;
1616
+ }
1617
+ if (schemaFromProps?.type === "number") {
1618
+ return [schemaFromProps, { type: "integer" }];
1619
+ }
1620
+ return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
1621
+ }, [schemaFromProps]);
1622
+ return includeSchema;
1623
+ }
1534
1624
 
1535
1625
  // src/components/dynamic-value-input/index.tsx
1536
1626
  function DynamicValueInput({
@@ -1538,18 +1628,49 @@ function DynamicValueInput({
1538
1628
  onChange,
1539
1629
  readonly,
1540
1630
  style,
1541
- schema,
1631
+ schema: schemaFromProps,
1542
1632
  constantProps
1543
1633
  }) {
1544
- const includeSchema = (0, import_react12.useMemo)(() => {
1545
- if (schema?.type === "number") {
1546
- return [schema, { type: "integer" }];
1634
+ const refVariable = useRefVariable(value);
1635
+ const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
1636
+ const includeSchema = useIncludeSchema(schemaFromProps);
1637
+ const renderTypeSelector = () => {
1638
+ if (schemaFromProps) {
1639
+ return /* @__PURE__ */ import_react22.default.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1640
+ }
1641
+ if (value?.type === "ref") {
1642
+ const schema = refVariable?.type ? import_json_schema5.JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
1643
+ return /* @__PURE__ */ import_react22.default.createElement(TypeSelector, { value: schema, readonly: true });
1547
1644
  }
1548
- return schema;
1549
- }, [schema]);
1645
+ return /* @__PURE__ */ import_react22.default.createElement(
1646
+ TypeSelector,
1647
+ {
1648
+ value: selectSchema,
1649
+ onChange: (_v) => {
1650
+ setSelectSchema(_v || { type: "string" });
1651
+ let content;
1652
+ if (_v?.type === "object") {
1653
+ content = "{}";
1654
+ }
1655
+ if (_v?.type === "array") {
1656
+ content = "[]";
1657
+ }
1658
+ if (_v?.type === "boolean") {
1659
+ content = false;
1660
+ }
1661
+ onChange({
1662
+ type: "constant",
1663
+ content,
1664
+ schema: _v || { type: "string" }
1665
+ });
1666
+ },
1667
+ readonly
1668
+ }
1669
+ );
1670
+ };
1550
1671
  const renderMain = () => {
1551
1672
  if (value?.type === "ref") {
1552
- return /* @__PURE__ */ import_react12.default.createElement(
1673
+ return /* @__PURE__ */ import_react22.default.createElement(
1553
1674
  VariableSelector,
1554
1675
  {
1555
1676
  style: { width: "100%" },
@@ -1560,18 +1681,29 @@ function DynamicValueInput({
1560
1681
  }
1561
1682
  );
1562
1683
  }
1563
- return /* @__PURE__ */ import_react12.default.createElement(
1684
+ const constantSchema = schemaFromProps || selectSchema || { type: "string" };
1685
+ return /* @__PURE__ */ import_react22.default.createElement(
1564
1686
  ConstantInput,
1565
1687
  {
1566
1688
  value: value?.content,
1567
- onChange: (_v) => onChange({ type: "constant", content: _v }),
1568
- schema: schema || { type: "string" },
1689
+ onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema }),
1690
+ schema: constantSchema || { type: "string" },
1569
1691
  readonly,
1692
+ strategies: [...constantProps?.strategies || []],
1693
+ fallbackRenderer: () => /* @__PURE__ */ import_react22.default.createElement(
1694
+ VariableSelector,
1695
+ {
1696
+ style: { width: "100%" },
1697
+ onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : void 0),
1698
+ includeSchema,
1699
+ readonly
1700
+ }
1701
+ ),
1570
1702
  ...constantProps
1571
1703
  }
1572
1704
  );
1573
1705
  };
1574
- const renderTrigger = () => /* @__PURE__ */ import_react12.default.createElement(
1706
+ const renderTrigger = () => /* @__PURE__ */ import_react22.default.createElement(
1575
1707
  VariableSelector,
1576
1708
  {
1577
1709
  style: { width: "100%" },
@@ -1579,31 +1711,31 @@ function DynamicValueInput({
1579
1711
  onChange: (_v) => onChange({ type: "ref", content: _v }),
1580
1712
  includeSchema,
1581
1713
  readonly,
1582
- triggerRender: () => /* @__PURE__ */ import_react12.default.createElement(import_semi_ui7.IconButton, { disabled: readonly, size: "small", icon: /* @__PURE__ */ import_react12.default.createElement(import_semi_icons6.IconSetting, { size: "small" }) })
1714
+ triggerRender: () => /* @__PURE__ */ import_react22.default.createElement(import_semi_ui12.IconButton, { disabled: readonly, size: "small", icon: /* @__PURE__ */ import_react22.default.createElement(import_semi_icons5.IconSetting, { size: "small" }) })
1583
1715
  }
1584
1716
  );
1585
- return /* @__PURE__ */ import_react12.default.createElement(UIContainer2, { style }, /* @__PURE__ */ import_react12.default.createElement(UIMain, null, renderMain()), /* @__PURE__ */ import_react12.default.createElement(UITrigger, null, renderTrigger()));
1717
+ return /* @__PURE__ */ import_react22.default.createElement(UIContainer2, { style }, /* @__PURE__ */ import_react22.default.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ import_react22.default.createElement(UIMain, null, renderMain()), /* @__PURE__ */ import_react22.default.createElement(UITrigger, null, renderTrigger()));
1586
1718
  }
1587
1719
 
1588
1720
  // src/components/condition-row/index.tsx
1589
- var import_react15 = __toESM(require("react"));
1590
- var import_semi_ui9 = require("@douyinfe/semi-ui");
1721
+ var import_react25 = __toESM(require("react"));
1722
+ var import_semi_ui14 = require("@douyinfe/semi-ui");
1591
1723
 
1592
1724
  // src/components/condition-row/styles.tsx
1593
- var import_styled_components4 = __toESM(require("styled-components"));
1594
- var UIContainer3 = import_styled_components4.default.div`
1725
+ var import_styled_components5 = __toESM(require("styled-components"));
1726
+ var UIContainer3 = import_styled_components5.default.div`
1595
1727
  display: flex;
1596
1728
  align-items: center;
1597
1729
  gap: 4px;
1598
1730
  `;
1599
- var UIOperator = import_styled_components4.default.div``;
1600
- var UILeft = import_styled_components4.default.div`
1731
+ var UIOperator = import_styled_components5.default.div``;
1732
+ var UILeft = import_styled_components5.default.div`
1601
1733
  width: 100%;
1602
1734
  `;
1603
- var UIRight = import_styled_components4.default.div`
1735
+ var UIRight = import_styled_components5.default.div`
1604
1736
  width: 100%;
1605
1737
  `;
1606
- var UIValues = import_styled_components4.default.div`
1738
+ var UIValues = import_styled_components5.default.div`
1607
1739
  flex-grow: 1;
1608
1740
  display: flex;
1609
1741
  flex-direction: column;
@@ -1612,8 +1744,9 @@ var UIValues = import_styled_components4.default.div`
1612
1744
  `;
1613
1745
 
1614
1746
  // src/components/condition-row/hooks/useRule.ts
1615
- var import_react13 = require("react");
1616
- var import_editor4 = require("@flowgram.ai/editor");
1747
+ var import_react23 = require("react");
1748
+ var import_json_schema6 = require("@flowgram.ai/json-schema");
1749
+ var import_editor7 = require("@flowgram.ai/editor");
1617
1750
 
1618
1751
  // src/components/condition-row/constants.ts
1619
1752
  var rules = {
@@ -1624,8 +1757,8 @@ var rules = {
1624
1757
  ["not_contains" /* NOT_CONTAINS */]: "string",
1625
1758
  ["in" /* IN */]: "array",
1626
1759
  ["nin" /* NIN */]: "array",
1627
- ["is_empty" /* IS_EMPTY */]: "string",
1628
- ["is_not_empty" /* IS_NOT_EMPTY */]: "string"
1760
+ ["is_empty" /* IS_EMPTY */]: null,
1761
+ ["is_not_empty" /* IS_NOT_EMPTY */]: null
1629
1762
  },
1630
1763
  number: {
1631
1764
  ["eq" /* EQ */]: "number",
@@ -1635,9 +1768,7 @@ var rules = {
1635
1768
  ["lt" /* LT */]: "number",
1636
1769
  ["lte" /* LTE */]: "number",
1637
1770
  ["in" /* IN */]: "array",
1638
- ["nin" /* NIN */]: "array",
1639
- ["is_empty" /* IS_EMPTY */]: null,
1640
- ["is_not_empty" /* IS_NOT_EMPTY */]: null
1771
+ ["nin" /* NIN */]: "array"
1641
1772
  },
1642
1773
  integer: {
1643
1774
  ["eq" /* EQ */]: "number",
@@ -1647,9 +1778,7 @@ var rules = {
1647
1778
  ["lt" /* LT */]: "number",
1648
1779
  ["lte" /* LTE */]: "number",
1649
1780
  ["in" /* IN */]: "array",
1650
- ["nin" /* NIN */]: "array",
1651
- ["is_empty" /* IS_EMPTY */]: null,
1652
- ["is_not_empty" /* IS_NOT_EMPTY */]: null
1781
+ ["nin" /* NIN */]: "array"
1653
1782
  },
1654
1783
  boolean: {
1655
1784
  ["eq" /* EQ */]: "boolean",
@@ -1657,9 +1786,7 @@ var rules = {
1657
1786
  ["is_true" /* IS_TRUE */]: null,
1658
1787
  ["is_false" /* IS_FALSE */]: null,
1659
1788
  ["in" /* IN */]: "array",
1660
- ["nin" /* NIN */]: "array",
1661
- ["is_empty" /* IS_EMPTY */]: null,
1662
- ["is_not_empty" /* IS_NOT_EMPTY */]: null
1789
+ ["nin" /* NIN */]: "array"
1663
1790
  },
1664
1791
  object: {
1665
1792
  ["is_empty" /* IS_EMPTY */]: null,
@@ -1667,7 +1794,11 @@ var rules = {
1667
1794
  },
1668
1795
  array: {
1669
1796
  ["is_empty" /* IS_EMPTY */]: null,
1670
- ["is_not_empty" /* IS_NOT_EMPTY */]: null
1797
+ ["is_not_empty" /* IS_NOT_EMPTY */]: null,
1798
+ ["contains" /* CONTAINS */]: "array",
1799
+ ["not_contains" /* NOT_CONTAINS */]: "array",
1800
+ ["eq" /* EQ */]: "array",
1801
+ ["neq" /* NEQ */]: "array"
1671
1802
  },
1672
1803
  map: {
1673
1804
  ["is_empty" /* IS_EMPTY */]: null,
@@ -1737,107 +1868,46 @@ var opConfigs = {
1737
1868
  }
1738
1869
  };
1739
1870
 
1740
- // src/utils/format-legacy-refs/index.ts
1741
- var import_lodash3 = require("lodash");
1742
- function formatLegacyRefOnSubmit(value) {
1743
- if ((0, import_lodash3.isObject)(value)) {
1744
- if (isLegacyFlowRefValueSchema(value)) {
1745
- return formatLegacyRefToNewRef(value);
1746
- }
1747
- return Object.fromEntries(
1748
- Object.entries(value).map(([key, value2]) => [
1749
- key,
1750
- formatLegacyRefOnSubmit(value2)
1751
- ])
1752
- );
1753
- }
1754
- if (Array.isArray(value)) {
1755
- return value.map(formatLegacyRefOnSubmit);
1756
- }
1757
- return value;
1758
- }
1759
- function formatLegacyRefOnInit(value) {
1760
- if ((0, import_lodash3.isObject)(value)) {
1761
- if (isNewFlowRefValueSchema(value)) {
1762
- return formatNewRefToLegacyRef(value);
1763
- }
1764
- return Object.fromEntries(
1765
- Object.entries(value).map(([key, value2]) => [
1766
- key,
1767
- formatLegacyRefOnInit(value2)
1768
- ])
1769
- );
1770
- }
1771
- if (Array.isArray(value)) {
1772
- return value.map(formatLegacyRefOnInit);
1773
- }
1774
- return value;
1775
- }
1776
- function isLegacyFlowRefValueSchema(value) {
1777
- return (0, import_lodash3.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
1778
- }
1779
- function isNewFlowRefValueSchema(value) {
1780
- return (0, import_lodash3.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
1781
- }
1782
- function formatLegacyRefToNewRef(value) {
1783
- const keyPath = value.content.split(".");
1784
- if (keyPath[1] === "outputs") {
1785
- return {
1786
- type: "ref",
1787
- content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
1788
- };
1789
- }
1790
- return {
1791
- type: "ref",
1792
- content: keyPath
1793
- };
1794
- }
1795
- function formatNewRefToLegacyRef(value) {
1796
- return {
1797
- type: "ref",
1798
- content: value.content.join(".")
1799
- };
1800
- }
1801
-
1802
1871
  // src/components/condition-row/hooks/useRule.ts
1803
1872
  function useRule(left) {
1804
- const available = (0, import_editor4.useScopeAvailable)();
1805
- const variable = (0, import_react13.useMemo)(() => {
1873
+ const available = (0, import_editor7.useScopeAvailable)();
1874
+ const variable = (0, import_react23.useMemo)(() => {
1806
1875
  if (!left) return void 0;
1807
1876
  return available.getByKeyPath(left.content);
1808
1877
  }, [available, left]);
1809
- const rule = (0, import_react13.useMemo)(() => {
1878
+ const rule = (0, import_react23.useMemo)(() => {
1810
1879
  if (!variable) return void 0;
1811
- const schema = JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
1880
+ const schema = import_json_schema6.JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
1812
1881
  return rules[schema?.type];
1813
1882
  }, [variable?.type]);
1814
1883
  return { rule };
1815
1884
  }
1816
1885
 
1817
1886
  // src/components/condition-row/hooks/useOp.tsx
1818
- var import_react14 = __toESM(require("react"));
1819
- var import_semi_ui8 = require("@douyinfe/semi-ui");
1820
- var import_semi_icons7 = require("@douyinfe/semi-icons");
1821
- function useOp({ rule, op, onChange }) {
1822
- const options2 = (0, import_react14.useMemo)(
1887
+ var import_react24 = __toESM(require("react"));
1888
+ var import_semi_ui13 = require("@douyinfe/semi-ui");
1889
+ var import_semi_icons6 = require("@douyinfe/semi-icons");
1890
+ function useOp({ rule, op, onChange, readonly }) {
1891
+ const options = (0, import_react24.useMemo)(
1823
1892
  () => Object.keys(rule || {}).map((_op) => ({
1824
1893
  ...opConfigs[_op] || {},
1825
1894
  value: _op
1826
1895
  })),
1827
1896
  [rule]
1828
1897
  );
1829
- const opConfig = (0, import_react14.useMemo)(() => opConfigs[op], [op]);
1830
- const renderOpSelect = () => /* @__PURE__ */ import_react14.default.createElement(
1831
- import_semi_ui8.Select,
1898
+ const opConfig = (0, import_react24.useMemo)(() => opConfigs[op], [op]);
1899
+ const renderOpSelect = () => /* @__PURE__ */ import_react24.default.createElement(
1900
+ import_semi_ui13.Select,
1832
1901
  {
1833
1902
  style: { height: 22 },
1903
+ disabled: readonly,
1834
1904
  size: "small",
1835
1905
  value: op,
1836
- optionList: options2,
1906
+ optionList: options,
1837
1907
  onChange: (v) => {
1838
1908
  onChange(v);
1839
1909
  },
1840
- triggerRender: ({ value }) => /* @__PURE__ */ import_react14.default.createElement(import_semi_ui8.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react14.default.createElement(import_semi_icons7.IconChevronDownStroked, { size: "small" }))
1910
+ triggerRender: ({ value }) => /* @__PURE__ */ import_react24.default.createElement(import_semi_ui13.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react24.default.createElement(import_semi_icons6.IconChevronDownStroked, { size: "small" }))
1841
1911
  }
1842
1912
  );
1843
1913
  return { renderOpSelect, opConfig };
@@ -1850,13 +1920,14 @@ function ConditionRow({ style, value, onChange, readonly }) {
1850
1920
  const { renderOpSelect, opConfig } = useOp({
1851
1921
  rule,
1852
1922
  op: operator,
1853
- onChange: (v) => onChange({ ...value, operator: v })
1923
+ onChange: (v) => onChange({ ...value, operator: v }),
1924
+ readonly
1854
1925
  });
1855
- const targetSchema = (0, import_react15.useMemo)(() => {
1926
+ const targetSchema = (0, import_react25.useMemo)(() => {
1856
1927
  const targetType = rule?.[operator] || null;
1857
1928
  return targetType ? { type: targetType, extra: { weak: true } } : null;
1858
1929
  }, [rule, opConfig]);
1859
- return /* @__PURE__ */ import_react15.default.createElement(UIContainer3, { style }, /* @__PURE__ */ import_react15.default.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ import_react15.default.createElement(UIValues, null, /* @__PURE__ */ import_react15.default.createElement(UILeft, null, /* @__PURE__ */ import_react15.default.createElement(
1930
+ return /* @__PURE__ */ import_react25.default.createElement(UIContainer3, { style }, /* @__PURE__ */ import_react25.default.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ import_react25.default.createElement(UIValues, null, /* @__PURE__ */ import_react25.default.createElement(UILeft, null, /* @__PURE__ */ import_react25.default.createElement(
1860
1931
  VariableSelector,
1861
1932
  {
1862
1933
  readonly,
@@ -1870,7 +1941,7 @@ function ConditionRow({ style, value, onChange, readonly }) {
1870
1941
  }
1871
1942
  })
1872
1943
  }
1873
- )), /* @__PURE__ */ import_react15.default.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ import_react15.default.createElement(
1944
+ )), /* @__PURE__ */ import_react25.default.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ import_react25.default.createElement(
1874
1945
  DynamicValueInput,
1875
1946
  {
1876
1947
  readonly: readonly || !rule,
@@ -1878,8 +1949,8 @@ function ConditionRow({ style, value, onChange, readonly }) {
1878
1949
  schema: targetSchema,
1879
1950
  onChange: (v) => onChange({ ...value, right: v })
1880
1951
  }
1881
- ) : /* @__PURE__ */ import_react15.default.createElement(
1882
- import_semi_ui9.Input,
1952
+ ) : /* @__PURE__ */ import_react25.default.createElement(
1953
+ import_semi_ui14.Input,
1883
1954
  {
1884
1955
  size: "small",
1885
1956
  disabled: true,
@@ -1890,28 +1961,32 @@ function ConditionRow({ style, value, onChange, readonly }) {
1890
1961
  }
1891
1962
 
1892
1963
  // src/components/batch-outputs/index.tsx
1893
- var import_react17 = __toESM(require("react"));
1894
- var import_semi_ui10 = require("@douyinfe/semi-ui");
1895
- var import_semi_icons8 = require("@douyinfe/semi-icons");
1964
+ var import_react27 = __toESM(require("react"));
1965
+ var import_semi_ui15 = require("@douyinfe/semi-ui");
1966
+ var import_semi_icons7 = require("@douyinfe/semi-icons");
1896
1967
 
1897
- // src/components/batch-outputs/use-list.ts
1898
- var import_react16 = require("react");
1899
- var import_lodash4 = require("lodash");
1900
- var _id2 = 0;
1968
+ // src/hooks/use-object-list/index.tsx
1969
+ var import_react26 = require("react");
1970
+ var import_nanoid = require("nanoid");
1971
+ var import_lodash2 = require("lodash");
1901
1972
  function genId2() {
1902
- return _id2++;
1973
+ return (0, import_nanoid.nanoid)();
1903
1974
  }
1904
- function useList({ value, onChange }) {
1905
- const [list, setList] = (0, import_react16.useState)([]);
1906
- (0, import_react16.useEffect)(() => {
1975
+ function useObjectList({
1976
+ value,
1977
+ onChange,
1978
+ sortIndexKey
1979
+ }) {
1980
+ const [list, setList] = (0, import_react26.useState)([]);
1981
+ (0, import_react26.useEffect)(() => {
1907
1982
  setList((_prevList) => {
1908
- const newKeys = Object.keys(value || {});
1983
+ const newKeys = Object.entries(value || {}).sort((a, b) => (0, import_lodash2.get)(a[1], sortIndexKey || 0) - (0, import_lodash2.get)(b[1], sortIndexKey || 0)).map(([key]) => key);
1909
1984
  const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
1910
- const addKeys = (0, import_lodash4.difference)(newKeys, oldKeys);
1985
+ const addKeys = (0, import_lodash2.difference)(newKeys, oldKeys);
1911
1986
  return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
1912
1987
  id: item.id,
1913
1988
  key: item.key,
1914
- value: item.key ? value?.[item.key] : void 0
1989
+ value: item.key ? value?.[item.key] : item.value
1915
1990
  })).concat(
1916
1991
  addKeys.map((_key) => ({
1917
1992
  id: genId2(),
@@ -1929,17 +2004,44 @@ function useList({ value, onChange }) {
1929
2004
  }
1930
2005
  ]);
1931
2006
  };
1932
- const update = (item) => {
2007
+ const updateValue = (itemId, value2) => {
2008
+ setList((prevList) => {
2009
+ const nextList = prevList.map((_item) => {
2010
+ if (_item.id === itemId) {
2011
+ return {
2012
+ ..._item,
2013
+ value: value2
2014
+ };
2015
+ }
2016
+ return _item;
2017
+ });
2018
+ onChange(
2019
+ Object.fromEntries(
2020
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
2021
+ if ((0, import_lodash2.isObject)(_res[1]) && sortIndexKey) {
2022
+ (0, import_lodash2.set)(_res[1], sortIndexKey, idx);
2023
+ }
2024
+ return _res;
2025
+ })
2026
+ )
2027
+ );
2028
+ return nextList;
2029
+ });
2030
+ };
2031
+ const updateKey = (itemId, key) => {
1933
2032
  setList((prevList) => {
1934
2033
  const nextList = prevList.map((_item) => {
1935
- if (_item.id === item.id) {
1936
- return item;
2034
+ if (_item.id === itemId) {
2035
+ return {
2036
+ ..._item,
2037
+ key
2038
+ };
1937
2039
  }
1938
2040
  return _item;
1939
2041
  });
1940
2042
  onChange(
1941
2043
  Object.fromEntries(
1942
- nextList.filter((item2) => item2.key).map((item2) => [item2.key, item2.value])
2044
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value])
1943
2045
  )
1944
2046
  );
1945
2047
  return nextList;
@@ -1956,18 +2058,18 @@ function useList({ value, onChange }) {
1956
2058
  return nextList;
1957
2059
  });
1958
2060
  };
1959
- return { list, add, update, remove };
2061
+ return { list, add, updateKey, updateValue, remove };
1960
2062
  }
1961
2063
 
1962
2064
  // src/components/batch-outputs/styles.tsx
1963
- var import_styled_components5 = __toESM(require("styled-components"));
1964
- var UIRows = import_styled_components5.default.div`
2065
+ var import_styled_components6 = __toESM(require("styled-components"));
2066
+ var UIRows = import_styled_components6.default.div`
1965
2067
  display: flex;
1966
2068
  flex-direction: column;
1967
2069
  gap: 10px;
1968
2070
  margin-bottom: 10px;
1969
2071
  `;
1970
- var UIRow2 = import_styled_components5.default.div`
2072
+ var UIRow2 = import_styled_components6.default.div`
1971
2073
  display: flex;
1972
2074
  align-items: center;
1973
2075
  gap: 5px;
@@ -1976,68 +2078,62 @@ var UIRow2 = import_styled_components5.default.div`
1976
2078
  // src/components/batch-outputs/index.tsx
1977
2079
  function BatchOutputs(props) {
1978
2080
  const { readonly, style } = props;
1979
- const { list, add, update, remove } = useList(props);
1980
- return /* @__PURE__ */ import_react17.default.createElement("div", null, /* @__PURE__ */ import_react17.default.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ import_react17.default.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ import_react17.default.createElement(
1981
- import_semi_ui10.Input,
2081
+ const { list, add, updateKey, updateValue, remove } = useObjectList(props);
2082
+ return /* @__PURE__ */ import_react27.default.createElement("div", null, /* @__PURE__ */ import_react27.default.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ import_react27.default.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ import_react27.default.createElement(
2083
+ import_semi_ui15.Input,
1982
2084
  {
1983
2085
  style: { width: 100 },
1984
2086
  disabled: readonly,
1985
2087
  size: "small",
1986
2088
  value: item.key,
1987
- onChange: (v) => update({ ...item, key: v })
2089
+ onChange: (v) => updateKey(item.id, v)
1988
2090
  }
1989
- ), /* @__PURE__ */ import_react17.default.createElement(
2091
+ ), /* @__PURE__ */ import_react27.default.createElement(
1990
2092
  VariableSelector,
1991
2093
  {
1992
2094
  style: { flexGrow: 1 },
1993
2095
  readonly,
1994
2096
  value: item.value?.content,
1995
- onChange: (v) => update({
1996
- ...item,
1997
- value: {
1998
- type: "ref",
1999
- content: v
2000
- }
2001
- })
2097
+ onChange: (v) => updateValue(item.id, { type: "ref", content: v })
2002
2098
  }
2003
- ), /* @__PURE__ */ import_react17.default.createElement(
2004
- import_semi_ui10.Button,
2099
+ ), /* @__PURE__ */ import_react27.default.createElement(
2100
+ import_semi_ui15.Button,
2005
2101
  {
2006
2102
  disabled: readonly,
2007
- icon: /* @__PURE__ */ import_react17.default.createElement(import_semi_icons8.IconDelete, null),
2103
+ icon: /* @__PURE__ */ import_react27.default.createElement(import_semi_icons7.IconDelete, null),
2008
2104
  size: "small",
2009
2105
  onClick: () => remove(item.id)
2010
2106
  }
2011
- )))), /* @__PURE__ */ import_react17.default.createElement(import_semi_ui10.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react17.default.createElement(import_semi_icons8.IconPlus, null), size: "small", onClick: add }, "Add"));
2107
+ )))), /* @__PURE__ */ import_react27.default.createElement(import_semi_ui15.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react27.default.createElement(import_semi_icons7.IconPlus, null), size: "small", onClick: add }, "Add"));
2012
2108
  }
2013
2109
 
2014
2110
  // src/components/prompt-editor/index.tsx
2015
- var import_react24 = __toESM(require("react"));
2016
- var import_react25 = require("@coze-editor/editor/react");
2111
+ var import_react34 = __toESM(require("react"));
2112
+ var import_react35 = require("@coze-editor/editor/react");
2017
2113
  var import_preset_prompt2 = __toESM(require("@coze-editor/editor/preset-prompt"));
2018
2114
 
2019
2115
  // src/components/prompt-editor/styles.tsx
2020
- var import_styled_components6 = __toESM(require("styled-components"));
2021
- var UIContainer4 = import_styled_components6.default.div`
2116
+ var import_styled_components7 = __toESM(require("styled-components"));
2117
+ var UIContainer4 = import_styled_components7.default.div`
2022
2118
  background-color: var(--semi-color-fill-0);
2023
2119
  padding-left: 10px;
2024
2120
  padding-right: 6px;
2025
2121
 
2026
- ${({ $hasError }) => $hasError && import_styled_components6.css`
2122
+ ${({ $hasError }) => $hasError && import_styled_components7.css`
2027
2123
  border: 1px solid var(--semi-color-danger-6);
2028
2124
  `}
2029
2125
  `;
2030
2126
 
2031
2127
  // src/components/prompt-editor/extensions/markdown.tsx
2032
- var import_react18 = require("react");
2033
- var import_react19 = require("@coze-editor/editor/react");
2034
- var import_editor5 = require("@coze-editor/editor");
2035
- var import_view = require("@codemirror/view");
2128
+ var import_react28 = require("react");
2129
+ var import_react29 = require("@coze-editor/editor/react");
2130
+ var import_editor8 = require("@coze-editor/editor");
2131
+ var import_view2 = require("@codemirror/view");
2036
2132
  function MarkdownHighlight() {
2037
- const injector = (0, import_react19.useInjector)();
2038
- (0, import_react18.useLayoutEffect)(
2133
+ const injector = (0, import_react29.useInjector)();
2134
+ (0, import_react28.useLayoutEffect)(
2039
2135
  () => injector.inject([
2040
- import_editor5.astDecorator.whole.of((cursor) => {
2136
+ import_editor8.astDecorator.whole.of((cursor) => {
2041
2137
  if (cursor.name.startsWith("ATXHeading")) {
2042
2138
  return {
2043
2139
  type: "className",
@@ -2063,7 +2159,7 @@ function MarkdownHighlight() {
2063
2159
  };
2064
2160
  }
2065
2161
  }),
2066
- import_view.EditorView.theme({
2162
+ import_view2.EditorView.theme({
2067
2163
  ".heading": {
2068
2164
  color: "#00818C",
2069
2165
  fontWeight: "bold"
@@ -2086,26 +2182,26 @@ function MarkdownHighlight() {
2086
2182
  var markdown_default = MarkdownHighlight;
2087
2183
 
2088
2184
  // src/components/prompt-editor/extensions/language-support.tsx
2089
- var import_react20 = require("react");
2090
- var import_react21 = require("@coze-editor/editor/react");
2185
+ var import_react30 = require("react");
2186
+ var import_react31 = require("@coze-editor/editor/react");
2091
2187
  var import_preset_prompt = require("@coze-editor/editor/preset-prompt");
2092
2188
  function LanguageSupport() {
2093
- const injector = (0, import_react21.useInjector)();
2094
- (0, import_react20.useLayoutEffect)(() => injector.inject([import_preset_prompt.languageSupport]), [injector]);
2189
+ const injector = (0, import_react31.useInjector)();
2190
+ (0, import_react30.useLayoutEffect)(() => injector.inject([import_preset_prompt.languageSupport]), [injector]);
2095
2191
  return null;
2096
2192
  }
2097
2193
  var language_support_default = LanguageSupport;
2098
2194
 
2099
2195
  // src/components/prompt-editor/extensions/jinja.tsx
2100
- var import_react22 = require("react");
2101
- var import_react23 = require("@coze-editor/editor/react");
2102
- var import_editor6 = require("@coze-editor/editor");
2103
- var import_view2 = require("@codemirror/view");
2196
+ var import_react32 = require("react");
2197
+ var import_react33 = require("@coze-editor/editor/react");
2198
+ var import_editor9 = require("@coze-editor/editor");
2199
+ var import_view3 = require("@codemirror/view");
2104
2200
  function JinjaHighlight() {
2105
- const injector = (0, import_react23.useInjector)();
2106
- (0, import_react22.useLayoutEffect)(
2201
+ const injector = (0, import_react33.useInjector)();
2202
+ (0, import_react32.useLayoutEffect)(
2107
2203
  () => injector.inject([
2108
- import_editor6.astDecorator.whole.of((cursor) => {
2204
+ import_editor9.astDecorator.whole.of((cursor) => {
2109
2205
  if (cursor.name === "JinjaStatementStart" || cursor.name === "JinjaStatementEnd") {
2110
2206
  return {
2111
2207
  type: "className",
@@ -2125,7 +2221,7 @@ function JinjaHighlight() {
2125
2221
  };
2126
2222
  }
2127
2223
  }),
2128
- import_view2.EditorView.theme({
2224
+ import_view3.EditorView.theme({
2129
2225
  ".jinja-statement-bracket": {
2130
2226
  color: "#D1009D"
2131
2227
  },
@@ -2156,14 +2252,14 @@ function PromptEditor(props) {
2156
2252
  children,
2157
2253
  disableMarkdownHighlight
2158
2254
  } = props || {};
2159
- const editorRef = (0, import_react24.useRef)(null);
2160
- (0, import_react24.useEffect)(() => {
2255
+ const editorRef = (0, import_react34.useRef)(null);
2256
+ (0, import_react34.useEffect)(() => {
2161
2257
  if (editorRef.current?.getValue() !== value?.content) {
2162
2258
  editorRef.current?.setValue(String(value?.content || ""));
2163
2259
  }
2164
2260
  }, [value]);
2165
- return /* @__PURE__ */ import_react24.default.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ import_react24.default.createElement(import_react25.EditorProvider, null, /* @__PURE__ */ import_react24.default.createElement(
2166
- import_react25.Renderer,
2261
+ return /* @__PURE__ */ import_react34.default.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ import_react34.default.createElement(import_react35.EditorProvider, null, /* @__PURE__ */ import_react34.default.createElement(
2262
+ import_react35.Renderer,
2167
2263
  {
2168
2264
  didMount: (editor) => {
2169
2265
  editorRef.current = editor;
@@ -2179,23 +2275,23 @@ function PromptEditor(props) {
2179
2275
  onChange({ type: "template", content: e.value });
2180
2276
  }
2181
2277
  }
2182
- ), activeLinePlaceholder && /* @__PURE__ */ import_react24.default.createElement(import_react25.ActiveLinePlaceholder, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ import_react24.default.createElement(markdown_default, null), /* @__PURE__ */ import_react24.default.createElement(language_support_default, null), /* @__PURE__ */ import_react24.default.createElement(jinja_default, null), children));
2278
+ ), activeLinePlaceholder && /* @__PURE__ */ import_react34.default.createElement(import_react35.ActiveLinePlaceholder, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ import_react34.default.createElement(markdown_default, null), /* @__PURE__ */ import_react34.default.createElement(language_support_default, null), /* @__PURE__ */ import_react34.default.createElement(jinja_default, null), children));
2183
2279
  }
2184
2280
 
2185
2281
  // src/components/prompt-editor-with-variables/index.tsx
2186
- var import_react30 = __toESM(require("react"));
2282
+ var import_react40 = __toESM(require("react"));
2187
2283
 
2188
2284
  // src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
2189
- var import_react26 = __toESM(require("react"));
2190
- var import_semi_ui11 = require("@douyinfe/semi-ui");
2191
- var import_react27 = require("@coze-editor/editor/react");
2285
+ var import_react36 = __toESM(require("react"));
2286
+ var import_semi_ui16 = require("@douyinfe/semi-ui");
2287
+ var import_react37 = require("@coze-editor/editor/react");
2192
2288
  function VariableTree() {
2193
- const [posKey, setPosKey] = (0, import_react26.useState)("");
2194
- const [visible, setVisible] = (0, import_react26.useState)(false);
2195
- const [position, setPosition] = (0, import_react26.useState)(-1);
2196
- const editor = (0, import_react27.useEditor)();
2289
+ const [posKey, setPosKey] = (0, import_react36.useState)("");
2290
+ const [visible, setVisible] = (0, import_react36.useState)(false);
2291
+ const [position, setPosition] = (0, import_react36.useState)(-1);
2292
+ const editor = (0, import_react37.useEditor)();
2197
2293
  function insert(variablePath) {
2198
- const range = (0, import_react27.getCurrentMentionReplaceRange)(editor.$view.state);
2294
+ const range = (0, import_react37.getCurrentMentionReplaceRange)(editor.$view.state);
2199
2295
  if (!range) {
2200
2296
  return;
2201
2297
  }
@@ -2209,21 +2305,21 @@ function VariableTree() {
2209
2305
  setPosition(e.state.selection.main.head);
2210
2306
  setVisible(e.value);
2211
2307
  }
2212
- (0, import_react26.useEffect)(() => {
2308
+ (0, import_react36.useEffect)(() => {
2213
2309
  if (!editor) {
2214
2310
  return;
2215
2311
  }
2216
2312
  }, [editor, visible]);
2217
2313
  const treeData = useVariableTree({});
2218
- return /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(import_react27.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react26.default.createElement(
2219
- import_semi_ui11.Popover,
2314
+ return /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(import_react37.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react36.default.createElement(
2315
+ import_semi_ui16.Popover,
2220
2316
  {
2221
2317
  visible,
2222
2318
  trigger: "custom",
2223
2319
  position: "topLeft",
2224
2320
  rePosKey: posKey,
2225
- content: /* @__PURE__ */ import_react26.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react26.default.createElement(
2226
- import_semi_ui11.Tree,
2321
+ content: /* @__PURE__ */ import_react36.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react36.default.createElement(
2322
+ import_semi_ui16.Tree,
2227
2323
  {
2228
2324
  treeData,
2229
2325
  onSelect: (v) => {
@@ -2232,8 +2328,8 @@ function VariableTree() {
2232
2328
  }
2233
2329
  ))
2234
2330
  },
2235
- /* @__PURE__ */ import_react26.default.createElement(
2236
- import_react27.PositionMirror,
2331
+ /* @__PURE__ */ import_react36.default.createElement(
2332
+ import_react37.PositionMirror,
2237
2333
  {
2238
2334
  position,
2239
2335
  onChange: () => setPosKey(String(Math.random()))
@@ -2244,18 +2340,18 @@ function VariableTree() {
2244
2340
 
2245
2341
  // src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
2246
2342
  var import_react_dom = __toESM(require("react-dom"));
2247
- var import_react28 = __toESM(require("react"));
2248
- var import_lodash5 = require("lodash");
2249
- var import_editor7 = require("@flowgram.ai/editor");
2250
- var import_semi_ui13 = require("@douyinfe/semi-ui");
2251
- var import_semi_icons9 = require("@douyinfe/semi-icons");
2252
- var import_react29 = require("@coze-editor/editor/react");
2253
- var import_view3 = require("@codemirror/view");
2254
-
2255
- // src/components/prompt-editor-with-variables/styles.tsx
2256
- var import_styled_components7 = __toESM(require("styled-components"));
2257
- var import_semi_ui12 = require("@douyinfe/semi-ui");
2258
- var UIRootTitle2 = import_styled_components7.default.div`
2343
+ var import_react38 = __toESM(require("react"));
2344
+ var import_lodash3 = require("lodash");
2345
+ var import_editor10 = require("@flowgram.ai/editor");
2346
+ var import_semi_ui18 = require("@douyinfe/semi-ui");
2347
+ var import_semi_icons8 = require("@douyinfe/semi-icons");
2348
+ var import_react39 = require("@coze-editor/editor/react");
2349
+ var import_view4 = require("@codemirror/view");
2350
+
2351
+ // src/components/prompt-editor-with-variables/styles.tsx
2352
+ var import_styled_components8 = __toESM(require("styled-components"));
2353
+ var import_semi_ui17 = require("@douyinfe/semi-ui");
2354
+ var UIRootTitle2 = import_styled_components8.default.div`
2259
2355
  margin-right: 4px;
2260
2356
  min-width: 20px;
2261
2357
  overflow: hidden;
@@ -2263,12 +2359,12 @@ var UIRootTitle2 = import_styled_components7.default.div`
2263
2359
  white-space: nowrap;
2264
2360
  color: var(--semi-color-text-2);
2265
2361
  `;
2266
- var UIVarName2 = import_styled_components7.default.div`
2362
+ var UIVarName2 = import_styled_components8.default.div`
2267
2363
  overflow: hidden;
2268
2364
  text-overflow: ellipsis;
2269
2365
  white-space: nowrap;
2270
2366
  `;
2271
- var UITag2 = (0, import_styled_components7.default)(import_semi_ui12.Tag)`
2367
+ var UITag2 = (0, import_styled_components8.default)(import_semi_ui17.Tag)`
2272
2368
  display: inline-flex;
2273
2369
  align-items: center;
2274
2370
  justify-content: flex-start;
@@ -2282,7 +2378,7 @@ var UITag2 = (0, import_styled_components7.default)(import_semi_ui12.Tag)`
2282
2378
  margin: 0 5px;
2283
2379
  }
2284
2380
  `;
2285
- var UIPopoverContent = import_styled_components7.default.div`
2381
+ var UIPopoverContent2 = import_styled_components8.default.div`
2286
2382
  padding: 10px;
2287
2383
  display: inline-flex;
2288
2384
  align-items: center;
@@ -2290,13 +2386,13 @@ var UIPopoverContent = import_styled_components7.default.div`
2290
2386
  `;
2291
2387
 
2292
2388
  // src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
2293
- var VariableTagWidget = class extends import_view3.WidgetType {
2389
+ var VariableTagWidget = class extends import_view4.WidgetType {
2294
2390
  constructor({ keyPath, scope }) {
2295
2391
  super();
2296
- this.toDispose = new import_editor7.DisposableCollection();
2392
+ this.toDispose = new import_editor10.DisposableCollection();
2297
2393
  this.renderIcon = (icon) => {
2298
2394
  if (typeof icon === "string") {
2299
- return /* @__PURE__ */ import_react28.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2395
+ return /* @__PURE__ */ import_react38.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2300
2396
  }
2301
2397
  return icon;
2302
2398
  };
@@ -2309,20 +2405,21 @@ var VariableTagWidget = class extends import_view3.WidgetType {
2309
2405
  renderVariable(v) {
2310
2406
  if (!v) {
2311
2407
  this.renderReact(
2312
- /* @__PURE__ */ import_react28.default.createElement(UITag2, { prefixIcon: /* @__PURE__ */ import_react28.default.createElement(import_semi_icons9.IconIssueStroked, null), color: "amber" }, "Unknown")
2408
+ /* @__PURE__ */ import_react38.default.createElement(UITag2, { prefixIcon: /* @__PURE__ */ import_react38.default.createElement(import_semi_icons8.IconIssueStroked, null), color: "amber" }, "Unknown")
2313
2409
  );
2314
2410
  return;
2315
2411
  }
2316
- const rootField = (0, import_lodash5.last)(v.parentFields);
2317
- const rootTitle = /* @__PURE__ */ import_react28.default.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2412
+ const rootField = (0, import_lodash3.last)(v.parentFields) || v;
2413
+ const isRoot = v.parentFields.length === 0;
2414
+ const rootTitle = /* @__PURE__ */ import_react38.default.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
2318
2415
  const rootIcon = this.renderIcon(rootField?.meta.icon);
2319
2416
  this.renderReact(
2320
- /* @__PURE__ */ import_react28.default.createElement(
2321
- import_semi_ui13.Popover,
2417
+ /* @__PURE__ */ import_react38.default.createElement(
2418
+ import_semi_ui18.Popover,
2322
2419
  {
2323
- content: /* @__PURE__ */ import_react28.default.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ import_react28.default.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2420
+ content: /* @__PURE__ */ import_react38.default.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ import_react38.default.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2324
2421
  },
2325
- /* @__PURE__ */ import_react28.default.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react28.default.createElement(UIVarName2, null, v?.key))
2422
+ /* @__PURE__ */ import_react38.default.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ import_react38.default.createElement(UIVarName2, null, v?.key))
2326
2423
  )
2327
2424
  );
2328
2425
  }
@@ -2330,7 +2427,7 @@ var VariableTagWidget = class extends import_view3.WidgetType {
2330
2427
  const dom = document.createElement("span");
2331
2428
  this.rootDOM = dom;
2332
2429
  this.toDispose.push(
2333
- import_editor7.Disposable.create(() => {
2430
+ import_editor10.Disposable.create(() => {
2334
2431
  import_react_dom.default.unmountComponentAtNode(this.rootDOM);
2335
2432
  })
2336
2433
  );
@@ -2347,7 +2444,7 @@ var VariableTagWidget = class extends import_view3.WidgetType {
2347
2444
  return dom;
2348
2445
  }
2349
2446
  eq(other) {
2350
- return (0, import_lodash5.isEqual)(this.keyPath, other.keyPath);
2447
+ return (0, import_lodash3.isEqual)(this.keyPath, other.keyPath);
2351
2448
  }
2352
2449
  ignoreEvent() {
2353
2450
  return false;
@@ -2357,12 +2454,12 @@ var VariableTagWidget = class extends import_view3.WidgetType {
2357
2454
  }
2358
2455
  };
2359
2456
  function VariableTagInject() {
2360
- const injector = (0, import_react29.useInjector)();
2361
- const scope = (0, import_editor7.useCurrentScope)();
2362
- (0, import_react28.useLayoutEffect)(() => {
2363
- const atMatcher = new import_view3.MatchDecorator({
2457
+ const injector = (0, import_react39.useInjector)();
2458
+ const scope = (0, import_editor10.useCurrentScope)();
2459
+ (0, import_react38.useLayoutEffect)(() => {
2460
+ const atMatcher = new import_view4.MatchDecorator({
2364
2461
  regexp: /\{\{([^\}]+)\}\}/g,
2365
- decoration: (match) => import_view3.Decoration.replace({
2462
+ decoration: (match) => import_view4.Decoration.replace({
2366
2463
  widget: new VariableTagWidget({
2367
2464
  keyPath: match[1]?.split(".") ?? [],
2368
2465
  scope
@@ -2370,7 +2467,7 @@ function VariableTagInject() {
2370
2467
  })
2371
2468
  });
2372
2469
  return injector.inject([
2373
- import_view3.ViewPlugin.fromClass(
2470
+ import_view4.ViewPlugin.fromClass(
2374
2471
  class {
2375
2472
  constructor(view) {
2376
2473
  this.view = view;
@@ -2383,8 +2480,8 @@ function VariableTagInject() {
2383
2480
  {
2384
2481
  decorations: (p) => p.decorations,
2385
2482
  provide(p) {
2386
- return import_view3.EditorView.atomicRanges.of(
2387
- (view) => view.plugin(p)?.decorations ?? import_view3.Decoration.none
2483
+ return import_view4.EditorView.atomicRanges.of(
2484
+ (view) => view.plugin(p)?.decorations ?? import_view4.Decoration.none
2388
2485
  );
2389
2486
  }
2390
2487
  }
@@ -2396,29 +2493,29 @@ function VariableTagInject() {
2396
2493
 
2397
2494
  // src/components/prompt-editor-with-variables/index.tsx
2398
2495
  function PromptEditorWithVariables(props) {
2399
- return /* @__PURE__ */ import_react30.default.createElement(PromptEditor, { ...props }, /* @__PURE__ */ import_react30.default.createElement(VariableTree, null), /* @__PURE__ */ import_react30.default.createElement(VariableTagInject, null));
2496
+ return /* @__PURE__ */ import_react40.default.createElement(PromptEditor, { ...props }, /* @__PURE__ */ import_react40.default.createElement(VariableTree, null), /* @__PURE__ */ import_react40.default.createElement(VariableTagInject, null));
2400
2497
  }
2401
2498
 
2402
2499
  // src/components/prompt-editor-with-inputs/index.tsx
2403
- var import_react34 = __toESM(require("react"));
2500
+ var import_react44 = __toESM(require("react"));
2404
2501
 
2405
2502
  // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2406
- var import_react32 = __toESM(require("react"));
2407
- var import_semi_ui15 = require("@douyinfe/semi-ui");
2408
- var import_react33 = require("@coze-editor/editor/react");
2503
+ var import_react42 = __toESM(require("react"));
2504
+ var import_semi_ui20 = require("@douyinfe/semi-ui");
2505
+ var import_react43 = require("@coze-editor/editor/react");
2409
2506
 
2410
2507
  // src/components/prompt-editor-with-inputs/inputs-picker.tsx
2411
- var import_react31 = __toESM(require("react"));
2412
- var import_lodash6 = require("lodash");
2413
- var import_editor8 = require("@flowgram.ai/editor");
2414
- var import_semi_ui14 = require("@douyinfe/semi-ui");
2508
+ var import_react41 = __toESM(require("react"));
2509
+ var import_lodash4 = require("lodash");
2510
+ var import_editor11 = require("@flowgram.ai/editor");
2511
+ var import_semi_ui19 = require("@douyinfe/semi-ui");
2415
2512
  function InputsPicker({
2416
2513
  inputsValues,
2417
2514
  onSelect
2418
2515
  }) {
2419
- const available = (0, import_editor8.useScopeAvailable)();
2516
+ const available = (0, import_editor11.useScopeAvailable)();
2420
2517
  const getArrayDrilldown = (type, depth = 1) => {
2421
- if (import_editor8.ASTMatch.isArray(type.items)) {
2518
+ if (import_editor11.ASTMatch.isArray(type.items)) {
2422
2519
  return getArrayDrilldown(type.items, depth + 1);
2423
2520
  }
2424
2521
  return { type: type.items, depth };
@@ -2426,12 +2523,12 @@ function InputsPicker({
2426
2523
  const renderVariable = (variable, keyPath) => {
2427
2524
  let type = variable?.type;
2428
2525
  let children;
2429
- if (import_editor8.ASTMatch.isObject(type)) {
2526
+ if (import_editor11.ASTMatch.isObject(type)) {
2430
2527
  children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
2431
2528
  }
2432
- if (import_editor8.ASTMatch.isArray(type)) {
2529
+ if (import_editor11.ASTMatch.isArray(type)) {
2433
2530
  const drilldown = getArrayDrilldown(type);
2434
- if (import_editor8.ASTMatch.isObject(drilldown.type)) {
2531
+ if (import_editor11.ASTMatch.isObject(drilldown.type)) {
2435
2532
  children = (drilldown.type.properties || []).map(
2436
2533
  (_property) => renderVariable(_property, [
2437
2534
  ...keyPath,
@@ -2444,14 +2541,14 @@ function InputsPicker({
2444
2541
  const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
2445
2542
  return {
2446
2543
  key,
2447
- label: (0, import_lodash6.last)(keyPath),
2544
+ label: (0, import_lodash4.last)(keyPath),
2448
2545
  value: key,
2449
2546
  children
2450
2547
  };
2451
2548
  };
2452
- const treeData = (0, import_react31.useMemo)(
2549
+ const treeData = (0, import_react41.useMemo)(
2453
2550
  () => Object.entries(inputsValues).map(([key, value]) => {
2454
- if (value.type === "ref") {
2551
+ if (value?.type === "ref") {
2455
2552
  const variable = available.getByKeyPath(value.content || []);
2456
2553
  if (variable) {
2457
2554
  return renderVariable(variable, [key]);
@@ -2465,400 +2562,82 @@ function InputsPicker({
2465
2562
  }),
2466
2563
  []
2467
2564
  );
2468
- return /* @__PURE__ */ import_react31.default.createElement(import_semi_ui14.Tree, { treeData, onSelect: (v) => onSelect(v) });
2565
+ return /* @__PURE__ */ import_react41.default.createElement(import_semi_ui19.Tree, { treeData, onSelect: (v) => onSelect(v) });
2469
2566
  }
2470
2567
 
2471
2568
  // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2472
2569
  function InputsTree({ inputsValues }) {
2473
- const [posKey, setPosKey] = (0, import_react32.useState)("");
2474
- const [visible, setVisible] = (0, import_react32.useState)(false);
2475
- const [position, setPosition] = (0, import_react32.useState)(-1);
2476
- const editor = (0, import_react33.useEditor)();
2570
+ const [posKey, setPosKey] = (0, import_react42.useState)("");
2571
+ const [visible, setVisible] = (0, import_react42.useState)(false);
2572
+ const [position, setPosition] = (0, import_react42.useState)(-1);
2573
+ const editor = (0, import_react43.useEditor)();
2477
2574
  function insert(variablePath) {
2478
- const range = (0, import_react33.getCurrentMentionReplaceRange)(editor.$view.state);
2575
+ const range = (0, import_react43.getCurrentMentionReplaceRange)(editor.$view.state);
2479
2576
  if (!range) {
2480
2577
  return;
2481
2578
  }
2482
2579
  editor.replaceText({
2483
2580
  ...range,
2484
2581
  text: "{{" + variablePath + "}}"
2485
- });
2486
- setVisible(false);
2487
- }
2488
- function handleOpenChange(e) {
2489
- setPosition(e.state.selection.main.head);
2490
- setVisible(e.value);
2491
- }
2492
- (0, import_react32.useEffect)(() => {
2493
- if (!editor) {
2494
- return;
2495
- }
2496
- }, [editor, visible]);
2497
- return /* @__PURE__ */ import_react32.default.createElement(import_react32.default.Fragment, null, /* @__PURE__ */ import_react32.default.createElement(import_react33.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react32.default.createElement(
2498
- import_semi_ui15.Popover,
2499
- {
2500
- visible,
2501
- trigger: "custom",
2502
- position: "topLeft",
2503
- rePosKey: posKey,
2504
- content: /* @__PURE__ */ import_react32.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react32.default.createElement(
2505
- InputsPicker,
2506
- {
2507
- inputsValues,
2508
- onSelect: (v) => {
2509
- insert(v);
2510
- }
2511
- }
2512
- ))
2513
- },
2514
- /* @__PURE__ */ import_react32.default.createElement(
2515
- import_react33.PositionMirror,
2516
- {
2517
- position,
2518
- onChange: () => setPosKey(String(Math.random()))
2519
- }
2520
- )
2521
- ));
2522
- }
2523
-
2524
- // src/components/prompt-editor-with-inputs/index.tsx
2525
- function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2526
- return /* @__PURE__ */ import_react34.default.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ import_react34.default.createElement(InputsTree, { inputsValues }));
2527
- }
2528
-
2529
- // src/components/code-editor/index.tsx
2530
- var import_react35 = __toESM(require("react"));
2531
- var import_react36 = require("@coze-editor/editor/react");
2532
- var import_preset_code5 = __toESM(require("@coze-editor/editor/preset-code"));
2533
- var import_view4 = require("@codemirror/view");
2534
-
2535
- // src/components/code-editor/utils.ts
2536
- function getSuffixByLanguageId(languageId) {
2537
- if (languageId === "python") {
2538
- return ".py";
2539
- }
2540
- if (languageId === "typescript") {
2541
- return ".ts";
2542
- }
2543
- if (languageId === "shell") {
2544
- return ".sh";
2545
- }
2546
- if (languageId === "json") {
2547
- return ".json";
2548
- }
2549
- return "";
2550
- }
2551
-
2552
- // src/components/code-editor/theme/index.ts
2553
- var import_preset_code3 = require("@coze-editor/editor/preset-code");
2554
-
2555
- // src/components/code-editor/theme/light.ts
2556
- var import_preset_code = require("@coze-editor/editor/preset-code");
2557
- var colors = {
2558
- background: "#F7F7FC",
2559
- // syntax
2560
- comment: "#000A298A",
2561
- key: "#00818C",
2562
- string: "#D1009D",
2563
- number: "#C74200",
2564
- boolean: "#2B57D9",
2565
- null: "#2B57D9",
2566
- separator: "#0F1529D1"
2567
- };
2568
- var lightTheme = (0, import_preset_code.createTheme)({
2569
- variant: "light",
2570
- settings: {
2571
- background: "#fff",
2572
- foreground: "#000",
2573
- caret: "#000",
2574
- selection: "#d9d9d9",
2575
- gutterBackground: "#f0f0f0",
2576
- gutterForeground: "#666",
2577
- gutterBorderColor: "transparent",
2578
- gutterBorderWidth: 0,
2579
- lineHighlight: "#f0f0f0",
2580
- bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
2581
- tooltip: {
2582
- backgroundColor: "#f0f0f0",
2583
- color: "#000",
2584
- border: "1px solid #ccc"
2585
- },
2586
- link: {
2587
- color: "#007bff"
2588
- },
2589
- completionItemHover: {
2590
- backgroundColor: "#f0f0f0"
2591
- },
2592
- completionItemSelected: {
2593
- backgroundColor: "#e0e0e0"
2594
- },
2595
- completionItemIcon: {
2596
- color: "#333"
2597
- },
2598
- completionItemLabel: {
2599
- color: "#333"
2600
- },
2601
- completionItemInfo: {
2602
- color: "#333"
2603
- },
2604
- completionItemDetail: {
2605
- color: "#666"
2606
- }
2607
- },
2608
- styles: [
2609
- // JSON
2610
- {
2611
- tag: import_preset_code.tags.comment,
2612
- color: colors.comment
2613
- },
2614
- {
2615
- tag: [import_preset_code.tags.propertyName],
2616
- color: colors.key
2617
- },
2618
- {
2619
- tag: [import_preset_code.tags.string],
2620
- color: colors.string
2621
- },
2622
- {
2623
- tag: [import_preset_code.tags.number],
2624
- color: colors.number
2625
- },
2626
- {
2627
- tag: [import_preset_code.tags.bool],
2628
- color: colors.boolean
2629
- },
2630
- {
2631
- tag: [import_preset_code.tags.null],
2632
- color: colors.null
2633
- },
2634
- {
2635
- tag: [import_preset_code.tags.separator],
2636
- color: colors.separator
2637
- },
2638
- // markdown
2639
- {
2640
- tag: [import_preset_code.tags.heading],
2641
- color: "#3e76ef"
2642
- },
2643
- {
2644
- tag: [import_preset_code.tags.processingInstruction],
2645
- color: "#3e76ef"
2646
- },
2647
- // shell
2648
- // curl
2649
- {
2650
- tag: [import_preset_code.tags.standard(import_preset_code.tags.variableName)],
2651
- color: "#00804A"
2652
- },
2653
- // -X
2654
- {
2655
- tag: [import_preset_code.tags.attributeName],
2656
- color: "#C74200"
2657
- },
2658
- // url in string (includes quotes), e.g. "https://..."
2659
- {
2660
- tag: [import_preset_code.tags.special(import_preset_code.tags.string)],
2661
- color: "#2B57D9"
2662
- }
2663
- ]
2664
- });
2665
-
2666
- // src/components/code-editor/theme/dark.ts
2667
- var import_preset_code2 = require("@coze-editor/editor/preset-code");
2668
- var colors2 = {
2669
- background: "#151B27",
2670
- // syntax
2671
- comment: "#FFFFFF63",
2672
- key: "#39E5D7",
2673
- string: "#FF94D2",
2674
- number: "#FF9933",
2675
- boolean: "#78B0FF",
2676
- null: "#78B0FF",
2677
- separator: "#FFFFFFC9"
2678
- };
2679
- var darkTheme = (0, import_preset_code2.createTheme)({
2680
- variant: "dark",
2681
- settings: {
2682
- background: colors2.background,
2683
- foreground: "#fff",
2684
- caret: "#AEAFAD",
2685
- selection: "#d9d9d942",
2686
- gutterBackground: colors2.background,
2687
- gutterForeground: "#FFFFFF63",
2688
- gutterBorderColor: "transparent",
2689
- gutterBorderWidth: 0,
2690
- lineHighlight: "#272e3d36",
2691
- bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
2692
- tooltip: {
2693
- backgroundColor: "#363D4D",
2694
- color: "#fff",
2695
- border: "none"
2696
- },
2697
- link: {
2698
- color: "#4daafc"
2699
- },
2700
- completionItemHover: {
2701
- backgroundColor: "#FFFFFF0F"
2702
- },
2703
- completionItemSelected: {
2704
- backgroundColor: "#FFFFFF17"
2705
- },
2706
- completionItemIcon: {
2707
- color: "#FFFFFFC9"
2708
- },
2709
- completionItemLabel: {
2710
- color: "#FFFFFFC9"
2711
- },
2712
- completionItemInfo: {
2713
- color: "#FFFFFFC9"
2714
- },
2715
- completionItemDetail: {
2716
- color: "#FFFFFF63"
2717
- }
2718
- },
2719
- styles: [
2720
- // json
2721
- {
2722
- tag: import_preset_code2.tags.comment,
2723
- color: colors2.comment
2724
- },
2725
- {
2726
- tag: [import_preset_code2.tags.propertyName],
2727
- color: colors2.key
2728
- },
2729
- {
2730
- tag: [import_preset_code2.tags.string],
2731
- color: colors2.string
2732
- },
2733
- {
2734
- tag: [import_preset_code2.tags.number],
2735
- color: colors2.number
2736
- },
2737
- {
2738
- tag: [import_preset_code2.tags.bool],
2739
- color: colors2.boolean
2740
- },
2741
- {
2742
- tag: [import_preset_code2.tags.null],
2743
- color: colors2.null
2744
- },
2745
- {
2746
- tag: [import_preset_code2.tags.separator],
2747
- color: colors2.separator
2748
- },
2749
- // markdown
2750
- {
2751
- tag: [import_preset_code2.tags.heading],
2752
- color: "#6b6bff"
2753
- },
2754
- {
2755
- tag: [import_preset_code2.tags.processingInstruction],
2756
- color: "#6b6bff"
2757
- },
2758
- // shell
2759
- // curl
2760
- {
2761
- tag: [import_preset_code2.tags.standard(import_preset_code2.tags.variableName)],
2762
- color: "#3BEB84"
2763
- },
2764
- // -X
2765
- {
2766
- tag: [import_preset_code2.tags.attributeName],
2767
- color: "#FF9933"
2768
- },
2769
- // url in string (includes quotes), e.g. "https://..."
2770
- {
2771
- tag: [import_preset_code2.tags.special(import_preset_code2.tags.string)],
2772
- color: "#78B0FF"
2773
- }
2774
- ]
2775
- });
2776
-
2777
- // src/components/code-editor/theme/index.ts
2778
- import_preset_code3.themes.register("dark", darkTheme);
2779
- import_preset_code3.themes.register("light", lightTheme);
2780
-
2781
- // src/components/code-editor/language-features.ts
2782
- var import_preset_code4 = require("@coze-editor/editor/preset-code");
2783
- var import_language_typescript = require("@coze-editor/editor/language-typescript");
2784
- var import_language_shell = require("@coze-editor/editor/language-shell");
2785
- var import_language_python = require("@coze-editor/editor/language-python");
2786
- var import_language_json = require("@coze-editor/editor/language-json");
2787
- var import_editor9 = require("@coze-editor/editor");
2788
- import_preset_code4.languages.register("python", import_language_python.python);
2789
- import_preset_code4.languages.register("typescript", import_language_typescript.typescript);
2790
- import_preset_code4.languages.register("shell", import_language_shell.shell);
2791
- import_preset_code4.languages.register("json", {
2792
- // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
2793
- language: (0, import_editor9.mixLanguages)({
2794
- outerLanguage: import_language_json.json.language
2795
- }),
2796
- languageService: import_language_json.json.languageService
2797
- });
2798
-
2799
- // src/components/code-editor/index.tsx
2800
- var OriginCodeEditor = (0, import_react36.createRenderer)(import_preset_code5.default, [
2801
- import_view4.EditorView.theme({
2802
- "&.cm-focused": {
2803
- outline: "none"
2804
- }
2805
- })
2806
- ]);
2807
- function CodeEditor({
2808
- value,
2809
- onChange,
2810
- languageId = "python",
2811
- theme = "light",
2812
- children,
2813
- placeholder,
2814
- activeLinePlaceholder,
2815
- options: options2,
2816
- readonly
2817
- }) {
2818
- const editorRef = (0, import_react35.useRef)(null);
2819
- (0, import_react35.useEffect)(() => {
2820
- if (editorRef.current?.getValue() !== value) {
2821
- editorRef.current?.setValue(String(value || ""));
2582
+ });
2583
+ setVisible(false);
2584
+ }
2585
+ function handleOpenChange(e) {
2586
+ setPosition(e.state.selection.main.head);
2587
+ setVisible(e.value);
2588
+ }
2589
+ (0, import_react42.useEffect)(() => {
2590
+ if (!editor) {
2591
+ return;
2822
2592
  }
2823
- }, [value]);
2824
- return /* @__PURE__ */ import_react35.default.createElement(import_react36.EditorProvider, null, /* @__PURE__ */ import_react35.default.createElement(
2825
- OriginCodeEditor,
2593
+ }, [editor, visible]);
2594
+ return /* @__PURE__ */ import_react42.default.createElement(import_react42.default.Fragment, null, /* @__PURE__ */ import_react42.default.createElement(import_react43.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react42.default.createElement(
2595
+ import_semi_ui20.Popover,
2826
2596
  {
2827
- defaultValue: value,
2828
- options: {
2829
- uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
2830
- languageId,
2831
- theme,
2832
- placeholder,
2833
- readOnly: readonly,
2834
- editable: !readonly,
2835
- ...options2 || {}
2836
- },
2837
- didMount: (editor) => {
2838
- editorRef.current = editor;
2839
- },
2840
- onChange: (e) => onChange?.(e.value)
2597
+ visible,
2598
+ trigger: "custom",
2599
+ position: "topLeft",
2600
+ rePosKey: posKey,
2601
+ content: /* @__PURE__ */ import_react42.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react42.default.createElement(
2602
+ InputsPicker,
2603
+ {
2604
+ inputsValues,
2605
+ onSelect: (v) => {
2606
+ insert(v);
2607
+ }
2608
+ }
2609
+ ))
2841
2610
  },
2842
- activeLinePlaceholder && /* @__PURE__ */ import_react35.default.createElement(import_react36.ActiveLinePlaceholder, null, activeLinePlaceholder),
2843
- children
2611
+ /* @__PURE__ */ import_react42.default.createElement(
2612
+ import_react43.PositionMirror,
2613
+ {
2614
+ position,
2615
+ onChange: () => setPosKey(String(Math.random()))
2616
+ }
2617
+ )
2844
2618
  ));
2845
2619
  }
2846
2620
 
2621
+ // src/components/prompt-editor-with-inputs/index.tsx
2622
+ function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2623
+ return /* @__PURE__ */ import_react44.default.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ import_react44.default.createElement(InputsTree, { inputsValues }));
2624
+ }
2625
+
2847
2626
  // src/components/json-editor-with-variables/index.tsx
2848
- var import_react41 = __toESM(require("react"));
2627
+ var import_react49 = __toESM(require("react"));
2849
2628
  var import_preset_code6 = require("@coze-editor/editor/preset-code");
2850
2629
 
2851
2630
  // src/components/json-editor-with-variables/extensions/variable-tree.tsx
2852
- var import_react37 = __toESM(require("react"));
2853
- var import_semi_ui16 = require("@douyinfe/semi-ui");
2854
- var import_react38 = require("@coze-editor/editor/react");
2631
+ var import_react45 = __toESM(require("react"));
2632
+ var import_semi_ui21 = require("@douyinfe/semi-ui");
2633
+ var import_react46 = require("@coze-editor/editor/react");
2855
2634
  function VariableTree2() {
2856
- const [posKey, setPosKey] = (0, import_react37.useState)("");
2857
- const [visible, setVisible] = (0, import_react37.useState)(false);
2858
- const [position, setPosition] = (0, import_react37.useState)(-1);
2859
- const editor = (0, import_react38.useEditor)();
2635
+ const [posKey, setPosKey] = (0, import_react45.useState)("");
2636
+ const [visible, setVisible] = (0, import_react45.useState)(false);
2637
+ const [position, setPosition] = (0, import_react45.useState)(-1);
2638
+ const editor = (0, import_react46.useEditor)();
2860
2639
  function insert(variablePath) {
2861
- const range = (0, import_react38.getCurrentMentionReplaceRange)(editor.$view.state);
2640
+ const range = (0, import_react46.getCurrentMentionReplaceRange)(editor.$view.state);
2862
2641
  if (!range) {
2863
2642
  return;
2864
2643
  }
@@ -2872,21 +2651,21 @@ function VariableTree2() {
2872
2651
  setPosition(e.state.selection.main.head);
2873
2652
  setVisible(e.value);
2874
2653
  }
2875
- (0, import_react37.useEffect)(() => {
2654
+ (0, import_react45.useEffect)(() => {
2876
2655
  if (!editor) {
2877
2656
  return;
2878
2657
  }
2879
2658
  }, [editor, visible]);
2880
2659
  const treeData = useVariableTree({});
2881
- return /* @__PURE__ */ import_react37.default.createElement(import_react37.default.Fragment, null, /* @__PURE__ */ import_react37.default.createElement(import_react38.Mention, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react37.default.createElement(
2882
- import_semi_ui16.Popover,
2660
+ return /* @__PURE__ */ import_react45.default.createElement(import_react45.default.Fragment, null, /* @__PURE__ */ import_react45.default.createElement(import_react46.Mention, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react45.default.createElement(
2661
+ import_semi_ui21.Popover,
2883
2662
  {
2884
2663
  visible,
2885
2664
  trigger: "custom",
2886
2665
  position: "topLeft",
2887
2666
  rePosKey: posKey,
2888
- content: /* @__PURE__ */ import_react37.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react37.default.createElement(
2889
- import_semi_ui16.Tree,
2667
+ content: /* @__PURE__ */ import_react45.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react45.default.createElement(
2668
+ import_semi_ui21.Tree,
2890
2669
  {
2891
2670
  treeData,
2892
2671
  onSelect: (v) => {
@@ -2895,8 +2674,8 @@ function VariableTree2() {
2895
2674
  }
2896
2675
  ))
2897
2676
  },
2898
- /* @__PURE__ */ import_react37.default.createElement(
2899
- import_react38.PositionMirror,
2677
+ /* @__PURE__ */ import_react45.default.createElement(
2678
+ import_react46.PositionMirror,
2900
2679
  {
2901
2680
  position,
2902
2681
  onChange: () => setPosKey(String(Math.random()))
@@ -2906,19 +2685,19 @@ function VariableTree2() {
2906
2685
  }
2907
2686
 
2908
2687
  // src/components/json-editor-with-variables/extensions/variable-tag.tsx
2909
- var import_react39 = __toESM(require("react"));
2688
+ var import_react47 = __toESM(require("react"));
2910
2689
  var import_client = require("react-dom/client");
2911
- var import_lodash7 = require("lodash");
2912
- var import_editor10 = require("@flowgram.ai/editor");
2913
- var import_semi_ui18 = require("@douyinfe/semi-ui");
2914
- var import_semi_icons10 = require("@douyinfe/semi-icons");
2915
- var import_react40 = require("@coze-editor/editor/react");
2690
+ var import_lodash5 = require("lodash");
2691
+ var import_editor12 = require("@flowgram.ai/editor");
2692
+ var import_semi_ui23 = require("@douyinfe/semi-ui");
2693
+ var import_semi_icons9 = require("@douyinfe/semi-icons");
2694
+ var import_react48 = require("@coze-editor/editor/react");
2916
2695
  var import_view5 = require("@codemirror/view");
2917
2696
 
2918
2697
  // src/components/json-editor-with-variables/styles.tsx
2919
- var import_styled_components8 = __toESM(require("styled-components"));
2920
- var import_semi_ui17 = require("@douyinfe/semi-ui");
2921
- var UIRootTitle3 = import_styled_components8.default.div`
2698
+ var import_styled_components9 = __toESM(require("styled-components"));
2699
+ var import_semi_ui22 = require("@douyinfe/semi-ui");
2700
+ var UIRootTitle3 = import_styled_components9.default.div`
2922
2701
  margin-right: 4px;
2923
2702
  min-width: 20px;
2924
2703
  overflow: hidden;
@@ -2926,12 +2705,12 @@ var UIRootTitle3 = import_styled_components8.default.div`
2926
2705
  white-space: nowrap;
2927
2706
  color: var(--semi-color-text-2);
2928
2707
  `;
2929
- var UIVarName3 = import_styled_components8.default.div`
2708
+ var UIVarName3 = import_styled_components9.default.div`
2930
2709
  overflow: hidden;
2931
2710
  text-overflow: ellipsis;
2932
2711
  white-space: nowrap;
2933
2712
  `;
2934
- var UITag3 = (0, import_styled_components8.default)(import_semi_ui17.Tag)`
2713
+ var UITag3 = (0, import_styled_components9.default)(import_semi_ui22.Tag)`
2935
2714
  display: inline-flex;
2936
2715
  align-items: center;
2937
2716
  justify-content: flex-start;
@@ -2945,7 +2724,7 @@ var UITag3 = (0, import_styled_components8.default)(import_semi_ui17.Tag)`
2945
2724
  margin: 0 5px;
2946
2725
  }
2947
2726
  `;
2948
- var UIPopoverContent2 = import_styled_components8.default.div`
2727
+ var UIPopoverContent3 = import_styled_components9.default.div`
2949
2728
  padding: 10px;
2950
2729
  display: inline-flex;
2951
2730
  align-items: center;
@@ -2956,10 +2735,10 @@ var UIPopoverContent2 = import_styled_components8.default.div`
2956
2735
  var VariableTagWidget2 = class extends import_view5.WidgetType {
2957
2736
  constructor({ keyPath, scope }) {
2958
2737
  super();
2959
- this.toDispose = new import_editor10.DisposableCollection();
2738
+ this.toDispose = new import_editor12.DisposableCollection();
2960
2739
  this.renderIcon = (icon) => {
2961
2740
  if (typeof icon === "string") {
2962
- return /* @__PURE__ */ import_react39.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2741
+ return /* @__PURE__ */ import_react47.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2963
2742
  }
2964
2743
  return icon;
2965
2744
  };
@@ -2969,20 +2748,20 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
2969
2748
  renderVariable(v) {
2970
2749
  if (!v) {
2971
2750
  this.root.render(
2972
- /* @__PURE__ */ import_react39.default.createElement(UITag3, { prefixIcon: /* @__PURE__ */ import_react39.default.createElement(import_semi_icons10.IconIssueStroked, null), color: "amber" }, "Unknown")
2751
+ /* @__PURE__ */ import_react47.default.createElement(UITag3, { prefixIcon: /* @__PURE__ */ import_react47.default.createElement(import_semi_icons9.IconIssueStroked, null), color: "amber" }, "Unknown")
2973
2752
  );
2974
2753
  return;
2975
2754
  }
2976
- const rootField = (0, import_lodash7.last)(v.parentFields);
2977
- const rootTitle = /* @__PURE__ */ import_react39.default.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2755
+ const rootField = (0, import_lodash5.last)(v.parentFields);
2756
+ const rootTitle = /* @__PURE__ */ import_react47.default.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2978
2757
  const rootIcon = this.renderIcon(rootField?.meta.icon);
2979
2758
  this.root.render(
2980
- /* @__PURE__ */ import_react39.default.createElement(
2981
- import_semi_ui18.Popover,
2759
+ /* @__PURE__ */ import_react47.default.createElement(
2760
+ import_semi_ui23.Popover,
2982
2761
  {
2983
- content: /* @__PURE__ */ import_react39.default.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ import_react39.default.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
2762
+ content: /* @__PURE__ */ import_react47.default.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ import_react47.default.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
2984
2763
  },
2985
- /* @__PURE__ */ import_react39.default.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react39.default.createElement(UIVarName3, null, v?.key))
2764
+ /* @__PURE__ */ import_react47.default.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react47.default.createElement(UIVarName3, null, v?.key))
2986
2765
  )
2987
2766
  );
2988
2767
  }
@@ -2990,7 +2769,7 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
2990
2769
  const dom = document.createElement("span");
2991
2770
  this.root = (0, import_client.createRoot)(dom);
2992
2771
  this.toDispose.push(
2993
- import_editor10.Disposable.create(() => {
2772
+ import_editor12.Disposable.create(() => {
2994
2773
  this.root.unmount();
2995
2774
  })
2996
2775
  );
@@ -3007,7 +2786,7 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
3007
2786
  return dom;
3008
2787
  }
3009
2788
  eq(other) {
3010
- return (0, import_lodash7.isEqual)(this.keyPath, other.keyPath);
2789
+ return (0, import_lodash5.isEqual)(this.keyPath, other.keyPath);
3011
2790
  }
3012
2791
  ignoreEvent() {
3013
2792
  return false;
@@ -3017,9 +2796,9 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
3017
2796
  }
3018
2797
  };
3019
2798
  function VariableTagInject2() {
3020
- const injector = (0, import_react40.useInjector)();
3021
- const scope = (0, import_editor10.useCurrentScope)();
3022
- (0, import_react39.useLayoutEffect)(() => {
2799
+ const injector = (0, import_react48.useInjector)();
2800
+ const scope = (0, import_editor12.useCurrentScope)();
2801
+ (0, import_react47.useLayoutEffect)(() => {
3023
2802
  const atMatcher = new import_view5.MatchDecorator({
3024
2803
  regexp: /\{\{([^\}]+)\}\}/g,
3025
2804
  decoration: (match) => import_view5.Decoration.replace({
@@ -3060,70 +2839,535 @@ function findAllMatches(inputString, regex) {
3060
2839
  regex,
3061
2840
  regex.flags.includes("g") ? regex.flags : regex.flags + "g"
3062
2841
  );
3063
- let match;
3064
- const matches = [];
3065
- while ((match = globalRegex.exec(inputString)) !== null) {
3066
- if (match.index === globalRegex.lastIndex) {
3067
- globalRegex.lastIndex++;
2842
+ let match;
2843
+ const matches = [];
2844
+ while ((match = globalRegex.exec(inputString)) !== null) {
2845
+ if (match.index === globalRegex.lastIndex) {
2846
+ globalRegex.lastIndex++;
2847
+ }
2848
+ matches.push({
2849
+ match: match[0],
2850
+ range: [match.index, match.index + match[0].length]
2851
+ });
2852
+ }
2853
+ return matches;
2854
+ }
2855
+ var transformer = (0, import_preset_code6.transformerCreator)((text) => {
2856
+ const originalSource = text.toString();
2857
+ const matches = findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
2858
+ if (matches.length > 0) {
2859
+ matches.forEach(({ range }) => {
2860
+ text.replaceRange(range[0], range[1], "null");
2861
+ });
2862
+ }
2863
+ return text;
2864
+ });
2865
+ function JsonEditorWithVariables(props) {
2866
+ return /* @__PURE__ */ import_react49.default.createElement(
2867
+ CodeEditor,
2868
+ {
2869
+ languageId: "json",
2870
+ activeLinePlaceholder: "Press '@' to Select variable",
2871
+ ...props,
2872
+ options: {
2873
+ transformer,
2874
+ ...props.options || {}
2875
+ }
2876
+ },
2877
+ /* @__PURE__ */ import_react49.default.createElement(VariableTree2, null),
2878
+ /* @__PURE__ */ import_react49.default.createElement(VariableTagInject2, null)
2879
+ );
2880
+ }
2881
+
2882
+ // src/components/inputs-values/index.tsx
2883
+ var import_react51 = __toESM(require("react"));
2884
+ var import_semi_ui24 = require("@douyinfe/semi-ui");
2885
+ var import_semi_icons10 = require("@douyinfe/semi-icons");
2886
+
2887
+ // src/components/inputs-values/styles.tsx
2888
+ var import_styled_components10 = __toESM(require("styled-components"));
2889
+ var UIRows2 = import_styled_components10.default.div`
2890
+ display: flex;
2891
+ flex-direction: column;
2892
+ gap: 10px;
2893
+ margin-bottom: 10px;
2894
+ `;
2895
+ var UIRow3 = import_styled_components10.default.div`
2896
+ display: flex;
2897
+ align-items: center;
2898
+ gap: 5px;
2899
+ `;
2900
+
2901
+ // src/components/inputs-values/components/blur-input.tsx
2902
+ var import_react50 = __toESM(require("react"));
2903
+ var import_input2 = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
2904
+ function BlurInput2(props) {
2905
+ const [value, setValue] = (0, import_react50.useState)("");
2906
+ (0, import_react50.useEffect)(() => {
2907
+ setValue(props.value);
2908
+ }, [props.value]);
2909
+ return /* @__PURE__ */ import_react50.default.createElement(
2910
+ import_input2.default,
2911
+ {
2912
+ ...props,
2913
+ value,
2914
+ onChange: (value2) => {
2915
+ setValue(value2);
2916
+ },
2917
+ onBlur: (e) => props.onChange?.(value, e)
2918
+ }
2919
+ );
2920
+ }
2921
+
2922
+ // src/components/inputs-values/index.tsx
2923
+ function InputsValues({
2924
+ value,
2925
+ onChange,
2926
+ style,
2927
+ readonly,
2928
+ constantProps,
2929
+ schema,
2930
+ hasError
2931
+ }) {
2932
+ const { list, updateKey, updateValue, remove, add } = useObjectList({
2933
+ value,
2934
+ onChange,
2935
+ sortIndexKey: "extra.index"
2936
+ });
2937
+ return /* @__PURE__ */ import_react51.default.createElement("div", null, /* @__PURE__ */ import_react51.default.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ import_react51.default.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ import_react51.default.createElement(
2938
+ BlurInput2,
2939
+ {
2940
+ style: { width: 100, minWidth: 100, maxWidth: 100 },
2941
+ disabled: readonly,
2942
+ size: "small",
2943
+ value: item.key,
2944
+ onChange: (v) => updateKey(item.id, v),
2945
+ placeholder: "Input Key"
2946
+ }
2947
+ ), /* @__PURE__ */ import_react51.default.createElement(
2948
+ DynamicValueInput,
2949
+ {
2950
+ style: { flexGrow: 1 },
2951
+ readonly,
2952
+ value: item.value,
2953
+ onChange: (v) => updateValue(item.id, v),
2954
+ schema,
2955
+ hasError,
2956
+ constantProps: {
2957
+ ...constantProps,
2958
+ strategies: [...constantProps?.strategies || []]
2959
+ }
2960
+ }
2961
+ ), /* @__PURE__ */ import_react51.default.createElement(
2962
+ import_semi_ui24.IconButton,
2963
+ {
2964
+ disabled: readonly,
2965
+ theme: "borderless",
2966
+ icon: /* @__PURE__ */ import_react51.default.createElement(import_semi_icons10.IconDelete, { size: "small" }),
2967
+ size: "small",
2968
+ onClick: () => remove(item.id)
2969
+ }
2970
+ )))), /* @__PURE__ */ import_react51.default.createElement(import_semi_ui24.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react51.default.createElement(import_semi_icons10.IconPlus, null), size: "small", onClick: add }, "Add"));
2971
+ }
2972
+
2973
+ // src/components/display-schema-tree/index.tsx
2974
+ var import_react52 = __toESM(require("react"));
2975
+
2976
+ // src/components/display-schema-tree/styles.tsx
2977
+ var import_styled_components11 = __toESM(require("styled-components"));
2978
+ var TreeRow = import_styled_components11.default.div`
2979
+ display: flex;
2980
+ align-items: center;
2981
+
2982
+ .tree-icon {
2983
+ margin-right: 8px;
2984
+ width: 14px;
2985
+ height: 14px;
2986
+ }
2987
+
2988
+ height: 27px;
2989
+ white-space: nowrap;
2990
+ `;
2991
+ var HorizontalLine = import_styled_components11.default.div`
2992
+ position: relative;
2993
+
2994
+ &::before,
2995
+ &::after {
2996
+ content: '';
2997
+ position: absolute;
2998
+ background-color: var(--semi-color-text-3);
2999
+ }
3000
+
3001
+ &::after {
3002
+ top: 0px;
3003
+ right: 6px;
3004
+ width: 15px;
3005
+ height: 1px;
3006
+ }
3007
+ `;
3008
+ var TreeTitle = import_styled_components11.default.div`
3009
+ // overflow: hidden;
3010
+ // text-overflow: ellipsis;
3011
+ `;
3012
+ var TreeLevel = import_styled_components11.default.div`
3013
+ padding-left: 30px;
3014
+ position: relative;
3015
+
3016
+ /* &::before {
3017
+ content: '';
3018
+ position: absolute;
3019
+ background-color: var(--semi-color-text-3);
3020
+ top: 0px;
3021
+ bottom: 0px;
3022
+ left: -22px;
3023
+ width: 1px;
3024
+ } */
3025
+ `;
3026
+ var TreeItem = import_styled_components11.default.div`
3027
+ position: relative;
3028
+
3029
+ &::before {
3030
+ content: '';
3031
+ position: absolute;
3032
+ background-color: var(--semi-color-text-3);
3033
+ }
3034
+
3035
+ &:not(:last-child)::before {
3036
+ width: 1px;
3037
+ top: 0;
3038
+ bottom: 0;
3039
+ left: -22px;
3040
+ }
3041
+
3042
+ &:last-child::before {
3043
+ width: 1px;
3044
+ top: 0;
3045
+ height: 14px;
3046
+ left: -22px;
3047
+ }
3048
+
3049
+ ${(props) => props.depth === 0 && import_styled_components11.css`
3050
+ &::before {
3051
+ width: 0px !important;
3052
+ }
3053
+ `}
3054
+ `;
3055
+
3056
+ // src/components/display-schema-tree/index.tsx
3057
+ function DisplaySchemaTree(props) {
3058
+ return /* @__PURE__ */ import_react52.default.createElement(SchemaTree, { ...props });
3059
+ }
3060
+ function SchemaTree(props) {
3061
+ const {
3062
+ value: schema = {},
3063
+ drilldown = true,
3064
+ depth = 0,
3065
+ showIcon = true,
3066
+ parentKey = ""
3067
+ } = props || {};
3068
+ const typeManager = useTypeManager();
3069
+ const config = typeManager.getTypeBySchema(schema);
3070
+ const title = typeManager.getComplexText(schema);
3071
+ const icon = typeManager?.getDisplayIcon(schema);
3072
+ let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
3073
+ const childEntries = Object.entries(properties || {});
3074
+ return /* @__PURE__ */ import_react52.default.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ import_react52.default.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ import_react52.default.createElement(HorizontalLine, null), showIcon && icon && import_react52.default.cloneElement(icon, {
3075
+ className: "tree-icon"
3076
+ }), /* @__PURE__ */ import_react52.default.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ import_react52.default.createElement(import_react52.default.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ import_react52.default.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ import_react52.default.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
3077
+ }
3078
+
3079
+ // src/components/display-outputs/index.tsx
3080
+ var import_react54 = __toESM(require("react"));
3081
+ var import_json_schema7 = require("@flowgram.ai/json-schema");
3082
+ var import_editor13 = require("@flowgram.ai/editor");
3083
+
3084
+ // src/components/display-schema-tag/index.tsx
3085
+ var import_react53 = __toESM(require("react"));
3086
+ var import_semi_ui26 = require("@douyinfe/semi-ui");
3087
+
3088
+ // src/components/display-schema-tag/styles.ts
3089
+ var import_styled_components12 = __toESM(require("styled-components"));
3090
+ var import_semi_ui25 = require("@douyinfe/semi-ui");
3091
+ var PopoverContent = import_styled_components12.default.div`
3092
+ padding: 10px;
3093
+ `;
3094
+ var StyledTag = (0, import_styled_components12.default)(import_semi_ui25.Tag)`
3095
+ padding: 4px;
3096
+
3097
+ .tag-icon {
3098
+ width: 12px;
3099
+ height: 12px;
3100
+ }
3101
+ `;
3102
+ var TitleSpan = import_styled_components12.default.span`
3103
+ display: inline-block;
3104
+ margin-left: 4px;
3105
+ margin-top: -1px;
3106
+ overflow: hidden;
3107
+ text-overflow: ellipsis;
3108
+ `;
3109
+
3110
+ // src/components/display-schema-tag/index.tsx
3111
+ function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
3112
+ const typeManager = useTypeManager();
3113
+ const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
3114
+ return /* @__PURE__ */ import_react53.default.createElement(
3115
+ import_semi_ui26.Popover,
3116
+ {
3117
+ content: /* @__PURE__ */ import_react53.default.createElement(PopoverContent, null, /* @__PURE__ */ import_react53.default.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
3118
+ },
3119
+ /* @__PURE__ */ import_react53.default.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && import_react53.default.cloneElement(icon, {
3120
+ className: "tag-icon"
3121
+ }), title && /* @__PURE__ */ import_react53.default.createElement(TitleSpan, null, title))
3122
+ );
3123
+ }
3124
+
3125
+ // src/components/display-outputs/styles.ts
3126
+ var import_styled_components13 = __toESM(require("styled-components"));
3127
+ var DisplayOutputsWrapper = import_styled_components13.default.div`
3128
+ display: flex;
3129
+ gap: 5px;
3130
+ flex-wrap: wrap;
3131
+ `;
3132
+
3133
+ // src/components/display-outputs/index.tsx
3134
+ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3135
+ const scope = (0, import_editor13.useCurrentScope)();
3136
+ const refresh = (0, import_editor13.useRefresh)();
3137
+ (0, import_react54.useEffect)(() => {
3138
+ if (!displayFromScope) {
3139
+ return () => null;
3140
+ }
3141
+ const disposable = scope.output.onListOrAnyVarChange(() => {
3142
+ refresh();
3143
+ });
3144
+ return () => {
3145
+ disposable.dispose();
3146
+ };
3147
+ }, [displayFromScope]);
3148
+ const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
3149
+ acm = {
3150
+ ...acm,
3151
+ ...import_json_schema7.JsonSchemaUtils.astToSchema(curr.type)?.properties || {}
3152
+ };
3153
+ return acm;
3154
+ }, {}) : value?.properties || {};
3155
+ const childEntries = Object.entries(properties || {});
3156
+ return /* @__PURE__ */ import_react54.default.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ import_react54.default.createElement(
3157
+ DisplaySchemaTag,
3158
+ {
3159
+ key,
3160
+ title: key,
3161
+ value: schema,
3162
+ showIconInTree,
3163
+ warning: !schema
3164
+ }
3165
+ )));
3166
+ }
3167
+
3168
+ // src/components/display-flow-value/index.tsx
3169
+ var import_react55 = __toESM(require("react"));
3170
+ var import_json_schema8 = require("@flowgram.ai/json-schema");
3171
+ var import_editor14 = require("@flowgram.ai/editor");
3172
+ function DisplayFlowValue({ value, title, showIconInTree }) {
3173
+ const available = (0, import_editor14.useScopeAvailable)();
3174
+ const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
3175
+ const schema = (0, import_react55.useMemo)(() => {
3176
+ if (value?.type === "ref") {
3177
+ return import_json_schema8.JsonSchemaUtils.astToSchema(variable?.type);
3178
+ }
3179
+ if (value?.type === "template") {
3180
+ return { type: "string" };
3181
+ }
3182
+ if (value?.type === "constant") {
3183
+ if (value?.schema) {
3184
+ return value?.schema;
3185
+ }
3186
+ if (typeof value?.content === "string") {
3187
+ return { type: "string" };
3188
+ }
3189
+ if (typeof value?.content === "number") {
3190
+ return { type: "number" };
3191
+ }
3192
+ if (typeof value?.content === "boolean") {
3193
+ return { type: "boolean" };
3194
+ }
3195
+ }
3196
+ return { type: "unknown" };
3197
+ }, [value, variable?.hash]);
3198
+ return /* @__PURE__ */ import_react55.default.createElement(
3199
+ DisplaySchemaTag,
3200
+ {
3201
+ title,
3202
+ value: schema,
3203
+ showIconInTree,
3204
+ warning: value?.type === "ref" && !variable
3205
+ }
3206
+ );
3207
+ }
3208
+
3209
+ // src/components/display-inputs-values/index.tsx
3210
+ var import_react56 = __toESM(require("react"));
3211
+
3212
+ // src/components/display-inputs-values/styles.ts
3213
+ var import_styled_components14 = __toESM(require("styled-components"));
3214
+ var DisplayInputsWrapper = import_styled_components14.default.div`
3215
+ display: flex;
3216
+ gap: 5px;
3217
+ flex-wrap: wrap;
3218
+ `;
3219
+
3220
+ // src/components/display-inputs-values/index.tsx
3221
+ function DisplayInputsValues({ value, showIconInTree }) {
3222
+ const childEntries = Object.entries(value || {});
3223
+ return /* @__PURE__ */ import_react56.default.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => /* @__PURE__ */ import_react56.default.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree })));
3224
+ }
3225
+
3226
+ // src/components/assign-rows/index.tsx
3227
+ var import_react59 = __toESM(require("react"));
3228
+ var import_editor15 = require("@flowgram.ai/editor");
3229
+ var import_semi_ui28 = require("@douyinfe/semi-ui");
3230
+ var import_semi_icons12 = require("@douyinfe/semi-icons");
3231
+
3232
+ // src/components/assign-row/index.tsx
3233
+ var import_react58 = __toESM(require("react"));
3234
+ var import_semi_ui27 = require("@douyinfe/semi-ui");
3235
+ var import_semi_icons11 = require("@douyinfe/semi-icons");
3236
+
3237
+ // src/components/assign-row/components/blur-input.tsx
3238
+ var import_react57 = __toESM(require("react"));
3239
+ var import_input3 = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
3240
+ function BlurInput3(props) {
3241
+ const [value, setValue] = (0, import_react57.useState)("");
3242
+ (0, import_react57.useEffect)(() => {
3243
+ setValue(props.value);
3244
+ }, [props.value]);
3245
+ return /* @__PURE__ */ import_react57.default.createElement(
3246
+ import_input3.default,
3247
+ {
3248
+ ...props,
3249
+ value,
3250
+ onChange: (value2) => {
3251
+ setValue(value2);
3252
+ },
3253
+ onBlur: (e) => props.onChange?.(value, e)
3254
+ }
3255
+ );
3256
+ }
3257
+
3258
+ // src/components/assign-row/index.tsx
3259
+ function AssignRow(props) {
3260
+ const {
3261
+ value = {
3262
+ operator: "assign"
3263
+ },
3264
+ onChange,
3265
+ onDelete,
3266
+ readonly
3267
+ } = props;
3268
+ return /* @__PURE__ */ import_react58.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ import_react58.default.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ import_react58.default.createElement(
3269
+ VariableSelector,
3270
+ {
3271
+ style: { width: "100%", height: 26 },
3272
+ value: value?.left?.content,
3273
+ config: { placeholder: "Select Left" },
3274
+ onChange: (v) => onChange?.({
3275
+ ...value,
3276
+ left: { type: "ref", content: v }
3277
+ })
3068
3278
  }
3069
- matches.push({
3070
- match: match[0],
3071
- range: [match.index, match.index + match[0].length]
3072
- });
3073
- }
3074
- return matches;
3279
+ ) : /* @__PURE__ */ import_react58.default.createElement(
3280
+ BlurInput3,
3281
+ {
3282
+ style: { height: 26 },
3283
+ size: "small",
3284
+ placeholder: "Input Name",
3285
+ value: value?.left,
3286
+ onChange: (v) => onChange?.({
3287
+ ...value,
3288
+ left: v
3289
+ })
3290
+ }
3291
+ )), /* @__PURE__ */ import_react58.default.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ import_react58.default.createElement(
3292
+ DynamicValueInput,
3293
+ {
3294
+ readonly,
3295
+ value: value?.right,
3296
+ onChange: (v) => onChange?.({
3297
+ ...value,
3298
+ right: v
3299
+ })
3300
+ }
3301
+ )), onDelete && /* @__PURE__ */ import_react58.default.createElement("div", null, /* @__PURE__ */ import_react58.default.createElement(
3302
+ import_semi_ui27.IconButton,
3303
+ {
3304
+ size: "small",
3305
+ theme: "borderless",
3306
+ icon: /* @__PURE__ */ import_react58.default.createElement(import_semi_icons11.IconMinus, null),
3307
+ onClick: () => onDelete?.()
3308
+ }
3309
+ )));
3075
3310
  }
3076
- var transformer = (0, import_preset_code6.transformerCreator)((text) => {
3077
- const originalSource = text.toString();
3078
- const matches = findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
3079
- if (matches.length > 0) {
3080
- matches.forEach(({ range }) => {
3081
- text.replaceRange(range[0], range[1], "null");
3082
- });
3083
- }
3084
- return text;
3085
- });
3086
- function JsonEditorWithVariables(props) {
3087
- return /* @__PURE__ */ import_react41.default.createElement(
3088
- CodeEditor,
3311
+
3312
+ // src/components/assign-rows/index.tsx
3313
+ function AssignRows(props) {
3314
+ const { name, readonly } = props;
3315
+ return /* @__PURE__ */ import_react59.default.createElement(import_editor15.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react59.default.createElement(
3316
+ AssignRow,
3089
3317
  {
3090
- languageId: "json",
3091
- activeLinePlaceholder: "Press '@' to Select variable",
3092
- ...props,
3093
- options: {
3094
- transformer,
3095
- ...props.options || {}
3096
- }
3318
+ key: childField.key,
3319
+ readonly,
3320
+ value: childField.value,
3321
+ onChange: (value) => {
3322
+ childField.onChange(value);
3323
+ },
3324
+ onDelete: () => field.remove(index)
3325
+ }
3326
+ )), /* @__PURE__ */ import_react59.default.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ import_react59.default.createElement(
3327
+ import_semi_ui28.Button,
3328
+ {
3329
+ size: "small",
3330
+ theme: "borderless",
3331
+ icon: /* @__PURE__ */ import_react59.default.createElement(import_semi_icons12.IconPlus, null),
3332
+ onClick: () => field.append({ operator: "assign" })
3097
3333
  },
3098
- /* @__PURE__ */ import_react41.default.createElement(VariableTree2, null),
3099
- /* @__PURE__ */ import_react41.default.createElement(VariableTagInject2, null)
3100
- );
3334
+ "Assign"
3335
+ ), /* @__PURE__ */ import_react59.default.createElement(
3336
+ import_semi_ui28.Button,
3337
+ {
3338
+ size: "small",
3339
+ theme: "borderless",
3340
+ icon: /* @__PURE__ */ import_react59.default.createElement(import_semi_icons12.IconPlus, null),
3341
+ onClick: () => field.append({ operator: "declare" })
3342
+ },
3343
+ "Declaration"
3344
+ ))));
3101
3345
  }
3102
3346
 
3103
3347
  // src/effects/provide-batch-input/index.ts
3104
- var import_editor11 = require("@flowgram.ai/editor");
3105
- var provideBatchInputEffect = (0, import_editor11.createEffectFromVariableProvider)({
3348
+ var import_editor16 = require("@flowgram.ai/editor");
3349
+ var provideBatchInputEffect = (0, import_editor16.createEffectFromVariableProvider)({
3106
3350
  private: true,
3107
3351
  parse: (value, ctx) => [
3108
- import_editor11.ASTFactory.createVariableDeclaration({
3352
+ import_editor16.ASTFactory.createVariableDeclaration({
3109
3353
  key: `${ctx.node.id}_locals`,
3110
3354
  meta: {
3111
- title: (0, import_editor11.getNodeForm)(ctx.node)?.getValueIn("title"),
3355
+ title: (0, import_editor16.getNodeForm)(ctx.node)?.getValueIn("title"),
3112
3356
  icon: ctx.node.getNodeRegistry().info?.icon
3113
3357
  },
3114
- type: import_editor11.ASTFactory.createObject({
3358
+ type: import_editor16.ASTFactory.createObject({
3115
3359
  properties: [
3116
- import_editor11.ASTFactory.createProperty({
3360
+ import_editor16.ASTFactory.createProperty({
3117
3361
  key: "item",
3118
- initializer: import_editor11.ASTFactory.createEnumerateExpression({
3119
- enumerateFor: import_editor11.ASTFactory.createKeyPathExpression({
3362
+ initializer: import_editor16.ASTFactory.createEnumerateExpression({
3363
+ enumerateFor: import_editor16.ASTFactory.createKeyPathExpression({
3120
3364
  keyPath: value.content || []
3121
3365
  })
3122
3366
  })
3123
3367
  }),
3124
- import_editor11.ASTFactory.createProperty({
3368
+ import_editor16.ASTFactory.createProperty({
3125
3369
  key: "index",
3126
- type: import_editor11.ASTFactory.createNumber()
3370
+ type: import_editor16.ASTFactory.createNumber()
3127
3371
  })
3128
3372
  ]
3129
3373
  })
@@ -3131,41 +3375,15 @@ var provideBatchInputEffect = (0, import_editor11.createEffectFromVariableProvid
3131
3375
  ]
3132
3376
  });
3133
3377
 
3134
- // src/effects/provide-batch-outputs/index.ts
3135
- var import_editor12 = require("@flowgram.ai/editor");
3136
- var provideBatchOutputsEffect = (0, import_editor12.createEffectFromVariableProvider)({
3137
- parse: (value, ctx) => [
3138
- import_editor12.ASTFactory.createVariableDeclaration({
3139
- key: `${ctx.node.id}`,
3140
- meta: {
3141
- title: (0, import_editor12.getNodeForm)(ctx.node)?.getValueIn("title"),
3142
- icon: ctx.node.getNodeRegistry().info?.icon
3143
- },
3144
- type: import_editor12.ASTFactory.createObject({
3145
- properties: Object.entries(value).map(
3146
- ([_key, value2]) => import_editor12.ASTFactory.createProperty({
3147
- key: _key,
3148
- initializer: import_editor12.ASTFactory.createWrapArrayExpression({
3149
- wrapFor: import_editor12.ASTFactory.createKeyPathExpression({
3150
- keyPath: value2.content || []
3151
- })
3152
- })
3153
- })
3154
- )
3155
- })
3156
- })
3157
- ]
3158
- });
3159
-
3160
3378
  // src/effects/auto-rename-ref/index.ts
3161
- var import_lodash8 = require("lodash");
3162
- var import_editor13 = require("@flowgram.ai/editor");
3379
+ var import_lodash6 = require("lodash");
3380
+ var import_editor17 = require("@flowgram.ai/editor");
3163
3381
  var autoRenameRefEffect = [
3164
3382
  {
3165
- event: import_editor13.DataEvent.onValueInit,
3383
+ event: import_editor17.DataEvent.onValueInit,
3166
3384
  effect: (params) => {
3167
3385
  const { context, form, name } = params;
3168
- const renameService = context.node.getService(import_editor13.VariableFieldKeyRenameService);
3386
+ const renameService = context.node.getService(import_editor17.VariableFieldKeyRenameService);
3169
3387
  const disposable = renameService.onRename(({ before, after }) => {
3170
3388
  const beforeKeyPath = [
3171
3389
  ...before.parentFields.map((_field) => _field.key).reverse(),
@@ -3214,7 +3432,7 @@ function isKeyPathMatch(keyPath = [], targetKeyPath) {
3214
3432
  }
3215
3433
  function getTemplateKeyPaths(value) {
3216
3434
  const keyPathReg = /{{(.*?)}}/g;
3217
- return (0, import_lodash8.uniq)(value.content?.match(keyPathReg) || []).map(
3435
+ return (0, import_lodash6.uniq)(value.content?.match(keyPathReg) || []).map(
3218
3436
  (_keyPath) => _keyPath.slice(2, -2).split(".")
3219
3437
  );
3220
3438
  }
@@ -3225,7 +3443,7 @@ function isTemplate(value) {
3225
3443
  return value?.type === "template" && typeof value?.content === "string";
3226
3444
  }
3227
3445
  function traverseRef(name, value, cb) {
3228
- if ((0, import_lodash8.isObject)(value)) {
3446
+ if ((0, import_lodash6.isObject)(value)) {
3229
3447
  if (isRef(value)) {
3230
3448
  cb(name, value);
3231
3449
  return;
@@ -3239,7 +3457,7 @@ function traverseRef(name, value, cb) {
3239
3457
  });
3240
3458
  return;
3241
3459
  }
3242
- if ((0, import_lodash8.isArray)(value)) {
3460
+ if ((0, import_lodash6.isArray)(value)) {
3243
3461
  value.forEach((_value, idx) => {
3244
3462
  traverseRef(`${name}[${idx}]`, _value, cb);
3245
3463
  });
@@ -3249,29 +3467,31 @@ function traverseRef(name, value, cb) {
3249
3467
  }
3250
3468
 
3251
3469
  // src/effects/provide-json-schema-outputs/index.ts
3252
- var import_editor14 = require("@flowgram.ai/editor");
3253
- var provideJsonSchemaOutputs = (0, import_editor14.createEffectFromVariableProvider)({
3470
+ var import_json_schema9 = require("@flowgram.ai/json-schema");
3471
+ var import_editor18 = require("@flowgram.ai/editor");
3472
+ var provideJsonSchemaOutputs = (0, import_editor18.createEffectFromVariableProvider)({
3254
3473
  parse: (value, ctx) => [
3255
- import_editor14.ASTFactory.createVariableDeclaration({
3474
+ import_editor18.ASTFactory.createVariableDeclaration({
3256
3475
  key: `${ctx.node.id}`,
3257
3476
  meta: {
3258
- title: (0, import_editor14.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
3477
+ title: (0, import_editor18.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
3259
3478
  icon: ctx.node.getNodeRegistry().info?.icon
3260
3479
  },
3261
- type: JsonSchemaUtils.schemaToAST(value)
3480
+ type: import_json_schema9.JsonSchemaUtils.schemaToAST(value)
3262
3481
  })
3263
3482
  ]
3264
3483
  });
3265
3484
 
3266
3485
  // src/effects/sync-variable-title/index.ts
3267
- var import_editor15 = require("@flowgram.ai/editor");
3486
+ var import_editor19 = require("@flowgram.ai/editor");
3268
3487
  var syncVariableTitle = [
3269
3488
  {
3270
- event: import_editor15.DataEvent.onValueChange,
3489
+ event: import_editor19.DataEvent.onValueChange,
3271
3490
  effect: ({ value, context }) => {
3272
- context.node.getData(import_editor15.FlowNodeVariableData).allScopes.forEach((_scope) => {
3491
+ context.node.getData(import_editor19.FlowNodeVariableData).allScopes.forEach((_scope) => {
3273
3492
  _scope.output.variables.forEach((_var) => {
3274
3493
  _var.updateMeta({
3494
+ ..._var.meta || {},
3275
3495
  title: value || context.node.id,
3276
3496
  icon: context.node.getNodeRegistry().info?.icon
3277
3497
  });
@@ -3281,22 +3501,154 @@ var syncVariableTitle = [
3281
3501
  }
3282
3502
  ];
3283
3503
 
3504
+ // src/effects/validate-when-variable-sync/index.ts
3505
+ var import_lodash7 = require("lodash");
3506
+ var import_editor20 = require("@flowgram.ai/editor");
3507
+ var validateWhenVariableSync = ({
3508
+ scope
3509
+ } = {}) => [
3510
+ {
3511
+ event: import_editor20.DataEvent.onValueInit,
3512
+ effect: ({ context, form }) => {
3513
+ const nodeScope = scope === "private" ? (0, import_editor20.getNodePrivateScope)(context.node) : (0, import_editor20.getNodeScope)(context.node);
3514
+ const disposable = nodeScope.available.onListOrAnyVarChange(() => {
3515
+ if (!(0, import_lodash7.isEmpty)(form.state.errors)) {
3516
+ form.validate();
3517
+ }
3518
+ });
3519
+ return () => disposable.dispose();
3520
+ }
3521
+ }
3522
+ ];
3523
+
3524
+ // src/effects/listen-ref-value-change/index.ts
3525
+ var import_editor21 = require("@flowgram.ai/editor");
3526
+ var listenRefValueChange = (cb) => [
3527
+ {
3528
+ event: import_editor21.DataEvent.onValueInitOrChange,
3529
+ effect: (params) => {
3530
+ const { context, value } = params;
3531
+ if (value?.type !== "ref") {
3532
+ return () => null;
3533
+ }
3534
+ const disposable = (0, import_editor21.getNodeScope)(context.node).available.trackByKeyPath(
3535
+ value?.content || [],
3536
+ (v) => {
3537
+ cb({ ...params, variable: v });
3538
+ }
3539
+ );
3540
+ return () => {
3541
+ disposable.dispose();
3542
+ };
3543
+ }
3544
+ }
3545
+ ];
3546
+
3547
+ // src/effects/listen-ref-schema-change/index.ts
3548
+ var import_json_schema10 = require("@flowgram.ai/json-schema");
3549
+ var import_editor22 = require("@flowgram.ai/editor");
3550
+ var listenRefSchemaChange = (cb) => [
3551
+ {
3552
+ event: import_editor22.DataEvent.onValueInitOrChange,
3553
+ effect: (params) => {
3554
+ const { context, value } = params;
3555
+ if (value?.type !== "ref") {
3556
+ return () => null;
3557
+ }
3558
+ const disposable = (0, import_editor22.getNodeScope)(context.node).available.trackByKeyPath(
3559
+ value?.content || [],
3560
+ (_type) => {
3561
+ cb({ ...params, schema: import_json_schema10.JsonSchemaUtils.astToSchema(_type) });
3562
+ },
3563
+ {
3564
+ selector: (_v) => _v?.type
3565
+ }
3566
+ );
3567
+ return () => {
3568
+ disposable.dispose();
3569
+ };
3570
+ }
3571
+ }
3572
+ ];
3573
+
3574
+ // src/shared/format-legacy-refs/index.ts
3575
+ var import_lodash8 = require("lodash");
3576
+ function formatLegacyRefOnSubmit(value) {
3577
+ if ((0, import_lodash8.isObject)(value)) {
3578
+ if (isLegacyFlowRefValueSchema(value)) {
3579
+ return formatLegacyRefToNewRef(value);
3580
+ }
3581
+ return Object.fromEntries(
3582
+ Object.entries(value).map(([key, value2]) => [
3583
+ key,
3584
+ formatLegacyRefOnSubmit(value2)
3585
+ ])
3586
+ );
3587
+ }
3588
+ if (Array.isArray(value)) {
3589
+ return value.map(formatLegacyRefOnSubmit);
3590
+ }
3591
+ return value;
3592
+ }
3593
+ function formatLegacyRefOnInit(value) {
3594
+ if ((0, import_lodash8.isObject)(value)) {
3595
+ if (isNewFlowRefValueSchema(value)) {
3596
+ return formatNewRefToLegacyRef(value);
3597
+ }
3598
+ return Object.fromEntries(
3599
+ Object.entries(value).map(([key, value2]) => [
3600
+ key,
3601
+ formatLegacyRefOnInit(value2)
3602
+ ])
3603
+ );
3604
+ }
3605
+ if (Array.isArray(value)) {
3606
+ return value.map(formatLegacyRefOnInit);
3607
+ }
3608
+ return value;
3609
+ }
3610
+ function isLegacyFlowRefValueSchema(value) {
3611
+ return (0, import_lodash8.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
3612
+ }
3613
+ function isNewFlowRefValueSchema(value) {
3614
+ return (0, import_lodash8.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
3615
+ }
3616
+ function formatLegacyRefToNewRef(value) {
3617
+ const keyPath = value.content.split(".");
3618
+ if (keyPath[1] === "outputs") {
3619
+ return {
3620
+ type: "ref",
3621
+ content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
3622
+ };
3623
+ }
3624
+ return {
3625
+ type: "ref",
3626
+ content: keyPath
3627
+ };
3628
+ }
3629
+ function formatNewRefToLegacyRef(value) {
3630
+ return {
3631
+ type: "ref",
3632
+ content: value.content.join(".")
3633
+ };
3634
+ }
3635
+
3284
3636
  // src/form-plugins/batch-outputs-plugin/index.ts
3285
- var import_editor16 = require("@flowgram.ai/editor");
3286
- var provideBatchOutputsEffect2 = (0, import_editor16.createEffectFromVariableProvider)({
3637
+ var import_editor23 = require("@flowgram.ai/editor");
3638
+ var provideBatchOutputsEffect = (0, import_editor23.createEffectFromVariableProvider)({
3287
3639
  parse: (value, ctx) => [
3288
- import_editor16.ASTFactory.createVariableDeclaration({
3640
+ import_editor23.ASTFactory.createVariableDeclaration({
3289
3641
  key: `${ctx.node.id}`,
3290
3642
  meta: {
3291
- title: (0, import_editor16.getNodeForm)(ctx.node)?.getValueIn("title"),
3643
+ title: (0, import_editor23.getNodeForm)(ctx.node)?.getValueIn("title"),
3292
3644
  icon: ctx.node.getNodeRegistry().info?.icon
3293
3645
  },
3294
- type: import_editor16.ASTFactory.createObject({
3646
+ type: import_editor23.ASTFactory.createObject({
3295
3647
  properties: Object.entries(value).map(
3296
- ([_key, value2]) => import_editor16.ASTFactory.createProperty({
3648
+ ([_key, value2]) => import_editor23.ASTFactory.createProperty({
3297
3649
  key: _key,
3298
- initializer: import_editor16.ASTFactory.createWrapArrayExpression({
3299
- wrapFor: import_editor16.ASTFactory.createKeyPathExpression({
3650
+ initializer: import_editor23.ASTFactory.createWrapArrayExpression({
3651
+ wrapFor: import_editor23.ASTFactory.createKeyPathExpression({
3300
3652
  keyPath: value2?.content || []
3301
3653
  })
3302
3654
  })
@@ -3306,15 +3658,15 @@ var provideBatchOutputsEffect2 = (0, import_editor16.createEffectFromVariablePro
3306
3658
  })
3307
3659
  ]
3308
3660
  });
3309
- var createBatchOutputsFormPlugin = (0, import_editor16.defineFormPluginCreator)({
3661
+ var createBatchOutputsFormPlugin = (0, import_editor23.defineFormPluginCreator)({
3310
3662
  name: "batch-outputs-plugin",
3311
3663
  onSetupFormMeta({ mergeEffect }, { outputKey }) {
3312
3664
  mergeEffect({
3313
- [outputKey]: provideBatchOutputsEffect2
3665
+ [outputKey]: provideBatchOutputsEffect
3314
3666
  });
3315
3667
  },
3316
3668
  onInit(ctx, { outputKey }) {
3317
- const chainTransformService = ctx.node.getService(import_editor16.ScopeChainTransformService);
3669
+ const chainTransformService = ctx.node.getService(import_editor23.ScopeChainTransformService);
3318
3670
  const batchNodeType = ctx.node.flowNodeType;
3319
3671
  const transformerId = `${batchNodeType}-outputs`;
3320
3672
  if (chainTransformService.hasTransformer(transformerId)) {
@@ -3324,21 +3676,21 @@ var createBatchOutputsFormPlugin = (0, import_editor16.defineFormPluginCreator)(
3324
3676
  transformCovers: (covers, ctx2) => {
3325
3677
  const node = ctx2.scope.meta?.node;
3326
3678
  if (node?.parent?.flowNodeType === batchNodeType) {
3327
- return [...covers, (0, import_editor16.getNodeScope)(node.parent)];
3679
+ return [...covers, (0, import_editor23.getNodeScope)(node.parent)];
3328
3680
  }
3329
3681
  return covers;
3330
3682
  },
3331
3683
  transformDeps(scopes, ctx2) {
3332
3684
  const scopeMeta = ctx2.scope.meta;
3333
- if (scopeMeta?.type === import_editor16.FlowNodeScopeType.private) {
3685
+ if (scopeMeta?.type === import_editor23.FlowNodeScopeType.private) {
3334
3686
  return scopes;
3335
3687
  }
3336
3688
  const node = scopeMeta?.node;
3337
3689
  if (node?.flowNodeType === batchNodeType) {
3338
3690
  const childBlocks = node.blocks;
3339
3691
  return [
3340
- (0, import_editor16.getNodePrivateScope)(node),
3341
- ...childBlocks.map((_childBlock) => (0, import_editor16.getNodeScope)(_childBlock))
3692
+ (0, import_editor23.getNodePrivateScope)(node),
3693
+ ...childBlocks.map((_childBlock) => (0, import_editor23.getNodeScope)(_childBlock))
3342
3694
  ];
3343
3695
  }
3344
3696
  return scopes;
@@ -3346,39 +3698,226 @@ var createBatchOutputsFormPlugin = (0, import_editor16.defineFormPluginCreator)(
3346
3698
  });
3347
3699
  }
3348
3700
  });
3701
+
3702
+ // src/form-plugins/infer-inputs-plugin/index.ts
3703
+ var import_lodash9 = require("lodash");
3704
+ var import_json_schema11 = require("@flowgram.ai/json-schema");
3705
+ var import_editor24 = require("@flowgram.ai/editor");
3706
+ var createInferInputsPlugin = (0, import_editor24.defineFormPluginCreator)({
3707
+ onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
3708
+ if (!sourceKey || !targetKey) {
3709
+ return;
3710
+ }
3711
+ addFormatOnSubmit((formData, ctx) => {
3712
+ (0, import_lodash9.set)(
3713
+ formData,
3714
+ targetKey,
3715
+ infer(
3716
+ (0, import_lodash9.get)(formData, sourceKey),
3717
+ scope === "private" ? (0, import_editor24.getNodePrivateScope)(ctx.node) : (0, import_editor24.getNodeScope)(ctx.node)
3718
+ )
3719
+ );
3720
+ return formData;
3721
+ });
3722
+ }
3723
+ });
3724
+ function isRef2(value) {
3725
+ return value?.type === "ref" && Array.isArray(value?.content) && typeof value?.content[0] === "string";
3726
+ }
3727
+ function isTemplate2(value) {
3728
+ return value?.type === "template" && typeof value?.content === "string";
3729
+ }
3730
+ function isConstant(value) {
3731
+ return value?.type === "constant" && typeof value?.content !== "undefined";
3732
+ }
3733
+ var infer = (values, scope) => {
3734
+ if (typeof values === "object") {
3735
+ if (isConstant(values)) {
3736
+ if (values?.schema) {
3737
+ return values.schema;
3738
+ }
3739
+ if (typeof values.content === "string") {
3740
+ return {
3741
+ type: "string"
3742
+ };
3743
+ }
3744
+ if (typeof values.content === "number") {
3745
+ return {
3746
+ type: "number"
3747
+ };
3748
+ }
3749
+ if (typeof values.content === "boolean") {
3750
+ return {
3751
+ type: "boolean"
3752
+ };
3753
+ }
3754
+ }
3755
+ if (isRef2(values)) {
3756
+ const variable = scope.available.getByKeyPath(values?.content);
3757
+ const schema = variable?.type ? import_json_schema11.JsonSchemaUtils.astToSchema(variable?.type) : void 0;
3758
+ return schema;
3759
+ }
3760
+ if (isTemplate2(values)) {
3761
+ return {
3762
+ type: "string"
3763
+ };
3764
+ }
3765
+ return {
3766
+ type: "object",
3767
+ properties: Object.keys(values).reduce((acc, key) => {
3768
+ const schema = infer(values[key], scope);
3769
+ if (schema) {
3770
+ acc[key] = schema;
3771
+ }
3772
+ return acc;
3773
+ }, {})
3774
+ };
3775
+ }
3776
+ };
3777
+
3778
+ // src/form-plugins/infer-assign-plugin/index.ts
3779
+ var import_lodash10 = require("lodash");
3780
+ var import_json_schema12 = require("@flowgram.ai/json-schema");
3781
+ var import_editor25 = require("@flowgram.ai/editor");
3782
+ var createInferAssignPlugin = (0, import_editor25.defineFormPluginCreator)({
3783
+ onSetupFormMeta({ addFormatOnSubmit, mergeEffect }, { assignKey, outputKey }) {
3784
+ if (!assignKey || !outputKey) {
3785
+ return;
3786
+ }
3787
+ mergeEffect({
3788
+ [assignKey]: (0, import_editor25.createEffectFromVariableProvider)({
3789
+ parse: (value, ctx) => {
3790
+ const declareRows = (0, import_lodash10.uniqBy)(
3791
+ value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
3792
+ "left"
3793
+ );
3794
+ return [
3795
+ import_editor25.ASTFactory.createVariableDeclaration({
3796
+ key: `${ctx.node.id}`,
3797
+ meta: {
3798
+ title: (0, import_editor25.getNodeForm)(ctx.node)?.getValueIn("title"),
3799
+ icon: ctx.node.getNodeRegistry().info?.icon
3800
+ },
3801
+ type: import_editor25.ASTFactory.createObject({
3802
+ properties: declareRows.map(
3803
+ (_v) => import_editor25.ASTFactory.createProperty({
3804
+ key: _v.left,
3805
+ type: _v.right?.type === "constant" ? import_json_schema12.JsonSchemaUtils.schemaToAST(_v.right?.schema || {}) : void 0,
3806
+ initializer: _v.right?.type === "ref" ? import_editor25.ASTFactory.createKeyPathExpression({
3807
+ keyPath: _v.right?.content || []
3808
+ }) : {}
3809
+ })
3810
+ )
3811
+ })
3812
+ })
3813
+ ];
3814
+ }
3815
+ })
3816
+ });
3817
+ addFormatOnSubmit((formData, ctx) => {
3818
+ (0, import_lodash10.set)(
3819
+ formData,
3820
+ outputKey,
3821
+ import_json_schema12.JsonSchemaUtils.astToSchema((0, import_editor25.getNodeScope)(ctx.node).output.variables?.[0]?.type)
3822
+ );
3823
+ return formData;
3824
+ });
3825
+ }
3826
+ });
3827
+
3828
+ // src/validate/validate-flow-value/index.tsx
3829
+ var import_lodash11 = require("lodash");
3830
+ var import_editor26 = require("@flowgram.ai/editor");
3831
+ function validateFlowValue(value, ctx) {
3832
+ const { node, required, errorMessages } = ctx;
3833
+ const {
3834
+ required: requiredMessage = "Field is required",
3835
+ unknownVariable: unknownVariableMessage = "Unknown Variable"
3836
+ } = errorMessages || {};
3837
+ if (required && ((0, import_lodash11.isNil)(value) || (0, import_lodash11.isNil)(value?.content) || value?.content === "")) {
3838
+ return {
3839
+ level: import_editor26.FeedbackLevel.Error,
3840
+ message: requiredMessage
3841
+ };
3842
+ }
3843
+ if (value?.type === "ref") {
3844
+ const variable = (0, import_editor26.getNodeScope)(node).available.getByKeyPath(value?.content || []);
3845
+ if (!variable) {
3846
+ return {
3847
+ level: import_editor26.FeedbackLevel.Error,
3848
+ message: unknownVariableMessage
3849
+ };
3850
+ }
3851
+ }
3852
+ if (value?.type === "template") {
3853
+ const allRefs = getTemplateKeyPaths2(value);
3854
+ for (const ref of allRefs) {
3855
+ const variable = (0, import_editor26.getNodeScope)(node).available.getByKeyPath(ref);
3856
+ if (!variable) {
3857
+ return {
3858
+ level: import_editor26.FeedbackLevel.Error,
3859
+ message: unknownVariableMessage
3860
+ };
3861
+ }
3862
+ }
3863
+ }
3864
+ return void 0;
3865
+ }
3866
+ function getTemplateKeyPaths2(value) {
3867
+ const keyPathReg = /{{(.*?)}}/g;
3868
+ return (0, import_lodash11.uniq)(value.content?.match(keyPathReg) || []).map(
3869
+ (_keyPath) => _keyPath.slice(2, -2).split(".")
3870
+ );
3871
+ }
3349
3872
  // Annotate the CommonJS export names for ESM import in node:
3350
3873
  0 && (module.exports = {
3351
- ArrayIcons,
3874
+ AssignRow,
3875
+ AssignRows,
3352
3876
  BatchOutputs,
3353
3877
  BatchVariableSelector,
3354
3878
  CodeEditor,
3879
+ CodeEditorMini,
3355
3880
  ConditionRow,
3356
3881
  ConstantInput,
3882
+ DisplayFlowValue,
3883
+ DisplayInputsValues,
3884
+ DisplayOutputs,
3885
+ DisplaySchemaTag,
3886
+ DisplaySchemaTree,
3357
3887
  DynamicValueInput,
3888
+ InputsValues,
3358
3889
  JsonEditorWithVariables,
3359
3890
  JsonSchemaEditor,
3891
+ JsonSchemaTypePresetProvider,
3360
3892
  JsonSchemaUtils,
3361
3893
  PromptEditor,
3362
3894
  PromptEditorWithInputs,
3363
3895
  PromptEditorWithVariables,
3364
3896
  TypeSelector,
3365
3897
  VariableSelector,
3366
- VariableTypeIcons,
3367
3898
  autoRenameRefEffect,
3368
3899
  createBatchOutputsFormPlugin,
3900
+ createDisableDeclarationPlugin,
3901
+ createInferAssignPlugin,
3902
+ createInferInputsPlugin,
3903
+ createTypePresetPlugin,
3369
3904
  formatLegacyRefOnInit,
3370
3905
  formatLegacyRefOnSubmit,
3371
3906
  formatLegacyRefToNewRef,
3372
3907
  formatNewRefToLegacyRef,
3373
- getSchemaIcon,
3374
3908
  getTypeSelectValue,
3375
3909
  isLegacyFlowRefValueSchema,
3376
3910
  isNewFlowRefValueSchema,
3911
+ listenRefSchemaChange,
3912
+ listenRefValueChange,
3377
3913
  parseTypeSelectValue,
3378
3914
  provideBatchInputEffect,
3379
3915
  provideBatchOutputsEffect,
3380
3916
  provideJsonSchemaOutputs,
3381
3917
  syncVariableTitle,
3382
- useVariableTree
3918
+ useTypeManager,
3919
+ useVariableTree,
3920
+ validateFlowValue,
3921
+ validateWhenVariableSync
3383
3922
  });
3384
3923
  //# sourceMappingURL=index.js.map