@stonecrop/stonecrop 0.12.8 → 0.13.1

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 (60) hide show
  1. package/README.md +0 -1
  2. package/dist/composable.js +1 -0
  3. package/dist/composables/lazy-link.js +125 -0
  4. package/dist/composables/operation-log.js +224 -0
  5. package/dist/composables/stonecrop.js +504 -0
  6. package/dist/composables/use-lazy-link-state.js +125 -0
  7. package/dist/composables/use-stonecrop.js +476 -0
  8. package/dist/doctype.js +242 -0
  9. package/dist/exceptions.js +16 -0
  10. package/dist/field-triggers.js +575 -0
  11. package/dist/index.js +27 -0
  12. package/dist/operation-log-DB-dGNT9.js +593 -0
  13. package/dist/operation-log-DB-dGNT9.js.map +1 -0
  14. package/dist/plugins/index.js +99 -0
  15. package/dist/registry.js +423 -0
  16. package/dist/schema-validator.js +407 -0
  17. package/dist/src/composable.d.ts +11 -0
  18. package/dist/src/composable.d.ts.map +1 -0
  19. package/dist/src/composable.js +477 -0
  20. package/dist/src/composables/use-lazy-link-state.d.ts +25 -0
  21. package/dist/src/composables/use-lazy-link-state.d.ts.map +1 -0
  22. package/dist/src/composables/use-stonecrop.d.ts +93 -0
  23. package/dist/src/composables/use-stonecrop.d.ts.map +1 -0
  24. package/dist/src/composables/useNestedSchema.d.ts +110 -0
  25. package/dist/src/composables/useNestedSchema.d.ts.map +1 -0
  26. package/dist/src/composables/useNestedSchema.js +155 -0
  27. package/dist/src/stores/data.d.ts +11 -0
  28. package/dist/src/stores/data.d.ts.map +1 -0
  29. package/dist/src/stores/xstate.d.ts +31 -0
  30. package/dist/src/stores/xstate.d.ts.map +1 -0
  31. package/dist/src/tsdoc-metadata.json +11 -0
  32. package/dist/src/types/doctype.d.ts +0 -2
  33. package/dist/src/types/doctype.d.ts.map +1 -1
  34. package/dist/src/utils.d.ts +24 -0
  35. package/dist/src/utils.d.ts.map +1 -0
  36. package/dist/stonecrop.css +1 -0
  37. package/dist/stonecrop.d.ts +0 -2
  38. package/dist/stonecrop.umd.cjs +6 -0
  39. package/dist/stonecrop.umd.cjs.map +1 -0
  40. package/dist/stores/data.js +7 -0
  41. package/dist/stores/hst.js +496 -0
  42. package/dist/stores/index.js +12 -0
  43. package/dist/stores/operation-log.js +580 -0
  44. package/dist/stores/xstate.js +29 -0
  45. package/dist/tests/setup.d.ts +5 -0
  46. package/dist/tests/setup.d.ts.map +1 -0
  47. package/dist/tests/setup.js +15 -0
  48. package/dist/types/composable.js +0 -0
  49. package/dist/types/doctype.js +0 -0
  50. package/dist/types/field-triggers.js +4 -0
  51. package/dist/types/hst.js +0 -0
  52. package/dist/types/index.js +10 -0
  53. package/dist/types/operation-log.js +0 -0
  54. package/dist/types/plugin.js +0 -0
  55. package/dist/types/registry.js +0 -0
  56. package/dist/types/schema-validator.js +13 -0
  57. package/dist/types/stonecrop.js +0 -0
  58. package/dist/utils.js +46 -0
  59. package/package.json +4 -4
  60. package/src/types/doctype.ts +0 -2
