@powerhousedao/powerhouse-vetra-packages 6.2.3-dev.9 → 6.2.3-dev.90

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 (117) hide show
  1. package/dist/browser/document-models/index.js +2 -1
  2. package/dist/browser/documents-cxt8RRxe.js +18 -0
  3. package/dist/browser/documents-cxt8RRxe.js.map +1 -0
  4. package/dist/browser/{editor-DWqW8FJ2.js → editor-DXAJ8Mqb.js} +761 -277
  5. package/dist/browser/editor-DXAJ8Mqb.js.map +1 -0
  6. package/dist/browser/{editor-CbGnfPVs.js → editor-Dmpkd8pQ.js} +4 -5
  7. package/dist/browser/{editor-CbGnfPVs.js.map → editor-Dmpkd8pQ.js.map} +1 -1
  8. package/dist/browser/editors/document-model-editor/module.js +1 -1
  9. package/dist/browser/editors/document-model-editor/module.js.map +1 -1
  10. package/dist/browser/editors/generic-drive-explorer/index.js +4 -324
  11. package/dist/browser/editors/generic-drive-explorer/index.js.map +1 -1
  12. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  13. package/dist/browser/editors/generic-drive-explorer/module.js.map +1 -1
  14. package/dist/{node/folder-view-DrRUOAcf.mjs → browser/folder-view-CwIU4XEe.js} +17 -12
  15. package/dist/browser/folder-view-CwIU4XEe.js.map +1 -0
  16. package/dist/browser/graphql-editor-CGxwONKl.js +103 -0
  17. package/dist/browser/graphql-editor-CGxwONKl.js.map +1 -0
  18. package/dist/browser/hooks-D15NCia0.js +126 -0
  19. package/dist/browser/hooks-D15NCia0.js.map +1 -0
  20. package/dist/browser/index.js +6 -703
  21. package/dist/browser/index.js.map +1 -1
  22. package/dist/browser/json-editor--jgLEwP2.js +55 -0
  23. package/dist/browser/json-editor--jgLEwP2.js.map +1 -0
  24. package/dist/browser/{schema-context-ZyeclQwy.js → schema-context-CC_WFs1x.js} +10 -6
  25. package/dist/browser/schema-context-CC_WFs1x.js.map +1 -0
  26. package/dist/browser/{state-schemas-DZB9PFEk.js → state-schemas-DSY44MOd.js} +28 -19
  27. package/dist/browser/state-schemas-DSY44MOd.js.map +1 -0
  28. package/dist/{browser/dist-BAJ5nRDl.js → node/bundle-mjs-Cuu3DEfT.mjs} +1251 -822
  29. package/dist/node/bundle-mjs-Cuu3DEfT.mjs.map +1 -0
  30. package/dist/node/document-models/index.mjs +2 -1
  31. package/dist/node/{graphql-BfAoPeWM.mjs → documents-DH2fyf7U.mjs} +80 -50
  32. package/dist/node/documents-DH2fyf7U.mjs.map +1 -0
  33. package/dist/node/editor-BcvUeBW7.mjs +4761 -0
  34. package/dist/node/editor-BcvUeBW7.mjs.map +1 -0
  35. package/dist/node/editor-DJCghViS.mjs +983 -0
  36. package/dist/node/editor-DJCghViS.mjs.map +1 -0
  37. package/dist/node/editors/index.mjs +23 -2
  38. package/dist/node/editors/index.mjs.map +1 -0
  39. package/dist/node/{graphql-editor-C38uott6.mjs → graphql-editor-u9NStKLL.mjs} +5129 -63
  40. package/dist/node/graphql-editor-u9NStKLL.mjs.map +1 -0
  41. package/dist/node/{hooks-D0DcS3MV.mjs → hooks-BiLz75cj.mjs} +824 -444
  42. package/dist/node/{hooks-D0DcS3MV.mjs.map → hooks-BiLz75cj.mjs.map} +1 -1
  43. package/dist/node/index.mjs +46 -100
  44. package/dist/node/index.mjs.map +1 -1
  45. package/dist/{browser/json-editor-DqRiIY49.js → node/json-editor-BfcrckeT.mjs} +8 -9
  46. package/dist/node/{json-editor-BM2wc5Zz.mjs.map → json-editor-BfcrckeT.mjs.map} +1 -1
  47. package/dist/node/{schema-context-DL8jhi_d.mjs → schema-context-r0MTQnRC.mjs} +9 -6
  48. package/dist/node/schema-context-r0MTQnRC.mjs.map +1 -0
  49. package/dist/node/state-schemas-o3PZdBW2.mjs +1071 -0
  50. package/dist/node/state-schemas-o3PZdBW2.mjs.map +1 -0
  51. package/package.json +26 -23
  52. package/style.css +2 -0
  53. package/dist/browser/assets/entry-DSBtQnit.js +0 -314
  54. package/dist/browser/assets/projection-entry-Bem3exmO.js +0 -404
  55. package/dist/browser/button-CuO8Gh3v.js +0 -696
  56. package/dist/browser/button-CuO8Gh3v.js.map +0 -1
  57. package/dist/browser/connect-CDHt0LA4.js +0 -14328
  58. package/dist/browser/connect-CDHt0LA4.js.map +0 -1
  59. package/dist/browser/dist-B4FWbuEM.js +0 -4148
  60. package/dist/browser/dist-B4FWbuEM.js.map +0 -1
  61. package/dist/browser/dist-BAJ5nRDl.js.map +0 -1
  62. package/dist/browser/dist-Csb8sxU2.js +0 -4641
  63. package/dist/browser/dist-Csb8sxU2.js.map +0 -1
  64. package/dist/browser/document-drive-fcQ4o8i3.js +0 -8320
  65. package/dist/browser/document-drive-fcQ4o8i3.js.map +0 -1
  66. package/dist/browser/documents-J_l59mSV.js +0 -6188
  67. package/dist/browser/documents-J_l59mSV.js.map +0 -1
  68. package/dist/browser/editor-DWqW8FJ2.js.map +0 -1
  69. package/dist/browser/folder-view-DxzbfZuY.js +0 -232
  70. package/dist/browser/folder-view-DxzbfZuY.js.map +0 -1
  71. package/dist/browser/graphql-editor-CuiExsfF.js +0 -11698
  72. package/dist/browser/graphql-editor-CuiExsfF.js.map +0 -1
  73. package/dist/browser/hooks-KKcNp2X0.js +0 -24213
  74. package/dist/browser/hooks-KKcNp2X0.js.map +0 -1
  75. package/dist/browser/json-editor-DqRiIY49.js.map +0 -1
  76. package/dist/browser/lib-CPkPeg_u.js +0 -209
  77. package/dist/browser/lib-CPkPeg_u.js.map +0 -1
  78. package/dist/browser/parser-CkF6Qt8V.js +0 -2553
  79. package/dist/browser/parser-CkF6Qt8V.js.map +0 -1
  80. package/dist/browser/printer-CEYr4JOg.js +0 -604
  81. package/dist/browser/printer-CEYr4JOg.js.map +0 -1
  82. package/dist/browser/schema-context-ZyeclQwy.js.map +0 -1
  83. package/dist/browser/state-schemas-DZB9PFEk.js.map +0 -1
  84. package/dist/node/button-Da7CxMn7.mjs +0 -678
  85. package/dist/node/button-Da7CxMn7.mjs.map +0 -1
  86. package/dist/node/connect-D7y1D5hm.mjs +0 -15022
  87. package/dist/node/connect-D7y1D5hm.mjs.map +0 -1
  88. package/dist/node/dist-CTcqTvC6.mjs +0 -4649
  89. package/dist/node/dist-CTcqTvC6.mjs.map +0 -1
  90. package/dist/node/dist-CzYOpeXN.mjs +0 -2711
  91. package/dist/node/dist-CzYOpeXN.mjs.map +0 -1
  92. package/dist/node/dist-DT7jI9ol.mjs +0 -4148
  93. package/dist/node/dist-DT7jI9ol.mjs.map +0 -1
  94. package/dist/node/document-drive-DuGBBYw5.mjs +0 -8337
  95. package/dist/node/document-drive-DuGBBYw5.mjs.map +0 -1
  96. package/dist/node/documents-DCf53bzO.mjs +0 -747
  97. package/dist/node/documents-DCf53bzO.mjs.map +0 -1
  98. package/dist/node/editor-BU3YRt7c.mjs +0 -1809
  99. package/dist/node/editor-BU3YRt7c.mjs.map +0 -1
  100. package/dist/node/editor-DCN8dGJA.mjs +0 -25
  101. package/dist/node/editor-DCN8dGJA.mjs.map +0 -1
  102. package/dist/node/editors/document-model-editor/index.mjs +0 -1
  103. package/dist/node/editors/document-model-editor/module.mjs +0 -14
  104. package/dist/node/editors/document-model-editor/module.mjs.map +0 -1
  105. package/dist/node/editors/generic-drive-explorer/index.mjs +0 -456
  106. package/dist/node/editors/generic-drive-explorer/index.mjs.map +0 -1
  107. package/dist/node/editors/generic-drive-explorer/module.mjs +0 -14
  108. package/dist/node/editors/generic-drive-explorer/module.mjs.map +0 -1
  109. package/dist/node/folder-view-DrRUOAcf.mjs.map +0 -1
  110. package/dist/node/graphql-BfAoPeWM.mjs.map +0 -1
  111. package/dist/node/graphql-editor-C38uott6.mjs.map +0 -1
  112. package/dist/node/json-editor-BM2wc5Zz.mjs +0 -154
  113. package/dist/node/main-BhH_ajBM.mjs +0 -745
  114. package/dist/node/main-BhH_ajBM.mjs.map +0 -1
  115. package/dist/node/schema-context-DL8jhi_d.mjs.map +0 -1
  116. package/dist/node/state-schemas--x-Yb4EP.mjs +0 -299
  117. package/dist/node/state-schemas--x-Yb4EP.mjs.map +0 -1
