@imagineio/configurator-sdk 0.1.3 → 0.1.5

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 CHANGED
@@ -1,134 +1,134 @@
1
- # @imagineio/configurator-sdk
2
-
3
- Build a 3D product configurator and make it yours. One publishable engine — scene,
4
- options, pricing, save/share, AR, AI chat — driven entirely by your backend: data
5
- selects behavior, your code implements overrides through registries, and nothing
6
- needs an SDK release to change.
7
-
8
- ## Install
9
-
10
- The 3D stack (three / fiber / drei) is installed for you — npm 7+ adds the SDK's
11
- peer packages automatically at the versions the SDK is built against, so your app
12
- ends up with exactly one copy of `three`. Pin React 18 in the same command: a fresh
13
- Vite template scaffolds React 19, which the SDK's 3D stack doesn't support yet
14
- (`@react-three/fiber@8` requires React 18), so installing the SDK alone there
15
- fails with `ERESOLVE`:
16
-
17
- ```bash
18
- npm install @imagineio/configurator-sdk react@^18.2 react-dom@^18.2
19
- npm install -D @types/react@^18.3 @types/react-dom@^18.3 # the scaffold's are React 19's
20
- ```
21
-
22
- (The second line matters even in a JavaScript project: create-vite scaffolds React 19
23
- *types*, and pinning the runtime alone leaves them mismatched — no error, just wrong
24
- autocomplete everywhere.)
25
-
26
- Then either add the Vite plugin (recommended — serves the SDK's static assets and
27
- dedupes three/react for you):
28
-
29
- ```js
30
- // vite.config.js
31
- import imagineConfigurator from '@imagineio/configurator-sdk/vite';
32
- export default defineConfig({ plugins: [react(), imagineConfigurator()] });
33
- ```
34
-
35
- …or follow the manual steps in the Getting Started guide.
36
-
37
- ```jsx
38
- import { mount, config } from '@imagineio/configurator-sdk';
39
-
40
- // The backend endpoint is built into the SDK — only the key is yours to set.
41
- config.setApiKey('YOUR_ORG_API_KEY');
42
- // systemId is REQUIRED — it names which configurator loads. Without it nothing does.
43
- mount(document.getElementById('root'), { systemId: YOUR_SYSTEM_ID });
44
- ```
45
-
46
- ## Documentation
47
-
48
- The full documentation site — Getting Started (install to a live configurator in
49
- five steps), theming and UI customization, placement customization, the complete
50
- function reference with runnable examples, the e-commerce bridge protocol, and
51
- troubleshooting — is published by your imagine.io contact. No guides ship inside
52
- this package.
53
-
54
- ## Requirements
55
-
56
- Node ≥ 18, React 18, Vite (recommended). Peer deps (auto-installed by npm 7+):
57
- `react`, `react-dom` (React 18 only — React 19 not supported yet), `three` 0.159,
58
- `@react-three/fiber` 8, `@react-three/drei` 9. Everything else is installed as a
59
- regular npm dependency — nothing third-party is bundled into the package itself.
60
-
61
- **Strict CSP?** Two things load at runtime from Google, not from the package: the AR
62
- viewer script (`https://ajax.googleapis.com`, overridable with `VITE_MODEL_VIEWER_SRC`
63
- to self-host it) and theme fonts (`https://fonts.googleapis.com` +
64
- `https://fonts.gstatic.com`, only when a theme names a Google font). Allow those hosts
65
- in `script-src` / `style-src` / `font-src`, or point the override at your own origin.
66
-
67
- ## License
68
-
69
- **Proprietary — licensed, not sold.** Not open source. Copyright (c) 2026 Live Furnish,
70
- Inc., dba imagine.io. Installing or using the package means you accept the licence.
71
-
72
- What follows is a plain-English summary, so you can see the shape of the terms before
73
- installing. **It is not the licence** — the full text in `LICENSE.md` governs, and where
74
- the two differ, that text wins.
75
-
76
- **Free to evaluate and build with.** With an imagine.io Account — a free plan counts — you
77
- may install the SDK to evaluate it, to develop and test your own application (including
78
- with your own data), and to demo that application internally or non-commercially, such as
79
- in a talk, tutorial, or portfolio piece.
80
-
81
- **A Subscription or Agreement is required before you go live** — that is, before you deploy
82
- to production or any customer-facing environment, use the SDK in anything sold or monetised
83
- (including ad-supported and lead-generating deployments), or deliver your application to a
84
- third party. One Subscription covers one organisation or brand; building for several
85
- clients or brands needs one each.
86
-
87
- **Explicitly allowed**, so there is no doubt:
88
-
89
- - copying the SDK as needed to install, build, and back up your application;
90
- - bundling and minifying it into your application's deployed build;
91
- - configuring and customising it through its documented extension points — themes,
92
- registries, hooks, plugins, configuration options.
93
-
94
- **Not allowed:**
95
-
96
- - redistributing the SDK itself — publishing, sublicensing, selling, renting, or shipping
97
- it as a package, library, SDK, template, or starter kit, repackaged or not;
98
- - reverse engineering, decompiling, or deobfuscating it (except where law permits despite
99
- this);
100
- - modifying it outside the documented extension points, including patching or runtime
101
- monkey-patching of the distributed files;
102
- - removing or altering any notice, attribution, watermark, licence check, usage meter, or
103
- integrity mechanism, or circumventing a plan limit;
104
- - building anything that competes with imagine.io, or copying its features or interfaces
105
- for that purpose;
106
- - using the SDK or its documentation to train, fine-tune, or evaluate ML/AI models — your
107
- application's use of imagine.io's own AI features is fine;
108
- - publishing benchmarks or security/performance results without written consent.
109
-
110
- These apply whether or not you hold a Subscription.
111
-
112
- **Minification is not a grant.** The code ships minified as a technical measure. Unreadable
113
- source does not imply permission, and readable source does not waive any restriction.
114
-
115
- **Pre-release builds** — including `@imagineio/configurator-sdk-staging` — are for
116
- evaluation and development only. They may change or be withdrawn at any time, with no
117
- stability or compatibility commitment.
118
-
119
- **Credentials.** The SDK is a client for the imagine.io Platform and needs an Account and
120
- valid credentials. Never put a permanent API key in client-side code or any publicly
121
- reachable page — production must use a server-side auth flow with short-lived session
122
- tokens.
123
-
124
- The licence terminates automatically on material breach or if your Account is terminated.
125
- The Software is provided "as is" without warranty, and liability is limited. The imagine.io
126
- Terms and Conditions also apply, and govern the Platform, your Account, billing, and usage
127
- limits.
128
-
129
- Full text: `LICENSE.md`, shipped inside the package — readable at
130
- `node_modules/@imagineio/configurator-sdk/LICENSE.md` after install. It also carries the
131
- notice and Apache-2.0 text for the one third-party component redistributed here (Google
132
- Draco).
133
-
134
- **Licensing enquiries:** finance@imagine.io
1
+ # @imagineio/configurator-sdk
2
+
3
+ Build a 3D product configurator and make it yours. One publishable engine — scene,
4
+ options, pricing, save/share, AR, AI chat — driven entirely by your backend: data
5
+ selects behavior, your code implements overrides through registries, and nothing
6
+ needs an SDK release to change.
7
+
8
+ ## Install
9
+
10
+ The 3D stack (three / fiber / drei) is installed for you — npm 7+ adds the SDK's
11
+ peer packages automatically at the versions the SDK is built against, so your app
12
+ ends up with exactly one copy of `three`. Pin React 19 in the same command: a fresh
13
+ Vite template scaffolds React 19, which the SDK's 3D stack doesn't support yet
14
+ (`@react-three/fiber@9` requires React 19), so installing the SDK alone there
15
+ fails with `ERESOLVE`:
16
+
17
+ ```bash
18
+ npm install @imagineio/configurator-sdk react@^19.3.1 react-dom@^19.3.1
19
+ npm install -D @types/react@^19.3.0 @types/react-dom@^19.3.0 # the scaffold's are React 19's
20
+ ```
21
+
22
+ (The second line matters even in a JavaScript project: create-vite scaffolds React 19
23
+ *types*, and pinning the runtime alone leaves them mismatched — no error, just wrong
24
+ autocomplete everywhere.)
25
+
26
+ Then either add the Vite plugin (recommended — serves the SDK's static assets and
27
+ dedupes three/react for you):
28
+
29
+ ```js
30
+ // vite.config.js
31
+ import imagineConfigurator from '@imagineio/configurator-sdk/vite';
32
+ export default defineConfig({ plugins: [react(), imagineConfigurator()] });
33
+ ```
34
+
35
+ …or follow the manual steps in the Getting Started guide.
36
+
37
+ ```jsx
38
+ import { mount, config } from '@imagineio/configurator-sdk';
39
+
40
+ // The backend endpoint is built into the SDK — only the key is yours to set.
41
+ config.setApiKey('YOUR_ORG_API_KEY');
42
+ // systemId is REQUIRED — it names which configurator loads. Without it nothing does.
43
+ mount(document.getElementById('root'), { systemId: YOUR_SYSTEM_ID });
44
+ ```
45
+
46
+ ## Documentation
47
+
48
+ The full documentation site — Getting Started (install to a live configurator in
49
+ five steps), theming and UI customization, placement customization, the complete
50
+ function reference with runnable examples, the e-commerce bridge protocol, and
51
+ troubleshooting — is published by your imagine.io contact. No guides ship inside
52
+ this package.
53
+
54
+ ## Requirements
55
+
56
+ Node ≥ 18, React 19, Vite (recommended). Peer deps (auto-installed by npm 7+):
57
+ `react`, `react-dom` , `three` 0.185,
58
+ `@react-three/fiber` 9, `@react-three/drei` 10. Everything else is installed as a
59
+ regular npm dependency — nothing third-party is bundled into the package itself.
60
+
61
+ **Strict CSP?** Two things load at runtime from Google, not from the package: the AR
62
+ viewer script (`https://ajax.googleapis.com`, overridable with `VITE_MODEL_VIEWER_SRC`
63
+ to self-host it) and theme fonts (`https://fonts.googleapis.com` +
64
+ `https://fonts.gstatic.com`, only when a theme names a Google font). Allow those hosts
65
+ in `script-src` / `style-src` / `font-src`, or point the override at your own origin.
66
+
67
+ ## License
68
+
69
+ **Proprietary — licensed, not sold.** Not open source. Copyright (c) 2026 Live Furnish,
70
+ Inc., dba imagine.io. Installing or using the package means you accept the licence.
71
+
72
+ What follows is a plain-English summary, so you can see the shape of the terms before
73
+ installing. **It is not the licence** — the full text in `LICENSE.md` governs, and where
74
+ the two differ, that text wins.
75
+
76
+ **Free to evaluate and build with.** With an imagine.io Account — a free plan counts — you
77
+ may install the SDK to evaluate it, to develop and test your own application (including
78
+ with your own data), and to demo that application internally or non-commercially, such as
79
+ in a talk, tutorial, or portfolio piece.
80
+
81
+ **A Subscription or Agreement is required before you go live** — that is, before you deploy
82
+ to production or any customer-facing environment, use the SDK in anything sold or monetised
83
+ (including ad-supported and lead-generating deployments), or deliver your application to a
84
+ third party. One Subscription covers one organisation or brand; building for several
85
+ clients or brands needs one each.
86
+
87
+ **Explicitly allowed**, so there is no doubt:
88
+
89
+ - copying the SDK as needed to install, build, and back up your application;
90
+ - bundling and minifying it into your application's deployed build;
91
+ - configuring and customising it through its documented extension points — themes,
92
+ registries, hooks, plugins, configuration options.
93
+
94
+ **Not allowed:**
95
+
96
+ - redistributing the SDK itself — publishing, sublicensing, selling, renting, or shipping
97
+ it as a package, library, SDK, template, or starter kit, repackaged or not;
98
+ - reverse engineering, decompiling, or deobfuscating it (except where law permits despite
99
+ this);
100
+ - modifying it outside the documented extension points, including patching or runtime
101
+ monkey-patching of the distributed files;
102
+ - removing or altering any notice, attribution, watermark, licence check, usage meter, or
103
+ integrity mechanism, or circumventing a plan limit;
104
+ - building anything that competes with imagine.io, or copying its features or interfaces
105
+ for that purpose;
106
+ - using the SDK or its documentation to train, fine-tune, or evaluate ML/AI models — your
107
+ application's use of imagine.io's own AI features is fine;
108
+ - publishing benchmarks or security/performance results without written consent.
109
+
110
+ These apply whether or not you hold a Subscription.
111
+
112
+ **Minification is not a grant.** The code ships minified as a technical measure. Unreadable
113
+ source does not imply permission, and readable source does not waive any restriction.
114
+
115
+ **Pre-release builds** — including `@imagineio/configurator-sdk-staging` — are for
116
+ evaluation and development only. They may change or be withdrawn at any time, with no
117
+ stability or compatibility commitment.
118
+
119
+ **Credentials.** The SDK is a client for the imagine.io Platform and needs an Account and
120
+ valid credentials. Never put a permanent API key in client-side code or any publicly
121
+ reachable page — production must use a server-side auth flow with short-lived session
122
+ tokens.
123
+
124
+ The licence terminates automatically on material breach or if your Account is terminated.
125
+ The Software is provided "as is" without warranty, and liability is limited. The imagine.io
126
+ Terms and Conditions also apply, and govern the Platform, your Account, billing, and usage
127
+ limits.
128
+
129
+ Full text: `LICENSE.md`, shipped inside the package — readable at
130
+ `node_modules/@imagineio/configurator-sdk/LICENSE.md` after install. It also carries the
131
+ notice and Apache-2.0 text for the one third-party component redistributed here (Google
132
+ Draco).
133
+
134
+ **Licensing enquiries:** finance@imagine.io
@@ -1 +1 @@
1
- import i from"node:fs";import t from"node:path";import{fileURLToPath as h}from"node:url";const g=["three","react","react-dom","@react-three/fiber","@react-three/drei","zustand"],j={".js":"text/javascript",".mjs":"text/javascript",".wasm":"application/wasm",".svg":"image/svg+xml",".json":"application/json",".txt":"text/plain",".md":"text/markdown"};function v(){const o=t.dirname(h(import.meta.url)),n=[t.resolve(o,"static"),t.resolve(o,"..","static")];return n.find(r=>i.existsSync(r))||n[0]}function y(o,n=""){let r=[],c=[];try{c=i.readdirSync(o,{withFileTypes:!0})}catch{return r}for(const s of c){const e=n?`${n}/${s.name}`:s.name;s.isDirectory()?r=r.concat(y(t.join(o,s.name),e)):r.push(e)}return r}function S(o={}){const{copyAssets:n=!0,dedupe:r=!0}=o,c=v();let s="dist";return{name:"imagine-configurator-sdk",config(){return r?{resolve:{dedupe:g}}:null},configResolved(e){s=t.resolve(e.root,e.build.outDir)},configureServer(e){if(!n)return;const a=e.config.publicDir;e.middlewares.use((m,d,u)=>{const f=decodeURIComponent((m.url||"").split("?")[0]),l=t.normalize(t.join(c,f));if(!l.startsWith(c+t.sep))return u();let p=null;try{p=i.statSync(l)}catch{return u()}if(!p.isFile())return u();try{if(a&&i.existsSync(t.join(a,f)))return u()}catch{}d.setHeader("Content-Type",j[t.extname(l).toLowerCase()]||"application/octet-stream"),i.createReadStream(l).pipe(d)})},closeBundle(){if(n)for(const e of y(c)){const a=t.join(s,e);try{if(i.existsSync(a))continue;i.mkdirSync(t.dirname(a),{recursive:!0}),i.copyFileSync(t.join(c,e),a)}catch{}}}}}export{S as default};
1
+ import n from"node:fs";import t from"node:path";import{fileURLToPath as h}from"node:url";const g=["three","react","react-dom","@react-three/fiber","@react-three/drei"],j={".js":"text/javascript",".mjs":"text/javascript",".wasm":"application/wasm",".svg":"image/svg+xml",".json":"application/json",".txt":"text/plain",".md":"text/markdown"};function v(){const o=t.dirname(h(import.meta.url)),i=[t.resolve(o,"static"),t.resolve(o,"..","static")];return i.find(r=>n.existsSync(r))||i[0]}function y(o,i=""){let r=[],c=[];try{c=n.readdirSync(o,{withFileTypes:!0})}catch{return r}for(const s of c){const e=i?`${i}/${s.name}`:s.name;s.isDirectory()?r=r.concat(y(t.join(o,s.name),e)):r.push(e)}return r}function S(o={}){const{copyAssets:i=!0,dedupe:r=!0}=o,c=v();let s="dist";return{name:"imagine-configurator-sdk",config(){return r?{resolve:{dedupe:g}}:null},configResolved(e){s=t.resolve(e.root,e.build.outDir)},configureServer(e){if(!i)return;const a=e.config.publicDir;e.middlewares.use((m,f,u)=>{const d=decodeURIComponent((m.url||"").split("?")[0]),l=t.normalize(t.join(c,d));if(!l.startsWith(c+t.sep))return u();let p=null;try{p=n.statSync(l)}catch{return u()}if(!p.isFile())return u();try{if(a&&n.existsSync(t.join(a,d)))return u()}catch{}f.setHeader("Content-Type",j[t.extname(l).toLowerCase()]||"application/octet-stream"),n.createReadStream(l).pipe(f)})},closeBundle(){if(i)for(const e of y(c)){const a=t.join(s,e);try{if(n.existsSync(a))continue;n.mkdirSync(t.dirname(a),{recursive:!0}),n.copyFileSync(t.join(c,e),a)}catch{}}}}}export{S as default};
@@ -1 +1 @@
1
- import{useCallback as a,useEffect as G,useMemo as S,useRef as M}from"react";import b from"./872c4302e0.js";import L from"./d94df858ea.js";import O from"./9c6c598569.js";import N from"./be337ddda5.js";import $ from"./8f60e5059a.js";import{getPlacementBindings as h,isOptionAvailable as B,isOptionVisible as x}from"./817d930a49.js";import{selectOption as U}from"./dbd5ba1d07.js";import{sceneOptionSetsFrom as V,productOptionSetsFrom as q,optionsForSetFrom as z}from"./4a99ddb3fd.js";import{isAddFeature as H}from"./8c27edda0f.js";function J({placementId:u}={}){const r=b(e=>e.options),v=b(e=>e.materials),t=b(e=>e.features),d=L(e=>e.sceneSelections),m=O(e=>e.placementSelections),D=O(e=>e.selectedInstanceId),A=O(e=>e.activeSceneConfigId),C=N(e=>e.sceneConfigurations),F=$(e=>e.hiddenOptions),i=u===void 0?D??null:u,o=i!=null,p=S(()=>V({features:t,sceneConfigurations:C,activeSceneConfigId:A}),[t,C,A]),R=S(()=>o?q({features:t,bindings:h(i)||[]}):[],[t,o,i,m]),f=M(new Map),E=`${Object.keys(t).length}_${Object.keys(r).length}`;G(()=>{f.current.clear()},[E]);const g=a(e=>{const n=e?.feature_id||e?.id;if(!n)return[];const c=o;if(!c){const l=f.current.get(n);if(l)return l}const s=z(e,{features:t,options:r,bindings:c?h(i)||[]:null});return c||f.current.set(n,s),s},[t,r,o,i,f]),y=S(()=>new Set((p||[]).filter(e=>H(e,{productSelected:o})).map(e=>String(e?.id))),[p,o]),_=a(e=>{if(!y.has(String(e))){if(o){const n=m?.[i];if(n&&n[e]!=null)return n[e]}return d[e]}},[y,o,i,m,d]),j=a(e=>e==null?null:d[e]??d[String(e)]??null,[d]),w=a((e,n)=>{if(!n)return{hidden:!1,disabled:!1,disabledReason:null};if(!x(e,n.id))return{hidden:!0,disabled:!0,disabledReason:null};if(!B(e,n.id))return{hidden:!1,disabled:!0,disabledReason:"Not available"};if(i!=null){const s=(h(i)||[]).find(l=>String(l.optionSetId??l.option_set_id)===String(e));if(s&&Array.isArray(s.available)&&!s.available.some(I=>String(I)===String(n.id)))return{hidden:!1,disabled:!0,disabledReason:"Not available"}}return{hidden:!1,disabled:!1,disabledReason:null}},[i]),P=a((e,n)=>(Array.isArray(n)?n:[]).filter(s=>s&&x(e,s.id)),[]),k=a((e,n,c)=>{const s=c||t?.[e]||t?.[String(e)]||null;return U(e,n,s)},[t]);return S(()=>({features:t,optionSets:t,optionSetList:Object.values(t||{}),sceneOptionSets:p,productOptionSets:R,getOptionsForSet:g,options:r,materials:v,hiddenOptions:F,scope:{placementId:i,isPlacementScoped:o},getOptionsForFeature:g,select:k,getSelection:_,getEffectiveSelection:j,optionDisabledPropsFor:w,visibleOptions:P}),[t,r,v,F,i,o,p,R,g,k,_,j,w,P])}function ie(u){const r=M(new Map);return G(()=>{r.current.clear()},[u]),r}export{J as default,ie as useOptionsCache};
1
+ import{useCallback as a,useEffect as G,useMemo as m,useRef as M}from"react";import b from"./872c4302e0.js";import I from"./d94df858ea.js";import O from"./9c6c598569.js";import L from"./be337ddda5.js";import N from"./8f60e5059a.js";import{getPlacementBindings as h,isOptionAvailable as $,isOptionVisible as x,getPlacementBinding as U}from"./817d930a49.js";import{selectOption as V}from"./dbd5ba1d07.js";import{sceneOptionSetsFrom as q,productOptionSetsFrom as z,optionsForSetFrom as H}from"./4a99ddb3fd.js";import{isAddFeature as J}from"./8c27edda0f.js";function K({placementId:u}={}){const r=b(e=>e.options),v=b(e=>e.materials),t=b(e=>e.features),d=I(e=>e.sceneSelections),p=O(e=>e.placementSelections),B=O(e=>e.selectedInstanceId),A=O(e=>e.activeSceneConfigId),C=L(e=>e.sceneConfigurations),F=N(e=>e.hiddenOptions),i=u===void 0?B??null:u,o=i!=null,f=m(()=>q({features:t,sceneConfigurations:C,activeSceneConfigId:A}),[t,C,A]),R=m(()=>o?z({features:t,bindings:h(i)||[]}):[],[t,o,i,p]),S=M(new Map),D=`${Object.keys(t).length}_${Object.keys(r).length}`;G(()=>{S.current.clear()},[D]);const g=a(e=>{const n=e?.feature_id||e?.id;if(!n)return[];const c=o;if(!c){const l=S.current.get(n);if(l)return l}const s=H(e,{features:t,options:r,bindings:c?h(i)||[]:null});return c||S.current.set(n,s),s},[t,r,o,i,S]),y=m(()=>new Set((f||[]).filter(e=>J(e,{productSelected:o&&!!U(i,e?.id??e?.feature_id)})).map(e=>String(e?.id))),[f,o,i,p]),_=a(e=>{if(!y.has(String(e))){if(o){const n=p?.[i];if(n&&n[e]!=null)return n[e]}return d[e]}},[y,o,i,p,d]),P=a(e=>e==null?null:d[e]??d[String(e)]??null,[d]),j=a((e,n)=>{if(!n)return{hidden:!1,disabled:!1,disabledReason:null};if(!x(e,n.id))return{hidden:!0,disabled:!0,disabledReason:null};if(!$(e,n.id))return{hidden:!1,disabled:!0,disabledReason:"Not available"};if(i!=null){const s=(h(i)||[]).find(l=>String(l.optionSetId??l.option_set_id)===String(e));if(s&&Array.isArray(s.available)&&!s.available.some(E=>String(E)===String(n.id)))return{hidden:!1,disabled:!0,disabledReason:"Not available"}}return{hidden:!1,disabled:!1,disabledReason:null}},[i]),w=a((e,n)=>(Array.isArray(n)?n:[]).filter(s=>s&&x(e,s.id)),[]),k=a((e,n,c)=>{const s=c||t?.[e]||t?.[String(e)]||null;return V(e,n,s)},[t]);return m(()=>({features:t,optionSets:t,optionSetList:Object.values(t||{}),sceneOptionSets:f,productOptionSets:R,getOptionsForSet:g,options:r,materials:v,hiddenOptions:F,scope:{placementId:i,isPlacementScoped:o},getOptionsForFeature:g,select:k,getSelection:_,getEffectiveSelection:P,optionDisabledPropsFor:j,visibleOptions:w}),[t,r,v,F,i,o,f,R,g,k,_,P,j,w])}function se(u){const r=M(new Map);return G(()=>{r.current.clear()},[u]),r}export{K as default,se as useOptionsCache};
@@ -1 +1 @@
1
- import p from"./8f60e5059a.js";import h from"./9c6c598569.js";import S from"./872c4302e0.js";import{getEffectiveSelections as v,getPlacementBinding as _}from"./817d930a49.js";const g=t=>String(t??"").toLowerCase().replace(/\s+/g," ").trim();function m(t,e,s){if(e==null||!Array.isArray(t)||t.length===0)return null;const c=r=>r.value_product??r.valueProduct??r.value,o=r=>r==null?null:s?.[r]||s?.[String(r)]||null,i=t.find(r=>{const n=c(r);return n!=null&&String(n)===String(e)});if(i)return i;const l=o(e),a=g(l?.name??l?.title);if(a){const r=t.filter(n=>{const u=g(n.name??n.label??n.title);return u.length>0&&a.includes(u)});if(r.length===1)return r[0]}const d=l?l.productGraph??l.product_graph??null:null;if(d!=null){const r=t.filter(n=>{const u=o(c(n)),f=u?u.productGraph??u.product_graph??null:null;return f!=null&&String(f)===String(d)});if(r.length===1)return r[0]}return null}function O(t,{productInstances:e,hostProductOverrides:s,getProduct:c}={}){if(t==null)return null;const o=e?.[t];let i=s?.[t]??o?.variantId??o?.productId??null;if(i==null&&String(t).endsWith("__host")){const l=String(t).replace(/__host$/,""),a=e?.[l],d=c?.(a?.variantId??a?.productId),r=d?.hostVariants??d?.host_variants,n=Array.isArray(r)?r.find(u=>u?.isDefault??u?.is_default)??r[0]:null;i=n?.hostVariantId??n?.host_variant_id??null}return i}function C(t){return y(t).id}function y({placementId:t,set:e,opts:s,inputs:c}){const o=c||V(),i=String(e?.type??""),l=e?.feature_id??e?.id;if(l==null)return{id:null,rule:"none"};let a=null;if(t!=null&&(i==="load_new_product"||i==="product_change")){a=O(t,o);const n=m(s,a,o.products);if(n)return{id:n.id,rule:"variant",currentVariantId:a}}if(t!=null&&/finish/i.test(i)){const n=P(t,e,o);if(n.size>0){const u=(s||[]).find(f=>f?.value!=null&&n.has(String(f.value)));if(u)return{id:u.id,rule:"material",currentVariantId:a}}}if(t!=null){const n=v(t)||{},u=n[l]??n[String(l)];if(u!=null)return{id:u,rule:"tracked",currentVariantId:a};const f=_(t,l);return f?.default!=null?{id:f.default,rule:"binding-default",currentVariantId:a}:{id:null,rule:"none",currentVariantId:a}}const d=o.sceneSelections||{},r=d[l]??d[String(l)]??null;return{id:r,rule:r==null?"none":"scene"}}function P(t,e,s){const c=s.hostMaterialOverrides?.[t]||{},o=new Set((e?.material_targets??e?.materialTargets??e?.materials??[]).map(i=>String(i).toLowerCase()));return new Set(Object.entries(c).filter(([i])=>o.size===0||o.has(String(i).toLowerCase())).map(([,i])=>String(i)))}function V(){const t=p.getState(),e=h.getState(),s=S.getState();return{productInstances:e.productInstances||{},hostProductOverrides:t.hostProductOverrides||{},hostMaterialOverrides:t.hostMaterialOverrides||{},products:s.products||{},getProduct:s.getProduct,sceneSelections:void 0}}export{C as currentOptionIdFor,O as currentVariantIdFor,y as explainCurrentOption,V as readCurrentOptionInputs,m as resolveCurrentSwapOption};
1
+ import p from"./8f60e5059a.js";import S from"./9c6c598569.js";import h from"./872c4302e0.js";import{getEffectiveSelections as v,getPlacementBinding as m}from"./817d930a49.js";import{resolveHostVariantId as _}from"./be07a7f885.js";const g=t=>String(t??"").toLowerCase().replace(/\s+/g," ").trim();function O(t,n,a){if(n==null||!Array.isArray(t)||t.length===0)return null;const s=r=>r.value_product??r.valueProduct??r.value,o=r=>r==null?null:a?.[r]||a?.[String(r)]||null,i=t.find(r=>{const e=s(r);return e!=null&&String(e)===String(n)});if(i)return i;const u=o(n),l=g(u?.name??u?.title);if(l){const r=t.filter(e=>{const c=g(e.name??e.label??e.title);return c.length>0&&l.includes(c)});if(r.length===1)return r[0]}const f=u?u.productGraph??u.product_graph??null:null;if(f!=null){const r=t.filter(e=>{const c=o(s(e)),d=c?c.productGraph??c.product_graph??null:null;return d!=null&&String(d)===String(f)});if(r.length===1)return r[0]}return null}function P(t,{productInstances:n,hostProductOverrides:a,getProduct:s}={}){if(t==null)return null;const o=n?.[t];let i=a?.[t]??o?.variantId??o?.productId??null;if(i==null&&String(t).endsWith("__host")){const u=String(t).replace(/__host$/,""),l=n?.[u],f=s?.(l?.variantId??l?.productId);i=_(f,l)}return i}function L(t){return b(t).id}function b({placementId:t,set:n,opts:a,inputs:s}){const o=s||x(),i=String(n?.type??""),u=n?.feature_id??n?.id;if(u==null)return{id:null,rule:"none"};let l=null;if(t!=null&&(i==="load_new_product"||i==="product_change")){l=P(t,o);const e=O(a,l,o.products);if(e)return{id:e.id,rule:"variant",currentVariantId:l}}if(t!=null&&/finish/i.test(i)){const e=w(t,n,o);if(e.size>0){const c=(a||[]).find(d=>d?.value!=null&&e.has(String(d.value)));if(c)return{id:c.id,rule:"material",currentVariantId:l}}}if(t!=null){const e=v(t)||{},c=e[u]??e[String(u)];if(c!=null)return{id:c,rule:"tracked",currentVariantId:l};const d=m(t,u);return d?.default!=null?{id:d.default,rule:"binding-default",currentVariantId:l}:{id:null,rule:"none",currentVariantId:l}}const f=o.sceneSelections||{},r=f[u]??f[String(u)]??null;return{id:r,rule:r==null?"none":"scene"}}function w(t,n,a){const s=a.hostMaterialOverrides?.[t]||{},o=new Set((n?.material_targets??n?.materialTargets??n?.materials??[]).map(i=>String(i).toLowerCase()));return new Set(Object.entries(s).filter(([i])=>o.size===0||o.has(String(i).toLowerCase())).map(([,i])=>String(i)))}function x(){const t=p.getState(),n=S.getState(),a=h.getState();return{productInstances:n.productInstances||{},hostProductOverrides:t.hostProductOverrides||{},hostMaterialOverrides:t.hostMaterialOverrides||{},products:a.products||{},getProduct:a.getProduct,sceneSelections:void 0}}export{L as currentOptionIdFor,P as currentVariantIdFor,b as explainCurrentOption,x as readCurrentOptionInputs,O as resolveCurrentSwapOption};
@@ -1,110 +1,110 @@
1
1
  @layer sdk-base, vendor, sdk;
