@imagineio/configurator-sdk 0.1.6 → 0.1.7

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.
@@ -1 +1 @@
1
- import{getSessionToken as h,getSessionScope as _,onScopeChange as w}from"./33fa2c8ca2.js";let o=null;function I(e){o=typeof e=="string"&&e.trim()?e.trim():null}function j(){return o}let s=null;function F(e){s=typeof e=="string"&&e.trim()?e.trim():null}function K(){return s}function k(e){if(typeof e!="string"||!e)return!1;let t=e;const n=t.indexOf("://");if(n!==-1){const r=t.indexOf("/",n+3);t=r===-1?"/":t.slice(r)}return t.includes("/api/v1/")||t.startsWith("/api/v1/")}let y=null;function $(e){y=e!=null&&String(e).trim()?String(e).trim():null}function R(){return y}let a=null;function X(e){a=typeof e=="string"&&e.trim()?e.trim():null}function m(){if(a)return a;try{const e=typeof window<"u"?window.__configApiKey:null;if(typeof e=="string"&&e.trim())return e.trim()}catch{}return null}function v(e){if(typeof e!="string"||!e)return!1;let t=e;const n=t.indexOf("://");if(n!==-1){const i=t.indexOf("/",n+3);t=i===-1?"/":t.slice(i)}if(!t.includes("/api/v1/")&&!t.startsWith("/api/v1/")||/\/api\/v1\/o\/[^/]+\/c\/[^/]+/.test(t)||/\/api\/v1\/channels\/[^/]+/.test(t))return!1;const r=t.match(/\/api\/v1\/projects\/([^/]+)/);if(r){const i=r[1];if(!/^\d+$/.test(i))return!1}return!0}function L(e){if(s&&k(e))return{"X-Share-Token":s};if(!v(e))return{};if(o)return{"X-Embed-Slug":o};const t=h();if(t)return{Authorization:`Bearer ${t}`};const n=m();return n?{"X-Api-Key":n}:{}}function N(){const e={};s&&(e["X-Share-Token"]=s),o&&(e["X-Embed-Slug"]=o);const t=h();t&&(e.Authorization=`Bearer ${t}`);const n=m();return n&&(e["X-Api-Key"]=n),e}let u=!1;const c=new Set;function g(){for(const e of c)try{e(u)}catch{}}function B(){const e=_();return e&&String(e).toLowerCase()!=="session"?!0:u}function O(e){u||(u=!0,g())}function W(e){return typeof e!="function"?()=>{}:(c.add(e),()=>c.delete(e))}w(()=>g());function z(){u=!1}async function H(e,t={}){if(!e||e.status!==403)return;let n=null,r=null,i=null;try{const l=await(e.clone?e.clone():e).json();n=l?.detail??null,r=l?.code??null,i=l?.hostname??null}catch{}if(r==="EMBED_NOT_LICENSED"){try{const{setConfiguratorStatusFromBackend:p}=await import("./3bbcee0334.js");p({status:!1,message:n||null})}catch{}try{console.warn(`[sdk] this organisation is not licensed to run on ${i||"this website"}${n?` \u2014 ${n}`:""}`)}catch{}return}const d=String(t.url||""),A=String(t.method||"GET").toUpperCase();if(/\/api\/v1\/projects\//.test(d)&&A!=="GET"){O(n);return}}let x=null,f=!1;function P(){f=!1}function S(e){const t=String(e||"").toLowerCase();return t.includes("required")?"missing":t.includes("revoked")?"revoked":t.includes("invalid")?"invalid":"unknown"}function T(e={}){if(f)return;f=!0;const t=e.reason?e:{...e,reason:S(e.detail)};if(!x){const n=t.reason&&t.reason!=="unknown"?`(${t.reason})`:"";return}try{x(t)}catch{}}function b(e){return!!e&&e.status===401}async function q(e,t={}){if(!b(e))return;let n=null;try{n=(await(e.clone?e.clone():e).json())?.detail??null}catch{}T({...t,status:401,detail:n,reason:S(n)})}export{z as _resetReadOnly,L as authHeaders,S as categorizeAuthFailure,N as copilotAuthHeaders,m as getApiKey,R as getChannelId,j as getEmbedSlug,K as getShareToken,b as isAuthFailure,B as isReadOnlyCredential,O as markReadOnlyCredential,T as notifyAuthFailure,W as onReadOnlyChange,v as pathRequiresApiKey,q as reportAuthFailure,H as reportForbidden,P as resetAuthFailureNotifier,X as setApiKey,$ as setChannelId,I as setEmbedSlug,F as setShareToken};
1
+ import{getSessionToken as m,getSessionScope as k,onScopeChange as v}from"./33fa2c8ca2.js";let o=null;function z(t){o=typeof t=="string"&&t.trim()?t.trim():null}function F(){return o}let u=null;function K(t){u=typeof t=="string"&&t.trim()?t.trim():null}function V(){return u}function h(t){if(typeof t!="string"||!t)return!1;let e=t;const n=e.indexOf("://");if(n!==-1){const r=e.indexOf("/",n+3);e=r===-1?"/":e.slice(r)}return e.includes("/api/v1/")||e.startsWith("/api/v1/")}let y=null;function X(t){y=t!=null&&String(t).trim()?String(t).trim():null}function $(){return y}let x=null;function L(t){x=t!=null&&String(t).trim()?String(t).trim():null}function N(){return x}let S=null;function B(t){S=t!=null&&String(t).trim()?String(t).trim():null}function W(){return S}let a=null;function H(t){a=t!=null&&String(t).trim()?String(t).trim():null}function P(){return a}let f=null;function q(t){f=typeof t=="string"&&t.trim()?t.trim():null}function _(){if(f)return f;try{const t=typeof window<"u"?window.__configApiKey:null;if(typeof t=="string"&&t.trim())return t.trim()}catch{}return null}function T(t){if(typeof t!="string"||!t)return!1;let e=t;const n=e.indexOf("://");if(n!==-1){const i=e.indexOf("/",n+3);e=i===-1?"/":e.slice(i)}if(!e.includes("/api/v1/")&&!e.startsWith("/api/v1/")||/\/api\/v1\/o\/[^/]+\/c\/[^/]+/.test(e)||/\/api\/v1\/channels\/[^/]+/.test(e))return!1;const r=e.match(/\/api\/v1\/projects\/([^/]+)/);if(r){const i=r[1];if(!/^\d+$/.test(i))return!1}return!0}function D(t){const e=a&&h(t)?{"X-Organization-Id":a}:null,n=l=>e?{...l,...e}:l;if(u&&h(t))return n({"X-Share-Token":u});if(!T(t))return n({});if(o)return n({"X-Embed-Slug":o});const r=m();if(r)return n({Authorization:`Bearer ${r}`});const i=_();return n(i?{"X-Api-Key":i}:{})}function G(){const t={};u&&(t["X-Share-Token"]=u),o&&(t["X-Embed-Slug"]=o);const e=m();e&&(t.Authorization=`Bearer ${e}`);const n=_();return n&&(t["X-Api-Key"]=n),t}let s=!1;const d=new Set;function A(){for(const t of d)try{t(s)}catch{}}function M(){const t=k();return t&&String(t).toLowerCase()!=="session"?!0:s}function b(t){s||(s=!0,A())}function U(t){return typeof t!="function"?()=>{}:(d.add(t),()=>d.delete(t))}v(()=>A());function J(){s=!1}async function Q(t,e={}){if(!t||t.status!==403)return;let n=null,r=null,i=null;try{const c=await(t.clone?t.clone():t).json();n=c?.detail??null,r=c?.code??null,i=c?.hostname??null}catch{}if(r==="EMBED_NOT_LICENSED"){try{const{setConfiguratorStatusFromBackend:g}=await import("./3bbcee0334.js");g({status:!1,message:n||null})}catch{}try{console.warn(`[sdk] this organisation is not licensed to run on ${i||"this website"}${n?` \u2014 ${n}`:""}`)}catch{}return}const l=String(e.url||""),I=String(e.method||"GET").toUpperCase();if(/\/api\/v1\/projects\//.test(l)&&I!=="GET"){b(n);return}}let O=null,p=!1;function Y(){p=!1}function w(t){const e=String(t||"").toLowerCase();return e.includes("required")?"missing":e.includes("revoked")?"revoked":e.includes("invalid")?"invalid":"unknown"}function C(t={}){if(p)return;p=!0;const e=t.reason?t:{...t,reason:w(t.detail)};if(!O){const n=e.reason&&e.reason!=="unknown"?`(${e.reason})`:"";return}try{O(e)}catch{}}function E(t){return!!t&&t.status===401}async function Z(t,e={}){if(!E(t))return;let n=null;try{n=(await(t.clone?t.clone():t).json())?.detail??null}catch{}C({...e,status:401,detail:n,reason:w(n)})}export{J as _resetReadOnly,D as authHeaders,w as categorizeAuthFailure,G as copilotAuthHeaders,_ as getApiKey,$ as getChannelId,F as getEmbedSlug,P as getOrganizationId,W as getRenderVersion,V as getShareToken,N as getSystemVersion,E as isAuthFailure,M as isReadOnlyCredential,b as markReadOnlyCredential,C as notifyAuthFailure,U as onReadOnlyChange,T as pathRequiresApiKey,Z as reportAuthFailure,Q as reportForbidden,Y as resetAuthFailureNotifier,q as setApiKey,X as setChannelId,z as setEmbedSlug,H as setOrganizationId,B as setRenderVersion,K as setShareToken,L as setSystemVersion};
@@ -1 +1 @@
1
- import{useMemo as l,useCallback as P}from"react";import m from"./9c6c598569.js";import{getPlacementType as f,PLACEMENT_TYPES as E}from"./4d7a0d1897.js";import{computeGaps as I,disarmPlacement as g}from"./ab6c80484f.js";function C({systemId:S,count:r,positionOf:i,insertAt:t,y:s=.6,armed:n=!0}){const p=m(e=>e.pendingPlacementPiece),o=f()===E.INSERT_BETWEEN&&(n?!!p:!0),a=l(()=>o?I(r,i,{y:s}):[],[o,r,s]),u=P(e=>{if(!n){t?.(e,null);return}const c=m.getState().pendingPlacementPiece;c&&(t?.(e,c),g())},[t,n]);return{active:o,gaps:a,onInsert:u}}export{C as usePlacementInteraction};
1
+ import{useMemo as d,useCallback as l,useEffect as P}from"react";import a from"./9c6c598569.js";import{getPlacementType as T,PLACEMENT_TYPES as g}from"./4d7a0d1897.js";import{computeGaps as I,disarmPlacement as m}from"./ab6c80484f.js";function L({systemId:w,count:c,positionOf:E,insertAt:r,y:u=.6,armed:t=!0}){const o=a(e=>e.pendingPlacementPiece),s=T()===g.INSERT_BETWEEN&&(t?!!o:!0),p=d(()=>s?I(c,E,{y:u}):[],[s,c,u]);P(()=>{if(!t||!o)return;const e=n=>{if(n.key!=="Escape")return;const i=n.target;i&&(i.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName||""))||m()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,o]);const f=l(e=>{if(!t){r?.(e,null);return}const n=a.getState().pendingPlacementPiece;n&&(r?.(e,n),m())},[r,t]);return{active:s,gaps:p,onInsert:f}}export{L as usePlacementInteraction};
@@ -0,0 +1 @@
1
+ import{useCallback as h,useEffect as w,useRef as y,useState as M}from"react";const P=1,X=6,E=2.5,m=(u,s,n)=>Math.min(n,Math.max(s,u));function S({onChange:u,disabled:s=!1}={}){const[n,d]=M({scale:1,x:0,y:0}),e=n.scale>1,a=y(null),p=y(null),v=y(u);v.current=u;const D=y(!1);w(()=>{D.current!==e&&(D.current=e,v.current?.(e))},[e]);const g=h((t,c,r)=>({scale:t.scale,x:t.scale<=1?0:m(t.x,c-c*t.scale,0),y:t.scale<=1?0:m(t.y,r-r*t.scale,0)}),[]),k=h((t,c,r)=>{const o=p.current;if(!o)return;const i=o.getBoundingClientRect(),z=c-i.left,C=r-i.top;d(f=>{const x=m(t,P,X),Y=z-(z-f.x)*(x/f.scale),A=C-(C-f.y)*(x/f.scale);return g({scale:x,x:Y,y:A},i.width,i.height)})},[g]),l=h(()=>d({scale:1,x:0,y:0}),[]);w(()=>{if(!e)return;const t=c=>{c.key==="Escape"&&l()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,l]),w(()=>{s&&l()},[s,l]);const R={ref:p,onDoubleClick:t=>{if(!s){t.preventDefault();try{window.getSelection?.()?.removeAllRanges()}catch{}e?l():k(E,t.clientX,t.clientY)}},onDragStart:t=>{e&&t.preventDefault()},onWheel:t=>{s||!e&&t.deltaY>0||(t.preventDefault(),k(n.scale*(t.deltaY<0?1.15:1/1.15),t.clientX,t.clientY))},onPointerDown:t=>{!e||t.button!==0||(t.preventDefault(),a.current={x:t.clientX,y:t.clientY,zx:n.x,zy:n.y},t.currentTarget.setPointerCapture?.(t.pointerId))},onPointerMove:t=>{if(!a.current)return;const c=p.current,r=c?c.getBoundingClientRect():{width:1,height:1},o=a.current;d(i=>g({scale:i.scale,x:o.zx+(t.clientX-o.x),y:o.zy+(t.clientY-o.y)},r.width,r.height))},onPointerUp:()=>{a.current=null},onPointerCancel:()=>{a.current=null}};return{active:e,scale:n.scale,bind:R,style:{transform:`translate(${n.x}px, ${n.y}px) scale(${n.scale})`,transformOrigin:"0 0"},reset:l}}var $=S;export{$ as default,S as useZoom};
@@ -1 +1 @@
1
- import{useSyncExternalStore as g}from"react";const r=new Map;let o=[],l=0;const f=new Set;function s(){l+=1;for(const t of f)try{t()}catch{}}const a=t=>{if(typeof t!="string")return null;const n=t.trim().toLowerCase();if(!n)return null;const e=n.length>1?n.replace(/\/+$/,""):n;return e.startsWith("/")?e:`/${e}`};function y(t,n){if(typeof n!="function")return()=>{};if(typeof t=="function"){const c=[t,n];return o=[c,...o],s(),()=>{const i=o.length;o=o.filter(p=>p!==c),o.length!==i&&s()}}const e=a(t);if(!e)return()=>{};const u=r.has(e)?r.get(e):void 0;return r.set(e,n),s(),()=>{r.get(e)===n&&(u!==void 0?r.set(e,u):r.delete(e),s())}}function d(t){let n=t;if(n==null)try{n=window.location.pathname}catch{return null}const e=a(n);if(!e)return null;const u=r.get(e);if(u)return u;for(const[c,i]of o)try{if(c(e))return i}catch{}return null}function _(t){return d(t)!==null}function R(){return{paths:[...r.keys()],matchers:o.length}}function m(t){return f.add(t),()=>{f.delete(t)}}const h=()=>l;function w(){return g(m,h,h)}function S(){r.clear(),o=[],s()}export{S as _resetRoutes,_ as hasRoute,R as listRoutes,y as registerRoute,d as resolveRoute,w as useRouteRegistry};
1
+ import{useSyncExternalStore as d}from"react";const o=new Map;let u=[],l=0;const f=new Set;function c(){l+=1;for(const t of f)try{t()}catch{}}const a=t=>{if(typeof t!="string")return null;const e=t.trim().toLowerCase();if(!e)return null;const n=e.length>1?e.replace(/\/+$/,""):e;return n.startsWith("/")?n:`/${n}`};function R(t,e){if(typeof e!="function")return()=>{};const n=typeof t=="function"?t:t instanceof RegExp?s=>t.test(s):null;if(n){const s=[n,e];return u=[s,...u],c(),()=>{const p=u.length;u=u.filter(g=>g!==s),u.length!==p&&c()}}const r=a(t);if(!r)return()=>{};const i=o.has(r)?o.get(r):void 0;return o.set(r,e),c(),()=>{o.get(r)===e&&(i!==void 0?o.set(r,i):o.delete(r),c())}}function m(t){let e=t;if(e==null)try{e=window.location.pathname}catch{return null}const n=a(e);if(!n)return null;const r=o.get(n);if(r)return r;for(const[i,s]of u)try{if(i(n))return s}catch{}return null}function y(t){return m(t)!==null}function w(){return{paths:[...o.keys()],matchers:u.length}}function x(t){return f.add(t),()=>{f.delete(t)}}const h=()=>l;function S(){return d(x,h,h)}function b(){o.clear(),u=[],c()}export{b as _resetRoutes,y as hasRoute,w as listRoutes,R as registerRoute,m as resolveRoute,S as useRouteRegistry};
@@ -1 +1 @@
1
- import{assertLicensed as v}from"./fe235d7160.js";import{shouldBlockRequest as w,requestBlockedError as x,blockForAuthFailure as C}from"./631a9f7fac.js";import{authHeaders as $,isAuthFailure as S,reportAuthFailure as T,reportForbidden as P,getChannelId as b}from"./431a2d8618.js";import{ensureSessionToken as y,hasTokenProvider as j}from"./33fa2c8ca2.js";import{getApiBaseUrl as g}from"./8ade32d067.js";const p=new Map;function h(e){const t=b();if(!t||/\/api\/v1\/o\/[^/]+\/c\/[^/]+/.test(e)||/\/api\/v1\/channels\/[^/]+/.test(e))return e;const s=e.includes("?")?"&":"?";return`${e}${s}channelId=${encodeURIComponent(t)}`}async function n(e,t={},s=1){if(w(e))throw x(e);const a=!t.method||t.method==="GET";if(a&&!t.noCache&&p.has(e))return p.get(e);const i=`${g()}${e}`;await v(e),await y();let m=!1;for(let c=0;c<=s;c++)try{const r={"Content-Type":"application/json",...$(e),...t.headers};typeof FormData<"u"&&t.body instanceof FormData&&delete r["Content-Type"];const o=await fetch(i,{headers:r,...import.meta.env?.DEV&&a?{cache:"no-store"}:{},...t});if(!o.ok){if(S(o)){if(!m&&j()){m=!0,await y({force:!0}),c-=1;continue}await T(o,{url:e,method:t.method||"GET"})}o.status===403&&await P(o,{url:e,method:t.method||"GET"});const f=await o.text().catch(()=>""),d=new Error(`API ${t.method||"GET"} ${e} failed: ${o.status} ${o.statusText}${f?` \u2014 ${f}`:""}`);if(d.status=o.status,f)try{const u=JSON.parse(f);u&&typeof u=="object"&&(d.body=u,u.code&&(d.code=String(u.code)),u.detail&&(d.detail=u.detail))}catch{}throw(o.status===401||o.status===403&&a)&&C(d),d}const l=await o.json();return a&&!t.noCache&&p.set(e,l),l}catch(r){const o=c===s,l=!t.method||t.method==="GET";if(r?.code==="EMBED_NOT_LICENSED"||r?.status===401||r?.status===403||r?.status===404||o||!l)throw r;await new Promise(f=>setTimeout(f,1e3))}}function E(e){if(e==null){p.clear();return}for(const t of p.keys())String(t).includes(e)&&p.delete(t)}async function I(){return n(h("/api/v1/catalog/"))}async function ne({domain:e,url:t,systemId:s}={}){const a=new URLSearchParams;e&&a.set("domain",e),t&&a.set("url",t),s!=null&&s!==""&&a.set("systemId",String(s));const i=a.toString();return n(`/api/v1/configurator/status/${i?`?${i}`:""}`,{method:"GET",noCache:!0})}async function oe({contentType:e,fileSize:t}={}){return n("/api/v1/ar/models/presign/",{method:"POST",body:JSON.stringify({content_type:e,file_size:t})})}async function O(){return n("/api/v1/ai/images/quota/",{method:"GET",noCache:!0})}async function R(e){return n("/api/v1/ai/images/",{method:"POST",body:e})}async function A(){return n("/api/v1/auth/introspect/",{method:"GET",noCache:!0})}async function re(e){return n("/api/v1/ai/images/references/",{method:"POST",body:e})}async function ae(e){return n("/api/v1/ai/images/generate/",{method:"POST",body:JSON.stringify(e)})}async function se(e){return n(`/api/v1/ai/images/jobs/${encodeURIComponent(e)}/`,{method:"GET",noCache:!0})}async function F(){return n(h("/api/v1/systems/"))}async function k(e){return n(h(`/api/v1/systems/${e}/`))}async function G(e,t,s){const a=typeof s=="boolean"?s:typeof window<"u"&&window.top!==window.self,i=new URLSearchParams({embedded:a?"1":"0"});t&&i.set("parentOrigin",t);const m=`${g()}/api/embed/${encodeURIComponent(e)}/?${i}`,c=await fetch(m,{headers:{"Content-Type":"application/json"}});let r=null;try{r=await c.json()}catch{}if(!c.ok){const o=new Error(`embed boot ${c.status}`);throw o.status=c.status,o.code=r?.code||null,o.detail=r?.detail||null,o.hostname=r?.hostname||null,o}return r}async function U(e){return n(h(`/api/v1/catalog/?systemId=${encodeURIComponent(e)}`))}async function q(e){return n(h(`/api/v1/products/?systemId=${encodeURIComponent(e)}`))}async function N(){return n(h("/api/v1/products/"))}async function J(e){return e==null?null:n(`/api/v1/themes/${encodeURIComponent(e)}/`)}async function B(){return n("/api/v1/layouts/")}async function D(e){return n("/api/v1/projects/",{method:"POST",body:JSON.stringify(e)})}async function L(e){return n(`/api/v1/projects/by-token/${encodeURIComponent(e)}/`)}async function _(e,t){return n(`/api/v1/projects/${e}/`,{method:"PATCH",body:JSON.stringify(t)})}async function M(e,t,s="design_pdf"){const a=new FormData;return a.append("file",t),a.append("kind",s),n(`/api/v1/projects/${e}/renders/`,{method:"POST",body:a})}async function H(e,t){return n(`/api/v1/projects/${e}/renders/`,{method:"POST",body:JSON.stringify(t)})}async function z(e){return n(`/api/v1/channels/${e}/config/`)}async function Q(e){return n(`/api/v1/channels/${e}/products/`)}async function V(e){return n(`/api/v1/channels/${e}/option-sets/`)}async function K(e){return n(`/api/v1/channels/${e}/projects/`)}const W={invalidateCache:E,fetchAiImageQuota:O,uploadAiImage:R,fetchCatalog:I,fetchSystems:F,fetchSystem:k,fetchEmbedBoot:G,fetchCatalogForSystem:U,fetchProductsForSystem:q,fetchProducts:N,fetchTheme:J,fetchLayouts:B,saveProject:D,loadProject:L,updateProject:_,uploadProjectRender:H,uploadProjectRenderFile:M,introspectCredential:A,fetchChannelConfig:z,fetchChannelProducts:Q,fetchChannelOptionSets:V,fetchChannelProjects:K};var ce=W;export{ce as default,se as fetchAiImageJob,O as fetchAiImageQuota,I as fetchCatalog,U as fetchCatalogForSystem,z as fetchChannelConfig,V as fetchChannelOptionSets,Q as fetchChannelProducts,K as fetchChannelProjects,ne as fetchConfiguratorStatus,G as fetchEmbedBoot,B as fetchLayouts,N as fetchProducts,q as fetchProductsForSystem,k as fetchSystem,F as fetchSystems,J as fetchTheme,ae as generateAiImage,A as introspectCredential,E as invalidateCache,L as loadProject,oe as presignArModel,D as saveProject,_ as updateProject,R as uploadAiImage,re as uploadAiReference,H as uploadProjectRender,M as uploadProjectRenderFile};
1
+ import{assertLicensed as v}from"./fe235d7160.js";import{shouldBlockRequest as g,requestBlockedError as w,blockForAuthFailure as C}from"./631a9f7fac.js";import{authHeaders as x,isAuthFailure as S,reportAuthFailure as T,reportForbidden as P,getChannelId as b,getSystemVersion as j,getRenderVersion as E}from"./431a2d8618.js";import{ensureSessionToken as l,hasTokenProvider as I}from"./33fa2c8ca2.js";import{getApiBaseUrl as $}from"./8ade32d067.js";const p=new Map;function m(e){const t=j();t&&/\/api\/v1\/systems\/[^/?]+\/?(\?|$)/.test(e)&&(e=`${e}${e.includes("?")?"&":"?"}version=${encodeURIComponent(t)}`);const s=E();s&&/\/api\/v1\/systems\/[^/?]+\/?(\?|$)/.test(e)&&(e=`${e}${e.includes("?")?"&":"?"}render_version=${encodeURIComponent(s)}`);const r=b();if(!r||/\/api\/v1\/o\/[^/]+\/c\/[^/]+/.test(e)||/\/api\/v1\/channels\/[^/]+/.test(e))return e;const i=e.includes("?")?"&":"?";return`${e}${i}channelId=${encodeURIComponent(r)}`}async function n(e,t={},s=1){if(g(e))throw w(e);const r=!t.method||t.method==="GET";if(r&&!t.noCache&&p.has(e))return p.get(e);const i=`${$()}${e}`;await v(e),await l();let h=!1;for(let c=0;c<=s;c++)try{const a={"Content-Type":"application/json",...x(e),...t.headers};typeof FormData<"u"&&t.body instanceof FormData&&delete a["Content-Type"];const o=await fetch(i,{headers:a,...import.meta.env?.DEV&&r?{cache:"no-store"}:{},...t});if(!o.ok){if(S(o)){if(!h&&I()){h=!0,await l({force:!0}),c-=1;continue}await T(o,{url:e,method:t.method||"GET"})}o.status===403&&await P(o,{url:e,method:t.method||"GET"});const d=await o.text().catch(()=>""),f=new Error(`API ${t.method||"GET"} ${e} failed: ${o.status} ${o.statusText}${d?` \u2014 ${d}`:""}`);if(f.status=o.status,d)try{const u=JSON.parse(d);u&&typeof u=="object"&&(f.body=u,u.code&&(f.code=String(u.code)),u.detail&&(f.detail=u.detail))}catch{}throw(o.status===401||o.status===403&&r)&&C(f),f}const y=await o.json();return r&&!t.noCache&&p.set(e,y),y}catch(a){const o=c===s,y=!t.method||t.method==="GET";if(a?.code==="EMBED_NOT_LICENSED"||a?.status===401||a?.status===403||a?.status===404||o||!y)throw a;await new Promise(d=>setTimeout(d,1e3))}}function R(e){if(e==null){p.clear();return}for(const t of p.keys())String(t).includes(e)&&p.delete(t)}async function O(){return n(m("/api/v1/catalog/"))}async function re({domain:e,url:t,systemId:s}={}){const r=new URLSearchParams;e&&r.set("domain",e),t&&r.set("url",t),s!=null&&s!==""&&r.set("systemId",String(s));const i=r.toString();return n(`/api/v1/configurator/status/${i?`?${i}`:""}`,{method:"GET",noCache:!0})}async function ae({contentType:e,fileSize:t}={}){return n("/api/v1/ar/models/presign/",{method:"POST",body:JSON.stringify({content_type:e,file_size:t})})}async function A(){return n("/api/v1/ai/images/quota/",{method:"GET",noCache:!0})}async function U(e){return n("/api/v1/ai/images/",{method:"POST",body:e})}async function F(){return n("/api/v1/auth/introspect/",{method:"GET",noCache:!0})}async function se(e){return n("/api/v1/ai/images/references/",{method:"POST",body:e})}async function ie(e){return n("/api/v1/ai/images/generate/",{method:"POST",body:JSON.stringify(e)})}async function ce(e){return n(`/api/v1/ai/images/jobs/${encodeURIComponent(e)}/`,{method:"GET",noCache:!0})}async function k(){return n(m("/api/v1/systems/"))}async function G(e){return n(m(`/api/v1/systems/${e}/`))}async function q(e,t,s){const r=typeof s=="boolean"?s:typeof window<"u"&&window.top!==window.self,i=new URLSearchParams({embedded:r?"1":"0"});t&&i.set("parentOrigin",t);const h=`${$()}/api/embed/${encodeURIComponent(e)}/?${i}`,c=await fetch(h,{headers:{"Content-Type":"application/json"}});let a=null;try{a=await c.json()}catch{}if(!c.ok){const o=new Error(`embed boot ${c.status}`);throw o.status=c.status,o.code=a?.code||null,o.detail=a?.detail||null,o.hostname=a?.hostname||null,o}return a}async function N(e){return n(m(`/api/v1/catalog/?systemId=${encodeURIComponent(e)}`))}async function J(e){return n(m(`/api/v1/products/?systemId=${encodeURIComponent(e)}`))}async function _(){return n(m("/api/v1/products/"))}async function B(e){return e==null?null:n(`/api/v1/themes/${encodeURIComponent(e)}/`)}async function D(){return n("/api/v1/layouts/")}async function L(e){return n("/api/v1/projects/",{method:"POST",body:JSON.stringify(e)})}async function V(e){return n(`/api/v1/projects/by-token/${encodeURIComponent(e)}/`)}async function M(e,t){return n(`/api/v1/projects/${e}/`,{method:"PATCH",body:JSON.stringify(t)})}async function H(e,t,s="design_pdf"){const r=new FormData;return r.append("file",t),r.append("kind",s),n(`/api/v1/projects/${e}/renders/`,{method:"POST",body:r})}async function z(e,t){return n(`/api/v1/projects/${e}/renders/`,{method:"POST",body:JSON.stringify(t)})}async function Q(e){return n(`/api/v1/channels/${e}/config/`)}async function K(e){return n(`/api/v1/channels/${e}/products/`)}async function W(e){return n(`/api/v1/channels/${e}/option-sets/`)}async function X(e){return n(`/api/v1/channels/${e}/projects/`)}const Y={invalidateCache:R,fetchAiImageQuota:A,uploadAiImage:U,fetchCatalog:O,fetchSystems:k,fetchSystem:G,fetchEmbedBoot:q,fetchCatalogForSystem:N,fetchProductsForSystem:J,fetchProducts:_,fetchTheme:B,fetchLayouts:D,saveProject:L,loadProject:V,updateProject:M,uploadProjectRender:z,uploadProjectRenderFile:H,introspectCredential:F,fetchChannelConfig:Q,fetchChannelProducts:K,fetchChannelOptionSets:W,fetchChannelProjects:X};var ue=Y;export{ue as default,ce as fetchAiImageJob,A as fetchAiImageQuota,O as fetchCatalog,N as fetchCatalogForSystem,Q as fetchChannelConfig,W as fetchChannelOptionSets,K as fetchChannelProducts,X as fetchChannelProjects,re as fetchConfiguratorStatus,q as fetchEmbedBoot,D as fetchLayouts,_ as fetchProducts,J as fetchProductsForSystem,G as fetchSystem,k as fetchSystems,B as fetchTheme,ie as generateAiImage,F as introspectCredential,R as invalidateCache,V as loadProject,ae as presignArModel,L as saveProject,M as updateProject,U as uploadAiImage,se as uploadAiReference,z as uploadProjectRender,H as uploadProjectRenderFile};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as i,useRef as l,useState as c}from"react";import{QRCodeSVG as L}from"qrcode.react";import{getModelViewerSrc as y}from"./9544661159.js";import{useLabel as o}from"./28d887bf8a.js";import"./17876f4322.css";function M(){const v=o("ar.title","View in AR"),u=o("ar.subtitle","Scan this QR code with your mobile device"),m=o("ar.hint","Point your phone camera at the code above"),p=o("ar.cta","View in your space"),h=o("ar.instruction","Move your camera around the floor to visualize the model in your space."),f=o("ar.noModel","No AR model URL provided."),s=l(),d=l(),[a,w]=c(null),[b,N]=c(!1),[A,R]=c(!1);return i(()=>{const r=navigator.userAgent;N(/Android|iPhone|iPad|iPod/i.test(r)),R(/iPhone|iPad|iPod/i.test(r))},[]),i(()=>{const r=y();if(document.querySelector("script[data-model-viewer]"))return;const t=document.createElement("script");t.type="module",t.src=r,t.setAttribute("data-model-viewer",""),document.head.appendChild(t)},[]),i(()=>{const t=new URLSearchParams(window.location.search).get("data");if(t)try{w(decodeURIComponent(t))}catch{}},[]),i(()=>{const r=s.current;if(!r||!a)return;const t=()=>{d.current?.click()};return r.addEventListener("load",t),()=>r.removeEventListener("load",t)},[a,A]),a?b?n("div",{className:"arv-wrapper",children:[e("div",{className:"arv-info",children:h}),e("model-viewer",{className:"arv-model-viewer",src:a,ar:!0,"ar-placement":"floor","ar-modes":"webxr quick-look scene-viewer","auto-rotate":!0,"rotation-per-second":"45deg","ar-scale":"auto","shadow-intensity":"1",ref:s,children:e("button",{slot:"ar-button",ref:d,style:{display:"none"}})}),n("button",{className:"arv-view-btn",onClick:()=>s.current?.activateAR(),children:[n("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M12 3l-4 2.18v4.64L12 12l4-2.18V5.18L12 3z"}),e("path",{d:"M4 8.18v4.64L8 15l4-2.18"}),e("path",{d:"M20 8.18v4.64L16 15l-4-2.18"}),e("path",{d:"M12 21l-4-2.18v-4.64"}),e("path",{d:"M12 21l4-2.18v-4.64"})]}),p]})]}):e("div",{className:"arv-center",children:n("div",{className:"arv-qr-card",children:[e("h2",{className:"arv-qr-title",children:v}),e("p",{className:"arv-qr-subtitle",children:u}),e("div",{className:"arv-qr-wrapper",children:e(L,{value:window.location.href,size:200,level:"Q"})}),e("p",{className:"arv-qr-hint",children:m})]})}):e("div",{className:"arv-center",children:e("p",{className:"arv-error",children:f})})}var I=M;export{I as default};
1
+ import{jsx as e,jsxs as p}from"react/jsx-runtime";import{useEffect as l,useRef as w,useState as m}from"react";import{QRCodeSVG as I}from"qrcode.react";import{getModelViewerSrc as V}from"./9544661159.js";import{useLabel as a}from"./28d887bf8a.js";import"./17876f4322.css";function x(){const S=a("ar.title","View in AR"),y=a("ar.subtitle","Scan this QR code with your mobile device"),k=a("ar.hint","Point your phone camera at the code above"),E=a("ar.cta","View in your space"),M=a("ar.instruction","Move your camera around the floor to visualize the model in your space."),g=a("ar.noModel","No AR model URL provided."),d=w(),A=w(),[n,P]=m(null),[f,q]=m(!1),[s,C]=m(!1);l(()=>{const t=navigator.userAgent;q(/Android|iPhone|iPad|iPod/i.test(t)),C(/iPhone|iPad|iPod/i.test(t))},[]),l(()=>{const t=V();if(document.querySelector("script[data-model-viewer]"))return;const r=document.createElement("script");r.type="module",r.src=t,r.setAttribute("data-model-viewer",""),document.head.appendChild(r)},[]),l(()=>{const r=new URLSearchParams(window.location.search).get("data");if(r)try{P(decodeURIComponent(r))}catch{}},[]),l(()=>{const t=d.current;if(!t||!n||!s)return;const r=()=>{A.current?.click()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)},[n,s]);const[b,u]=m(null),v=w("");return l(()=>{const t=d.current;if(!t||!n||s||!f)return;const r=console.error,h=console.warn,R=o=>{const i=o.map(c=>c instanceof Error?`${c.name}: ${c.message}`:typeof c=="string"?c:"").filter(Boolean).join(" ");i&&(v.current=i.slice(0,240))};console.error=(...o)=>{R(o),r.apply(console,o)},console.warn=(...o)=>{/XR|AR|ar-mode/.test(String(o[0]??""))&&R(o),h.apply(console,o)};const N=o=>{const i=o.detail?.status;i==="session-started"&&(v.current="",u(null)),i==="failed"&&u(`AR could not start on this phone.${v.current?` (${v.current})`:""}`)},L=()=>{t.canActivateAR===!1&&u("AR is not available in this browser. Open this link in Chrome on a phone that supports Google Play Services for AR.")};return t.addEventListener("ar-status",N),t.addEventListener("load",L),()=>{t.removeEventListener("ar-status",N),t.removeEventListener("load",L),console.error=r,console.warn=h}},[n,s,f]),n?f?p("div",{className:"arv-wrapper",children:[e("div",{className:"arv-info",children:M}),e("model-viewer",{className:"arv-model-viewer",src:n,ar:!0,"ar-placement":"floor","ar-modes":s?"webxr quick-look scene-viewer":"webxr quick-look","auto-rotate":!0,"rotation-per-second":"45deg","ar-scale":"auto","shadow-intensity":"1",ref:d,children:e("button",{slot:"ar-button",ref:A,style:{display:"none"}})}),b&&e("p",{className:"arv-status",role:"status",children:b}),p("button",{className:"arv-view-btn",onClick:()=>{u(null),d.current?.activateAR()},children:[p("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M12 3l-4 2.18v4.64L12 12l4-2.18V5.18L12 3z"}),e("path",{d:"M4 8.18v4.64L8 15l4-2.18"}),e("path",{d:"M20 8.18v4.64L16 15l-4-2.18"}),e("path",{d:"M12 21l-4-2.18v-4.64"}),e("path",{d:"M12 21l4-2.18v-4.64"})]}),E]})]}):e("div",{className:"arv-center",children:p("div",{className:"arv-qr-card",children:[e("h2",{className:"arv-qr-title",children:S}),e("p",{className:"arv-qr-subtitle",children:y}),e("div",{className:"arv-qr-wrapper",children:e(I,{value:window.location.href,size:200,level:"Q"})}),e("p",{className:"arv-qr-hint",children:k})]})}):e("div",{className:"arv-center",children:e("p",{className:"arv-error",children:g})})}var D=x;export{D as default};
@@ -1 +1 @@
1
- import*as m from"three";const h=2,V=45,e=new m.Box3,g=new m.Vector3,M=new m.Vector3;function b({scene:y,aspect:x,fov:p=h,padding:s=1.3}){if(e.makeEmpty(),y.traverse(r=>{if(!r.isMesh||!r.geometry)return;const o=r.geometry.type;o==="CircleGeometry"||o==="PlaneGeometry"||e.expandByObject(r)}),e.isEmpty())return null;const a=e.getSize(g),t=e.getCenter(M),n=Math.tan(p*Math.PI/360),c=a.z*s/(2*n),f=a.x*s/(2*n*x),u=Math.max(c,f);return{position:[t.x,u,t.z+.01],target:[t.x,0,t.z]}}function w({scene:y,aspect:x=1,fov:p=V,padding:s=1.35,dir:a=[.55,.5,1]}){if(e.makeEmpty(),y.traverse(i=>{if(!i.isMesh||!i.geometry)return;const z=i.geometry.type;z==="CircleGeometry"||z==="PlaneGeometry"||e.expandByObject(i)}),e.isEmpty())return null;const t=e.getSize(g),n=e.getCenter(M),c=Math.tan(p*Math.PI/360),f=t.y*s/(2*c),u=Math.max(t.x,t.z)*s/(2*c*Math.max(x,1e-4)),r=Math.max(f,u,Math.max(t.x,t.y,t.z)*s),o=new m.Vector3(a[0],a[1],a[2]);return o.lengthSq()===0&&o.set(.55,.5,1),o.normalize(),{position:[n.x+o.x*r,n.y+o.y*r,n.z+o.z*r],target:[n.x,n.y,n.z]}}export{h as ORTHO_FOV,V as PERSP_FOV,w as computeFitView,b as computeTopDownView};
1
+ import*as m from"three";const h=2,V=25,e=new m.Box3,g=new m.Vector3,M=new m.Vector3;function b({scene:y,aspect:x,fov:p=h,padding:s=1.3}){if(e.makeEmpty(),y.traverse(r=>{if(!r.isMesh||!r.geometry)return;const o=r.geometry.type;o==="CircleGeometry"||o==="PlaneGeometry"||e.expandByObject(r)}),e.isEmpty())return null;const a=e.getSize(g),t=e.getCenter(M),n=Math.tan(p*Math.PI/360),c=a.z*s/(2*n),f=a.x*s/(2*n*x),u=Math.max(c,f);return{position:[t.x,u,t.z+.01],target:[t.x,0,t.z]}}function w({scene:y,aspect:x=1,fov:p=V,padding:s=1.35,dir:a=[.55,.5,1]}){if(e.makeEmpty(),y.traverse(i=>{if(!i.isMesh||!i.geometry)return;const z=i.geometry.type;z==="CircleGeometry"||z==="PlaneGeometry"||e.expandByObject(i)}),e.isEmpty())return null;const t=e.getSize(g),n=e.getCenter(M),c=Math.tan(p*Math.PI/360),f=t.y*s/(2*c),u=Math.max(t.x,t.z)*s/(2*c*Math.max(x,1e-4)),r=Math.max(f,u,Math.max(t.x,t.y,t.z)*s),o=new m.Vector3(a[0],a[1],a[2]);return o.lengthSq()===0&&o.set(.55,.5,1),o.normalize(),{position:[n.x+o.x*r,n.y+o.y*r,n.z+o.z*r],target:[n.x,n.y,n.z]}}export{h as ORTHO_FOV,V as PERSP_FOV,w as computeFitView,b as computeTopDownView};
@@ -1 +1 @@
1
- import{isHostedProduct as J}from"./061b81ad81.js";import{create as it}from"zustand";import{setSceneAccessFromBackend as rt,setAiChatFromBackend as Q}from"./87f511c4a8.js";import{devtools as st}from"./52436e0169.js";import j from"./79a397bb92.js";import{clearMaterialCache as lt}from"./c44d37da7a.js";import{resolveComponentType as at}from"./061b81ad81.js";import{registerBaselineHiddenLookup as ct}from"./817d930a49.js";import{setWatermarkFromBackend as ut}from"./d3cd7f1bc1.js";let C=null;function dt(m){if(!Array.isArray(m))return[];const d=[];for(const s of m){const c=s?.match||{},g=c.product_id,h=s?.slot||{},r=Array.isArray(g)?g:g!=null?[g]:[null];for(const b of r)d.push({product_id:b!=null?String(b):null,match:c,position:h.offset||h.position||null,rotation:h.rotation||null,component_overrides:h.component_overrides||{},component_transforms:h.component_transforms||{},additionalModels:h.additionalModels||h.additional_models||[]})}return d}function pt(m){const d=Object.keys(m||{})[0];if(!d)return[1,1,1];const s=m[d]?.scale;return Array.isArray(s)&&s.length>=3?s:[1,1,1]}const X=it(st((m,d)=>({products:{},productsByRef:{},components:{},features:{},options:{},materials:{},componentGroups:{},watermarkEnabled:!0,systemUiToggles:{},presets:{},defaultPresetId:null,optionToProducts:{},hostedProducts:{},hostedProductByOptionId:{},isLoading:!1,loadError:null,loadCatalog:async({force:s=!1,systemId:c=null}={})=>{if(!s&&C)return C;const g=d();if(!s&&g.products&&Object.keys(g.products).length>0)return Promise.resolve();s&&(C=null,j.invalidateCache("/api/v1/catalog/"),j.invalidateCache("/api/v1/products/"));const h=c!=null&&String(c)!=="";return C=(async()=>{m({isLoading:!0,loadError:null}),lt();try{const[r,b]=await Promise.all([h?j.fetchCatalogForSystem(c):j.fetchCatalog(),h?j.fetchProductsForSystem(c):j.fetchProducts()]),S={};for(const[n,t]of Object.entries(r.options||{}))S[n]=t&&typeof t=="object"&&t.id==null?{...t,id:n}:t;const Y=new Set(Object.keys(S).map(String)),E=r.presets||{},D={};for(const[n,t]of Object.entries(r.optionSets||{})){let e=[];const p=["options","optionIds","option_ids","availableOptions","optionsList","option_list"];for(const i of p)if(Array.isArray(t[i])&&t[i].length>0){e=t[i];break}if(!e.length)for(const i of Object.values(t)){if(!Array.isArray(i)||i.length===0)continue;const u=i[0],y=typeof u=="object"?u?.id:u;if(y!=null&&Y.has(String(y))){e=i;break}}if(!e.length&&E[n]){const i=E[n];Array.isArray(i)?e=i:Array.isArray(i?.options)&&(e=i.options)}if(e.length||(e=Object.values(S).filter(i=>i?.optionSetId==n||i?.option_set_id==n||i?.optionSet==n||i?.feature_id==n).sort((i,u)=>(i?.sequence||0)-(u?.sequence||0)).map(i=>i.id)),!e.length){const i=t.defaultOption??t.default_option_id;i!=null&&(e=[i])}e=e.map(i=>typeof i=="object"?i.id:i).filter(i=>i!=null),D[n]={...t,options:e,default_option_id:t.defaultOption??t.default_option_id,materials:t.materialTargets||t.materials,contentKind:t.contentKind||t.content_kind||"options",childOptionSetIds:t.childOptionSetIds||t.child_option_set_ids||[],priceMode:t.priceMode||t.price_mode||"per_placement"}}const A={};for(const[n,t]of Object.entries(b||{})){const e={...t};e.componentsConfiguration&&!e.components_configuration&&(e.components_configuration=e.componentsConfiguration),e.optionSets&&!e.features_configuration_ids&&(e.features_configuration_ids=e.optionSets),A[n]=e}for(const[n,t]of Object.entries(A)){if(t.width!=null&&t.width>0||!J(t))continue;let e=t.target_width??t.targetWidth;if(e==null||!(e>0)){const p=Array.isArray(t.hostVariants)?t.hostVariants:Array.isArray(t.host_variants)?t.host_variants:null;if(Array.isArray(p)&&p.length>0){const i=p.find(P=>P?.isDefault??P?.is_default)||p[0],u=i?.hostVariantId??i?.host_variant_id,y=u!=null?A[u]||A[String(u)]:null;y?.width!=null&&y.width>0&&(e=y.width)}}e!=null&&e>0&&(A[n]={...t,width:e})}const I={};for(const[n,t]of Object.entries(A)){const e=t.optionSets||t.features_configuration_ids||[];if(Array.isArray(e))for(const p of e){if(!p||typeof p!="object")continue;const i=p.defaultOption??p.default_option??p.default_option_id;if(i==null)continue;const u=String(i);I[u]||(I[u]=[]);const y=String(n);I[u].includes(y)||I[u].push(y)}}const M={};for(const[n,t]of Object.entries(r.components||{}))M[n]={...t,type:at(t),replace_key:t.replaceKey||t.replace_key,finish_slot:t.finishSlot||t.finish_slot,default_material:t.defaultMaterial||t.default_material};const G={};for(const n of Object.values(S))n?.value!=null&&(G[String(n.value)]=n);const H={},R={};for(const[n,t]of Object.entries(A)){if(!J(t))continue;const e=G[String(n)],p=Array.isArray(t.hostVariants)?t.hostVariants:Array.isArray(t.host_variants)?t.host_variants:null,i=Array.isArray(t.compatibleSlots)?t.compatibleSlots:Array.isArray(t.compatible_slots)?t.compatible_slots:null;let u=[],y=null,P=null;if(Array.isArray(p))for(const o of p){if(!o)continue;const l=o.hostVariantId??o.host_variant_id??null;if(l==null)continue;const _=Array.isArray(o.position)?o.position:null,a=Array.isArray(o.rotation)?o.rotation:null,v=o.isDefault??o.is_default??!1;if(u.push({product_id:String(l),position:_,rotation:a,match:{product_id:[l]},component_overrides:{},component_transforms:{},additionalModels:[],isDefault:v}),v&&y==null){y=l;const f=A[l]||A[String(l)];f?.width!=null&&(P=f.width)}}if(u.length===0&&e?.rules){for(const o of e.rules)if(o.effectType==="load_product"&&o.effectParams?.compatible_slots){u=dt(o.effectParams.compatible_slots);break}}const F=t.componentsConfiguration||t.components_configuration||{},L=Array.isArray(t.components_config)?t.components_config:Array.isArray(t.componentsConfig)?t.componentsConfig:null;let k=null,U=null,z=null;const O=[],Z=o=>{let l=null;Number.isFinite(Number(o.position_x))||Number.isFinite(Number(o.position_y))||Number.isFinite(Number(o.position_z))?l=[Number(o.position_x??0)||0,Number(o.position_y??0)||0,Number(o.position_z??0)||0]:Array.isArray(o.position)&&o.position.length===3&&(l=[...o.position]);let _=null;Number.isFinite(Number(o.rotation_x))||Number.isFinite(Number(o.rotation_y))||Number.isFinite(Number(o.rotation_z))?_=[Number(o.rotation_x??0)||0,Number(o.rotation_y??0)||0,Number(o.rotation_z??0)||0]:Array.isArray(o.rotation)&&o.rotation.length===3&&(_=[...o.rotation]);let a=null;return Array.isArray(o.scale)&&o.scale.length===3?a=[...o.scale]:Number.isFinite(Number(o.scale_x))&&(a=[Number(o.scale_x??1)||1,Number(o.scale_y??1)||1,Number(o.scale_z??1)||1]),{pos:l,rot:_,scl:a}};if(L&&L.length>0)for(const o of L){const l=o?.component,_=l?.modelPath||l?.model_path||l?.modelUrl||l?.model_url;if(!_)continue;const{pos:a,rot:v,scl:f}=Z(o);k?O.push({url:_,position:a||[0,0,0],rotation:v||[0,0,0],scale:f||[1,1,1],materialSlot:l?.materialSlot??l?.material_slot??null}):(k=_,U=a,z=v)}if(!k||O.length===0){const o=Object.keys(F||{});for(let l=0;l<o.length;l++){const _=o[l],a=F[_],v=a?.componentId??a?.component_id??_,f=M[v]||M[String(v)];let N=null;if(f?.variants){const $=a?.variantKey??a?.variant_key;N=$&&f.variants[$]||f.variants.default||Object.values(f.variants)[0]||null}if(!N&&f&&(N=f.modelPath||f.model_path||f.modelUrl||f.model_url||null),!N)continue;const B=a&&Array.isArray(a.position)&&a.position.length===3?[...a.position]:a&&Number.isFinite(Number(a.position_x))?[Number(a.position_x??0)||0,Number(a.position_y??0)||0,Number(a.position_z??0)||0]:null,V=a&&Array.isArray(a.rotation)&&a.rotation.length===3?[...a.rotation]:null;k?O.push({url:N,position:B||[0,0,0],rotation:V||[0,0,0],scale:[1,1,1],materialSlot:f?.materialSlot??f?.material_slot??null}):(k=N,B&&(U=B),V&&(z=V))}}if(O.length>0)for(const o of u)o.additionalModels=[...O];const K=[],q={},W=t.optionSets||[];if(Array.isArray(W))for(const o of W){const l=o?.optionSetId??o?.option_set_id??o?.id;l!=null&&K.push(l);const _=o?.defaultOption??o?.default_option??o?.default_option_id;l!=null&&_!=null&&(q[l]=_)}const tt=t.target_all_base??!1,ot=t.target_all_tall??!1,et=t.target_all_upper??!1,nt={id:n,optionId:e?.id??null,name:t.name,description:t.description||"",thumbnail:e?.thumbnail??e?.thumbnailUrl??e?.thumbnail_url??e?.imageUrl??e?.image_url??t.thumbnail??t.thumbnailUrl??t.thumbnail_url??t.thumbnailPath??t.thumbnail_path??t.imageUrl??t.image_url??t.icon??null,icon:t.icon||null,placement_type:t.placementType||t.placement_type||"replace_components",placementGroup:t.placementGroup||t.placement_group||null,movable:t.movable??!0,scale:pt(F),modelUrl:k,componentModelOffset:U||null,componentModelRotation:z||null,features:K,feature_defaults:q,slots:u,replaceable_by:t.replaceable_by??[],target_all_base:tt,target_all_tall:ot,target_all_upper:et,target_product_id:t.target_product_id??y??null,target_tall_product_id:t.target_tall_product_id??null,target_width:t.target_width??P??t.width??null,target_tall_width:t.target_tall_width??null,auto_target_product_id:t.auto_target_product_id??y??null,auto_target_width:t.auto_target_width??P??t.width??null,compatibleSlots:i||[],hostVariants:p||[],exclude_occupied_appliances:t.exclude_occupied_appliances??[],exclude_product_ids:t.exclude_product_ids??[],host_display_overrides:t.host_display_overrides??t.hostDisplayOverrides??null,additionalModels:O.length>0?O:t.additionalModels??t.additional_models??[]};H[String(n)]=nt,e?.id!=null&&(R[String(e.id)]=String(n))}const x={},w=(n,t)=>{if(n==null||n==="")return;const e=String(n).toLowerCase();x[e]||(x[e]=t)};for(const[n,t]of Object.entries(A))if(w(n,n),t?.id!=null&&w(t.id,n),t?.slug!=null&&w(t.slug,n),t?.name!=null&&w(t.name,n),t?.product_id!=null&&w(t.product_id,n),t?.name){const e="product_"+String(t.name).toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"");w(e,n)}const T=r.watermarkEnabled??r.watermark_enabled;if(T!=null)try{ut(T)}catch{}m({products:A,productsByRef:x,components:M,features:D,options:S,materials:r.materials||{},componentGroups:r.componentGroups||{},watermarkEnabled:(r.watermarkEnabled??r.watermark_enabled)!==!1,systemUiToggles:r.system?.uiToggles??r.system?.ui_toggles??{},presets:r.presets||{},defaultPresetId:r.defaultPreset??r.default_preset??null,optionToProducts:I,hostedProducts:H,hostedProductByOptionId:R,isLoading:!1}),rt(r.exposeThreejsScene??r.expose_threejs_scene),Q(r.system?.uiToggles??r.system?.ui_toggles)}catch(r){throw m({loadError:r.message,isLoading:!1}),C=null,r}})(),C},getProduct:s=>d().products[s],getComponent:s=>d().components[s],getMaterial:s=>d().materials[s],mergeSystemUiToggles:s=>{!s||typeof s!="object"||(Q(s),m(c=>({systemUiToggles:{...c.systemUiToggles||{},...s}})))},getHostedProductsList:()=>Object.values(d().hostedProducts||{}),getHostedProduct:s=>{if(s==null)return null;const c=String(s),g=d().hostedProducts||{};if(g[c])return g[c];const r=(d().hostedProductByOptionId||{})[c];if(r&&g[r])return g[r];const b=c.toLowerCase();return Object.values(g).find(S=>String(S.name||"").toLowerCase()===b||String(S.slug||"").toLowerCase()===b)||null},getFeatureOptions:s=>{const c=d().features[s];if(!c||!c.options)return[];const h=c.options.map(r=>typeof r=="string"?r:r.id).map(r=>d().options[r]).filter(Boolean);if(c.options.length>0&&typeof c.options[0]=="object"){const r={};c.options.forEach(b=>{r[b.id]=b.sequence||0}),h.sort((b,S)=>(r[b.id]||0)-(r[S.id]||0))}return h}}),{name:"object-graph"}));try{ct(m=>{if(m==null)return null;const d=X.getState().features||{},s=d[String(m)]??d[m];return s?.defaultHiddenOptions??s?.default_hidden_options??null})}catch{}var vt=X;export{vt as default};
1
+ import{isHostedProduct as Q}from"./061b81ad81.js";import{create as st}from"zustand";import{setSceneAccessFromBackend as lt,setAiChatFromBackend as X}from"./87f511c4a8.js";import{devtools as at}from"./52436e0169.js";import N from"./79a397bb92.js";import{clearMaterialCache as ct}from"./c44d37da7a.js";import{resolveComponentType as ut}from"./061b81ad81.js";import{registerBaselineHiddenLookup as dt}from"./817d930a49.js";import{setWatermarkFromBackend as pt}from"./d3cd7f1bc1.js";let C=null;function ft(h){if(!Array.isArray(h))return[];const d=[];for(const r of h){const c=r?.match||{},b=c.product_id,f=r?.slot||{},p=Array.isArray(b)?b:b!=null?[b]:[null];for(const A of p)d.push({product_id:A!=null?String(A):null,match:c,position:f.offset||f.position||null,rotation:f.rotation||null,component_overrides:f.component_overrides||{},component_transforms:f.component_transforms||{},additionalModels:f.additionalModels||f.additional_models||[]})}return d}function _t(h){const d=Object.keys(h||{})[0];if(!d)return[1,1,1];const r=h[d]?.scale;return Array.isArray(r)&&r.length>=3?r:[1,1,1]}const Y=st(at((h,d)=>({products:{},productsByRef:{},components:{},features:{},options:{},materials:{},componentGroups:{},watermarkEnabled:!0,systemUiToggles:{},presets:{},defaultPresetId:null,optionToProducts:{},hostedProducts:{},hostedProductByOptionId:{},isLoading:!1,loadError:null,loadCatalog:async({force:r=!1,systemId:c=null,skipProducts:b=!1}={})=>{if(!r&&C)return C;const f=d(),p=f.products&&Object.keys(f.products).length>0||f.options&&Object.keys(f.options).length>0;if(!r&&p)return Promise.resolve();r&&(C=null,N.invalidateCache("/api/v1/catalog/"),N.invalidateCache("/api/v1/products/"));const A=c!=null&&String(c)!=="";return C=(async()=>{h({isLoading:!0,loadError:null}),ct();try{const[s,Z]=await Promise.all([A?N.fetchCatalogForSystem(c):N.fetchCatalog(),b?Promise.resolve({}):A?N.fetchProductsForSystem(c):N.fetchProducts()]),I={};for(const[n,t]of Object.entries(s.options||{}))I[n]=t&&typeof t=="object"&&t.id==null?{...t,id:n}:t;const tt=new Set(Object.keys(I).map(String)),D=s.presets||{},G={};for(const[n,t]of Object.entries(s.optionSets||{})){let e=[];const _=["options","optionIds","option_ids","availableOptions","optionsList","option_list"];for(const i of _)if(Array.isArray(t[i])&&t[i].length>0){e=t[i];break}if(!e.length)for(const i of Object.values(t)){if(!Array.isArray(i)||i.length===0)continue;const u=i[0],y=typeof u=="object"?u?.id:u;if(y!=null&&tt.has(String(y))){e=i;break}}if(!e.length&&D[n]){const i=D[n];Array.isArray(i)?e=i:Array.isArray(i?.options)&&(e=i.options)}if(e.length||(e=Object.values(I).filter(i=>i?.optionSetId==n||i?.option_set_id==n||i?.optionSet==n||i?.feature_id==n).sort((i,u)=>(i?.sequence||0)-(u?.sequence||0)).map(i=>i.id)),!e.length){const i=t.defaultOption??t.default_option_id;i!=null&&(e=[i])}e=e.map(i=>typeof i=="object"?i.id:i).filter(i=>i!=null),G[n]={...t,options:e,default_option_id:t.defaultOption??t.default_option_id,materials:t.materialTargets||t.materials,contentKind:t.contentKind||t.content_kind||"options",childOptionSetIds:t.childOptionSetIds||t.child_option_set_ids||[],priceMode:t.priceMode||t.price_mode||"per_placement"}}const S={};for(const[n,t]of Object.entries(Z||{})){const e={...t};e.componentsConfiguration&&!e.components_configuration&&(e.components_configuration=e.componentsConfiguration),e.optionSets&&!e.features_configuration_ids&&(e.features_configuration_ids=e.optionSets),S[n]=e}for(const[n,t]of Object.entries(S)){if(t.width!=null&&t.width>0||!Q(t))continue;let e=t.target_width??t.targetWidth;if(e==null||!(e>0)){const _=Array.isArray(t.hostVariants)?t.hostVariants:Array.isArray(t.host_variants)?t.host_variants:null;if(Array.isArray(_)&&_.length>0){const i=_.find(P=>P?.isDefault??P?.is_default)||_[0],u=i?.hostVariantId??i?.host_variant_id,y=u!=null?S[u]||S[String(u)]:null;y?.width!=null&&y.width>0&&(e=y.width)}}e!=null&&e>0&&(S[n]={...t,width:e})}const M={};for(const[n,t]of Object.entries(S)){const e=t.optionSets||t.features_configuration_ids||[];if(Array.isArray(e))for(const _ of e){if(!_||typeof _!="object")continue;const i=_.defaultOption??_.default_option??_.default_option_id;if(i==null)continue;const u=String(i);M[u]||(M[u]=[]);const y=String(n);M[u].includes(y)||M[u].push(y)}}const x={};for(const[n,t]of Object.entries(s.components||{}))x[n]={...t,type:ut(t),replace_key:t.replaceKey||t.replace_key,finish_slot:t.finishSlot||t.finish_slot,default_material:t.defaultMaterial||t.default_material};const H={};for(const n of Object.values(I))n?.value!=null&&(H[String(n.value)]=n);const R={},K={};for(const[n,t]of Object.entries(S)){if(!Q(t))continue;const e=H[String(n)],_=Array.isArray(t.hostVariants)?t.hostVariants:Array.isArray(t.host_variants)?t.host_variants:null,i=Array.isArray(t.compatibleSlots)?t.compatibleSlots:Array.isArray(t.compatible_slots)?t.compatible_slots:null;let u=[],y=null,P=null;if(Array.isArray(_))for(const o of _){if(!o)continue;const l=o.hostVariantId??o.host_variant_id??null;if(l==null)continue;const g=Array.isArray(o.position)?o.position:null,a=Array.isArray(o.rotation)?o.rotation:null,v=o.isDefault??o.is_default??!1;if(u.push({product_id:String(l),position:g,rotation:a,match:{product_id:[l]},component_overrides:{},component_transforms:{},additionalModels:[],isDefault:v}),v&&y==null){y=l;const m=S[l]||S[String(l)];m?.width!=null&&(P=m.width)}}if(u.length===0&&e?.rules){for(const o of e.rules)if(o.effectType==="load_product"&&o.effectParams?.compatible_slots){u=ft(o.effectParams.compatible_slots);break}}const L=t.componentsConfiguration||t.components_configuration||{},U=Array.isArray(t.components_config)?t.components_config:Array.isArray(t.componentsConfig)?t.componentsConfig:null;let k=null,z=null,B=null;const O=[],ot=o=>{let l=null;Number.isFinite(Number(o.position_x))||Number.isFinite(Number(o.position_y))||Number.isFinite(Number(o.position_z))?l=[Number(o.position_x??0)||0,Number(o.position_y??0)||0,Number(o.position_z??0)||0]:Array.isArray(o.position)&&o.position.length===3&&(l=[...o.position]);let g=null;Number.isFinite(Number(o.rotation_x))||Number.isFinite(Number(o.rotation_y))||Number.isFinite(Number(o.rotation_z))?g=[Number(o.rotation_x??0)||0,Number(o.rotation_y??0)||0,Number(o.rotation_z??0)||0]:Array.isArray(o.rotation)&&o.rotation.length===3&&(g=[...o.rotation]);let a=null;return Array.isArray(o.scale)&&o.scale.length===3?a=[...o.scale]:Number.isFinite(Number(o.scale_x))&&(a=[Number(o.scale_x??1)||1,Number(o.scale_y??1)||1,Number(o.scale_z??1)||1]),{pos:l,rot:g,scl:a}};if(U&&U.length>0)for(const o of U){const l=o?.component,g=l?.modelPath||l?.model_path||l?.modelUrl||l?.model_url;if(!g)continue;const{pos:a,rot:v,scl:m}=ot(o);k?O.push({url:g,position:a||[0,0,0],rotation:v||[0,0,0],scale:m||[1,1,1],materialSlot:l?.materialSlot??l?.material_slot??null}):(k=g,z=a,B=v)}if(!k||O.length===0){const o=Object.keys(L||{});for(let l=0;l<o.length;l++){const g=o[l],a=L[g],v=a?.componentId??a?.component_id??g,m=x[v]||x[String(v)];let j=null;if(m?.variants){const J=a?.variantKey??a?.variant_key;j=J&&m.variants[J]||m.variants.default||Object.values(m.variants)[0]||null}if(!j&&m&&(j=m.modelPath||m.model_path||m.modelUrl||m.model_url||null),!j)continue;const V=a&&Array.isArray(a.position)&&a.position.length===3?[...a.position]:a&&Number.isFinite(Number(a.position_x))?[Number(a.position_x??0)||0,Number(a.position_y??0)||0,Number(a.position_z??0)||0]:null,E=a&&Array.isArray(a.rotation)&&a.rotation.length===3?[...a.rotation]:null;k?O.push({url:j,position:V||[0,0,0],rotation:E||[0,0,0],scale:[1,1,1],materialSlot:m?.materialSlot??m?.material_slot??null}):(k=j,V&&(z=V),E&&(B=E))}}if(O.length>0)for(const o of u)o.additionalModels=[...O];const q=[],W={},$=t.optionSets||[];if(Array.isArray($))for(const o of $){const l=o?.optionSetId??o?.option_set_id??o?.id;l!=null&&q.push(l);const g=o?.defaultOption??o?.default_option??o?.default_option_id;l!=null&&g!=null&&(W[l]=g)}const et=t.target_all_base??!1,nt=t.target_all_tall??!1,it=t.target_all_upper??!1,rt={id:n,optionId:e?.id??null,name:t.name,description:t.description||"",thumbnail:e?.thumbnail??e?.thumbnailUrl??e?.thumbnail_url??e?.imageUrl??e?.image_url??t.thumbnail??t.thumbnailUrl??t.thumbnail_url??t.thumbnailPath??t.thumbnail_path??t.imageUrl??t.image_url??t.icon??null,icon:t.icon||null,placement_type:t.placementType||t.placement_type||"replace_components",placementGroup:t.placementGroup||t.placement_group||null,movable:t.movable??!0,scale:_t(L),modelUrl:k,componentModelOffset:z||null,componentModelRotation:B||null,features:q,feature_defaults:W,slots:u,replaceable_by:t.replaceable_by??[],target_all_base:et,target_all_tall:nt,target_all_upper:it,target_product_id:t.target_product_id??y??null,target_tall_product_id:t.target_tall_product_id??null,target_width:t.target_width??P??t.width??null,target_tall_width:t.target_tall_width??null,auto_target_product_id:t.auto_target_product_id??y??null,auto_target_width:t.auto_target_width??P??t.width??null,compatibleSlots:i||[],hostVariants:_||[],exclude_occupied_appliances:t.exclude_occupied_appliances??[],exclude_product_ids:t.exclude_product_ids??[],host_display_overrides:t.host_display_overrides??t.hostDisplayOverrides??null,additionalModels:O.length>0?O:t.additionalModels??t.additional_models??[]};R[String(n)]=rt,e?.id!=null&&(K[String(e.id)]=String(n))}const T={},w=(n,t)=>{if(n==null||n==="")return;const e=String(n).toLowerCase();T[e]||(T[e]=t)};for(const[n,t]of Object.entries(S))if(w(n,n),t?.id!=null&&w(t.id,n),t?.slug!=null&&w(t.slug,n),t?.name!=null&&w(t.name,n),t?.product_id!=null&&w(t.product_id,n),t?.name){const e="product_"+String(t.name).toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"");w(e,n)}const F=s.watermarkEnabled??s.watermark_enabled;if(F!=null)try{pt(F)}catch{}h({products:S,productsByRef:T,components:x,features:G,options:I,materials:s.materials||{},componentGroups:s.componentGroups||{},watermarkEnabled:(s.watermarkEnabled??s.watermark_enabled)!==!1,systemUiToggles:s.system?.uiToggles??s.system?.ui_toggles??{},presets:s.presets||{},defaultPresetId:s.defaultPreset??s.default_preset??null,optionToProducts:M,hostedProducts:R,hostedProductByOptionId:K,isLoading:!1}),lt(s.exposeThreejsScene??s.expose_threejs_scene),X(s.system?.uiToggles??s.system?.ui_toggles)}catch(s){throw h({loadError:s.message,isLoading:!1}),C=null,s}})(),C},getProduct:r=>d().products[r],getComponent:r=>d().components[r],getMaterial:r=>d().materials[r],mergeSystemUiToggles:r=>{!r||typeof r!="object"||(X(r),h(c=>({systemUiToggles:{...c.systemUiToggles||{},...r}})))},getHostedProductsList:()=>Object.values(d().hostedProducts||{}),getHostedProduct:r=>{if(r==null)return null;const c=String(r),b=d().hostedProducts||{};if(b[c])return b[c];const p=(d().hostedProductByOptionId||{})[c];if(p&&b[p])return b[p];const A=c.toLowerCase();return Object.values(b).find(s=>String(s.name||"").toLowerCase()===A||String(s.slug||"").toLowerCase()===A)||null},getFeatureOptions:r=>{const c=d().features[r];if(!c||!c.options)return[];const f=c.options.map(p=>typeof p=="string"?p:p.id).map(p=>d().options[p]).filter(Boolean);if(c.options.length>0&&typeof c.options[0]=="object"){const p={};c.options.forEach(A=>{p[A.id]=A.sequence||0}),f.sort((A,s)=>(p[A.id]||0)-(p[s.id]||0))}return f}}),{name:"object-graph"}));try{dt(h=>{if(h==null)return null;const d=Y.getState().features||{},r=d[String(h)]??d[h];return r?.defaultHiddenOptions??r?.default_hidden_options??null})}catch{}var wt=Y;export{wt as default};
@@ -1 +1 @@
1
- import{Fragment as de,jsx as h,jsxs as lt}from"react/jsx-runtime";import{useCallback as J,useEffect as N,useMemo as H,useRef as Pt,useState as xt,useSyncExternalStore as We}from"react";import{Html as yn,useProgress as vn}from"@react-three/drei";import T from"./9c6c598569.js";import W from"./872c4302e0.js";import z from"./be337ddda5.js";import gt from"./d94df858ea.js";import{normalizeMaterialTargets as Mn}from"./dc2a1a0e13.js";import y from"./8f60e5059a.js";import Pn from"./60d697292c.js";import xn from"./811b403d43.js";import{useUiToggles as wn}from"./d0f9681634.js";import{ProductInstance as ce,SelectionActionPanel as Cn,FreeMovable as Tn,PlacementGaps as _n,SceneStage as Fn,SceneRoom as Gn,SceneProductsSource as On}from"./8a3a57c008.js";import An from"./205827c5c8.js";import{computeTargets as Dn,resolveTarget as Ln,resolveTargetRenderer as kn,resolveInsertSequence as Rn}from"./58e6419ba8.js";import{disarmPlacement as Ye}from"./ab6c80484f.js";import{applyMeasurement as zn}from"./9ce3c3df25.js";import{isCompatibleSlot as $e}from"./99577e3161.js";import{resolveComponent as ie,useComponentRegistry as Ke}from"./882bc739c8.js";import En from"./88251d6671.js";import{useLabels as qn}from"./28d887bf8a.js";import{SlotHost as Nn}from"./73f7d65985.js";import{ModalHost as Xn}from"./09c4973968.js";import Zn from"./6c0a2572dd.js";import Hn from"./20b0104576.js";import{getConfigState as Vn,subscribe as Qe,getVersion as Et}from"./817d930a49.js";import{getPlacementStrategy as Je}from"./281cf952fa.js";import{resolveAddMode as jn,armPlacement as Un}from"./ab6c80484f.js";import{resolveReplaceTarget as Bn}from"./4d7a0d1897.js";import{enforceCorners as Wn}from"./388cadacbd.js";import{resolvePlacementStrategyConfig as tn}from"./281cf952fa.js";import{getLabel as Yn}from"./28d887bf8a.js";import{isAddFeature as $n}from"./8c27edda0f.js";import{usePlacementInteraction as Kn}from"./4b8958aa4c.js";import{refreshCanonicalState as Qn,seedInitialState as Jn,addProduct as qt}from"./a77b15c0d6.js";import{resolveLayout as to,hasLayout as eo,useLayoutRegistry as no,layoutOverride as oo,_publishResolvedLayoutKey as so}from"./31ea036f5c.js";import{themeLayoutKey as ro,useSystemTheme as ao}from"./5c9fd9201c.js";import"./1a2629800a.css";import{runIntent as Nt,INTENTS as Xt}from"./6d238282c1.js";function co(){const _=gt(a=>a.sceneSelections),I=gt(a=>a.selectionOrder),f=T(a=>a.activeSceneConfigId),u=z(a=>a.defaultPresetId),p=z(a=>a.sceneConfigurations),D=z(a=>a.getSceneFeatures),S=We(Qe,Et,Et);return H(()=>{const a=f||u||Object.keys(p||{})[0],tt=a?D(a):[],V=W.getState(),v=[],et=new Set,ut=(i,L)=>{if(!i||i.id==null||et.has(String(i.id))||L>4)return;et.add(String(i.id)),v.push(i);const w=(V.features?.[i.id]||V.features?.[String(i.id)])?.childOptionSetIds||[];for(const P of w){const d=V.features?.[P]||V.features?.[String(P)];d&&ut({id:P,type:d.type,sequence:d.sequence},L+1)}};for(const i of tt)ut(i,0);const It=v.filter(i=>/finish/i.test(i.type||"")&&_[i.id]!=null).sort((i,L)=>{const X=I?.[String(i.id)]??-1,w=I?.[String(L.id)]??-1;return X!==w?X-w:(i.sequence??0)-(L.sequence??0)}),M={};for(const i of It){const L=_[i.id],X=V.options?.[L]?.value;if(X==null)continue;const w=V.features?.[i.id]||{},P=Mn(w.materialTargets??w.material_targets??w.materials);for(const d of P)M[String(d).toLowerCase()]=X}return M},[_,I,f,u,p,D,S])}function io(_,I){if(I==null)return null;const f=String(I);for(const u of Object.values(_.products||{})){const p=u?.components_configuration||u?.componentsConfiguration;if(!(!p||typeof p!="object"))for(const D of Object.values(p))for(const S of Array.isArray(D)?D:[D]){const a=S&&typeof S=="object"?S.componentId??S.component_id:S;if(a!=null&&String(a)===f)return u}}return null}function lo(_){const I=gt(v=>v.sceneSelections),f=gt(v=>v.setSceneSelection),u=z(v=>v.getSceneFeatures),p=z(v=>v.sceneConfigurations),D=We(Qe,Et,Et),S=H(()=>new Set((_?u(_)||[]:[]).filter(v=>$n(v)).map(v=>String(v.id))),[_,u,p,D]),a=Pt({}),tt=Pt(!1),V=gt(v=>v.sceneSelectionsSettled);N(()=>{if(!V){a.current={...I};return}if(!tt.current){tt.current=!0;let M=!1;for(const[i,L]of Object.entries(I||{}))L==null||!S.has(String(i))||(f(i,null),M=!0);if(M){a.current={...I};return}}const v=a.current,et=[];for(const[M,i]of Object.entries(I||{}))v[M]===i||i==null||S.has(String(M))&&et.push([M,i]);if(a.current={...I},!et.length)return;const ut=z.getState().systemId;let It=!1;return(async()=>{const M=W.getState(),i=T.getState();for(const[L,X]of et){const w=M.options?.[X];let P=w?.valueProductVariantId??w?.value_product_variant_id??w?.value_product_variant??w?.variantId??w?.variant_id??null,d=P!=null?M.getProduct?.(P):null;if(d==null){const g=w?.value??(M.optionToProducts?.[String(X)]||[])[0]??w?.product_id??w?.productId??null;d=g!=null?M.getProduct?.(g):null,d==null&&g!=null&&M.getComponent?.(g)&&(d=io(M,g)),P=d?.id??P??g}else P=d?.id??P;if(P==null){f(L,null);continue}const wt=d?.id??P,Ct=d?.placementGroup??d?.placement_group??null,Zt=d?.productGraph??d?.product_graph??null,St=d?.compatibleSlots??d?.compatible_slots??null;if(Array.isArray(St)&&St.length){const g=new Set(St.map(String));if(Object.values(i.productInstances||{}).some(ht=>{const le=M.getProduct?.(ht.variantId)||M.getProduct?.(ht.productId);return $e(d,le,M.products)})){y.getState().setPendingSlotPlacement?.({productId:wt,variantId:P,name:d?.name??d?.displayName??d?.variantName??"product",compatibleGraphIds:Array.from(g)}),f(L,null);continue}}if(jn(ut,d)==="arm"){Un({productId:wt,variantId:P});const g=Je(),Tt=typeof g?.computeTargets=="function",ht=Object.prototype.hasOwnProperty.call(g??{},"armHint")?g.armHint:Yn(Tt?"placement.armedPickTarget":"placement.armedPickGap",Tt?"":"Click a + between pieces to insert it.");ht&&y.getState().showInfo?.(ht),f(L,null);continue}const bt=T.getState(),pt=bt.selectedInstanceId,j=pt!=null?(bt.productInstances||{})[pt]:null,nt=j&&Number.isFinite(Number(j.sequence))?Number(j.sequence):void 0,mt=Bn({placementGroup:Ct}),R=mt!=null?(bt.productInstances||{})[mt]:null,Ht=R&&Number.isFinite(Number(R.sequence))?Number(R.sequence):nt,ct=Array.isArray(R?.position)?R.position:[0,0,0];let Vt=null;try{Vt=await Nt({type:Xt.PRODUCT_ADD,productGraphId:Zt,variantId:P,placementGroup:Ct,sequence:Ht,replacePlacementId:mt??void 0},g=>qt({productGraphId:g.productGraphId,variantId:g.variantId,placementGroup:g.placementGroup,position:ct,sequence:g.sequence,replace:g.replacePlacementId!=null,replacePlacementId:g.replacePlacementId}))}catch{}if(f(L,null),It)return}})(),()=>{It=!0}},[I,S,_,f])}function uo({position:_,onClick:I}){const[f,u]=xt(!1);return h(yn,{position:_,center:!0,style:{pointerEvents:"auto"},zIndexRange:[100,0],children:h("div",{onClick:I,onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),style:{width:22,height:22,borderRadius:"50%",background:f?"#ff8a65":"rgba(255, 87, 34, 0.85)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontSize:13,fontWeight:"bold",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",cursor:"pointer",transition:"transform 0.2s",transform:f?"scale(1.15)":"scale(1)"},children:"+"})})}function po({isMobile:_}={}){Ke();const I=ie("SelectionActionPanel",Cn),f=T(t=>t.productInstances),u=W(t=>t.getProduct),p=W(t=>t.componentGroups),D=T(t=>t.clearSelection),S=T(t=>t.selectedInstanceId),a=T(t=>t.isFocusing),tt=y(t=>t.bootLoading),V=y(t=>t.bootDetail),v=y(t=>t.bootProgress);Ke();const et=ie("LoadingScreen",En),ut=qn();N(()=>{if(typeof document>"u")return;const t=document.documentElement;return tt?t.setAttribute("data-scene-booting",""):t.removeAttribute("data-scene-booting"),()=>t.removeAttribute("data-scene-booting")},[tt]),N(()=>{y.getState().markUiReady?.()},[]);const It=T(t=>t.removeProductInstance),M=T(t=>t.addProductInstance),i=T(t=>t.updateInstancePosition),L=T(t=>t.updateInstanceRotation),X=T(t=>t.activeSceneConfigId),w=z(t=>t.defaultPresetId),P=z(t=>t.sceneConfigurations),d=z(t=>t.systemId),wt=z(t=>t.useTransform),Ct=y(t=>t.sceneCapabilities),Zt=y(t=>t.showWalls),St=y(t=>t.showDimensions),bt=y(t=>t.pendingSlotPlacement),pt=co(),j=y(t=>t.hostMaterialOverrides),nt=(Vn()||{}).room||null,mt=X||w||Object.keys(P||{})[0]||null;lo(mt);const[R,Ht]=xt(!0),[ct,Vt]=xt(!1),g=J(async()=>{try{await Jn()}catch{}Vt(!0)},[]),{edgeOf:Tt,cornerOf:ht,isHostAnchored:le,isMovable:ue,rawFree:ho,splitReliable:fo,freeInstances:_t,ordered:C,syntheticHosts:pe,moveInFlightRef:go}=Pn(),Ft=H(()=>new Map(pe.map(t=>[t.hostedProductId,t])),[pe]),[ot,nn]=xt({}),jt=J((t,n,e=null,o=e)=>{nn(r=>zn(r,t,n,e,o))},[]),st=J((t,n)=>{const e=n?.id!=null?ot[`inst:${n.id}`]:null;return e&&String(e.forProductId)===String(t)?e:ot[t]||null},[ot]),me=W(t=>t.placementBoundsExcludeIds),he=H(()=>new Set((me||[]).map(t=>String(t))),[me]),Ut=J((t,n)=>{const e=t?.componentId??n?.id??n?.componentId??null;if(e!=null&&he.has(String(e)))return!0},[p,he]),Y=Pt(!1),Gt=Pt(!1),k=C.length+_t.length,Bt=H(()=>[...C,..._t],[C,_t]),it=k>0&&Bt.every(t=>ot[t.productId]),Ot=H(()=>Bt.filter(t=>ot[t.productId]).length,[Bt,ot]),{active:Wt,loaded:fe,total:Yt}=vn(),ge=y(t=>t.isEvaluating),At=y(t=>t.isLayoutLoading),Ie=y(t=>t.bootEvaluating),Se=Pt({pieceCount:0,allMeasured:!1});Se.current={pieceCount:k,allMeasured:it};const Dt=J(()=>{const{pieceCount:t,allMeasured:n}=Se.current;t>0&&!Y.current&&!Gt.current&&(T.getState().resetCameraToDefault?.({instant:!0}),Y.current=n,Gt.current=!n)},[]);N(()=>y.subscribe((t,n)=>{n?.bootLoading&&!t.bootLoading&&Dt()}),[Dt]),N(()=>{if(!ct)return;const t=!Wt&&(Yt===0||fe>=Yt),n=(it||k===0)&&t&&!ge&&!Ie,e=()=>{Dt(),Ht(!1),y.getState().endBootLoading()};if(n){let r=null;const c=setTimeout(()=>{k>0&&!Y.current&&(T.getState().resetCameraToDefault?.({instant:!0}),Y.current=!0),r=setTimeout(e,120)},780);return()=>{clearTimeout(c),r&&clearTimeout(r)}}const o=setTimeout(e,Wt?12e4:15e3);return()=>clearTimeout(o)},[ct,it,k,Ot,Wt,fe,Yt,ge,Ie,Dt]);const[be,ye]=xt(!1);N(()=>{if(!R){ye(!1);return}(it&&k>0||ct&&k===0)&&ye(!0)},[it,k,ct,R]);const ve=ct?be||k===0?"Finishing up\u2026":`Loading products\u2026 ${Math.min(Ot,k)}/${k}`:"Preparing your configurator\u2026",Me=be?100:k>0?Math.min(Math.round(Ot/k*100),92):0;N(()=>{R&&y.getState().setBootPhase(ve,Me)},[R,ve,Me]),N(()=>(y.setState({initialSceneLoading:R}),()=>y.setState({initialSceneLoading:!1})),[R]),N(()=>{At&&(Y.current=!1)},[At]),N(()=>{if(k===0){Y.current=!1;return}if(Y.current||R||At||!it)return;const t=setTimeout(()=>{Y.current||(T.getState().resetCameraToDefault?.({instant:!Gt.current}),Gt.current=!1,Y.current=!0)},250);return()=>clearTimeout(t)},[k,Ot,R,At,it]);const yt=Je(),ft=H(()=>C.map(t=>{const n=Ft.get(t.id);return n?{...t,productId:n.hostVariantId}:t}),[C,Ft]),Pe=wt||!!P?.[mt]?.useTransform,Z=T(t=>t.pendingPlacementPiece),xe=!!Z&&typeof yt?.computeTargets=="function"&&!!kn(),dt=H(()=>{const t={getProduct:u,getDims:st,useTransform:Pe,candidate:Z,openSlots:xe,config:tn()},n=yt.computeLayout?yt.computeLayout(ft,t):ft.map(()=>({position:[0,0,0],rotation:[0,0,0]})),e=Wn(n,ft,t,yt);try{import.meta.env?.DEV&&typeof window<"u"&&(window.__layoutDebug={at:Date.now(),dims:ot,items:ft.map(o=>({id:o.id,variantId:o.variantId,productId:o.productId,placementGroup:o.placementGroup,sequence:o.sequence,positionedAbove:o.positionedAbove??null,hostVariantId:o.hostVariantId??null,position:o.position,rotation:o.rotation,corner:!!o.corner})),layout:e})}catch{}return e},[yt,ft,u,st,Pe,Z,xe,ot]),U=H(()=>{const n=nt?.height>0?nt.height:2.7,e=.1,o=.05,r=new Map;let c=1/0,m=-1/0,b=1/0,l=-1/0,E=0,A=!1;if(C.forEach((s,B)=>{const F=dt[B];if(!F||ue(s))return;const x=F.position||[0,0,0],G=st(s.productId,s),Q=u(s.productId),q=G?.full||G,oe=q?.height>0?q.height:Q?.height>0?Q.height*.0254:0,Rt=(x[1]||0)+oe;if(Rt>E&&(E=Rt),(s.positionedAbove??s.positioned_above)!=null)return;const se=(x[1]||0)<=.01,zt=-((Array.isArray(F.rotation)?F.rotation[1]:0)||0),re=G?.depth>0?G.depth:Q?.depth>0?Q.depth*.0254:.6,ae=G?.width>0?G.width:Q?.width>0?Q.width*.0254:.9,rt=Math.cos(zt),at=Math.sin(zt),Oe=G?.cx||0,Ae=G?.cz||0,De=x[0]+rt*Oe-at*Ae,Le=x[2]+at*Oe+rt*Ae,ke=(ae*Math.abs(rt)+re*Math.abs(at))/2,Re=(ae*Math.abs(at)+re*Math.abs(rt))/2,ze=De-ke,Ee=De+ke,qe=Le-Re,Ne=Le+Re,Xe=q?.width>0?q.width:ae,Ze=q?.depth>0?q.depth:re,He=x[0]+rt*(q?.cx||0)-at*(q?.cz||0),Ve=x[2]+at*(q?.cx||0)+rt*(q?.cz||0),je=(Xe*Math.abs(rt)+Ze*Math.abs(at))/2,Ue=(Xe*Math.abs(at)+Ze*Math.abs(rt))/2,gn=He-je,In=He+je,Sn=Ve-Ue,bn=Ve+Ue,Be=String((Math.round(zt/(Math.PI/2))%4+4)%4),O=r.get(Be)||{heading:zt,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,fMinX:1/0,fMaxX:-1/0,fMinZ:1/0,fMaxZ:-1/0,hasFloor:!1};O.minX=Math.min(O.minX,ze),O.maxX=Math.max(O.maxX,Ee),O.minZ=Math.min(O.minZ,qe),O.maxZ=Math.max(O.maxZ,Ne),se&&(O.fMinX=Math.min(O.fMinX,ze),O.fMaxX=Math.max(O.fMaxX,Ee),O.fMinZ=Math.min(O.fMinZ,qe),O.fMaxZ=Math.max(O.fMaxZ,Ne),O.hasFloor=!0),r.set(Be,O),c=Math.min(c,gn),m=Math.max(m,In),b=Math.min(b,Sn),l=Math.max(l,bn),A=!0}),!A)return null;const K=Math.max(n,E>0?E+.02:n),Mt=[...r.values()].map(s=>{const B=Math.sin(s.heading),F=Math.cos(s.heading),x=B,G=-F,Q=Math.abs(x)>Math.abs(G),q=s.hasFloor?s.fMinX:s.minX,oe=s.hasFloor?s.fMaxX:s.maxX,Rt=s.hasFloor?s.fMinZ:s.minZ,se=s.hasFloor?s.fMaxZ:s.maxZ,Ge=Q?(x>0?oe:q)+(x>0?e/2:-e/2):(G>0?se:Rt)+(G>0?e/2:-e/2);return{g:s,isSide:Q,plane:Ge}}),Lt=Mt.some(s=>s.g.hasFloor)?Mt.filter(s=>s.g.hasFloor):Mt,pn=Lt.filter(s=>s.isSide).map(s=>s.plane),mn=Lt.filter(s=>!s.isSide).map(s=>s.plane),Qt=[];for(const s of Lt){const{g:B}=s;if(s.isSide){let F=B.minZ,x=B.maxZ;for(const G of mn)F=Math.min(F,G),x=Math.max(x,G);Qt.push({cx:s.plane,cz:(F+x)/2,cy:K/2,length:x-F+o*2,thickness:e,height:K,rotY:Math.PI/2})}else{let F=B.minX,x=B.maxX;for(const G of pn)F=Math.min(F,G),x=Math.max(x,G);Qt.push({cx:(F+x)/2,cz:s.plane,cy:K/2,length:x-F+o*2,thickness:e,height:K,rotY:0})}}const kt=.4,Fe=m>c&&l>b;let Jt=c-kt,te=m+kt,ee=b-kt,ne=l+kt;for(const s of Lt){const B=Math.sin(s.g.heading),F=-Math.cos(s.g.heading);s.isSide?B<0?Jt=s.plane-e/2:te=s.plane+e/2:F<0?ee=s.plane-e/2:ne=s.plane+e/2}const hn=Fe?{cx:(Jt+te)/2,cz:(ee+ne)/2,w:te-Jt,d:ne-ee}:null,fn=Fe?{minX:c,maxX:m,minZ:b,maxZ:l,w:m-c,d:l-b,h:K,height:E>0?E:K}:null;return{segments:Qt,floor:hn,bbox:fn}},[C,dt,nt,st,u,ue]),on=Zt&&!!(U&&U.segments&&U.segments.length),sn=St&&!!(U&&U.bbox&&U.bbox.w>0),rn=(t,n)=>{const e=dt[n]||{position:[0,0,0],rotation:[0,0,0]},o=Ft.get(t.id);if(!o)return e;const r=e.position||[0,0,0],c=(Array.isArray(e.rotation)?e.rotation[1]:0)||0,m=Math.cos(c),b=Math.sin(c),l=o.offset||[0,0,0];return{position:[r[0]+(l[0]||0)*m+(l[2]||0)*b,r[1]+(l[1]||0),r[2]-(l[0]||0)*b+(l[2]||0)*m],rotation:[0,c+(o.rotDegY||0)*Math.PI/180,0]}},$=bt,vt=!!$,we=H(()=>{if(!$)return new Set;const t=u($.variantId)||u($.productId)||null,n=W.getState().products,e=new Set;for(const o of Object.values(f||{})){const r=u(o.variantId)||u(o.productId);(t?$e(t,r,n):(()=>{const m=new Set(($.compatibleGraphIds||[]).map(String)),b=r?.product_graph??r?.productGraph;return b!=null&&m.has(String(b))})())&&e.add(String(o.id))}return e},[$,f,u]),$t=J(()=>{y.getState().clearPendingSlotPlacement?.(),y.getState().clearPendingHostedProduct?.()},[]),Ce=J((t,n)=>{if(!n)return;const e=W.getState(),o=e.getProduct?.(n.variantId)||e.getProduct?.(n.productId),r=o?.productGraph??o?.product_graph??null,c=T.getState().productInstances?.[String(t)],m=o?.placementGroup??o?.placement_group??c?.placementGroup??null,b=Array.isArray(c?.position)?c.position:[0,0,0],l=c?.variantId??c?.productId??null,E=Number.isFinite(Number(c?.sequence))?Number(c.sequence):void 0;$t(),Nt({type:Xt.PRODUCT_ADD,productGraphId:r,variantId:n.variantId??n.productId,placementGroup:m,sequence:E,hostPlacementId:String(t),hostVariantId:l},A=>qt({productGraphId:A.productGraphId,variantId:A.variantId,placementGroup:A.placementGroup,position:b,sequence:A.sequence,hostPlacementId:A.hostPlacementId,hostVariantId:A.hostVariantId}).catch(()=>{}))},[$t]),Kt=J((t,n)=>{const e=W.getState(),o=e.getProduct?.(n.variantId)||e.getProduct?.(n.productId),r=o?.productGraph??o?.product_graph??null,c=o?.placementGroup??o?.placement_group??null,m=C[t-1]||C[t],b=Array.isArray(m?.position)?m.position:[0,0,0],l=C[t],E=l&&Number.isFinite(Number(l.sequence))?Number(l.sequence):void 0;Nt({type:Xt.PRODUCT_ADD,productGraphId:r,variantId:n.variantId??n.productId,placementGroup:c,sequence:E},A=>qt({productGraphId:A.productGraphId,variantId:A.variantId,placementGroup:A.placementGroup,position:b,sequence:A.sequence}).catch(()=>{}))},[C]);N(()=>{if(!Z||C.length>0)return;const t=Z;Ye(),Kt(0,t)},[Z,C.length,Kt]);const{gaps:an,onInsert:cn}=Kn({systemId:d,count:C.length,positionOf:t=>dt[t]?.position||[0,0,0],insertAt:Kt}),Te=H(()=>{if(!Z)return[];const t=W.getState();return Dn(C,{candidate:Z,getProduct:n=>t.getProduct?.(n),getDims:st,config:tn(),layout:dt})},[Z,C,dt,st]),dn=J(t=>{const n=Ln(t,{candidate:Z});if(!n)return;const e=W.getState(),o=e.getProduct?.(n.variantId)||e.getProduct?.(n.productId),r=o?.productGraph??o?.product_graph??null,c=o?.placementGroup??o?.placement_group??null,m=n.transform?.position??t.position??[0,0,0],b=Rn(n,t,C);Nt({type:Xt.PRODUCT_ADD,productGraphId:r,variantId:n.variantId??n.productId,placementGroup:c,anchor:n.anchor??null,sequence:b},l=>qt({productGraphId:l.productGraphId,variantId:l.variantId,placementGroup:l.placementGroup,position:m,sequence:l.sequence}).catch(()=>{})),Ye()},[Z,C]),{selectedInst:Io,swapOrder:So,panelActions:_e,priceInfo:ln}=xn(),un=wn()("selectionPanel");N(()=>{if(S==null)return;const t=f||{},n=String(S),e="__host";if(n.endsWith(e)){const o=n.slice(0,-e.length);if(t[o]||Object.values(t).some(r=>String(r?.id??r?.instanceId)===o))return}else if(t[S]||Object.values(t).some(o=>String(o?.instanceId??o?.id)===n))return;D?.()},[S,f,D]);const yo=gt(t=>t.placementPricing),vo=z(t=>t.getChannelPriceConfig);return lt(de,{children:[h(On,{onSeeded:g}),lt(Fn,{isMobile:_,camera:{position:[2.6,2.2,4],fov:45},controlsTarget:[0,.5,0],onPointerMissed:()=>D?.(),groundShadowCatcher:!0,overlay:lt(de,{children:[!vt&&_e&&un?h(I,{actions:_e,priceInfo:ln}):null,vt&&h("div",{className:"placement-mode-overlay",children:lt("div",{className:"placement-mode-overlay__content",children:[lt("span",{className:"placement-mode-overlay__text",children:["Click on a highlighted slot to place ",h("strong",{children:$?.name})]}),h("button",{type:"button",className:"placement-mode-overlay__cancel",onClick:$t,children:h("span",{className:"placement-mode-overlay__cancel-text",children:"Cancel"})})]})}),h(Nn,{name:"overlay"}),tt&&h(et,{scene:!0,message:ut("loading.message","Loading your configurator\u2026"),detail:V,progress:v}),a&&h("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,zIndex:30,cursor:"default"}})]}),children:[on&&h(Gn,{width:nt?.width,depth:nt?.depth,height:nt?.height??U?.bbox?.h??2.7,showCeiling:Ct?.ceiling===!0,segments:U?.segments||null,floor:U?.floor||null}),sn&&(()=>{const t=ie("SceneDimensions",Hn);return h(t,{bbox:U.bbox})})(),C.map((t,n)=>{const e=Ft.get(t.id),o=dt[n]||{position:[0,0,0],rotation:[0,0,0]};return o.hidden?null:lt("group",{children:[e&&h(ce,{instance:{id:e.id,instanceId:e.id,productId:e.hostVariantId,variantId:e.hostVariantId,position:o.position||[0,0,0],rotation:o.rotation||[0,0,0]},slotMaterials:{...pt,...j?.[e.hostedProductId]||{},...j?.[e.id]||{}},stateInstanceId:e.hostedProductId,onSelect:()=>T.getState().selectInstance(e.id),isSelected:String(S)===String(e.id),onMeasure:r=>jt(e.hostVariantId,r,null,e.id),footprintExcludeItem:Ut,hoverable:!0,focusable:!0},e.id),h(ce,{instance:{...t,...rn(t,n)},slotMaterials:{...pt,...j?.[t.id]||j?.[t.instanceId]||{}},onSelect:(r,c,m)=>{if(vt){we.has(String(t.id))&&Ce(t.id,$);return}T.getState().selectInstance(r,m??null)},isSelected:!vt&&String(S)===String(t.instanceId??t.id),onMeasure:r=>jt(t.productId,r,t.id),footprintExcludeItem:Ut,hoverable:!0,focusable:!0}),vt&&we.has(String(t.id))&&(()=>{const r=o.position||[0,0,0],c=st(ft[n]?.productId??t.productId,t),m=(Array.isArray(o.rotation)?o.rotation[1]:0)||0,b=Math.cos(m),l=Math.sin(m),E=c?.cx||0,A=c?.cz||0,K=c?.full?.height??c?.height,Mt=[r[0]+E*b+A*l,r[1]+(K>0?K/2:.45),r[2]-E*l+A*b];return h(uo,{position:Mt,onClick:()=>Ce(t.id,$)})})()]},t.id??t.instanceId??n)}),_t.map((t,n)=>h(Tn,{selected:S===t.id,disabled:!!t.locked,position:t.position||[0,0,0],rotationY:(Array.isArray(t.rotation)&&t.rotation[1]||0)*Math.PI/180,gizmoOffset:(()=>{const e=st(t.productId,t);return[e?.cx||0,0,e?.cz||0]})(),onCommit:({position:e,rotationY:o})=>{i(t.id,e),L(t.id,[0,o*180/Math.PI,0]),Qn({allowRevert:!0}).catch(()=>{})},children:h(ce,{instance:{...t,position:[0,0,0],rotation:[0,0,0]},slotMaterials:{...pt,...j?.[t.id]||j?.[t.instanceId]||{}},onMeasure:e=>jt(t.productId,e,t.id),footprintExcludeItem:Ut})},t.id??t.instanceId??`free-${n}`)),Te.length>0?h(An,{targets:Te,onPick:dn}):h(_n,{gaps:an,onInsert:cn})]})]})}const en=new Set;function mo(){no();const _=z(a=>a.systemLayoutTemplate),I=z(a=>a.systemTheme),f=z(a=>a.systemThemeRecord);ao(I,f);const u=ro(f)||(I?String(I).trim().toLowerCase():null);let p=_;try{const a=new URLSearchParams(window.location.search);a.has("template")?p=a.get("template"):a.has("theme")&&(p=a.get("theme"))}catch{}p=p||_||u||null;const D=oo();D&&(p=D),!D&&!_&&p&&p===u&&!eo(p)&&!/^theme\d+$/.test(p)&&!en.has(p)&&en.add(p),so(p);const S=to(p);return lt(de,{children:[h(S,{Scene:po,template:p}),h(Xn,{}),h(Zn,{})]})}export{po as SharedConfiguratorScene,mo as default};
1
+ import{Fragment as le,jsx as m,jsxs as lt}from"react/jsx-runtime";import{useCallback as J,useEffect as N,useMemo as H,useRef as Mt,useState as wt,useSyncExternalStore as Ye}from"react";import{Html as vn,useProgress as Pn}from"@react-three/drei";import T from"./9c6c598569.js";import W from"./872c4302e0.js";import E from"./be337ddda5.js";import gt from"./d94df858ea.js";import{normalizeMaterialTargets as Mn}from"./dc2a1a0e13.js";import I from"./8f60e5059a.js";import wn from"./60d697292c.js";import xn from"./811b403d43.js";import{useUiToggles as Cn}from"./d0f9681634.js";import{ProductInstance as ce,SelectionActionPanel as Tn,FreeMovable as _n,PlacementGaps as Fn,SceneStage as Gn,SceneRoom as On,SceneProductsSource as An}from"./8a3a57c008.js";import kn from"./205827c5c8.js";import{computeTargets as Dn,resolveTarget as Ln,resolveTargetRenderer as Rn,resolveInsertSequence as En}from"./58e6419ba8.js";import{disarmPlacement as ie}from"./ab6c80484f.js";import{applyMeasurement as zn}from"./9ce3c3df25.js";import{isCompatibleSlot as $e}from"./99577e3161.js";import{resolveComponent as de,useComponentRegistry as Ke}from"./882bc739c8.js";import qn from"./88251d6671.js";import{useLabels as Nn}from"./28d887bf8a.js";import{SlotHost as Xn}from"./73f7d65985.js";import{ModalHost as Zn}from"./09c4973968.js";import Hn from"./6c0a2572dd.js";import Vn from"./c1791d3a4a.js";import jn from"./20b0104576.js";import{getConfigState as Un,subscribe as Qe,getVersion as zt}from"./817d930a49.js";import{getPlacementStrategy as Je}from"./281cf952fa.js";import{resolveAddMode as Bn,armPlacement as Wn,getPendingPlacement as Yn}from"./ab6c80484f.js";import{resolveReplaceTarget as $n}from"./4d7a0d1897.js";import{enforceCorners as Kn}from"./388cadacbd.js";import{resolvePlacementStrategyConfig as tn}from"./281cf952fa.js";import{getLabel as Qn}from"./28d887bf8a.js";import{isAddFeature as Jn}from"./8c27edda0f.js";import{usePlacementInteraction as to}from"./4b8958aa4c.js";import{refreshCanonicalState as eo,seedInitialState as no,addProduct as qt}from"./a77b15c0d6.js";import{resolveLayout as oo,hasLayout as so,useLayoutRegistry as ro,layoutOverride as ao,_publishResolvedLayoutKey as co}from"./31ea036f5c.js";import{themeLayoutKey as io,useSystemTheme as lo}from"./5c9fd9201c.js";import"./1a2629800a.css";import{runIntent as Nt,INTENTS as Xt}from"./6d238282c1.js";function uo(){const _=gt(a=>a.sceneSelections),S=gt(a=>a.selectionOrder),f=T(a=>a.activeSceneConfigId),u=E(a=>a.defaultPresetId),p=E(a=>a.sceneConfigurations),k=E(a=>a.getSceneFeatures),b=Ye(Qe,zt,zt);return H(()=>{const a=f||u||Object.keys(p||{})[0],tt=a?k(a):[],V=W.getState(),v=[],et=new Set,ut=(i,D)=>{if(!i||i.id==null||et.has(String(i.id))||D>4)return;et.add(String(i.id)),v.push(i);const x=(V.features?.[i.id]||V.features?.[String(i.id)])?.childOptionSetIds||[];for(const M of x){const d=V.features?.[M]||V.features?.[String(M)];d&&ut({id:M,type:d.type,sequence:d.sequence},D+1)}};for(const i of tt)ut(i,0);const It=v.filter(i=>/finish/i.test(i.type||"")&&_[i.id]!=null).sort((i,D)=>{const X=S?.[String(i.id)]??-1,x=S?.[String(D.id)]??-1;return X!==x?X-x:(i.sequence??0)-(D.sequence??0)}),P={};for(const i of It){const D=_[i.id],X=V.options?.[D]?.value;if(X==null)continue;const x=V.features?.[i.id]||{},M=Mn(x.materialTargets??x.material_targets??x.materials);for(const d of M)P[String(d).toLowerCase()]=X}return P},[_,S,f,u,p,k,b])}function po(_,S){if(S==null)return null;const f=String(S);for(const u of Object.values(_.products||{})){const p=u?.components_configuration||u?.componentsConfiguration;if(!(!p||typeof p!="object"))for(const k of Object.values(p))for(const b of Array.isArray(k)?k:[k]){const a=b&&typeof b=="object"?b.componentId??b.component_id:b;if(a!=null&&String(a)===f)return u}}return null}function mo(_){const S=gt(v=>v.sceneSelections),f=gt(v=>v.setSceneSelection),u=E(v=>v.getSceneFeatures),p=E(v=>v.sceneConfigurations),k=Ye(Qe,zt,zt),b=H(()=>new Set((_?u(_)||[]:[]).filter(v=>Jn(v)).map(v=>String(v.id))),[_,u,p,k]),a=Mt({}),tt=Mt(!1),V=gt(v=>v.sceneSelectionsSettled);N(()=>{if(!V){a.current={...S};return}if(!tt.current){tt.current=!0;let P=!1;for(const[i,D]of Object.entries(S||{}))D==null||!b.has(String(i))||(f(i,null),P=!0);if(P){a.current={...S};return}}const v=a.current,et=[];for(const[P,i]of Object.entries(S||{}))v[P]===i||i==null||b.has(String(P))&&et.push([P,i]);if(a.current={...S},!et.length)return;const ut=E.getState().systemId;let It=!1;return(async()=>{const P=W.getState(),i=T.getState();for(const[D,X]of et){const x=P.options?.[X];let M=x?.valueProductVariantId??x?.value_product_variant_id??x?.value_product_variant??x?.variantId??x?.variant_id??null,d=M!=null?P.getProduct?.(M):null;if(d==null){const g=x?.value??(P.optionToProducts?.[String(X)]||[])[0]??x?.product_id??x?.productId??null;d=g!=null?P.getProduct?.(g):null,d==null&&g!=null&&P.getComponent?.(g)&&(d=po(P,g)),M=d?.id??M??g}else M=d?.id??M;if(M==null){f(D,null);continue}const xt=d?.id??M,Ct=d?.placementGroup??d?.placement_group??null,Zt=d?.productGraph??d?.product_graph??null,St=d?.compatibleSlots??d?.compatible_slots??null;if(Array.isArray(St)&&St.length){const g=new Set(St.map(String));if(Object.values(i.productInstances||{}).some(ht=>{const ue=P.getProduct?.(ht.variantId)||P.getProduct?.(ht.productId);return $e(d,ue,P.products)})){I.getState().setPendingSlotPlacement?.({productId:xt,variantId:M,name:d?.name??d?.displayName??d?.variantName??"product",compatibleGraphIds:Array.from(g)}),f(D,null);continue}}if(Bn(ut,d)==="arm"){Wn({productId:xt,variantId:M});const g=Je(),Tt=typeof g?.computeTargets=="function",ht=Object.prototype.hasOwnProperty.call(g??{},"armHint")?g.armHint:Qn(Tt?"placement.armedPickTarget":"placement.armedPickGap",Tt?"":"Click a + between pieces to insert it, or press Esc to cancel.");ht&&I.getState().showInfo?.(ht),f(D,null);continue}const bt=T.getState(),pt=bt.selectedInstanceId,j=pt!=null?(bt.productInstances||{})[pt]:null,nt=j&&Number.isFinite(Number(j.sequence))?Number(j.sequence):void 0,mt=$n({placementGroup:Ct}),R=mt!=null?(bt.productInstances||{})[mt]:null,Ht=R&&Number.isFinite(Number(R.sequence))?Number(R.sequence):nt,ct=Array.isArray(R?.position)?R.position:[0,0,0];let Vt=null;try{Vt=await Nt({type:Xt.PRODUCT_ADD,productGraphId:Zt,variantId:M,placementGroup:Ct,sequence:Ht,replacePlacementId:mt??void 0},g=>qt({productGraphId:g.productGraphId,variantId:g.variantId,placementGroup:g.placementGroup,position:ct,sequence:g.sequence,replace:g.replacePlacementId!=null,replacePlacementId:g.replacePlacementId}))}catch{}if(f(D,null),It)return}})(),()=>{It=!0}},[S,b,_,f])}function ho({position:_,onClick:S}){const[f,u]=wt(!1);return m(vn,{position:_,center:!0,style:{pointerEvents:"auto"},zIndexRange:[100,0],children:m("div",{onClick:S,onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),style:{width:22,height:22,borderRadius:"50%",background:f?"#ff8a65":"rgba(255, 87, 34, 0.85)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontSize:13,fontWeight:"bold",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",cursor:"pointer",transition:"transform 0.2s",transform:f?"scale(1.15)":"scale(1)"},children:"+"})})}function fo({isMobile:_}={}){Ke();const S=de("SelectionActionPanel",Tn),f=T(t=>t.productInstances),u=W(t=>t.getProduct),p=W(t=>t.componentGroups),k=T(t=>t.clearSelection),b=T(t=>t.selectedInstanceId),a=T(t=>t.isFocusing),tt=I(t=>t.bootLoading),V=I(t=>t.bootDetail),v=I(t=>t.bootProgress);Ke();const et=de("LoadingScreen",qn),ut=Nn();N(()=>{if(typeof document>"u")return;const t=document.documentElement;return tt?t.setAttribute("data-scene-booting",""):t.removeAttribute("data-scene-booting"),()=>t.removeAttribute("data-scene-booting")},[tt]),N(()=>{I.getState().markUiReady?.()},[]);const It=T(t=>t.removeProductInstance),P=T(t=>t.addProductInstance),i=T(t=>t.updateInstancePosition),D=T(t=>t.updateInstanceRotation),X=T(t=>t.activeSceneConfigId),x=E(t=>t.defaultPresetId),M=E(t=>t.sceneConfigurations),d=E(t=>t.systemId),xt=E(t=>t.useTransform),Ct=I(t=>t.sceneCapabilities),Zt=I(t=>t.showWalls),St=I(t=>t.showDimensions),bt=I(t=>t.pendingSlotPlacement),pt=uo(),j=I(t=>t.hostMaterialOverrides),nt=(Un()||{}).room||null,mt=X||x||Object.keys(M||{})[0]||null;mo(mt);const[R,Ht]=wt(!0),[ct,Vt]=wt(!1),g=J(async()=>{try{await no()}catch{}Vt(!0)},[]),{edgeOf:Tt,cornerOf:ht,isHostAnchored:ue,isMovable:pe,rawFree:Io,splitReliable:So,freeInstances:_t,ordered:C,syntheticHosts:me,moveInFlightRef:bo}=wn(),Ft=H(()=>new Map(me.map(t=>[t.hostedProductId,t])),[me]),[ot,nn]=wt({}),jt=J((t,n,e=null,o=e)=>{nn(r=>zn(r,t,n,e,o))},[]),st=J((t,n)=>{const e=n?.id!=null?ot[`inst:${n.id}`]:null;return e&&String(e.forProductId)===String(t)?e:ot[t]||null},[ot]),he=W(t=>t.placementBoundsExcludeIds),fe=H(()=>new Set((he||[]).map(t=>String(t))),[he]),Ut=J((t,n)=>{const e=t?.componentId??n?.id??n?.componentId??null;if(e!=null&&fe.has(String(e)))return!0},[p,fe]),Y=Mt(!1),Gt=Mt(!1),L=C.length+_t.length,Bt=H(()=>[...C,..._t],[C,_t]),it=L>0&&Bt.every(t=>ot[t.productId]),Ot=H(()=>Bt.filter(t=>ot[t.productId]).length,[Bt,ot]),{active:Wt,loaded:ge,total:Yt}=Pn(),Ie=I(t=>t.isEvaluating),At=I(t=>t.isLayoutLoading),Se=I(t=>t.bootEvaluating),be=Mt({pieceCount:0,allMeasured:!1});be.current={pieceCount:L,allMeasured:it};const kt=J(()=>{const{pieceCount:t,allMeasured:n}=be.current;t>0&&!Y.current&&!Gt.current&&(T.getState().resetCameraToDefault?.({instant:!0}),Y.current=n,Gt.current=!n)},[]);N(()=>I.subscribe((t,n)=>{n?.bootLoading&&!t.bootLoading&&kt()}),[kt]),N(()=>{if(!ct)return;const t=!Wt&&(Yt===0||ge>=Yt),n=(it||L===0)&&t&&!Ie&&!Se,e=()=>{kt(),Ht(!1),I.getState().endBootLoading()};if(n){let r=null;const c=setTimeout(()=>{L>0&&!Y.current&&(T.getState().resetCameraToDefault?.({instant:!0}),Y.current=!0),r=setTimeout(e,120)},780);return()=>{clearTimeout(c),r&&clearTimeout(r)}}const o=setTimeout(e,Wt?12e4:15e3);return()=>clearTimeout(o)},[ct,it,L,Ot,Wt,ge,Yt,Ie,Se,kt]);const[ye,ve]=wt(!1);N(()=>{if(!R){ve(!1);return}(it&&L>0||ct&&L===0)&&ve(!0)},[it,L,ct,R]);const Pe=ct?ye||L===0?"Finishing up\u2026":`Loading products\u2026 ${Math.min(Ot,L)}/${L}`:"Preparing your configurator\u2026",Me=ye?100:L>0?Math.min(Math.round(Ot/L*100),92):0;N(()=>{R&&I.getState().setBootPhase(Pe,Me)},[R,Pe,Me]),N(()=>(I.setState({initialSceneLoading:R}),()=>I.setState({initialSceneLoading:!1})),[R]),N(()=>{At&&(Y.current=!1)},[At]),N(()=>{if(L===0){Y.current=!1;return}if(Y.current||R||At||!it)return;const t=setTimeout(()=>{Y.current||(T.getState().resetCameraToDefault?.({instant:!Gt.current}),Gt.current=!1,Y.current=!0)},250);return()=>clearTimeout(t)},[L,Ot,R,At,it]);const yt=Je(),ft=H(()=>C.map(t=>{const n=Ft.get(t.id);return n?{...t,productId:n.hostVariantId}:t}),[C,Ft]),we=xt||!!M?.[mt]?.useTransform,Z=T(t=>t.pendingPlacementPiece),on=I(t=>t.finalRenderShowing),xe=!!Z&&typeof yt?.computeTargets=="function"&&!!Rn(),dt=H(()=>{const t={getProduct:u,getDims:st,useTransform:we,candidate:Z,openSlots:xe,config:tn()},n=yt.computeLayout?yt.computeLayout(ft,t):ft.map(()=>({position:[0,0,0],rotation:[0,0,0]})),e=Kn(n,ft,t,yt);try{import.meta.env?.DEV&&typeof window<"u"&&(window.__layoutDebug={at:Date.now(),dims:ot,items:ft.map(o=>({id:o.id,variantId:o.variantId,productId:o.productId,placementGroup:o.placementGroup,sequence:o.sequence,positionedAbove:o.positionedAbove??null,hostVariantId:o.hostVariantId??null,position:o.position,rotation:o.rotation,corner:!!o.corner})),layout:e})}catch{}return e},[yt,ft,u,st,we,Z,xe,ot]),U=H(()=>{const n=nt?.height>0?nt.height:2.7,e=.1,o=.05,r=new Map;let c=1/0,h=-1/0,y=1/0,l=-1/0,z=0,A=!1;if(C.forEach((s,B)=>{const F=dt[B];if(!F||pe(s))return;const w=F.position||[0,0,0],G=st(s.productId,s),Q=u(s.productId),q=G?.full||G,oe=q?.height>0?q.height:Q?.height>0?Q.height*.0254:0,Rt=(w[1]||0)+oe;if(Rt>z&&(z=Rt),(s.positionedAbove??s.positioned_above)!=null)return;const se=(w[1]||0)<=.01,Et=-((Array.isArray(F.rotation)?F.rotation[1]:0)||0),re=G?.depth>0?G.depth:Q?.depth>0?Q.depth*.0254:.6,ae=G?.width>0?G.width:Q?.width>0?Q.width*.0254:.9,rt=Math.cos(Et),at=Math.sin(Et),Ae=G?.cx||0,ke=G?.cz||0,De=w[0]+rt*Ae-at*ke,Le=w[2]+at*Ae+rt*ke,Re=(ae*Math.abs(rt)+re*Math.abs(at))/2,Ee=(ae*Math.abs(at)+re*Math.abs(rt))/2,ze=De-Re,qe=De+Re,Ne=Le-Ee,Xe=Le+Ee,Ze=q?.width>0?q.width:ae,He=q?.depth>0?q.depth:re,Ve=w[0]+rt*(q?.cx||0)-at*(q?.cz||0),je=w[2]+at*(q?.cx||0)+rt*(q?.cz||0),Ue=(Ze*Math.abs(rt)+He*Math.abs(at))/2,Be=(Ze*Math.abs(at)+He*Math.abs(rt))/2,In=Ve-Ue,Sn=Ve+Ue,bn=je-Be,yn=je+Be,We=String((Math.round(Et/(Math.PI/2))%4+4)%4),O=r.get(We)||{heading:Et,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,fMinX:1/0,fMaxX:-1/0,fMinZ:1/0,fMaxZ:-1/0,hasFloor:!1};O.minX=Math.min(O.minX,ze),O.maxX=Math.max(O.maxX,qe),O.minZ=Math.min(O.minZ,Ne),O.maxZ=Math.max(O.maxZ,Xe),se&&(O.fMinX=Math.min(O.fMinX,ze),O.fMaxX=Math.max(O.fMaxX,qe),O.fMinZ=Math.min(O.fMinZ,Ne),O.fMaxZ=Math.max(O.fMaxZ,Xe),O.hasFloor=!0),r.set(We,O),c=Math.min(c,In),h=Math.max(h,Sn),y=Math.min(y,bn),l=Math.max(l,yn),A=!0}),!A)return null;const K=Math.max(n,z>0?z+.02:n),Pt=[...r.values()].map(s=>{const B=Math.sin(s.heading),F=Math.cos(s.heading),w=B,G=-F,Q=Math.abs(w)>Math.abs(G),q=s.hasFloor?s.fMinX:s.minX,oe=s.hasFloor?s.fMaxX:s.maxX,Rt=s.hasFloor?s.fMinZ:s.minZ,se=s.hasFloor?s.fMaxZ:s.maxZ,Oe=Q?(w>0?oe:q)+(w>0?e/2:-e/2):(G>0?se:Rt)+(G>0?e/2:-e/2);return{g:s,isSide:Q,plane:Oe}}),Dt=Pt.some(s=>s.g.hasFloor)?Pt.filter(s=>s.g.hasFloor):Pt,mn=Dt.filter(s=>s.isSide).map(s=>s.plane),hn=Dt.filter(s=>!s.isSide).map(s=>s.plane),Qt=[];for(const s of Dt){const{g:B}=s;if(s.isSide){let F=B.minZ,w=B.maxZ;for(const G of hn)F=Math.min(F,G),w=Math.max(w,G);Qt.push({cx:s.plane,cz:(F+w)/2,cy:K/2,length:w-F+o*2,thickness:e,height:K,rotY:Math.PI/2})}else{let F=B.minX,w=B.maxX;for(const G of mn)F=Math.min(F,G),w=Math.max(w,G);Qt.push({cx:(F+w)/2,cz:s.plane,cy:K/2,length:w-F+o*2,thickness:e,height:K,rotY:0})}}const Lt=.4,Ge=h>c&&l>y;let Jt=c-Lt,te=h+Lt,ee=y-Lt,ne=l+Lt;for(const s of Dt){const B=Math.sin(s.g.heading),F=-Math.cos(s.g.heading);s.isSide?B<0?Jt=s.plane-e/2:te=s.plane+e/2:F<0?ee=s.plane-e/2:ne=s.plane+e/2}const fn=Ge?{cx:(Jt+te)/2,cz:(ee+ne)/2,w:te-Jt,d:ne-ee}:null,gn=Ge?{minX:c,maxX:h,minZ:y,maxZ:l,w:h-c,d:l-y,h:K,height:z>0?z:K}:null;return{segments:Qt,floor:fn,bbox:gn}},[C,dt,nt,st,u,pe]),sn=Zt&&!!(U&&U.segments&&U.segments.length),rn=St&&!!(U&&U.bbox&&U.bbox.w>0),an=(t,n)=>{const e=dt[n]||{position:[0,0,0],rotation:[0,0,0]},o=Ft.get(t.id);if(!o)return e;const r=e.position||[0,0,0],c=(Array.isArray(e.rotation)?e.rotation[1]:0)||0,h=Math.cos(c),y=Math.sin(c),l=o.offset||[0,0,0];return{position:[r[0]+(l[0]||0)*h+(l[2]||0)*y,r[1]+(l[1]||0),r[2]-(l[0]||0)*y+(l[2]||0)*h],rotation:[0,c+(o.rotDegY||0)*Math.PI/180,0]}},$=bt,vt=!!$,Ce=H(()=>{if(!$)return new Set;const t=u($.variantId)||u($.productId)||null,n=W.getState().products,e=new Set;for(const o of Object.values(f||{})){const r=u(o.variantId)||u(o.productId);(t?$e(t,r,n):(()=>{const h=new Set(($.compatibleGraphIds||[]).map(String)),y=r?.product_graph??r?.productGraph;return y!=null&&h.has(String(y))})())&&e.add(String(o.id))}return e},[$,f,u]),$t=J(()=>{I.getState().clearPendingSlotPlacement?.(),I.getState().clearPendingHostedProduct?.()},[]),Te=J((t,n)=>{if(!n)return;const e=W.getState(),o=e.getProduct?.(n.variantId)||e.getProduct?.(n.productId),r=o?.productGraph??o?.product_graph??null,c=T.getState().productInstances?.[String(t)],h=o?.placementGroup??o?.placement_group??c?.placementGroup??null,y=Array.isArray(c?.position)?c.position:[0,0,0],l=c?.variantId??c?.productId??null,z=Number.isFinite(Number(c?.sequence))?Number(c.sequence):void 0;$t(),Nt({type:Xt.PRODUCT_ADD,productGraphId:r,variantId:n.variantId??n.productId,placementGroup:h,sequence:z,hostPlacementId:String(t),hostVariantId:l},A=>qt({productGraphId:A.productGraphId,variantId:A.variantId,placementGroup:A.placementGroup,position:y,sequence:A.sequence,hostPlacementId:A.hostPlacementId,hostVariantId:A.hostVariantId}).catch(()=>{}))},[$t]),Kt=J((t,n)=>{const e=W.getState(),o=e.getProduct?.(n.variantId)||e.getProduct?.(n.productId),r=o?.productGraph??o?.product_graph??null,c=o?.placementGroup??o?.placement_group??null,h=C[t-1]||C[t],y=Array.isArray(h?.position)?h.position:[0,0,0],l=C[t],z=l&&Number.isFinite(Number(l.sequence))?Number(l.sequence):void 0;Nt({type:Xt.PRODUCT_ADD,productGraphId:r,variantId:n.variantId??n.productId,placementGroup:c,sequence:z},A=>qt({productGraphId:A.productGraphId,variantId:A.variantId,placementGroup:A.placementGroup,position:y,sequence:A.sequence}).catch(()=>{}))},[C]);N(()=>{if(!Z||C.length>0)return;const t=Z;ie(),Kt(0,t)},[Z,C.length,Kt]);const{gaps:cn,onInsert:dn}=to({systemId:d,count:C.length,positionOf:t=>dt[t]?.position||[0,0,0],insertAt:Kt}),_e=H(()=>{if(!Z)return[];const t=W.getState();return Dn(C,{candidate:Z,getProduct:n=>t.getProduct?.(n),getDims:st,config:tn(),layout:dt})},[Z,C,dt,st]),ln=J(t=>{const n=Ln(t,{candidate:Z});if(!n)return;const e=W.getState(),o=e.getProduct?.(n.variantId)||e.getProduct?.(n.productId),r=o?.productGraph??o?.product_graph??null,c=o?.placementGroup??o?.placement_group??null,h=n.transform?.position??t.position??[0,0,0],y=En(n,t,C);Nt({type:Xt.PRODUCT_ADD,productGraphId:r,variantId:n.variantId??n.productId,placementGroup:c,anchor:n.anchor??null,sequence:y},l=>qt({productGraphId:l.productGraphId,variantId:l.variantId,placementGroup:l.placementGroup,position:h,sequence:l.sequence}).catch(()=>{})),ie()},[Z,C]),{selectedInst:yo,swapOrder:vo,panelActions:Fe,priceInfo:un}=xn(),pn=Cn()("selectionPanel");N(()=>{if(b==null)return;const t=f||{},n=String(b),e="__host";if(n.endsWith(e)){const o=n.slice(0,-e.length);if(t[o]||Object.values(t).some(r=>String(r?.id??r?.instanceId)===o))return}else if(t[b]||Object.values(t).some(o=>String(o?.instanceId??o?.id)===n))return;k?.()},[b,f,k]);const Mo=gt(t=>t.placementPricing),wo=E(t=>t.getChannelPriceConfig);return lt(le,{children:[m(An,{onSeeded:g}),lt(Gn,{isMobile:_,camera:{position:[2.6,2.2,4],fov:25},controlsTarget:[0,.5,0],onPointerMissed:()=>{Yn()&&ie(),k?.()},groundShadowCatcher:!0,overlay:lt(le,{children:[m(Vn,{}),!vt&&Fe&&pn?m(S,{actions:Fe,priceInfo:un}):null,vt&&m("div",{className:"placement-mode-overlay",children:lt("div",{className:"placement-mode-overlay__content",children:[lt("span",{className:"placement-mode-overlay__text",children:["Click on a highlighted slot to place ",m("strong",{children:$?.name})]}),m("button",{type:"button",className:"placement-mode-overlay__cancel",onClick:$t,children:m("span",{className:"placement-mode-overlay__cancel-text",children:"Cancel"})})]})}),m(Xn,{name:"overlay"}),tt&&m(et,{scene:!0,message:ut("loading.message","Loading your configurator\u2026"),detail:V,progress:v}),a&&m("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,zIndex:30,cursor:"default"}})]}),children:[sn&&m(On,{width:nt?.width,depth:nt?.depth,height:nt?.height??U?.bbox?.h??2.7,showCeiling:Ct?.ceiling===!0,segments:U?.segments||null,floor:U?.floor||null}),rn&&(()=>{const t=de("SceneDimensions",jn);return m(t,{bbox:U.bbox})})(),C.map((t,n)=>{const e=Ft.get(t.id),o=dt[n]||{position:[0,0,0],rotation:[0,0,0]};return o.hidden?null:lt("group",{children:[e&&m(ce,{instance:{id:e.id,instanceId:e.id,productId:e.hostVariantId,variantId:e.hostVariantId,position:o.position||[0,0,0],rotation:o.rotation||[0,0,0]},slotMaterials:{...pt,...j?.[e.hostedProductId]||{},...j?.[e.id]||{}},stateInstanceId:e.hostedProductId,onSelect:()=>T.getState().selectInstance(e.id),isSelected:String(b)===String(e.id),onMeasure:r=>jt(e.hostVariantId,r,null,e.id),footprintExcludeItem:Ut,hoverable:!0,focusable:!0},e.id),m(ce,{instance:{...t,...an(t,n)},slotMaterials:{...pt,...j?.[t.id]||j?.[t.instanceId]||{}},onSelect:(r,c,h)=>{if(vt){Ce.has(String(t.id))&&Te(t.id,$);return}T.getState().selectInstance(r,h??null)},isSelected:!vt&&String(b)===String(t.instanceId??t.id),onMeasure:r=>jt(t.productId,r,t.id),footprintExcludeItem:Ut,hoverable:!0,focusable:!0}),vt&&Ce.has(String(t.id))&&(()=>{const r=o.position||[0,0,0],c=st(ft[n]?.productId??t.productId,t),h=(Array.isArray(o.rotation)?o.rotation[1]:0)||0,y=Math.cos(h),l=Math.sin(h),z=c?.cx||0,A=c?.cz||0,K=c?.full?.height??c?.height,Pt=[r[0]+z*y+A*l,r[1]+(K>0?K/2:.45),r[2]-z*l+A*y];return m(ho,{position:Pt,onClick:()=>Te(t.id,$)})})()]},t.id??t.instanceId??n)}),_t.map((t,n)=>m(_n,{selected:b===t.id,disabled:!!t.locked,position:t.position||[0,0,0],rotationY:(Array.isArray(t.rotation)&&t.rotation[1]||0)*Math.PI/180,gizmoOffset:(()=>{const e=st(t.productId,t);return[e?.cx||0,0,e?.cz||0]})(),onCommit:({position:e,rotationY:o})=>{i(t.id,e),D(t.id,[0,o*180/Math.PI,0]),eo({allowRevert:!0}).catch(()=>{})},children:m(ce,{instance:{...t,position:[0,0,0],rotation:[0,0,0]},slotMaterials:{...pt,...j?.[t.id]||j?.[t.instanceId]||{}},onMeasure:e=>jt(t.productId,e,t.id),footprintExcludeItem:Ut})},t.id??t.instanceId??`free-${n}`)),on?null:_e.length>0?m(kn,{targets:_e,onPick:ln}):m(Fn,{gaps:cn,onInsert:dn})]})]})}const en=new Set;function go(){ro();const _=E(a=>a.systemLayoutTemplate),S=E(a=>a.systemTheme),f=E(a=>a.systemThemeRecord);lo(S,f);const u=io(f)||(S?String(S).trim().toLowerCase():null);let p=_;try{const a=new URLSearchParams(window.location.search);a.has("template")?p=a.get("template"):a.has("theme")&&(p=a.get("theme"))}catch{}p=p||_||u||null;const k=ao();k&&(p=k),!k&&!_&&p&&p===u&&!so(p)&&!/^theme\d+$/.test(p)&&!en.has(p)&&en.add(p),co(p);const b=oo(p);return lt(le,{children:[m(b,{Scene:fo,template:p}),m(Zn,{}),m(Hn,{})]})}export{fo as SharedConfiguratorScene,go as default};
@@ -1 +1 @@
1
- import{HOSTED_PLACEMENT_ID_PREFIX as R}from"./23dc0ccf32.js";import{create as V}from"zustand";import{devtools as k}from"./52436e0169.js";import U from"./d94df858ea.js";import T from"./872c4302e0.js";import{productRefsMatch as C,pieceKindOf as E}from"./9326c23506.js";import{getHostedProductShapeSuffix as j}from"./70dd811d74.js";let $=0;const L=()=>{const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,p=>{const e=Math.random()*16|0;return(p==="x"?e:e&3|8).toString(16)});return`${R}${t}`},K=V(k((t,p)=>({guiVisible:!0,regions:{sidebar:!0,header:!0,toolbar:!0,panels:!0,chat:!0,notifications:!0},ownsSceneGraph:!1,sidebarOpen:!0,sidebarTab:"features",jsonPanelOpen:!0,chatPanelOpen:!1,debugPanelOpen:!1,activeModal:null,modalData:null,modalOpen:!1,notifications:[],constraintWarnings:[],inlineMessages:[],messageModal:null,isExporting:!1,isSharing:!1,isSceneLoading:!1,sceneLoadingMessage:"",isLayoutLoading:!1,isEvaluating:!1,isMobile:!1,mobileMenuOpen:!1,mobileActiveAccordion:"configurator",isLandscapeMode:!1,landscapeMethod:null,landscapeSidebarOpen:!0,liveStatusSummary:"",initialSceneLoading:!1,bootEvaluating:!1,bootLoading:!0,uiReady:!1,markUiReady:()=>t(e=>e.uiReady?e:{uiReady:!0}),bootProgress:null,bootDetail:"",themeReady:!1,setBootPhase:(e,o=null)=>t(n=>n.bootDetail===e&&n.bootProgress===o?n:{bootDetail:e,bootProgress:o}),endBootLoading:()=>t(e=>e.bootLoading?{bootLoading:!1}:e),is3D:!0,showDimensions:!1,showWalls:!0,showFloor:!1,showCeiling:!1,wallOverflowDetected:!1,pieceOverlapDetected:!1,tallWallOverlapDetected:!1,wallPieceOverlapDetected:!1,wallPieceHostedOverlapDetected:!1,skipWallPieceOverlapCheck:!0,overlappingPieces:[],highlightOverlappingPieces:!0,islandOverlapDetected:!1,cornerOverflowDetected:!1,wallOverflowSide:null,wallOverflowRecenterMode:!1,wallOverflowSuppressUntil:0,showWallGuide:!1,captureMode:!1,showOptionLabels:!1,theme:"light",freePieceTier:"single",freePieceWidthOption:"6ft",freePiecePosition:null,freePieceRotation:null,selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null,hostFinishes:{},hostMaterials:{},hostWidths:{},hostDoorTypes:{},hostStyles:{},sceneCapabilities:{dimensions:!0,walls:!0},globals:{},disabledOptions:new Set,hiddenOptions:new Set,currentVisibleOptionSets:null,managedOptionSets:new Set,featureToOptionsMap:{},hostHardwareFinishes:{},hostHandleTypes:{},hostProductOverrides:{},hostMaterialOverrides:{},sceneHostedProducts:[],pendingHostedProduct:null,showHostedProductSlots:!1,pendingSlotPlacement:null,pendingAutoPlacePieceIdx:null,deferredHostedProductPlacement:null,pendingPieceAdd:null,pendingPieceAddQueue:[],pendingPieceDelete:null,disabledWalls:[],currentLayoutType:"single_wall",currentPerpendicularWalls:[],validCornerSlots:[],pendingWallCornerAdd:null,wallCornerCount:0,validWallCornerSlots:[],occupiedPieceSlots:{},pieceConfigSnapshot:null,initialPieceConfigSnapshot:null,initialPerPieceOverrides:null,_snapshotOverridesOnLoadComplete:!1,basePiecePositions:{},sceneModelTransforms:[],setGuiVisible:e=>t({guiVisible:e}),setRegions:e=>t(o=>({regions:{...o.regions,...e&&typeof e=="object"?e:{}}})),toggleSidebar:()=>{t(e=>({sidebarOpen:!e.sidebarOpen}))},setSidebarOpen:e=>{t({sidebarOpen:e})},closeSidebar:()=>{t({sidebarOpen:!1})},openSidebar:()=>{t({sidebarOpen:!0})},setSidebarTab:e=>{t({sidebarTab:e})},setMobileActiveAccordion:e=>{t({mobileActiveAccordion:e})},toggleMobileAccordion:e=>{t(o=>({mobileActiveAccordion:o.mobileActiveAccordion===e?null:e}))},setLandscapeMode:(e,o=null)=>{t({isLandscapeMode:e,landscapeMethod:e?o:null})},toggleLandscapeSidebar:()=>{t(e=>({landscapeSidebarOpen:!e.landscapeSidebarOpen}))},setLiveStatusSummary:e=>{t({liveStatusSummary:e})},toggleView:()=>{t(e=>({is3D:!e.is3D}))},toggleDimensions:()=>{t(e=>({showDimensions:!e.showDimensions}))},toggleWalls:()=>{t(e=>({showWalls:!e.showWalls}))},toggleFloor:()=>{t(e=>({showFloor:!e.showFloor}))},toggleCeiling:()=>{t(e=>({showCeiling:!e.showCeiling}))},toggleOptionLabels:()=>{t(e=>({showOptionLabels:!e.showOptionLabels}))},toggleJsonPanel:()=>{t(e=>({jsonPanelOpen:!e.jsonPanelOpen}))},setJsonPanelOpen:e=>{t({jsonPanelOpen:e})},toggleChatPanel:()=>{t(e=>({chatPanelOpen:!e.chatPanelOpen}))},setChatPanelOpen:e=>{t({chatPanelOpen:e})},toggleDebugPanel:()=>{t(e=>({debugPanelOpen:!e.debugPanelOpen}))},setDebugPanelOpen:e=>{t({debugPanelOpen:e})},openModal:(e,o=null)=>{t({activeModal:e,modalData:o,modalOpen:!0})},closeModal:()=>{t({activeModal:null,modalData:null,modalOpen:!1})},addNotification:e=>{if(p().isLayoutLoading)return null;const o={type:"info",duration:5e3,...e},n=p().notifications.find(c=>c.type===o.type&&(c.title??"")===(o.title??"")&&c.message===o.message);if(n)return n.id;const s=`${Date.now()}-${++$}`,r={id:s,...o};return t(c=>({notifications:[...c.notifications,r]})),r.duration>0&&setTimeout(()=>{p().removeNotification(s)},r.duration),s},removeNotification:e=>{t(o=>({notifications:o.notifications.filter(n=>n.id!==e)}))},clearNotifications:()=>{t({notifications:[]})},setConstraintWarnings:e=>{t({constraintWarnings:Array.isArray(e)?e:[]})},setInlineMessages:e=>{t({inlineMessages:Array.isArray(e)?e:[]})},lastModalKeys:[],setMessageModal:e=>{t({messageModal:e??null})},dismissMessageModal:()=>{t({messageModal:null})},setExporting:e=>{t({isExporting:e})},setSharing:e=>{t({isSharing:e})},setSceneLoading:(e,o="")=>{t({isSceneLoading:e,sceneLoadingMessage:o})},clearSceneLoading:()=>{const e=p()._snapshotOverridesOnLoadComplete;t({isSceneLoading:!1,sceneLoadingMessage:""}),e&&(p().setInitialPerPieceOverrides(),t({_snapshotOverridesOnLoadComplete:!1,isLayoutLoading:!1,selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null}),import("./1fac915f8b.js").then(o=>o.default.getState().clearHistory()))},setIsMobile:e=>{t({isMobile:e})},toggleMobileMenu:()=>{t(e=>({mobileMenuOpen:!e.mobileMenuOpen}))},setMobileMenuOpen:e=>{t({mobileMenuOpen:e})},setTheme:e=>{t({theme:e}),document.documentElement.setAttribute("data-theme",e)},toggleTheme:()=>{const e=p().theme==="light"?"dark":"light";t({theme:e}),document.documentElement.setAttribute("data-theme",e)},setFreePieceTier:e=>t({freePieceTier:e}),setFreePieceWidthOption:e=>t({freePieceWidthOption:e}),setFreePiecePosition:e=>t({freePiecePosition:e}),setFreePieceRotation:e=>t({freePieceRotation:e}),resetFreePiece:()=>t({freePieceTier:"single",freePieceWidthOption:"6ft",freePiecePosition:null,freePieceRotation:null}),setSelectedFeature:(e,o=null)=>{t({selectedFeatureId:e,selectedElementType:o})},setSelectedPieceIndex:e=>{const o=p().selectedPieceIndex;t({selectedPieceIndex:e});const n=c=>{if(c==null)return null;const l=p().hostProductOverrides?.[c];return l??p().basePiecePositions?.[c]?.productId??null},s=n(o),r=n(e);String(s)!==String(r)&&t({currentVisibleOptionSets:null})},clearSelectedFeature:()=>{t({selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})},setHostFinish:(e,o,n)=>{t(s=>({hostFinishes:{...s.hostFinishes,[e]:o},hostMaterials:{...s.hostMaterials,[e]:n}}))},clearHostFinishes:()=>{t({hostFinishes:{},hostMaterials:{}})},clearHostMaterials:()=>{t({hostMaterials:{}})},setHostStyle:(e,o)=>{t(n=>({hostStyles:{...n.hostStyles,[e]:o}}))},clearHostStyles:()=>{t({hostStyles:{}})},setGlobal:(e,o)=>{t(n=>({globals:{...n.globals,[e]:o}}))},roomFootprint:null,setRoomFootprint:e=>t(o=>{const n=o.roomFootprint;return n&&Math.abs(n.width-e.width)<1e-4&&Math.abs(n.depth-e.depth)<1e-4?o:{roomFootprint:{width:e.width,depth:e.depth}}}),setHostHandleType:(e,o)=>{t(n=>({hostHandleTypes:{...n.hostHandleTypes,[e]:o}}))},clearHostHandleTypes:()=>{t({hostHandleTypes:{}})},setHostHardwareFinish:(e,o)=>{t(n=>({hostHardwareFinishes:{...n.hostHardwareFinishes,[e]:o}}))},clearHostHardwareFinishes:()=>{t({hostHardwareFinishes:{}})},setHostMaterialOverride:(e,o,n)=>{!e||!o||t(s=>({hostMaterialOverrides:{...s.hostMaterialOverrides,[e]:{...s.hostMaterialOverrides[e]||{},[o]:n}}}))},clearHostMaterialOverrides:()=>{t({hostMaterialOverrides:{}})},setHostWidth:(e,o)=>{t(n=>({hostWidths:{...n.hostWidths,[e]:o}}))},clearHostWidths:()=>{t({hostWidths:{}})},setHostDoorType:(e,o,n,s)=>{t(r=>({hostDoorTypes:{...r.hostDoorTypes,[e]:{optionId:o,modelUrl:n,value:s}}}))},clearHostDoorTypes:()=>{t({hostDoorTypes:{}})},setHostProductOverride:(e,o)=>{t(n=>{const s=n.occupiedPieceSlots[e];if(s&&s.compatibleProductIds){const r=String(o);if(!s.compatibleProductIds.some(l=>String(l)===r)){const l={...n.occupiedPieceSlots};return delete l[e],{hostProductOverrides:{...n.hostProductOverrides,[e]:o},sceneHostedProducts:n.sceneHostedProducts.filter(u=>u.id!==s.hostedProductId),occupiedPieceSlots:l}}if(s.hostedProductSlots){const l=s.hostedProductSlots.find(u=>u.product_id!=null&&String(u.product_id)===String(o));if(l){const u={...n.occupiedPieceSlots};u[e]={...s,component_overrides:l.component_overrides||s.component_overrides,component_transforms:l.component_transforms||s.component_transforms};const m=l.position||null,P=l.rotation||null;return{hostProductOverrides:{...n.hostProductOverrides,[e]:o},occupiedPieceSlots:u,sceneHostedProducts:n.sceneHostedProducts.map(f=>f.id===s.hostedProductId?{...f,modelOffset:m,modelRotation:P}:f)}}}}return{hostProductOverrides:{...n.hostProductOverrides,[e]:o}}})},clearHostProductOverrides:()=>{t({hostProductOverrides:{}})},cleanupPieceState:e=>{t(o=>{const n={...o.hostWidths},s={...o.hostProductOverrides},r={...o.hostDoorTypes},c={...o.hostFinishes},l={...o.hostMaterials},u={...o.hostStyles},m={...o.hostHandleTypes},P={...o.occupiedPieceSlots},f=P[e],d=f?.pairedHostedProductId;let i=f?.pairedWith;if(delete n[e],delete s[e],delete r[e],delete c[e],delete l[e],delete u[e],delete m[e],delete P[e],i&&P[i]){const h=P[i];h.previousWidth!==void 0?n[i]=h.previousWidth:delete n[i],h.previousProductOverride!==void 0?s[i]=h.previousProductOverride:delete s[i],h.previousDoorType!==void 0?r[i]=h.previousDoorType:delete r[i],delete P[i]}let g=o.sceneHostedProducts.filter(h=>h.replacedPiece!==e);return d&&(g=g.filter(h=>h.id!==d)),{hostWidths:n,hostProductOverrides:s,hostDoorTypes:r,hostFinishes:c,hostMaterials:l,hostStyles:u,hostHandleTypes:m,occupiedPieceSlots:P,sceneHostedProducts:g}})},setPendingHostedProduct:(e,o={})=>{const n=o.autoPlacePieceIdx??null;t({pendingHostedProduct:e,showHostedProductSlots:!0,pendingAutoPlacePieceIdx:n,selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})},clearPendingAutoPlacePieceIdx:()=>{t({pendingAutoPlacePieceIdx:null})},clearPendingHostedProduct:()=>{t({pendingHostedProduct:null,showHostedProductSlots:!1,pendingAutoPlacePieceIdx:null})},setPendingSlotPlacement:e=>t({pendingSlotPlacement:e||null}),clearPendingSlotPlacement:()=>t({pendingSlotPlacement:null}),setDeferredHostedProductPlacement:e=>t({deferredHostedProductPlacement:e}),clearDeferredHostedProductPlacement:()=>t({deferredHostedProductPlacement:null}),setPendingPieceAdd:e=>t(o=>o.pendingPieceAdd?{pendingPieceAddQueue:[...o.pendingPieceAddQueue,e]}:{pendingPieceAdd:e}),clearPendingPieceAdd:()=>t(e=>{const o=e.pendingPieceAddQueue;if(o.length>0){const[n,...s]=o;return{pendingPieceAdd:n,pendingPieceAddQueue:s}}return{pendingPieceAdd:null}}),setPendingPieceDelete:e=>t({pendingPieceDelete:e}),clearPendingPieceDelete:()=>t({pendingPieceDelete:null}),addDisabledWall:e=>t(o=>({disabledWalls:o.disabledWalls.includes(e)?o.disabledWalls:[...o.disabledWalls,e]})),removeDisabledWall:e=>t(o=>({disabledWalls:o.disabledWalls.filter(n=>n!==e)})),clearDisabledWalls:()=>t({disabledWalls:[]}),setSkipWallPieceOverlapCheck:e=>t({skipWallPieceOverlapCheck:e}),setCurrentLayoutType:e=>t({currentLayoutType:e}),setCurrentPerpendicularWalls:e=>t({currentPerpendicularWalls:e}),setValidCornerSlots:e=>t({validCornerSlots:e}),setWallCornerCount:e=>t({wallCornerCount:e}),setValidWallCornerSlots:e=>t({validWallCornerSlots:e}),clearPendingWallCornerAdd:()=>t({pendingWallCornerAdd:null}),placeHostedProductAtSlot:(e,o=[0,0,0])=>{const{pendingHostedProduct:n}=p();if(!n)return null;const s=L(),r={id:s,hostedProductId:n.id,name:n.name,modelUrl:n.modelUrl,position:e,rotation:o,scale:n.scale||[1,1,1]},c=p()._snapshotOverridesOnLoadComplete;return t(l=>({sceneHostedProducts:[...l.sceneHostedProducts,r],pendingHostedProduct:null,showHostedProductSlots:!1,...c?{sceneLoadingMessage:`Placing ${n.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Placing ${n.name}...`}})),s},addHostedProduct:e=>{const o=L(),n={id:o,hostedProductId:e.id,name:e.name,modelUrl:e.modelUrl,position:e.position||[0,0,0],rotation:e.rotation||[0,0,0],scale:e.scale||[1,1,1],...e.pairedWith?{pairedWith:e.pairedWith}:{}},s=p()._snapshotOverridesOnLoadComplete;return t(r=>({sceneHostedProducts:[...r.sceneHostedProducts,n],...s?{sceneLoadingMessage:`Adding ${e.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Adding ${e.name}...`}})),o},setHostedProductLoaded:()=>{p()._snapshotOverridesOnLoadComplete||t({isSceneLoading:!1,sceneLoadingMessage:""})},removeHostedProduct:e=>{t(o=>{const n={...o.occupiedPieceSlots},s={...o.hostWidths},r={...o.hostProductOverrides},c={...o.hostDoorTypes};let l=null,u=null,m=!1;for(const[d,i]of Object.entries(n))i.surfaceHostedProductId===e&&(n[d]={...i},delete n[d].surfaceHostedProductId,m=!0);if(!m){for(const[d,i]of Object.entries(n))if(i.hostedProductId===e){i.surfaceHostedProductId&&(u=i.surfaceHostedProductId),i.previousWidth!==void 0?s[d]=i.previousWidth:delete s[d],i.previousProductOverride!==void 0?r[d]=i.previousProductOverride:delete r[d],i.previousDoorType!==void 0?c[d]=i.previousDoorType:delete c[d];try{const g=T.getState().products||{},h=r[d]??o.basePiecePositions?.[d]?.productId??null,b=h!=null?g[h]||g[String(h)]:null,W=v=>{const _=v?.components_configuration??v?.componentsConfiguration??{},y=_.comp_base_slab??_.comp_corner_slab??null;return String(y?.variant_key??y?.variantKey??"")};if(b){const v=W(b),_=b.product_graph??b.productGraph??null,y=v?Object.values(g).find(w=>{if(!w||w.id===b.id||b.width!=null&&Number(w.width)!==Number(b.width)||_!=null&&(w.product_graph??w.productGraph??null)!==_)return!1;const M=W(w);if(!M||M===v||!v.startsWith(M+"_"))return!1;const I=v.slice(M.length+1);return/^[a-z0-9]+$/i.test(I)}):null;y?.id!=null&&(r[d]=y.id)}}catch{}i.pairedHostedProductId&&(l=i.pairedHostedProductId),delete n[d]}else if(i.linkedToBase){const g=o.occupiedPieceSlots[i.linkedToBase];g&&g.hostedProductId===e&&delete n[d]}}if(!l){const d=o.sceneHostedProducts.find(i=>i.id===e);d?.pairedWithHostedProductId&&(l=d.pairedWithHostedProductId)}if(l)for(const[d,i]of Object.entries(n))i.hostedProductId===l&&i.pairedHostedProductId&&(n[d]={...i},delete n[d].pairedHostedProductId);const P=new Set([e,u].filter(Boolean));for(let d=!0;d;){d=!1;for(const i of o.sceneHostedProducts)P.has(i.id)||i.pairedWithHostedProductId!=null&&P.has(i.pairedWithHostedProductId)&&(P.add(i.id),d=!0)}for(const[d,i]of Object.entries(n))P.has(i.hostedProductId)&&delete n[d];let f=o.sceneHostedProducts.filter(d=>!P.has(d.id));return l&&!P.has(l)&&(f=f.map(d=>d.id===l?{...d,pairedWithHostedProductId:void 0,pairedWithPiece:void 0}:d)),{sceneHostedProducts:f,occupiedPieceSlots:n,hostWidths:s,hostProductOverrides:r,hostDoorTypes:c}})},moveHostedProductLeft:e=>{t(o=>{const n=o.sceneHostedProducts.findIndex(r=>r.id===e);if(n<=0)return o;const s=[...o.sceneHostedProducts];return[s[n-1],s[n]]=[s[n],s[n-1]],{sceneHostedProducts:s}})},moveHostedProductRight:e=>{t(o=>{const n=o.sceneHostedProducts.findIndex(r=>r.id===e);if(n===-1||n>=o.sceneHostedProducts.length-1)return o;const s=[...o.sceneHostedProducts];return[s[n],s[n+1]]=[s[n+1],s[n]],{sceneHostedProducts:s}})},updateHostedProductPosition:(e,o)=>{t(n=>({sceneHostedProducts:n.sceneHostedProducts.map(s=>s.id===e?{...s,position:o}:s)}))},updateHostedProductRotation:(e,o)=>{t(n=>({sceneHostedProducts:n.sceneHostedProducts.map(s=>s.id===e?{...s,rotation:o}:s)}))},clearHostedProducts:()=>{t({sceneHostedProducts:[],occupiedPieceSlots:{}})},occupyPieceSlot:(e,o,n,s)=>{t(r=>({occupiedPieceSlots:{...r.occupiedPieceSlots,[e]:{hostedProductId:o,position:n,rotation:s}}}))},freePieceSlot:e=>{t(o=>{const n={...o.occupiedPieceSlots};return delete n[e],{occupiedPieceSlots:n}})},setHostedProductFeatureForSlot:(e,o,n)=>{t(s=>{const r=s.occupiedPieceSlots[e];return r?{occupiedPieceSlots:{...s.occupiedPieceSlots,[e]:{...r,featureSelections:{...r.featureSelections,[o]:n}}}}:s})},updateHostedProductSlotForProduct:(e,o)=>{const n=p().occupiedPieceSlots[e];if(!n)return;const s=n.hostedProductSlots?.find(r=>r.product_id===o);s&&t(r=>{const c={...r.occupiedPieceSlots[e]};s.component_overrides&&(c.component_overrides=s.component_overrides),s.component_transforms?c.component_transforms=s.component_transforms:delete c.component_transforms;const l=c.hostedProductId;return{occupiedPieceSlots:{...r.occupiedPieceSlots,[e]:c},sceneHostedProducts:r.sceneHostedProducts.map(u=>u.id===l?{...u,modelOffset:s.position||null,modelRotation:s.rotation||null,additionalModels:s.additionalModels||u.additionalModels,...s.modelUrl?{modelUrl:s.modelUrl}:{}}:u)}})},setPieceConfigSnapshot:e=>{t({pieceConfigSnapshot:e})},setInitialPieceConfigSnapshot:e=>{t({initialPieceConfigSnapshot:e})},setInitialPerPieceOverrides:()=>{const e=p(),o=U.getState().sceneSelections;t({initialPerPieceOverrides:{hostFinishes:{...e.hostFinishes},hostStyles:{...e.hostStyles},hostHandleTypes:{...e.hostHandleTypes},hostWidths:{...e.hostWidths},hostDoorTypes:{...e.hostDoorTypes},hostProductOverrides:{...e.hostProductOverrides},hostHardwareFinishes:{...e.hostHardwareFinishes},sceneHostedProducts:[...e.sceneHostedProducts],sceneSelections:{...o}}})},setBasePiecePositions:e=>{const o=p().basePiecePositions||{},n=Object.keys(o),s=Object.keys(e||{});if(n.length===s.length){let r=!1;for(const c of s){const l=o[c],u=e[c];if(!l||!u){r=!0;break}const m=l.position,P=u.position,f=l.rotation||[0,0,0],d=u.rotation||[0,0,0];if(!Array.isArray(m)||!Array.isArray(P)){r=!0;break}if(Math.abs((m[0]||0)-(P[0]||0))>1e-6||Math.abs((m[1]||0)-(P[1]||0))>1e-6||Math.abs((m[2]||0)-(P[2]||0))>1e-6||Math.abs((f[1]||0)-(d[1]||0))>1e-6||String(l.productId??"")!==String(u.productId??"")){r=!0;break}}if(!r)return}t({basePiecePositions:e})},getBasePiecePosition:e=>p().basePiecePositions[e],setSceneModelTransforms:e=>{t({sceneModelTransforms:e})},placeHostedProductAtPiece:(e,o,n,s=[0,0,0],r=null)=>{const c=L();let l=e.placement_type||"replace_full";const u=r||p().basePiecePositions[o]?.productId,m=u!=null?String(u):null,P=T.getState().products||{},f=a=>{if(a==null)return null;const H=P[a]||P[String(a)];return H||Object.values(P).find(O=>O&&C(O.id,a))||null},d=(a,H)=>{const O=f(a),S=f(H);return!O||!S?!1:String(O.id)===String(S.id)};let i=e.slots?.find(a=>a.product_id!=null&&d(a.product_id,u))||e.slots?.find(a=>a.product_id==null)||e.slots?.find(a=>a.product_id!=null&&C(a.product_id,u))||(e.id==="oven_stove"?e.slots?.find(a=>a.product_id!=null&&C(a.product_id,e.target_product_id)):null);const g=E(o);if(g==="corner"||g==="wall_corner"){const a=j(e,P);if(a){const H=f(u),S=(H?.components_configuration??H?.componentsConfiguration??{}).comp_corner_slab,D=String(S?.variant_key??S?.variantKey??"");if(D){const A=T.getState().components||{},x=A.comp_corner_slab??A.comp_corner_slab,F=D+a;x?.variants?.[F]!=null&&(i={...i||{position:null,rotation:null},product_id:null,component_overrides:{...i?.component_overrides||{},comp_corner_slab:{variant_key:F}}},l="replace_components")}}}if(l==="replace_components"){const a=Array.isArray(e.slots)?e.slots:[],H=a.some(S=>S&&S.component_overrides&&Object.keys(S.component_overrides).length>0);!(i?.component_overrides&&Object.keys(i.component_overrides).length>0)&&(a.length===0||!H)&&(l="replace_full")}const b=i?.position||e.componentModelOffset||null,W=i?.rotation||e.componentModelRotation||null,v={id:c,hostedProductId:e.id,name:e.name,modelUrl:i?.modelUrl||e.modelUrl,position:n,rotation:s,scale:e.scale||[1,1,1],placement_type:l,modelOffset:b,modelRotation:W,replacedPiece:o,additionalModels:i?.additionalModels||e.additionalModels||[]},_=Array.isArray(e.hostVariants)&&e.hostVariants.length>0,y={hostedProductId:c,position:n,rotation:s,placement_type:l,isHostSwap:_,compatibleProductIds:e.slots?.map(a=>a.product_id)||[],hostedProductSlots:e.slots||[],featureSelections:(()=>{const a=e.features||[],H=e.feature_defaults||{},O={};for(const S of a){const D=T.getState().features[S];O[S]=H[S]||D?.default_option_id}return O})()};l==="replace_components"&&i?.component_overrides&&(y.component_overrides=i.component_overrides),l==="replace_components"&&i?.component_transforms&&(y.component_transforms=i.component_transforms);const w={},M=e?.target_width??e?.auto_target_width??null,I=p()._snapshotOverridesOnLoadComplete;return t(a=>({sceneHostedProducts:[...a.sceneHostedProducts,v],occupiedPieceSlots:{...a.occupiedPieceSlots,[o]:y,...w},...M!=null?{hostWidths:{...a.hostWidths,[o]:M}}:{},pendingHostedProduct:null,showHostedProductSlots:!1,...I?{sceneLoadingMessage:`Placing ${e.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Placing ${e.name}...`},selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})),c},addSurfaceHostedProduct:(e,o)=>{const n=L(),s={id:n,hostedProductId:e.id,name:e.name,modelUrl:e.modelUrl,position:[0,0,0],rotation:[0,0,0],scale:e.scale||[1,1,1],placement_type:"countertop_overlay",replacedPiece:o},r=p()._snapshotOverridesOnLoadComplete;return t(c=>({sceneHostedProducts:[...c.sceneHostedProducts,s],occupiedPieceSlots:{...c.occupiedPieceSlots,[o]:{...c.occupiedPieceSlots[o],surfaceHostedProductId:n}},pendingHostedProduct:null,showHostedProductSlots:!1,...r?{sceneLoadingMessage:`Placing ${e.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Placing ${e.name}...`},selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})),n},setPair:(e,o,n,s)=>{t(r=>({occupiedPieceSlots:{...r.occupiedPieceSlots,[e]:{...r.occupiedPieceSlots[e],pairedWith:n,pairedHostedProductId:s},[n]:{...r.occupiedPieceSlots[n],pairedWith:e,pairedHostedProductId:o}}}))},setPairing:(e,o,n,s)=>p().setPair(e,o,n,s),showSuccess:e=>p().addNotification({type:"success",message:e}),showError:e=>p().addNotification({type:"error",message:e}),showWarning:e=>p().addNotification({type:"warning",message:e}),showInfo:e=>p().addNotification({type:"info",message:e})}),{name:"ui-store"}));var Z=K;export{Z as default};
1
+ import{HOSTED_PLACEMENT_ID_PREFIX as R}from"./23dc0ccf32.js";import{create as V}from"zustand";import{devtools as k}from"./52436e0169.js";import U from"./d94df858ea.js";import T from"./872c4302e0.js";import{productRefsMatch as C,pieceKindOf as E}from"./9326c23506.js";import{getHostedProductShapeSuffix as j}from"./70dd811d74.js";let $=0;const L=()=>{const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,p=>{const e=Math.random()*16|0;return(p==="x"?e:e&3|8).toString(16)});return`${R}${t}`},K=V(k((t,p)=>({guiVisible:!0,regions:{sidebar:!0,header:!0,toolbar:!0,panels:!0,chat:!0,notifications:!0},ownsSceneGraph:!1,sidebarOpen:!0,sidebarTab:"features",jsonPanelOpen:!0,chatPanelOpen:!1,debugPanelOpen:!1,activeModal:null,modalData:null,modalOpen:!1,notifications:[],constraintWarnings:[],inlineMessages:[],messageModal:null,isExporting:!1,isSharing:!1,isSceneLoading:!1,sceneLoadingMessage:"",isLayoutLoading:!1,isEvaluating:!1,isMobile:!1,mobileMenuOpen:!1,mobileActiveAccordion:"configurator",isLandscapeMode:!1,landscapeMethod:null,landscapeSidebarOpen:!0,liveStatusSummary:"",initialSceneLoading:!1,bootEvaluating:!1,bootLoading:!0,uiReady:!1,markUiReady:()=>t(e=>e.uiReady?e:{uiReady:!0}),bootProgress:null,bootDetail:"",themeReady:!1,setBootPhase:(e,o=null)=>t(n=>n.bootDetail===e&&n.bootProgress===o?n:{bootDetail:e,bootProgress:o}),endBootLoading:()=>t(e=>e.bootLoading?{bootLoading:!1}:e),is3D:!0,showDimensions:!1,showWalls:!0,showFloor:!1,showCeiling:!1,wallOverflowDetected:!1,pieceOverlapDetected:!1,tallWallOverlapDetected:!1,wallPieceOverlapDetected:!1,wallPieceHostedOverlapDetected:!1,skipWallPieceOverlapCheck:!0,overlappingPieces:[],highlightOverlappingPieces:!0,islandOverlapDetected:!1,cornerOverflowDetected:!1,wallOverflowSide:null,wallOverflowRecenterMode:!1,wallOverflowSuppressUntil:0,showWallGuide:!1,captureMode:!1,showOptionLabels:!1,theme:"light",freePieceTier:"single",freePieceWidthOption:"6ft",freePiecePosition:null,freePieceRotation:null,selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null,hostFinishes:{},hostMaterials:{},hostWidths:{},hostDoorTypes:{},hostStyles:{},sceneCapabilities:{dimensions:!0,walls:!0},globals:{},disabledOptions:new Set,hiddenOptions:new Set,currentVisibleOptionSets:null,managedOptionSets:new Set,featureToOptionsMap:{},hostHardwareFinishes:{},hostHandleTypes:{},hostMode:"public",setHostMode:e=>t({hostMode:e==="admin"?"admin":"public"}),finalRenderShowing:!1,setFinalRenderShowing:e=>t({finalRenderShowing:!!e}),hostProductOverrides:{},hostMaterialOverrides:{},sceneHostedProducts:[],pendingHostedProduct:null,showHostedProductSlots:!1,pendingSlotPlacement:null,pendingAutoPlacePieceIdx:null,deferredHostedProductPlacement:null,pendingPieceAdd:null,pendingPieceAddQueue:[],pendingPieceDelete:null,disabledWalls:[],currentLayoutType:"single_wall",currentPerpendicularWalls:[],validCornerSlots:[],pendingWallCornerAdd:null,wallCornerCount:0,validWallCornerSlots:[],occupiedPieceSlots:{},pieceConfigSnapshot:null,initialPieceConfigSnapshot:null,initialPerPieceOverrides:null,_snapshotOverridesOnLoadComplete:!1,basePiecePositions:{},sceneModelTransforms:[],setGuiVisible:e=>t({guiVisible:e}),setRegions:e=>t(o=>({regions:{...o.regions,...e&&typeof e=="object"?e:{}}})),toggleSidebar:()=>{t(e=>({sidebarOpen:!e.sidebarOpen}))},setSidebarOpen:e=>{t({sidebarOpen:e})},closeSidebar:()=>{t({sidebarOpen:!1})},openSidebar:()=>{t({sidebarOpen:!0})},setSidebarTab:e=>{t({sidebarTab:e})},setMobileActiveAccordion:e=>{t({mobileActiveAccordion:e})},toggleMobileAccordion:e=>{t(o=>({mobileActiveAccordion:o.mobileActiveAccordion===e?null:e}))},setLandscapeMode:(e,o=null)=>{t({isLandscapeMode:e,landscapeMethod:e?o:null})},toggleLandscapeSidebar:()=>{t(e=>({landscapeSidebarOpen:!e.landscapeSidebarOpen}))},setLiveStatusSummary:e=>{t({liveStatusSummary:e})},toggleView:()=>{t(e=>({is3D:!e.is3D}))},toggleDimensions:()=>{t(e=>({showDimensions:!e.showDimensions}))},toggleWalls:()=>{t(e=>({showWalls:!e.showWalls}))},toggleFloor:()=>{t(e=>({showFloor:!e.showFloor}))},toggleCeiling:()=>{t(e=>({showCeiling:!e.showCeiling}))},toggleOptionLabels:()=>{t(e=>({showOptionLabels:!e.showOptionLabels}))},toggleJsonPanel:()=>{t(e=>({jsonPanelOpen:!e.jsonPanelOpen}))},setJsonPanelOpen:e=>{t({jsonPanelOpen:e})},toggleChatPanel:()=>{t(e=>({chatPanelOpen:!e.chatPanelOpen}))},setChatPanelOpen:e=>{t({chatPanelOpen:e})},toggleDebugPanel:()=>{t(e=>({debugPanelOpen:!e.debugPanelOpen}))},setDebugPanelOpen:e=>{t({debugPanelOpen:e})},openModal:(e,o=null)=>{t({activeModal:e,modalData:o,modalOpen:!0})},closeModal:()=>{t({activeModal:null,modalData:null,modalOpen:!1})},addNotification:e=>{if(p().isLayoutLoading)return null;const o={type:"info",duration:5e3,...e},n=p().notifications.find(c=>c.type===o.type&&(c.title??"")===(o.title??"")&&c.message===o.message);if(n)return n.id;const s=`${Date.now()}-${++$}`,r={id:s,...o};return t(c=>({notifications:[...c.notifications,r]})),r.duration>0&&setTimeout(()=>{p().removeNotification(s)},r.duration),s},removeNotification:e=>{t(o=>({notifications:o.notifications.filter(n=>n.id!==e)}))},clearNotifications:()=>{t({notifications:[]})},setConstraintWarnings:e=>{t({constraintWarnings:Array.isArray(e)?e:[]})},setInlineMessages:e=>{t({inlineMessages:Array.isArray(e)?e:[]})},lastModalKeys:[],setMessageModal:e=>{t({messageModal:e??null})},dismissMessageModal:()=>{t({messageModal:null})},setExporting:e=>{t({isExporting:e})},setSharing:e=>{t({isSharing:e})},setSceneLoading:(e,o="")=>{t({isSceneLoading:e,sceneLoadingMessage:o})},clearSceneLoading:()=>{const e=p()._snapshotOverridesOnLoadComplete;t({isSceneLoading:!1,sceneLoadingMessage:""}),e&&(p().setInitialPerPieceOverrides(),t({_snapshotOverridesOnLoadComplete:!1,isLayoutLoading:!1,selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null}),import("./1fac915f8b.js").then(o=>o.default.getState().clearHistory()))},setIsMobile:e=>{t({isMobile:e})},toggleMobileMenu:()=>{t(e=>({mobileMenuOpen:!e.mobileMenuOpen}))},setMobileMenuOpen:e=>{t({mobileMenuOpen:e})},setTheme:e=>{t({theme:e}),document.documentElement.setAttribute("data-theme",e)},toggleTheme:()=>{const e=p().theme==="light"?"dark":"light";t({theme:e}),document.documentElement.setAttribute("data-theme",e)},setFreePieceTier:e=>t({freePieceTier:e}),setFreePieceWidthOption:e=>t({freePieceWidthOption:e}),setFreePiecePosition:e=>t({freePiecePosition:e}),setFreePieceRotation:e=>t({freePieceRotation:e}),resetFreePiece:()=>t({freePieceTier:"single",freePieceWidthOption:"6ft",freePiecePosition:null,freePieceRotation:null}),setSelectedFeature:(e,o=null)=>{t({selectedFeatureId:e,selectedElementType:o})},setSelectedPieceIndex:e=>{const o=p().selectedPieceIndex;t({selectedPieceIndex:e});const n=c=>{if(c==null)return null;const l=p().hostProductOverrides?.[c];return l??p().basePiecePositions?.[c]?.productId??null},s=n(o),r=n(e);String(s)!==String(r)&&t({currentVisibleOptionSets:null})},clearSelectedFeature:()=>{t({selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})},setHostFinish:(e,o,n)=>{t(s=>({hostFinishes:{...s.hostFinishes,[e]:o},hostMaterials:{...s.hostMaterials,[e]:n}}))},clearHostFinishes:()=>{t({hostFinishes:{},hostMaterials:{}})},clearHostMaterials:()=>{t({hostMaterials:{}})},setHostStyle:(e,o)=>{t(n=>({hostStyles:{...n.hostStyles,[e]:o}}))},clearHostStyles:()=>{t({hostStyles:{}})},setGlobal:(e,o)=>{t(n=>({globals:{...n.globals,[e]:o}}))},roomFootprint:null,setRoomFootprint:e=>t(o=>{const n=o.roomFootprint;return n&&Math.abs(n.width-e.width)<1e-4&&Math.abs(n.depth-e.depth)<1e-4?o:{roomFootprint:{width:e.width,depth:e.depth}}}),setHostHandleType:(e,o)=>{t(n=>({hostHandleTypes:{...n.hostHandleTypes,[e]:o}}))},clearHostHandleTypes:()=>{t({hostHandleTypes:{}})},setHostHardwareFinish:(e,o)=>{t(n=>({hostHardwareFinishes:{...n.hostHardwareFinishes,[e]:o}}))},clearHostHardwareFinishes:()=>{t({hostHardwareFinishes:{}})},setHostMaterialOverride:(e,o,n)=>{!e||!o||t(s=>({hostMaterialOverrides:{...s.hostMaterialOverrides,[e]:{...s.hostMaterialOverrides[e]||{},[o]:n}}}))},clearHostMaterialOverrides:()=>{t({hostMaterialOverrides:{}})},setHostWidth:(e,o)=>{t(n=>({hostWidths:{...n.hostWidths,[e]:o}}))},clearHostWidths:()=>{t({hostWidths:{}})},setHostDoorType:(e,o,n,s)=>{t(r=>({hostDoorTypes:{...r.hostDoorTypes,[e]:{optionId:o,modelUrl:n,value:s}}}))},clearHostDoorTypes:()=>{t({hostDoorTypes:{}})},setHostProductOverride:(e,o)=>{t(n=>{const s=n.occupiedPieceSlots[e];if(s&&s.compatibleProductIds){const r=String(o);if(!s.compatibleProductIds.some(l=>String(l)===r)){const l={...n.occupiedPieceSlots};return delete l[e],{hostProductOverrides:{...n.hostProductOverrides,[e]:o},sceneHostedProducts:n.sceneHostedProducts.filter(u=>u.id!==s.hostedProductId),occupiedPieceSlots:l}}if(s.hostedProductSlots){const l=s.hostedProductSlots.find(u=>u.product_id!=null&&String(u.product_id)===String(o));if(l){const u={...n.occupiedPieceSlots};u[e]={...s,component_overrides:l.component_overrides||s.component_overrides,component_transforms:l.component_transforms||s.component_transforms};const m=l.position||null,P=l.rotation||null;return{hostProductOverrides:{...n.hostProductOverrides,[e]:o},occupiedPieceSlots:u,sceneHostedProducts:n.sceneHostedProducts.map(f=>f.id===s.hostedProductId?{...f,modelOffset:m,modelRotation:P}:f)}}}}return{hostProductOverrides:{...n.hostProductOverrides,[e]:o}}})},clearHostProductOverrides:()=>{t({hostProductOverrides:{}})},cleanupPieceState:e=>{t(o=>{const n={...o.hostWidths},s={...o.hostProductOverrides},r={...o.hostDoorTypes},c={...o.hostFinishes},l={...o.hostMaterials},u={...o.hostStyles},m={...o.hostHandleTypes},P={...o.occupiedPieceSlots},f=P[e],d=f?.pairedHostedProductId;let i=f?.pairedWith;if(delete n[e],delete s[e],delete r[e],delete c[e],delete l[e],delete u[e],delete m[e],delete P[e],i&&P[i]){const h=P[i];h.previousWidth!==void 0?n[i]=h.previousWidth:delete n[i],h.previousProductOverride!==void 0?s[i]=h.previousProductOverride:delete s[i],h.previousDoorType!==void 0?r[i]=h.previousDoorType:delete r[i],delete P[i]}let g=o.sceneHostedProducts.filter(h=>h.replacedPiece!==e);return d&&(g=g.filter(h=>h.id!==d)),{hostWidths:n,hostProductOverrides:s,hostDoorTypes:r,hostFinishes:c,hostMaterials:l,hostStyles:u,hostHandleTypes:m,occupiedPieceSlots:P,sceneHostedProducts:g}})},setPendingHostedProduct:(e,o={})=>{const n=o.autoPlacePieceIdx??null;t({pendingHostedProduct:e,showHostedProductSlots:!0,pendingAutoPlacePieceIdx:n,selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})},clearPendingAutoPlacePieceIdx:()=>{t({pendingAutoPlacePieceIdx:null})},clearPendingHostedProduct:()=>{t({pendingHostedProduct:null,showHostedProductSlots:!1,pendingAutoPlacePieceIdx:null})},setPendingSlotPlacement:e=>t({pendingSlotPlacement:e||null}),clearPendingSlotPlacement:()=>t({pendingSlotPlacement:null}),setDeferredHostedProductPlacement:e=>t({deferredHostedProductPlacement:e}),clearDeferredHostedProductPlacement:()=>t({deferredHostedProductPlacement:null}),setPendingPieceAdd:e=>t(o=>o.pendingPieceAdd?{pendingPieceAddQueue:[...o.pendingPieceAddQueue,e]}:{pendingPieceAdd:e}),clearPendingPieceAdd:()=>t(e=>{const o=e.pendingPieceAddQueue;if(o.length>0){const[n,...s]=o;return{pendingPieceAdd:n,pendingPieceAddQueue:s}}return{pendingPieceAdd:null}}),setPendingPieceDelete:e=>t({pendingPieceDelete:e}),clearPendingPieceDelete:()=>t({pendingPieceDelete:null}),addDisabledWall:e=>t(o=>({disabledWalls:o.disabledWalls.includes(e)?o.disabledWalls:[...o.disabledWalls,e]})),removeDisabledWall:e=>t(o=>({disabledWalls:o.disabledWalls.filter(n=>n!==e)})),clearDisabledWalls:()=>t({disabledWalls:[]}),setSkipWallPieceOverlapCheck:e=>t({skipWallPieceOverlapCheck:e}),setCurrentLayoutType:e=>t({currentLayoutType:e}),setCurrentPerpendicularWalls:e=>t({currentPerpendicularWalls:e}),setValidCornerSlots:e=>t({validCornerSlots:e}),setWallCornerCount:e=>t({wallCornerCount:e}),setValidWallCornerSlots:e=>t({validWallCornerSlots:e}),clearPendingWallCornerAdd:()=>t({pendingWallCornerAdd:null}),placeHostedProductAtSlot:(e,o=[0,0,0])=>{const{pendingHostedProduct:n}=p();if(!n)return null;const s=L(),r={id:s,hostedProductId:n.id,name:n.name,modelUrl:n.modelUrl,position:e,rotation:o,scale:n.scale||[1,1,1]},c=p()._snapshotOverridesOnLoadComplete;return t(l=>({sceneHostedProducts:[...l.sceneHostedProducts,r],pendingHostedProduct:null,showHostedProductSlots:!1,...c?{sceneLoadingMessage:`Placing ${n.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Placing ${n.name}...`}})),s},addHostedProduct:e=>{const o=L(),n={id:o,hostedProductId:e.id,name:e.name,modelUrl:e.modelUrl,position:e.position||[0,0,0],rotation:e.rotation||[0,0,0],scale:e.scale||[1,1,1],...e.pairedWith?{pairedWith:e.pairedWith}:{}},s=p()._snapshotOverridesOnLoadComplete;return t(r=>({sceneHostedProducts:[...r.sceneHostedProducts,n],...s?{sceneLoadingMessage:`Adding ${e.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Adding ${e.name}...`}})),o},setHostedProductLoaded:()=>{p()._snapshotOverridesOnLoadComplete||t({isSceneLoading:!1,sceneLoadingMessage:""})},removeHostedProduct:e=>{t(o=>{const n={...o.occupiedPieceSlots},s={...o.hostWidths},r={...o.hostProductOverrides},c={...o.hostDoorTypes};let l=null,u=null,m=!1;for(const[d,i]of Object.entries(n))i.surfaceHostedProductId===e&&(n[d]={...i},delete n[d].surfaceHostedProductId,m=!0);if(!m){for(const[d,i]of Object.entries(n))if(i.hostedProductId===e){i.surfaceHostedProductId&&(u=i.surfaceHostedProductId),i.previousWidth!==void 0?s[d]=i.previousWidth:delete s[d],i.previousProductOverride!==void 0?r[d]=i.previousProductOverride:delete r[d],i.previousDoorType!==void 0?c[d]=i.previousDoorType:delete c[d];try{const g=T.getState().products||{},h=r[d]??o.basePiecePositions?.[d]?.productId??null,O=h!=null?g[h]||g[String(h)]:null,W=v=>{const _=v?.components_configuration??v?.componentsConfiguration??{},y=_.comp_base_slab??_.comp_corner_slab??null;return String(y?.variant_key??y?.variantKey??"")};if(O){const v=W(O),_=O.product_graph??O.productGraph??null,y=v?Object.values(g).find(w=>{if(!w||w.id===O.id||O.width!=null&&Number(w.width)!==Number(O.width)||_!=null&&(w.product_graph??w.productGraph??null)!==_)return!1;const M=W(w);if(!M||M===v||!v.startsWith(M+"_"))return!1;const I=v.slice(M.length+1);return/^[a-z0-9]+$/i.test(I)}):null;y?.id!=null&&(r[d]=y.id)}}catch{}i.pairedHostedProductId&&(l=i.pairedHostedProductId),delete n[d]}else if(i.linkedToBase){const g=o.occupiedPieceSlots[i.linkedToBase];g&&g.hostedProductId===e&&delete n[d]}}if(!l){const d=o.sceneHostedProducts.find(i=>i.id===e);d?.pairedWithHostedProductId&&(l=d.pairedWithHostedProductId)}if(l)for(const[d,i]of Object.entries(n))i.hostedProductId===l&&i.pairedHostedProductId&&(n[d]={...i},delete n[d].pairedHostedProductId);const P=new Set([e,u].filter(Boolean));for(let d=!0;d;){d=!1;for(const i of o.sceneHostedProducts)P.has(i.id)||i.pairedWithHostedProductId!=null&&P.has(i.pairedWithHostedProductId)&&(P.add(i.id),d=!0)}for(const[d,i]of Object.entries(n))P.has(i.hostedProductId)&&delete n[d];let f=o.sceneHostedProducts.filter(d=>!P.has(d.id));return l&&!P.has(l)&&(f=f.map(d=>d.id===l?{...d,pairedWithHostedProductId:void 0,pairedWithPiece:void 0}:d)),{sceneHostedProducts:f,occupiedPieceSlots:n,hostWidths:s,hostProductOverrides:r,hostDoorTypes:c}})},moveHostedProductLeft:e=>{t(o=>{const n=o.sceneHostedProducts.findIndex(r=>r.id===e);if(n<=0)return o;const s=[...o.sceneHostedProducts];return[s[n-1],s[n]]=[s[n],s[n-1]],{sceneHostedProducts:s}})},moveHostedProductRight:e=>{t(o=>{const n=o.sceneHostedProducts.findIndex(r=>r.id===e);if(n===-1||n>=o.sceneHostedProducts.length-1)return o;const s=[...o.sceneHostedProducts];return[s[n],s[n+1]]=[s[n+1],s[n]],{sceneHostedProducts:s}})},updateHostedProductPosition:(e,o)=>{t(n=>({sceneHostedProducts:n.sceneHostedProducts.map(s=>s.id===e?{...s,position:o}:s)}))},updateHostedProductRotation:(e,o)=>{t(n=>({sceneHostedProducts:n.sceneHostedProducts.map(s=>s.id===e?{...s,rotation:o}:s)}))},clearHostedProducts:()=>{t({sceneHostedProducts:[],occupiedPieceSlots:{}})},occupyPieceSlot:(e,o,n,s)=>{t(r=>({occupiedPieceSlots:{...r.occupiedPieceSlots,[e]:{hostedProductId:o,position:n,rotation:s}}}))},freePieceSlot:e=>{t(o=>{const n={...o.occupiedPieceSlots};return delete n[e],{occupiedPieceSlots:n}})},setHostedProductFeatureForSlot:(e,o,n)=>{t(s=>{const r=s.occupiedPieceSlots[e];return r?{occupiedPieceSlots:{...s.occupiedPieceSlots,[e]:{...r,featureSelections:{...r.featureSelections,[o]:n}}}}:s})},updateHostedProductSlotForProduct:(e,o)=>{const n=p().occupiedPieceSlots[e];if(!n)return;const s=n.hostedProductSlots?.find(r=>r.product_id===o);s&&t(r=>{const c={...r.occupiedPieceSlots[e]};s.component_overrides&&(c.component_overrides=s.component_overrides),s.component_transforms?c.component_transforms=s.component_transforms:delete c.component_transforms;const l=c.hostedProductId;return{occupiedPieceSlots:{...r.occupiedPieceSlots,[e]:c},sceneHostedProducts:r.sceneHostedProducts.map(u=>u.id===l?{...u,modelOffset:s.position||null,modelRotation:s.rotation||null,additionalModels:s.additionalModels||u.additionalModels,...s.modelUrl?{modelUrl:s.modelUrl}:{}}:u)}})},setPieceConfigSnapshot:e=>{t({pieceConfigSnapshot:e})},setInitialPieceConfigSnapshot:e=>{t({initialPieceConfigSnapshot:e})},setInitialPerPieceOverrides:()=>{const e=p(),o=U.getState().sceneSelections;t({initialPerPieceOverrides:{hostFinishes:{...e.hostFinishes},hostStyles:{...e.hostStyles},hostHandleTypes:{...e.hostHandleTypes},hostWidths:{...e.hostWidths},hostDoorTypes:{...e.hostDoorTypes},hostProductOverrides:{...e.hostProductOverrides},hostHardwareFinishes:{...e.hostHardwareFinishes},sceneHostedProducts:[...e.sceneHostedProducts],sceneSelections:{...o}}})},setBasePiecePositions:e=>{const o=p().basePiecePositions||{},n=Object.keys(o),s=Object.keys(e||{});if(n.length===s.length){let r=!1;for(const c of s){const l=o[c],u=e[c];if(!l||!u){r=!0;break}const m=l.position,P=u.position,f=l.rotation||[0,0,0],d=u.rotation||[0,0,0];if(!Array.isArray(m)||!Array.isArray(P)){r=!0;break}if(Math.abs((m[0]||0)-(P[0]||0))>1e-6||Math.abs((m[1]||0)-(P[1]||0))>1e-6||Math.abs((m[2]||0)-(P[2]||0))>1e-6||Math.abs((f[1]||0)-(d[1]||0))>1e-6||String(l.productId??"")!==String(u.productId??"")){r=!0;break}}if(!r)return}t({basePiecePositions:e})},getBasePiecePosition:e=>p().basePiecePositions[e],setSceneModelTransforms:e=>{t({sceneModelTransforms:e})},placeHostedProductAtPiece:(e,o,n,s=[0,0,0],r=null)=>{const c=L();let l=e.placement_type||"replace_full";const u=r||p().basePiecePositions[o]?.productId,m=u!=null?String(u):null,P=T.getState().products||{},f=a=>{if(a==null)return null;const H=P[a]||P[String(a)];return H||Object.values(P).find(b=>b&&C(b.id,a))||null},d=(a,H)=>{const b=f(a),S=f(H);return!b||!S?!1:String(b.id)===String(S.id)};let i=e.slots?.find(a=>a.product_id!=null&&d(a.product_id,u))||e.slots?.find(a=>a.product_id==null)||e.slots?.find(a=>a.product_id!=null&&C(a.product_id,u))||(e.id==="oven_stove"?e.slots?.find(a=>a.product_id!=null&&C(a.product_id,e.target_product_id)):null);const g=E(o);if(g==="corner"||g==="wall_corner"){const a=j(e,P);if(a){const H=f(u),S=(H?.components_configuration??H?.componentsConfiguration??{}).comp_corner_slab,D=String(S?.variant_key??S?.variantKey??"");if(D){const A=T.getState().components||{},x=A.comp_corner_slab??A.comp_corner_slab,F=D+a;x?.variants?.[F]!=null&&(i={...i||{position:null,rotation:null},product_id:null,component_overrides:{...i?.component_overrides||{},comp_corner_slab:{variant_key:F}}},l="replace_components")}}}if(l==="replace_components"){const a=Array.isArray(e.slots)?e.slots:[],H=a.some(S=>S&&S.component_overrides&&Object.keys(S.component_overrides).length>0);!(i?.component_overrides&&Object.keys(i.component_overrides).length>0)&&(a.length===0||!H)&&(l="replace_full")}const O=i?.position||e.componentModelOffset||null,W=i?.rotation||e.componentModelRotation||null,v={id:c,hostedProductId:e.id,name:e.name,modelUrl:i?.modelUrl||e.modelUrl,position:n,rotation:s,scale:e.scale||[1,1,1],placement_type:l,modelOffset:O,modelRotation:W,replacedPiece:o,additionalModels:i?.additionalModels||e.additionalModels||[]},_=Array.isArray(e.hostVariants)&&e.hostVariants.length>0,y={hostedProductId:c,position:n,rotation:s,placement_type:l,isHostSwap:_,compatibleProductIds:e.slots?.map(a=>a.product_id)||[],hostedProductSlots:e.slots||[],featureSelections:(()=>{const a=e.features||[],H=e.feature_defaults||{},b={};for(const S of a){const D=T.getState().features[S];b[S]=H[S]||D?.default_option_id}return b})()};l==="replace_components"&&i?.component_overrides&&(y.component_overrides=i.component_overrides),l==="replace_components"&&i?.component_transforms&&(y.component_transforms=i.component_transforms);const w={},M=e?.target_width??e?.auto_target_width??null,I=p()._snapshotOverridesOnLoadComplete;return t(a=>({sceneHostedProducts:[...a.sceneHostedProducts,v],occupiedPieceSlots:{...a.occupiedPieceSlots,[o]:y,...w},...M!=null?{hostWidths:{...a.hostWidths,[o]:M}}:{},pendingHostedProduct:null,showHostedProductSlots:!1,...I?{sceneLoadingMessage:`Placing ${e.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Placing ${e.name}...`},selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})),c},addSurfaceHostedProduct:(e,o)=>{const n=L(),s={id:n,hostedProductId:e.id,name:e.name,modelUrl:e.modelUrl,position:[0,0,0],rotation:[0,0,0],scale:e.scale||[1,1,1],placement_type:"countertop_overlay",replacedPiece:o},r=p()._snapshotOverridesOnLoadComplete;return t(c=>({sceneHostedProducts:[...c.sceneHostedProducts,s],occupiedPieceSlots:{...c.occupiedPieceSlots,[o]:{...c.occupiedPieceSlots[o],surfaceHostedProductId:n}},pendingHostedProduct:null,showHostedProductSlots:!1,...r?{sceneLoadingMessage:`Placing ${e.name}...`}:{isSceneLoading:!0,sceneLoadingMessage:`Placing ${e.name}...`},selectedFeatureId:null,selectedElementType:null,selectedPieceIndex:null})),n},setPair:(e,o,n,s)=>{t(r=>({occupiedPieceSlots:{...r.occupiedPieceSlots,[e]:{...r.occupiedPieceSlots[e],pairedWith:n,pairedHostedProductId:s},[n]:{...r.occupiedPieceSlots[n],pairedWith:e,pairedHostedProductId:o}}}))},setPairing:(e,o,n,s)=>p().setPair(e,o,n,s),showSuccess:e=>p().addNotification({type:"success",message:e}),showError:e=>p().addNotification({type:"error",message:e}),showWarning:e=>p().addNotification({type:"warning",message:e}),showInfo:e=>p().addNotification({type:"info",message:e})}),{name:"ui-store"}));var Z=K;export{Z as default};
@@ -1 +1 @@
1
- import t from"react";class e extends t.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(){}render(){return this.state.hasError?null:this.props.children}}var n=e;export{n as default};
1
+ import t from"react";class e extends t.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r){this.props.onError?.(r)}render(){return this.state.hasError?null:this.props.children}}var n=e;export{n as default};
@@ -1 +1 @@
1
- import{Fragment as fe,jsx as e,jsxs as b}from"react/jsx-runtime";import{Suspense as U,useEffect as j,useRef as x,useSyncExternalStore as W}from"react";import{getSceneAccessGranted as A,subscribeSceneAccess as _}from"./87f511c4a8.js";import*as F from"three";import{Canvas as Q,useThree as L}from"@react-three/fiber";import{setSceneContext as T,disposeSceneExtras as q}from"./95a44ebec2.js";import{PerspectiveCamera as J,OrbitControls as K}from"@react-three/drei";import X from"./be337ddda5.js";import O from"./8f60e5059a.js";import"./9c6c598569.js";import Y from"./d4378d9afa.js";import Z from"./00a41227ff.js";import $ from"./28a9d58274.js";import ee from"./8db8655f21.js";import{rememberRenderer as te}from"./b59b0dde17.js";import oe from"./14c83bc57a.js";import{applyEnvironmentToRenderer as re,RENDERER_DEFAULTS as G}from"./4e7d0a0d4a.js";import{setR3FState as z}from"./e1cd279733.js";import{computeTopDownView as ne,computeFitView as ie,ORTHO_FOV as B}from"./85af90fade.js";const V=(t,o)=>t?o:Math.max(o,1e5);function ae({defaultPosition:t,fov:o,controlsRef:a,controlsTarget:p,maxDistance:c}){const{scene:f,size:m,invalidate:h}=L(),u=O(r=>r.is3D)!==!1,g=x(),w=x(u),D=x(!1);return j(()=>{const r=g.current,n=a?.current;if(!r)return;const R=w.current;w.current=u;const C=!D.current;D.current=!0;const y=m.width/Math.max(m.height,1);if(n&&(n.maxDistance=V(u,c)),!u){const i=ne({scene:f,aspect:y,fov:B});if(!i)return;r.fov=B,r.position.set(i.position[0],i.position[1],i.position[2]),r.updateProjectionMatrix(),n&&(n.target.set(i.target[0],i.target[1],i.target[2]),n.update()),h?.();return}if(R&&!C){r.updateProjectionMatrix(),h?.();return}r.fov=o;const S=R?null:ie({scene:f,aspect:y,fov:o}),v=S?.position||t,M=S?.target||p;r.position.set(v[0],v[1],v[2]),r.updateProjectionMatrix(),n&&(n.target.set(M[0],M[1],M[2]),n.update()),h?.()},[u,f,m.width,m.height]),e(J,{ref:g,makeDefault:!0,position:t,fov:o})}function se(){const{gl:t,scene:o,camera:a,invalidate:p}=L(),c=W(_,A,()=>!1);return j(()=>(z({gl:t,scene:o,camera:a}),c?T({THREE:F,scene:o,camera:a,renderer:t,invalidate:p}):T(null),()=>{q(),T(null),z(null)}),[t,o,a,c]),null}function ce({background:t="#f4f4f5"}){return b(fe,{children:[e("color",{attach:"background",args:[t]}),e("ambientLight",{intensity:.7}),e("directionalLight",{position:[4,6,4],intensity:1.1,castShadow:!0,"shadow-mapSize-width":1024,"shadow-mapSize-height":1024})]})}function ue({env:t}){return!!t&&Object.keys(t).length>0?null:b("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.001,0],receiveShadow:!0,children:[e("circleGeometry",{args:[21,64]}),e("shadowMaterial",{transparent:!0,opacity:.28,color:"#000000"})]})}function pe({children:t,overlay:o,isMobile:a=!1,is3D:p,camera:c={position:[2.6,2.2,4],fov:45},controlsTarget:f=[0,.5,0],renderCamera:m=!0,renderControls:h=!0,minDistance:u=1.2,maxDistance:g=14,orbitProps:w,renderFallbackLighting:D=!0,fallbackBackground:r="#f4f4f5",groundShadowCatcher:n=!1,fallback:R=null,dpr:C=[1,2],shadows:y=!0,frameloop:S,canvasStyle:v,onPointerMissed:M,onCreated:i}){const k=x(),P=X(s=>s.systemEnvironment),H=O(s=>s.is3D),I=O(s=>s.captureMode)===!0,E=p??H!==!1,l=P&&Object.keys(P).length>0?P:null,N=V(E,g);return b("div",{className:"scene-canvas",style:{position:"relative",width:"100%",height:"100%"},children:[b(Q,{shadows:y,dpr:C,...S?{frameloop:S}:{},style:{width:"100%",height:"100%",...v||{}},onPointerMissed:M,onCreated:s=>{const{gl:d}=s;te(d),d.outputColorSpace=F.SRGBColorSpace,d.toneMapping=G.toneMapping,d.toneMappingExposure=G.exposure,d.shadowMap.type=G.shadowMapType,l&&re(l,d),A()&&i?.(s)},children:[l&&e(Y,{env:l,isMobile:a,is3D:E,reducedQuality:!!a,captureMode:I}),!l&&D&&e(ce,{background:r}),n&&E&&!I&&e(ue,{env:l}),m&&e(ae,{defaultPosition:c.position,fov:c.fov,controlsRef:k,controlsTarget:f,maxDistance:g}),e(U,{fallback:R,children:t}),h&&e(K,{ref:k,makeDefault:!0,target:f,enablePan:!0,minDistance:u,maxDistance:N,maxPolarAngle:Math.PI/2.05,enableRotate:E,...w||{}}),e(se,{}),e(oe,{controlsRef:k}),e(Z,{})]}),o,e($,{}),e(ee,{})]})}export{pe as default};
1
+ import{Fragment as fe,jsx as e,jsxs as b}from"react/jsx-runtime";import{Suspense as U,useEffect as j,useRef as x,useSyncExternalStore as W}from"react";import{getSceneAccessGranted as A,subscribeSceneAccess as _}from"./87f511c4a8.js";import*as F from"three";import{Canvas as Q,useThree as L}from"@react-three/fiber";import{setSceneContext as T,disposeSceneExtras as q}from"./95a44ebec2.js";import{PerspectiveCamera as J,OrbitControls as K}from"@react-three/drei";import X from"./be337ddda5.js";import O from"./8f60e5059a.js";import"./9c6c598569.js";import Y from"./d4378d9afa.js";import Z from"./00a41227ff.js";import $ from"./28a9d58274.js";import ee from"./8db8655f21.js";import{rememberRenderer as te}from"./b59b0dde17.js";import oe from"./14c83bc57a.js";import{applyEnvironmentToRenderer as re,RENDERER_DEFAULTS as G}from"./4e7d0a0d4a.js";import{setR3FState as z}from"./e1cd279733.js";import{computeTopDownView as ne,computeFitView as ie,ORTHO_FOV as B}from"./85af90fade.js";const V=(t,o)=>t?o:Math.max(o,1e5);function ae({defaultPosition:t,fov:o,controlsRef:a,controlsTarget:p,maxDistance:c}){const{scene:f,size:m,invalidate:h}=L(),u=O(r=>r.is3D)!==!1,g=x(),w=x(u),D=x(!1);return j(()=>{const r=g.current,n=a?.current;if(!r)return;const R=w.current;w.current=u;const C=!D.current;D.current=!0;const y=m.width/Math.max(m.height,1);if(n&&(n.maxDistance=V(u,c)),!u){const i=ne({scene:f,aspect:y,fov:B});if(!i)return;r.fov=B,r.position.set(i.position[0],i.position[1],i.position[2]),r.updateProjectionMatrix(),n&&(n.target.set(i.target[0],i.target[1],i.target[2]),n.update()),h?.();return}if(R&&!C){r.updateProjectionMatrix(),h?.();return}r.fov=o;const S=R?null:ie({scene:f,aspect:y,fov:o}),v=S?.position||t,M=S?.target||p;r.position.set(v[0],v[1],v[2]),r.updateProjectionMatrix(),n&&(n.target.set(M[0],M[1],M[2]),n.update()),h?.()},[u,f,m.width,m.height]),e(J,{ref:g,makeDefault:!0,position:t,fov:o})}function se(){const{gl:t,scene:o,camera:a,invalidate:p}=L(),c=W(_,A,()=>!1);return j(()=>(z({gl:t,scene:o,camera:a}),c?T({THREE:F,scene:o,camera:a,renderer:t,invalidate:p}):T(null),()=>{q(),T(null),z(null)}),[t,o,a,c]),null}function ce({background:t="#f4f4f5"}){return b(fe,{children:[e("color",{attach:"background",args:[t]}),e("ambientLight",{intensity:.7}),e("directionalLight",{position:[4,6,4],intensity:1.1,castShadow:!0,"shadow-mapSize-width":1024,"shadow-mapSize-height":1024})]})}function ue({env:t}){return!!t&&Object.keys(t).length>0?null:b("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.001,0],receiveShadow:!0,children:[e("circleGeometry",{args:[21,64]}),e("shadowMaterial",{transparent:!0,opacity:.28,color:"#000000"})]})}function pe({children:t,overlay:o,isMobile:a=!1,is3D:p,camera:c={position:[2.6,2.2,4],fov:25},controlsTarget:f=[0,.5,0],renderCamera:m=!0,renderControls:h=!0,minDistance:u=1.2,maxDistance:g=14,orbitProps:w,renderFallbackLighting:D=!0,fallbackBackground:r="#f4f4f5",groundShadowCatcher:n=!1,fallback:R=null,dpr:C=[1,2],shadows:y=!0,frameloop:S,canvasStyle:v,onPointerMissed:M,onCreated:i}){const k=x(),P=X(s=>s.systemEnvironment),H=O(s=>s.is3D),I=O(s=>s.captureMode)===!0,E=p??H!==!1,l=P&&Object.keys(P).length>0?P:null,N=V(E,g);return b("div",{className:"scene-canvas",style:{position:"relative",width:"100%",height:"100%"},children:[b(Q,{shadows:y,dpr:C,...S?{frameloop:S}:{},style:{width:"100%",height:"100%",...v||{}},onPointerMissed:M,onCreated:s=>{const{gl:d}=s;te(d),d.outputColorSpace=F.SRGBColorSpace,d.toneMapping=G.toneMapping,d.toneMappingExposure=G.exposure,d.shadowMap.type=G.shadowMapType,l&&re(l,d),A()&&i?.(s)},children:[l&&e(Y,{env:l,isMobile:a,is3D:E,reducedQuality:!!a,captureMode:I}),!l&&D&&e(ce,{background:r}),n&&E&&!I&&e(ue,{env:l}),m&&e(ae,{defaultPosition:c.position,fov:c.fov,controlsRef:k,controlsTarget:f,maxDistance:g}),e(U,{fallback:R,children:t}),h&&e(K,{ref:k,makeDefault:!0,target:f,enablePan:!0,minDistance:u,maxDistance:N,maxPolarAngle:Math.PI/2.05,enableRotate:E,...w||{}}),e(se,{}),e(oe,{controlsRef:k}),e(Z,{})]}),o,e($,{}),e(ee,{})]})}export{pe as default};
@@ -1 +1 @@
1
- import{create as I}from"zustand";import{emitEvent as p,EVENTS as S}from"./2e366d7386.js";import{subscribeWithSelector as g}from"zustand/middleware";import{devtools as v}from"./52436e0169.js";import{v4 as h}from"uuid";import{FRONT_VIEW_POSITION as P,FRONT_VIEW_TARGET as C,PERSPECTIVE_VIEW_DIR_LEFT as T}from"./23dc0ccf32.js";import"./d94df858ea.js";import"./be337ddda5.js";import"./872c4302e0.js";import F from"./8f60e5059a.js";import{getR3FState as u}from"./e1cd279733.js";import{computeTopDownView as O,computeFitView as E,ORTHO_FOV as b,PERSP_FOV as _}from"./85af90fade.js";const N=I(v(g((c,f)=>({activeSceneId:null,activeSceneConfigId:null,productInstances:{},pendingPlacementPiece:null,componentStates:{},placementSelections:{},placementOverrides:{},selectedInstanceId:null,selectedComponentId:null,hoveredInstanceId:null,hoveredComponentId:null,cameraPosition:[0,1.08,3.92],cameraTarget:[0,1,0],cameraFov:45,focusTarget:null,isFocusing:!1,isSceneLoading:!1,viewMode:"3d",initializeScene:e=>{c({activeSceneConfigId:e,isSceneLoading:!0,productInstances:{},componentStates:{},placementOverrides:{},selectedInstanceId:null,selectedComponentId:null})},setActiveSceneId:e=>{c({activeSceneId:e})},addProductInstance:(e,t,o=[0,0,0],n=[0,0,0])=>{const a=h();return c(i=>({productInstances:{...i.productInstances,[a]:{id:a,productId:e,configId:t,position:o,rotation:n,scale:[1,1,1],createdAt:Date.now()}}})),a},removeProductInstance:e=>{c(t=>{const o=t.productInstances||{},n=new Set([String(e)]);let a=!0;for(;a;){a=!1;for(const s of Object.values(o)){const l=String(s?.id??s?.instanceId??"");if(!l||n.has(l))continue;const d=s?.positionedAbove??s?.positioned_above??null;d!=null&&n.has(String(d))&&(n.add(l),a=!0)}}const i={};for(const[s,l]of Object.entries(o))n.has(String(s))||(i[s]=l);const r={};for(const[s,l]of Object.entries(t.componentStates||{}))n.has(String(s))||(r[s]=l);const m=n.has(String(t.selectedInstanceId));return{productInstances:i,componentStates:r,selectedInstanceId:m?null:t.selectedInstanceId,selectedComponentId:m?null:t.selectedComponentId}})},updateInstancePosition:(e,t)=>{c(o=>({productInstances:{...o.productInstances,[e]:{...o.productInstances[e],position:t}}}))},updateInstanceRotation:(e,t)=>{c(o=>({productInstances:{...o.productInstances,[e]:{...o.productInstances[e],rotation:t}}}))},updateInstanceScale:(e,t)=>{c(o=>({productInstances:{...o.productInstances,[e]:{...o.productInstances[e],scale:t}}}))},updateInstanceVariant:(e,t)=>{c(o=>{const n=o.productInstances[e];return n?{productInstances:{...o.productInstances,[e]:{...n,productId:t,variantId:t}}}:o})},setComponentMaterial:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],materialId:o}}}}))},setComponentVariant:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],variant:o}}}}))},setComponentVisibility:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],visible:o}}}}))},setPlacementSelections:(e,t)=>{!e||typeof t!="object"||c(o=>({placementSelections:{...o.placementSelections,[e]:t||{}}}))},setPlacementOverrides:(e,t)=>{e&&c(o=>({placementOverrides:{...o.placementOverrides,[e]:t||{}}}))},setComponentSwap:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],componentId:o}}}}))},initializeComponentStates:(e,t,o={})=>{const n={};t.forEach(a=>{n[a.id]={visible:!0,material:a.default_material,variant:null}}),c(a=>({componentStates:{...a.componentStates,[e]:n}}))},selectInstance:(e,t=null)=>{c({selectedInstanceId:e,selectedComponentId:t});try{p(S.SELECTION_CHANGED,{placementId:e,componentId:t})}catch{}},clearSelection:()=>{c({selectedInstanceId:null,selectedComponentId:null});try{p(S.SELECTION_CHANGED,{placementId:null,componentId:null})}catch{}},setPendingPlacementPiece:e=>c({pendingPlacementPiece:e}),clearPendingPlacementPiece:()=>c({pendingPlacementPiece:null}),setHoveredInstance:(e,t=null)=>{c({hoveredInstanceId:e,hoveredComponentId:t})},setCameraPosition:e=>{c({cameraPosition:e})},setCameraTarget:e=>{c({cameraTarget:e})},setCameraFov:e=>{c({cameraFov:e})},setCameraPreset:(e={})=>{const t=f(),o=Array.isArray(e.position)?e.position:t.cameraPosition,n=Array.isArray(e.target)?e.target:t.cameraTarget,a=Number.isFinite(Number(e.fov))?Number(e.fov):t.cameraFov;if(Number.isFinite(Number(e.fov))){const i=u()?.camera;i&&i.fov!==a&&(i.fov=a,i.updateProjectionMatrix?.())}c({cameraPosition:[...o],cameraTarget:[...n],cameraFov:a,focusTarget:{position:[...o],target:[...n],instant:!!e.instant},isFocusing:!0})},focusOnObject:(e,t,o)=>{const n=Math.max(t*2.5,.8);let a,i,r;if(o!=null){const m=Math.sin(o),s=Math.cos(o);a=e[0]+m*n,i=e[1]+n*.3,r=e[2]+s*n}else a=e[0],i=e[1]+n*.3,r=e[2]+n;c({focusTarget:{position:[a,i,r],target:[...e]},isFocusing:!0})},clearFocus:()=>{c({focusTarget:null,isFocusing:!1})},resetCameraToDefault:(e={})=>{const t=!!e.instant;if(!F.getState().is3D){const r=u(),m=r?.scene,s=r?.gl?.domElement;if(m&&s&&s.clientWidth&&s.clientHeight){const l=O({scene:m,aspect:s.clientWidth/s.clientHeight,fov:b});if(l){c({focusTarget:{position:l.position,target:l.target,instant:t},isFocusing:!0});return}}return}const n=u(),a=n?.scene,i=n?.gl?.domElement;if(a&&i&&i.clientWidth&&i.clientHeight){const r=E({scene:a,aspect:i.clientWidth/i.clientHeight,fov:_,dir:T});if(r){c({focusTarget:{position:r.position,target:r.target,instant:t},isFocusing:!0});return}}c({focusTarget:{position:P,target:C,instant:t},isFocusing:!0})},setViewMode:e=>{c({viewMode:e})},setSceneLoading:e=>{c({isSceneLoading:e})},resetScene:()=>{c({productInstances:{},componentStates:{},placementOverrides:{},selectedInstanceId:null,selectedComponentId:null,hoveredInstanceId:null,hoveredComponentId:null,isSceneLoading:!1})}})),{name:"scene-graph"}));var U=N;export{U as default};
1
+ import{create as I}from"zustand";import{emitEvent as p,EVENTS as S}from"./2e366d7386.js";import{subscribeWithSelector as g}from"zustand/middleware";import{devtools as v}from"./52436e0169.js";import{v4 as h}from"uuid";import{FRONT_VIEW_POSITION as P,FRONT_VIEW_TARGET as C,PERSPECTIVE_VIEW_DIR_LEFT as T}from"./23dc0ccf32.js";import"./d94df858ea.js";import"./be337ddda5.js";import"./872c4302e0.js";import F from"./8f60e5059a.js";import{getR3FState as u}from"./e1cd279733.js";import{computeTopDownView as O,computeFitView as E,ORTHO_FOV as b,PERSP_FOV as _}from"./85af90fade.js";const N=I(v(g((c,f)=>({activeSceneId:null,activeSceneConfigId:null,productInstances:{},pendingPlacementPiece:null,componentStates:{},placementSelections:{},placementOverrides:{},selectedInstanceId:null,selectedComponentId:null,hoveredInstanceId:null,hoveredComponentId:null,cameraPosition:[0,1.08,3.92],cameraTarget:[0,1,0],cameraFov:25,focusTarget:null,isFocusing:!1,isSceneLoading:!1,viewMode:"3d",initializeScene:e=>{c({activeSceneConfigId:e,isSceneLoading:!0,productInstances:{},componentStates:{},placementOverrides:{},selectedInstanceId:null,selectedComponentId:null})},setActiveSceneId:e=>{c({activeSceneId:e})},addProductInstance:(e,t,o=[0,0,0],n=[0,0,0])=>{const a=h();return c(i=>({productInstances:{...i.productInstances,[a]:{id:a,productId:e,configId:t,position:o,rotation:n,scale:[1,1,1],createdAt:Date.now()}}})),a},removeProductInstance:e=>{c(t=>{const o=t.productInstances||{},n=new Set([String(e)]);let a=!0;for(;a;){a=!1;for(const s of Object.values(o)){const l=String(s?.id??s?.instanceId??"");if(!l||n.has(l))continue;const d=s?.positionedAbove??s?.positioned_above??null;d!=null&&n.has(String(d))&&(n.add(l),a=!0)}}const i={};for(const[s,l]of Object.entries(o))n.has(String(s))||(i[s]=l);const r={};for(const[s,l]of Object.entries(t.componentStates||{}))n.has(String(s))||(r[s]=l);const m=n.has(String(t.selectedInstanceId));return{productInstances:i,componentStates:r,selectedInstanceId:m?null:t.selectedInstanceId,selectedComponentId:m?null:t.selectedComponentId}})},updateInstancePosition:(e,t)=>{c(o=>({productInstances:{...o.productInstances,[e]:{...o.productInstances[e],position:t}}}))},updateInstanceRotation:(e,t)=>{c(o=>({productInstances:{...o.productInstances,[e]:{...o.productInstances[e],rotation:t}}}))},updateInstanceScale:(e,t)=>{c(o=>({productInstances:{...o.productInstances,[e]:{...o.productInstances[e],scale:t}}}))},updateInstanceVariant:(e,t)=>{c(o=>{const n=o.productInstances[e];return n?{productInstances:{...o.productInstances,[e]:{...n,productId:t,variantId:t}}}:o})},setComponentMaterial:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],materialId:o}}}}))},setComponentVariant:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],variant:o}}}}))},setComponentVisibility:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],visible:o}}}}))},setPlacementSelections:(e,t)=>{!e||typeof t!="object"||c(o=>({placementSelections:{...o.placementSelections,[e]:t||{}}}))},setPlacementOverrides:(e,t)=>{e&&c(o=>({placementOverrides:{...o.placementOverrides,[e]:t||{}}}))},setComponentSwap:(e,t,o)=>{c(n=>({componentStates:{...n.componentStates,[e]:{...n.componentStates[e],[t]:{...n.componentStates[e]?.[t],componentId:o}}}}))},initializeComponentStates:(e,t,o={})=>{const n={};t.forEach(a=>{n[a.id]={visible:!0,material:a.default_material,variant:null}}),c(a=>({componentStates:{...a.componentStates,[e]:n}}))},selectInstance:(e,t=null)=>{c({selectedInstanceId:e,selectedComponentId:t});try{p(S.SELECTION_CHANGED,{placementId:e,componentId:t})}catch{}},clearSelection:()=>{c({selectedInstanceId:null,selectedComponentId:null});try{p(S.SELECTION_CHANGED,{placementId:null,componentId:null})}catch{}},setPendingPlacementPiece:e=>c({pendingPlacementPiece:e}),clearPendingPlacementPiece:()=>c({pendingPlacementPiece:null}),setHoveredInstance:(e,t=null)=>{c({hoveredInstanceId:e,hoveredComponentId:t})},setCameraPosition:e=>{c({cameraPosition:e})},setCameraTarget:e=>{c({cameraTarget:e})},setCameraFov:e=>{c({cameraFov:e})},setCameraPreset:(e={})=>{const t=f(),o=Array.isArray(e.position)?e.position:t.cameraPosition,n=Array.isArray(e.target)?e.target:t.cameraTarget,a=Number.isFinite(Number(e.fov))?Number(e.fov):t.cameraFov;if(Number.isFinite(Number(e.fov))){const i=u()?.camera;i&&i.fov!==a&&(i.fov=a,i.updateProjectionMatrix?.())}c({cameraPosition:[...o],cameraTarget:[...n],cameraFov:a,focusTarget:{position:[...o],target:[...n],instant:!!e.instant},isFocusing:!0})},focusOnObject:(e,t,o)=>{const n=Math.max(t*2.5,.8);let a,i,r;if(o!=null){const m=Math.sin(o),s=Math.cos(o);a=e[0]+m*n,i=e[1]+n*.3,r=e[2]+s*n}else a=e[0],i=e[1]+n*.3,r=e[2]+n;c({focusTarget:{position:[a,i,r],target:[...e]},isFocusing:!0})},clearFocus:()=>{c({focusTarget:null,isFocusing:!1})},resetCameraToDefault:(e={})=>{const t=!!e.instant;if(!F.getState().is3D){const r=u(),m=r?.scene,s=r?.gl?.domElement;if(m&&s&&s.clientWidth&&s.clientHeight){const l=O({scene:m,aspect:s.clientWidth/s.clientHeight,fov:b});if(l){c({focusTarget:{position:l.position,target:l.target,instant:t},isFocusing:!0});return}}return}const n=u(),a=n?.scene,i=n?.gl?.domElement;if(a&&i&&i.clientWidth&&i.clientHeight){const r=E({scene:a,aspect:i.clientWidth/i.clientHeight,fov:_,dir:T});if(r){c({focusTarget:{position:r.position,target:r.target,instant:t},isFocusing:!0});return}}c({focusTarget:{position:P,target:C,instant:t},isFocusing:!0})},setViewMode:e=>{c({viewMode:e})},setSceneLoading:e=>{c({isSceneLoading:e})},resetScene:()=>{c({productInstances:{},componentStates:{},placementOverrides:{},selectedInstanceId:null,selectedComponentId:null,hoveredInstanceId:null,hoveredComponentId:null,isSceneLoading:!1})}})),{name:"scene-graph"}));var U=N;export{U as default};
@@ -1 +1 @@
1
- import{addProduct as q,removeProduct as N,moveProduct as K,transformProduct as Y,changeProductVariant as z,changeHostVariantForProduct as W,placeHostedProduct as J,applyLayoutPreset as X,setRoomDimensions as Z,restoreConfiguration as $,clearProductOption as ee,selectOptionForProduct as te,selectOptionForScene as oe,clearSceneOption as re}from"./a77b15c0d6.js";import{selectProduct as ne,deselect as se,getSelectedProduct as ae,moveSelectedLeft as ie,moveSelectedRight as le,duplicateSelected as ce,deleteSelected as de,resetScene as ue,undo as me,redo as pe,canUndo as ge,canRedo as fe,clearHistory as Se,toggleDimensions as Pe,toggleWalls as he,toggleFloor as ve,toggleCeiling as ye,resetCamera as Ie,setCameraPreset as be,focusOnObject as Ce,setRoomFootprint as Te,toggleView as Ae,isView3D as Oe,view2D as xe,view3D as Re,toggleSidebar as Ee,setSidebarTab as Me,closeModal as He,notify as Le,setGuiVisible as Be,openQuote as De,setUIRegions as Fe,hideUI as we,showUI as Ue,showInfo as Ge,setSceneLoading as Qe,clearSceneLoading as Ve,setSceneSelection as je,clearSceneSelection as _e,removeSceneInstance as ke,setSceneInstanceVariant as qe,setPendingSlotPlacement as T,clearPendingSlotPlacement as A,clearDeferredHostedProductPlacement as Ne,setHostedProductFeatureForSlot as O,updateHostedProductSlotForProduct as Ke,addHostedProduct as Ye,removeHostedProduct as ze,clearHostedProducts as We,placeHostedProductAtHost as Je}from"./2cafe3274b.js";import{registerPlacementStrategy as Xe,listPlacementStrategies as Ze,hasPlacementStrategy as $e,setPlacementStrategy as et,getPlacementStrategy as tt,clearPlacementStrategy as ot,getPlacementStrategyOverride as rt,resolvePlacementStrategyConfig as nt,setPlacementStrategyConfig as st,placementKit as at,STRATEGIES as it,DEFAULT_STRATEGY_ID as lt,PLACEMENT_TYPES as ct,getPlacementType as dt,currentConfiguratorKey as ut,armPlacement as x,disarmPlacement as R,getPendingPlacement as E,armHostedProduct as M,disarmHostedProduct as H,computeTargets as mt,resolveTarget as pt,registerTargetRenderer as gt}from"./a77b15c0d6.js";import{registerComponentRenderer as ft,registerMaterialResolver as St,registerInteraction as Pt,onSceneReady as ht,readSceneBounds as vt,onSceneSettled as yt,listComponentRenderers as It,listMaterialResolvers as bt,listInteractions as Ct,hideComponent as Tt,showComponent as At,transformComponent as Ot,setComponentMaterial as xt,clearComponentOverrides as Rt,listComponents as Et,setToggles as Mt,getToggles as Ht,registerAssetResolver as Lt,resolveAssetUrl as Bt,registerButton as Dt}from"./a77b15c0d6.js";import{registerComponent as Ft,resolveComponent as wt,hasComponent as Ut,listComponentOverrides as Gt,registerLayout as Qt,resolveLayout as Vt,hasLayout as jt,listLayouts as _t,setLayout as kt,activeLayoutKey as qt,registerRoute as Nt,resolveRoute as Kt,hasRoute as Yt,listRoutes as zt,registerSlot as Wt,listSlots as Jt,hasSlot as Xt,registerAction as Zt,runAction as $t,listActions as eo,actions as to,registerIcon as oo,resolveIcon as ro,listIcons as no,hasIcon as so,registerModal as ao,listModals as io,setLabels as lo,getLabel as co,getLabels as uo,setLocale as mo,getLocale as po,setCurrency as go,getCurrency as fo,isRtl as So,formatMoney as Po,formatNumber as ho,applyTheme as vo,applyThemeById as yo,validateTheme as Io,checkThemeContrast as bo,contrastRatio as Co,applyCustomCss as To,applyFontUrl as Ao}from"./a77b15c0d6.js";import{openModal as Oo}from"./09c4973968.js";import{useComponentRegistry as xo}from"./882bc739c8.js";import{getLastEvaluation as Ro,getEvaluationHistory as Eo,isEvaluationPending as Mo,subscribeEvaluation as Ho,explainOption as Lo}from"./9f474b5d1a.js";import{selectOption as Bo}from"./dbd5ba1d07.js";import P from"./872c4302e0.js";function h(e,o,a){let i=a;if(!i){const l=P.getState().features||{};i=l[e]??l[String(e)]??null}return Bo(e,o,i??{id:e})}const c=e=>String(e??"").trim().toLowerCase();function Do(e,o){const a=P.getState(),i=a.features||{},l=a.options||{},m=t=>i[t]??i[String(t)]??null,d=t=>Object.values(i).filter(r=>c(r?.name)===c(t)),p=Object.entries(l).filter(([,t])=>t&&typeof t=="object").map(([t,r])=>r.id==null?{...r,id:t}:r),b=t=>{const r=Array.isArray(t?.options)?t.options.map(n=>{if(n&&typeof n=="object")return n;const u=l[n]??l[String(n)];return u&&typeof u=="object"?u.id==null?{...u,id:n}:u:n==null?null:{id:n}}):[],s=p.filter(n=>String(n?.optionSetId??n?.option_set_id??"")===String(t?.id??""));return[...r,...s].filter(Boolean)},k=(t,r)=>t.find(s=>String(s?.id)===String(r))??t.find(s=>c(s?.name)===c(r))??null;if(o!=null){const t=m(e)?[m(e)]:d(e);if(!t.length||t.length>1)return null;const r=t[0],s=k(b(r),o);return s?{optionSetId:r.id,optionId:s.id,optionSet:r}:null}const C=p.filter(t=>String(t?.id)===String(e)),S=C.length?C:p.filter(t=>c(t?.name)===c(e)||c(t?.label)===c(e));if(!S.length){const t=m(e)??d(e)[0]??null;if(t){const r=b(t).map(s=>s?.name??s?.id).filter(Boolean);return null}return p.length,null}if(S.length>1)return null;const f=S[0];let g=f.optionSetId??f.option_set_id??null;if(g==null){const t=Object.entries(i).find(([r,s])=>Array.isArray(s?.options)&&s.options.some(n=>{const u=n&&typeof n=="object"?n.id:n;return String(u)===String(f.id)})&&r);t&&(g=t[1]?.id??t[0])}return g==null?null:{optionSetId:g,optionId:f.id,optionSet:m(g)}}function Fo(e,o,a){const l=P.getState().features||{};if(o!=null&&(l[e]!=null||l[String(e)]!=null))return h(e,o,a);const d=Do(e,o);return d?h(d.optionSetId,d.optionId,a??d.optionSet):!1}import{use as L,runIntent as v,INTENTS as y,onEvent as B,onceEvent as D,offEvent as F,on as w,registerEffectHandler as U,onRequest as wo,onResponse as Uo,setTransport as Go,hasTransport as Qo,readBom as Vo,readQuote as I,readGeneratedAssets as jo,getUIRegions as _o,UI_REGIONS as ko,collectGenericBom as qo,setMetadata as No,readMetadata as Ko,serializeMetadata as Yo,restoreMetadata as zo,registerQuoteTemplate as Wo,hasQuoteTemplate as Jo,setQuoteTemplate as Xo,listQuoteTemplates as Zo,activeQuoteTemplateKey as $o,listQuotePdfBuilders as er,buildQuotePdfBlob as tr,saveQuotePdf as or,registerQuotePdf as rr,registerQuotePdfEndpoint as nr,hasQuotePdf as sr,generateSilo as ar,generateLifestyle as ir,generateArAsset as lr,generateBomPdf as cr,generateAll as dr,generationStatus as ur,METADATA_LIMITS as mr}from"./a77b15c0d6.js";import{bootConfigurator as G,mountConfigurator as Q,loadConfigurator as V,configureSDK as j,getVersion as _,saveProject as pr,loadProject as gr,restoreProject as fr,buildShareUrl as Sr,parseShareToken as Pr,getShareToken as hr,fetchEmbedBoot as vr,setEmbedSlug as yr,getEmbedSlug as Ir,setEmbedContext as br,trackEmbed as Cr,setIframeAllowedOrigins as Tr,getIframeAllowedOrigins as Ar,getApiBaseUrl as Or,setApiKey as xr,setChannelId as Rr,getChannelId as Er,setEmbedded as Mr,getEffectiveSelections as Hr,recomputePrice as Lr,getProduct as Br,getProductName as Dr,getPlacedProductName as Fr,getProductVariants as wr,listProducts as Ur,getOptionSet as Gr,getOption as Qr,listOptionSets as Vr,listSceneOptionSets as jr,listProductOptionSets as _r,listOptions as kr,listMaterials as qr,getMaterial as Nr,buildDesignPdf as Kr,captureDesignViews as Yr,generateArForCurrentScene as zr,checkCopilotAvailability as Wr,getCopilotRuntimeUrl as Jr,setCopilotApiUrl as Xr}from"./a77b15c0d6.js";const Zr={add:(e={})=>v({type:y.PRODUCT_ADD,productGraphId:e.productGraphId,variantId:e.variantId,placementGroup:e.placementGroup??null,sequence:e.sequence??null},o=>q({...e,productGraphId:o.productGraphId,variantId:o.variantId,placementGroup:o.placementGroup??e.placementGroup,sequence:o.sequence??e.sequence})),remove:(e,o)=>v({type:y.PRODUCT_REMOVE,placementId:e},a=>N(a.placementId,o)),move:(e={})=>v({type:y.PRODUCT_MOVE,placementId:e.placementId,sequence:e.sequence??null,direction:null},o=>K({...e,placementId:o.placementId,sequence:o.sequence??e.sequence})),transform:Y,changeVariant:z,changeHost:W,addHosted:J,select:ne,deselect:se,getSelected:ae,moveLeft:ie,moveRight:le,duplicate:ce,deleteSelected:de,anchor:x,unanchor:R,getAnchored:E,anchorHosted:M,unanchorHosted:H,arm:x,disarm:R,getArmed:E,armHosted:M,disarmHosted:H,hosted:{add:Ye,remove:ze,clear:We,placeAtHost:Je}},$r={select:Fo,selectByIds:h,selectForProduct:te,clearForProduct:ee,selectForScene:oe,clearForScene:re,effective:Hr},en={applyPreset:X,setRoomDimensions:Z,setRoomFootprint:Te,restoreState:$,reset:ue,recomputePrice:Lr,camera:{reset:Ie,preset:be,focusOn:Ce},view:{toggle:Ae,is3D:Oe,to2D:xe,to3D:Re},toggle:{dimensions:Pe,walls:he,floor:ve,ceiling:ye},onReady:ht,readBounds:vt,onSettled:yt,registerRenderer:ft,registerMaterial:St,registerInteraction:Pt,listRenderers:It,listMaterials:bt,listInteractions:Ct,capture:Yr,buildPdf:Kr,generateAr:zr,setSelection:je,clearSelection:_e,removeInstance:ke,setInstanceVariant:qe,anchorSlot:T,unanchorSlot:A,armSlot:T,disarmSlot:A,clearDeferredHostedPlacement:Ne,setHostedOptionForSlot:O,setHostedFeatureForSlot:O,moveHostedToSlot:Ke,hideComponent:Tt,showComponent:At,transformComponent:Ot,setComponentMaterial:xt,clearComponentOverrides:Rt,listComponents:Et},tn={registerComponent:Ft,resolveComponent:wt,hasComponent:Ut,listComponentOverrides:Gt,useComponentRegistry:xo,registerLayout:Qt,resolveLayout:Vt,hasLayout:jt,listLayouts:_t,activeLayout:qt,setLayout:kt,registerRoute:Nt,resolveRoute:Kt,hasRoute:Yt,listRoutes:zt,setToggles:Mt,getToggles:Ht,registerAssetResolver:Lt,resolveAssetUrl:Bt,registerButton:Dt,registerSlot:Wt,listSlots:Jt,hasSlot:Xt,registerAction:Zt,runAction:$t,listActions:eo,actions:to,registerIcon:oo,resolveIcon:ro,listIcons:no,hasIcon:so,registerModal:ao,openModal:Oo,closeModal:He,listModals:io,setLabels:lo,getLabel:co,getLabels:uo,setLocale:mo,getLocale:po,setCurrency:go,getCurrency:fo,isRtl:So,formatMoney:Po,formatNumber:ho,applyTheme:vo,applyThemeById:yo,validateTheme:Io,checkThemeContrast:bo,contrastRatio:Co,applyCustomCss:To,applyFontUrl:Ao,hide:we,show:Ue,setVisible:Fe,visible:_o,regions:ko,sidebar:{toggle:Ee,setTab:Me},notify:Le,setSceneOverlaysVisible:Be,showInfo:Ge,setLoading:Qe,clearLoading:Ve},on={read:I,registerTemplate:Wo,hasTemplate:Jo,setTemplate:Xo,listTemplates:Zo,activeTemplate:$o,listPdfBuilders:er,open:De,images:jo,generateSilo:ar,generateLifestyle:ir,generateAr:lr,generateBomPdf:cr,generateAll:dr,generationStatus:ur,toPdf:(e={})=>tr(I(),e),savePdf:(e={})=>or(I(),e),registerPdf:rr,registerPdfEndpoint:nr,hasPdf:sr,setDocument:_n,hasDocument:kn,resetDocument:qn},rn={registerStrategy:Xe,listStrategies:Ze,hasStrategy:$e,setStrategy:et,strategyOverride:rt,config:nt,setConfig:st,kit:at,getStrategy:tt,clearStrategy:ot,computeTargets:mt,resolveTarget:pt,registerTargetRenderer:gt,getType:dt,currentKey:ut,STRATEGIES:it,DEFAULT_STRATEGY_ID:lt,TYPES:ct},nn={readBom:Vo,collectBom:qo,setMetadata:No,readMetadata:Ko,serializeMetadata:Yo,restoreMetadata:zo,LIMITS:mr},sn={onRequest:wo,onResponse:Uo,setTransport:Go,hasTransport:Qo},an={save:pr,load:gr,restore:fr,shareUrl:Sr,parseShareToken:Pr,getShareToken:hr},ln={undo:me,redo:pe,canUndo:ge,canRedo:fe,clear:Se},cn={fetchBoot:vr,setSlug:yr,getSlug:Ir,setContext:br,track:Cr,setEmbedded:Mr,setAllowedOrigins:Tr,getAllowedOrigins:Ar},dn={isAvailable:Wr,runtimeUrl:Jr,setApiUrl:Xr},Os={quota:us},un={getProduct:Br,getProductName:Dr,getProductVariants:wr,getPlacedProductName:Fr,listProducts:Ur,listOptionSets:Vr,listSceneOptionSets:jr,listProductOptionSets:_r,listOptions:kr,listMaterials:qr,getMaterial:Nr,getOptionSet:Gr,getOption:Qr},xs={last:Ro,history:Eo,pending:Mo,subscribe:Ho,explainOption:Lo},mn={getApiBaseUrl:Or,setChannelId:Rr,getChannelId:Er,setApiKey:xr};import{default as qs}from"./2990ba64d6.js";import{useComponentRegistry as Ks}from"./882bc739c8.js";import{default as zs}from"./60d697292c.js";import{default as Js}from"./6ba86aa3b8.js";import{default as Zs}from"./811b403d43.js";import{useSelection as ea,useProducts as ta,usePrice as oa}from"./16a399703e.js";import{default as na}from"./d0f9681634.js";import{useBootStatus as aa,useSystem as ia}from"./066fc9aa40.js";import{useEvaluation as ca}from"./9f474b5d1a.js";import{useLabel as ua,useLabels as ma,useFormatters as pa}from"./28d887bf8a.js";import{useProduct as fa,useCatalogMaps as Sa}from"./1458417bdb.js";import{useSceneState as ha}from"./16a399703e.js";import{useUIState as ya,useOptionGating as Ia,useHostedProductState as ba,useUIRegion as Ca,useUIRegions as Ta}from"./9840b9ce12.js";import{useSystemConfig as Oa}from"./6855e6a3b1.js";import{useIcon as Ra}from"./09c4973968.js";import{default as Ma}from"./921bf270dd.js";import{usePlacementInteraction as La}from"./4b8958aa4c.js";import{default as Da}from"./f11a45a150.js";import{useCopilotAvailable as wa}from"./672404d987.js";import pn from"./3fb3ab6757.js";import gn from"./7206ce49c6.js";import fn from"./0f7c8345a8.js";import Sn from"./82a8a4bc35.js";import Pn from"./e379e0039b.js";import{Sidebar as hn,SaveProjectButton as vn,GenerateAssetsButton as yn,LiveStatusPanel as In,ChatBar as bn,NotificationContainer as Cn,EvaluatingOverlay as Tn,Modals as An,SaveProjectModal as On,ExportModal as xn,ARModal as Rn,GeneratedAssetsModal as En,Header as Mn,SceneToolbar as Hn,SidebarFrame as Ln,OptionSidebar as Bn,LoadingScreen as Dn,ConfirmDialog as Fn,Modal as wn,Button as Un,ARViewer as Gn,SceneRoom as Qn,SceneDimensions as Vn,CameraAnimator as jn}from"./64e9020b49.js";import{setQuoteDocument as _n,hasQuoteDocument as kn,resetQuoteDocument as qn}from"./12b8165d6d.js";import{SlotHost as Nn}from"./73f7d65985.js";import{ModalHost as Kn}from"./09c4973968.js";import{OptionThumbnail as Yn,FinishThumbnail as zn,LayoutThumbnail as Wn,ColorSwatch as Jn,WidthSlider as Xn,FrameSizeButton as Zn,HostedProductThumbnail as $n,ProductFeaturePickers as es,AddProductToggle as ts}from"./c12c112c6f.js";import{ProductInstance as os,ComponentMesh as rs,SceneStage as ns,SceneEnvironment as ss,SelectionBox as as,FreeMovable as is,PlacementGaps as ls,SelectionActionPanel as cs}from"./8a3a57c008.js";import ds from"./205827c5c8.js";import{refreshAiQuota as us}from"./2f8cc8b292.js";const ms={Sidebar:hn,SidebarFrame:Ln,OptionSetSection:pn,OptionThumbnail:Yn,FinishThumbnail:zn,LayoutThumbnail:Wn,ColorSwatch:Jn,WidthSlider:Xn,FrameSizeButton:Zn,HostedProductThumbnail:$n,ProductFeaturePickers:es,AddProductToggle:ts,QuoteRenders:fn,QuoteQr:Pn,ConfigurationSummary:Sn,SaveProjectButton:vn,GenerateAssetsButton:yn,LiveStatusPanel:In,ChatBar:bn,NotificationContainer:Cn,EvaluatingOverlay:Tn,Header:Mn,SceneToolbar:Hn,OptionSidebar:Bn,LoadingScreen:Dn,Modals:An,SaveProjectModal:On,ExportModal:xn,ARModal:Rn,GeneratedAssetsModal:En,Modal:wn,Button:Un,ConfirmDialog:Fn,ARViewer:Gn,SceneRoom:Qn,SceneDimensions:Vn,CameraAnimator:jn,Popover:gn,SlotHost:Nn,ModalHost:Kn,ProductInstance:os,ComponentMesh:rs,SceneStage:ns,SceneEnvironment:ss,SelectionBox:as,FreeMovable:is,PlacementGaps:ls,PlacementTargets:ds,SelectionActionPanel:cs},ps={products:Zr,options:$r,scene:en,ui:tn,placement:rn,commerce:nn,http:sn,project:an,history:ln,embed:cn,config:mn,copilot:dn,catalog:un,parts:ms,quote:on,boot:G,mount:Q,load:V,configure:j,version:_,on:B,once:D,off:F,onBackendEvent:w,registerEffectHandler:U,addMiddleware:L};var js=ps;export{L as addMiddleware,Os as ai,G as boot,un as catalog,nn as commerce,mn as config,j as configure,dn as copilot,js as default,cn as embed,xs as evaluation,ln as history,sn as http,V as load,Q as mount,F as off,B as on,w as onBackendEvent,D as once,$r as options,ms as parts,rn as placement,Zr as products,an as project,on as quote,U as registerEffectHandler,en as scene,tn as ui,Da as useAppVersion,aa as useBootStatus,Sa as useCatalogMaps,Ks as useComponentRegistry,wa as useCopilotAvailable,ca as useEvaluation,pa as useFormatters,Ma as useGenerateAssets,ba as useHostedProductState,Ra as useIcon,ua as useLabel,ma as useLabels,Ia as useOptionGating,qs as useOptionSets,La as usePlacementInteraction,oa as usePrice,fa as useProduct,zs as useProductOrder,Js as useProductOverrides,ta as useProducts,ha as useSceneState,ea as useSelection,Zs as useSelectionActions,ia as useSystem,Oa as useSystemConfig,na as useToolbar,Ca as useUIRegion,Ta as useUIRegions,ya as useUIState,_ as version};
1
+ import{addProduct as q,removeProduct as N,moveProduct as K,transformProduct as z,changeProductVariant as Y,changeHostVariantForProduct as W,placeHostedProduct as J,applyLayoutPreset as X,setRoomDimensions as Z,restoreConfiguration as $,clearProductOption as ee,selectOptionForProduct as te,selectOptionForScene as oe,clearSceneOption as re}from"./a77b15c0d6.js";import{selectProduct as ne,deselect as se,getSelectedProduct as ae,moveSelectedLeft as ie,moveSelectedRight as le,duplicateSelected as ce,deleteSelected as de,resetScene as ue,undo as me,redo as pe,canUndo as ge,canRedo as fe,clearHistory as Se,toggleDimensions as Pe,toggleWalls as he,toggleFloor as ve,toggleCeiling as ye,resetCamera as Ie,setCameraPreset as be,focusOnObject as Ce,setRoomFootprint as Te,toggleView as Ae,isView3D as Oe,view2D as xe,view3D as Re,toggleSidebar as Ee,setSidebarTab as Me,closeModal as He,notify as Le,setGuiVisible as Be,openQuote as De,setUIRegions as Fe,hideUI as we,showUI as Ue,showInfo as Ge,setSceneLoading as Qe,clearSceneLoading as Ve,setSceneSelection as je,clearSceneSelection as _e,removeSceneInstance as ke,setSceneInstanceVariant as qe,setPendingSlotPlacement as T,clearPendingSlotPlacement as A,clearDeferredHostedProductPlacement as Ne,setHostedProductFeatureForSlot as O,updateHostedProductSlotForProduct as Ke,addHostedProduct as ze,removeHostedProduct as Ye,clearHostedProducts as We,placeHostedProductAtHost as Je}from"./2cafe3274b.js";import{registerPlacementStrategy as Xe,listPlacementStrategies as Ze,hasPlacementStrategy as $e,setPlacementStrategy as et,getPlacementStrategy as tt,clearPlacementStrategy as ot,getPlacementStrategyOverride as rt,resolvePlacementStrategyConfig as nt,setPlacementStrategyConfig as st,placementKit as at,STRATEGIES as it,DEFAULT_STRATEGY_ID as lt,PLACEMENT_TYPES as ct,getPlacementType as dt,currentConfiguratorKey as ut,armPlacement as x,disarmPlacement as R,getPendingPlacement as E,armHostedProduct as M,disarmHostedProduct as H,computeTargets as mt,resolveTarget as pt,registerTargetRenderer as gt}from"./a77b15c0d6.js";import{registerComponentRenderer as ft,registerMaterialResolver as St,registerInteraction as Pt,onSceneReady as ht,readSceneBounds as vt,onSceneSettled as yt,listComponentRenderers as It,listMaterialResolvers as bt,listInteractions as Ct,hideComponent as Tt,showComponent as At,transformComponent as Ot,setComponentMaterial as xt,clearComponentOverrides as Rt,listComponents as Et,setToggles as Mt,getToggles as Ht,registerAssetResolver as Lt,resolveAssetUrl as Bt,registerButton as Dt}from"./a77b15c0d6.js";import{registerComponent as Ft,resolveComponent as wt,hasComponent as Ut,listComponentOverrides as Gt,registerLayout as Qt,resolveLayout as Vt,hasLayout as jt,listLayouts as _t,setLayout as kt,activeLayoutKey as qt,registerRoute as Nt,resolveRoute as Kt,hasRoute as zt,listRoutes as Yt,registerSlot as Wt,listSlots as Jt,hasSlot as Xt,registerAction as Zt,runAction as $t,listActions as eo,actions as to,registerIcon as oo,resolveIcon as ro,listIcons as no,hasIcon as so,registerModal as ao,listModals as io,setLabels as lo,getLabel as co,getLabels as uo,setLocale as mo,getLocale as po,setCurrency as go,getCurrency as fo,isRtl as So,formatMoney as Po,formatNumber as ho,applyTheme as vo,applyThemeById as yo,validateTheme as Io,checkThemeContrast as bo,contrastRatio as Co,applyCustomCss as To,applyFontUrl as Ao}from"./a77b15c0d6.js";import{openModal as Oo}from"./09c4973968.js";import{useComponentRegistry as xo}from"./882bc739c8.js";import{getLastEvaluation as Ro,getEvaluationHistory as Eo,isEvaluationPending as Mo,subscribeEvaluation as Ho,explainOption as Lo}from"./9f474b5d1a.js";import{selectOption as Bo}from"./dbd5ba1d07.js";import P from"./872c4302e0.js";import{getViews as Do,getImage as Fo,getFrames as wo,getLayers as Uo}from"./c245393c92.js";function h(e,o,a){let i=a;if(!i){const l=P.getState().features||{};i=l[e]??l[String(e)]??null}return Bo(e,o,i??{id:e})}const c=e=>String(e??"").trim().toLowerCase();function Go(e,o){const a=P.getState(),i=a.features||{},l=a.options||{},m=t=>i[t]??i[String(t)]??null,d=t=>Object.values(i).filter(r=>c(r?.name)===c(t)),p=Object.entries(l).filter(([,t])=>t&&typeof t=="object").map(([t,r])=>r.id==null?{...r,id:t}:r),b=t=>{const r=Array.isArray(t?.options)?t.options.map(n=>{if(n&&typeof n=="object")return n;const u=l[n]??l[String(n)];return u&&typeof u=="object"?u.id==null?{...u,id:n}:u:n==null?null:{id:n}}):[],s=p.filter(n=>String(n?.optionSetId??n?.option_set_id??"")===String(t?.id??""));return[...r,...s].filter(Boolean)},k=(t,r)=>t.find(s=>String(s?.id)===String(r))??t.find(s=>c(s?.name)===c(r))??null;if(o!=null){const t=m(e)?[m(e)]:d(e);if(!t.length||t.length>1)return null;const r=t[0],s=k(b(r),o);return s?{optionSetId:r.id,optionId:s.id,optionSet:r}:null}const C=p.filter(t=>String(t?.id)===String(e)),S=C.length?C:p.filter(t=>c(t?.name)===c(e)||c(t?.label)===c(e));if(!S.length){const t=m(e)??d(e)[0]??null;if(t){const r=b(t).map(s=>s?.name??s?.id).filter(Boolean);return null}return p.length,null}if(S.length>1)return null;const f=S[0];let g=f.optionSetId??f.option_set_id??null;if(g==null){const t=Object.entries(i).find(([r,s])=>Array.isArray(s?.options)&&s.options.some(n=>{const u=n&&typeof n=="object"?n.id:n;return String(u)===String(f.id)})&&r);t&&(g=t[1]?.id??t[0])}return g==null?null:{optionSetId:g,optionId:f.id,optionSet:m(g)}}function Qo(e,o,a){const l=P.getState().features||{};if(o!=null&&(l[e]!=null||l[String(e)]!=null))return h(e,o,a);const d=Go(e,o);return d?h(d.optionSetId,d.optionId,a??d.optionSet):!1}import{use as L,runIntent as v,INTENTS as y,onEvent as B,onceEvent as D,offEvent as F,on as w,registerEffectHandler as U,onRequest as Vo,onResponse as jo,setTransport as _o,hasTransport as ko,readBom as qo,readQuote as I,readGeneratedAssets as No,getUIRegions as Ko,UI_REGIONS as zo,collectGenericBom as Yo,setMetadata as Wo,readMetadata as Jo,serializeMetadata as Xo,restoreMetadata as Zo,registerQuoteTemplate as $o,hasQuoteTemplate as er,setQuoteTemplate as tr,listQuoteTemplates as or,activeQuoteTemplateKey as rr,listQuotePdfBuilders as nr,buildQuotePdfBlob as sr,saveQuotePdf as ar,registerQuotePdf as ir,registerQuotePdfEndpoint as lr,hasQuotePdf as cr,generateSilo as dr,generateLifestyle as ur,generateArAsset as mr,generateBomPdf as pr,generateAll as gr,generationStatus as fr,METADATA_LIMITS as Sr}from"./a77b15c0d6.js";import{bootConfigurator as G,mountConfigurator as Q,loadConfigurator as V,configureSDK as j,getVersion as _,saveProject as Pr,loadProject as hr,restoreProject as vr,buildShareUrl as yr,parseShareToken as Ir,getShareToken as br,fetchEmbedBoot as Cr,setEmbedSlug as Tr,getEmbedSlug as Ar,setEmbedContext as Or,trackEmbed as xr,setIframeAllowedOrigins as Rr,getIframeAllowedOrigins as Er,getApiBaseUrl as Mr,setApiKey as Hr,setChannelId as Lr,getChannelId as Br,setOrganizationId as Dr,getOrganizationId as Fr,setEmbedded as wr,getEffectiveSelections as Ur,recomputePrice as Gr,getProduct as Qr,getProductName as Vr,getPlacedProductName as jr,getProductVariants as _r,listProducts as kr,getOptionSet as qr,getOption as Nr,listOptionSets as Kr,listSceneOptionSets as zr,listProductOptionSets as Yr,listOptions as Wr,listMaterials as Jr,getMaterial as Xr,buildDesignPdf as Zr,captureDesignViews as $r,generateArForCurrentScene as en,checkCopilotAvailability as tn,getCopilotRuntimeUrl as on,setCopilotApiUrl as rn}from"./a77b15c0d6.js";const nn={add:(e={})=>v({type:y.PRODUCT_ADD,productGraphId:e.productGraphId,variantId:e.variantId,placementGroup:e.placementGroup??null,sequence:e.sequence??null},o=>q({...e,productGraphId:o.productGraphId,variantId:o.variantId,placementGroup:o.placementGroup??e.placementGroup,sequence:o.sequence??e.sequence})),remove:(e,o)=>v({type:y.PRODUCT_REMOVE,placementId:e},a=>N(a.placementId,o)),move:(e={})=>v({type:y.PRODUCT_MOVE,placementId:e.placementId,sequence:e.sequence??null,direction:null},o=>K({...e,placementId:o.placementId,sequence:o.sequence??e.sequence})),transform:z,changeVariant:Y,changeHost:W,addHosted:J,select:ne,deselect:se,getSelected:ae,moveLeft:ie,moveRight:le,duplicate:ce,deleteSelected:de,anchor:x,unanchor:R,getAnchored:E,anchorHosted:M,unanchorHosted:H,arm:x,disarm:R,getArmed:E,armHosted:M,disarmHosted:H,hosted:{add:ze,remove:Ye,clear:We,placeAtHost:Je}},sn={select:Qo,selectByIds:h,selectForProduct:te,clearForProduct:ee,selectForScene:oe,clearForScene:re,effective:Ur},an={applyPreset:X,setRoomDimensions:Z,setRoomFootprint:Te,restoreState:$,reset:ue,recomputePrice:Gr,camera:{reset:Ie,preset:be,focusOn:Ce},view:{toggle:Ae,is3D:Oe,to2D:xe,to3D:Re},toggle:{dimensions:Pe,walls:he,floor:ve,ceiling:ye},onReady:ht,readBounds:vt,onSettled:yt,registerRenderer:ft,registerMaterial:St,registerInteraction:Pt,listRenderers:It,listMaterials:bt,listInteractions:Ct,capture:$r,buildPdf:Zr,generateAr:en,setSelection:je,clearSelection:_e,removeInstance:ke,setInstanceVariant:qe,anchorSlot:T,unanchorSlot:A,armSlot:T,disarmSlot:A,clearDeferredHostedPlacement:Ne,setHostedOptionForSlot:O,setHostedFeatureForSlot:O,moveHostedToSlot:Ke,hideComponent:Tt,showComponent:At,transformComponent:Ot,setComponentMaterial:xt,clearComponentOverrides:Rt,listComponents:Et},ln={registerComponent:Ft,resolveComponent:wt,hasComponent:Ut,listComponentOverrides:Gt,useComponentRegistry:xo,registerLayout:Qt,resolveLayout:Vt,hasLayout:jt,listLayouts:_t,activeLayout:qt,setLayout:kt,registerRoute:Nt,resolveRoute:Kt,hasRoute:zt,listRoutes:Yt,setToggles:Mt,getToggles:Ht,registerAssetResolver:Lt,resolveAssetUrl:Bt,registerButton:Dt,registerSlot:Wt,listSlots:Jt,hasSlot:Xt,registerAction:Zt,runAction:$t,listActions:eo,actions:to,registerIcon:oo,resolveIcon:ro,listIcons:no,hasIcon:so,registerModal:ao,openModal:Oo,closeModal:He,listModals:io,setLabels:lo,getLabel:co,getLabels:uo,setLocale:mo,getLocale:po,setCurrency:go,getCurrency:fo,isRtl:So,formatMoney:Po,formatNumber:ho,applyTheme:vo,applyThemeById:yo,validateTheme:Io,checkThemeContrast:bo,contrastRatio:Co,applyCustomCss:To,applyFontUrl:Ao,hide:we,show:Ue,setVisible:Fe,visible:Ko,regions:zo,sidebar:{toggle:Ee,setTab:Me},notify:Le,setSceneOverlaysVisible:Be,showInfo:Ge,setLoading:Qe,clearLoading:Ve},cn={read:I,registerTemplate:$o,hasTemplate:er,setTemplate:tr,listTemplates:or,activeTemplate:rr,listPdfBuilders:nr,open:De,images:No,generateSilo:dr,generateLifestyle:ur,generateAr:mr,generateBomPdf:pr,generateAll:gr,generationStatus:fr,toPdf:(e={})=>sr(I(),e),savePdf:(e={})=>ar(I(),e),registerPdf:ir,registerPdfEndpoint:lr,hasPdf:cr,setDocument:Yn,hasDocument:Wn,resetDocument:Jn},dn={registerStrategy:Xe,listStrategies:Ze,hasStrategy:$e,setStrategy:et,strategyOverride:rt,config:nt,setConfig:st,kit:at,getStrategy:tt,clearStrategy:ot,computeTargets:mt,resolveTarget:pt,registerTargetRenderer:gt,getType:dt,currentKey:ut,STRATEGIES:it,DEFAULT_STRATEGY_ID:lt,TYPES:ct},un={readBom:qo,collectBom:Yo,setMetadata:Wo,readMetadata:Jo,serializeMetadata:Xo,restoreMetadata:Zo,LIMITS:Sr},mn={onRequest:Vo,onResponse:jo,setTransport:_o,hasTransport:ko},pn={save:Pr,load:hr,restore:vr,shareUrl:yr,parseShareToken:Ir,getShareToken:br},Bs={getViews:Do,getImage:Fo,getFrames:wo,getLayers:Uo},gn={undo:me,redo:pe,canUndo:ge,canRedo:fe,clear:Se},fn={fetchBoot:Cr,setSlug:Tr,getSlug:Ar,setContext:Or,track:xr,setEmbedded:wr,setAllowedOrigins:Rr,getAllowedOrigins:Er},Sn={isAvailable:tn,runtimeUrl:on,setApiUrl:rn},Ds={quota:Ps},Pn={getProduct:Qr,getProductName:Vr,getProductVariants:_r,getPlacedProductName:jr,listProducts:kr,listOptionSets:Kr,listSceneOptionSets:zr,listProductOptionSets:Yr,listOptions:Wr,listMaterials:Jr,getMaterial:Xr,getOptionSet:qr,getOption:Nr},Fs={last:Ro,history:Eo,pending:Mo,subscribe:Ho,explainOption:Lo},hn={getApiBaseUrl:Mr,setChannelId:Lr,getChannelId:Br,setApiKey:Hr,setOrganizationId:Dr,getOrganizationId:Fr};import{default as Zs}from"./2990ba64d6.js";import{useComponentRegistry as ea}from"./882bc739c8.js";import{default as oa}from"./60d697292c.js";import{default as na}from"./6ba86aa3b8.js";import{default as aa}from"./811b403d43.js";import{useSelection as la,useProducts as ca,usePrice as da}from"./16a399703e.js";import{default as ma}from"./d0f9681634.js";import{useBootStatus as ga,useSystem as fa}from"./066fc9aa40.js";import{useHostMode as Pa,useRenderMode as ha}from"./066fc9aa40.js";import{useRenderImage as ya}from"./c245393c92.js";import{useEvaluation as ba}from"./9f474b5d1a.js";import{useLabel as Ta,useLabels as Aa,useFormatters as Oa}from"./28d887bf8a.js";import{useProduct as Ra,useCatalogMaps as Ea}from"./1458417bdb.js";import{useSceneState as Ha}from"./16a399703e.js";import{useUIState as Ba,useOptionGating as Da,useHostedProductState as Fa,useUIRegion as wa,useUIRegions as Ua}from"./9840b9ce12.js";import{useSystemConfig as Qa}from"./6855e6a3b1.js";import{useIcon as ja}from"./09c4973968.js";import{default as ka}from"./921bf270dd.js";import{usePlacementInteraction as Na}from"./4b8958aa4c.js";import{default as za}from"./f11a45a150.js";import{useCopilotAvailable as Wa}from"./672404d987.js";import vn from"./3fb3ab6757.js";import yn from"./7206ce49c6.js";import In from"./0f7c8345a8.js";import bn from"./82a8a4bc35.js";import Cn from"./e379e0039b.js";import{Sidebar as Tn,SaveProjectButton as An,GenerateAssetsButton as On,LiveStatusPanel as xn,ChatBar as Rn,NotificationContainer as En,EvaluatingOverlay as Mn,Modals as Hn,SaveProjectModal as Ln,ExportModal as Bn,ARModal as Dn,GeneratedAssetsModal as Fn,Header as wn,SceneToolbar as Un,SidebarFrame as Gn,OptionSidebar as Qn,LoadingScreen as Vn,ConfirmDialog as jn,Modal as _n,Button as kn,ARViewer as qn,SceneRoom as Nn,SceneDimensions as Kn,CameraAnimator as zn}from"./64e9020b49.js";import{setQuoteDocument as Yn,hasQuoteDocument as Wn,resetQuoteDocument as Jn}from"./12b8165d6d.js";import{SlotHost as Xn}from"./73f7d65985.js";import{ModalHost as Zn}from"./09c4973968.js";import{OptionThumbnail as $n,FinishThumbnail as es,LayoutThumbnail as ts,ColorSwatch as os,WidthSlider as rs,FrameSizeButton as ns,HostedProductThumbnail as ss,ProductFeaturePickers as as,AddProductToggle as is}from"./c12c112c6f.js";import{ProductInstance as ls,ComponentMesh as cs,SceneStage as ds,SceneEnvironment as us,SelectionBox as ms,FreeMovable as ps,PlacementGaps as gs,SelectionActionPanel as fs}from"./8a3a57c008.js";import Ss from"./205827c5c8.js";import{refreshAiQuota as Ps}from"./2f8cc8b292.js";const hs={Sidebar:Tn,SidebarFrame:Gn,OptionSetSection:vn,OptionThumbnail:$n,FinishThumbnail:es,LayoutThumbnail:ts,ColorSwatch:os,WidthSlider:rs,FrameSizeButton:ns,HostedProductThumbnail:ss,ProductFeaturePickers:as,AddProductToggle:is,QuoteRenders:In,QuoteQr:Cn,ConfigurationSummary:bn,SaveProjectButton:An,GenerateAssetsButton:On,LiveStatusPanel:xn,ChatBar:Rn,NotificationContainer:En,EvaluatingOverlay:Mn,Header:wn,SceneToolbar:Un,OptionSidebar:Qn,LoadingScreen:Vn,Modals:Hn,SaveProjectModal:Ln,ExportModal:Bn,ARModal:Dn,GeneratedAssetsModal:Fn,Modal:_n,Button:kn,ConfirmDialog:jn,ARViewer:qn,SceneRoom:Nn,SceneDimensions:Kn,CameraAnimator:zn,Popover:yn,SlotHost:Xn,ModalHost:Zn,ProductInstance:ls,ComponentMesh:cs,SceneStage:ds,SceneEnvironment:us,SelectionBox:ms,FreeMovable:ps,PlacementGaps:gs,PlacementTargets:Ss,SelectionActionPanel:fs},vs={products:nn,options:sn,scene:an,ui:ln,placement:dn,commerce:un,http:mn,project:pn,history:gn,embed:fn,config:hn,copilot:Sn,catalog:Pn,parts:hs,quote:cn,boot:G,mount:Q,load:V,configure:j,version:_,on:B,once:D,off:F,onBackendEvent:w,registerEffectHandler:U,addMiddleware:L};var Ws=vs;export{L as addMiddleware,Ds as ai,G as boot,Pn as catalog,un as commerce,hn as config,j as configure,Sn as copilot,Ws as default,fn as embed,Fs as evaluation,gn as history,mn as http,V as load,Q as mount,F as off,B as on,w as onBackendEvent,D as once,sn as options,hs as parts,dn as placement,nn as products,pn as project,cn as quote,U as registerEffectHandler,Bs as renders,an as scene,ln as ui,za as useAppVersion,ga as useBootStatus,Ea as useCatalogMaps,ea as useComponentRegistry,Wa as useCopilotAvailable,ba as useEvaluation,Oa as useFormatters,ka as useGenerateAssets,Pa as useHostMode,Fa as useHostedProductState,ja as useIcon,Ta as useLabel,Aa as useLabels,Da as useOptionGating,Zs as useOptionSets,Na as usePlacementInteraction,da as usePrice,Ra as useProduct,oa as useProductOrder,na as useProductOverrides,ca as useProducts,ya as useRenderImage,ha as useRenderMode,Ha as useSceneState,la as useSelection,aa as useSelectionActions,fa as useSystem,Qa as useSystemConfig,ma as useToolbar,wa as useUIRegion,Ua as useUIRegions,Ba as useUIState,_ as version};