@@ -0,0 +1,1071 @@
1
+ import { i as typeDefsDoc, o as require_graphql } from "./documents-DH2fyf7U.mjs";
2
+ import { n as safeParseSdl, r as useSchemaContext } from "./schema-context-r0MTQnRC.mjs";
3
+ import { t as twMerge } from "./bundle-mjs-Cuu3DEfT.mjs";
4
+ import { a as ensureValidStateSchemaName, c as makeMinimalObjectForStateType, i as Button, l as makeStateSchemaNameForScope, n as composeRefs, o as StateValidationError, r as useComposedRefs, s as makeInitialSchemaDoc, u as validateStateObject } from "./editor-BcvUeBW7.mjs";
5
+ import * as React$1 from "react";
6
+ import React, { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import "@powerhousedao/design-system/connect";
9
+ import "react-dom";
10
+ //#region editors/document-model-editor/components/state-error.tsx
11
+ var import_graphql = require_graphql();
12
+ function StateValidationErrorMessage({ error }) {
13
+ const { payload } = error;
14
+ switch (payload.kind) {
15
+ case "MISSING": return /* @__PURE__ */ jsxs("span", { children: [
16
+ "Field ",
17
+ /* @__PURE__ */ jsx("strong", { children: payload.field }),
18
+ " is missing."
19
+ ] });
20
+ case "MISSING_OPTIONAL": return /* @__PURE__ */ jsxs("span", { children: [
21
+ "Optional field ",
22
+ /* @__PURE__ */ jsx("strong", { children: payload.field }),
23
+ " is not defined."
24
+ ] });
25
+ case "UNKNOWN_FIELD": return /* @__PURE__ */ jsxs("span", { children: [
26
+ "Field ",
27
+ /* @__PURE__ */ jsx("strong", { children: payload.field }),
28
+ " is not a known field."
29
+ ] });
30
+ case "NON_NULL": return /* @__PURE__ */ jsxs("span", { children: [
31
+ "Field ",
32
+ /* @__PURE__ */ jsx("strong", { children: payload.field }),
33
+ " cannot be null."
34
+ ] });
35
+ case "TYPE": return /* @__PURE__ */ jsxs("span", { children: [
36
+ "Field ",
37
+ /* @__PURE__ */ jsx("strong", { children: payload.field }),
38
+ payload.expectedType ? /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ " ",
40
+ "must be a",
41
+ " ",
42
+ /* @__PURE__ */ jsx("strong", { children: payload.expectedType.replace(/!/g, "") }),
43
+ "."
44
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: " has an invalid value." })
45
+ ] });
46
+ case "RECURSIVE_TYPE": return /* @__PURE__ */ jsxs("span", { children: [
47
+ "Field ",
48
+ /* @__PURE__ */ jsx("strong", { children: payload.typeName }),
49
+ " has a recursive type. It must be optional."
50
+ ] });
51
+ default: return /* @__PURE__ */ jsx("span", { children: "Invalid value." });
52
+ }
53
+ }
54
+ typeof window !== "undefined" && window.document && window.document.createElement;
55
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
56
+ return function handleEvent(event) {
57
+ originalEventHandler?.(event);
58
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler?.(event);
59
+ };
60
+ }
61
+ //#endregion
62
+ //#region ../../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-context/dist/index.mjs
63
+ function createContextScope(scopeName, createContextScopeDeps = []) {
64
+ let defaultContexts = [];
65
+ function createContext3(rootComponentName, defaultContext) {
66
+ const BaseContext = React$1.createContext(defaultContext);
67
+ const index = defaultContexts.length;
68
+ defaultContexts = [...defaultContexts, defaultContext];
69
+ const Provider = (props) => {
70
+ const { scope, children, ...context } = props;
71
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
72
+ const value = React$1.useMemo(() => context, Object.values(context));
73
+ return /* @__PURE__ */ jsx(Context.Provider, {
74
+ value,
75
+ children
76
+ });
77
+ };
78
+ Provider.displayName = rootComponentName + "Provider";
79
+ function useContext2(consumerName, scope) {
80
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
81
+ const context = React$1.useContext(Context);
82
+ if (context) return context;
83
+ if (defaultContext !== void 0) return defaultContext;
84
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
85
+ }
86
+ return [Provider, useContext2];
87
+ }
88
+ const createScope = () => {
89
+ const scopeContexts = defaultContexts.map((defaultContext) => {
90
+ return React$1.createContext(defaultContext);
91
+ });
92
+ return function useScope(scope) {
93
+ const contexts = scope?.[scopeName] || scopeContexts;
94
+ return React$1.useMemo(() => ({ [`__scope${scopeName}`]: {
95
+ ...scope,
96
+ [scopeName]: contexts
97
+ } }), [scope, contexts]);
98
+ };
99
+ };
100
+ createScope.scopeName = scopeName;
101
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
102
+ }
103
+ function composeContextScopes(...scopes) {
104
+ const baseScope = scopes[0];
105
+ if (scopes.length === 1) return baseScope;
106
+ const createScope = () => {
107
+ const scopeHooks = scopes.map((createScope2) => ({
108
+ useScope: createScope2(),
109
+ scopeName: createScope2.scopeName
110
+ }));
111
+ return function useComposedScopes(overrideScopes) {
112
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
113
+ const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
114
+ return {
115
+ ...nextScopes2,
116
+ ...currentScope
117
+ };
118
+ }, {});
119
+ return React$1.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
120
+ };
121
+ };
122
+ createScope.scopeName = baseScope.scopeName;
123
+ return createScope;
124
+ }
125
+ //#endregion
126
+ //#region ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-slot/dist/index.mjs
127
+ // @__NO_SIDE_EFFECTS__
128
+ function createSlot(ownerName) {
129
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
130
+ const Slot2 = React$1.forwardRef((props, forwardedRef) => {
131
+ const { children, ...slotProps } = props;
132
+ const childrenArray = React$1.Children.toArray(children);
133
+ const slottable = childrenArray.find(isSlottable);
134
+ if (slottable) {
135
+ const newElement = slottable.props.children;
136
+ const newChildren = childrenArray.map((child) => {
137
+ if (child === slottable) {
138
+ if (React$1.Children.count(newElement) > 1) return React$1.Children.only(null);
139
+ return React$1.isValidElement(newElement) ? newElement.props.children : null;
140
+ } else return child;
141
+ });
142
+ return /* @__PURE__ */ jsx(SlotClone, {
143
+ ...slotProps,
144
+ ref: forwardedRef,
145
+ children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null
146
+ });
147
+ }
148
+ return /* @__PURE__ */ jsx(SlotClone, {
149
+ ...slotProps,
150
+ ref: forwardedRef,
151
+ children
152
+ });
153
+ });
154
+ Slot2.displayName = `${ownerName}.Slot`;
155
+ return Slot2;
156
+ }
157
+ // @__NO_SIDE_EFFECTS__
158
+ function createSlotClone(ownerName) {
159
+ const SlotClone = React$1.forwardRef((props, forwardedRef) => {
160
+ const { children, ...slotProps } = props;
161
+ if (React$1.isValidElement(children)) {
162
+ const childrenRef = getElementRef$1(children);
163
+ const props2 = mergeProps(slotProps, children.props);
164
+ if (children.type !== React$1.Fragment) props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
165
+ return React$1.cloneElement(children, props2);
166
+ }
167
+ return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
168
+ });
169
+ SlotClone.displayName = `${ownerName}.SlotClone`;
170
+ return SlotClone;
171
+ }
172
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
173
+ function isSlottable(child) {
174
+ return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
175
+ }
176
+ function mergeProps(slotProps, childProps) {
177
+ const overrideProps = { ...childProps };
178
+ for (const propName in childProps) {
179
+ const slotPropValue = slotProps[propName];
180
+ const childPropValue = childProps[propName];
181
+ if (/^on[A-Z]/.test(propName)) {
182
+ if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
183
+ const result = childPropValue(...args);
184
+ slotPropValue(...args);
185
+ return result;
186
+ };
187
+ else if (slotPropValue) overrideProps[propName] = slotPropValue;
188
+ } else if (propName === "style") overrideProps[propName] = {
189
+ ...slotPropValue,
190
+ ...childPropValue
191
+ };
192
+ else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
193
+ }
194
+ return {
195
+ ...slotProps,
196
+ ...overrideProps
197
+ };
198
+ }
199
+ function getElementRef$1(element) {
200
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
201
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
202
+ if (mayWarn) return element.ref;
203
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
204
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
205
+ if (mayWarn) return element.props.ref;
206
+ return element.props.ref || element.ref;
207
+ }
208
+ //#endregion
209
+ //#region ../../node_modules/.pnpm/@radix-ui+react-collection@1.1.7_@types+react-dom@19.2.3_@types+react@19.2.14__@types+r_b94f5365b88697a700662930c56ccffc/node_modules/@radix-ui/react-collection/dist/index.mjs
210
+ function createCollection(name) {
211
+ const PROVIDER_NAME = name + "CollectionProvider";
212
+ const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
213
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
214
+ collectionRef: { current: null },
215
+ itemMap: /* @__PURE__ */ new Map()
216
+ });
217
+ const CollectionProvider = (props) => {
218
+ const { scope, children } = props;
219
+ const ref = React.useRef(null);
220
+ const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
221
+ return /* @__PURE__ */ jsx(CollectionProviderImpl, {
222
+ scope,
223
+ itemMap,
224
+ collectionRef: ref,
225
+ children
226
+ });
227
+ };
228
+ CollectionProvider.displayName = PROVIDER_NAME;
229
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
230
+ const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
231
+ const CollectionSlot = React.forwardRef((props, forwardedRef) => {
232
+ const { scope, children } = props;
233
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
234
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
235
+ return /* @__PURE__ */ jsx(CollectionSlotImpl, {
236
+ ref: composedRefs,
237
+ children
238
+ });
239
+ });
240
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
241
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
242
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
243
+ const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
244
+ const CollectionItemSlot = React.forwardRef((props, forwardedRef) => {
245
+ const { scope, children, ...itemData } = props;
246
+ const ref = React.useRef(null);
247
+ const composedRefs = useComposedRefs(forwardedRef, ref);
248
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
249
+ React.useEffect(() => {
250
+ context.itemMap.set(ref, {
251
+ ref,
252
+ ...itemData
253
+ });
254
+ return () => void context.itemMap.delete(ref);
255
+ });
256
+ return /* @__PURE__ */ jsx(CollectionItemSlotImpl, {
257
+ [ITEM_DATA_ATTR]: "",
258
+ ref: composedRefs,
259
+ children
260
+ });
261
+ });
262
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
263
+ function useCollection(scope) {
264
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
265
+ return React.useCallback(() => {
266
+ const collectionNode = context.collectionRef.current;
267
+ if (!collectionNode) return [];
268
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
269
+ return Array.from(context.itemMap.values()).sort((a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current));
270
+ }, [context.collectionRef, context.itemMap]);
271
+ }
272
+ return [
273
+ {
274
+ Provider: CollectionProvider,
275
+ Slot: CollectionSlot,
276
+ ItemSlot: CollectionItemSlot
277
+ },
278
+ useCollection,
279
+ createCollectionScope
280
+ ];
281
+ }
282
+ //#endregion
283
+ //#region ../../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.1.1_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
284
+ var useLayoutEffect2 = globalThis?.document ? React$1.useLayoutEffect : () => {};
285
+ //#endregion
286
+ //#region ../../node_modules/.pnpm/@radix-ui+react-id@1.1.1_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-id/dist/index.mjs
287
+ var useReactId = React$1[" useId ".trim().toString()] || (() => void 0);
288
+ var count = 0;
289
+ function useId$1(deterministicId) {
290
+ const [id, setId] = React$1.useState(useReactId());
291
+ useLayoutEffect2(() => {
292
+ if (!deterministicId) setId((reactId) => reactId ?? String(count++));
293
+ }, [deterministicId]);
294
+ return deterministicId || (id ? `radix-${id}` : "");
295
+ }
296
+ //#endregion
297
+ //#region ../../node_modules/.pnpm/@radix-ui+react-primitive@2.1.3_@types+react-dom@19.2.3_@types+react@19.2.14__@types+re_0935c7b95cefcdb4f10a34e92035e5e3/node_modules/@radix-ui/react-primitive/dist/index.mjs
298
+ var Primitive = [
299
+ "a",
300
+ "button",
301
+ "div",
302
+ "form",
303
+ "h2",
304
+ "h3",
305
+ "img",
306
+ "input",
307
+ "label",
308
+ "li",
309
+ "nav",
310
+ "ol",
311
+ "p",
312
+ "select",
313
+ "span",
314
+ "svg",
315
+ "ul"
316
+ ].reduce((primitive, node) => {
317
+ const Slot = /* @__PURE__ */ createSlot(`Primitive.${node}`);
318
+ const Node = React$1.forwardRef((props, forwardedRef) => {
319
+ const { asChild, ...primitiveProps } = props;
320
+ const Comp = asChild ? Slot : node;
321
+ if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
322
+ return /* @__PURE__ */ jsx(Comp, {
323
+ ...primitiveProps,
324
+ ref: forwardedRef
325
+ });
326
+ });
327
+ Node.displayName = `Primitive.${node}`;
328
+ return {
329
+ ...primitive,
330
+ [node]: Node
331
+ };
332
+ }, {});
333
+ //#endregion
334
+ //#region ../../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.1_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
335
+ function useCallbackRef(callback) {
336
+ const callbackRef = React$1.useRef(callback);
337
+ React$1.useEffect(() => {
338
+ callbackRef.current = callback;
339
+ });
340
+ return React$1.useMemo(() => (...args) => callbackRef.current?.(...args), []);
341
+ }
342
+ //#endregion
343
+ //#region ../../node_modules/.pnpm/@radix-ui+react-use-controllable-state@1.2.2_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
344
+ var useInsertionEffect = React$1[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
345
+ function useControllableState({ prop, defaultProp, onChange = () => {}, caller }) {
346
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
347
+ defaultProp,
348
+ onChange
349
+ });
350
+ const isControlled = prop !== void 0;
351
+ const value = isControlled ? prop : uncontrolledProp;
352
+ {
353
+ const isControlledRef = React$1.useRef(prop !== void 0);
354
+ React$1.useEffect(() => {
355
+ const wasControlled = isControlledRef.current;
356
+ if (wasControlled !== isControlled) console.warn(`${caller} is changing from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);
357
+ isControlledRef.current = isControlled;
358
+ }, [isControlled, caller]);
359
+ }
360
+ return [value, React$1.useCallback((nextValue) => {
361
+ if (isControlled) {
362
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
363
+ if (value2 !== prop) onChangeRef.current?.(value2);
364
+ } else setUncontrolledProp(nextValue);
365
+ }, [
366
+ isControlled,
367
+ prop,
368
+ setUncontrolledProp,
369
+ onChangeRef
370
+ ])];
371
+ }
372
+ function useUncontrolledState({ defaultProp, onChange }) {
373
+ const [value, setValue] = React$1.useState(defaultProp);
374
+ const prevValueRef = React$1.useRef(value);
375
+ const onChangeRef = React$1.useRef(onChange);
376
+ useInsertionEffect(() => {
377
+ onChangeRef.current = onChange;
378
+ }, [onChange]);
379
+ React$1.useEffect(() => {
380
+ if (prevValueRef.current !== value) {
381
+ onChangeRef.current?.(value);
382
+ prevValueRef.current = value;
383
+ }
384
+ }, [value, prevValueRef]);
385
+ return [
386
+ value,
387
+ setValue,
388
+ onChangeRef
389
+ ];
390
+ }
391
+ function isFunction(value) {
392
+ return typeof value === "function";
393
+ }
394
+ //#endregion
395
+ //#region ../../node_modules/.pnpm/@radix-ui+react-direction@1.1.1_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-direction/dist/index.mjs
396
+ var DirectionContext = React$1.createContext(void 0);
397
+ function useDirection(localDir) {
398
+ const globalDir = React$1.useContext(DirectionContext);
399
+ return localDir || globalDir || "ltr";
400
+ }
401
+ //#endregion
402
+ //#region ../../node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.14__@type_b849ea542e77d5b397b1fe12d9f00b2e/node_modules/@radix-ui/react-roving-focus/dist/index.mjs
403
+ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
404
+ var EVENT_OPTIONS = {
405
+ bubbles: false,
406
+ cancelable: true
407
+ };
408
+ var GROUP_NAME = "RovingFocusGroup";
409
+ var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
410
+ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(GROUP_NAME, [createCollectionScope]);
411
+ var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
412
+ var RovingFocusGroup = React$1.forwardRef((props, forwardedRef) => {
413
+ return /* @__PURE__ */ jsx(Collection.Provider, {
414
+ scope: props.__scopeRovingFocusGroup,
415
+ children: /* @__PURE__ */ jsx(Collection.Slot, {
416
+ scope: props.__scopeRovingFocusGroup,
417
+ children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, {
418
+ ...props,
419
+ ref: forwardedRef
420
+ })
421
+ })
422
+ });
423
+ });
424
+ RovingFocusGroup.displayName = GROUP_NAME;
425
+ var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
426
+ const { __scopeRovingFocusGroup, orientation, loop = false, dir, currentTabStopId: currentTabStopIdProp, defaultCurrentTabStopId, onCurrentTabStopIdChange, onEntryFocus, preventScrollOnEntryFocus = false, ...groupProps } = props;
427
+ const ref = React$1.useRef(null);
428
+ const composedRefs = useComposedRefs(forwardedRef, ref);
429
+ const direction = useDirection(dir);
430
+ const [currentTabStopId, setCurrentTabStopId] = useControllableState({
431
+ prop: currentTabStopIdProp,
432
+ defaultProp: defaultCurrentTabStopId ?? null,
433
+ onChange: onCurrentTabStopIdChange,
434
+ caller: GROUP_NAME
435
+ });
436
+ const [isTabbingBackOut, setIsTabbingBackOut] = React$1.useState(false);
437
+ const handleEntryFocus = useCallbackRef(onEntryFocus);
438
+ const getItems = useCollection(__scopeRovingFocusGroup);
439
+ const isClickFocusRef = React$1.useRef(false);
440
+ const [focusableItemsCount, setFocusableItemsCount] = React$1.useState(0);
441
+ React$1.useEffect(() => {
442
+ const node = ref.current;
443
+ if (node) {
444
+ node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
445
+ return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
446
+ }
447
+ }, [handleEntryFocus]);
448
+ return /* @__PURE__ */ jsx(RovingFocusProvider, {
449
+ scope: __scopeRovingFocusGroup,
450
+ orientation,
451
+ dir: direction,
452
+ loop,
453
+ currentTabStopId,
454
+ onItemFocus: React$1.useCallback((tabStopId) => setCurrentTabStopId(tabStopId), [setCurrentTabStopId]),
455
+ onItemShiftTab: React$1.useCallback(() => setIsTabbingBackOut(true), []),
456
+ onFocusableItemAdd: React$1.useCallback(() => setFocusableItemsCount((prevCount) => prevCount + 1), []),
457
+ onFocusableItemRemove: React$1.useCallback(() => setFocusableItemsCount((prevCount) => prevCount - 1), []),
458
+ children: /* @__PURE__ */ jsx(Primitive.div, {
459
+ tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
460
+ "data-orientation": orientation,
461
+ ...groupProps,
462
+ ref: composedRefs,
463
+ style: {
464
+ outline: "none",
465
+ ...props.style
466
+ },
467
+ onMouseDown: composeEventHandlers(props.onMouseDown, () => {
468
+ isClickFocusRef.current = true;
469
+ }),
470
+ onFocus: composeEventHandlers(props.onFocus, (event) => {
471
+ const isKeyboardFocus = !isClickFocusRef.current;
472
+ if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
473
+ const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
474
+ event.currentTarget.dispatchEvent(entryFocusEvent);
475
+ if (!entryFocusEvent.defaultPrevented) {
476
+ const items = getItems().filter((item) => item.focusable);
477
+ focusFirst([
478
+ items.find((item) => item.active),
479
+ items.find((item) => item.id === currentTabStopId),
480
+ ...items
481
+ ].filter(Boolean).map((item) => item.ref.current), preventScrollOnEntryFocus);
482
+ }
483
+ }
484
+ isClickFocusRef.current = false;
485
+ }),
486
+ onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
487
+ })
488
+ });
489
+ });
490
+ var ITEM_NAME = "RovingFocusGroupItem";
491
+ var RovingFocusGroupItem = React$1.forwardRef((props, forwardedRef) => {
492
+ const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props;
493
+ const autoId = useId$1();
494
+ const id = tabStopId || autoId;
495
+ const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
496
+ const isCurrentTabStop = context.currentTabStopId === id;
497
+ const getItems = useCollection(__scopeRovingFocusGroup);
498
+ const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
499
+ React$1.useEffect(() => {
500
+ if (focusable) {
501
+ onFocusableItemAdd();
502
+ return () => onFocusableItemRemove();
503
+ }
504
+ }, [
505
+ focusable,
506
+ onFocusableItemAdd,
507
+ onFocusableItemRemove
508
+ ]);
509
+ return /* @__PURE__ */ jsx(Collection.ItemSlot, {
510
+ scope: __scopeRovingFocusGroup,
511
+ id,
512
+ focusable,
513
+ active,
514
+ children: /* @__PURE__ */ jsx(Primitive.span, {
515
+ tabIndex: isCurrentTabStop ? 0 : -1,
516
+ "data-orientation": context.orientation,
517
+ ...itemProps,
518
+ ref: forwardedRef,
519
+ onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
520
+ if (!focusable) event.preventDefault();
521
+ else context.onItemFocus(id);
522
+ }),
523
+ onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
524
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
525
+ if (event.key === "Tab" && event.shiftKey) {
526
+ context.onItemShiftTab();
527
+ return;
528
+ }
529
+ if (event.target !== event.currentTarget) return;
530
+ const focusIntent = getFocusIntent(event, context.orientation, context.dir);
531
+ if (focusIntent !== void 0) {
532
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
533
+ event.preventDefault();
534
+ let candidateNodes = getItems().filter((item) => item.focusable).map((item) => item.ref.current);
535
+ if (focusIntent === "last") candidateNodes.reverse();
536
+ else if (focusIntent === "prev" || focusIntent === "next") {
537
+ if (focusIntent === "prev") candidateNodes.reverse();
538
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
539
+ candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
540
+ }
541
+ setTimeout(() => focusFirst(candidateNodes));
542
+ }
543
+ }),
544
+ children: typeof children === "function" ? children({
545
+ isCurrentTabStop,
546
+ hasTabStop: currentTabStopId != null
547
+ }) : children
548
+ })
549
+ });
550
+ });
551
+ RovingFocusGroupItem.displayName = ITEM_NAME;
552
+ var MAP_KEY_TO_FOCUS_INTENT = {
553
+ ArrowLeft: "prev",
554
+ ArrowUp: "prev",
555
+ ArrowRight: "next",
556
+ ArrowDown: "next",
557
+ PageUp: "first",
558
+ Home: "first",
559
+ PageDown: "last",
560
+ End: "last"
561
+ };
562
+ function getDirectionAwareKey(key, dir) {
563
+ if (dir !== "rtl") return key;
564
+ return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
565
+ }
566
+ function getFocusIntent(event, orientation, dir) {
567
+ const key = getDirectionAwareKey(event.key, dir);
568
+ if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
569
+ if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
570
+ return MAP_KEY_TO_FOCUS_INTENT[key];
571
+ }
572
+ function focusFirst(candidates, preventScroll = false) {
573
+ const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
574
+ for (const candidate of candidates) {
575
+ if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
576
+ candidate.focus({ preventScroll });
577
+ if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
578
+ }
579
+ }
580
+ function wrapArray(array, startIndex) {
581
+ return array.map((_, index) => array[(startIndex + index) % array.length]);
582
+ }
583
+ var Root = RovingFocusGroup;
584
+ var Item = RovingFocusGroupItem;
585
+ //#endregion
586
+ //#region ../../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@19.2.3_@types+react@19.2.14__@types+rea_abbc8bcf75333b39bfe32b13ef7abc0e/node_modules/@radix-ui/react-presence/dist/index.mjs
587
+ function useStateMachine(initialState, machine) {
588
+ return React$1.useReducer((state, event) => {
589
+ return machine[state][event] ?? state;
590
+ }, initialState);
591
+ }
592
+ var Presence = (props) => {
593
+ const { present, children } = props;
594
+ const presence = usePresence(present);
595
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React$1.Children.only(children);
596
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
597
+ return typeof children === "function" || presence.isPresent ? React$1.cloneElement(child, { ref }) : null;
598
+ };
599
+ Presence.displayName = "Presence";
600
+ function usePresence(present) {
601
+ const [node, setNode] = React$1.useState();
602
+ const stylesRef = React$1.useRef(null);
603
+ const prevPresentRef = React$1.useRef(present);
604
+ const prevAnimationNameRef = React$1.useRef("none");
605
+ const [state, send] = useStateMachine(present ? "mounted" : "unmounted", {
606
+ mounted: {
607
+ UNMOUNT: "unmounted",
608
+ ANIMATION_OUT: "unmountSuspended"
609
+ },
610
+ unmountSuspended: {
611
+ MOUNT: "mounted",
612
+ ANIMATION_END: "unmounted"
613
+ },
614
+ unmounted: { MOUNT: "mounted" }
615
+ });
616
+ React$1.useEffect(() => {
617
+ const currentAnimationName = getAnimationName(stylesRef.current);
618
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
619
+ }, [state]);
620
+ useLayoutEffect2(() => {
621
+ const styles = stylesRef.current;
622
+ const wasPresent = prevPresentRef.current;
623
+ if (wasPresent !== present) {
624
+ const prevAnimationName = prevAnimationNameRef.current;
625
+ const currentAnimationName = getAnimationName(styles);
626
+ if (present) send("MOUNT");
627
+ else if (currentAnimationName === "none" || styles?.display === "none") send("UNMOUNT");
628
+ else if (wasPresent && prevAnimationName !== currentAnimationName) send("ANIMATION_OUT");
629
+ else send("UNMOUNT");
630
+ prevPresentRef.current = present;
631
+ }
632
+ }, [present, send]);
633
+ useLayoutEffect2(() => {
634
+ if (node) {
635
+ let timeoutId;
636
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
637
+ const handleAnimationEnd = (event) => {
638
+ const isCurrentAnimation = getAnimationName(stylesRef.current).includes(CSS.escape(event.animationName));
639
+ if (event.target === node && isCurrentAnimation) {
640
+ send("ANIMATION_END");
641
+ if (!prevPresentRef.current) {
642
+ const currentFillMode = node.style.animationFillMode;
643
+ node.style.animationFillMode = "forwards";
644
+ timeoutId = ownerWindow.setTimeout(() => {
645
+ if (node.style.animationFillMode === "forwards") node.style.animationFillMode = currentFillMode;
646
+ });
647
+ }
648
+ }
649
+ };
650
+ const handleAnimationStart = (event) => {
651
+ if (event.target === node) prevAnimationNameRef.current = getAnimationName(stylesRef.current);
652
+ };
653
+ node.addEventListener("animationstart", handleAnimationStart);
654
+ node.addEventListener("animationcancel", handleAnimationEnd);
655
+ node.addEventListener("animationend", handleAnimationEnd);
656
+ return () => {
657
+ ownerWindow.clearTimeout(timeoutId);
658
+ node.removeEventListener("animationstart", handleAnimationStart);
659
+ node.removeEventListener("animationcancel", handleAnimationEnd);
660
+ node.removeEventListener("animationend", handleAnimationEnd);
661
+ };
662
+ } else send("ANIMATION_END");
663
+ }, [node, send]);
664
+ return {
665
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
666
+ ref: React$1.useCallback((node2) => {
667
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
668
+ setNode(node2);
669
+ }, [])
670
+ };
671
+ }
672
+ function getAnimationName(styles) {
673
+ return styles?.animationName || "none";
674
+ }
675
+ function getElementRef(element) {
676
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
677
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
678
+ if (mayWarn) return element.ref;
679
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
680
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
681
+ if (mayWarn) return element.props.ref;
682
+ return element.props.ref || element.ref;
683
+ }
684
+ //#endregion
685
+ //#region ../../node_modules/.pnpm/@radix-ui+react-tabs@1.1.13_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@_08684373bbac196273bdefb5472f93a8/node_modules/@radix-ui/react-tabs/dist/index.mjs
686
+ var TABS_NAME = "Tabs";
687
+ var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [createRovingFocusGroupScope]);
688
+ var useRovingFocusGroupScope = createRovingFocusGroupScope();
689
+ var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
690
+ var Tabs$1 = React$1.forwardRef((props, forwardedRef) => {
691
+ const { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", ...tabsProps } = props;
692
+ const direction = useDirection(dir);
693
+ const [value, setValue] = useControllableState({
694
+ prop: valueProp,
695
+ onChange: onValueChange,
696
+ defaultProp: defaultValue ?? "",
697
+ caller: TABS_NAME
698
+ });
699
+ return /* @__PURE__ */ jsx(TabsProvider, {
700
+ scope: __scopeTabs,
701
+ baseId: useId$1(),
702
+ value,
703
+ onValueChange: setValue,
704
+ orientation,
705
+ dir: direction,
706
+ activationMode,
707
+ children: /* @__PURE__ */ jsx(Primitive.div, {
708
+ dir: direction,
709
+ "data-orientation": orientation,
710
+ ...tabsProps,
711
+ ref: forwardedRef
712
+ })
713
+ });
714
+ });
715
+ Tabs$1.displayName = TABS_NAME;
716
+ var TAB_LIST_NAME = "TabsList";
717
+ var TabsList$1 = React$1.forwardRef((props, forwardedRef) => {
718
+ const { __scopeTabs, loop = true, ...listProps } = props;
719
+ const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
720
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
721
+ return /* @__PURE__ */ jsx(Root, {
722
+ asChild: true,
723
+ ...rovingFocusGroupScope,
724
+ orientation: context.orientation,
725
+ dir: context.dir,
726
+ loop,
727
+ children: /* @__PURE__ */ jsx(Primitive.div, {
728
+ role: "tablist",
729
+ "aria-orientation": context.orientation,
730
+ ...listProps,
731
+ ref: forwardedRef
732
+ })
733
+ });
734
+ });
735
+ TabsList$1.displayName = TAB_LIST_NAME;
736
+ var TRIGGER_NAME = "TabsTrigger";
737
+ var TabsTrigger$1 = React$1.forwardRef((props, forwardedRef) => {
738
+ const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
739
+ const context = useTabsContext(TRIGGER_NAME, __scopeTabs);
740
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
741
+ const triggerId = makeTriggerId(context.baseId, value);
742
+ const contentId = makeContentId(context.baseId, value);
743
+ const isSelected = value === context.value;
744
+ return /* @__PURE__ */ jsx(Item, {
745
+ asChild: true,
746
+ ...rovingFocusGroupScope,
747
+ focusable: !disabled,
748
+ active: isSelected,
749
+ children: /* @__PURE__ */ jsx(Primitive.button, {
750
+ type: "button",
751
+ role: "tab",
752
+ "aria-selected": isSelected,
753
+ "aria-controls": contentId,
754
+ "data-state": isSelected ? "active" : "inactive",
755
+ "data-disabled": disabled ? "" : void 0,
756
+ disabled,
757
+ id: triggerId,
758
+ ...triggerProps,
759
+ ref: forwardedRef,
760
+ onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
761
+ if (!disabled && event.button === 0 && event.ctrlKey === false) context.onValueChange(value);
762
+ else event.preventDefault();
763
+ }),
764
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
765
+ if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
766
+ }),
767
+ onFocus: composeEventHandlers(props.onFocus, () => {
768
+ const isAutomaticActivation = context.activationMode !== "manual";
769
+ if (!isSelected && !disabled && isAutomaticActivation) context.onValueChange(value);
770
+ })
771
+ })
772
+ });
773
+ });
774
+ TabsTrigger$1.displayName = TRIGGER_NAME;
775
+ var CONTENT_NAME = "TabsContent";
776
+ var TabsContent$1 = React$1.forwardRef((props, forwardedRef) => {
777
+ const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
778
+ const context = useTabsContext(CONTENT_NAME, __scopeTabs);
779
+ const triggerId = makeTriggerId(context.baseId, value);
780
+ const contentId = makeContentId(context.baseId, value);
781
+ const isSelected = value === context.value;
782
+ const isMountAnimationPreventedRef = React$1.useRef(isSelected);
783
+ React$1.useEffect(() => {
784
+ const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
785
+ return () => cancelAnimationFrame(rAF);
786
+ }, []);
787
+ return /* @__PURE__ */ jsx(Presence, {
788
+ present: forceMount || isSelected,
789
+ children: ({ present }) => /* @__PURE__ */ jsx(Primitive.div, {
790
+ "data-state": isSelected ? "active" : "inactive",
791
+ "data-orientation": context.orientation,
792
+ role: "tabpanel",
793
+ "aria-labelledby": triggerId,
794
+ hidden: !present,
795
+ id: contentId,
796
+ tabIndex: 0,
797
+ ...contentProps,
798
+ ref: forwardedRef,
799
+ style: {
800
+ ...props.style,
801
+ animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
802
+ },
803
+ children: present && children
804
+ })
805
+ });
806
+ });
807
+ TabsContent$1.displayName = CONTENT_NAME;
808
+ function makeTriggerId(baseId, value) {
809
+ return `${baseId}-trigger-${value}`;
810
+ }
811
+ function makeContentId(baseId, value) {
812
+ return `${baseId}-content-${value}`;
813
+ }
814
+ var Root2 = Tabs$1;
815
+ var List = TabsList$1;
816
+ var Trigger = TabsTrigger$1;
817
+ var Content = TabsContent$1;
818
+ //#endregion
819
+ //#region editors/document-model-editor/components/tabs.tsx
820
+ const Tabs = Root2;
821
+ const TabsList = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(List, {
822
+ ref,
823
+ className: twMerge("flex items-center justify-center rounded-xl bg-background p-1 shadow-inner", className),
824
+ ...props
825
+ }));
826
+ TabsList.displayName = List.displayName;
827
+ const TabsTrigger = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Trigger, {
828
+ ref,
829
+ className: twMerge("flex w-full items-center justify-center rounded-lg p-1 text-sm whitespace-nowrap text-muted-foreground transition-all disabled:disabled-effect data-[state=active]:bg-accent data-[state=active]:text-foreground data-[state=active]:shadow-tab", className),
830
+ ...props
831
+ }));
832
+ TabsTrigger.displayName = Trigger.displayName;
833
+ const TabsContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Content, {
834
+ ref,
835
+ className,
836
+ ...props
837
+ }));
838
+ TabsContent.displayName = Content.displayName;
839
+ //#endregion
840
+ //#region editors/document-model-editor/components/state-schemas.tsx
841
+ const GraphqlEditor = lazy(() => import("./graphql-editor-u9NStKLL.mjs"));
842
+ const JSONEditor = lazy(() => import("./json-editor-BfcrckeT.mjs"));
843
+ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, setInitialState, scope }) {
844
+ const { sharedSchema: sharedSchemaSdl, error: sharedSchemaError } = useSchemaContext();
845
+ const [showStandardLib, setShowStandardLib] = useState(false);
846
+ const [syncWithSchema, setSyncWithSchema] = useState(true);
847
+ const customLinter = useCallback((doc) => ensureValidStateSchemaName(doc, modelName, scope), [modelName, scope]);
848
+ const schemaErrors = useMemo(() => {
849
+ const errors = ensureValidStateSchemaName(stateSchema, modelName, scope);
850
+ if (sharedSchemaError) return [...errors, sharedSchemaError];
851
+ return errors;
852
+ }, [
853
+ stateSchema,
854
+ modelName,
855
+ scope,
856
+ sharedSchemaError
857
+ ]);
858
+ const handleToggleStandardLib = useCallback(() => {
859
+ setShowStandardLib((prev) => !prev);
860
+ }, []);
861
+ const handleSchemaUpdate = useCallback((newDoc) => setStateSchema(newDoc, scope), [setStateSchema, scope]);
862
+ const handleInitialStateUpdate = useCallback((newDoc) => setInitialState(newDoc, scope), [setInitialState, scope]);
863
+ const hasSyncedRef = useRef(false);
864
+ const [openedWith] = useState(() => ({
865
+ sharedSchemaSdl,
866
+ initialValue,
867
+ modelName
868
+ }));
869
+ const editedSinceOpen = sharedSchemaSdl !== openedWith.sharedSchemaSdl || initialValue !== openedWith.initialValue || modelName !== openedWith.modelName;
870
+ const { initialValueErrors, fixedState } = useMemo(() => {
871
+ const existingValue = initialValue || "{}";
872
+ const sharedSchemaDocumentNode = safeParseSdl(sharedSchemaSdl);
873
+ if (!sharedSchemaDocumentNode) return {
874
+ initialValueErrors: [],
875
+ fixedState: null
876
+ };
877
+ const stateTypeName = makeStateSchemaNameForScope(modelName, scope);
878
+ if (!stateTypeName) return {
879
+ initialValueErrors: [],
880
+ fixedState: null
881
+ };
882
+ const stateTypeDefinitionNode = sharedSchemaDocumentNode.definitions.find((def) => def.kind === import_graphql.Kind.OBJECT_TYPE_DEFINITION && def.name.value === stateTypeName);
883
+ if (!stateTypeDefinitionNode || stateTypeDefinitionNode.kind !== import_graphql.Kind.OBJECT_TYPE_DEFINITION) return {
884
+ initialValueErrors: [],
885
+ fixedState: null
886
+ };
887
+ const errors = validateStateObject(sharedSchemaDocumentNode, stateTypeDefinitionNode, existingValue);
888
+ if (errors.length && syncWithSchema && editedSinceOpen) {
889
+ const computedFixedState = makeMinimalObjectForStateType({
890
+ sharedSchemaDocumentNode,
891
+ stateTypeDefinitionNode,
892
+ existingValue
893
+ });
894
+ if (initialValue !== computedFixedState) return {
895
+ initialValueErrors: [],
896
+ fixedState: computedFixedState
897
+ };
898
+ }
899
+ return {
900
+ initialValueErrors: errors,
901
+ fixedState: null
902
+ };
903
+ }, [
904
+ sharedSchemaSdl,
905
+ initialValue,
906
+ syncWithSchema,
907
+ editedSinceOpen,
908
+ scope,
909
+ modelName
910
+ ]);
911
+ useEffect(() => {
912
+ if (fixedState && !hasSyncedRef.current) {
913
+ hasSyncedRef.current = true;
914
+ setInitialState(fixedState, scope);
915
+ } else if (!fixedState) hasSyncedRef.current = false;
916
+ }, [
917
+ fixedState,
918
+ setInitialState,
919
+ scope
920
+ ]);
921
+ return /* @__PURE__ */ jsxs("div", {
922
+ className: "grid grid-cols-2 gap-4",
923
+ children: [/* @__PURE__ */ jsxs("div", { children: [
924
+ /* @__PURE__ */ jsxs("h3", {
925
+ className: "mb-2 text-lg text-foreground capitalize",
926
+ children: [scope, " state schema *"]
927
+ }),
928
+ /* @__PURE__ */ jsxs(Button, {
929
+ onClick: handleToggleStandardLib,
930
+ className: "mb-2 flex w-fit items-center gap-2",
931
+ children: [
932
+ showStandardLib ? "Hide" : "Show",
933
+ " standard library",
934
+ /* @__PURE__ */ jsx("svg", {
935
+ className: twMerge("inline-block transition-transform", showStandardLib ? "rotate-180" : "rotate-0"),
936
+ xmlns: "http://www.w3.org/2000/svg",
937
+ width: "24",
938
+ height: "24",
939
+ viewBox: "0 0 24 24",
940
+ fill: "currentColor",
941
+ children: /* @__PURE__ */ jsx("path", {
942
+ d: "M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z",
943
+ fill: "currentColor"
944
+ })
945
+ })
946
+ ]
947
+ }),
948
+ /* @__PURE__ */ jsxs(Suspense, { children: [
949
+ showStandardLib && /* @__PURE__ */ jsx(GraphqlEditor, {
950
+ doc: typeDefsDoc,
951
+ readonly: true
952
+ }),
953
+ /* @__PURE__ */ jsx(GraphqlEditor, {
954
+ doc: stateSchema,
955
+ updateDocumentInModel: handleSchemaUpdate,
956
+ customLinter
957
+ }),
958
+ schemaErrors.length > 0 && /* @__PURE__ */ jsx("p", {
959
+ className: "mt-2 text-sm text-destructive",
960
+ children: schemaErrors[0].message
961
+ })
962
+ ] })
963
+ ] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
964
+ className: "flex flex-col items-end",
965
+ children: [/* @__PURE__ */ jsxs("h3", {
966
+ className: "mb-2 text-right text-lg text-foreground capitalize",
967
+ children: [scope, " state initial value *"]
968
+ }), /* @__PURE__ */ jsxs("label", {
969
+ className: "mb-2 flex w-fit items-center gap-2 rounded-md border border-border bg-background p-2 text-sm font-medium whitespace-nowrap text-foreground transition-colors hover:hover-effect focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
970
+ children: [
971
+ /* @__PURE__ */ jsx("input", {
972
+ type: "checkbox",
973
+ className: "",
974
+ value: syncWithSchema.toString(),
975
+ onChange: (e) => {
976
+ setSyncWithSchema(e.currentTarget.value === "true" ? true : false);
977
+ }
978
+ }),
979
+ "Sync with schema",
980
+ " ",
981
+ /* @__PURE__ */ jsx("svg", {
982
+ className: "inline-block",
983
+ xmlns: "http://www.w3.org/2000/svg",
984
+ width: "16",
985
+ height: "16",
986
+ viewBox: "0 0 16 16",
987
+ fill: "none",
988
+ children: /* @__PURE__ */ jsx("path", {
989
+ d: "M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z",
990
+ fill: "currentColor"
991
+ })
992
+ })
993
+ ]
994
+ })]
995
+ }), /* @__PURE__ */ jsxs(Suspense, { children: [/* @__PURE__ */ jsx(JSONEditor, {
996
+ doc: initialValue,
997
+ updateDocumentInModel: handleInitialStateUpdate
998
+ }), initialValueErrors.map((error, index) => /* @__PURE__ */ jsx("p", {
999
+ className: "mt-2 text-sm text-destructive",
1000
+ children: error instanceof StateValidationError ? /* @__PURE__ */ jsx(StateValidationErrorMessage, { error }) : error.message
1001
+ }, index))] })] })]
1002
+ });
1003
+ }
1004
+ function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema, setInitialState, currentScope, onScopeChange }) {
1005
+ const handleAddLocalState = useCallback(() => {
1006
+ setStateSchema(makeInitialSchemaDoc(modelName, "local"), "local");
1007
+ setInitialState("", "local");
1008
+ }, [
1009
+ modelName,
1010
+ setStateSchema,
1011
+ setInitialState
1012
+ ]);
1013
+ return /* @__PURE__ */ jsxs(Tabs, {
1014
+ className: "pb-8",
1015
+ activationMode: "manual",
1016
+ value: currentScope,
1017
+ onValueChange: (value) => onScopeChange(value),
1018
+ children: [
1019
+ /* @__PURE__ */ jsx("div", {
1020
+ className: "my-6",
1021
+ children: /* @__PURE__ */ jsxs(TabsList, {
1022
+ className: "mx-auto flex max-w-sm",
1023
+ children: [/* @__PURE__ */ jsx(TabsTrigger, {
1024
+ value: "global",
1025
+ children: "Global"
1026
+ }), /* @__PURE__ */ jsx(TabsTrigger, {
1027
+ value: "local",
1028
+ children: "Local"
1029
+ })]
1030
+ })
1031
+ }),
1032
+ /* @__PURE__ */ jsx(TabsContent, {
1033
+ value: "global",
1034
+ tabIndex: -1,
1035
+ children: /* @__PURE__ */ jsx(StateEditor, {
1036
+ modelName,
1037
+ stateSchema: globalStateSchema,
1038
+ initialValue: globalStateInitialValue,
1039
+ setStateSchema,
1040
+ setInitialState,
1041
+ scope: "global"
1042
+ })
1043
+ }),
1044
+ /* @__PURE__ */ jsx(TabsContent, {
1045
+ value: "local",
1046
+ tabIndex: -1,
1047
+ children: !localStateSchema ? /* @__PURE__ */ jsxs("div", {
1048
+ className: "",
1049
+ children: [/* @__PURE__ */ jsx("h3", {
1050
+ className: "mb-2 text-lg text-foreground capitalize",
1051
+ children: "local state schema *"
1052
+ }), /* @__PURE__ */ jsx(Button, {
1053
+ onClick: handleAddLocalState,
1054
+ children: "Add local state"
1055
+ })]
1056
+ }) : /* @__PURE__ */ jsx(StateEditor, {
1057
+ modelName,
1058
+ stateSchema: localStateSchema,
1059
+ initialValue: localStateInitialValue,
1060
+ setStateSchema,
1061
+ setInitialState,
1062
+ scope: "local"
1063
+ })
1064
+ })
1065
+ ]
1066
+ });
1067
+ }
1068
+ //#endregion
1069
+ export { StateSchemas as default };
1070
+
1071
+ //# sourceMappingURL=state-schemas-o3PZdBW2.mjs.map