2
2
  @layer sdk {
3
- /* Boot failure screen — a FIXED palette, deliberately no theme tokens.
4
- Same reasoning as ui/LicenceNotice.css: this renders when boot did not finish, so the theme
5
- may never have applied, and a token that resolves to nothing leaves unreadable text on an
6
- unpainted ground (which is exactly how a shell's CTA went invisible once). Every value here
7
- is literal, and every property .error-screen would otherwise supply is set at higher
8
- specificity. */
9
- .error-screen.boot-error {
10
- position: absolute;
11
- inset: 0;
12
- display: flex;
13
- align-items: center;
14
- justify-content: center;
15
- height: 100%;
16
- padding: 24px;
17
- box-sizing: border-box;
18
- background: #f4f5f7;
19
- color: #111111;
20
- color-scheme: light;
21
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
22
- text-align: left;
23
- }
24
-
25
- .error-screen.boot-error .boot-error__card {
26
- max-width: 520px;
27
- padding: 28px 32px;
28
- background: #ffffff;
29
- border: 1px solid #e3e5e8;
30
- border-radius: 12px;
31
- box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
32
- }
33
-
34
- .error-screen.boot-error h1.boot-error__title {
35
- margin: 0 0 10px;
36
- font-size: 18px;
37
- font-weight: 600;
38
- line-height: 1.35;
39
- color: #111111;
40
- }
41
-
42
- .error-screen.boot-error button.boot-error__retry {
43
- margin-top: 18px;
44
- padding: 9px 18px;
45
- border: 1px solid #d0d3d8;
46
- border-radius: 6px;
47
- background: #ffffff;
48
- color: #111111;
49
- font-size: 13px;
50
- font-weight: 600;
51
- cursor: pointer;
52
- }
53
-
54
- .error-screen.boot-error button.boot-error__retry:hover {
55
- background: #f4f5f7;
56
- }
57
-
58
- .error-screen.boot-error p.boot-error__body {
59
- margin: 0;
60
- font-size: 14px;
61
- line-height: 1.55;
62
- color: #555b66;
63
- }
64
-
65
- /* DEV ONLY (see BootErrorNotice.jsx): the integrator's instruction, COLLAPSED so it never
66
- competes with the shopper's message, and visually separated so it cannot be mistaken for it. */
67
- .error-screen.boot-error .boot-error__dev {
68
- margin-top: 20px;
69
- padding-top: 16px;
70
- border-top: 1px dashed #d8dbe0;
71
- }
72
-
73
- .error-screen.boot-error summary.boot-error__dev-tag {
74
- display: inline-block;
75
- padding: 3px 10px;
76
- border-radius: 999px;
77
- background: #eef1f5;
78
- color: #5b6472;
79
- font-size: 10px;
80
- font-weight: 700;
81
- letter-spacing: 0.06em;
82
- text-transform: uppercase;
83
- cursor: pointer;
84
- user-select: none;
85
- list-style: none; /* hide the default marker; the pill IS the affordance */
86
- }
87
-
88
- .error-screen.boot-error summary.boot-error__dev-tag::-webkit-details-marker { display: none; }
89
-
90
- .error-screen.boot-error summary.boot-error__dev-tag::after {
91
- content: ' ▸';
92
- font-size: 9px;
93
- }
94
-
95
- .error-screen.boot-error .boot-error__dev[open] summary.boot-error__dev-tag::after {
96
- content: ' ▾';
97
- }
98
-
99
- .error-screen.boot-error summary.boot-error__dev-tag:hover {
100
- background: #e4e8ee;
101
- }
102
-
103
- .error-screen.boot-error p.boot-error__dev-fix {
104
- margin: 10px 0 0;
105
- font-size: 13px;
106
- line-height: 1.55;
107
- color: #3f4652;
108
- }
3
+ /* Boot failure screen — a FIXED palette, deliberately no theme tokens.
4
+ Same reasoning as ui/LicenceNotice.css: this renders when boot did not finish, so the theme
5
+ may never have applied, and a token that resolves to nothing leaves unreadable text on an
6
+ unpainted ground (which is exactly how a shell's CTA went invisible once). Every value here
7
+ is literal, and every property .error-screen would otherwise supply is set at higher
8
+ specificity. */
9
+ .error-screen.boot-error {
10
+ position: absolute;
11
+ inset: 0;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ height: 100%;
16
+ padding: 24px;
17
+ box-sizing: border-box;
18
+ background: #f4f5f7;
19
+ color: #111111;
20
+ color-scheme: light;
21
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
22
+ text-align: left;
23
+ }
24
+
25
+ .error-screen.boot-error .boot-error__card {
26
+ max-width: 520px;
27
+ padding: 28px 32px;
28
+ background: #ffffff;
29
+ border: 1px solid #e3e5e8;
30
+ border-radius: 12px;
31
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
32
+ }
33
+
34
+ .error-screen.boot-error h1.boot-error__title {
35
+ margin: 0 0 10px;
36
+ font-size: 18px;
37
+ font-weight: 600;
38
+ line-height: 1.35;
39
+ color: #111111;
40
+ }
41
+
42
+ .error-screen.boot-error button.boot-error__retry {
43
+ margin-top: 18px;
44
+ padding: 9px 18px;
45
+ border: 1px solid #d0d3d8;
46
+ border-radius: 6px;
47
+ background: #ffffff;
48
+ color: #111111;
49
+ font-size: 13px;
50
+ font-weight: 600;
51
+ cursor: pointer;
52
+ }
53
+
54
+ .error-screen.boot-error button.boot-error__retry:hover {
55
+ background: #f4f5f7;
56
+ }
57
+
58
+ .error-screen.boot-error p.boot-error__body {
59
+ margin: 0;
60
+ font-size: 14px;
61
+ line-height: 1.55;
62
+ color: #555b66;
63
+ }
64
+
65
+ /* DEV ONLY (see BootErrorNotice.jsx): the integrator's instruction, COLLAPSED so it never
66
+ competes with the shopper's message, and visually separated so it cannot be mistaken for it. */
67
+ .error-screen.boot-error .boot-error__dev {
68
+ margin-top: 20px;
69
+ padding-top: 16px;
70
+ border-top: 1px dashed #d8dbe0;
71
+ }
72
+
73
+ .error-screen.boot-error summary.boot-error__dev-tag {
74
+ display: inline-block;
75
+ padding: 3px 10px;
76
+ border-radius: 999px;
77
+ background: #eef1f5;
78
+ color: #5b6472;
79
+ font-size: 10px;
80
+ font-weight: 700;
81
+ letter-spacing: 0.06em;
82
+ text-transform: uppercase;
83
+ cursor: pointer;
84
+ user-select: none;
85
+ list-style: none; /* hide the default marker; the pill IS the affordance */
86
+ }
87
+
88
+ .error-screen.boot-error summary.boot-error__dev-tag::-webkit-details-marker { display: none; }
89
+
90
+ .error-screen.boot-error summary.boot-error__dev-tag::after {
91
+ content: ' ▸';
92
+ font-size: 9px;
93
+ }
94
+
95
+ .error-screen.boot-error .boot-error__dev[open] summary.boot-error__dev-tag::after {
96
+ content: ' ▾';
97
+ }
98
+
99
+ .error-screen.boot-error summary.boot-error__dev-tag:hover {
100
+ background: #e4e8ee;
101
+ }
102
+
103
+ .error-screen.boot-error p.boot-error__dev-fix {
104
+ margin: 10px 0 0;
105
+ font-size: 13px;
106
+ line-height: 1.55;
107
+ color: #3f4652;
108
+ }
109
109
 
110
110
  }
