@processandtools/rp-article-designer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/contexts/article/ArticleContext.d.ts +7 -0
- package/dist/contexts/article-data/DataContext.d.ts +1 -0
- package/dist/contexts/descriptor/DescriptorContext.d.ts +3 -0
- package/dist/descriptor/helper/DescriptorEvaluator.d.ts +8 -0
- package/dist/descriptor/services/DescriptorManager.d.ts +23 -0
- package/dist/helpers/ExpressionResolver.d.ts +44 -0
- package/dist/helpers/LindivResolver.d.ts +59 -0
- package/dist/hooks/useArticle.d.ts +1 -0
- package/dist/hooks/useData.d.ts +1 -0
- package/dist/hooks/useDescriptor.d.ts +32 -0
- package/dist/hooks/useDescriptorManager.d.ts +3 -0
- package/dist/hooks/zoneDescriptor.d.ts +93 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +2571 -0
- package/dist/rp-article-designer.css +1 -0
- package/dist/types/divider.types.d.ts +82 -0
- package/dist/types/view.types.d.ts +5 -0
- package/dist/variables/VariableResolver.d.ts +28 -0
- package/dist/variables/useVariables.d.ts +11 -0
- package/dist/variables/variable.types.d.ts +20 -0
- package/dist/vite.svg +1 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DataContext: import('react').Context<any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DescriptorEvaluationResult, DescriptorNode, DescriptorResponse } from '../types/descriptor.types';
|
|
2
|
+
import { DescriptorTypeValue } from '../types/descriptor-data.types.ts';
|
|
3
|
+
import { VariableTree } from '../../variables/VariableResolver.ts';
|
|
4
|
+
|
|
5
|
+
export declare class DescriptorEvaluator {
|
|
6
|
+
static evaluate<T extends DescriptorTypeValue>(descriptor: DescriptorResponse<T>, data: Record<string, unknown>, variableTree?: VariableTree): DescriptorEvaluationResult<T>;
|
|
7
|
+
static findAllNonDefaultMatches(descriptor: DescriptorResponse, data: Record<string, unknown>, variableTree?: VariableTree): DescriptorNode[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DescriptorResponse, DescriptorEvaluationResult } from '../types/descriptor.types';
|
|
2
|
+
import { DescriptorTypeValue } from '../types/descriptor-data.types';
|
|
3
|
+
import { VariableTree } from '../../variables/VariableResolver';
|
|
4
|
+
|
|
5
|
+
export declare class DescriptorManager {
|
|
6
|
+
private descriptors;
|
|
7
|
+
private variableTree?;
|
|
8
|
+
constructor(descriptors: DescriptorResponse[], variableTree?: VariableTree);
|
|
9
|
+
evaluate<T extends DescriptorTypeValue = DescriptorTypeValue>(descriptorName: string, inputData: Record<string, unknown>): DescriptorEvaluationResult<T>;
|
|
10
|
+
getDescriptor(descriptorName: string): DescriptorResponse | undefined;
|
|
11
|
+
hasDescriptor(descriptorName: string): boolean;
|
|
12
|
+
getDescriptorNames(): string[];
|
|
13
|
+
getDescriptorsByType(descriptorType: DescriptorTypeValue): DescriptorResponse[];
|
|
14
|
+
findAllMatches(descriptorName: string, inputData: Record<string, unknown>): import('../types/descriptor.types').DescriptorNode<DescriptorTypeValue>[];
|
|
15
|
+
getStats(): {
|
|
16
|
+
total: number;
|
|
17
|
+
byType: Record<number, number>;
|
|
18
|
+
names: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function createDescriptorManager(jsonData: DescriptorResponse[] | {
|
|
22
|
+
descriptors: DescriptorResponse[];
|
|
23
|
+
}, variableTree?: VariableTree): DescriptorManager;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { VariableTree } from '../variables/VariableResolver';
|
|
2
|
+
|
|
3
|
+
export interface ResolveOptions {
|
|
4
|
+
variableTree?: VariableTree;
|
|
5
|
+
dataType?: 'FL' | 'IN' | 'CI' | 'CS' | 'DA' | string;
|
|
6
|
+
silent?: boolean;
|
|
7
|
+
allowFunctions?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ResolveResult {
|
|
10
|
+
value: number | string | undefined;
|
|
11
|
+
original: string;
|
|
12
|
+
resolved: string;
|
|
13
|
+
hadVariables: boolean;
|
|
14
|
+
wasEvaluated: boolean;
|
|
15
|
+
unit?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolve(input: string, options?: ResolveOptions): ResolveResult;
|
|
19
|
+
export declare function resolveValue(input: string, options?: ResolveOptions): number | string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a string is an IF statement
|
|
22
|
+
*/
|
|
23
|
+
export declare function isIfStatement(str: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Parse and evaluate an IF statement
|
|
26
|
+
* Format: IF(condition, trueValue, falseValue)
|
|
27
|
+
*
|
|
28
|
+
* Supports:
|
|
29
|
+
* - Comparisons: =, !=, <, >, <=, >=
|
|
30
|
+
* - Logical: AND, OR, NOT
|
|
31
|
+
* - Nested IF statements
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* evaluateIfStatement("IF(1 = 1, -150, 150)") // → -150
|
|
35
|
+
* evaluateIfStatement("IF(5 > 3, 100, 200)") // → 100
|
|
36
|
+
*/
|
|
37
|
+
export declare function evaluateIfStatement(expr: string, allowFunctions?: boolean): number | string;
|
|
38
|
+
export declare function isMathExpression(str: string): boolean;
|
|
39
|
+
export declare function evaluateExpression(expr: string, allowFunctions?: boolean): number;
|
|
40
|
+
export declare function clearCache(): void;
|
|
41
|
+
export declare function resolveMany(inputs: string[], options?: ResolveOptions): ResolveResult[];
|
|
42
|
+
export declare function resolveObject<T extends Record<string, unknown>>(obj: T, options?: ResolveOptions): T;
|
|
43
|
+
export declare function inspect(input: string, options?: ResolveOptions): ResolveResult;
|
|
44
|
+
export declare function canResolve(input: string, options?: ResolveOptions): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { VariableTree } from '../variables/VariableResolver';
|
|
2
|
+
|
|
3
|
+
export interface LindivResult {
|
|
4
|
+
/** Resolved lindiv string in original format (e.g., "3600mm:1", "1:1800mm") */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Original input string */
|
|
7
|
+
original: string;
|
|
8
|
+
/** Whether this is a reference (starts with # or is article name) */
|
|
9
|
+
isReference: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolve lindiv expressions and return in original format
|
|
13
|
+
*
|
|
14
|
+
* Handles:
|
|
15
|
+
* - Simple ratios: "1:1", "2:1" → "1:1"
|
|
16
|
+
* - References: "#RP_LD_P_T100" → "RP_LD_P_T100"
|
|
17
|
+
* - Expressions: "(round(4000/1200 -0.5)*1200)mm:1" → "3600mm:1"
|
|
18
|
+
* - Reverse format: "1:((round(2700/150))*150)mm" → "1:1800mm"
|
|
19
|
+
* - With braces: "(round(X/150))*{1}" → "24*{1}"
|
|
20
|
+
* - With variables: Assumes variables are already resolved
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* resolveLindiv("(round(4000/1200 -0.5)*1200)mm:1")
|
|
24
|
+
* // → "3600mm:1"
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* resolveLindiv("1:((round(2700/150))*150)mm")
|
|
28
|
+
* // → "1:1800mm"
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* resolveLindiv("#RP_LD_P_T100")
|
|
32
|
+
* // → "RP_LD_P_T100" (removes #)
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveLindiv(lindiv: string, variableTree?: VariableTree): LindivResult;
|
|
35
|
+
/**
|
|
36
|
+
* Simpler version that just returns the resolved string value
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* resolveLindivValue("(round(4000/1200 -0.5)*1200)mm:1")
|
|
40
|
+
* // → "3600mm:1"
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveLindivValue(lindiv: string, variableTree?: VariableTree): string;
|
|
43
|
+
/**
|
|
44
|
+
* Check if lindiv is a reference (descriptor name or article name)
|
|
45
|
+
*/
|
|
46
|
+
export declare function isLindivReference(lindiv: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a lindiv expression contains variables
|
|
49
|
+
*/
|
|
50
|
+
export declare function lindivHasVariables(lindiv: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Extract variable names from lindiv
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractLindivVariables(lindiv: string): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Format lindiv result back to string
|
|
57
|
+
* Since value is already formatted, this just adds # for references
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatLindiv(result: LindivResult): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useArticle(): import('../contexts/article/ArticleContext.ts').ArticleContextType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useData(): any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DescriptorManager } from '../descriptor/services/DescriptorManager';
|
|
2
|
+
import { DescriptorEvaluationResult, DescriptorNode } from '../descriptor/types/descriptor.types';
|
|
3
|
+
import { DescriptorTypeValue } from '../descriptor/types/descriptor-data.types';
|
|
4
|
+
|
|
5
|
+
export interface UseDescriptorOptions {
|
|
6
|
+
/** Throw error if descriptor not found (default: false) */
|
|
7
|
+
throwOnError?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface UseDescriptorResult<T extends DescriptorTypeValue> {
|
|
10
|
+
/** Evaluation result (null if error and throwOnError=false) */
|
|
11
|
+
result: DescriptorEvaluationResult<T> | null;
|
|
12
|
+
/** Error message if evaluation failed */
|
|
13
|
+
error: string | null;
|
|
14
|
+
/** Whether evaluation was successful */
|
|
15
|
+
success: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function useDescriptorEvaluation<T extends DescriptorTypeValue = DescriptorTypeValue>(manager: DescriptorManager, descriptorName: string, inputData: Record<string, unknown>, options?: UseDescriptorOptions): UseDescriptorResult<T>;
|
|
18
|
+
export interface UseDescriptorMatchesResult {
|
|
19
|
+
/** All matching nodes */
|
|
20
|
+
matches: DescriptorNode[];
|
|
21
|
+
/** Error message if evaluation failed */
|
|
22
|
+
error: string | null;
|
|
23
|
+
/** Number of matches found */
|
|
24
|
+
count: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function useDescriptorMatches(manager: DescriptorManager, descriptorName: string, inputData: Record<string, unknown>): UseDescriptorMatchesResult;
|
|
27
|
+
export declare function useDescriptorExists(manager: DescriptorManager, descriptorName: string): boolean;
|
|
28
|
+
export interface UseDescriptorListOptions {
|
|
29
|
+
/** Filter by descriptor type */
|
|
30
|
+
type?: DescriptorTypeValue;
|
|
31
|
+
}
|
|
32
|
+
export declare function useDescriptorList(manager: DescriptorManager, options?: UseDescriptorListOptions): string[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DividerMode } from '../types/divider.types';
|
|
2
|
+
|
|
3
|
+
export interface UseZoneDescriptorOptions {
|
|
4
|
+
inputData: Record<string, unknown>;
|
|
5
|
+
divider?: DividerMode;
|
|
6
|
+
}
|
|
7
|
+
export declare function ZoneDescriptor({ divider, inputData }: UseZoneDescriptorOptions): {
|
|
8
|
+
updatedDivider: {
|
|
9
|
+
LINDIV1: string;
|
|
10
|
+
articleName: string;
|
|
11
|
+
type: "linear-division";
|
|
12
|
+
valueSource: "string";
|
|
13
|
+
DIVIDER: "";
|
|
14
|
+
formula: string;
|
|
15
|
+
thickness: number;
|
|
16
|
+
TREEID: string;
|
|
17
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
18
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
19
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
20
|
+
DIVELEM1: number;
|
|
21
|
+
} | {
|
|
22
|
+
LINDIV1: string;
|
|
23
|
+
articleName: string;
|
|
24
|
+
type: "linear-division";
|
|
25
|
+
valueSource: "descriptor";
|
|
26
|
+
DIVIDER: "";
|
|
27
|
+
descriptorName: string;
|
|
28
|
+
thickness: number;
|
|
29
|
+
TREEID: string;
|
|
30
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
31
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
32
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
33
|
+
DIVELEM1: number;
|
|
34
|
+
} | {
|
|
35
|
+
LINDIV1: string;
|
|
36
|
+
articleName: string;
|
|
37
|
+
type: "article";
|
|
38
|
+
valueSource: "string";
|
|
39
|
+
DIVIDER: string;
|
|
40
|
+
TREEID: string;
|
|
41
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
42
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
43
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
44
|
+
DIVELEM1: number;
|
|
45
|
+
} | {
|
|
46
|
+
LINDIV1: string;
|
|
47
|
+
articleName: string;
|
|
48
|
+
type: "article";
|
|
49
|
+
valueSource: "descriptor";
|
|
50
|
+
DIVIDER: string;
|
|
51
|
+
descriptorName: string;
|
|
52
|
+
TREEID: string;
|
|
53
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
54
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
55
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
56
|
+
DIVELEM1: number;
|
|
57
|
+
} | {
|
|
58
|
+
LINDIV1: string;
|
|
59
|
+
type: "linear-division";
|
|
60
|
+
valueSource: "string";
|
|
61
|
+
DIVIDER: "";
|
|
62
|
+
formula: string;
|
|
63
|
+
thickness: number;
|
|
64
|
+
TREEID: string;
|
|
65
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
66
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
67
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
68
|
+
DIVELEM1: number;
|
|
69
|
+
} | {
|
|
70
|
+
LINDIV1: string;
|
|
71
|
+
type: "linear-division";
|
|
72
|
+
valueSource: "descriptor";
|
|
73
|
+
DIVIDER: "";
|
|
74
|
+
descriptorName: string;
|
|
75
|
+
thickness: number;
|
|
76
|
+
TREEID: string;
|
|
77
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
78
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
79
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
80
|
+
DIVELEM1: number;
|
|
81
|
+
} | {
|
|
82
|
+
LINDIV1: string;
|
|
83
|
+
type: "article";
|
|
84
|
+
valueSource: "descriptor";
|
|
85
|
+
DIVIDER: string;
|
|
86
|
+
descriptorName: string;
|
|
87
|
+
TREEID: string;
|
|
88
|
+
DIVDIR: import('../types/divider.types').DivisionDirection;
|
|
89
|
+
DIVTYPE: import('../types/divider.types').DividerType;
|
|
90
|
+
HORDEFTYPE: import('../types/divider.types').HorizontalDefType;
|
|
91
|
+
DIVELEM1: number;
|
|
92
|
+
};
|
|
93
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";var Be=Object.defineProperty;var He=(e,t,r)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var L=(e,t,r)=>He(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("react"),be=require("@react-three/drei"),R=b.createContext(void 0);function _e({data:e,children:t,names:r}){const s=e,[i,n]=b.useState(s),[a,o]=b.useState(null),[l,h]=b.useState(null),f=b.useCallback(E=>({anglElems:i.anglelem.filter(N=>N.NAME===E),anglZones:i.anglzone.filter(N=>N.NAME===E),anglPrims:i.anglprim.filter(N=>N.NAME===E),anglClies:i.anglclie.filter(N=>N.NAME===E),anglGrtxs:i.anglgrtx.filter(N=>N.NAME===E)}),[i]),{anglElems:m,anglZones:p,anglPrims:x,anglClies:y,anglGrtxs:u}=b.useMemo(()=>r&&r.length>0?{anglElems:i.anglelem.filter(E=>r.includes(E.NAME)),anglZones:i.anglzone.filter(E=>r.includes(E.NAME)),anglPrims:i.anglprim.filter(E=>r.includes(E.NAME)),anglClies:i.anglclie.filter(E=>r.includes(E.NAME)),anglGrtxs:i.anglgrtx.filter(E=>r.includes(E.NAME))}:{anglElems:i.anglelem,anglZones:i.anglzone,anglPrims:i.anglprim,anglClies:i.anglclie,anglGrtxs:i.anglgrtx},[i,r]),C={anglElems:m,anglZones:p,anglPrims:x,anglClies:y,anglGrtxs:u,selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h,updateAnglPrim:(E,N,_)=>{n(A=>({...A,anglprim:A.anglprim.map(w=>w.NAME===E?{...w,[N]:_}:w)}))},updateAnglElem:(E,N,_,A)=>{n(w=>({...w,anglelem:w.anglelem.map(k=>k.TREEID===N&&k.NAME===E?{...k,[_]:A}:k)}))},updateAnglZone:(E,N,_,A)=>{n(w=>({...w,anglzone:w.anglzone.map(k=>k.TREEID===N&&k.NAME===E?{...k,[_]:A}:k)}))},updateAnglClie:(E,N,_,A,w)=>{n(k=>({...k,anglclie:k.anglclie.map(O=>O.TREEID===N&&O.TAGNAME===_&&O.DATATYPE===w&&O.NAME===E?{...O,TAGVALUE:A,DATE_LASTCHANGE:new Date().toISOString()}:O)}))},updateAnglGrtx:(E,N,_,A)=>{n(w=>({...w,anglgrtx:w.anglgrtx.map(k=>k.TREEID===N&&k.NUM===_&&k.NAME===E?{...k,TEXT:A,DATE_LASTCHANGE:new Date().toISOString()}:k)}))},getArticleData:f,allData:i};return c.jsx(R.Provider,{value:C,children:t})}const ue=b.createContext(null);function he({children:e,articleName:t,dimensionOverrides:r}){const s={articleName:t,dimensionOverrides:r};return c.jsx(ue.Provider,{value:s,children:e})}const fe=b.createContext(void 0);var P=(e=>(e[e.Surface=3]="Surface",e[e.Material=4]="Material",e[e.Numeric=100]="Numeric",e[e.Text=120]="Text",e))(P||{});function ce(e){return new Map(e.map(t=>[t.NAME,t]))}function ne(e,t,r=new Set){const s=t.get(e);if(!s)return;if(r.has(e)){console.error(`Circular dependency: ${[...r,e].join(" -> ")}`);return}const i=s.WERT;if(i.startsWith("$")&&s.TYP!=P.Text){const a=i.slice(1);return r.add(e),ne(a,t,r)}const n=Number(i);return isNaN(n)?i:n}function ke(e,t,r){const s=r.get(e);if(!s)return console.warn(`Variable ${e} not found`),r;const i=new Map(r);return i.set(e,{...s,WERT:String(t)}),i}function me(e,t){return e.replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(r,s)=>{const i=ne(s,t);return i!==void 0?String(i):r})}function pe(e){return/\$[A-Za-z_][A-Za-z0-9_]*/g.test(e)}function Ue(e){const t=e.matchAll(/\$([A-Za-z_][A-Za-z0-9_]*)/g);return Array.from(t,r=>r[1])}const Ze=Object.freeze(Object.defineProperty({__proto__:null,createVariableTree:ce,extractVariableNames:Ue,getValue:ne,hasVariables:pe,resolveString:me,setValue:ke},Symbol.toStringTag,{value:"Module"}));function Ae({children:e,imosVariables:t}){const[r,s]=b.useState(()=>ce(t));b.useEffect(()=>{s(ce(t))},[t]);const i=b.useCallback((a,o)=>{s(l=>ke(a,o,l))},[]),n={tree:r,setValue:i};return c.jsx(fe.Provider,{value:n,children:e})}const de=b.createContext(null),Ne=e=>{const t=Number(e);return isNaN(t)?null:t},Z=e=>e==null?"":String(e),j=(e,t,r)=>{const s=Ne(e),i=Ne(t);return s===null||i===null?!1:r(s,i)},U=(e,t,r)=>e==null||t==null?!1:r(Z(e),Z(t)),Ke={"=":(e,t)=>e==null||t==null?e===t:Z(e).trim()===Z(t).trim(),"!=":(e,t)=>e==null||t==null?e!==t:Z(e).trim()!==Z(t).trim(),">":(e,t)=>j(e,t,(r,s)=>r>s),"<":(e,t)=>j(e,t,(r,s)=>r<s),">=":(e,t)=>j(e,t,(r,s)=>r>=s),"<=":(e,t)=>j(e,t,(r,s)=>r<=s),">":(e,t)=>j(e,t,(r,s)=>r>s),">=":(e,t)=>j(e,t,(r,s)=>r>=s),"<":(e,t)=>j(e,t,(r,s)=>r<s),"<=":(e,t)=>j(e,t,(r,s)=>r<=s),B:(e,t)=>U(e,t,(r,s)=>r.startsWith(s)),"!B":(e,t)=>U(e,t,(r,s)=>!r.startsWith(s)),E:(e,t)=>U(e,t,(r,s)=>r.endsWith(s)),"!E":(e,t)=>U(e,t,(r,s)=>!r.endsWith(s)),C:(e,t)=>U(e,t,(r,s)=>r.includes(s)),"!C":(e,t)=>U(e,t,(r,s)=>!r.includes(s))},Ye={"Zusatzfilter 3":"filter3","Zusatzfilter 4":"filter4"};function De(e,t={}){const{variableTree:r,dataType:s,silent:i=!1,allowFunctions:n=!0}=t,a=/^(.+?)\s*(mm|cm|m|in|ft|px|pt|%|deg|rad)$/i,o={value:void 0,original:e,resolved:e,hadVariables:!1,wasEvaluated:!1};try{let l=e.trim(),h;if(a.test(l)){const f=l.match(a);f&&(l=f[1].trim(),h=f[2])}r&&pe(l)&&(o.hadVariables=!0,l=me(l,r),o.resolved=l),Ce(l)?(o.wasEvaluated=!0,o.value=we(l,n)):ge(l)?(o.wasEvaluated=!0,o.value=xe(l,n)):o.value=Xe(l,s)}catch(l){o.error=l instanceof Error?l.message:String(l),i||console.error(`[ExpressionResolver] Failed to resolve: "${e}"`,l),o.value=e}return o}function re(e,t={}){return De(e,t).value}function Ce(e){return!e||typeof e!="string"?!1:/^\s*IF\s*\(/i.test(e.trim())}function we(e,t=!0){const s=e.trim().match(/^IF\s*\((.*)\)\s*$/i);if(!s)throw new Error(`Invalid IF statement: ${e}`);const i=s[1],n=We(i);if(n.length!==3)throw new Error(`IF statement must have exactly 3 parts: IF(condition, trueValue, falseValue). Got: ${n.length} parts`);const[a,o,l]=n,f=ee(a.trim(),t)?o.trim():l.trim();if(Ce(f))return we(f,t);if(ge(f))return xe(f,t);{const m=Number(f);return isNaN(m)?f:m}}function We(e){const t=[];let r="",s=0;for(let i=0;i<e.length;i++){const n=e[i];n==="("?(s++,r+=n):n===")"?(s--,r+=n):n===","&&s===0?(t.push(r),r=""):r+=n}return r&&t.push(r),t}function ee(e,t){if(/\bAND\b/i.test(e))return e.split(/\bAND\b/i).every(h=>ee(h.trim(),t));if(/\bOR\b/i.test(e))return e.split(/\bOR\b/i).some(h=>ee(h.trim(),t));if(/^\s*NOT\s+/i.test(e)){const l=e.replace(/^\s*NOT\s+/i,"").trim();return!ee(l,t)}const r=e.match(/(.+?)(<=|>=|!=|<>|=|<|>)(.+)/);if(!r)throw new Error(`Invalid condition: ${e}`);const[,s,i,n]=r,a=Me(s.trim(),t),o=Me(n.trim(),t);switch(i){case"=":return a===o;case"!=":case"<>":return a!==o;case"<":return a<o;case">":return a>o;case"<=":return a<=o;case">=":return a>=o;default:throw new Error(`Unknown operator: ${i}`)}}function Me(e,t){if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if(ge(e))return xe(e,t);const r=Number(e);return isNaN(r)?e:r}function ge(e){if(!e||typeof e!="string")return!1;const t=e.trim();return/[+\-*/()]/.test(t)?/^[\d\s+\-*/().,a-z]+$/i.test(t):!1}const oe=new Map;function xe(e,t=!0){const r=e.trim(),s=`${r}:${t}`;if(oe.has(s))return oe.get(s);let i=r.replace(/\s+/g,"");if(t&&(i=i.replace(/round\(/g,"Math.round(").replace(/floor\(/g,"Math.floor(").replace(/ceil\(/g,"Math.ceil(").replace(/abs\(/g,"Math.abs(").replace(/min\(/g,"Math.min(").replace(/max\(/g,"Math.max(").replace(/pow\(/g,"Math.pow(").replace(/sqrt\(/g,"Math.sqrt(")),!(t?/^[\d+\-*/().,a-zA-Z]+$/:/^[\d+\-*/().]+$/).test(i))throw new Error(`Expression contains invalid characters: ${e}`);if(!i)throw new Error("Empty expression");try{const a=Function(`'use strict'; return (${i})`)();if(typeof a!="number"||isNaN(a))throw new Error(`Expression did not evaluate to a number: ${e}`);return oe.set(s,a),a}catch(a){throw new Error(`Failed to evaluate expression: ${e} - ${a}`)}}function Xe(e,t){if(!t){const r=Number(e);return isNaN(r)?e:r}switch(t.toUpperCase()){case"FL":return parseFloat(e);case"IN":return parseInt(e,10);case"CI":case"CS":case"ST":return e;case"DA":return new Date(e).toISOString();default:const r=Number(e);return isNaN(r)?e:r}}const qe=e=>Ye[e]||e,K=class K{};L(K,"evaluateTree",(t,r,s)=>t?t.roots.every(i=>K.evaluateNode(i,r,s)):!1),L(K,"evaluateNode",(t,r,s)=>{if(!t)return!1;if(t.kind==="comparison"){let i=t.data.LEFTVALUE;const n=qe(t.data.LEFTVALUE);r[n]!==void 0?i=r[n]:i=re(t.data.LEFTVALUE,{variableTree:s,dataType:t.data.DATATYPE,silent:!0});const a=re(t.data.RIGHTVALUE,{variableTree:s,dataType:t.data.DATATYPE,silent:!0});return Ke[t.data.COMPARISONTYPE](i,a)}if(t.kind==="operation"){const i=t.children.map(n=>K.evaluateNode(n,r,s));switch(t.data.OPSTRING){case"AND":return i.every(Boolean);case"OR":return i.some(Boolean);case"NOT":return!i.every(Boolean);case"NOT OR":return!i.some(Boolean);default:return!1}}return!1});let se=K;class Te{static evaluate(t,r,s){const i=t.nodes.find(n=>n.conditionId===0||n.conditionTree===null);for(const n of t.nodes){if(n.conditionId===0||n.conditionTree===null)continue;if(se.evaluateTree(n.conditionTree,r,s))return{lindiv:n.lindiv,nodeNum:n.nodeNum,matched:!0,isDefault:!1,descriptorType:t.descriptor.DESC_TYPE}}if(i)return{lindiv:i.lindiv,nodeNum:i.nodeNum,matched:!1,isDefault:!0,descriptorType:t.descriptor.DESC_TYPE};throw new Error("No matching node found and no default node exists")}static findAllNonDefaultMatches(t,r,s){const i=[];for(const n of t.nodes){if(n.conditionId===0||n.conditionTree===null)continue;se.evaluateTree(n.conditionTree,r,s)&&i.push(n)}return i}}class Je{constructor(t,r){L(this,"descriptors");L(this,"variableTree");this.descriptors=new Map(t.map(s=>[s.descriptor.NAME,s])),this.variableTree=r}evaluate(t,r){const s=this.getDescriptor(t);if(!s)throw new Error(`Descriptor not found: ${t}`);return Te.evaluate(s,r,this.variableTree)}getDescriptor(t){return this.descriptors.get(t)}hasDescriptor(t){return this.descriptors.has(t)}getDescriptorNames(){return Array.from(this.descriptors.keys())}getDescriptorsByType(t){return Array.from(this.descriptors.values()).filter(r=>r.descriptor.DESC_TYPE===t)}findAllMatches(t,r){const s=this.getDescriptor(t);if(!s)throw new Error(`Descriptor not found: ${t}`);return Te.findAllNonDefaultMatches(s,r,this.variableTree)}getStats(){const t={};for(const r of this.descriptors.values()){const s=r.descriptor.DESC_TYPE;t[s]=(t[s]||0)+1}return{total:this.descriptors.size,byType:t,names:this.getDescriptorNames()}}}function G(){const e=b.useContext(fe);if(!e)throw new Error("useVariables must be used within a VariableProvider");const{tree:t,setValue:r}=e,s=b.useMemo(()=>a=>ne(a,t),[t]),i=b.useMemo(()=>a=>me(a,t),[t]),n=b.useMemo(()=>a=>pe(a),[]);return{tree:t,getValue:s,resolveString:i,hasVariables:n,setValue:r}}function Le({children:e,descriptorData:t}){const r=G(),s=b.useMemo(()=>new Je(t,r.tree),[t,r]);return c.jsx(de.Provider,{value:s,children:e})}var M=(e=>(e._2D_TOP="2D_TOP",e._2D_FRONT="2D_FRONT",e._3D="3D",e))(M||{});const le=0,Qe=1,Oe=e=>e+".0",Pe=e=>e+".1",Ve=e=>e+".2",Re=e=>e+".3",Ee=e=>e.substring(0,e.lastIndexOf(".")),et=e=>{const t=Ee(e),s=(je(e)+3)%4;return`${t}.${s}`},tt=e=>{const t=Ee(e),s=(je(e)+1)%4;return`${t}.${s}`},je=e=>parseInt(e.substring(e.lastIndexOf(".")+1)),Y={IAC_THICKNESS:"IAC_THICKNESS",IAC_BOTTOMSHELFTHICKNESS:"IAC_BOTTOMSHELFTHICKNESS",IAC_TOPSHELFTHICKNESS:"IAC_TOPSHELFTHICKNESS"},S=1;function W(){const e=b.useContext(R);if(e===void 0)throw new Error("useData must be used within a DataProvider");return e}function X(){const e=b.useContext(ue);if(!e)throw new Error("useArticle must be used within an ArticleProvider");return e}function te(e,t,r){const{getArticleData:s}=W(),{articleName:i}=X(),{anglClies:n}=s(i),a=n.find(l=>l.TREEID===e&&l.DATATYPE===r&&l.TAGNAME===t);return a?{thickness:Number(a.TAGVALUE)}:null}function rt(e){const{getArticleData:t}=W(),{resolveString:r}=G(),{articleName:s}=X(),i=t(s).anglGrtxs;if(!i)return null;const n=i.filter(o=>o.TREEID===e),a=new Map;return n.map(o=>a.set(`AD zone info0${o.NUM+1}`,r(o.TEXT))),{zoneInfo:a}}function ae(e){const{getArticleData:t}=W(),{articleName:r}=X(),{anglZones:s}=t(r),i=s.find(a=>a.TREEID===e),n=s.filter(a=>a.TREEID.substring(0,a.TREEID.lastIndexOf("."))===e);return n.sort((a,o)=>a.TREEID.localeCompare(o.TREEID,void 0,{numeric:!0})),i?{currentZone:i,children:n,get topShelfCP(){return i?.TOPSHELF},get bottomShelfCP(){return i?.BOTSHELF},zoneInfo(){return rt(e)?.zoneInfo},getClieThk(a,o){return this.topShelfCP===""?0:te(a,o,Qe)?.thickness||0},get topShelfThk(){return this.getClieThk(e,Y.IAC_TOPSHELFTHICKNESS)},get bottomShelfThk(){return this.getClieThk(e,Y.IAC_BOTTOMSHELFTHICKNESS)},get dividerThk(){return this.getClieThk(e,Y.IAC_THICKNESS)}}:null}function Q(e){const{getArticleData:t}=W(),{articleName:r}=X(),{resolveString:s}=G(),{anglElems:i}=t(r),n=i.find(T=>T.TREEID===e),a=Ee(e),o=ae(a);if(!n)return null;const l=n.CPNAME===""?0:te(e,Y.IAC_THICKNESS,le)?.thickness||0,h=te(tt(e),Y.IAC_THICKNESS,le)?.thickness||0,f=te(et(e),Y.IAC_THICKNESS,le)?.thickness||0,m=n.CPNAME===""?0:n.INSETFOR!==""?re(s(n.INSETFOR)):Number(n.INSET),p=(typeof m=="string"?0:m)||0,x=n.MANINFO||"black",y=n.CPNAME,u=o?.topShelfThk||0,d=o?.bottomShelfThk||0,g={start:Number(n.STARTOFFS)||0,end:Number(n.ENDOFFS)||0,top:Number(n.TOPOFFS)||0,bottom:Number(n.BOTOFFS)||0},I={start:n.STARTTRIM,end:n.ENDTRIM,top:n.TOPTRIM,bottom:n.BOTTRIM},v={top:I.top==="S"?u:0,bottom:I.bottom==="S"?d:0};return{TREEID:e,thk:l,nxtThk:h,prvThk:f,inset:p,color:x,CPNAME:y,topThk:u,bottomThk:d,oversize:g,trim:I,elmTrimThk:v}}var D=class extends Error{constructor(e){super(`Evaluation Error: ${e}`),this.name="EvaluationError"}},z,st=(z=class{constructor(){L(this,"cache",new Map);L(this,"source","");L(this,"tokens",[]);L(this,"start",0);L(this,"current",0);L(this,"errors",[])}reportError(t){this.errors.push(t)}scan(t){if(this.cache.has(t)){const r=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,r),r}try{this.source=t;const r=this.preformScan();if(this.cache.set(this.source,r),this.cache.size>3){const s=this.cache.keys().next().value;this.cache.delete(s)}return r}catch(r){throw console.error(r),new Error(r instanceof Error?r.message:String(r))}}preformScan(){this.resetState();try{if(this.source.includes("<")||this.source.includes(">"))throw new Error("Angle brackets are not allowed in the input string");if(this.source.length===0)throw new Error("Empty input string");for(this.start=0,this.current=0,this.tokens=[],this.start===0&&this.addToken("LEFT_ANGLE_BRACKET","<");!this.isAtEnd();){this.start=this.current;const t=this.peek();switch(t){case":":this.addToken("RIGHT_ANGLE_BRACKET",">"),this.addToken("LEFT_ANGLE_BRACKET","<"),this.advance();break;case" ":case"\r":case" ":case`
|
|
2
|
+
`:this.advance();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case".":this.scanNumber();break;case"$":this.scanVariable();break;case"+":case"-":case"*":case"/":this.addToken("OPERATOR",t),this.advance();break;case"(":this.addToken("PAREN_OPEN","("),this.advance();break;case")":this.addToken("PAREN_CLOSE",")"),this.advance();break;case"{":this.current!=0&&this.tokens[this.tokens.length-1].type!="OPERATOR"&&this.addToken("OPERATOR","*"),this.addToken("BRACE_OPEN","{"),this.addToken("LEFT_ANGLE_BRACKET","<"),this.advance();break;case"}":this.addToken("RIGHT_ANGLE_BRACKET",">"),this.addToken("BRACE_CLOSE","}"),this.advance();break;case"[":this.addToken("OPERATOR","~"),this.addToken("BRACKET_OPEN","["),this.advance();break;case"]":this.addToken("BRACKET_CLOSE","]"),this.advance();break;case"m":this.peekNext()==="m"?this.scanMm():this.scanIdentifierOrFunction();break;default:this.isAlpha(t)?this.scanIdentifierOrFunction():this.reportError(`Unexpected character: ${t} at position: ${this.current}`)}}if(this.addToken("RIGHT_ANGLE_BRACKET",">"),this.addToken("EOF",""),this.errors.length>0)throw new Error(this.errors.join(`,
|
|
3
|
+
`));return this.tokens}catch(t){throw new Error(t instanceof Error?t.message:String(t))}}isAtEnd(){return this.current>=this.source.length}advance(){return this.source.charAt(this.current++)}peek(){return this.isAtEnd()?"\0":this.source.charAt(this.current)}peekNext(){return this.current+1>=this.source.length?"\0":this.source.charAt(this.current+1)}addToken(t,r){this.tokens.push({type:t,lexeme:r||(t?this.source.substring(this.start,this.current):""),position:this.start})}isDigit(t){return/^[0-9]$/.test(t)}isAlpha(t){return/^[a-zA-Z]$/.test(t)}scanNumber(){for(;this.isDigit(this.peek());)this.advance();if(this.peek()===".")for(this.advance(),this.isDigit(this.peek())||this.reportError("Expected digit after decimal point at position: "+this.current);this.isDigit(this.peek());)this.advance();this.addToken("NUMBER")}scanVariable(){for(this.advance();/[a-zA-Z0-9_]/.test(this.peek());)this.advance();const t=this.source.substring(this.start+1,this.current);if(t.endsWith("mm")){const r=t.substring(0,t.length-2);r&&r.length>0?(this.addToken("VARIABLE",r),this.addToken("UNIT","mm")):this.reportError("Variable name cannot be empty or $mm")}else this.addToken("VARIABLE",t)}scanMm(){this.advance(),this.advance(),this.addToken("UNIT","mm")}scanIdentifierOrFunction(){const t=["X","Y","n"];for(;this.isAlpha(this.peek());)this.advance();const r=this.source.substring(this.start,this.current),s=z.MATHEMATICAL_FUNCTIONS[r.toLocaleLowerCase()];s!=null?this.addToken(s,r):t.includes(r)?this.addToken("SPECIAL_VARIABLE",r):this.reportError(`Unknown identifier: ${r} at position: ${this.current}`)}resetState(){this.tokens=[],this.start=0,this.current=0,this.errors=[]}},L(z,"MATHEMATICAL_FUNCTIONS",{abs:"FUNCTION",acos:"FUNCTION",asin:"FUNCTION",atan:"FUNCTION",bog2deg:"FUNCTION",cos:"FUNCTION",deg2bog:"FUNCTION",in2mm:"FUNCTION",ln:"FUNCTION",log:"FUNCTION",log10:"FUNCTION",max:"FUNCTION",maxunder:"FUNCTION",mm2in:"FUNCTION",nextto:"FUNCTION",pi:"FUNCTION",pow:"FUNCTION",round:"FUNCTION",sin:"FUNCTION",sqr:"FUNCTION",tab:"FUNCTION",tan:"FUNCTION"}),z),it=class{constructor(){L(this,"cache",new Map);L(this,"tokens",[]);L(this,"current",0);L(this,"resetCurrent",()=>{this.current=0})}parse(e){if(this.cache.has(e)){const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}try{this.tokens=e;const t=this.performParse(e);if(this.cache.set(e,t),this.cache.size>3){const r=this.cache.keys().next().value;this.cache.delete(r)}return t}catch(t){throw new Error(t instanceof Error?t.message:String(t))}}performParse(e){if(this.resetCurrent(),this.tokens.length===0)throw new Error("No tokens to parse.");try{return this.expression()}catch(t){throw new Error(t instanceof Error?t.message:String(t))}}checkMillimeterSuffix(){if(this.isAtEnd())return!1;const e=this.peek();return e.type==="UNIT"&&e.lexeme==="mm"}consumeMillimeterSuffix(){return this.checkMillimeterSuffix()?(this.advance(),!0):!1}sections(){const e=[];if(!this.check("LEFT_ANGLE_BRACKET"))return this.expression();for(;this.check("LEFT_ANGLE_BRACKET");){this.advance();let t=this.expression();this.consume("RIGHT_ANGLE_BRACKET","Expected '>' after section expression."),e.push({type:"Section",nodes:t,hasMillimeterSuffix:this.consumeMillimeterSuffix()})}if(e.length===1){const t=e[0];return t.type==="Section"&&t.nodes.type==="Section"?t.nodes:t}return{type:"Sections",sections:e}}expression(){try{let e=this.term();for(;!this.isAtEnd()&&this.check("OPERATOR")&&["+","-"].includes(this.peek().lexeme);){this.advance();const t=this.previous().lexeme,r=this.term();e={type:"BinaryExpression",left:e,operator:t,right:r}}return e}catch(e){throw new Error(`Failed to parse expression: ${e.message}`)}}term(){try{let e=this.factor();for(;!this.isAtEnd()&&this.check("OPERATOR")&&["*","/","~"].includes(this.peek().lexeme);){this.advance();const t=this.previous().lexeme,r=this.factor();if(r.type==="SpecialVariable"&&r.name==="n")throw new Error('Invalid usage: "n" cannot appear on the right-hand side of an operator');e={type:"BinaryExpression",left:e,operator:t,right:r}}return e}catch(e){throw new Error(`Failed to parse term: ${e.message}`)}}factor(){try{if(this.check("OPERATOR")&&["-","+"].includes(this.peek().lexeme)){this.advance();const e=this.previous().lexeme,t=this.factor();return{type:"UnaryExpression",operator:e,right:t}}return this.primary()}catch(e){throw new Error(`Failed to parse factor: ${e.message}`)}}primary(){try{if(this.check("NUMBER"))return this.advance(),{type:"NumberLiteral",value:parseFloat(this.previous().lexeme),hasMillimeterSuffix:this.consumeMillimeterSuffix()};if(this.check("VARIABLE"))return this.advance(),{type:"Variable",name:this.previous().lexeme,hasMillimeterSuffix:this.consumeMillimeterSuffix()};if(this.check("SPECIAL_VARIABLE"))return this.advance(),{type:"SpecialVariable",name:this.previous().lexeme,hasMillimeterSuffix:this.previous().lexeme==="n"};if(this.check("FUNCTION")){this.advance();const e=this.previous().lexeme;this.consume("PAREN_OPEN",`Expected '(' after function name '${e}'.`);const t=this.expression();return this.consume("PAREN_CLOSE","Expected ')' after function arguments."),{type:"FunctionCall",name:e,arg:t,hasMillimeterSuffix:this.consumeMillimeterSuffix()}}if(this.check("PAREN_OPEN")){this.advance();const e=this.expression();if(!e)throw new Error("Expected expression inside parentheses.");return this.consume("PAREN_CLOSE","Expected ')' after expression."),{type:"Grouping",expression:e,hasMillimeterSuffix:this.consumeMillimeterSuffix()}}if(this.check("PAREN_CLOSE"))throw new Error("Unexpected ')' without a matching '('.");if(this.check("BRACE_OPEN")){this.advance();let e=this.sections();return this.consume("BRACE_CLOSE","Expected '}' after expression."),e.type==="Section"&&e.nodes.type==="Section"&&(e=e.nodes),{type:"Repeated",toRepeat:e,hasMillimeterSuffix:this.consumeMillimeterSuffix()}}if(this.check("LEFT_ANGLE_BRACKET"))return this.sections();throw new Error(`Unexpected token: ${this.peek().lexeme}`)}catch(e){throw new Error(`Failed to parse primary: ${e.message}`)}}check(e){return this.isAtEnd()?!1:this.peek().type===e}advance(){return this.isAtEnd()||this.current++,this.previous()}consume(e,t){if(this.check(e))return this.advance();throw new Error(t)}isAtEnd(){return this.current>=this.tokens.length}peek(){return this.tokens[this.current]}previous(){return this.tokens[this.current-1]}},ye=e=>e.type==="SpecialVariable"&&e.name==="n";function nt(e,t){if(e.right.type==="SpecialVariable"&&e.right.name==="n")return new D("Cannot have n in the right side of an expression");const r=ye(e.left)?e.left:this.evaluate(e.left),s=ye(e.right)?e.right:this.evaluate(e.right);if(r instanceof D)return r;if(s instanceof D)return s;const i=r.type==="NumberLiteral"&&s.type==="NumberLiteral",n=i?r.hasMillimeterSuffix===s.hasMillimeterSuffix:!1,a=o=>o.type==="Repeated";switch(e.operator){case"+":return i&&n&&t?.isInsideGroup==!1?{type:"NumberLiteral",value:r.value+s.value,hasMillimeterSuffix:r.hasMillimeterSuffix===!0||s.hasMillimeterSuffix===!0,spreadMm:r.spreadMm||s.spreadMm}:i&&t?.isInsideGroup==!0?{type:"NumberLiteral",value:r.value+s.value,spreadMm:r.hasMillimeterSuffix||s.hasMillimeterSuffix}:{type:"BinaryExpression",operator:"+",left:r,right:s};case"*":return i&&t?.isInsideGroup==!0?{type:"NumberLiteral",value:r.value*s.value,hasMillimeterSuffix:r.hasMillimeterSuffix===!0||s.hasMillimeterSuffix===!0,spreadMm:r.spreadMm||s.spreadMm}:a(s)&&r.type==="NumberLiteral"?{type:"Repeated",toRepeat:s.toRepeat,times:Math.round(r.value),hasMillimeterSuffix:s.type==="NumberLiteral"&&s.hasMillimeterSuffix||!1}:t?.isInsideGroup==!1&&r.type!=="SpecialVariable"&&r.name!=="n"?new D("cannot have * outside of group"):r.type==="SpecialVariable"?{type:"BinaryExpression",operator:"*",left:r,right:{type:"NumberLiteral",value:s.value,hasMillimeterSuffix:!0}}:{type:"BinaryExpression",operator:"*",left:r,right:s,hasMillimeterSuffix:r.hasMillimeterSuffix||s.hasMillimeterSuffix};case"/":if(i&&t?.isInsideGroup==!0)return{type:"NumberLiteral",value:r.value/s.value,hasMillimeterSuffix:r.hasMillimeterSuffix===!0||s.hasMillimeterSuffix===!0};if(t?.isInsideGroup==!1)return new D("cannot have / outside of group");case"-":return i&&n&&t?.isInsideGroup==!1?{type:"NumberLiteral",value:r.value-s.value,hasMillimeterSuffix:r.hasMillimeterSuffix===!0||s.hasMillimeterSuffix===!0,spreadMm:r.spreadMm||s.spreadMm}:i&&t?.isInsideGroup==!0?{type:"NumberLiteral",value:r.value-s.value,spreadMm:r.hasMillimeterSuffix||s.hasMillimeterSuffix}:{type:"BinaryExpression",operator:"-",left:r,right:s};default:throw new D("Invalid Operator")}}function at(e,t){const r=this.evaluate(e.arg);if(r instanceof D)throw new D("Error in function arguments");switch(e.name.toLowerCase()){case"abs":return{type:"NumberLiteral",value:Math.abs(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"acos":return{type:"NumberLiteral",value:Math.acos(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"asin":return{type:"NumberLiteral",value:Math.asin(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"atan":return{type:"NumberLiteral",value:Math.atan(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"cos":return{type:"NumberLiteral",value:Math.cos(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"sin":return{type:"NumberLiteral",value:Math.sin(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"tan":return{type:"NumberLiteral",value:Math.tan(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"round":return{type:"NumberLiteral",value:Math.round(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"bog2deg":return{type:"NumberLiteral",value:r.value*(180/Math.PI),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"deg2bog":return{type:"NumberLiteral",value:r.value*(Math.PI/180),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"in2mm":return{type:"NumberLiteral",value:r.value*25.4,hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"mm2in":return{type:"NumberLiteral",value:r.value/25.4,hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"ln":return{type:"NumberLiteral",value:Math.log(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};case"log10":return{type:"NumberLiteral",value:Math.log10(r.value),hasMillimeterSuffix:r.hasMillimeterSuffix,spreadMm:t?.isInsideGroup===!1};default:throw new D("Function not implemented")}}function ot(e){if(!this.variables||!(e.name in this.variables))throw new D(`Variable ${e.name} is not defined.`);return{type:"NumberLiteral",value:this.variables[e.name],hasMillimeterSuffix:e.hasMillimeterSuffix}}var lt=class{constructor(){L(this,"nestingLevel",0);L(this,"variables",{});L(this,"evaluateBinaryExpression");L(this,"evaluateFunction");L(this,"evaluateVariable");this.evaluateBinaryExpression=nt.bind(this),this.evaluateFunction=at.bind(this),this.evaluateVariable=ot.bind(this)}evaluate(e,t={isInsideGroup:!1},r){this.nestingLevel++;try{if(r&&(this.variables=r),this.isSections(e))return this.evaluateSections(e,t);if(this.isSection(e)){const s=this.evaluate(e.nodes,t);return s instanceof D?new D(`Error in section ${JSON.stringify(e)}`):{...e,nodes:s}}if(this.isNumberLiteral(e))if(t.isInsideGroup){if(e.hasMillimeterSuffix)return{...e,spreadMm:!0}}else return e;if(this.isGrouping(e)){t={...t,isInsideGroup:!0};const s=this.evaluate(e.expression,t);return s instanceof D?s:{...s,hasMillimeterSuffix:e.hasMillimeterSuffix}}if(this.isRepeated(e)){const s=this.evaluate(e.toRepeat);return s instanceof D?s:{...e,toRepeat:s}}if(this.isBinaryExpression(e))return this.evaluateBinaryExpression(e,t);if(this.isUnaryExpression(e))return{type:"NumberLiteral",value:e.operator==="-"?-1*e.right.value:e.right.value,hasMillimeterSuffix:e.right.hasMillimeterSuffix};if(this.isFunctionCall(e))return this.evaluateFunction(e,t);if(this.isVariable(e)){if(this.variables)return this.evaluateVariable(e);throw new D("No variables defined.")}throw new D(`unsupported node type: ${e.type}`)}catch(s){throw new D(s.message)}finally{this.nestingLevel--}}isUnaryExpression(e){return e.type==="UnaryExpression"}isNumberLiteral(e){return e.type==="NumberLiteral"}isVariable(e){return e.type==="Variable"||e.type==="SpecialVariable"}isBinaryExpression(e){return e.type==="BinaryExpression"}isFunctionCall(e){return e.type==="FunctionCall"}isGrouping(e){return e.type==="Grouping"}isRepeated(e){return e.type==="Repeated"}isSections(e){return e.type==="Sections"}isSection(e){return e.type==="Section"}evaluateSections(e,t={isInsideGroup:!1}){return{type:"Sections",sections:e.sections.map(s=>{const i=this.evaluate(s.nodes);if(i instanceof D)throw i;return{type:"Section",nodes:i}})}}};function F(e,t){if(!e)throw new D(`unsupported node type to traverse: ${JSON.stringify(e)}`);t(e),e.type==="Sections"&&Array.isArray(e.sections)?e.sections.forEach(r=>F(r,t)):e.type==="Section"&&e.nodes?F(e.nodes,t):e.type}var ct=class{accumulateIncorporatedThicknesses(e,t,r,s,i,n,a,o,l){let h=0;if(a==="M")for(let f=1;f<e.sections.length-1;f++)h+=s;if(a==="O")for(let f=1;f<e.sections.length-1;f++)h+=s*2;return i==="M"&&(h+=t/2),i==="O"&&(h+=t),n==="M"&&(h+=t/2),n==="O"&&(h+=t),l==="M"&&(h+=r/2),l==="O"&&(h+=r),o==="M"&&(h+=r/2),o==="O"&&(h+=r),h}},ut=class{calculateSections(e,t=500,r=0,s){try{if(e instanceof D)throw e;if(e.type!=="Sections"&&e.type!=="Section")throw new D(`Expected Sections or Section, got ${JSON.stringify(e)}`);let i={type:"Sections",sections:[]};if(e.type==="Sections")for(const u of e.sections)if(u.nodes.type==="Repeated"&&u.nodes.times){for(let d=0;d<(u.nodes?.times??0);d++)if(u.nodes.toRepeat.type==="Section")i.sections.push(u.nodes.toRepeat);else if(u.nodes.toRepeat.type==="Sections")for(const g of u.nodes.toRepeat.sections)i.sections.push(g)}else i.sections.push(u);else e.type==="Section"&&i.sections.push(e);if(s){const d=new ct().accumulateIncorporatedThicknesses(i,s.startPanelThk,s.endPanelThk,r,s.sizerefout1,s.sizerefedg1,s.sizerefmid,s.sizerefedg2,s.sizerefout2)}i.sections.forEach(u=>{let d=!1;F(u,g=>{g.type==="NumberLiteral"?g?.spreadMm===!0&&(d=!0):g.type==="BinaryExpression"&&g.left.type==="NumberLiteral"&&(g.left?.spreadMm===!0&&(d=!0),g.right?.spreadMm===!0&&(d=!0))}),d&&F(u,g=>{g.type==="NumberLiteral"?g.hasMillimeterSuffix=!0:g.type==="BinaryExpression"&&(g.left.type==="NumberLiteral"&&(g.left.hasMillimeterSuffix=!0),g.right.type==="NumberLiteral"&&(g.right.hasMillimeterSuffix=!0))})});let n=0;const a=u=>{if(r&&u.type==="Section"&&(n+=r),u.type==="NumberLiteral")u.hasMillimeterSuffix===!0&&(n+=u.value);else if(u.type==="BinaryExpression"){const d=u;d.left.type==="NumberLiteral"&&d.right.type==="NumberLiteral"&&(d.left.hasMillimeterSuffix===!0&&(n+=d.left.value),d.right.hasMillimeterSuffix===!0&&(n+=d.right.value))}};if(i.sections.forEach(u=>F(u,a)),n>t)throw new D("Total length exceeded");let o=t-n+r,l=0;const h=u=>{if(u.type==="BinaryExpression"){const d=u;if(d.right.type==="NumberLiteral"&&d.left.type==="SpecialVariable"&&d.left.name==="n"&&d.operator==="*"){l=Math.floor(o/(d.right.value+r));const g=(l-1)*r,I=l*d.right.value;o+=-g-I}}};i.sections.forEach(u=>F(u,h));let f=0;const m=u=>{u.type==="BinaryExpression"&&(u.left.type==="NumberLiteral"&&u.left.hasMillimeterSuffix===!1&&(f+=u.left.value),u.right.type==="NumberLiteral"&&u.right.hasMillimeterSuffix===!1&&(f+=u.right.value)),u.type==="NumberLiteral"&&u.hasMillimeterSuffix===!1&&(f+=u.value)};i.sections.forEach(u=>{F(u,m)});const p=o/f,x=[],y=u=>{let d=0,g=0;if(u.type==="NumberLiteral")u.hasMillimeterSuffix===!1&&(d+=u.value*p),u.hasMillimeterSuffix===!0&&(g+=u.value),x.push(Number((d+g).toFixed(2)));else if(u.type==="BinaryExpression"&&(u.left.type==="NumberLiteral"&&u.right.type==="NumberLiteral"&&(u.left.hasMillimeterSuffix===!1&&(d+=u.left.value*p),u.left.hasMillimeterSuffix===!0&&(g+=u.left.value),u.right.hasMillimeterSuffix===!1&&(d+=u.right.value*p),u.right.hasMillimeterSuffix===!0&&(g+=u.right.value),x.push(Number((d+g).toFixed(2)))),u.left.type==="SpecialVariable"&&u.left.name==="n"&&u.right.type==="NumberLiteral")){g+=u.right.value;for(let I=0;I<l;I++)u.right.hasMillimeterSuffix===!0&&x.push(Number(g.toFixed(2)))}};return i.sections.forEach(u=>{F(u,y)}),x}catch{return new D("Error calculating sections")}}},ht=new st,ft=new it,mt=new lt,pt=(e,t,r,s)=>{try{const i=ht.scan(e),n=ft.parse(i),a=mt.evaluate(n,{},s);if(a&&!(a instanceof D)){const l=new ut().calculateSections(a,t,r);if(l&&l instanceof D)throw new Error(l.message);return l}return a||new D("Unknown error during evaluation.")}catch(i){return new D(i.message)}};function dt(e){const t=/^(\d+)\*\{(\d+)\}$/,r=e.match(t);if(r){const s=parseInt(r[1],10),i=r[2];return s>0?Array(s).fill(i).join(":"):""}return e}function gt(e){const t=e.trim().match(/^(\d+(?:\.\d+)?)\s*\*\s*\{.+\}$/);return t?Number(t[1]):e}function xt(e,t,r){let s=0;const{LINDIV1:i,DIVDIR:n,HORDEFTYPE:a,DIVELEM1:o}=e;let l="width";if(i==="")return{divisionType:l,zone_dimensions:[],divided_length_list:[]};if(n==="H")if(a==="W")s=t.width,l="width";else if(a==="D")s=t.depth,l="depth";else if(a==="P")if(o===0||o===2)s=t.width,l="width";else if(o===1||o===3)s=t.depth,l="depth";else throw new Error("Unhandled case: DIVELEM1 = "+o);else throw new Error("Unhandled case: HORDEFTYPE = "+a);else if(n==="V")s=t.height,l="height";else if(n==="A")s=t.width,l="article";else if(n==="I")s=t.width,l="independent";else throw new Error("Unhandled case: DIVDIR = "+n);let h=[];const f=dt(i);if(l==="independent"){const p=gt(i);h=Array(p).fill(s)}else l==="article"?h=[s]:h=pt(f,s,r);return Array.isArray(h)?(a==="P"&&(o===2||o===3)&&(h=[...h].reverse()),{zone_dimensions:h.map(p=>{if(l==="width")return{width:p,height:t.height,depth:t.depth};if(l==="depth")return{width:t.width,height:t.height,depth:p};if(l==="height")return{width:t.width,height:p,depth:t.depth};if(l==="article"||l==="independent")return{width:t.width,height:t.height,depth:t.depth};throw new Error("Unhandled case: DIVDIR = "+n)}),divisionType:l,divided_length_list:h}):{divisionType:l,zone_dimensions:[],divided_length_list:[]}}function Et({divisionType:e,parentDimensions:t,lengthList:r,childTREEIDs:s,dividerThk:i}){const n=-t.width/2,a=-t.depth/2,o=-t.height/2;return{childPositions:r.reduce((h,f,m)=>{let p=0,x=0,y=0,u;return e==="width"?(p=n+h.cumulativeX+f/2,x=0,y=0,u={width:f,height:t.height,depth:t.depth},h.cumulativeX+=f+i):e==="depth"?(p=0,x=a+h.cumulativeY+f/2,y=0,u={width:t.width,height:t.height,depth:f},h.cumulativeY+=f+i):e==="independent"||e==="article"?(p=0,x=0,y=0,u={width:f,height:t.height,depth:t.depth}):(p=0,x=0,y=o+h.cumulativeZ+f/2,u={width:t.width,height:f,depth:t.depth},h.cumulativeZ+=f+i),h.positions.push({x:p,y:x,z:y,zone_dims:u,TREEID:s[m]}),h},{cumulativeX:0,cumulativeY:0,cumulativeZ:0,positions:[]}).positions,dividerType:e}}function St(e){return{front:Q(Oe(e)),left:Q(Re(e)),right:Q(Pe(e)),back:Q(Ve(e))}}function vt(e,t,r){return{front:e.front?.thk||0,right:e.right?.thk||0,back:e.back?.thk||0,left:e.left?.thk||0,top:t,bottom:r}}function Nt(e){return{front:e.front?.inset||0,right:e.right?.inset||0,back:e.back?.inset||0,left:e.left?.inset||0}}function Mt(e,t){return{dimensions:{width:e.width-t.left-t.right,height:e.height,depth:e.depth-t.front-t.back},position:{x:t.left/2-t.right/2,y:t.front/2-t.back/2,z:0}}}function Tt(e,t){return{dimensions:{width:e.dimensions.width-t.left-t.right,height:e.dimensions.height-t.top-t.bottom,depth:e.dimensions.depth-t.front-t.back},position:{x:t.left/2-t.right/2,y:t.front/2-t.back/2,z:t.bottom/2-t.top/2}}}function yt(e,t,r,s){return t.divisionType?Et({divisionType:t.divisionType,parentDimensions:e,lengthList:t.divided_length_list,childTREEIDs:s,dividerThk:Number(r)||0}):{childPositions:[],dividerType:"height"}}function It(e,t,r,s){if(!r)return{childPositions:[],dividerType:"height"};const i=xt(r,e.dimensions,t);return yt(e.dimensions,i,t,s)}function B({length:e,width:t,thk:r,material:s="gray",opacity:i=.2,isSelected:n=!1,isHovered:a=!1,onClick:o,onPointerEnter:l,onPointerLeave:h}){const f=n?"#ff6b00":a?"#0066ff":s,m=n?.8:a?.6:i;return c.jsx("group",{children:c.jsxs("mesh",{onClick:o,onPointerEnter:l,onPointerLeave:h,children:[c.jsx("boxGeometry",{args:[e/S,t/S,r/S]}),c.jsx("meshStandardMaterial",{color:f,opacity:m,transparent:!0}),c.jsx(be.Edges,{color:n?"#ff6b00":a?"#0066ff":"black"})]})})}function bt(e,t,r=0,s=0){const i=e/2,n=t/2,a=i,o=n;return`
|
|
4
|
+
${a},${-o}
|
|
5
|
+
${-a},${-o}
|
|
6
|
+
${-a+r},${o}
|
|
7
|
+
${a-s},${o}
|
|
8
|
+
`.trim().replace(/\s+/g," ")}function H({dim_x:e,dim_y:t,fill:r="lightgray",text:s="",stroke_width:i=2,rotate:n=0,isSelected:a=!1,isHovered:o=!1,onClick:l,onMouseEnter:h,onMouseLeave:f,startPanelThk:m=0,endPanelThk:p=0}){const x=bt(e,t,m,p),y=a?"#ff6b00":o?"#0066ff":"black",u=a?i*2:o?i*1.5:i,d=a?.8:o?.7:.5;return c.jsxs("g",{transform:`rotate(${n})`,children:[c.jsx("polygon",{points:x,stroke:y,strokeWidth:u,fill:r,strokeLinejoin:"bevel",strokeMiterlimit:"1",opacity:d,onClick:l,onMouseEnter:h,onMouseLeave:f,style:{cursor:l?"pointer":"default"}}),c.jsx("text",{transform:"scale(1,-1)",x:0,y:0,textAnchor:"middle",dominantBaseline:"middle",fontSize:14,children:s})]})}function _t({TREEID:e,dimension:t,view:r,helper:s}){const i=s.front,n=b.useContext(R);if(!i||!n)return;const{selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h}=n,{CPNAME:f}=i;if(!f)return null;const{elmTrimThk:m}=i,p=s.left?.thk,x=s.right?.thk,y=(i.trim.start==="S"?p:0)??0,u=(i.trim.end==="S"?x:0)??0,d=(i.trim.start==="M"?p:0)??0,g=(i.trim.end==="M"?x:0)??0,I=t.height-m.top-m.bottom+i.oversize.top+i.oversize.bottom,v=t.width-y-u+i.oversize.start+i.oversize.end,T=i.thk,C=-(i.oversize.start/2-i.oversize.end/2-y/2+u/2),E=i.oversize.bottom/2-i.oversize.top/2+m.bottom/2-m.top/2,N=-(t.depth/2-T/2),_=a===e,A=l===e,w=()=>{console.log("handleClick",e),o(_?null:e)},k=()=>{h(e)},O=()=>{h(null)};return r===M._3D?c.jsx("group",{position:[C/S,N/S,E/S],rotation:[Math.PI/2,0,Math.PI/2],children:c.jsx(B,{length:I,width:v,thk:T,treeId:e,isSelected:_,isHovered:A,onClick:w,onPointerEnter:k,onPointerLeave:O})}):c.jsx("g",{transform:`translate(${C},${r===M._2D_TOP?N:E}) rotate(0)`,children:c.jsx(H,{dim_x:v,dim_y:r===M._2D_TOP?T:I,text:"front "+I+" x "+v+" x "+T,treeId:e,isSelected:_,isHovered:A,onClick:w,onMouseEnter:k,onMouseLeave:O,startPanelThk:r===M._2D_TOP?d:0,endPanelThk:r===M._2D_TOP?g:0})})}const J=({view:e=M._3D,position:t=[0,0,0],rotation:r=[0,0,0],children:s})=>{if(e===M._3D)return c.jsx("group",{position:[t[0]/S,t[1]/S,t[2]/S],rotation:r,children:s});const i=t[0],n=e===M._2D_TOP?t[1]:t[2],a=r[2]*(180/Math.PI);return c.jsx("g",{transform:`translate(${i},${n}) rotate(${a})`,children:s})};function kt({TREEID:e,dimension:t,view:r,helper:s}){const i=s.left,n=b.useContext(R);if(!i||!n)return;const{selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h}=n,{CPNAME:f}=i;if(!f)return null;const{elmTrimThk:m}=i,p=s.back?.thk,x=s.front?.thk,y=(i.trim.start==="S"?p:0)??0,u=(i.trim.end==="S"?x:0)??0,d=(i.trim.start==="M"?p:0)??0,g=(i.trim.end==="M"?x:0)??0,I=t.height-m.top-m.bottom+i.oversize.top+i.oversize.bottom,v=t.depth-y-u+i.oversize.start+i.oversize.end,T=i.thk,C=-(t.width/2-T/2),E=i.oversize.start/2-i.oversize.end/2-y/2+u/2,N=i.oversize.bottom/2-i.oversize.top/2+m.bottom/2-m.top/2,_=a===e,A=l===e,w=()=>{o(_?null:e)},k=()=>{h(e)},O=()=>{h(null)};return r===M._3D?c.jsx("group",{position:[C/S,E/S,N/S],rotation:[0,Math.PI/2,0],children:c.jsx(B,{length:I,width:v,thk:T,treeId:e,isSelected:_,isHovered:A,onClick:w,onPointerEnter:k,onPointerLeave:O})}):c.jsx("g",{transform:`translate(${C},${r===M._2D_TOP?E:N}) rotate(90)`,children:c.jsx(H,{dim_x:r===M._2D_TOP?v:I,dim_y:T,text:"left "+I+" x "+v+" x "+T,treeId:e,rotate:180,isSelected:_,isHovered:A,onClick:w,onMouseEnter:k,onMouseLeave:O,startPanelThk:r===M._2D_TOP?d:0,endPanelThk:r===M._2D_TOP?g:0})})}function At({TREEID:e,dimension:t,view:r,helper:s}){const i=s.back,n=b.useContext(R);if(!i||!n)return;const{selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h}=n,{CPNAME:f}=i;if(!f)return null;const{elmTrimThk:m}=i,p=s.right?.thk,x=s.left?.thk,y=(i.trim.start==="S"?p:0)??0,u=(i.trim.end==="S"?x:0)??0,d=(i.trim.start==="M"?p:0)??0,g=(i.trim.end==="M"?x:0)??0,I=t.height-m.top-m.bottom+i.oversize.top+i.oversize.bottom,v=t.width-y-u+i.oversize.start+i.oversize.end,T=i.thk,C=i.oversize.start/2-i.oversize.end/2-y/2+u/2,E=t.depth/2-T/2,N=i.oversize.bottom/2-i.oversize.top/2+m.bottom/2-m.top/2,_=a===e,A=l===e,w=()=>{o(_?null:e)},k=()=>{h(e)},O=()=>{h(null)};return r===M._3D?c.jsxs("group",{position:[C/S,E/S,N/S],rotation:[Math.PI/2,0,Math.PI/2],children:[c.jsx(B,{length:I,width:v,thk:T,treeId:e,isSelected:_,isHovered:A,onClick:w,onPointerEnter:k,onPointerLeave:O}),c.jsx(be.Text,{position:[0,0,0],color:"blue",fontSize:20,children:e})]}):c.jsx("g",{transform:`translate(${C},${r===M._2D_TOP?E:N}) rotate(0)`,children:c.jsx(H,{dim_x:v,dim_y:r===M._2D_TOP?T:I,text:"Back "+I+" x "+v+" x "+T,treeId:e,isSelected:_,rotate:180,isHovered:A,onClick:w,onMouseEnter:k,onMouseLeave:O,startPanelThk:r===M._2D_TOP?d:0,endPanelThk:r===M._2D_TOP?g:0})})}function Dt({TREEID:e,dimension:t,view:r,helper:s}){const i=s.right,n=b.useContext(R);if(!i||!n)return;const{selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h}=n,{CPNAME:f}=i;if(!f)return null;const{elmTrimThk:m}=i,p=s.front?.thk,x=s.back?.thk,y=(i.trim.start==="S"?p:0)??0,u=(i.trim.end==="S"?x:0)??0,d=(i.trim.start==="M"?p:0)??0,g=(i.trim.end==="M"?x:0)??0,I=t.height-m.top-m.bottom+i.oversize.top+i.oversize.bottom,v=t.depth-y-u+i.oversize.start+i.oversize.end,T=i.thk,C=t.width/2-T/2,E=-(i.oversize.start/2-i.oversize.end/2-y/2+u/2),N=i.oversize.bottom/2+i.oversize.top/2+m.bottom/2-m.top/2,_=a===e,A=l===e,w=()=>{o(_?null:e)},k=()=>{h(e)},O=()=>{h(null)};return r===M._3D?c.jsx("group",{position:[C/S,E/S,N/S],rotation:[0,Math.PI/2,0],children:c.jsx(B,{length:I,width:v,thk:T,treeId:e,isSelected:_,isHovered:A,onClick:w,onPointerEnter:k,onPointerLeave:O})}):c.jsx("g",{transform:`translate(${C},${r===M._2D_TOP?E:N}) rotate(90)`,children:c.jsx(H,{dim_x:r===M._2D_TOP?v:I,dim_y:T,text:"right "+I+" x "+v+" x "+T,treeId:e,isSelected:_,isHovered:A,onClick:w,onMouseEnter:k,onMouseLeave:O,startPanelThk:r===M._2D_TOP?d:0,endPanelThk:r===M._2D_TOP?g:0})})}function Ct({TREEID:e,dimension:t,view:r,helper:s}){const i=ae(e),n=b.useContext(R);if(!i||!n)return;const{selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h}=n,{topShelfCP:f}=i;if(!f)return;const m=(s.front?.trim.top!=="S"?s.front?.thk:0)??0,p=(s.back?.trim.top!=="S"?s.back?.thk:0)??0,x=(s.left?.trim.top!=="S"?s.left?.thk:0)??0,y=(s.right?.trim.top!=="S"?s.right?.thk:0)??0,u=t.width-x-y,d=t.depth-p-m,g=i.topShelfThk,I=x/2-y/2,v=-(p/2-m/2),T=t.height/2-g/2,C=a===e,E=l===e,N=()=>{o(C?null:e)},_=()=>{h(e)},A=()=>{h(null)};return r===M._3D?c.jsx("group",{position:[I/S,v/S,T/S],rotation:[0,0,0],children:c.jsx(B,{length:u,width:d,thk:g,opacity:.8,treeId:e,isSelected:C,isHovered:E,onClick:N,onPointerEnter:_,onPointerLeave:A})}):c.jsx("g",{transform:`translate(${I},${r===M._2D_TOP?v:T})`,children:c.jsx(H,{dim_x:u,dim_y:r===M._2D_TOP?d:g,text:"Top "+e+" -- "+u+" x "+d+" x "+g,treeId:e,isSelected:C,isHovered:E,onClick:N,onMouseEnter:_,onMouseLeave:A})})}function wt({TREEID:e,dimension:t,view:r,helper:s}){const i=ae(e),n=b.useContext(R);if(!i||!n)return;const{selectedElem:a,setSelectedElem:o,hoveredElem:l,setHoveredElem:h}=n,{bottomShelfCP:f}=i;if(!f)return;const m=(s.front?.trim.bottom!=="S"?s.front?.thk:0)??0,p=(s.back?.trim.bottom!=="S"?s.back?.thk:0)??0,x=(s.left?.trim.bottom!=="S"?s.left?.thk:0)??0,y=(s.right?.trim.bottom!=="S"?s.right?.thk:0)??0,u=t.width-x-y,d=t.depth-p-m,g=i.bottomShelfThk,I=x/2-y/2,v=-(p/2-m/2),T=-(t.height/2-g/2),C=a===e,E=l===e,N=()=>{o(C?null:e)},_=()=>{h(e)},A=()=>{h(null)};return r===M._3D?c.jsx("group",{position:[I/S,v/S,T/S],rotation:[0,0,0],children:c.jsx(B,{length:u,width:d,thk:g,opacity:.8,treeId:e,isSelected:C,isHovered:E,onClick:N,onPointerEnter:_,onPointerLeave:A})}):c.jsx("g",{transform:`translate(${I},${r===M._2D_TOP?v:T})`,children:c.jsx(H,{dim_x:u,dim_y:r===M._2D_TOP?d:g,text:"Bot "+u+" x "+d+" x "+g,treeId:e,isSelected:C,isHovered:E,onClick:N,onMouseEnter:_,onMouseLeave:A})})}function Fe(){const e=b.useContext(de);if(!e)throw new Error("useDescriptorManager must be used within a DescriptorProvider");return e}function $e(e,t,r,s={}){const{throwOnError:i=!1}=s;if(!e.hasDescriptor(t))throw new Error(`Descriptor ${t} not found`);return b.useMemo(()=>{try{return{result:e.evaluate(t,r),error:null,success:!0}}catch(n){const a=n instanceof Error?n.message:"Unknown error";if(i)throw n;return{result:null,error:a,success:!1}}},[e,t,r,i])}function Lt(e,t,r){return b.useMemo(()=>{try{const s=e.findAllMatches(t,r);return{matches:s,error:null,count:s.length}}catch(s){const i=s instanceof Error?s.message:"Unknown error";return{matches:[],error:i,count:0}}},[e,t,r])}const V={LINEAR_DIVISION:"linear-division",ARTICLE:"article"},$={STRING:"string",DESCRIPTOR:"descriptor"},Ie={linearDivision:e=>e.type===V.LINEAR_DIVISION,article:e=>e.type===V.ARTICLE},Ot={string:e=>e.type===V.LINEAR_DIVISION&&e.valueSource===$.STRING,descriptor:e=>e.type===V.LINEAR_DIVISION&&e.valueSource===$.DESCRIPTOR},ie={string:e=>e.type===V.ARTICLE&&e.valueSource===$.STRING,descriptor:e=>e.type===V.ARTICLE&&e.valueSource===$.DESCRIPTOR},q={linearDivisionString(e,t,r,s,i,n,a,o){return{TREEID:e,type:V.LINEAR_DIVISION,valueSource:$.STRING,DIVDIR:t,DIVTYPE:r,HORDEFTYPE:s,LINDIV1:i,DIVELEM1:n,DIVIDER:"",formula:a,thickness:o}},linearDivisionDescriptor(e,t,r,s,i,n,a,o){return{TREEID:e,type:V.LINEAR_DIVISION,valueSource:$.DESCRIPTOR,DIVDIR:t,DIVTYPE:r,HORDEFTYPE:s,LINDIV1:i,DIVELEM1:n,DIVIDER:"",descriptorName:a,thickness:o}},articleString(e,t,r,s,i,n,a){return{TREEID:e,type:V.ARTICLE,valueSource:$.STRING,DIVDIR:t,DIVTYPE:r,HORDEFTYPE:s,LINDIV1:i,DIVELEM1:n,DIVIDER:a,articleName:a}},articleDescriptor(e,t,r,s,i,n,a){return{TREEID:e,type:V.ARTICLE,valueSource:$.DESCRIPTOR,DIVDIR:t,DIVTYPE:r,HORDEFTYPE:s,LINDIV1:i,DIVELEM1:n,DIVIDER:a,descriptorName:a}},fromZoneData(e,t){const r=s=>s.trim().startsWith("#");if(e.DIVDIR==="A"){if(r(e.DIVIDER)){const s=e.DIVIDER.replace("#","").trim();return q.articleDescriptor(e.TREEID,e.DIVDIR,e.DIVTYPE,e.HORDEFTYPE,e.LINDIV1,e.DIVELEM1,s)}return q.articleString(e.TREEID,e.DIVDIR,e.DIVTYPE,e.HORDEFTYPE,e.LINDIV1,e.DIVELEM1,e.DIVIDER)}if(r(e.LINDIV1)){const s=e.LINDIV1.replace("#","").trim();return q.linearDivisionDescriptor(e.TREEID,e.DIVDIR,e.DIVTYPE,e.HORDEFTYPE,e.LINDIV1,e.DIVELEM1,s,t)}return q.linearDivisionString(e.TREEID,e.DIVDIR,e.DIVTYPE,e.HORDEFTYPE,e.LINDIV1,e.DIVELEM1,e.LINDIV1,t)}};function Pt(e){if(!e)return"width";const t={0:"width",1:"depth",2:"width",3:"depth"};return e.DIVDIR==="V"?"height":e.HORDEFTYPE==="W"?"width":e.HORDEFTYPE==="D"?"depth":e.HORDEFTYPE==="P"?t[e.DIVELEM1]??"width":"width"}function Vt(e,t){return t?t[e]:0}function Rt(e,t){const r=e;if($t(e))return{value:e.startsWith("#")?e.slice(1):e,original:r,isReference:!0};if(/^\d+:\d+$/.test(e))return{value:e,original:r,isReference:!1};const{format:s,expression:i,suffix:n}=Ft(e);let a=i;a=a.replace(/^\((.+)\)$/,"$1");const l=De(a,{variableTree:t,allowFunctions:!0,dataType:"FL",silent:!0}).value??i;let h;switch(s){case"expr:ratio":h=`${l}${n}`;break;case"ratio:expr":h=`${n}${l}`;break;case"expr*{ratio}":h=`${l}${n}`;break;case"simple":h=String(l);break}return{value:h,original:r,isReference:!1}}function jt(e,t){return Rt(e,t).value}function Ft(e){const r=e.trim().replace(/^\((.+)\)$/,"$1"),s=r.match(/^(\d+|n):(.+?)(mm|cm)?$/);if(s){const[,a,o,l]=s;return{format:"ratio:expr",expression:o.trim(),suffix:l?`${a}:${l}`:`${a}:`}}const i=r.match(/^(.+?)(mm|cm)?:(\d+)$/);if(i){const[,a,o,l]=i;return{format:"expr:ratio",expression:a.trim(),suffix:o?`${o}:${l}`:`:${l}`}}const n=r.match(/^(.+?)(\*)?{(\d+)}$/);if(n){const[,a,o,l]=n;return{format:"expr*{ratio}",expression:a.trim(),suffix:o?`*{${l}}`:`{${l}}`}}return{format:"simple",expression:r,suffix:""}}function $t(e){return e.startsWith("#")?!0:e.includes("(")||/[+\-*/]/.test(e)?!1:/^[A-Za-z0-9_-]+$/.test(e)?!0:!/^\d+:\d+$/.test(e)}function ze({divider:e,inputData:t}){const r=Fe(),{resolveString:s}=G(),{result:i,error:n}=$e(r,e.descriptorName,t,{throwOnError:!1}),a=b.useMemo(()=>e?ie.string(e)?e.articleName:ie.descriptor(e)&&i?.lindiv?i.lindiv:"":"",[e,i]);return{updatedDivider:b.useMemo(()=>{if(e)return i?.lindiv!=null?{...e,LINDIV1:jt(s(i.lindiv)),articleName:a}:{...e,LINDIV1:s(e.LINDIV1)}},[e,i,a,s])}}const zt={width:{rotation:[0,Math.PI/2,0],get3D:(e,t)=>({length:e.height,width:e.depth,thk:t}),get2DTop:(e,t)=>({dim_x:e.depth,dim_y:t,rotate:90}),get2DFront:(e,t)=>({dim_x:e.height,dim_y:t,rotate:90})},height:{rotation:[0,0,0],get3D:(e,t)=>({length:e.width,width:e.depth,thk:t}),get2DTop:e=>({dim_x:e.width,dim_y:e.depth}),get2DFront:(e,t)=>({dim_x:e.width,dim_y:t})},depth:{rotation:[Math.PI/2,0,Math.PI/2],get3D:(e,t)=>({length:e.height,width:e.width,thk:t}),get2DTop:(e,t)=>({dim_x:e.width,dim_y:t}),get2DFront:e=>({dim_x:e.width,dim_y:e.height})},article:{rotation:[0,0,0],get3D:(e,t)=>({length:e.width,width:e.depth,thk:t}),get2DTop:e=>({dim_x:e.width,dim_y:e.depth}),get2DFront:(e,t)=>({dim_x:e.width,dim_y:t})},independent:{rotation:[0,0,0],get3D:(e,t)=>({length:e.width,width:e.depth,thk:t}),get2DTop:e=>({dim_x:e.width,dim_y:e.depth}),get2DFront:(e,t)=>({dim_x:e.width,dim_y:t})}},Gt=(e,t,r)=>({x:e==="width"?r.width/2+t/2:0,y:e==="depth"?r.depth/2+t/2:0,z:e==="height"?r.height/2+t/2:0});function Bt({divider:e,view:t,childrenPositon:r,dividerThk:s}){const i=b.useContext(R),n=r.dividerType,a=r.childPositions,o=zt[n];if(!i)return null;const{selectedElem:l,setSelectedElem:h,hoveredElem:f,setHoveredElem:m}=i;return a.map((p,x)=>{const u=!(x===a.length-1)&&s!==0,d=Gt(n,s,p.zone_dims),g=o.get3D(p.zone_dims,s),I=t===M._2D_TOP?o.get2DTop(p.zone_dims,s):o.get2DFront(p.zone_dims,s),v=`${e.TREEID} divider`,T=l===v,C=f===v;return c.jsx(b.Fragment,{children:c.jsxs(J,{view:t,position:[p.x/S,p.y/S,p.z/S],children:[c.jsx(J,{view:t,position:[d.x/S,d.y/S,d.z/S],rotation:o.rotation,children:u&&c.jsxs(c.Fragment,{children:[c.jsx("group",{children:c.jsxs("mesh",{children:[c.jsx("boxGeometry",{args:[g.length,g.width,g.thk]}),c.jsx("meshStandardMaterial",{color:"blue",transparent:!0,opacity:.3})]})}),t===M._3D?c.jsx(B,{...g,opacity:1,treeId:v,isSelected:T,isHovered:C,onClick:()=>h(T?null:v),onPointerEnter:()=>m(v),onPointerLeave:()=>m(null)}):c.jsx(H,{...I,text:v,treeId:v,isSelected:T,isHovered:C,onClick:()=>h(T?null:v),onMouseEnter:()=>m(v),onMouseLeave:()=>m(null)})]})}),c.jsx(Se,{TREEID:p.TREEID,dimension:p.zone_dims,view:t})]})},x)})}function Ht({view:e,remainingZone:t,articleName:r}){return c.jsx(he,{articleName:r,dimensionOverrides:{width:t.dimensions.width,height:t.dimensions.height,depth:t.dimensions.depth},children:c.jsx(J,{view:e,position:[t.position.x/S,t.position.y/S,t.position.z/S],children:c.jsx(ve,{view:e})})})}function Ut({childrenPositon:e,dividerThk:t,divider:r,view:s,remainingZone:i}){if(Ie.linearDivision(r))return e?c.jsx(Bt,{view:s,childrenPositon:e,dividerThk:t,divider:r,remainingZone:i}):null;if(Ie.article(r)){const n=ie.string(r)?r.articleName:r.LINDIV1;return!i||n===""?null:c.jsx(Ht,{view:s,articleName:n,remainingZone:i})}return null}function Ge(){const{getArticleData:e}=W(),{articleName:t,dimensionOverrides:r}=X(),{resolveString:s}=G(),{anglPrims:i}=e(t);if(i.length===0)throw new Error(`No prims found for article: ${t}`);const n=i[0],a=(l,h)=>{const f=typeof l=="string"&&l!==""?re(s(l)):h;return parseFloat(String(f))||0},o={width:r?.width??a(n.DIMCALCFX,n.SIZEX),height:r?.height??a(n.DIMCALCFZ,n.SIZEZ),depth:r?.depth??a(n.DIMCALCFY,n.SIZEY)};return{current_prim:n,prim_dims:o}}function Se({TREEID:e,dimension:t,view:r=M._3D}){console.log(`===================================== Zone Start ${e} =====================================`);const s=ae(e),i=s?.zoneInfo(),n=s?.dividerThk||0,a=Ge(),o=St(e),l=vt(o,s?.topShelfThk||0,s?.bottomShelfThk||0),h=Nt(o),f=Mt(t,h),m=Tt(f,l),p=b.useMemo(()=>{if(s)return q.fromZoneData(s.currentZone,n)},[s,n]),x=i?Object.fromEntries(i):{},y=Pt(p),u=Vt(y,m.dimensions);x["AD article width"]=a?.prim_dims.width.toString(),x["AD article height"]=a?.prim_dims.height.toString(),x["AD article depth"]=a?.prim_dims.depth.toString(),x[0]="0",x.X=u.toString();const d=p?Ot.descriptor(p):!1,g=p?ie.descriptor(p):!1,v=d||g?ze({divider:p,inputData:x}).updatedDivider:p,T=It(m,n,v,s?.children.map(C=>C.TREEID)||[]);return(e==="0"||e==="0")&&(console.log("start dimensions ",t),console.log("border inset",h),console.log("border thk",l),console.log("zone dimensions ",f.dimensions),console.log("position => ",f.position),console.log("remaining dimensions ",m.dimensions),console.log("remaining position => ",m.position)),c.jsx(c.Fragment,{children:c.jsxs(J,{view:r,position:[f.position.x/S,f.position.y/S,f.position.z/S],children:[o.front?.CPNAME&&c.jsx(_t,{view:r,TREEID:Oe(e),dimension:f.dimensions,helper:o}),o.left?.CPNAME&&c.jsx(kt,{view:r,TREEID:Re(e),dimension:f.dimensions,helper:o}),o.back?.CPNAME&&c.jsx(At,{view:r,TREEID:Ve(e),dimension:f.dimensions,helper:o}),o.right?.CPNAME&&c.jsx(Dt,{view:r,TREEID:Pe(e),dimension:f.dimensions,helper:o}),s?.topShelfCP&&c.jsx(Ct,{view:r,TREEID:e,dimension:f.dimensions,helper:o}),s?.bottomShelfCP&&c.jsx(wt,{view:r,TREEID:e,dimension:f.dimensions,helper:o}),c.jsx(J,{view:r,position:[m.position.x/S,m.position.y/S,m.position.z/S],children:v&&c.jsx(Ut,{remainingZone:m,divider:v,view:r,childrenPositon:T,dividerThk:n})})]})})}const Zt="scale(1,-1)";function ve({view:e=M._3D}){console.log("========================================================= Designer ===============================================================================================");const r=Ge().prim_dims,s=c.jsx(Se,{TREEID:"0",view:e,dimension:r}),i=e===M._3D?s:c.jsx("g",{transform:Zt,children:s});return console.log(i),i}function Kt({view:e,data:t,articleName:r}){const s=t.descriptors,i=t.variables,n=t.anglprim.map(a=>a.NAME);return c.jsx(c.Fragment,{children:c.jsx(_e,{names:n,data:t,children:c.jsx(he,{articleName:r,children:c.jsx(Ae,{imosVariables:i,children:c.jsx(Le,{descriptorData:s,children:c.jsx(ve,{view:e})})})})})})}function Yt(){const{tree:e,getValue:t,setValue:r}=G(),s=(o,l)=>{const h=Number(l);r(o,isNaN(h)?l:h)},n=(()=>{const o={[P.Numeric]:{type:P.Numeric,label:"Dimensions (Numeric)",variables:[]},[P.Surface]:{type:P.Surface,label:"Surfaces",variables:[]},[P.Material]:{type:P.Material,label:"Materials",variables:[]},[P.Text]:{type:P.Text,label:"Text",variables:[]}};return Array.from(e.entries()).forEach(([l,h])=>{const f=t(l),m=h.WERT.startsWith("$");o[h.TYP]?.variables.push({name:l,value:f??"undefined",reference:m?h.WERT:void 0,rawType:h.TYP})}),Object.values(o).filter(l=>l.variables.length>0)})(),a=o=>{const l=o.rawType===P.Numeric,h=typeof o.value=="number"?o.value:Number(o.value);return l&&!isNaN(h)?c.jsxs("div",{className:"var-controller__slider-container",children:[c.jsx("input",{type:"range",min:0,max:2e4,value:h,onChange:f=>s(o.name,f.target.value),className:"var-controller__slider"}),c.jsx("input",{type:"number",value:h,onChange:f=>s(o.name,f.target.value),onBlur:f=>s(o.name,f.target.value),className:"var-controller__number-input",min:0,max:2e4})]}):c.jsx("input",{type:"text",value:o.value,onChange:f=>s(o.name,f.target.value),onBlur:f=>s(o.name,f.target.value),className:"var-controller__text-input"})};return c.jsxs("div",{className:"var-controller",children:[c.jsx("h2",{children:"Variable Controller"}),c.jsxs("p",{className:"var-controller__header",children:["Total variables: ",e.size]}),n.map(o=>c.jsxs("section",{className:"var-controller__section",children:[c.jsxs("h3",{className:"var-controller__section-title",children:[o.label," (",o.variables.length,")"]}),c.jsxs("table",{className:"var-controller__table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{style:{width:"25%"},children:"Variable Name"}),c.jsx("th",{style:{width:"35%"},children:"Current Value"}),c.jsx("th",{style:{width:"25%"},children:"Reference"}),c.jsx("th",{className:"center",style:{width:"15%"},children:"Type"})]})}),c.jsx("tbody",{children:o.variables.map(l=>c.jsxs("tr",{children:[c.jsx("td",{className:"var-controller__var-name",children:l.name}),c.jsx("td",{children:a(l)}),c.jsx("td",{className:"var-controller__reference",children:l.reference||"-"}),c.jsx("td",{style:{textAlign:"center"},children:c.jsx("span",{className:"var-controller__type-badge",children:o.type})})]},l.name))})]})]},o.type)),c.jsxs("section",{className:"var-controller__stats",children:[c.jsx("h4",{children:"Quick Stats"}),c.jsx("ul",{children:n.map(o=>c.jsxs("li",{children:[o.label,": ",o.variables.length," variables"]},o.type))})]})]})}const Wt="1.0.0";exports.ArticleContext=ue;exports.ArticleDesigner=Kt;exports.ArticleProvider=he;exports.DataContext=R;exports.DataProvider=_e;exports.DescriptorContext=de;exports.DescriptorProvider=Le;exports.Designer=ve;exports.VERSION=Wt;exports.VIEW=M;exports.VarController=Yt;exports.VariableContext=fe;exports.VariableProvider=Ae;exports.VariableResolver=Ze;exports.Zone=Se;exports.ZoneDescriptor=ze;exports.useArticle=X;exports.useData=W;exports.useDescriptorEvaluation=$e;exports.useDescriptorManager=Fe;exports.useDescriptorMatches=Lt;exports.useVariables=G;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @package @your-org/article-designer
|
|
3
|
+
* Main entry point for the Article Designer package
|
|
4
|
+
*
|
|
5
|
+
* 3D Article Designer for furniture visualization using React Three Fiber
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* ArticleDesigner - Main component with all providers included
|
|
9
|
+
* This is the recommended entry point
|
|
10
|
+
*/
|
|
11
|
+
export { default as ArticleDesigner } from './components/ui/ArticleDesigner';
|
|
12
|
+
/**
|
|
13
|
+
* Designer - Core designer component without providers
|
|
14
|
+
*/
|
|
15
|
+
export { default as Designer } from './components/article_designer/Designer';
|
|
16
|
+
/**
|
|
17
|
+
* Zone component
|
|
18
|
+
*/
|
|
19
|
+
export { default as Zone } from './components/article_designer/Zone';
|
|
20
|
+
export { DataProvider } from './contexts/article-data/DataProvider';
|
|
21
|
+
export { ArticleProvider } from './contexts/article/ArticleProvider';
|
|
22
|
+
export { VariableProvider } from './variables/VariableProvider';
|
|
23
|
+
export { DescriptorProvider } from './contexts/descriptor/DescriptorProvider';
|
|
24
|
+
export { DataContext } from './contexts/article-data/DataContext';
|
|
25
|
+
export { ArticleContext } from './contexts/article/ArticleContext';
|
|
26
|
+
export { VariableContext } from './variables/VariableContext';
|
|
27
|
+
export { DescriptorContext } from './contexts/descriptor/DescriptorContext';
|
|
28
|
+
export { useVariables } from './variables/useVariables';
|
|
29
|
+
export { useArticle } from './hooks/useArticle';
|
|
30
|
+
export { useDescriptorEvaluation, useDescriptorMatches } from './hooks/useDescriptor';
|
|
31
|
+
export { useData } from './hooks/useData';
|
|
32
|
+
export { useDescriptorManager } from './hooks/useDescriptorManager';
|
|
33
|
+
export { ZoneDescriptor } from './hooks/zoneDescriptor';
|
|
34
|
+
export { default as VarController } from './components/ui/controls/VarController';
|
|
35
|
+
export type { ArticleData } from './types/data.types';
|
|
36
|
+
export { VIEW } from './types/view.types';
|
|
37
|
+
export type { ImosVariable, VAR_TYPE } from './variables/variable.types';
|
|
38
|
+
export * as VariableResolver from './variables/VariableResolver';
|
|
39
|
+
export declare const VERSION = "1.0.0";
|