@@ -0,0 +1,110 @@
1
+ import { type Ref } from 'vue';
2
+ import type { SchemaTypes } from '@stonecrop/aform/types';
3
+ /**
4
+ * Registry interface for schema lookup
5
+ * Compatible with Stonecrop Registry but doesn't require it as a dependency
6
+ * @public
7
+ */
8
+ export interface SchemaRegistry {
9
+ /**
10
+ * Map of doctype slugs to their metadata including schema, slug, and doctype name
11
+ */
12
+ registry: Record<string, {
13
+ doctype: string;
14
+ slug: string;
15
+ schema?: SchemaTypes[] | Iterable<SchemaTypes>;
16
+ }>;
17
+ }
18
+ /**
19
+ * Options for useNestedSchema composable
20
+ * @public
21
+ */
22
+ export interface UseNestedSchemaOptions {
23
+ /**
24
+ * The target doctype slug to load schema for
25
+ */
26
+ doctype: string;
27
+ /**
28
+ * Registry instance for schema lookup (optional)
29
+ * If not provided, you must supply schema directly via setSchema
30
+ */
31
+ registry?: SchemaRegistry;
32
+ /**
33
+ * Direct schema array to use instead of loading from registry
34
+ */
35
+ schema?: SchemaTypes[];
36
+ /**
37
+ * Initial data for the nested form
38
+ */
39
+ initialData?: any;
40
+ }
41
+ /**
42
+ * Return type for useNestedSchema composable
43
+ * @public
44
+ */
45
+ export interface UseNestedSchemaReturn {
46
+ /**
47
+ * The loaded/provided nested schema
48
+ */
49
+ schema: Ref<SchemaTypes[] | undefined>;
50
+ /**
51
+ * Error message if schema loading fails
52
+ */
53
+ error: Ref<string | undefined>;
54
+ /**
55
+ * Loading state
56
+ */
57
+ loading: Ref<boolean>;
58
+ /**
59
+ * Initialize empty record data based on schema
60
+ */
61
+ initializeRecord: () => Record<string, any>;
62
+ /**
63
+ * Initialize array of records
64
+ */
65
+ initializeArray: (count: number) => Record<string, any>[];
66
+ /**
67
+ * Manually set schema (useful if not using registry)
68
+ */
69
+ setSchema: (newSchema: SchemaTypes[]) => void;
70
+ /**
71
+ * Load schema from registry
72
+ */
73
+ loadSchema: () => Promise<void>;
74
+ /**
75
+ * Get the doctype name (display name)
76
+ */
77
+ doctypeName: Ref<string>;
78
+ }
79
+ /**
80
+ * Composable for managing nested schema loading and initialization
81
+ *
82
+ * This composable provides utilities for working with nested doctypes in forms
83
+ * without being tightly coupled to Stonecrop or any specific state management solution.
84
+ *
85
+ * **Note:** This composable supports 1:1 nested schemas only. For 1:many relationships,
86
+ * use nested table schemas which provide proper doctype mapping.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * // With Stonecrop registry
91
+ * const { schema, initializeRecord, loadSchema } = useNestedSchema({
92
+ * doctype: 'address',
93
+ * registry: stonecrop.registry,
94
+ * })
95
+ * await loadSchema()
96
+ *
97
+ * // With direct schema
98
+ * const { schema, initializeRecord } = useNestedSchema({
99
+ * doctype: 'address',
100
+ * schema: addressSchema,
101
+ * })
102
+ *
103
+ * // Initialize data
104
+ * const emptyAddress = initializeRecord()
105
+ * ```
106
+ *
107
+ * @internal
108
+ */
109
+ export declare function useNestedSchema(options: UseNestedSchemaOptions): UseNestedSchemaReturn;
110
+ //# sourceMappingURL=useNestedSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNestedSchema.d.ts","sourceRoot":"","sources":["../../../src/composables/useNestedSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,QAAQ,EAAE,MAAM,CACf,MAAM,EACN;QACC,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAA;KAC9C,CACD,CAAA;CACD;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAA;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,GAAG,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,CAAA;IAEtC;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAE9B;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAErB;;OAEG;IACH,gBAAgB,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE3C;;OAEG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;IAEzD;;OAEG;IACH,SAAS,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,IAAI,CAAA;IAE7C;;OAEG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/B;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAwItF"}
@@ -0,0 +1,155 @@
1
+ import { ref } from 'vue';
2
+ /**
3
+ * Composable for managing nested schema loading and initialization
4
+ *
5
+ * This composable provides utilities for working with nested doctypes in forms
6
+ * without being tightly coupled to Stonecrop or any specific state management solution.
7
+ *
8
+ * **Note:** This composable supports 1:1 nested schemas only. For 1:many relationships,
9
+ * use nested table schemas which provide proper doctype mapping.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // With Stonecrop registry
14
+ * const { schema, initializeRecord, loadSchema } = useNestedSchema({
15
+ * doctype: 'address',
16
+ * registry: stonecrop.registry,
17
+ * })
18
+ * await loadSchema()
19
+ *
20
+ * // With direct schema
21
+ * const { schema, initializeRecord } = useNestedSchema({
22
+ * doctype: 'address',
23
+ * schema: addressSchema,
24
+ * })
25
+ *
26
+ * // Initialize data
27
+ * const emptyAddress = initializeRecord()
28
+ * ```
29
+ *
30
+ * @internal
31
+ */
32
+ export function useNestedSchema(options) {
33
+ const schema = ref();
34
+ const error = ref();
35
+ const loading = ref(false);
36
+ const doctypeName = ref(options.doctype);
37
+ // Initialize with provided schema if available
38
+ if (options.schema) {
39
+ schema.value = options.schema;
40
+ }
41
+ // Initialize with provided data if available
42
+ if (options.initialData) {
43
+ // Data is provided externally, composable just manages schema
44
+ }
45
+ /**
46
+ * Load schema from registry
47
+ */
48
+ const loadSchema = async () => {
49
+ if (!options.registry) {
50
+ error.value = 'No registry provided and no schema set directly';
51
+ return;
52
+ }
53
+ loading.value = true;
54
+ error.value = undefined;
55
+ try {
56
+ // Get doctype from registry
57
+ const doctype = options.registry.registry[options.doctype];
58
+ if (!doctype) {
59
+ error.value = `Doctype '${options.doctype}' not found in registry`;
60
+ return;
61
+ }
62
+ doctypeName.value = doctype.doctype;
63
+ // Convert schema to array (handles both arrays and Immutable Lists)
64
+ if (Array.isArray(doctype.schema)) {
65
+ schema.value = doctype.schema;
66
+ }
67
+ else if (doctype.schema && typeof doctype.schema[Symbol.iterator] === 'function') {
68
+ schema.value = Array.from(doctype.schema);
69
+ }
70
+ else {
71
+ error.value = 'Invalid schema format';
72
+ }
73
+ }
74
+ catch (err) {
75
+ error.value = `Failed to load schema: ${err instanceof Error ? err.message : String(err)}`;
76
+ }
77
+ finally {
78
+ loading.value = false;
79
+ }
80
+ };
81
+ /**
82
+ * Manually set schema
83
+ */
84
+ const setSchema = (newSchema) => {
85
+ schema.value = newSchema;
86
+ error.value = undefined;
87
+ };
88
+ /**
89
+ * Initialize empty record based on schema
90
+ */
91
+ const initializeRecord = () => {
92
+ const initialData = {};
93
+ if (!schema.value) {
94
+ return initialData;
95
+ }
96
+ schema.value.forEach(field => {
97
+ const fieldtype = 'fieldtype' in field ? field.fieldtype : 'Data';
98
+ const fieldname = field.fieldname;
99
+ // Provide sensible defaults based on field type
100
+ switch (fieldtype) {
101
+ case 'Data':
102
+ case 'Text':
103
+ initialData[fieldname] = '';
104
+ break;
105
+ case 'Check':
106
+ initialData[fieldname] = false;
107
+ break;
108
+ case 'Int':
109
+ case 'Float':
110
+ case 'Decimal':
111
+ initialData[fieldname] = 0;
112
+ break;
113
+ case 'Doctype':
114
+ // Initialize nested Doctype fields as empty objects (1:1 only)
115
+ initialData[fieldname] = {};
116
+ break;
117
+ case 'JSON':
118
+ initialData[fieldname] = {};
119
+ break;
120
+ case 'Date':
121
+ case 'Time':
122
+ case 'Datetime':
123
+ initialData[fieldname] = null;
124
+ break;
125
+ default:
126
+ initialData[fieldname] = null;
127
+ }
128
+ // Use default value if specified in schema
129
+ if ('default' in field && field.default !== undefined) {
130
+ initialData[fieldname] = field.default;
131
+ }
132
+ });
133
+ return initialData;
134
+ };
135
+ /**
136
+ * Initialize array of records
137
+ */
138
+ const initializeArray = (count) => {
139
+ return Array.from({ length: count }, () => initializeRecord());
140
+ };
141
+ // Auto-load if registry is provided
142
+ if (options.registry && !options.schema) {
143
+ void loadSchema();
144
+ }
145
+ return {
146
+ schema,
147
+ error,
148
+ loading,
149
+ doctypeName,
150
+ initializeRecord,
151
+ initializeArray,
152
+ setSchema,
153
+ loadSchema,
154
+ };
155
+ }
@@ -0,0 +1,11 @@
1
+ export declare const useDataStore: import("pinia").StoreDefinition<"data", Pick<{
2
+ records: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
3
+ record: import("vue").Ref<Record<string, any>, Record<string, any>>;
4
+ }, "records" | "record">, Pick<{
5
+ records: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
6
+ record: import("vue").Ref<Record<string, any>, Record<string, any>>;
7
+ }, never>, Pick<{
8
+ records: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
9
+ record: import("vue").Ref<Record<string, any>, Record<string, any>>;
10
+ }, never>>;
11
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/stores/data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;UAIvB,CAAA"}
@@ -0,0 +1,31 @@
1
+ export declare const counterMachine: import("xstate").StateMachine<{
2
+ count: number;
3
+ }, any, import("xstate").AnyEventObject, {
4
+ value: any;
5
+ context: {
6
+ count: number;
7
+ };
8
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("xstate").AnyEventObject, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
9
+ export declare const useCounterStore: import("pinia").StoreDefinition<string, Pick<import("pinia-xstate").Store<import("xstate").StateMachine<{
10
+ count: number;
11
+ }, any, import("xstate").AnyEventObject, {
12
+ value: any;
13
+ context: {
14
+ count: number;
15
+ };
16
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("xstate").AnyEventObject, import("xstate").BaseActionObject, import("xstate").ServiceMap>>>, "state" | "actor">, Pick<import("pinia-xstate").Store<import("xstate").StateMachine<{
17
+ count: number;
18
+ }, any, import("xstate").AnyEventObject, {
19
+ value: any;
20
+ context: {
21
+ count: number;
22
+ };
23
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("xstate").AnyEventObject, import("xstate").BaseActionObject, import("xstate").ServiceMap>>>, "state">, Pick<import("pinia-xstate").Store<import("xstate").StateMachine<{
24
+ count: number;
25
+ }, any, import("xstate").AnyEventObject, {
26
+ value: any;
27
+ context: {
28
+ count: number;
29
+ };
30
+ }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("xstate").AnyEventObject, import("xstate").BaseActionObject, import("xstate").ServiceMap>>>, "state" | "send">>;
31
+ //# sourceMappingURL=xstate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xstate.d.ts","sourceRoot":"","sources":["../../../src/stores/xstate.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;0OA0B1B,CAAA;AAGD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;+PAAyD,CAAA"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.57.0"
9
+ }
10
+ ]
11
+ }
@@ -40,8 +40,6 @@ export type DoctypeConfig = {
40
40
  name: string;
41
41
  /** URL-friendly slug (kebab-case) */
42
42
  slug?: string;
43
- /** Database table name */
44
- tableName?: string;
45
43
  /** Field definitions (including link fields with fieldtype: 'Link') */
46
44
  fields?: (SchemaTypes | FieldMeta)[];
47
45
  /** Relationship links to other doctypes */
@@ -1 +1 @@
1
- {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../../src/types/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAChD,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,CAAA;IACpC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACvC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,YAAY,CAAA;IAC9C,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
1
+ {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../../src/types/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAChD,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,CAAA;IACpC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACvC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,YAAY,CAAA;IAC9C,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { type SchemaTypes } from '@stonecrop/aform';
2
+ import type { HSTNode } from './stores/hst';
3
+ /**
4
+ * Recursively collect nested data from HST using pre-resolved schemas.
5
+ *
6
+ * Walks through a resolved schema and collects all values from the HST store,
7
+ * including nested 1:1 Doctype fields and 1:many child arrays.
8
+ *
9
+ * @param resolvedSchema - The already-resolved schema (with nested schemas embedded)
10
+ * @param basePath - The base path in HST (e.g., "customer.123.address")
11
+ * @param hstStore - The HST store instance
12
+ * @returns The collected data object with all nested fields
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const addressSchema = registry.resolveSchema(addressDoctype.schema)
17
+ * const addressData = collectNestedData(addressSchema, 'customer.123.address', hstStore)
18
+ * // Returns: { street: '123 Main St', city: 'Portland', ... }
19
+ * ```
20
+ *
21
+ * @public
22
+ */
23
+ export declare function collectNestedData(resolvedSchema: SchemaTypes[], basePath: string, hstStore: HSTNode): Record<string, unknown>;
24
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,WAAW,EAEhB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAChC,cAAc,EAAE,WAAW,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkCzB"}
@@ -0,0 +1 @@
1
+ @import"https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400..700;1,400..700&display=swap";.atable-cell{border-radius:0;box-sizing:border-box;outline:none;box-shadow:none;color:var(--sc-cell-text-color);padding-left:.5ch!important;padding-right:.5ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);border-spacing:0px;border-collapse:collapse;overflow:hidden;text-overflow:ellipsis;order:1;white-space:nowrap;max-width:40ch;border-top:1px solid var(--sc-row-border-color);margin:0 0 0 1px}.atable-cell a{color:var(--sc-cell-text-color);text-decoration:none}.atable-cell:focus,.atable-cell:focus-within{background-color:var(--sc-focus-cell-background);outline-width:var(--sc-atable-cell-border-width);outline-style:solid;outline-offset:calc(var(--sc-atable-cell-border-width) * -1);outline-color:var(--sc-focus-cell-outline);box-shadow:none;overflow:hidden;text-wrap:nowrap;box-sizing:border-box}.cell-modified{font-weight:700;font-style:italic}.cell-modified-highlight{background-color:var(--sc-cell-changed-color)}.row-index{color:var(--sc-header-text-color);font-weight:700;text-align:center;-webkit-user-select:none;user-select:none;width:2ch;display:flex;align-items:center;justify-content:center}.expandable-row{border-top:1px solid var(--sc-row-border-color);height:var(--sc-atable-row-height)}.expandable-row>td:first-child{border-left:4px solid var(--sc-row-border-color)}.expanded-row{border-left:2px solid var(--sc-row-border-color)}.expandable-row:last-child{border-bottom:1px solid var(--sc-row-border-color)}.expanded-row-content{border-top:1px solid var(--sc-row-border-color);padding:1.5rem}.expandable-row.changed-row-gradient[data-v-a42297c7]:has(td.cell-modified){--cell-color-start: color-mix(in srgb, var(--sc-cell-changed-color), #fff 20%);--cell-color-end: color-mix(in srgb, var(--sc-cell-changed-color), #fff 60%);background:linear-gradient(90deg,var(--cell-color-start),var(--cell-color-end))}.aganttcell[data-v-c2df3f52]{background-color:#f9f9f9;width:100%;padding:0;height:100%}.gantt-container[data-v-c2df3f52]{position:relative;height:100%;background-color:#f0f0f0;border-radius:4px;overflow:visible}.gantt-bar[data-v-c2df3f52]{position:absolute;border-radius:4px;display:flex;align-items:center;justify-content:space-between;cursor:grab;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);transition:left .1s ease-out,width .1s ease-out;height:80%;top:50%;z-index:0;transform:translateY(-50%)}.gantt-bar[data-v-c2df3f52]:active{cursor:grabbing}.gantt-bar.is-dragging[data-v-c2df3f52]{z-index:10}.gantt-label[data-v-c2df3f52]{flex:1;text-align:center;font-size:12px;color:#aaa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 8px;-webkit-user-select:none;user-select:none}.resize-handle[data-v-c2df3f52]{position:relative;width:12px;height:100%;cursor:ew-resize;display:flex;align-items:center;justify-content:center;z-index:0;background:#00000040}.left-resize-handle[data-v-c2df3f52]{border-right:1px solid rgba(0,0,0,.5)}.right-resize-handle[data-v-c2df3f52]{border-left:1px solid rgba(0,0,0,.5)}.handle-grip[data-v-c2df3f52]{width:4px;height:12px;border-radius:2px;background:#000c}.resize-handle[data-v-c2df3f52]:hover{background-color:#ffffff80}.vertical-indicator[data-v-c2df3f52]{position:absolute;width:2px;opacity:0;pointer-events:none;transition:opacity .2s ease;top:-100vh;height:100vh;z-index:5;background-color:var(--v737862e7)}.left-indicator[data-v-c2df3f52]{left:50%;transform:translate(-50%)}.right-indicator[data-v-c2df3f52]{right:50%;transform:translate(50%)}.resize-handle.is-dragging .vertical-indicator[data-v-c2df3f52]{opacity:.7}.gantt-container[data-v-c2df3f52]:after{content:"";position:absolute;inset:0;background-size:calc(100% / var(--v05f25613)) 100%;background-image:linear-gradient(to right,rgba(0,0,0,.1) 1px,transparent 1px);pointer-events:none;z-index:1}.connection-handle[data-v-c2df3f52]{position:absolute;top:50%;transform:translateY(-50%);width:16px;height:16px;opacity:0;transition:opacity .2s ease;cursor:crosshair;z-index:2;display:flex;align-items:center;justify-content:center}.connection-handle.visible[data-v-c2df3f52]{opacity:1}.left-connection-handle[data-v-c2df3f52]{left:-16px}.right-connection-handle[data-v-c2df3f52]{right:-16px}.connection-dot[data-v-c2df3f52]{width:8px;height:8px;border-radius:50%;background-color:#2196f3;border:2px solid white;box-shadow:0 1px 3px #0000004d}.connection-handle:hover .connection-dot[data-v-c2df3f52]{background-color:#1976d2;transform:scale(1.2)}.connection-handle.is-dragging[data-v-c2df3f52]{opacity:1!important}.connection-handle.is-dragging .connection-dot[data-v-c2df3f52]{background-color:#1976d2;transform:scale(1.3);box-shadow:0 2px 8px #2196f366}.atable-row-actions{width:2rem;min-width:2rem;padding:0 .25rem;vertical-align:middle;white-space:nowrap;border-top:1px solid var(--sc-row-border-color);background:#fff;-webkit-user-select:none;user-select:none;position:relative}.atable-row-actions.dropdown-active{z-index:101}.row-actions-icons{display:flex;gap:.25rem;align-items:center;justify-content:center}.row-action-btn{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.125rem;border:none;background:transparent;cursor:pointer;border-radius:.25rem;transition:background-color .15s ease}.row-action-btn:hover{background-color:var(--sc-gray-10, #e5e5e5)}.row-action-btn:focus{outline:2px solid var(--sc-focus-cell-outline, #3b82f6);outline-offset:1px}.row-action-btn .action-icon{display:flex;align-items:center;justify-content:center;width:1rem;height:1rem}.row-action-btn .action-icon :deep(svg){width:100%;height:100%}.row-actions-dropdown{position:relative;display:inline-block}.row-actions-dropdown:has(button:focus){outline:2px solid var(--sc-focus-cell-outline);outline-offset:-2px}.row-actions-toggle{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:none;background:transparent;cursor:pointer;border-radius:.25rem;font-size:1rem;font-weight:700;transition:background-color .15s ease}.row-actions-toggle:hover{background-color:var(--sc-gray-10, #e5e5e5)}.dropdown-icon{line-height:1}.row-actions-menu{position:fixed;z-index:100;min-width:10rem;padding:.25rem 0;background:#fff;border:1px solid var(--sc-row-border-color);border-left:4px solid var(--sc-row-border-color);border-radius:0}.row-actions-menu.menu-flipped{box-shadow:0 -4px 6px -1px #0000001a,0 -2px 4px -2px #0000001a}.row-action-menu-item{display:flex;align-items:center;gap:.5rem;width:100%;padding:.5rem .75rem;border:none;background:transparent;cursor:pointer;text-align:left;font-size:.875rem;transition:background-color .15s ease}.row-action-menu-item:hover{background-color:var(--sc-gray-10, #f5f5f5)}.row-action-menu-item:focus{outline:none;background-color:var(--sc-gray-10, #f5f5f5)}.row-action-menu-item .action-icon{display:flex;align-items:center;justify-content:center;width:1rem;height:1rem;flex-shrink:0}.row-action-menu-item .action-icon :deep(svg){width:100%;height:100%}.row-action-menu-item .action-label{flex:1}.atable-row{background-color:#fff}.atable-row:last-child>td{border-bottom:1px solid var(--sc-row-border-color)}.atable-row>td:first-child{border-left:4px solid var(--sc-row-border-color)}.atable-row>td:last-child{border-right:1px solid var(--sc-row-border-color)}.list-index{color:var(--sc-header-text-color);font-weight:700;padding-left:var(--sc-atable-row-padding);padding-right:.5em;text-align:left;-webkit-user-select:none;user-select:none;border-top:1px solid var(--sc-row-border-color);text-overflow:ellipsis;overflow:hidden;box-sizing:border-box;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding)}.tree-index{color:var(--sc-header-text-color);font-weight:700;text-align:center;-webkit-user-select:none;user-select:none;width:2ch;box-sizing:border-box;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding)}.atable-row:has(td.cell-modified)>td.sticky-column,.atable-row:has(td.cell-modified)>th.sticky-column,.atable-row:has(td.cell-modified)>td.sticky-index,.atable-row:has(td.cell-modified)>th.sticky-index{background:var(--sc-cell-changed-color)}.atable-row.changed-row-gradient[data-v-2e038a9c]:has(td.cell-modified){--cell-color-start: color-mix(in srgb, var(--sc-cell-changed-color), #fff 20%);--cell-color-end: color-mix(in srgb, var(--sc-cell-changed-color), #fff 60%);background:linear-gradient(90deg,var(--cell-color-start),var(--cell-color-end))}.gantt-connection-overlay[data-v-d5929c98]{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:15}.connection-path[data-v-d5929c98]{transition:stroke-width .2s ease;pointer-events:auto;cursor:pointer;stroke-dasharray:5px;stroke:var(--sc-cell-text-color)}#arrowhead-marker polygon[data-v-d5929c98]{fill:var(--sc-cell-text-color)}.animated-path[data-v-d5929c98]{animation:animated-dash-d5929c98 infinite 1.5s linear}.connection-path[data-v-d5929c98]:hover{stroke-width:3px}.connection-hitbox[data-v-d5929c98]{pointer-events:auto;cursor:pointer}@keyframes animated-dash-d5929c98{0%{stroke-dashoffset:0px}to{stroke-dashoffset:-10px}}.column-filter[data-v-8487462d]{display:flex;align-items:center;gap:.25rem;width:100%}.filter-input[data-v-8487462d],.filter-select[data-v-8487462d]{background-color:var(--sc-form-background)!important;padding:.15rem .2rem;border:1px solid var(--sc-form-border);border-radius:3px;font-size:.875rem;color:var(--sc-text-color);width:100%;box-sizing:border-box}.filter-input[data-v-8487462d]:focus,.filter-select[data-v-8487462d]:focus{outline:none;border-color:var(--sc-input-active-border-color)}.checkbox-filter[data-v-8487462d]{display:flex;align-items:center;gap:.25rem;font-size:.875rem;color:var(--sc-text-color);cursor:pointer}.filter-checkbox[data-v-8487462d]{margin:0}.date-range-filter[data-v-8487462d]{display:flex;gap:.25rem;align-items:center;width:100%}.date-range-filter .filter-input[data-v-8487462d]{flex:1;min-width:0}.date-separator[data-v-8487462d]{color:var(--sc-gray-50);font-weight:500;padding:0 .25rem;flex-shrink:0}.clear-btn[data-v-8487462d]{background:var(--sc-gray-10, #f0f0f0);border:1px solid var(--sc-form-border);border-radius:3px;color:var(--sc-gray-70);cursor:pointer;font-size:1rem;padding:.15rem .4rem;line-height:1;flex-shrink:0}.atable-header-row th{padding-left:.5ch!important;font-weight:700;min-width:3ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);box-sizing:border-box;color:var(--sc-header-text-color);position:relative}#header-index{padding-left:var(--sc-atable-row-padding);box-sizing:border-box;border-top:none}.tree-index{padding-right:0}th{order:1}.list-expansion-index{width:2ch;margin-left:5px}.cursor-pointer{cursor:pointer}.atable-filters-row th{padding:.25rem .5ch;vertical-align:top}.row-actions-header{width:2rem;min-width:2rem;padding:0 .25rem}:root{--sc-primary-color: #0098c9;--sc-primary-text-color: #ffffff;--sc-brand-color: #202a44;--sc-gray-5: #f2f2f2;--sc-gray-10: #e6e6e6;--sc-gray-20: #cccccc;--sc-gray-50: #808080;--sc-gray-60: #666666;--sc-gray-80: #333333;--sc-brand-danger: #e63c28;--sc-brand-success: #155724;--sc-brand-warning: #b99d3e;--sc-active-cell-background: #ffffff;--sc-active-cell-outline: #e6a92d;--sc-cell-border-color: #ffffff;--sc-cell-text-color: #3a3c41;--sc-focus-cell-background: #ffffff;--sc-focus-cell-outline: #000000;--sc-header-border-color: #ffffff;--sc-header-text-color: var(--sc-gray-20);--sc-row-border-color: var(--sc-gray-20);--sc-row-color-zebra-dark: #dddddd;--sc-row-color-zebra-light: #eeeeee;--sc-row-number-background-color: #ffffff;--sc-input-active-border-color: #000000;--sc-input-active-label-color: #000000;--sc-input-border-color: var(--sc-gray-20);--sc-input-label-color: var(--sc-gray-60);--sc-required-border: #e63c28;--sc-cell-changed-color: #d8edff;--sc-form-border: var(--sc-gray-5);--sc-form-background: #ffffff;--sc-input-field-background: #ffffff;--sc-input-field-disabled-background: var(--sc-gray-5);--sc-font-size: 10px;--sc-font-family: Arimo, Arial, sans-serif;--sc-table-font-size: 16px;--sc-atable-font-family: "Arimo", sans-serif;--sc-atable-row-padding: .125rem;--sc-atable-row-height: 1.5em;--sc-atable-cell-border-width: 2px;--sc-table-loading-color: 204, 204, 204;--sc-btn-border: #cccccc;--sc-btn-color: white;--sc-btn-hover: #f2f2f2;--sc-btn-label-color: black}.amodal{position:absolute;background-color:var(--sc-row-color-zebra-dark);z-index:200}.atable-container{position:relative}.sticky-index{position:sticky;left:0;z-index:100;order:0}.sticky-column,th.sticky-column,td.sticky-column,th.sticky-index,td.sticky-index{position:sticky;z-index:100;order:0;background:#fff}.sticky-column-edge,.atable th.sticky-column-edge{border-right:1px solid var(--sc-row-border-color)}[data-v-56d7171c]:root{--sc-primary-color: #0098c9;--sc-primary-text-color: #ffffff;--sc-brand-color: #202a44;--sc-gray-5: #f2f2f2;--sc-gray-10: #e6e6e6;--sc-gray-20: #cccccc;--sc-gray-50: #808080;--sc-gray-60: #666666;--sc-gray-80: #333333;--sc-brand-danger: #e63c28;--sc-brand-success: #155724;--sc-brand-warning: #b99d3e;--sc-active-cell-background: #ffffff;--sc-active-cell-outline: #e6a92d;--sc-cell-border-color: #ffffff;--sc-cell-text-color: #3a3c41;--sc-focus-cell-background: #ffffff;--sc-focus-cell-outline: #000000;--sc-header-border-color: #ffffff;--sc-header-text-color: var(--sc-gray-20);--sc-row-border-color: var(--sc-gray-20);--sc-row-color-zebra-dark: #dddddd;--sc-row-color-zebra-light: #eeeeee;--sc-row-number-background-color: #ffffff;--sc-input-active-border-color: #000000;--sc-input-active-label-color: #000000;--sc-input-border-color: var(--sc-gray-20);--sc-input-label-color: var(--sc-gray-60);--sc-required-border: #e63c28;--sc-cell-changed-color: #d8edff;--sc-form-border: var(--sc-gray-5);--sc-form-background: #ffffff;--sc-input-field-background: #ffffff;--sc-input-field-disabled-background: var(--sc-gray-5);--sc-font-size: 10px;--sc-font-family: Arimo, Arial, sans-serif;--sc-table-font-size: 16px;--sc-atable-font-family: "Arimo", sans-serif;--sc-atable-row-padding: .125rem;--sc-atable-row-height: 1.5em;--sc-atable-cell-border-width: 2px;--sc-table-loading-color: 204, 204, 204;--sc-btn-border: #cccccc;--sc-btn-color: white;--sc-btn-hover: #f2f2f2;--sc-btn-label-color: black}.atable[data-v-56d7171c]{position:relative;font-family:var(--sc-atable-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:var(--sc-table-font-size);border-collapse:collapse;box-sizing:border-box;table-layout:auto;width:auto;overflow:clip;height:1px}.atable th[data-v-56d7171c]{border-width:0px;border-style:solid;border-radius:0;padding-left:.5ch;padding-right:.5ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);color:var(--sc-gray-60);height:var(--sc-atable-row-height);font-weight:300;letter-spacing:.05rem;order:1;box-sizing:border-box}.atable th[data-v-56d7171c]:focus{outline:none}.atable[data-v-56d7171c]:tbody{overflow:hidden;position:relative}.atable[data-v-56d7171c]:tbody:before{content:"";position:absolute;top:0;left:0;right:0;height:1px;background-color:transparent;z-index:100}.aloading[data-v-a930a25b]{width:100%;border-top:1px solid var(--sc-row-border-color);border-bottom:1px solid var(--sc-row-border-color);display:flex;background-color:#fff;border-left:4px solid var(--sc-row-border-color);padding-left:.5ch!important;padding-right:.5ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);align-items:center;box-sizing:border-box;background:var(--sc-focus-cell-background);overflow:hidden;position:relative}.aloading-bar[data-v-a930a25b]{width:100%;height:100%;position:absolute;left:-100%;top:0;background:linear-gradient(90deg,rgba(var(--sc-table-loading-color),0),rgba(var(--sc-table-loading-color),1),rgba(var(--sc-table-loading-color),0));animation:gradient-a930a25b infinite 2s;z-index:0}.aloading-header[data-v-a930a25b]{color:var(--sc-cell-text-color);font-family:var(--sc-atable-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:var(--sc-table-font-size);padding:0;margin:0;font-weight:400;z-index:1}.aloading-header[data-v-a930a25b]:after{content:"...";animation:ellipse-a930a25b 2s;animation-iteration-count:infinite}@keyframes gradient-a930a25b{0%{left:-100%}to{left:100%}}@keyframes ellipse-a930a25b{0%{content:""}20%{content:""}40%{content:"."}60%{content:".."}80%{content:"..."}}.aloading[data-v-e1165876]{width:100%;border-top:1px solid var(--sc-row-border-color);border-bottom:1px solid var(--sc-row-border-color);display:flex;background-color:#fff;border-left:4px solid var(--sc-row-border-color);padding-left:.5ch!important;padding-right:.5ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);align-items:center;box-sizing:border-box;background:var(--sc-focus-cell-background);overflow:hidden;position:relative}.aloading-bar[data-v-e1165876]{width:50%;height:3px;position:absolute;left:-100%;bottom:0;background:var(--sc-row-border-color);animation:bar-left-e1165876 infinite 2s;z-index:0}.aloading-header[data-v-e1165876]{color:var(--sc-cell-text-color);font-family:var(--sc-atable-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:var(--sc-table-font-size);padding:0;margin:0;font-weight:400;z-index:1}.aloading-header[data-v-e1165876]:after{content:"...";animation:ellipse-e1165876 2s;animation-iteration-count:infinite}@keyframes bar-left-e1165876{0%{left:-50%}to{left:100%}}@keyframes ellipse-e1165876{0%{content:""}20%{content:""}40%{content:"."}60%{content:".."}80%{content:"..."}}.aform_checkbox[data-v-cc185b72]{cursor:pointer;width:auto;margin-top:0;display:block}.aform_checkbox[data-v-cc185b72]:checked{accent-color:var(--sc-primary-color);border:1px solid black}.aform_checkbox-container[data-v-cc185b72]{width:100%;display:inline-block;text-align:left}.aform_checkbox-container input[data-v-cc185b72]{width:auto}.aform_checkbox-container:hover+.aform_field-label[data-v-cc185b72]{color:var(--sc-input-active-label-color)}div[data-v-8e467bb3]{min-width:40ch;width:100%;box-sizing:border-box;border:1px solid transparent;padding:0rem;margin:0rem;margin-right:1ch}input[data-v-8e467bb3]{width:calc(100% - 1ch);box-sizing:border-box;outline:1px solid transparent;border:1px solid var(--sc-input-border-color);padding:1ch .5ch .5ch 1ch;margin:.575rem 0 0;min-height:1.15rem;border-radius:.25rem}p[data-v-8e467bb3],label[data-v-8e467bb3]{color:var(--sc-input-label-color);display:block;min-height:1.15rem;padding:0rem;margin:0rem 0rem .25rem;border:1px solid transparent;box-sizing:border-box}p[data-v-8e467bb3]{width:100%;color:red;font-size:85%;box-sizing:border-box}label[data-v-8e467bb3]{z-index:0;font-size:80%;position:absolute;background:#fff;margin:-2.575rem 0 0 1ch;padding:0 .25ch;box-sizing:border-box}input[data-v-8e467bb3]:focus{border:1px solid var(--sc-input-active-border-color)}input:focus+label[data-v-8e467bb3]{color:var(--sc-input-active-label-color)}.autocomplete[data-v-c823d475]{position:relative}.input-wrapper[data-v-c823d475]{border:1px solid transparent;padding:0rem;margin:0rem;margin-right:1ch}input[data-v-c823d475]{width:calc(100% - 1ch);outline:1px solid transparent;border:1px solid var(--sc-input-border-color);padding:1ch .5ch .5ch 1ch;margin:.575rem 0 0;min-height:1.15rem;border-radius:.25rem}input[data-v-c823d475]:focus{border:1px solid var(--sc-input-active-border-color);border-radius:.25rem .25rem 0 0;border-bottom:none}label[data-v-c823d475]{display:block;min-height:1.15rem;padding:0rem;margin:0rem 0rem .25rem;border:1px solid transparent;z-index:0;font-size:80%;position:absolute;background:#fff;margin:-2.575rem 0 0 1ch;padding:0 .25ch}.autocomplete-results[data-v-c823d475]{position:absolute;width:calc(100% - 1ch + 1.5px);z-index:100;padding:0;margin:0;color:var(--sc-input-active-border-color);border:1px solid var(--sc-input-active-border-color);border-radius:0 0 .25rem .25rem;border-top:none;background-color:#fff}.autocomplete-result[data-v-c823d475]{list-style:none;text-align:left;padding:4px 6px;cursor:pointer;border-bottom:.5px solid lightgray}.autocomplete-result.is-active[data-v-c823d475],.autocomplete-result[data-v-c823d475]:hover{background-color:var(--sc-row-color-zebra-light);color:var(--sc-input-active-border-color)}.adatepicker[data-v-9da05d06]{font-size:var(--sc-table-font-size);display:inline-table;color:var(--sc-cell-text-color);outline:none;border-collapse:collapse}.adatepicker tr[data-v-9da05d06]{height:1.15rem;text-align:center;vertical-align:middle}.adatepicker td[data-v-9da05d06]{border:2px solid transparent;outline:2px solid transparent;min-width:3ch;max-width:3ch}.adatepicker td[data-v-9da05d06]:focus,.adatepicker td[data-v-9da05d06]:focus-within{outline:1px dashed black;box-shadow:none;min-height:1.15em;max-height:1.15em;overflow:hidden}.adatepicker .selectedDate[data-v-9da05d06]{outline:1px solid black;background:var(--sc-gray-20);font-weight:bolder}.adatepicker .todaysDate[data-v-9da05d06]{font-weight:bolder;text-decoration:underline;color:#000}.days-header>td[data-v-9da05d06]{font-weight:700}.prev-date[data-v-9da05d06]{color:var(--sc-gray-20)}.collapse-button[data-v-6f1c1b45]{width:2ch;min-width:calc(66px - 4ch);background-color:transparent;font-size:150%;text-align:center;border:none;margin-top:-.5rem}.rotated[data-v-6f1c1b45]{transform:rotate(45deg);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transition:transform .25s;transform-origin:center center}.unrotated[data-v-6f1c1b45]{transform:rotate(0);-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transition:transform .25s}.aform_form-element{padding:0;margin:0;position:relative;box-sizing:border-box;flex-grow:1;min-width:20ch;margin-bottom:1rem}.aform_input-field{outline:1px solid var(--sc-input-border-color);outline-offset:-1px;font-size:1rem;padding:.5rem;margin:0;border-radius:0;box-sizing:border-box;width:100%;min-height:auto;position:relative;color:var(--sc-cell-text-color);background:var(--sc-input-field-background)}.aform_input-field:focus{outline:1px solid var(--sc-input-active-border-color)}.aform_display-value{display:block;padding:.5rem;min-height:2rem;color:var(--sc-cell-text-color);word-break:break-word}.aform_input-field:focus+.aform_field-label{color:var(--sc-input-active-label-color)}.aform_field-label{color:var(--sc-input-label-color);display:inline-block;position:absolute;padding:0 .25rem;margin:0rem;z-index:1;font-size:.7rem;font-weight:300;letter-spacing:.05rem;background:linear-gradient(var(--sc-form-background) 50%,var(--sc-input-field-background) 50%);width:auto;box-sizing:border-box;background:#fff;margin:0;grid-row:1;top:0;left:10px;border:none;line-height:0;transform:translateY(-50%)}.aform_input-field:disabled{background:var(--sc-input-field-disabled-background)}.aform_input-field:disabled+.aform_field-label{background:linear-gradient(var(--sc-form-background) 50%,var(--sc-input-field-disabled-background) 50%)}.aform_input-field:disabled~p.aform_error{background:linear-gradient(var(--sc-form-background) 50%,var(--sc-input-field-disabled-background) 50%)}.aform_field-label:after{margin:0;padding:0;box-sizing:border-box;content:"";line-height:normal}p.aform_error{display:block;display:inline-block;display:none;background:linear-gradient(var(--sc-form-background) 50%,var(--sc-input-field-background) 50%);padding:0 .25rem;margin:0rem;width:auto;color:var(--sc-brand-danger);font-size:.7rem;position:absolute;right:0;top:0;line-height:0;background:#fff;padding:.25rem;transform:translate(-1rem,-50%);margin:0}.aform[data-v-969d8869]{display:flex;flex-wrap:wrap;gap:1rem;padding:1rem;border:1px solid var(--sc-form-border);border-left:4px solid var(--sc-form-border);margin-bottom:1rem;max-width:100%}@media screen and (max-width:400px){.aform[data-v-969d8869]{flex-direction:column}}.aform-nested-section[data-v-969d8869]{width:100%;padding:.5rem 0}.aform-nested-label[data-v-969d8869]{font-size:.9rem;font-weight:600;margin:0 0 .5rem;color:var(--sc-input-label-color, #666)}.aform-nested-section .aform[data-v-969d8869]{border-left-width:2px;margin-left:.5rem}fieldset[data-v-a3606386]{max-width:100%;width:100%;margin-right:2ch;border:1px solid transparent;border-bottom:1px solid var(--sc-gray-50)}legend[data-v-a3606386]{width:100%;height:1.15rem;border:1px solid transparent;padding-bottom:.5rem;font-size:110%;font-weight:600;-webkit-user-select:none;user-select:none}.collapse-button[data-v-a3606386]{float:right}.aform_file-attach[data-v-6543d39a]{padding:1rem;display:flex;flex-wrap:wrap;gap:1rem;flex-direction:row;justify-content:center;align-items:center;border:1px dashed var(--sc-input-border-color);width:100%}@media screen and (max-width:400px){.aform_file-attach>.aform_form-btn[data-v-6543d39a]{width:100%}}.aform_file-attach-feedback[data-v-6543d39a]{color:var(--sc-input-label-color);width:100%;padding:.5rem;text-align:center;align-self:center}.aform_file-attach-feedback>li[data-v-6543d39a]{list-style:none;font-style:italic}.aform_file-attach-feedback>p[data-v-6543d39a]{margin-top:0}.aform_form-btn[data-v-6543d39a]{padding:.5rem 2rem;width:auto;border:1px solid var(--sc-input-border-color);color:var(--sc-input-label-color);cursor:pointer;background-color:#fff}.aform_form-btn[data-v-6543d39a]:disabled{background-color:var(--sc-gray-5)}.login-container[data-v-d9ffd0a7]{width:100%;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:var(--sc-font-family)}.account-container[data-v-d9ffd0a7]{width:100%;margin-left:auto;margin-top:.5rem;margin-right:auto;display:flex;flex-direction:column;justify-content:center}.account-header[data-v-d9ffd0a7]{display:flex;flex-direction:column;text-align:center;margin-top:.5rem}#account-title[data-v-d9ffd0a7]{font-size:1.5rem;line-height:2rem;font-weight:600;letter-spacing:-.025em;margin:0}#account-subtitle[data-v-d9ffd0a7]{font-size:.875rem;line-height:1.25rem;margin:1rem}.login-form-container[data-v-d9ffd0a7]{display:grid;gap:.5rem}.login-form-element[data-v-d9ffd0a7]{display:grid;margin:.5rem 0;position:relative}.login-field[data-v-d9ffd0a7]{padding:.5rem .25rem .25rem .5rem;outline:1px solid transparent;border:1px solid var(--sc-input-border-color);border-radius:.25rem}.login-field[data-v-d9ffd0a7]:focus{border:1px solid black}.btn[data-v-d9ffd0a7]{background-color:var(--sc-btn-color);color:var(--sc-btn-label-color);border:1px solid var(--sc-btn-border);margin:.5rem 0;padding:.25rem;position:relative;cursor:pointer}.btn[data-v-d9ffd0a7]:hover{background-color:var(--sc-btn-hover)}.btn[data-v-d9ffd0a7]:disabled{background-color:var(--sc-input-field-disabled-background)}.disabled[data-v-d9ffd0a7]{opacity:.5}.loading-icon[data-v-d9ffd0a7]{animation:spin-d9ffd0a7 1s linear infinite forwards;display:inline-block;margin-right:.2rem;line-height:0;font-size:1rem;position:relative;top:.2rem}@keyframes spin-d9ffd0a7{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
@@ -318,8 +318,6 @@ export declare type DoctypeConfig = {
318
318
  name: string;
319
319
  /** URL-friendly slug (kebab-case) */
320
320
  slug?: string;
321
- /** Database table name */
322
- tableName?: string;
323
321
  /** Field definitions (including link fields with fieldtype: 'Link') */
324
322
  fields?: (SchemaTypes | FieldMeta)[];
325
323
  /** Relationship links to other doctypes */
@@ -0,0 +1,6 @@
1
+ (function(I,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(I=typeof globalThis<"u"?globalThis:I||self,a(I["@stonecrop/stonecrop"]={},I.Vue))})(this,(function(I,a){"use strict";const Y=typeof window<"u";let J;const ae=n=>J=n;process.env.NODE_ENV;const de=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();function G(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var oe;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(oe||(oe={}));function we(n,e){for(const t in e){const r=e[t];if(!(t in n))continue;const o=n[t];G(o)&&G(r)&&!a.isRef(r)&&!a.isReactive(r)?n[t]=we(o,r):n[t]=r}return n}const Ee=()=>{};function Re(n,e,t,r=Ee){n.add(e);const o=()=>{n.delete(e)&&r()};return!t&&a.getCurrentScope()&&a.onScopeDispose(o),o}function X(n,...e){n.forEach(t=>{t(...e)})}const Fe=n=>n(),Oe=Symbol(),pe=Symbol();function he(n,e){n instanceof Map&&e instanceof Map?e.forEach((t,r)=>n.set(r,t)):n instanceof Set&&e instanceof Set&&e.forEach(n.add,n);for(const t in e){if(!e.hasOwnProperty(t))continue;const r=e[t],o=n[t];G(o)&&G(r)&&n.hasOwnProperty(t)&&!a.isRef(r)&&!a.isReactive(r)?n[t]=he(o,r):n[t]=r}return n}const xe=process.env.NODE_ENV!=="production"?Symbol("pinia:skipHydration"):Symbol();function je(n){return!G(n)||!Object.prototype.hasOwnProperty.call(n,xe)}const{assign:H}=Object;function Ae(n){return!!(a.isRef(n)&&n.effect)}function Pe(n,e,t,r){const{state:o,actions:s,getters:i}=e,c=t.state.value[n];let l;function d(){!c&&(process.env.NODE_ENV==="production"||!r)&&(t.state.value[n]=o?o():{});const m=process.env.NODE_ENV!=="production"&&r?a.toRefs(a.ref(o?o():{}).value):a.toRefs(t.state.value[n]);return H(m,s,Object.keys(i||{}).reduce((w,P)=>(process.env.NODE_ENV!=="production"&&P in m&&console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${P}" in store "${n}".`),w[P]=a.markRaw(a.computed(()=>{ae(t);const $=t._s.get(n);return i[P].call($,$)})),w),{}))}return l=ge(n,d,e,t,r,!0),l}function ge(n,e,t={},r,o,s){let i;const c=H({actions:{}},t);if(process.env.NODE_ENV!=="production"&&!r._e.active)throw new Error("Pinia destroyed");const l={deep:!0};process.env.NODE_ENV!=="production"&&(l.onTrigger=p=>{d?$=p:d==!1&&!y._hotUpdating&&(Array.isArray($)?$.push(p):console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."))});let d,m,w=new Set,P=new Set,$;const L=r.state.value[n];!s&&!L&&(process.env.NODE_ENV==="production"||!o)&&(r.state.value[n]={});const x=a.ref({});let _;function D(p){let h;d=m=!1,process.env.NODE_ENV!=="production"&&($=[]),typeof p=="function"?(p(r.state.value[n]),h={type:oe.patchFunction,storeId:n,events:$}):(he(r.state.value[n],p),h={type:oe.patchObject,payload:p,storeId:n,events:$});const A=_=Symbol();a.nextTick().then(()=>{_===A&&(d=!0)}),m=!0,X(w,h,r.state.value[n])}const N=s?function(){const{state:h}=t,A=h?h():{};this.$patch(B=>{H(B,A)})}:process.env.NODE_ENV!=="production"?()=>{throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`)}:Ee;function b(){i.stop(),w.clear(),P.clear(),r._s.delete(n)}const V=(p,h="")=>{if(Oe in p)return p[pe]=h,p;const A=function(){ae(r);const B=Array.from(arguments),E=new Set,C=new Set;function M(S){E.add(S)}function v(S){C.add(S)}X(P,{args:B,name:A[pe],store:y,after:M,onError:v});let R;try{R=p.apply(this&&this.$id===n?this:y,B)}catch(S){throw X(C,S),S}return R instanceof Promise?R.then(S=>(X(E,S),S)).catch(S=>(X(C,S),Promise.reject(S))):(X(E,R),R)};return A[Oe]=!0,A[pe]=h,A},O=a.markRaw({actions:{},getters:{},state:[],hotState:x}),T={_p:r,$id:n,$onAction:Re.bind(null,P),$patch:D,$reset:N,$subscribe(p,h={}){const A=Re(w,p,h.detached,()=>B()),B=i.run(()=>a.watch(()=>r.state.value[n],E=>{(h.flush==="sync"?m:d)&&p({storeId:n,type:oe.direct,events:$},E)},H({},l,h)));return A},$dispose:b},y=a.reactive(process.env.NODE_ENV!=="production"||process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&Y?H({_hmrPayload:O,_customProperties:a.markRaw(new Set)},T):T);r._s.set(n,y);const j=(r._a&&r._a.runWithContext||Fe)(()=>r._e.run(()=>(i=a.effectScope()).run(()=>e({action:V}))));for(const p in j){const h=j[p];if(a.isRef(h)&&!Ae(h)||a.isReactive(h))process.env.NODE_ENV!=="production"&&o?x.value[p]=a.toRef(j,p):s||(L&&je(h)&&(a.isRef(h)?h.value=L[p]:he(h,L[p])),r.state.value[n][p]=h),process.env.NODE_ENV!=="production"&&O.state.push(p);else if(typeof h=="function"){const A=process.env.NODE_ENV!=="production"&&o?h:V(h,p);j[p]=A,process.env.NODE_ENV!=="production"&&(O.actions[p]=h),c.actions[p]=h}else process.env.NODE_ENV!=="production"&&Ae(h)&&(O.getters[p]=s?t.getters[p]:h,Y&&(j._getters||(j._getters=a.markRaw([]))).push(p))}if(H(y,j),H(a.toRaw(y),j),Object.defineProperty(y,"$state",{get:()=>process.env.NODE_ENV!=="production"&&o?x.value:r.state.value[n],set:p=>{if(process.env.NODE_ENV!=="production"&&o)throw new Error("cannot set hotState");D(h=>{H(h,p)})}}),process.env.NODE_ENV!=="production"&&(y._hotUpdate=a.markRaw(p=>{y._hotUpdating=!0,p._hmrPayload.state.forEach(h=>{if(h in y.$state){const A=p.$state[h],B=y.$state[h];typeof A=="object"&&G(A)&&G(B)?we(A,B):p.$state[h]=B}y[h]=a.toRef(p.$state,h)}),Object.keys(y.$state).forEach(h=>{h in p.$state||delete y[h]}),d=!1,m=!1,r.state.value[n]=a.toRef(p._hmrPayload,"hotState"),m=!0,a.nextTick().then(()=>{d=!0});for(const h in p._hmrPayload.actions){const A=p[h];y[h]=V(A,h)}for(const h in p._hmrPayload.getters){const A=p._hmrPayload.getters[h],B=s?a.computed(()=>(ae(r),A.call(y,y))):A;y[h]=B}Object.keys(y._hmrPayload.getters).forEach(h=>{h in p._hmrPayload.getters||delete y[h]}),Object.keys(y._hmrPayload.actions).forEach(h=>{h in p._hmrPayload.actions||delete y[h]}),y._hmrPayload=p._hmrPayload,y._getters=p._getters,y._hotUpdating=!1})),process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&Y){const p={writable:!0,configurable:!0,enumerable:!1};["_p","_hmrPayload","_getters","_customProperties"].forEach(h=>{Object.defineProperty(y,h,H({value:y[h]},p))})}return r._p.forEach(p=>{if(process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&Y){const h=i.run(()=>p({store:y,app:r._a,pinia:r,options:c}));Object.keys(h||{}).forEach(A=>y._customProperties.add(A)),H(y,h)}else H(y,i.run(()=>p({store:y,app:r._a,pinia:r,options:c})))}),process.env.NODE_ENV!=="production"&&y.$state&&typeof y.$state=="object"&&typeof y.$state.constructor=="function"&&!y.$state.constructor.toString().includes("[native code]")&&console.warn(`[🍍]: The "state" must be a plain object. It cannot be
2
+ state: () => new MyClass()
3
+ Found in store "${y.$id}".`),L&&s&&t.hydrate&&t.hydrate(y.$state,L),d=!0,m=!0,y}function Be(n,e,t){let r;const o=typeof e=="function";r=o?t:e;function s(i,c){const l=a.hasInjectionContext();if(i=(process.env.NODE_ENV==="test"&&J&&J._testing?null:i)||(l?a.inject(de,null):null),i&&ae(i),process.env.NODE_ENV!=="production"&&!J)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
4
+ See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
5
+ This will fail in production.`);i=J,i._s.has(n)||(o?ge(n,e,r,i):Pe(n,r,i),process.env.NODE_ENV!=="production"&&(s._pinia=i));const d=i._s.get(n);if(process.env.NODE_ENV!=="production"&&c){const m="__hot:"+n,w=o?ge(m,e,r,i,!0):Pe(m,H({},r),i,!0);c._hotUpdate(w),delete i.state.value[m],i._s.delete(m)}if(process.env.NODE_ENV!=="production"&&Y){const m=a.getCurrentInstance();if(m&&m.proxy&&!c){const w=m.proxy,P="_pStores"in w?w._pStores:w._pStores={};P[n]=d}}return d}return s.$id=n,s}function Ne(n){const e=a.toRaw(n),t={};for(const r in e){const o=e[r];o.effect?t[r]=a.computed({get:()=>n[r],set(s){n[r]=s}}):(a.isRef(o)||a.isReactive(o))&&(t[r]=a.toRef(n,r))}return t}const We=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const He=Object.prototype.toString,Ue=n=>He.call(n)==="[object Object]",_e=()=>{};function ze(...n){if(n.length!==1)return a.toRef(...n);const e=n[0];return typeof e=="function"?a.readonly(a.customRef(()=>({get:e,set:_e}))):a.ref(e)}function qe(n,e){function t(...r){return new Promise((o,s)=>{Promise.resolve(n(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(o).catch(s)})}return t}const Te=n=>n();function Je(n=Te,e={}){const{initialState:t="active"}=e,r=ze(t==="active");function o(){r.value=!1}function s(){r.value=!0}const i=(...c)=>{r.value&&n(...c)};return{isActive:a.readonly(r),pause:o,resume:s,eventFilter:i}}function me(n){return Array.isArray(n)?n:[n]}function Ge(n){return a.getCurrentInstance()}function Ke(n,e,t={}){const{eventFilter:r=Te,...o}=t;return a.watch(n,qe(r,e),o)}function Ze(n,e,t={}){const{eventFilter:r,initialState:o="active",...s}=t,{eventFilter:i,pause:c,resume:l,isActive:d}=Je(r,{initialState:o});return{stop:Ke(n,e,{...s,eventFilter:i}),pause:c,resume:l,isActive:d}}function Qe(n,e=!0,t){Ge()?a.onMounted(n,t):e?n():a.nextTick(n)}function Ye(n,e,t){return a.watch(n,e,{...t,immediate:!0})}function se(n,e,t){return a.watch(n,(o,s,i)=>{o&&e(o,s,i)},{...t,once:!1})}const K=We?window:void 0;function Xe(n){var e;const t=a.toValue(n);return(e=t?.$el)!==null&&e!==void 0?e:t}function ee(...n){const e=(r,o,s,i)=>(r.addEventListener(o,s,i),()=>r.removeEventListener(o,s,i)),t=a.computed(()=>{const r=me(a.toValue(n[0])).filter(o=>o!=null);return r.every(o=>typeof o!="string")?r:void 0});return Ye(()=>{var r,o;return[(r=(o=t.value)===null||o===void 0?void 0:o.map(s=>Xe(s)))!==null&&r!==void 0?r:[K].filter(s=>s!=null),me(a.toValue(t.value?n[1]:n[0])),me(a.unref(t.value?n[2]:n[1])),a.toValue(t.value?n[3]:n[2])]},([r,o,s,i],c,l)=>{if(!r?.length||!o?.length||!s?.length)return;const d=Ue(i)?{...i}:i,m=r.flatMap(w=>o.flatMap(P=>s.map($=>e(w,P,$,d))));l(()=>{m.forEach(w=>w())})},{flush:"post"})}const ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},le="__vueuse_ssr_handlers__",et=tt();function tt(){return le in ce||(ce[le]=ce[le]||{}),ce[le]}function rt(n,e){return et[n]||e}function nt(n){return n==null?"any":n instanceof Set?"set":n instanceof Map?"map":n instanceof Date?"date":typeof n=="boolean"?"boolean":typeof n=="string"?"string":typeof n=="object"?"object":Number.isNaN(n)?"any":"number"}const ot={boolean:{read:n=>n==="true",write:n=>String(n)},object:{read:n=>JSON.parse(n),write:n=>JSON.stringify(n)},number:{read:n=>Number.parseFloat(n),write:n=>String(n)},any:{read:n=>n,write:n=>String(n)},string:{read:n=>n,write:n=>String(n)},map:{read:n=>new Map(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n.entries()))},set:{read:n=>new Set(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n))},date:{read:n=>new Date(n),write:n=>n.toISOString()}},$e="vueuse-storage";function st(n,e,t,r={}){var o;const{flush:s="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:l=!0,mergeDefaults:d=!1,shallow:m,window:w=K,eventFilter:P,onError:$=E=>{console.error(E)},initOnMounted:L}=r,x=(m?a.shallowRef:a.ref)(e),_=a.computed(()=>a.toValue(n));if(!t)try{t=rt("getDefaultStorage",()=>K?.localStorage)()}catch(E){$(E)}if(!t)return x;const D=a.toValue(e),N=nt(D),b=(o=r.serializer)!==null&&o!==void 0?o:ot[N],{pause:V,resume:O}=Ze(x,E=>p(E),{flush:s,deep:i,eventFilter:P});a.watch(_,()=>A(),{flush:s});let T=!1;const y=E=>{L&&!T||A(E)},W=E=>{L&&!T||B(E)};w&&c&&(t instanceof Storage?ee(w,"storage",y,{passive:!0}):ee(w,$e,W)),L?Qe(()=>{T=!0,A()}):A();function j(E,C){if(w){const M={key:_.value,oldValue:E,newValue:C,storageArea:t};w.dispatchEvent(t instanceof Storage?new StorageEvent("storage",M):new CustomEvent($e,{detail:M}))}}function p(E){try{const C=t.getItem(_.value);if(E==null)j(C,null),t.removeItem(_.value);else{const M=b.write(E);C!==M&&(t.setItem(_.value,M),j(C,M))}}catch(C){$(C)}}function h(E){const C=E?E.newValue:t.getItem(_.value);if(C==null)return l&&D!=null&&t.setItem(_.value,b.write(D)),D;if(!E&&d){const M=b.read(C);return typeof d=="function"?d(M,D):N==="object"&&!Array.isArray(M)?{...D,...M}:M}else return typeof C!="string"?C:b.read(C)}function A(E){if(!(E&&E.storageArea!==t)){if(E&&E.key==null){x.value=D;return}if(!(E&&E.key!==_.value)){V();try{const C=b.write(x.value);(E===void 0||E?.newValue!==C)&&(x.value=h(E))}catch(C){$(C)}finally{E?a.nextTick(O):O()}}}}function B(E){A(E.detail)}return x}function it(n,e,t={}){const{window:r=K}=t;return st(n,e,r?.localStorage,t)}const at={ctrl:"control",command:"meta",cmd:"meta",option:"alt",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright"};function ct(n={}){const{reactive:e=!1,target:t=K,aliasMap:r=at,passive:o=!0,onEventFired:s=_e}=n,i=a.reactive(new Set),c={toJSON(){return{}},current:i},l=e?a.reactive(c):c,d=new Set,m=new Map([["Meta",d],["Shift",new Set],["Alt",new Set]]),w=new Set;function P(N,b){N in l&&(e?l[N]=b:l[N].value=b)}function $(){i.clear();for(const N of w)P(N,!1)}function L(N,b,V){if(!(!N||typeof b.getModifierState!="function")){for(const[O,T]of m)if(b.getModifierState(O)){V.forEach(y=>T.add(y));break}}}function x(N,b){if(N)return;const V=`${b[0].toUpperCase()}${b.slice(1)}`,O=m.get(V);if(!["shift","alt"].includes(b)||!O)return;const T=Array.from(O),y=T.indexOf(b);T.forEach((W,j)=>{j>=y&&(i.delete(W),P(W,!1))}),O.clear()}function _(N,b){var V,O;const T=(V=N.key)===null||V===void 0?void 0:V.toLowerCase(),y=[(O=N.code)===null||O===void 0?void 0:O.toLowerCase(),T].filter(Boolean);if(T){T&&(b?i.add(T):i.delete(T));for(const W of y)w.add(W),P(W,b);L(b,N,[...i,...y]),x(b,T),T==="meta"&&!b&&(d.forEach(W=>{i.delete(W),P(W,!1)}),d.clear())}}ee(t,"keydown",N=>(_(N,!0),s(N)),{passive:o}),ee(t,"keyup",N=>(_(N,!1),s(N)),{passive:o}),ee("blur",$,{passive:o}),ee("focus",$,{passive:o});const D=new Proxy(l,{get(N,b,V){if(typeof b!="string")return Reflect.get(N,b,V);if(b=b.toLowerCase(),b in r&&(b=r[b]),!(b in l))if(/[+_-]/.test(b)){const T=b.split(/[+_-]/g).map(y=>y.trim());l[b]=a.computed(()=>T.map(y=>a.toValue(D[y])).every(Boolean))}else l[b]=a.shallowRef(!1);const O=Reflect.get(N,b,V);return e?a.toValue(O):O}});return D}function ye(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function ue(n){const e={type:n.type,clientId:n.clientId,timestamp:n.timestamp.toISOString()};return n.operation&&(e.operation={...n.operation,timestamp:n.operation.timestamp.toISOString()}),n.operations&&(e.operations=n.operations.map(t=>({...t,timestamp:t.timestamp.toISOString()}))),e}function lt(n){const e={type:n.type,clientId:n.clientId,timestamp:new Date(n.timestamp)};return n.operation&&(e.operation={...n.operation,timestamp:new Date(n.operation.timestamp)}),n.operations&&(e.operations=n.operations.map(t=>({...t,timestamp:new Date(t.timestamp)}))),e}const te=Be("hst-operation-log",()=>{const n=a.ref({maxOperations:100,enableCrossTabSync:!0,autoSyncInterval:3e4,enablePersistence:!1,persistenceKeyPrefix:"stonecrop-ops"}),e=a.ref([]),t=a.ref(-1),r=a.ref(ye()),o=a.ref(!1),s=a.ref([]),i=a.ref(null),c=a.computed(()=>t.value<0?!1:e.value[t.value]?.reversible??!1),l=a.computed(()=>t.value<e.value.length-1),d=a.computed(()=>{let f=0;for(let u=t.value;u>=0&&e.value[u]?.reversible;u--)f++;return f}),m=a.computed(()=>e.value.length-1-t.value),w=a.computed(()=>({canUndo:c.value,canRedo:l.value,undoCount:d.value,redoCount:m.value,currentIndex:t.value}));function P(f){n.value={...n.value,...f},n.value.enablePersistence&&(v(),S()),n.value.enableCrossTabSync&&h()}function $(f,u="user"){const g={...f,id:ye(),timestamp:new Date,source:u,userId:n.value.userId};if(n.value.operationFilter&&!n.value.operationFilter(g))return g.id;if(o.value)return s.value.push(g),g.id;if(t.value<e.value.length-1&&(e.value=e.value.slice(0,t.value+1)),e.value.push(g),t.value++,n.value.maxOperations&&e.value.length>n.value.maxOperations){const k=e.value.length-n.value.maxOperations;e.value=e.value.slice(k),t.value-=k}return n.value.enableCrossTabSync&&A(g),g.id}function L(){o.value=!0,s.value=[],i.value=ye()}function x(f){if(!o.value||s.value.length===0)return o.value=!1,s.value=[],i.value=null,null;const u=i.value,g=s.value.every(F=>F.reversible),k={id:u,type:"batch",path:"",fieldname:"",beforeValue:null,afterValue:null,doctype:s.value[0]?.doctype||"",timestamp:new Date,source:"user",reversible:g,irreversibleReason:g?void 0:"Contains irreversible operations",childOperationIds:s.value.map(F=>F.id),metadata:{description:f}};s.value.forEach(F=>{F.parentOperationId=u}),e.value.push(...s.value,k),t.value=e.value.length-1,n.value.enableCrossTabSync&&B(s.value,k);const U=u;return o.value=!1,s.value=[],i.value=null,U}function _(){o.value=!1,s.value=[],i.value=null}function D(f){if(!c.value)return!1;const u=e.value[t.value];if(!u.reversible)return typeof console<"u"&&u.irreversibleReason&&console.warn("Cannot undo irreversible operation:",u.irreversibleReason),!1;try{if(u.type==="batch"&&u.childOperationIds)for(let g=u.childOperationIds.length-1;g>=0;g--){const k=u.childOperationIds[g],U=e.value.find(F=>F.id===k);U&&b(U,f)}else b(u,f);return t.value--,n.value.enableCrossTabSync&&E(u),!0}catch(g){return typeof console<"u"&&console.error("Undo failed:",g),!1}}function N(f){if(!l.value)return!1;const u=e.value[t.value+1];try{if(u.type==="batch"&&u.childOperationIds)for(const g of u.childOperationIds){const k=e.value.find(U=>U.id===g);k&&V(k,f)}else V(u,f);return t.value++,n.value.enableCrossTabSync&&C(u),!0}catch(g){return typeof console<"u"&&console.error("Redo failed:",g),!1}}function b(f,u){(f.type==="set"||f.type==="delete")&&u&&typeof u.set=="function"&&u.set(f.path,f.beforeValue,"undo")}function V(f,u){(f.type==="set"||f.type==="delete")&&u&&typeof u.set=="function"&&u.set(f.path,f.afterValue,"redo")}function O(){const f=e.value.filter(g=>g.reversible).length,u=e.value.map(g=>g.timestamp);return{operations:[...e.value],currentIndex:t.value,totalOperations:e.value.length,reversibleOperations:f,irreversibleOperations:e.value.length-f,oldestOperation:u.length>0?new Date(Math.min(...u.map(g=>g.getTime()))):void 0,newestOperation:u.length>0?new Date(Math.max(...u.map(g=>g.getTime()))):void 0}}function T(){e.value=[],t.value=-1}function y(f,u){return e.value.filter(g=>g.doctype===f&&(u===void 0||g.recordId===u))}function W(f,u){const g=e.value.find(k=>k.id===f);g&&(g.reversible=!1,g.irreversibleReason=u)}function j(f,u,g,k="success",U){const F={type:"action",path:g&&g.length>0?`${f}.${g[0]}`:f,fieldname:"",beforeValue:null,afterValue:null,doctype:f,recordId:g&&g.length>0?g[0]:void 0,reversible:!1,actionName:u,actionRecordIds:g,actionResult:k,actionError:U};return $(F)}let p=null;function h(){typeof window>"u"||!window.BroadcastChannel||(p=new BroadcastChannel("stonecrop-operation-log"),p.addEventListener("message",f=>{const u=f.data;if(!u||typeof u!="object")return;const g=lt(u);g.clientId!==r.value&&(g.type==="operation"&&g.operation?(e.value.push({...g.operation,source:"sync"}),t.value=e.value.length-1):g.type==="operation"&&g.operations&&(e.value.push(...g.operations.map(k=>({...k,source:"sync"}))),t.value=e.value.length-1))}))}function A(f){if(!p)return;const u={type:"operation",operation:f,clientId:r.value,timestamp:new Date};p.postMessage(ue(u))}function B(f,u){if(!p)return;const g={type:"operation",operations:[...f,u],clientId:r.value,timestamp:new Date};p.postMessage(ue(g))}function E(f){if(!p)return;const u={type:"undo",operation:f,clientId:r.value,timestamp:new Date};p.postMessage(ue(u))}function C(f){if(!p)return;const u={type:"redo",operation:f,clientId:r.value,timestamp:new Date};p.postMessage(ue(u))}const M=it("stonecrop-ops-operations",null,{serializer:{read:f=>{try{return JSON.parse(f)}catch{return null}},write:f=>f?JSON.stringify(f):""}});function v(){if(!(typeof window>"u"))try{const f=M.value;f&&Array.isArray(f.operations)&&(e.value=f.operations.map(u=>({...u,timestamp:new Date(u.timestamp)})),t.value=f.currentIndex??-1)}catch(f){typeof console<"u"&&console.error("Failed to load operations from persistence:",f)}}function R(){if(!(typeof window>"u"))try{M.value={operations:e.value.map(f=>({...f,timestamp:f.timestamp.toISOString()})),currentIndex:t.value}}catch(f){typeof console<"u"&&console.error("Failed to save operations to persistence:",f)}}function S(){a.watch([e,t],()=>{n.value.enablePersistence&&R()},{deep:!0})}return{operations:e,currentIndex:t,config:n,clientId:r,undoRedoState:w,canUndo:c,canRedo:l,undoCount:d,redoCount:m,configure:P,addOperation:$,startBatch:L,commitBatch:x,cancelBatch:_,undo:D,redo:N,clear:T,getOperationsFor:y,getSnapshot:O,markIrreversible:W,logAction:j}});class ie{static _root;options;doctypeActions=new Map;doctypeTransitions=new Map;fieldRollbackConfig=new Map;globalActions=new Map;globalTransitionActions=new Map;constructor(e={}){if(ie._root)return ie._root;ie._root=this,this.options={defaultTimeout:e.defaultTimeout??5e3,debug:e.debug??!1,enableRollback:e.enableRollback??!0,errorHandler:e.errorHandler}}registerAction(e,t){this.globalActions.set(e,t)}registerTransitionAction(e,t){this.globalTransitionActions.set(e,t)}setFieldRollback(e,t,r){this.fieldRollbackConfig.has(e)||this.fieldRollbackConfig.set(e,new Map),this.fieldRollbackConfig.get(e).set(t,r)}getFieldRollback(e,t){return this.fieldRollbackConfig.get(e)?.get(t)}registerDoctypeActions(e,t){if(!t)return;const r=new Map,o=new Map;if(typeof t.entrySeq=="function")t.entrySeq().forEach(([s,i])=>{this.categorizeAction(s,i,r,o)});else if(t instanceof Map)for(const[s,i]of t)this.categorizeAction(s,i,r,o);else t&&typeof t=="object"&&Object.entries(t).forEach(([s,i])=>{this.categorizeAction(s,i,r,o)});this.doctypeActions.set(e,r),this.doctypeTransitions.set(e,o)}categorizeAction(e,t,r,o){this.isTransitionKey(e)?o.set(e,t):r.set(e,t)}isTransitionKey(e){return/^[A-Z0-9_]+$/.test(e)&&e.length>0}async executeFieldTriggers(e,t={}){const{doctype:r,fieldname:o}=e,s=this.findFieldTriggers(r,o);if(s.length===0)return{path:e.path,actionResults:[],totalExecutionTime:0,allSucceeded:!0,stoppedOnError:!1,rolledBack:!1};const i=performance.now(),c=[];let l=!1,d=!1,m;const w=this.getFieldRollback(r,o),P=t.enableRollback??w??this.options.enableRollback;P&&e.store&&(m=this.captureSnapshot(e));for(const _ of s)try{const D=await this.executeAction(_,e,t.timeout);if(c.push(D),!D.success){l=!0;break}}catch(D){const b={success:!1,error:D instanceof Error?D:new Error(String(D)),executionTime:0,action:_};c.push(b),l=!0;break}if(P&&l&&m&&e.store)try{this.restoreSnapshot(e,m),d=!0}catch(_){console.error("[FieldTriggers] Rollback failed:",_)}const $=performance.now()-i,L=c.filter(_=>!_.success);if(L.length>0&&this.options.errorHandler)for(const _ of L)try{this.options.errorHandler(_.error,e,_.action)}catch(D){console.error("[FieldTriggers] Error in global error handler:",D)}return{path:e.path,actionResults:c,totalExecutionTime:$,allSucceeded:c.every(_=>_.success),stoppedOnError:l,rolledBack:d,snapshot:this.options.debug&&P?m:void 0}}async executeTransitionActions(e,t={}){const{doctype:r,transition:o}=e,s=this.findTransitionActions(r,o);if(s.length===0)return[];const i=[];for(const l of s)try{const d=await this.executeTransitionAction(l,e,t.timeout);if(i.push(d),!d.success)break}catch(d){const w={success:!1,error:d instanceof Error?d:new Error(String(d)),executionTime:0,action:l,transition:o};i.push(w);break}const c=i.filter(l=>!l.success);if(c.length>0&&this.options.errorHandler)for(const l of c)try{this.options.errorHandler(l.error,e,l.action)}catch(d){console.error("[FieldTriggers] Error in global error handler:",d)}return i}findTransitionActions(e,t){const r=this.doctypeTransitions.get(e);return r?r.get(t)||[]:[]}async executeTransitionAction(e,t,r){const o=performance.now(),s=r??this.options.defaultTimeout;try{let i=this.globalTransitionActions.get(e);if(!i){const l=this.globalActions.get(e);l&&(i=l)}if(!i)throw new Error(`Transition action "${e}" not found in registry`);return await this.executeWithTimeout(i,t,s),{success:!0,executionTime:performance.now()-o,action:e,transition:t.transition}}catch(i){const c=performance.now()-o;return{success:!1,error:i instanceof Error?i:new Error(String(i)),executionTime:c,action:e,transition:t.transition}}}findFieldTriggers(e,t){const r=this.doctypeActions.get(e);if(!r)return[];const o=[];for(const[s,i]of r)this.isFieldTriggerKey(s,t)&&o.push(...i);return o}isFieldTriggerKey(e,t){return e===t?!0:e.includes(".")?this.matchFieldPattern(e,t):e.includes("*")?this.matchFieldPattern(e,t):!1}matchFieldPattern(e,t){const r=e.split("."),o=t.split(".");if(r.length!==o.length)return!1;for(let s=0;s<r.length;s++){const i=r[s],c=o[s];if(i!=="*"&&i!==c)return!1}return!0}async executeAction(e,t,r){const o=performance.now(),s=r??this.options.defaultTimeout;try{const i=this.globalActions.get(e);if(!i)throw new Error(`Action "${e}" not found in registry`);return await this.executeWithTimeout(i,t,s),{success:!0,executionTime:performance.now()-o,action:e}}catch(i){const c=performance.now()-o;return{success:!1,error:i instanceof Error?i:new Error(String(i)),executionTime:c,action:e}}}async executeWithTimeout(e,t,r){return new Promise((o,s)=>{const i=setTimeout(()=>{s(new Error(`Action timeout after ${r}ms`))},r);Promise.resolve(e(t)).then(c=>{clearTimeout(i),o(c)}).catch(c=>{clearTimeout(i),s(c)})})}captureSnapshot(e){if(!(!e.store||!e.doctype||!e.recordId))try{const t=`${e.doctype}.${e.recordId}`,r=e.store.get(t);return!r||typeof r!="object"?void 0:JSON.parse(JSON.stringify(r))}catch(t){this.options.debug&&console.warn("[FieldTriggers] Failed to capture snapshot:",t);return}}restoreSnapshot(e,t){if(!(!e.store||!e.doctype||!e.recordId||!t))try{const r=`${e.doctype}.${e.recordId}`;e.store.set(r,t),this.options.debug&&console.log(`[FieldTriggers] Rolled back ${r} to previous state`)}catch(r){throw console.error("[FieldTriggers] Failed to restore snapshot:",r),r}}}function z(n){return new ie(n)}function ut(n,e){z().registerAction(n,e)}function ft(n,e){z().registerTransitionAction(n,e)}function dt(n,e,t){z().setFieldRollback(n,e,t)}async function pt(n,e,t){const r=z(),o={path:t?.path||(t?.recordId?`${n}.${t.recordId}`:n),fieldname:"",beforeValue:void 0,afterValue:void 0,operation:"set",doctype:n,recordId:t?.recordId,timestamp:new Date,transition:e,currentState:t?.currentState,targetState:t?.targetState,fsmContext:t?.fsmContext};return await r.executeTransitionActions(o)}function ht(n,e){if(n)try{te().markIrreversible(n,e)}catch{}}function De(){try{return te()}catch{return null}}class Z{static instance;static getInstance(){return Z.instance||(Z.instance=new Z),Z.instance}getRegistry(){if(typeof globalThis<"u"){const e=globalThis.Registry?._root;if(e)return e}if(typeof window<"u"){const e=window.Registry?._root;if(e)return e}if(typeof global<"u"&&global){const e=global.Registry?._root;if(e)return e}}getDoctypeMeta(e){const t=this.getRegistry();if(t&&typeof t=="object"&&"registry"in t)return t.registry[e]}}class fe{target;parentPath;rootNode;doctype;parentDoctype;hst;constructor(e,t,r="",o=null,s){return this.target=e,this.parentPath=r,this.rootNode=o||this,this.doctype=t,this.parentDoctype=s,this.hst=Z.getInstance(),new Proxy(this,{get(i,c){if(c in i)return i[c];const l=String(c);return i.getNode(l)},set(i,c,l){const d=String(c);return i.set(d,l),!0}})}get(e){return this.resolveValue(e)}getNode(e){const t=this.resolvePath(e),r=this.resolveValue(e),o=t.split(".");let s=this.doctype;return this.doctype==="StonecropStore"&&o.length>=1&&(s=o[0]),typeof r=="object"&&r!==null&&!this.isPrimitive(r)?new fe(r,s,t,this.rootNode,this.parentDoctype):new fe(r,s,t,this.rootNode,this.parentDoctype)}set(e,t,r="user"){const o=this.resolvePath(e),s=this.has(e)?this.get(e):void 0;if(r!=="undo"&&r!=="redo"){const i=De();if(i&&typeof i.addOperation=="function"){const c=o.split("."),l=this.doctype==="StonecropStore"&&c.length>=1?c[0]:this.doctype,d=c.length>=2?c[1]:void 0,m=c.slice(2).join(".")||c[c.length-1],P=t===void 0&&s!==void 0?"delete":"set";i.addOperation({type:P,path:o,fieldname:m,beforeValue:s,afterValue:t,doctype:l,recordId:d,reversible:!0},r)}}this.updateValue(e,t),this.triggerFieldActions(o,s,t)}has(e){try{if(e==="")return!0;const t=this.parsePath(e);let r=this.target;for(let o=0;o<t.length;o++){const s=t[o];if(r==null)return!1;if(o===t.length-1)return this.isImmutable(r)?r.has(s):this.isPiniaStore(r)&&r.$state&&s in r.$state||s in r;r=this.getProperty(r,s)}return!1}catch{return!1}}getParent(){if(!this.parentPath)return null;const t=this.parentPath.split(".").slice(0,-1).join(".");return t===""?this.rootNode:this.rootNode.getNode(t)}getRoot(){return this.rootNode}getPath(){return this.parentPath}getDepth(){return this.parentPath?this.parentPath.split(".").length:0}getBreadcrumbs(){return this.parentPath?this.parentPath.split("."):[]}async triggerTransition(e,t){const r=z(),o=this.parentPath.split(".");let s=this.doctype,i;this.doctype==="StonecropStore"&&o.length>=1&&(s=o[0]),o.length>=2&&(i=o[1]);const c={path:this.parentPath,fieldname:"",beforeValue:void 0,afterValue:void 0,operation:"set",doctype:s,recordId:i,timestamp:new Date,store:this.rootNode||void 0,transition:e,currentState:t?.currentState,targetState:t?.targetState,fsmContext:t?.fsmContext},l=De();return l&&typeof l.addOperation=="function"&&l.addOperation({type:"transition",path:this.parentPath,fieldname:e,beforeValue:t?.currentState,afterValue:t?.targetState,doctype:s,recordId:i,reversible:!1,metadata:{transition:e,currentState:t?.currentState,targetState:t?.targetState,fsmContext:t?.fsmContext}},"user"),await r.executeTransitionActions(c)}resolvePath(e){return e===""?this.parentPath:this.parentPath?`${this.parentPath}.${e}`:e}resolveValue(e){if(e==="")return this.target;const t=this.parsePath(e);let r=this.target;for(const o of t){if(r==null)return;r=this.getProperty(r,o)}return r}updateValue(e,t){if(e==="")throw new Error("Cannot set value on empty path");const r=this.parsePath(e),o=r.pop();let s=this.target;for(const i of r)if(s=this.getProperty(s,i),s==null)throw new Error(`Cannot set property on null/undefined path: ${e}`);this.setProperty(s,o,t)}getProperty(e,t){return this.isImmutable(e)?e.get(t):this.isVueReactive(e)?e[t]:this.isPiniaStore(e)?e.$state?.[t]??e[t]:e[t]}setProperty(e,t,r){if(this.isImmutable(e))throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");if(this.isPiniaStore(e)){e.$patch?e.$patch({[t]:r}):e[t]=r;return}e[t]=r}async triggerFieldActions(e,t,r){try{if(!e||typeof e!="string")return;const o=e.split(".");if(o.length<3)return;const s=z(),i=o.slice(2).join(".")||o[o.length-1];let c=this.doctype;this.doctype==="StonecropStore"&&o.length>=1&&(c=o[0]);let l;o.length>=2&&(l=o[1]);const d={path:e,fieldname:i,beforeValue:t,afterValue:r,operation:"set",doctype:c,recordId:l,timestamp:new Date,store:this.rootNode||void 0};await s.executeFieldTriggers(d)}catch(o){o instanceof Error&&console.warn("Field trigger error:",o.message)}}isVueReactive(e){return e&&typeof e=="object"&&"__v_isReactive"in e&&e.__v_isReactive===!0}isPiniaStore(e){return e&&typeof e=="object"&&("$state"in e||"$patch"in e||"$id"in e)}isImmutable(e){if(!e||typeof e!="object")return!1;const t="get"in e&&typeof e.get=="function",r="set"in e&&typeof e.set=="function",o="has"in e&&typeof e.has=="function",s="__ownerID"in e||"_map"in e||"_list"in e||"_origin"in e||"_capacity"in e||"_defaultValues"in e||"_tail"in e||"_root"in e||"size"in e&&t&&r;let i;try{const l=e;if("constructor"in l&&l.constructor&&typeof l.constructor=="object"&&"name"in l.constructor){const d=l.constructor.name;i=typeof d=="string"?d:void 0}}catch{i=void 0}const c=i&&(i.includes("Map")||i.includes("List")||i.includes("Set")||i.includes("Stack")||i.includes("Seq"))&&(t||r);return!!(t&&r&&o&&s||t&&r&&c)}isPrimitive(e){return e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="function"||typeof e=="symbol"||typeof e=="bigint"}parsePath(e){return e?e.replace(/\[(\d+)\]/g,".$1").split(".").filter(r=>r.length>0):[]}}function Ie(n,e,t){return new fe(n,e,"",null,t)}class ve{hstStore;_operationLogStore;_operationLogConfig;registry;constructor(e,t){this.registry=e,this._operationLogConfig=t,this.initializeHSTStore(),this.setupRegistrySync()}getOperationLogStore(){return this._operationLogStore||(this._operationLogStore=te(),this._operationLogConfig&&this._operationLogStore.configure(this._operationLogConfig)),this._operationLogStore}initializeHSTStore(){const e={};Object.keys(this.registry.registry).forEach(t=>{e[t]={}}),this.hstStore=Ie(a.reactive(e),"StonecropStore")}setupRegistrySync(){const e=this.registry.addDoctype.bind(this.registry);this.registry.addDoctype=t=>{e(t),this.hstStore.has(t.slug)||this.hstStore.set(t.slug,{})}}records(e){const t=typeof e=="string"?e:e.slug;return this.ensureDoctypeExists(t),this.hstStore.getNode(t)}addRecord(e,t,r){const o=typeof e=="string"?e:e.slug;this.ensureDoctypeExists(o),this.hstStore.set(`${o}.${t}`,r)}getRecordById(e,t){const r=typeof e=="string"?e:e.slug;if(this.ensureDoctypeExists(r),!(!this.hstStore.has(`${r}.${t}`)||this.hstStore.get(`${r}.${t}`)===void 0))return this.hstStore.getNode(`${r}.${t}`)}removeRecord(e,t){const r=typeof e=="string"?e:e.slug;this.ensureDoctypeExists(r),this.hstStore.has(`${r}.${t}`)&&this.hstStore.set(`${r}.${t}`,void 0)}getRecordIds(e){const t=typeof e=="string"?e:e.slug;this.ensureDoctypeExists(t);const r=this.hstStore.get(t);return!r||typeof r!="object"?[]:Object.keys(r).filter(o=>r[o]!==void 0)}clearRecords(e){const t=typeof e=="string"?e:e.slug;this.ensureDoctypeExists(t),this.getRecordIds(t).forEach(o=>{this.hstStore.set(`${t}.${o}`,void 0)})}setup(e){this.ensureDoctypeExists(e.slug)}runAction(e,t,r){const s=this.registry.registry[e.slug]?.actions?.get(t),i=Array.isArray(r)?r.filter(m=>typeof m=="string"):void 0,c=this.getOperationLogStore();let l="success",d;try{s&&s.length>0&&s.forEach(m=>{try{new Function("args",m)(r)}catch(w){throw l="failure",d=w instanceof Error?w.message:"Unknown error",w}})}catch{}finally{c.logAction(e.doctype,t,i,l,d)}}async getRecords(e){(await(await fetch(`/${e.slug}`)).json()).forEach(o=>{o.id&&this.addRecord(e,o.id,o)})}async getRecord(e,t){const o=await(await fetch(`/${e.slug}/${t}`)).json();this.addRecord(e,t,o)}ensureDoctypeExists(e){this.hstStore.has(e)||this.hstStore.set(e,{})}async getMeta(e){if(!this.registry.getMeta)throw new Error("No getMeta function provided to Registry");return await this.registry.getMeta(e)}getStore(){return this.hstStore}}function gt(n){n||(n={});const e=n.registry||a.inject("$registry"),t=a.inject("$stonecrop"),r=a.ref(),o=a.ref(),s=a.ref({}),i=a.ref(),c=a.ref(),l=a.ref([]);if(n.doctype&&e){const v=n.doctype.schema?Array.isArray(n.doctype.schema)?n.doctype.schema:Array.from(n.doctype.schema):[];l.value=e.resolveSchema(v)}const d=a.ref([]),m=a.ref(-1),w=a.computed(()=>r.value?.getOperationLogStore().canUndo??!1),P=a.computed(()=>r.value?.getOperationLogStore().canRedo??!1),$=a.computed(()=>r.value?.getOperationLogStore().undoCount??0),L=a.computed(()=>r.value?.getOperationLogStore().redoCount??0),x=a.computed(()=>r.value?.getOperationLogStore().undoRedoState??{canUndo:!1,canRedo:!1,undoCount:0,redoCount:0,currentIndex:-1}),_=v=>r.value?.getOperationLogStore().undo(v)??!1,D=v=>r.value?.getOperationLogStore().redo(v)??!1,N=()=>{r.value?.getOperationLogStore().startBatch()},b=v=>r.value?.getOperationLogStore().commitBatch(v)??null,V=()=>{r.value?.getOperationLogStore().cancelBatch()},O=()=>{r.value?.getOperationLogStore().clear()},T=(v,R)=>r.value?.getOperationLogStore().getOperationsFor(v,R)??[],y=()=>r.value?.getOperationLogStore().getSnapshot()??{operations:[],currentIndex:-1,totalOperations:0,reversibleOperations:0,irreversibleOperations:0},W=(v,R)=>{r.value?.getOperationLogStore().markIrreversible(v,R)},j=(v,R,S,f="success",u)=>r.value?.getOperationLogStore().logAction(v,R,S,f,u)??"",p=v=>{r.value?.getOperationLogStore().configure(v)};a.onMounted(async()=>{if(e){r.value=t||new ve(e);try{const v=r.value.getOperationLogStore(),R=Ne(v);d.value=R.operations.value,m.value=R.currentIndex.value,a.watch(()=>R.operations.value,S=>{d.value=S}),a.watch(()=>R.currentIndex.value,S=>{m.value=S})}catch{}if(!n.doctype&&e.router){const v=e.router.currentRoute.value;if(!v.path)return;const R=v.path.split("/").filter(f=>f.length>0),S=R[1]?.toLowerCase();if(R.length>0){const f={path:v.path,segments:R},u=await e.getMeta?.(f);if(u){if(e.addDoctype(u),r.value.setup(u),i.value=u,c.value=S,o.value=r.value.getStore(),e){const g=u.schema?Array.isArray(u.schema)?u.schema:Array.from(u.schema):[];l.value=e.resolveSchema(g)}if(S&&S!=="new"){const g=r.value.getRecordById(u,S);if(g)s.value=g.get("")||{};else try{await r.value.getRecord(u,S);const k=r.value.getRecordById(u,S);k&&(s.value=k.get("")||{})}catch{s.value=q(u)}}else s.value=q(u);o.value&&Ce(u,S||"new",s,o.value),r.value.runAction(u,"load",S?[S]:void 0)}}}if(n.doctype){o.value=r.value.getStore();const v=n.doctype,R=n.recordId;if(R&&R!=="new"){const S=r.value.getRecordById(v,R);if(S)s.value=S.get("")||{};else try{await r.value.getRecord(v,R);const f=r.value.getRecordById(v,R);f&&(s.value=f.get("")||{})}catch{s.value=q(v)}}else s.value=q(v);o.value&&Ce(v,R||"new",s,o.value)}}});const h=(v,R)=>{const S=n.doctype||i.value;if(!S)return"";const f=R||n.recordId||c.value||"new";return`${S.slug}.${f}.${v}`},A=v=>{const R=n.doctype||i.value;if(!(!o.value||!r.value||!R))try{const S=v.path.split(".");if(S.length>=2){const g=S[0],k=S[1];if(o.value.has(`${g}.${k}`)||r.value.addRecord(R,k,{...s.value}),S.length>3){const U=`${g}.${k}`,F=S.slice(2);let Q=U;for(let ne=0;ne<F.length-1;ne++)if(Q+=`.${F[ne]}`,!o.value.has(Q)){const be=F[ne+1],Rt=!isNaN(Number(be));o.value.set(Q,Rt?[]:{})}}}o.value.set(v.path,v.value);const f=v.fieldname.split("."),u={...s.value};f.length===1?u[f[0]]=v.value:mt(u,f,v.value),s.value=u}catch{}};(n.doctype||e?.router)&&(a.provide("hstPathProvider",h),a.provide("hstChangeHandler",A));const B=(v,R,S)=>{if(!r.value)return q(R);if(S)try{const f=o.value?.get(v);return f&&typeof f=="object"?f:q(R)}catch{return q(R)}return q(R)},E=async(v,R)=>{if(!o.value||!r.value)throw new Error("HST store not initialized");const S=`${v.slug}.${R}`,u={...o.value.get(S)||{}},g=v.schema?Array.isArray(v.schema)?v.schema:Array.from(v.schema):[],U=(e?e.resolveSchema(g):g).filter(F=>"fieldtype"in F&&F.fieldtype==="Doctype"&&"schema"in F&&Array.isArray(F.schema));for(const F of U){const Q=F,ne=`${S}.${Q.fieldname}`,be=ke(Q.schema,ne,o.value);u[Q.fieldname]=be}return u},C=(v,R)=>({provideHSTPath:u=>`${v}.${u}`,handleHSTChange:u=>{const g=u.path.startsWith(v)?u.path:`${v}.${u.fieldname}`;A({...u,path:g})}}),M={operations:d,currentIndex:m,undoRedoState:x,canUndo:w,canRedo:P,undoCount:$,redoCount:L,undo:_,redo:D,startBatch:N,commitBatch:b,cancelBatch:V,clear:O,getOperationsFor:T,getSnapshot:y,markIrreversible:W,logAction:j,configure:p};return n.doctype?{stonecrop:r,operationLog:M,provideHSTPath:h,handleHSTChange:A,hstStore:o,formData:s,resolvedSchema:l,loadNestedData:B,saveRecursive:E,createNestedContext:C}:!n.doctype&&e?.router?{stonecrop:r,operationLog:M,provideHSTPath:h,handleHSTChange:A,hstStore:o,formData:s,resolvedSchema:l,loadNestedData:B,saveRecursive:E,createNestedContext:C}:{stonecrop:r,operationLog:M}}function q(n){const e={};return n.schema&&n.schema.forEach(t=>{switch("fieldtype"in t?t.fieldtype:"Data"){case"Data":case"Text":e[t.fieldname]="";break;case"Check":e[t.fieldname]=!1;break;case"Int":case"Float":e[t.fieldname]=0;break;case"Table":e[t.fieldname]=[];break;case"JSON":e[t.fieldname]={};break;default:e[t.fieldname]=null}}),e}function Ce(n,e,t,r){a.watch(t,o=>{const s=`${n.slug}.${e}`;Object.keys(o).forEach(i=>{const c=`${s}.${i}`;try{r.set(c,o[i])}catch{}})},{deep:!0})}function mt(n,e,t){let r=n;for(let s=0;s<e.length-1;s++){const i=e[s];(!(i in r)||typeof r[i]!="object")&&(r[i]=isNaN(Number(e[s+1]))?{}:[]),r=r[i]}const o=e[e.length-1];r[o]=t}function ke(n,e,t){const o={...t.get(e)||{}},s=n.filter(i=>"fieldtype"in i&&i.fieldtype==="Doctype"&&"schema"in i&&Array.isArray(i.schema));for(const i of s){const c=i,l=`${e}.${c.fieldname}`,d=ke(c.schema,l,t);o[c.fieldname]=d}return o}function Se(n){const t=a.inject("$operationLogStore",void 0)||te();n&&t.configure(n);const{operations:r,currentIndex:o,undoRedoState:s,canUndo:i,canRedo:c,undoCount:l,redoCount:d}=Ne(t);function m(O){return t.undo(O)}function w(O){return t.redo(O)}function P(){t.startBatch()}function $(O){return t.commitBatch(O)}function L(){t.cancelBatch()}function x(){t.clear()}function _(O,T){return t.getOperationsFor(O,T)}function D(){return t.getSnapshot()}function N(O,T){t.markIrreversible(O,T)}function b(O,T,y,W="success",j){return t.logAction(O,T,y,W,j)}function V(O){t.configure(O)}return{operations:r,currentIndex:o,undoRedoState:s,canUndo:i,canRedo:c,undoCount:l,redoCount:d,undo:m,redo:w,startBatch:P,commitBatch:$,cancelBatch:L,clear:x,getOperationsFor:_,getSnapshot:D,markIrreversible:N,logAction:b,configure:V}}function yt(n,e=!0){if(!e)return;const{undo:t,redo:r,canUndo:o,canRedo:s}=Se(),i=ct();se(i["Ctrl+Z"],()=>{o.value&&t(n)}),se(i["Meta+Z"],()=>{o.value&&t(n)}),se(i["Ctrl+Shift+Z"],()=>{s.value&&r(n)}),se(i["Meta+Shift+Z"],()=>{s.value&&r(n)}),se(i["Ctrl+Y"],()=>{s.value&&r(n)})}async function vt(n,e){const{startBatch:t,commitBatch:r,cancelBatch:o}=Se();t();try{return await n(),r(e)}catch(s){throw o(),s}}class St{doctype;schema;workflow;actions;component;constructor(e,t,r,o,s){this.doctype=e,this.schema=t,this.workflow=r,this.actions=o,this.component=s}get slug(){return this.doctype.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}}class re{static _root;name;registry;router;constructor(e,t){if(re._root)return re._root;re._root=this,this.name="Registry",this.registry={},this.router=e,this.getMeta=t}getMeta;addDoctype(e){e.slug in this.registry||(this.registry[e.slug]=e);const t=z();t.registerDoctypeActions(e.doctype,e.actions),e.slug!==e.doctype&&t.registerDoctypeActions(e.slug,e.actions),e.component&&this.router&&!this.router.hasRoute(e.doctype)&&this.router.addRoute({path:`/${e.slug}`,name:e.slug,component:e.component})}resolveSchema(e,t){const r=t||new Set;return e.map(o=>{if("fieldtype"in o&&o.fieldtype==="Doctype"&&"options"in o&&typeof o.options=="string"){const s=o.options;if(r.has(s))return{...o};const i=this.registry[s];if(i&&i.schema){const c=Array.isArray(i.schema)?i.schema:Array.from(i.schema);r.add(s);const l=this.resolveSchema(c,r);return r.delete(s),{...o,schema:l}}}if("fieldtype"in o&&o.fieldtype==="Table"&&"options"in o&&typeof o.options=="string"){const s=o.options;if(r.has(s))return{...o};const i=this.registry[s];if(i&&i.schema){const c=Array.isArray(i.schema)?i.schema:Array.from(i.schema),l={...o};return(!("columns"in o)||!o.columns)&&(l.columns=c.map(d=>({name:d.fieldname,fieldname:d.fieldname,label:"label"in d&&d.label||d.fieldname,fieldtype:"fieldtype"in d?d.fieldtype:"Data",align:"align"in d&&d.align||"left",edit:"edit"in d?d.edit:!0,width:"width"in d&&d.width||"20ch"}))),l.component||(l.component="ATable"),(!("config"in o)||!o.config)&&(l.config={view:"list"}),(!("rows"in o)||!o.rows)&&(l.rows=[]),l}}return{...o}})}initializeRecord(e){const t={};return e.forEach(r=>{switch("fieldtype"in r?r.fieldtype:"Data"){case"Data":case"Text":case"Code":t[r.fieldname]="";break;case"Check":t[r.fieldname]=!1;break;case"Int":case"Float":case"Decimal":case"Currency":case"Quantity":t[r.fieldname]=0;break;case"Table":t[r.fieldname]=[];break;case"JSON":t[r.fieldname]={};break;case"Doctype":"schema"in r&&Array.isArray(r.schema)?t[r.fieldname]=this.initializeRecord(r.schema):t[r.fieldname]={};break;default:t[r.fieldname]=null}}),t}}async function bt(n,e,t){await a.nextTick();try{await t(n,e)}catch{}}const wt={install:(n,e)=>{const t=n.config.globalProperties.$router,r=e?.router,o=t||r;!t&&r&&n.use(r);const s=new re(o,e?.getMeta);n.provide("$registry",s),n.config.globalProperties.$registry=s;const i=new ve(s);n.provide("$stonecrop",i),n.config.globalProperties.$stonecrop=i;try{const c=n.config.globalProperties.$pinia;if(c){const l=te(c);n.provide("$operationLogStore",l),n.config.globalProperties.$operationLogStore=l}}catch(c){console.warn("Pinia not available - operation log features will be disabled:",c)}if(e?.components)for(const[c,l]of Object.entries(e.components))n.component(c,l);e?.autoInitializeRouter&&e.onRouterInitialized&&bt(s,i,e.onRouterInitialized)}};var Ve=(n=>(n.ERROR="error",n.WARNING="warning",n.INFO="info",n))(Ve||{});class Le{options;constructor(e={}){this.options={registry:e.registry||null,validateLinkTargets:e.validateLinkTargets??!0,validateActions:e.validateActions??!0,validateWorkflows:e.validateWorkflows??!0,validateRequiredProperties:e.validateRequiredProperties??!0}}validate(e,t,r,o){const s=[],i=t?Array.isArray(t)?t:t.toArray():[];if(this.options.validateRequiredProperties&&s.push(...this.validateRequiredProperties(e,i)),this.options.validateLinkTargets&&this.options.registry&&s.push(...this.validateLinkFields(e,i,this.options.registry)),this.options.validateWorkflows&&r&&s.push(...this.validateWorkflow(e,r)),this.options.validateActions&&o){const m=o instanceof Map?o:o.toObject();s.push(...this.validateActionRegistration(e,m))}const c=s.filter(m=>m.severity==="error").length,l=s.filter(m=>m.severity==="warning").length,d=s.filter(m=>m.severity==="info").length;return{valid:c===0,issues:s,errorCount:c,warningCount:l,infoCount:d}}validateRequiredProperties(e,t){const r=[];for(const o of t){if(!o.fieldname){r.push({severity:"error",rule:"required-fieldname",message:"Field is missing required property: fieldname",doctype:e,context:{field:o}});continue}if(!o.component&&!("fieldtype"in o)&&r.push({severity:"error",rule:"required-component-or-fieldtype",message:`Field "${o.fieldname}" must have either component or fieldtype property`,doctype:e,fieldname:o.fieldname}),"schema"in o){const s=o.schema,i=Array.isArray(s)?s:s.toArray?.()||[];r.push(...this.validateRequiredProperties(e,i))}}return r}validateLinkFields(e,t,r){const o=[];for(const s of t){if(("fieldtype"in s?s.fieldtype:void 0)==="Link"){const c="options"in s?s.options:void 0;if(!c){o.push({severity:"error",rule:"link-missing-options",message:`Link field "${s.fieldname}" is missing options property (target doctype)`,doctype:e,fieldname:s.fieldname});continue}const l=typeof c=="string"?c:"";if(!l){o.push({severity:"error",rule:"link-invalid-options",message:`Link field "${s.fieldname}" has invalid options format (expected string doctype name)`,doctype:e,fieldname:s.fieldname});continue}r.registry[l]||r.registry[l.toLowerCase()]||o.push({severity:"error",rule:"link-invalid-target",message:`Link field "${s.fieldname}" references non-existent doctype: "${l}"`,doctype:e,fieldname:s.fieldname,context:{targetDoctype:l}})}if("schema"in s){const c=s.schema,l=Array.isArray(c)?c:c.toArray?.()||[];o.push(...this.validateLinkFields(e,l,r))}}return o}validateWorkflow(e,t){const r=[];if(!t.initial&&!t.type&&r.push({severity:"warning",rule:"workflow-missing-initial",message:"Workflow is missing initial state property",doctype:e}),!t.states||Object.keys(t.states).length===0)return r.push({severity:"warning",rule:"workflow-no-states",message:"Workflow has no states defined",doctype:e}),r;t.initial&&typeof t.initial=="string"&&!t.states[t.initial]&&r.push({severity:"error",rule:"workflow-invalid-initial",message:`Workflow initial state "${t.initial}" does not exist in states`,doctype:e,context:{initialState:t.initial}});const o=Object.keys(t.states),s=new Set;t.initial&&typeof t.initial=="string"&&s.add(t.initial);for(const[i,c]of Object.entries(t.states)){const l=c;if(l.on){for(const[d,m]of Object.entries(l.on))if(typeof m=="string")s.add(m);else if(m&&typeof m=="object"){const w="target"in m?m.target:void 0;typeof w=="string"?s.add(w):Array.isArray(w)&&w.forEach(P=>{typeof P=="string"&&s.add(P)})}}}for(const i of o)s.has(i)||r.push({severity:"warning",rule:"workflow-unreachable-state",message:`Workflow state "${i}" may not be reachable`,doctype:e,context:{stateName:i}});return r}validateActionRegistration(e,t){const r=[],o=z();for(const[s,i]of Object.entries(t)){if(!Array.isArray(i)){r.push({severity:"error",rule:"action-invalid-format",message:`Action configuration for "${s}" must be an array`,doctype:e,context:{triggerName:s,actionNames:i}});continue}for(const c of i){const l=o;l.globalActions?.has(c)||l.globalTransitionActions?.has(c)||r.push({severity:"warning",rule:"action-not-registered",message:`Action "${c}" referenced in "${s}" is not registered in FieldTriggerEngine`,doctype:e,context:{triggerName:s,actionName:c}})}}return r}}function Me(n,e){return new Le({registry:n,...e})}function Et(n,e,t,r,o){return Me(t).validate(n,e,r,o)}I.DoctypeMeta=St,I.HST=Z,I.Registry=re,I.SchemaValidator=Le,I.Stonecrop=ve,I.ValidationSeverity=Ve,I.createHST=Ie,I.createValidator=Me,I.default=wt,I.getGlobalTriggerEngine=z,I.markOperationIrreversible=ht,I.registerGlobalAction=ut,I.registerTransitionAction=ft,I.setFieldRollback=dt,I.triggerTransition=pt,I.useOperationLog=Se,I.useOperationLogStore=te,I.useStonecrop=gt,I.useUndoRedoShortcuts=yt,I.validateSchema=Et,I.withBatch=vt,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
6
+ //# sourceMappingURL=stonecrop.umd.cjs.map