@@ -1 +1 @@
1
- import{jsx as b,jsxs as fn}from"react/jsx-runtime";import{memo as qt,useRef as Z,useState as J,useCallback as kt,useEffect as lt,useSyncExternalStore as Qt}from"react";import{useFrame as Ut,useThree as Xt}from"@react-three/fiber";import{Html as Ct}from"@react-three/drei";import*as _ from"three";import q from"./9c6c598569.js";import ut from"./872c4302e0.js";import Yt from"./8f60e5059a.js";import _t from"./c9a1656c62.js";import{resolveComponentRenderer as Zt,subscribeSceneRegistry as Jt,getSceneRegistryVersion as Ot,runInteraction as dt}from"./95a44ebec2.js";import mt,{SELECTION_COLOR as tn}from"./66c461dc2c.js";import{useUiToggles as nn}from"./d0f9681634.js";import{_anchorHasData as on}from"./9326c23506.js";function en(o){Qt(Jt,Ot,Ot);const c=[o?.slotName,o?.component?.slotName,o?.component?.slot_name,o?.component?.kind,o?.component?.name];let g=null;for(const l of c)if(l!=null&&(g=Zt(l),g))break;return g?b(g,{...o,Default:_t,THREE:_}):b(_t,{...o})}function Q(o,c,g=[0,0,0]){const l=o?.[c];if(Array.isArray(l)&&l.length>=3)return[Number(l[0])||0,Number(l[1])||0,Number(l[2])||0];if(l&&typeof l=="object")return[Number(l.x)||0,Number(l.y)||0,Number(l.z)||0];const I=D=>o?.[`${c}_${D}`]??o?.[`${c}${D.toUpperCase()}`],A=I("x"),x=I("y"),E=I("z");return A==null&&x==null&&E==null?g:[Number(A)||0,Number(x)||0,Number(E)||0]}function sn(o){if(!Array.isArray(o)||o.length<2)return o;const c=new Set,g=l=>(l?.groups||l?.group_ids||[]).map(String);for(const l of o){const I=l.component,A=I?.anchor_points||I?.anchorPoints;if(!(!Array.isArray(A)||!A.length))for(const x of A){if(!on(x))continue;const E=new Set((x.acceptedGroups||x.accepted_groups||[]).map(String));if(!E.size)continue;const D=new Set((x.excludedGroups||x.excluded_groups||[]).map(String)),L=o.find(B=>{if(B===l||c.has(B.key))return!1;const F=g(B.component);return F.some(T=>E.has(T))&&!F.some(T=>D.has(T))});if(!L)continue;const z=Q(x,"position"),M=Q(x,"orientation");L.position=[z[0],z[1],z[2]],L.rotation=[M[0],M[1],M[2]],c.add(L.key)}}return o}const rn="#ff0000",cn="#333333",Mn=()=>{},an="rgba(255, 87, 34, 0.85)",ln="#ff8a65",un=[0,0,0];function dn(o){return o.map(c=>{const g=new Set,l=I=>{I!=null&&String(I)!==""&&g.add(String(I).toLowerCase())};return l(c.slotKey),l(c.slotName),l(c.component?.slot_name??c.component?.slotName),l(c.componentId),g})}function mn({instance:o,components:c,slotMaterials:g,onMeasure:l,onSelect:I,isSelected:A,selectionColor:x=tn,style:E,footprintExcludeItem:D,stateInstanceId:L,overlapping:z=!1,isPlacementTarget:M=!1,onPlacementClick:B,label:F,hoverable:T=!1,focusable:Mt=!1,disableInteraction:H=!1}){const $=Z(),pt=Z(),tt=Z(),nt=Z({}),[ft,ht]=J(null),[ot,gt]=J(null),[Nt,At]=J(0),Et=kt(()=>At(t=>t+1),[]),[U,yt]=J(!1),X=nn()("selectionPanel");lt(()=>{nt.current={},ht(null),gt(null)},[o?.productId]);const zt=q(t=>t.selectInstance),Rt=q(t=>t.selectedInstanceId),et=ut(t=>t.getProduct),R=ut(t=>t.getComponent),O=ut(t=>t.componentGroups),vt=q(t=>t.componentStates),Pt=q(t=>t.placementOverrides),j=Yt(t=>t.guiVisible)!==!1,st=Xt(t=>t.invalidate);lt(()=>{z&&st?.()},[z,st]),Ut(({clock:t})=>{if(!z||!tt.current)return;const e=.45+.25*Math.sin(t.getElapsedTime()*6);tt.current.traverse(n=>{n.isMesh&&n.material&&(n.material.opacity=e)}),st?.()}),lt(()=>{const t=$.current,e=pt.current;if(!t||!e)return;const n=requestAnimationFrame(()=>{t.updateWorldMatrix(!0,!0);const s=new _.Matrix4().copy(t.matrixWorld).invert(),a=new _.Box3,i=new _.Box3,u=new _.Matrix4;if(e.traverse(r=>{!r.isMesh||!r.geometry||(r.geometry.boundingBox||r.geometry.computeBoundingBox(),i.copy(r.geometry.boundingBox),i.applyMatrix4(u.multiplyMatrices(s,r.matrixWorld)),a.union(i))}),a.isEmpty())return;const m=a.getSize(new _.Vector3),f=a.getCenter(new _.Vector3);gt(r=>r&&r.width===m.x&&r.height===m.y&&r.depth===m.z&&r.cx===f.x&&r.cy===f.y&&r.cz===f.z?r:{width:m.x,height:m.y,depth:m.z,cx:f.x,cy:f.y,cz:f.z})});return()=>cancelAnimationFrame(n)},[ft,Nt]);const Dt=kt((t,e,n,s=!1)=>{const a=(n?.[0]||0)+(e.cx||0),i=(n?.[2]||0)+(e.cz||0),u=(n?.[1]||0)+(e.cy||0);nt.current[t]={minx:a-(e.width||0)/2,maxx:a+(e.width||0)/2,minz:i-(e.depth||0)/2,maxz:i+(e.depth||0)/2,height:e.height||0,bottom:u-(e.height||0)/2,top:u+(e.height||0)/2,isLeg:s};const m=p=>{let d=1/0,h=-1/0,y=1/0,C=-1/0,w=-1/0,v=1/0,xt=!1;for(const N of Object.values(nt.current))p(N)&&(xt=!0,d=Math.min(d,N.minx),h=Math.max(h,N.maxx),y=Math.min(y,N.minz),C=Math.max(C,N.maxz),w=Math.max(w,N.top!=null?N.top:N.height||0),v=Math.min(v,N.bottom!=null?N.bottom:0));if(!xt||!Number.isFinite(d))return null;const Wt=Number.isFinite(w)&&Number.isFinite(v)?Math.max(0,w-v):0;return{width:h-d,depth:C-y,height:Wt,cx:(d+h)/2,cz:(y+C)/2,minX:d,minZ:y}},f=m(()=>!0);f&&ht(p=>p&&p.width===f.width&&p.height===f.height&&p.depth===f.depth&&p.cx===f.cx&&p.cz===f.cz?p:f);const r=m(p=>!p.isLeg)||f;r&&l?.(f?{...r,full:f}:r)},[l]),k=o.instanceId??o.id,bt=L??k,it=et(o.productId)||et(o.variantId),rt=A??Rt===k;if(!it)return null;const ct=(t=null)=>{if(!H){if(M&&B){B(k,o);return}X&&dt("click",{placementId:k,instanceId:k,instance:o,componentId:t},e=>{I?I(e.instanceId,e.instance,e.componentId):zt(e.instanceId,e.componentId)})}},Lt=t=>{H||(t.stopPropagation(),ct())},Bt=X?I?ct:void 0:ct,Tt=t=>{if(H||!Mt||M||!$.current)return;t.stopPropagation();const e=new _.Box3().setFromObject($.current),n=new _.Vector3;e.getCenter(n);const s=new _.Sphere;e.getBoundingSphere(s);const a=new _.Quaternion;$.current.getWorldQuaternion(a);const i=new _.Euler().setFromQuaternion(a,"YXZ").y;q.getState().focusOnObject?.([n.x,n.y,n.z],s.radius,i)},Kt=t=>{H||!T||(t.stopPropagation(),dt("hover",{placementId:k,instanceId:k,instance:o,hovered:!0},()=>{yt(!0),typeof document<"u"&&(document.body.style.cursor="pointer")}))},Ft=()=>{H||!T||dt("hover",{placementId:k,instanceId:k,instance:o,hovered:!1},()=>{yt(!1),typeof document<"u"&&(document.body.style.cursor="auto")})},Ht=it.components_configuration||it.componentsConfiguration||{},G=vt[bt]||{},S=ot||ft,V=S?.height>0?S.height:.8,It=ot?.cy!=null?ot.cy:V/2,St=(t,e)=>{const n=G[t]?.componentId??null;if(n!=null)return n;if(e==null||!O)return null;const s=R(e),a=s?.groups||s?.group_ids||[];for(const i of a){const u=O[i]||O[String(i)];if(!u)continue;const m=new Set([...Object.values(u.variants||{}),...Array.isArray(u.members)?u.members.map(d=>d?.componentId??d?.id??d):[]].map(String));if(m.size&&!m.has(String(e)))continue;const f=u.name??u.slotKey??u.slot_key,r=f!=null?G[f]?.componentId:null,p=G[i]?.componentId??G[String(i)]?.componentId;if(r!=null)return r;if(p!=null)return p}return null},$t=t=>{if(!E||t==null)return null;const e=R(t),n=String(e?.type??"").toLowerCase();if(n!=="door"&&n!=="drawer")return null;const s=e?.groups||e?.group_ids||[];for(const a of s){const u=(O?.[a]||O?.[String(a)])?.variants?.[E];if(u!=null)return u}return null};let P=Array.isArray(c)&&c.length?c.map((t,e)=>{const n=t.slotKey??t.materialSlot??t.material_slot??t.type??`res-${e}`,s=t.componentId??t.component_id??null,a=St(n,s),i=t.component??t;let u=i;if(a!=null&&String(a)!==String(s)){let m=R(a);if(!m){const f=et(a),r=f&&(f.components_configuration||f.componentsConfiguration||f.components);if(r&&typeof r=="object"){const p=r[n]??Object.values(r)[0],d=p?.componentId??p?.component_id??(typeof p=="number"||typeof p=="string"?p:null);m=(d!=null?R(d):null)??(p&&typeof p=="object"?p:null)}}m&&(u={...m,position:i.position??m.position,rotation:i.rotation??m.rotation,scale:i.scale??m.scale,materialSlot:i.materialSlot??i.material_slot??m.materialSlot,rotationRad:i.rotationRad??m.rotationRad})}return{key:t.key??`res-${e}`,slotKey:n,componentId:a??s,component:u,position:t.position??i?.position??null,offset:t.offset??i?.offset??null,baseState:{materialId:t.materialId??null,color:t.color??null,roughness:t.roughness,metalness:t.metalness}}}):Object.entries(Ht).flatMap(([t,e])=>(Array.isArray(e)?e:[e]).map((s,a)=>{const i=s?.slotName??s?.slot_name??t,u=s?.componentId??s?.component_id??i,m=St(i,u)??$t(u)??u;return{key:`${t}-${a}`,slotKey:i,slotName:s?.slotName??s?.slot_name??null,componentId:m,component:R(m),position:s?.position??null,rotation:s?.rotation??null,scale:s?.scale??null,offset:s?.offset??s?.offsets??null,baseState:null}}));{const t=new Set,e=(n,s)=>{if(!n||s>6)return;const a=Array.isArray(n.children)?n.children:[];for(const i of a){const u=i?.componentId??i?.component_id;u!=null&&(t.add(String(u)),e(R(u),s+1))}};for(const n of P)e(n.component??(n.componentId!=null?R(n.componentId):null),0);t.size&&(P=P.filter(n=>!t.has(String(n.componentId))))}{const t=new Map;for(const e of P){const n=String(e.key??e.slotKey??e.componentId??"item"),s=t.get(n)??0;t.set(n,s+1),e.key=s>0?`${n}#${s}`:n}}sn(P);const K=Pt?.[bt]||{},wt=!!(K.visibility||K.transforms),jt=wt?dn(P):null,W=S?.width>0&&S?.depth>0,Y=[S?.cx||0,It,S?.cz||0],at=t=>{const e=t.slotKey;if(e!=null&&String(e)!==""&&O)for(const a of Object.keys(O)){const i=O[a]?.slotKey??O[a]?.slot_key;if(i!=null&&String(i)===String(e))return String(a)}const n=t.component||(t.componentId!=null?R(t.componentId):null),s=n?.groups||n?.group_ids||[];return s.length?String(s[0]):"__ungrouped__"},Gt=(()=>{const t=new Map;return P.forEach((e,n)=>{const s=at(e);t.has(s)||t.set(s,{gid:s,items:[]}),t.get(s).items.push({it:e,i:n})}),[...t.values()]})(),Vt=(t,e)=>{const n=t.component;if(!n)return null;const s=G[t.slotKey],a={visible:!0,materialId:null,variantId:null,...t.baseState,...s};if(a.visible===!1||K.hiddenComponentIds?.some?.(d=>String(d)===String(t.componentId)))return null;let i=null;if(wt){const d=jt[e],h=K.visibility;if(h){for(const[C,w]of Object.entries(h))if(w===!1&&d.has(String(C).toLowerCase()))return null}const y=K.transforms;if(y){for(const[C,w]of Object.entries(y))if(w&&d.has(String(C).toLowerCase())){i=w;break}}}const u=String(n.materialSlot??n.material_slot??"").toLowerCase(),m=g&&u?g[u]:null,f=m?{...a,materialId:m}:a,r={...n,position:t.position||n.position||[0,0,0],rotation:t.rotation||n.rotation||n.orientation||[0,0,0],...t.scale?{scale:t.scale}:{}},p=n.offset||n.offsets||t.offset||null;if(p){const d=Q(p,"position"),h=Q(p,"rotation"),y=Q(p,"scale"),C=r.position||[0,0,0];r.position=[(C[0]||0)+d[0],(C[1]||0)+d[1],(C[2]||0)+d[2]];const w=r.rotation||[0,0,0];r.rotation=[(w[0]||0)+h[0],(w[1]||0)+h[1],(w[2]||0)+h[2]];const v=r.scale||n.scale||[1,1,1];r.scale=[(v[0]||1)+y[0],(v[1]||1)+y[1],(v[2]||1)+y[2]]}if(i){const d=i.position_delta||i.positionDelta;if(Array.isArray(d)){const y=r.position||[0,0,0];r.position=[(y[0]||0)+(d[0]||0),(y[1]||0)+(d[1]||0),(y[2]||0)+(d[2]||0)]}else Array.isArray(i.position)&&(r.position=i.position);Array.isArray(i.rotation)&&(r.rotation=i.rotation);const h=i.scale;Array.isArray(h)?r.scale=h:typeof h=="number"&&(r.scale=[h,h,h]),(i.recalculate_position||i.recalculatePosition)&&(r.recalcPosition=!0)}return b(en,{component:r,componentState:f,instanceId:k,isSelected:!1,onPick:Bt,slotName:t.slotKey??t.component?.slot_name??t.component?.slotName??(t.componentId!=null?`component-${t.componentId}`:null),slotKey:t.slotKey,componentId:t.componentId,hiddenComponentIds:K.hiddenComponentIds||null,slotMaterials:g,onDescendantMeasured:Et,pivot:O?.[at(t)]?.pivot??O?.[String(at(t))]?.pivot??null,onMeasure:d=>Dt(t.key,d,t.position,!!D?.(t,n))},t.key)};return fn("group",{ref:$,name:`placement-${k}`,userData:{instanceId:k,productId:o.productId??null},position:o.position,rotation:o.rotation,scale:Array.isArray(o.scale)?o.scale:[1,1,1],onClick:Lt,onDoubleClick:Tt,onPointerOver:Kt,onPointerOut:Ft,children:[M&&j&&W&&b(Ct,{position:Y,center:!0,style:{pointerEvents:"none"},zIndexRange:[100,0],children:b("div",{style:{width:22,height:22,borderRadius:"50%",background:U?ln:an,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13,fontWeight:"bold",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",transform:U?"scale(1.15)":"scale(1)"},children:"+"})}),z&&!M&&j&&W&&b("group",{ref:tt,position:Y,children:b(mt,{width:S.width,height:V,depth:S.depth,color:rn,thickness:.01})}),X&&rt&&!M&&j&&W&&b("group",{position:Y,children:b(mt,{width:S.width,height:V,depth:S.depth,color:x,thickness:.008})}),X&&U&&!rt&&!M&&j&&W&&b("group",{position:Y,children:b(mt,{width:S.width,height:V,depth:S.depth,color:cn,thickness:.008})}),F&&(rt||U)&&j&&W&&b(Ct,{position:[S.cx||0,It+V/2+.12,S.cz||0],center:!0,zIndexRange:[100,0],children:b("div",{className:"dimension-label",children:b("span",{children:F})})}),b("group",{ref:pt,children:Gt.map(({gid:t,items:e})=>b("group",{position:un,children:e.map(({it:n,i:s})=>Vt(n,s))},t))})]})}function pn(o,c){if(!o.instance||!c.instance)return o.instance===c.instance;const g=o.instance.instanceId??o.instance.id,l=c.instance.instanceId??c.instance.id;return g===l&&o.instance.productId===c.instance.productId&&o.instance.position===c.instance.position&&o.instance.rotation===c.instance.rotation&&o.components===c.components&&o.slotMaterials===c.slotMaterials&&o.onMeasure===c.onMeasure&&o.footprintExcludeItem===c.footprintExcludeItem&&o.stateInstanceId===c.stateInstanceId&&o.onSelect===c.onSelect&&o.isSelected===c.isSelected&&o.selectionColor===c.selectionColor&&o.overlapping===c.overlapping&&o.isPlacementTarget===c.isPlacementTarget&&o.onPlacementClick===c.onPlacementClick&&o.label===c.label&&o.hoverable===c.hoverable&&o.focusable===c.focusable&&o.disableInteraction===c.disableInteraction}var Nn=qt(mn,pn);export{Nn as default};
1
+ import{jsx as g,jsxs as ye}from"react/jsx-runtime";import{memo as Ut,useRef as P,useState as X,useCallback as dt,useEffect as Z,useSyncExternalStore as Yt}from"react";import{useFrame as Xt,useThree as Zt}from"@react-three/fiber";import{Html as xt}from"@react-three/drei";import*as k from"three";import W from"./9c6c598569.js";import pt from"./872c4302e0.js";import Jt from"./8f60e5059a.js";import At from"./c9a1656c62.js";import{resolveComponentRenderer as te,subscribeSceneRegistry as ee,getSceneRegistryVersion as Nt,runInteraction as mt}from"./95a44ebec2.js";import ft,{SELECTION_COLOR as oe}from"./66c461dc2c.js";import{useUiToggles as ne}from"./d0f9681634.js";import{_anchorHasData as se}from"./9326c23506.js";import{createSlotFootprint as Rt,footprintFlag as re}from"./718ecf1729.js";function ie(o){Yt(ee,Nt,Nt);const i=[o?.slotName,o?.component?.slotName,o?.component?.slot_name,o?.component?.kind,o?.component?.name];let m=null;for(const l of i)if(l!=null&&(m=te(l),m))break;return m?g(m,{...o,Default:At,THREE:k}):g(At,{...o})}function q(o,i,m=[0,0,0]){const l=o?.[i];if(Array.isArray(l)&&l.length>=3)return[Number(l[0])||0,Number(l[1])||0,Number(l[2])||0];if(l&&typeof l=="object")return[Number(l.x)||0,Number(l.y)||0,Number(l.z)||0];const y=z=>o?.[`${i}_${z}`]??o?.[`${i}${z.toUpperCase()}`],x=y("x"),S=y("y"),A=y("z");return x==null&&S==null&&A==null?m:[Number(x)||0,Number(S)||0,Number(A)||0]}function ce(o){if(!Array.isArray(o)||o.length<2)return o;const i=new Set,m=l=>(l?.groups||l?.group_ids||[]).map(String);for(const l of o){const y=l.component,x=y?.anchor_points||y?.anchorPoints;if(!(!Array.isArray(x)||!x.length))for(const S of x){if(!se(S))continue;const A=new Set((S.acceptedGroups||S.accepted_groups||[]).map(String));if(!A.size)continue;const z=new Set((S.excludedGroups||S.excluded_groups||[]).map(String)),D=o.find(L=>{if(L===l||i.has(L.key))return!1;const F=m(L.component);return F.some(B=>A.has(B))&&!F.some(B=>z.has(B))});if(!D)continue;const N=q(S,"position"),_=q(S,"orientation");D.position=[N[0],N[1],N[2]],D.rotation=[_[0],_[1],_[2]],i.add(D.key)}}return o}const ae="#ff0000",le="#333333",Ee=()=>{},ue="rgba(255, 87, 34, 0.85)",de="#ff8a65",pe=re,me=[0,0,0];function fe(o){return o.map(i=>{const m=new Set,l=y=>{y!=null&&String(y)!==""&&m.add(String(y).toLowerCase())};return l(i.slotKey),l(i.slotName),l(i.component?.slot_name??i.component?.slotName),l(i.componentId),m})}function he({instance:o,components:i,slotMaterials:m,onMeasure:l,onSelect:y,isSelected:x,selectionColor:S=oe,style:A,footprintExcludeItem:z,stateInstanceId:D,overlapping:N=!1,isPlacementTarget:_=!1,onPlacementClick:L,label:F,hoverable:B=!1,focusable:vt=!1,disableInteraction:K=!1}){const H=P(),ht=P(),J=P(),tt=P(Rt()),[gt,yt]=X(null),[et,bt]=X(null),[Et,Mt]=X(0),Pt=dt(()=>Mt(t=>t+1),[]),[Q,It]=X(!1),U=ne()("selectionPanel");Z(()=>{tt.current=Rt(),yt(null),bt(null)},[o?.productId]);const zt=W(t=>t.selectInstance),Dt=W(t=>t.selectedInstanceId),ot=pt(t=>t.getProduct),R=pt(t=>t.getComponent),C=pt(t=>t.componentGroups),Lt=W(t=>t.componentStates),Bt=W(t=>t.placementOverrides),$=Jt(t=>t.guiVisible)!==!1,nt=Zt(t=>t.invalidate);Z(()=>{N&&nt?.()},[N,nt]),Xt(({clock:t})=>{if(!N||!J.current)return;const n=.45+.25*Math.sin(t.getElapsedTime()*6);J.current.traverse(e=>{e.isMesh&&e.material&&(e.material.opacity=n)}),nt?.()}),Z(()=>{const t=H.current,n=ht.current;if(!t||!n)return;const e=requestAnimationFrame(()=>{t.updateWorldMatrix(!0,!0);const s=new k.Matrix4().copy(t.matrixWorld).invert(),a=new k.Box3,r=new k.Box3,u=new k.Matrix4;if(n.traverse(c=>{!c.isMesh||!c.geometry||(c.geometry.boundingBox||c.geometry.computeBoundingBox(),r.copy(c.geometry.boundingBox),r.applyMatrix4(u.multiplyMatrices(s,c.matrixWorld)),a.union(r))}),a.isEmpty())return;const d=a.getSize(new k.Vector3),f=a.getCenter(new k.Vector3);bt(c=>c&&c.width===d.x&&c.height===d.y&&c.depth===d.z&&c.cx===f.x&&c.cy===f.y&&c.cz===f.z?c:{width:d.x,height:d.y,depth:d.z,cx:f.x,cy:f.y,cz:f.z})});return()=>cancelAnimationFrame(e)},[gt,Et]);const St=P(!0);Z(()=>()=>{St.current=!1},[]);const wt=P(l);wt.current=l;const st=P(!1),rt=dt(()=>{const t=tt.current,n=t.report();if(!n)return;const e=n.full||n;yt(s=>s&&s.width===e.width&&s.height===e.height&&s.depth===e.depth&&s.cx===e.cx&&s.cz===e.cz?s:e),import.meta.env?.DEV&&(n.__slots={...t.boxes}),wt.current?.(n)},[]),Tt=dt((t,n,e,s=!1)=>{const a=tt.current;if(n!=null){a.set(t,n,e,s),rt();return}a.remove(t)&&(st.current||(st.current=!0,queueMicrotask(()=>{st.current=!1,St.current&&rt()})))},[rt]),w=o.instanceId??o.id,kt=D??w,it=ot(o.productId)||ot(o.variantId),ct=x??Dt===w;if(!it)return null;const at=(t=null)=>{if(!K){if(_&&L){L(w,o);return}U&&mt("click",{placementId:w,instanceId:w,instance:o,componentId:t},n=>{y?y(n.instanceId,n.instance,n.componentId):zt(n.instanceId,n.componentId)})}},Ft=t=>{K||(t.stopPropagation(),at())},Kt=U?y?at:void 0:at,Ht=t=>{if(K||!vt||_||!H.current)return;t.stopPropagation();const n=new k.Box3().setFromObject(H.current),e=new k.Vector3;n.getCenter(e);const s=new k.Sphere;n.getBoundingSphere(s);const a=new k.Quaternion;H.current.getWorldQuaternion(a);const r=new k.Euler().setFromQuaternion(a,"YXZ").y;W.getState().focusOnObject?.([e.x,e.y,e.z],s.radius,r)},$t=t=>{K||!B||(t.stopPropagation(),mt("hover",{placementId:w,instanceId:w,instance:o,hovered:!0},()=>{It(!0),typeof document<"u"&&(document.body.style.cursor="pointer")}))},Gt=()=>{K||!B||mt("hover",{placementId:w,instanceId:w,instance:o,hovered:!1},()=>{It(!1),typeof document<"u"&&(document.body.style.cursor="auto")})},Vt=it.components_configuration||it.componentsConfiguration||{},G=Lt[kt]||{},b=et||gt,V=b?.height>0?b.height:.8,Ct=et?.cy!=null?et.cy:V/2,_t=(t,n)=>{const e=G[t]?.componentId??null;if(e!=null)return e;if(n==null||!C)return null;const s=R(n),a=s?.groups||s?.group_ids||[];for(const r of a){const u=C[r]||C[String(r)];if(!u)continue;const d=new Set([...Object.values(u.variants||{}),...Array.isArray(u.members)?u.members.map(p=>p?.componentId??p?.id??p):[]].map(String));if(d.size&&!d.has(String(n)))continue;const f=u.name??u.slotKey??u.slot_key,c=f!=null?G[f]?.componentId:null,h=G[r]?.componentId??G[String(r)]?.componentId;if(c!=null)return c;if(h!=null)return h}return null},jt=t=>{if(!A||t==null)return null;const n=R(t),e=String(n?.type??"").toLowerCase();if(e!=="door"&&e!=="drawer")return null;const s=n?.groups||n?.group_ids||[];for(const a of s){const u=(C?.[a]||C?.[String(a)])?.variants?.[A];if(u!=null)return u}return null};let E=Array.isArray(i)&&i.length?i.map((t,n)=>{const e=t.slotKey??t.materialSlot??t.material_slot??t.type??`res-${n}`,s=t.componentId??t.component_id??null,a=_t(e,s),r=t.component??t;let u=r;if(a!=null&&String(a)!==String(s)){let d=R(a);if(!d){const f=ot(a),c=f&&(f.components_configuration||f.componentsConfiguration||f.components);if(c&&typeof c=="object"){const h=c[e]??Object.values(c)[0],p=h?.componentId??h?.component_id??(typeof h=="number"||typeof h=="string"?h:null);d=(p!=null?R(p):null)??(h&&typeof h=="object"?h:null)}}d&&(u={...d,position:r.position??d.position,rotation:r.rotation??d.rotation,scale:r.scale??d.scale,materialSlot:r.materialSlot??r.material_slot??d.materialSlot,rotationRad:r.rotationRad??d.rotationRad})}return{key:t.key??`res-${n}`,slotKey:e,componentId:a??s,component:u,position:t.position??r?.position??null,offset:t.offset??r?.offset??null,baseState:{materialId:t.materialId??null,color:t.color??null,roughness:t.roughness,metalness:t.metalness}}}):Object.entries(Vt).flatMap(([t,n])=>(Array.isArray(n)?n:[n]).map((s,a)=>{const r=s?.slotName??s?.slot_name??t,u=s?.componentId??s?.component_id??r,d=_t(r,u)??jt(u)??u;return{key:`${t}-${a}`,slotKey:r,slotName:s?.slotName??s?.slot_name??null,componentId:d,component:R(d),position:s?.position??null,rotation:s?.rotation??null,scale:s?.scale??null,offset:s?.offset??s?.offsets??null,baseState:null}}));{const t=new Set,n=(e,s)=>{if(!e||s>6)return;const a=Array.isArray(e.children)?e.children:[];for(const r of a){const u=r?.componentId??r?.component_id;u!=null&&(t.add(String(u)),n(R(u),s+1))}};for(const e of E)n(e.component??(e.componentId!=null?R(e.componentId):null),0);t.size&&(E=E.filter(e=>!t.has(String(e.componentId))))}{const t=new Map;for(const n of E){const e=String(n.key??n.slotKey??n.componentId??"item"),s=t.get(e)??0;t.set(e,s+1),n.key=s>0?`${e}#${s}`:e}}ce(E);const T=Bt?.[kt]||{},Ot=!!(T.visibility||T.transforms),Wt=Ot?fe(E):null,j=b?.width>0&&b?.depth>0,Y=[b?.cx||0,Ct,b?.cz||0],lt=t=>{const n=t.slotKey;if(n!=null&&String(n)!==""&&C)for(const a of Object.keys(C)){const r=C[a]?.slotKey??C[a]?.slot_key;if(r!=null&&String(r)===String(n))return String(a)}const e=t.component||(t.componentId!=null?R(t.componentId):null),s=e?.groups||e?.group_ids||[];return s.length?String(s[0]):"__ungrouped__"},qt=(()=>{const t=new Map;return E.forEach((n,e)=>{const s=lt(n);t.has(s)||t.set(s,{gid:s,items:[]}),t.get(s).items.push({it:n,i:e})}),[...t.values()]})(),Qt=(t,n)=>{const e=t.component;if(!e)return null;const s=G[t.slotKey],a={visible:!0,materialId:null,variantId:null,...t.baseState,...s};if(a.visible===!1||T.hiddenComponentIds?.some?.(p=>String(p)===String(t.componentId)))return null;let r=null;if(Ot){const p=Wt[n],I=T.visibility;if(I){for(const[M,v]of Object.entries(I))if(v===!1&&p.has(String(M).toLowerCase()))return null}const O=T.transforms;if(O){for(const[M,v]of Object.entries(O))if(v&&p.has(String(M).toLowerCase())){r=v;break}}}const u=String(e.materialSlot??e.material_slot??"").toLowerCase(),d=m&&u?m[u]:null,f=d?{...a,materialId:d}:a,c={...e,position:t.position||e.position||[0,0,0],rotation:t.rotation||e.rotation||e.orientation||[0,0,0],...t.scale?{scale:t.scale}:{}},h=e.offset||e.offsets||t.offset||null;if(h){const p=q(h,"position"),I=q(h,"rotation"),O=q(h,"scale"),M=c.position||[0,0,0];c.position=[(M[0]||0)+p[0],(M[1]||0)+p[1],(M[2]||0)+p[2]];const v=c.rotation||[0,0,0];c.rotation=[(v[0]||0)+I[0],(v[1]||0)+I[1],(v[2]||0)+I[2]];const ut=c.scale||e.scale||[1,1,1];c.scale=[(ut[0]||1)+O[0],(ut[1]||1)+O[1],(ut[2]||1)+O[2]]}if(r){const p=r.position_delta||r.positionDelta;if(Array.isArray(p)){const O=c.position||[0,0,0];c.position=[(O[0]||0)+(p[0]||0),(O[1]||0)+(p[1]||0),(O[2]||0)+(p[2]||0)]}else Array.isArray(r.position)&&(c.position=r.position);Array.isArray(r.rotation)&&(c.rotation=r.rotation);const I=r.scale;Array.isArray(I)?c.scale=I:typeof I=="number"&&(c.scale=[I,I,I]),(r.recalculate_position||r.recalculatePosition)&&(c.recalcPosition=!0)}return g(ie,{component:c,componentState:f,instanceId:w,isSelected:!1,onPick:Kt,slotName:t.slotKey??t.component?.slot_name??t.component?.slotName??(t.componentId!=null?`component-${t.componentId}`:null),slotKey:t.slotKey,componentId:t.componentId,hiddenComponentIds:T.hiddenComponentIds||null,slotMaterials:m,onDescendantMeasured:Pt,pivot:C?.[lt(t)]?.pivot??C?.[String(lt(t))]?.pivot??null,onMeasure:p=>Tt(t.key,p,c,pe(z?.(t,e)))},t.key)};return ye("group",{ref:H,name:`placement-${w}`,userData:{instanceId:w,productId:o.productId??null},position:o.position,rotation:o.rotation,scale:Array.isArray(o.scale)?o.scale:[1,1,1],onClick:Ft,onDoubleClick:Ht,onPointerOver:$t,onPointerOut:Gt,children:[_&&$&&j&&g(xt,{position:Y,center:!0,style:{pointerEvents:"none"},zIndexRange:[100,0],children:g("div",{style:{width:22,height:22,borderRadius:"50%",background:Q?de:ue,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13,fontWeight:"bold",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",transform:Q?"scale(1.15)":"scale(1)"},children:"+"})}),N&&!_&&$&&j&&g("group",{ref:J,position:Y,children:g(ft,{width:b.width,height:V,depth:b.depth,color:ae,thickness:.01})}),U&&ct&&!_&&$&&j&&g("group",{position:Y,children:g(ft,{width:b.width,height:V,depth:b.depth,color:S,thickness:.008})}),U&&Q&&!ct&&!_&&$&&j&&g("group",{position:Y,children:g(ft,{width:b.width,height:V,depth:b.depth,color:le,thickness:.008})}),F&&(ct||Q)&&$&&j&&g(xt,{position:[b.cx||0,Ct+V/2+.12,b.cz||0],center:!0,zIndexRange:[100,0],children:g("div",{className:"dimension-label",children:g("span",{children:F})})}),g("group",{ref:ht,children:qt.map(({gid:t,items:n})=>g("group",{position:me,children:n.map(({it:e,i:s})=>Qt(e,s))},t))})]})}function ge(o,i){if(!o.instance||!i.instance)return o.instance===i.instance;const m=o.instance.instanceId??o.instance.id,l=i.instance.instanceId??i.instance.id;return m===l&&o.instance.productId===i.instance.productId&&o.instance.position===i.instance.position&&o.instance.rotation===i.instance.rotation&&o.components===i.components&&o.slotMaterials===i.slotMaterials&&o.onMeasure===i.onMeasure&&o.footprintExcludeItem===i.footprintExcludeItem&&o.stateInstanceId===i.stateInstanceId&&o.onSelect===i.onSelect&&o.isSelected===i.isSelected&&o.selectionColor===i.selectionColor&&o.overlapping===i.overlapping&&o.isPlacementTarget===i.isPlacementTarget&&o.onPlacementClick===i.onPlacementClick&&o.label===i.label&&o.hoverable===i.hoverable&&o.focusable===i.focusable&&o.disableInteraction===i.disableInteraction}var Me=Ut(he,ge);export{Me as default};
@@ -1 +1 @@
1
- const o=Object.freeze({CHANGE_VARIANT:"changeVariant",SET_ROOM_DIMENSIONS:"setRoomDimensions",RESTORE_STATE:"restoreState",SELECT_OPTION:"selectOption",SELECT_SYSTEM_OPTION:"selectSystemOption",ADD_PLACEMENT:"addPlacement",REMOVE_PLACEMENT:"removePlacement",MOVE_PLACEMENT:"movePlacement",SET_TRANSFORM:"setTransform",APPLY_PRESET:"applyPreset",CLEAR_SELECTION:"clearSelection",CLEAR_SYSTEM_SELECTION:"clearSystemSelection",NOOP:"noop"}),s=(e,t)=>({type:o.CHANGE_VARIANT,placementId:e,variantId:t}),O=(e,t,E)=>({type:o.SET_ROOM_DIMENSIONS,width:e,depth:t,height:E}),_=e=>({type:o.RESTORE_STATE,savedState:e}),a=(e,t,E)=>({type:o.SELECT_OPTION,placementId:e,optionSetId:t,optionId:E}),i=(e,t)=>({type:o.SELECT_SYSTEM_OPTION,optionSetId:e,optionId:t}),N=({productGraphId:e,variantId:t,placementGroup:E,position:p,sequence:T,hostPlacementId:r,hostVariantId:l,replace:n,replacePlacementId:c}={})=>{const S={type:o.ADD_PLACEMENT,productGraphId:e,variantId:t,placementGroup:E,position:p};return T!=null&&(S.sequence=T),r!=null&&(S.hostPlacementId=r),l!=null&&(S.hostVariantId=l),n&&(S.replace=!0,c!=null&&(S.replacePlacementId=c)),S},P=e=>({type:o.REMOVE_PLACEMENT,placementId:e}),A=({placementId:e,sequence:t,placementGroup:E,position:p,rotation:T,hostPlacementId:r,hostVariantId:l}={})=>{const n={type:o.MOVE_PLACEMENT,placementId:e,sequence:t};return E!=null&&(n.placementGroup=E),p!=null&&(n.position=p),T!=null&&(n.rotation=T),r!=null&&(n.hostPlacementId=r),l!=null&&(n.hostVariantId=l),n},R=(e,t,E)=>({type:o.SET_TRANSFORM,placementId:e,position:t,rotation:E}),M=e=>({type:o.APPLY_PRESET,presetId:e}),m=(e,t)=>({type:o.CLEAR_SELECTION,placementId:e,optionSetId:t}),y=e=>({type:o.CLEAR_SYSTEM_SELECTION,optionSetId:e}),L=()=>({type:o.NOOP});function C(e){return e?.type===o.SET_TRANSFORM}export{o as MutationType,N as addPlacement,M as applyPreset,s as changeVariant,m as clearSelection,y as clearSystemSelection,C as isLocalOnlyMutation,A as movePlacement,L as noop,P as removePlacement,_ as restoreState,a as selectOption,i as selectSystemOption,O as setRoomDimensions,R as setTransform};
1
+ const o=Object.freeze({CHANGE_VARIANT:"changeVariant",CHANGE_HOST_VARIANT:"changeHostVariant",SET_ROOM_DIMENSIONS:"setRoomDimensions",RESTORE_STATE:"restoreState",SELECT_OPTION:"selectOption",SELECT_SYSTEM_OPTION:"selectSystemOption",ADD_PLACEMENT:"addPlacement",REMOVE_PLACEMENT:"removePlacement",MOVE_PLACEMENT:"movePlacement",SET_TRANSFORM:"setTransform",APPLY_PRESET:"applyPreset",CLEAR_SELECTION:"clearSelection",CLEAR_SYSTEM_SELECTION:"clearSystemSelection",NOOP:"noop"}),l=(e,t)=>({type:o.CHANGE_VARIANT,placementId:e,variantId:t}),O=(e,t)=>({type:o.CHANGE_HOST_VARIANT,placementId:e,variantId:t}),_=(e,t,n)=>({type:o.SET_ROOM_DIMENSIONS,width:e,depth:t,height:n}),a=e=>({type:o.RESTORE_STATE,savedState:e}),A=(e,t,n)=>({type:o.SELECT_OPTION,placementId:e,optionSetId:t,optionId:n}),N=(e,t)=>({type:o.SELECT_SYSTEM_OPTION,optionSetId:e,optionId:t}),i=({productGraphId:e,variantId:t,placementGroup:n,position:p,sequence:S,hostPlacementId:r,hostVariantId:c,replace:E,replacePlacementId:s}={})=>{const T={type:o.ADD_PLACEMENT,productGraphId:e,variantId:t,placementGroup:n,position:p};return S!=null&&(T.sequence=S),r!=null&&(T.hostPlacementId=r),c!=null&&(T.hostVariantId=c),E&&(T.replace=!0,s!=null&&(T.replacePlacementId=s)),T},P=e=>({type:o.REMOVE_PLACEMENT,placementId:e}),R=({placementId:e,sequence:t,placementGroup:n,position:p,rotation:S,hostPlacementId:r,hostVariantId:c}={})=>{const E={type:o.MOVE_PLACEMENT,placementId:e,sequence:t};return n!=null&&(E.placementGroup=n),p!=null&&(E.position=p),S!=null&&(E.rotation=S),r!=null&&(E.hostPlacementId=r),c!=null&&(E.hostVariantId=c),E},y=(e,t,n)=>({type:o.SET_TRANSFORM,placementId:e,position:t,rotation:n}),M=e=>({type:o.APPLY_PRESET,presetId:e}),m=(e,t)=>({type:o.CLEAR_SELECTION,placementId:e,optionSetId:t}),C=e=>({type:o.CLEAR_SYSTEM_SELECTION,optionSetId:e}),L=()=>({type:o.NOOP});function u(e){return e?.type===o.SET_TRANSFORM}export{o as MutationType,i as addPlacement,M as applyPreset,O as changeHostVariant,l as changeVariant,m as clearSelection,C as clearSystemSelection,u as isLocalOnlyMutation,R as movePlacement,L as noop,P as removePlacement,a as restoreState,A as selectOption,N as selectSystemOption,_ as setRoomDimensions,y as setTransform};
@@ -1 +1 @@
1
- import*as o from"three";const t={ACESFilmic:o.ACESFilmicToneMapping,Reinhard:o.ReinhardToneMapping,Linear:o.LinearToneMapping,None:o.NoToneMapping,Cineon:o.CineonToneMapping},d={PCF:o.PCFSoftShadowMap,PCFSoft:o.PCFSoftShadowMap,PCFHard:o.PCFShadowMap,VSM:o.VSMShadowMap,Basic:o.BasicShadowMap},M={toneMapping:o.NoToneMapping,exposure:1,shadowMapType:o.PCFSoftShadowMap};function r(a,p){if(!a||!p)return;if(a.tone_mapping||a.toneMapping){const n=a.tone_mapping??a.toneMapping,s=t[n];s!=null&&(p.toneMapping=s)}const e=a.exposure,i=e!=null&&e!==""?Number(e):NaN;if(p.toneMappingExposure=Number.isFinite(i)?i:M.exposure,a.shadows&&(typeof a.shadows.enabled=="boolean"&&(p.shadowMap.enabled=a.shadows.enabled),a.shadows.type)){const n=d[a.shadows.type];n!=null&&(p.shadowMap.type=n),p.shadowMap.needsUpdate=!0}}export{M as RENDERER_DEFAULTS,r as applyEnvironmentToRenderer};
1
+ import*as o from"three";const M={ACESFilmic:o.ACESFilmicToneMapping,Reinhard:o.ReinhardToneMapping,Linear:o.LinearToneMapping,None:o.NoToneMapping,Cineon:o.CineonToneMapping},r={PCF:o.PCFShadowMap,PCFSoft:o.PCFShadowMap,PCFHard:o.PCFShadowMap,VSM:o.VSMShadowMap,Basic:o.BasicShadowMap},i={toneMapping:o.NoToneMapping,exposure:1,shadowMapType:o.PCFShadowMap};function h(a,p){if(!a||!p)return;const n=a.tone_mapping??a.toneMapping,s=n!=null&&n!==""?M[n]:null;p.toneMapping=s??i.toneMapping;const e=a.exposure,t=e!=null&&e!==""?Number(e):NaN;if(p.toneMappingExposure=Number.isFinite(t)?t:i.exposure,a.shadows){typeof a.shadows.enabled=="boolean"&&(p.shadowMap.enabled=a.shadows.enabled);const d=a.shadows.type?r[a.shadows.type]:null;p.shadowMap.type=d??i.shadowMapType,p.shadowMap.needsUpdate=!0}}export{i as RENDERER_DEFAULTS,h as applyEnvironmentToRenderer};