@liveroom-tech/react-immersive 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +10 -6
  2. package/README.md +106 -3856
  3. package/dist/binding-builder.css +1 -1
  4. package/dist/binding-builder.d.mts +5 -1
  5. package/dist/binding-builder.d.ts +5 -1
  6. package/dist/binding-builder.js +67 -17
  7. package/dist/binding-builder.mjs +1 -1
  8. package/dist/chunk-2JFUMJUP.mjs +1 -0
  9. package/dist/chunk-4JMJALRO.mjs +2 -0
  10. package/dist/chunk-OTSCPJWF.mjs +1 -0
  11. package/dist/chunk-P2JZ5Z7I.mjs +1 -0
  12. package/dist/chunk-UGPR4EPP.mjs +81 -0
  13. package/dist/chunk-V7WZUWJ5.mjs +1 -0
  14. package/dist/chunk-WWUWEPFK.mjs +3 -0
  15. package/dist/hosted.css +1 -1
  16. package/dist/hosted.d.mts +48 -19
  17. package/dist/hosted.d.ts +48 -19
  18. package/dist/hosted.js +66 -16
  19. package/dist/hosted.mjs +1 -1
  20. package/dist/index.css +1 -1
  21. package/dist/index.d.mts +78 -12
  22. package/dist/index.d.ts +78 -12
  23. package/dist/index.js +65 -15
  24. package/dist/index.mjs +1 -1
  25. package/dist/{materialVariants-DnZe9eMC.d.mts → modelFileResolver-Co7j1tdQ.d.mts} +125 -27
  26. package/dist/{materialVariants-DnZe9eMC.d.ts → modelFileResolver-Co7j1tdQ.d.ts} +125 -27
  27. package/dist/modelViewerProps-BibuMND7.d.ts +1988 -0
  28. package/dist/modelViewerProps-Ce4-wb57.d.mts +1988 -0
  29. package/dist/{publicProps-tJuWZgT3.d.ts → publicProps-BaJHCDa_.d.mts} +7 -0
  30. package/dist/{publicProps-tJuWZgT3.d.mts → publicProps-CP18d_mt.d.ts} +7 -0
  31. package/dist/simple-model-viewer.d.mts +2 -4
  32. package/dist/simple-model-viewer.d.ts +2 -4
  33. package/dist/simple-model-viewer.js +3 -3
  34. package/dist/simple-model-viewer.mjs +1 -1
  35. package/dist/utils.d.mts +62 -4
  36. package/dist/utils.d.ts +62 -4
  37. package/dist/utils.js +2 -1
  38. package/dist/utils.mjs +1 -1
  39. package/package.json +2 -1
  40. package/dist/chunk-4NLJSD3S.mjs +0 -1
  41. package/dist/chunk-B7REIGDG.mjs +0 -1
  42. package/dist/chunk-HYFJ5DYJ.mjs +0 -1
  43. package/dist/chunk-QC3NT76G.mjs +0 -3
  44. package/dist/chunk-SEESCGUS.mjs +0 -1
  45. package/dist/chunk-T3M3BQ7H.mjs +0 -32
  46. package/dist/chunk-ZPK67UG7.mjs +0 -1
  47. package/dist/modelInfo-BYebMPdZ.d.mts +0 -43
  48. package/dist/modelInfo-XfUQO7C_.d.ts +0 -43
  49. package/dist/modelViewerProps-CIZ2R_Fv.d.ts +0 -569
  50. package/dist/modelViewerProps-DoRiTZMn.d.mts +0 -569
  51. package/dist/rendererBackend-QwMzISTn.d.mts +0 -903
  52. package/dist/rendererBackend-QwMzISTn.d.ts +0 -903
@@ -1 +1 @@
1
- "use client";import{a as st}from"./chunk-MMO7KCYU.mjs";import{B as Ze,C as et,F as tt,G as nt,H as rt,I as at,J as ot,a as Ie,b as Z,c as Be,d as Fe,e as Ae,f as Ke,g as He,k as Ue,l as We,m as Xe,n as $e,s as Ge,t as qe,u as Ye,v as Je,x as Qe}from"./chunk-ZPK67UG7.mjs";import{a as Bt}from"./chunk-4NLJSD3S.mjs";import"./chunk-JR557W27.mjs";import{useRef as S,useState as u,useCallback as x,useEffect as k,useMemo as ee,Component as Ft,Suspense as me}from"react";import{CameraControls as At,Environment as Kt}from"@react-three/drei";import{useFrame as mt,useThree as $}from"@react-three/fiber";import{Canvas as Ht}from"@react-three/fiber";import{Box3 as Ut,MeshStandardMaterial as Wt,PerspectiveCamera as Xt,Vector3 as fe}from"three";import{SkeletonUtils as $t}from"three-stdlib";import{X as xe,Check as vt,Settings as Gt,ChevronDown as qt,Boxes as Yt,Trash2 as Jt,Upload as ve,AlertTriangle as Qt}from"lucide-react";import{Fragment as ut,jsx as e,jsxs as p}from"react/jsx-runtime";var it={color:"#93c5fd",intensity:.05},lt=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];function Zt(n){return!!(n&&"isMesh"in n&&n.isMesh)}function dt(n,r){Array.isArray(n)?n.forEach(r):r(n)}function en(n,r){if(!r)return;let s=r.camera;if(!(s instanceof Xt))return;let a=new Ut().setFromObject(n).getSize(new fe).length();!Number.isFinite(a)||a<=0||(s.near=a/100,s.far=a*100,s.updateProjectionMatrix(),r.maxDistance=a*10)}var he=class extends Ft{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s){this.props.onLoadError?.(s)}render(){return this.state.hasError?null:this.props.children}};function tn({url:n,format:r,dracoDecoderPath:s,ktx2TranscoderPath:a,meshopt:l,hiddenKeys:o,selectedKey:w,panelHoveredKey:z,nodeRefsOut:c,onMeshesReady:y,onModelLoaded:K,onLoadProgress:_,onMeshClick:D,highlightOnHover:L}){let{scene:g}=Ze(n,{dracoDecoderPath:s,ktx2TranscoderPath:a,meshopt:l},r,_),B=$(i=>i.invalidate),{setCanvasCursor:E,restoreCanvasCursor:T}=nt(),[N,V]=u(null),h=ee(()=>$t.clone(g),[g]),M=ee(()=>{let i={};return h.traverse(d=>{if(!Zt(d))return;let b=d.name||d.uuid;i[b]={key:b,label:d.name||d.type,ref:d}}),i},[h]),j=ee(()=>{let i={};for(let[d,{ref:b}]of Object.entries(M)){let A=(Array.isArray(b.material)?b.material:[b.material]).map(m=>{let f=(et(m)??new Wt).clone();return f.userData.baseColor=f.color.clone(),f.userData.baseMap=f.map,f.userData.baseEmissive=f.emissive.clone(),f.userData.baseEmissiveMap=f.emissiveMap,f.userData.baseEmissiveIntensity=f.emissiveIntensity,f});i[d]=Array.isArray(b.material)?A:A[0]}return i},[M]);k(()=>()=>{Object.values(j).forEach(i=>dt(i,d=>d.dispose()))},[j]);let H=S(null);k(()=>{H.current!==n&&(H.current=n,h.updateWorldMatrix(!0,!0),tt(h),y(M),K(h))},[n,h,M,y,K]),k(()=>{let i=new AbortController;return Ke(h,i.signal),()=>{i.abort(),He(h)}},[h]);let q=ee(()=>!Fe(h),[h]);k(()=>{for(let[i,{ref:d}]of Object.entries(M))c.current[i]=d},[M,c]),k(()=>{!L&&N!==null&&(V(null),T())},[L,N,T]),k(()=>{for(let[i,{ref:d}]of Object.entries(M)){d.visible=!o.has(i);let b=j[i];if(!b)continue;d.material=b;let O=L&&N===i,A=L&&z===i;dt(b,m=>{if(m.color.copy(m.userData.baseColor),m.map=m.userData.baseMap??null,m.emissive.copy(m.userData.baseEmissive),m.emissiveMap=m.userData.baseEmissiveMap??null,m.emissiveIntensity=m.userData.baseEmissiveIntensity,A||O){let U=!!m.userData.baseEmissiveMap;m.emissive.set(it.color),m.emissiveIntensity=U?m.userData.baseEmissiveIntensity:it.intensity}m.needsUpdate=!0})}B()},[M,j,N,w,z,L,o,B]);let F=i=>{let d=i;for(;d;){let b=d.name||d.uuid;if(M[b])return b;d=d.parent}return null},ne=q?{onClick:i=>{let d=F(i.object);d&&(i.stopPropagation(),D(d))},...L?{onPointerOver:i=>{let d=F(i.object);d&&(i.stopPropagation(),E("pointer"),V(d))},onPointerOut:i=>{i.stopPropagation(),T(),V(null)}}:{}}:{};return e("primitive",{object:h,...ne})}function nn({scene:n,controlsRef:r,refitOnResize:s,onInitialFitComplete:a,resumeViewRef:l}){let o=S(!1),w=$(y=>y.invalidate),z=$(y=>y.size),c=S(null);return k(()=>{o.current=!1,w()},[w,n]),mt(()=>{if(o.current)return;if(!n||!r.current){w();return}o.current=!0,en(n,r.current);let y=l.current;if(y){l.current=null,r.current.setLookAt(...y.position,...y.target,!1).catch(()=>{}).finally(a);return}r.current.fitToBox(n,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{}).finally(a)}),k(()=>{if(!(!s||!o.current||!n||!r.current))return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{r.current?.fitToBox(n,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{}),w()},150),()=>{c.current&&clearTimeout(c.current)}},[z.width,z.height,s]),null}function rn({exposure:n}){let r=$(a=>a.gl),s=$(a=>a.invalidate);return k(()=>{r.toneMappingExposure=n,s()},[r,n,s]),null}function an({enabled:n,controlsRef:r}){let s=$(a=>a.invalidate);return mt((a,l)=>{!n||!r.current||(r.current.rotate(l*.2,0,!1),s())}),null}function te(n){return Array.from(n.types).includes("Files")}function pt({label:n,checked:r,onChange:s}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),e("div",{className:"env-row__value",children:e("button",{className:"env-checkbox-btn",onClick:()=>s(!r),children:e("span",{className:`env-checkbox${r?" env-checkbox--checked":""}`,children:r&&e(vt,{size:9,strokeWidth:2,color:"white"})})})})]})}function ge({label:n,value:r,onChange:s}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),e("div",{className:"env-row__value",children:p("div",{className:"env-color-swatch",style:{background:r},children:[e("span",{className:"env-color-swatch__hex",children:r}),e("input",{type:"color",className:"env-color-swatch__input",value:r,onChange:a=>s(a.target.value)})]})})]})}function be({label:n,value:r,min:s,max:a,step:l,onChange:o}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),p("div",{className:"env-row__value env-row__value--slider",children:[e("input",{type:"range",className:"env-slider",min:s,max:a,step:l,value:r,onChange:w=>o(Number(w.target.value))}),e("span",{className:"env-slider__value",children:r.toFixed(2)})]})]})}function on({label:n,optionLabels:r,value:s,options:a,onChange:l}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),e("div",{className:"env-row__value",children:e("select",{className:"env-select",value:s,onChange:o=>l(o.target.value),children:a.map(o=>e("option",{value:o,children:r?.[o]??o},o))})})]})}function ct({title:n,children:r}){let[s,a]=u(!1);return p("div",{className:"env-section",children:[p("button",{className:"env-section__header",onClick:()=>a(l=>!l),children:[e(qt,{size:12,strokeWidth:2,className:`env-section__chevron${s?" env-section__chevron--collapsed":""}`}),e("span",{children:n})]}),!s&&e("div",{className:"env-section__body",children:r})]})}function sn({isOpen:n,onToggle:r,settings:s,onChange:a}){let l=Z();return p("div",{className:`left-panel-wrapper ${n?"left-panel-wrapper--open":"left-panel-wrapper--closed"}`,children:[!n&&e("button",{className:"side-panel__open-btn side-panel__open-btn--left",onClick:()=>r(!0),children:e(Gt,{size:20,strokeWidth:1.8})}),p("div",{className:`side-panel side-panel--left ${n?"side-panel--open-left":"side-panel--closed-left"}`,"aria-hidden":!n,children:[e("div",{className:"side-panel__header",children:p("div",{className:"side-panel__header-top",children:[e("span",{className:"side-panel__eyebrow",children:l("sceneSettings")}),e("button",{className:"side-panel__close-btn",onClick:()=>r(!1),title:l("close"),children:e(xe,{size:12,strokeWidth:1.6})})]})}),p("div",{className:"env-controls",children:[p(ct,{title:l("background"),children:[e(pt,{label:l("background"),checked:s.backgroundEnabled,onChange:o=>a("backgroundEnabled",o)}),e(ge,{label:l("backgroundColor"),value:s.backgroundColor,onChange:o=>a("backgroundColor",o)}),e(on,{label:l("environment"),value:s.envPreset,options:lt,optionLabels:Object.fromEntries(lt.map(o=>[o,l(`environment${o[0].toUpperCase()}${o.slice(1)}`)])),onChange:o=>a("envPreset",o)}),e(pt,{label:l("autoRotate"),checked:s.autoRotate,onChange:o=>a("autoRotate",o)})]}),p(ct,{title:l("lighting"),children:[e(be,{label:l("exposure"),value:s.exposure,min:0,max:2,step:.05,onChange:o=>a("exposure",o)}),e(be,{label:l("ambientLightIntensity"),value:s.ambientIntensity,min:0,max:3,step:.05,onChange:o=>a("ambientIntensity",o)}),e(ge,{label:l("ambientLightColor"),value:s.ambientColor,onChange:o=>a("ambientColor",o)}),e(be,{label:l("directLightIntensity"),value:s.directionalIntensity,min:0,max:5,step:.05,onChange:o=>a("directionalIntensity",o)}),e(ge,{label:l("directLightColor"),value:s.directionalColor,onChange:o=>a("directionalColor",o)})]})]})]})]})}function ln({meshKeys:n,hiddenKeys:r,selectedKey:s,isOpen:a,onToggle:l,onFocus:o,onHover:w,onToggleVisibility:z}){let c=Z(),[y,K]=u(""),[_,D]=u(null),L=Object.values(n).filter(g=>g.label.toLowerCase().includes(y.toLowerCase()));return p("div",{className:`right-panel-wrapper ${a?"right-panel-wrapper--open":"right-panel-wrapper--closed"}`,children:[!a&&e("button",{className:"side-panel__open-btn",onClick:()=>l(!0),children:e(Yt,{size:20,strokeWidth:1.8})}),p("div",{className:`side-panel ${a?"side-panel--open":"side-panel--closed"}`,"aria-hidden":!a,children:[p("div",{className:"side-panel__header",children:[p("div",{className:"side-panel__header-top",children:[e("span",{className:"side-panel__eyebrow",children:c("sceneObjects")}),e("button",{className:"side-panel__close-btn",onClick:()=>l(!1),title:c("close"),children:e(xe,{size:12,strokeWidth:1.6})})]}),e("p",{className:"side-panel__title",children:c("objectCount",{count:L.length})})]}),e("div",{className:"side-panel__search-wrap",children:e("input",{className:"side-panel__search",type:"text",placeholder:c("searchObjects"),value:y,onChange:g=>K(g.target.value)})}),e("div",{className:"side-panel__list",children:L.map(({key:g,label:B})=>{let E=!r.has(g),T=s===g,N=_===g;return p("div",{onClick:()=>o(g),onMouseEnter:()=>{D(g),w(g)},onMouseLeave:()=>{D(null),w(null)},className:["side-panel__row",N?"side-panel__row--hovered":"",T?"side-panel__row--selected":""].filter(Boolean).join(" "),children:[e("button",{type:"button",className:`side-panel__label side-panel__labelButton${N||T?" side-panel__label--hovered":""}`,"aria-current":T?"true":void 0,onFocus:()=>{D(g),w(g)},onBlur:()=>{D(null),w(null)},children:B}),e("button",{type:"button",className:"side-panel__vis-btn",title:c(E?"hide":"show"),"aria-label":c(E?"hideObject":"showObject",{name:B}),onClick:V=>{V.stopPropagation(),z(g)},children:e("span",{className:`side-panel__checkbox${E?" side-panel__checkbox--checked":""}`,children:E&&e(vt,{size:9,strokeWidth:5,color:"white"})})})]},g)})})]})]})}function gt(n){return e(Ie,{labels:n.labels,children:e(dn,{...n})})}function dn({modelUrl:n,poster:r,loading:s,reveal:a,modelFormat:l,dracoDecoderPath:o,ktx2TranscoderPath:w,meshopt:z=!0,backgroundColor:c="#1a1a1a",showSceneObjectsPanel:y=!0,showSceneSettingsPanel:K=!0,enableModelUpload:_=!1,zoomOnSelected:D=!1,highlightOnHover:L=!1,showLoadingOverlay:g=!0,refitOnResize:B=!0,backgroundEnabled:E=!1,autoRotate:T=!1,envPreset:N="city",exposure:V=1,ambientIntensity:h=.6,ambientColor:M="#ffffff",directionalIntensity:j=1.2,directionalColor:H="#ffffff",onModelLoaded:q,onLoadError:F,reducedMotion:ne="user"}){let i=Z(),d=at(ne),b=T&&!d;st("simple-model-viewer","SimpleModelViewer");let O=S(null),A=S({}),m=S(null),U=S(null),f=S(0),[re,ae]=u(null),[we,ye]=u(null),[bt,oe]=u(!1),[ft,_e]=u({}),[ke,Me]=u(new Set),[Ce,Re]=u(null),[ht,Se]=u(null),[Le,Ne]=u(null),[xt,Ee]=u(null),[wt,Y]=u(!1),[Pe,ze]=u(!1),[se,ie]=u(!1),[yt,J]=u(null),[_t,Q]=u(!1),[kt,Mt]=u(()=>typeof window>"u"?!0:window.innerWidth>900),[Ct,Rt]=u(()=>typeof window>"u"?!0:window.innerWidth>900),[C,le]=u({backgroundEnabled:E,backgroundColor:c,autoRotate:b,envPreset:N,exposure:V,ambientIntensity:h,ambientColor:M,directionalIntensity:j,directionalColor:H}),R=_?Le:n,De=S(null),de=S(null),pe=S(null),[G,Te]=u(null);k(()=>()=>{G&&URL.revokeObjectURL(G)},[G]);let Ve=S(R);Ve.current=R;let ce=S(null),I=Ge({loading:s,reveal:a,rootRef:De,onPark:()=>{ce.current=de.current?.gl??null;let t=O.current;if(t&&se){pe.current={position:t.getPosition(new fe).toArray(),target:t.getTarget(new fe).toArray()};let v=R;$e(de.current).then(P=>{P&&(v===Ve.current?Te(P):URL.revokeObjectURL(P))})}ae(null),ie(!1)}});k(()=>{if(I.live)return;let t=ce.current;ce.current=null,t&&Xe(t)},[I.live]);let W=x(()=>{pe.current=null,Te(null),ae(null),ye(null),oe(!1),_e({}),Me(new Set),Re(null),Se(null),Y(!1),ie(!1),J(null)},[]),X=x(()=>{U.current?.cleanup(),U.current=null},[]),St=x(()=>{X(),Ne(null),Ee(null),W(),le({backgroundEnabled:E,backgroundColor:c,autoRotate:b,envPreset:N,exposure:V,ambientIntensity:h,ambientColor:M,directionalIntensity:j,directionalColor:H})},[M,h,b,c,E,H,j,N,V,W,X]),Oe=x(async t=>{ze(!0);try{let v=await Qe(t);X(),U.current=v,Ne(v.url),Ee(v.name),W()}catch(v){Y(!0),F?.(v)}finally{ze(!1)}},[F,W,X]),ue=x(t=>{let v=t?.[0];v&&Oe(v)},[Oe]);k(()=>()=>{X()},[X]);let Lt=x((t,v)=>{le(P=>({...P,[t]:v}))},[]);k(()=>{le(t=>({...t,backgroundColor:c}))},[c]),k(()=>{W()},[R,W]);let Nt=x(t=>{_e(t)},[]),Et=x(t=>{ae(t),Y(!1);let v=Ae(t);ye(v>Be?v:null),oe(!1),J(null),q?.(rt(t))},[q]),Pt=x(t=>{Y(!0),J(null),F?.(t)},[F]),zt=x(t=>{t.lengthComputable&&t.total>0&&J(t.loaded/t.total*100)},[]),je=x(t=>{if(Re(t),!D)return;let v=A.current[t];!v||!O.current||O.current.fitToBox(v,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{})},[D]),Dt=x(t=>{Me(v=>{let P=new Set(v);return P.has(t)?P.delete(t):P.add(t),P})},[]),Tt=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),f.current+=1,Q(!0))},[_]),Vt=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="copy",Q(!0))},[_]),Ot=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),f.current=Math.max(0,f.current-1),f.current===0&&Q(!1))},[_]),jt=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),f.current=0,Q(!1),ue(t.dataTransfer.files))},[_,ue]),It=g&&(Pe||!!(R&&I.live&&!wt&&(!re||!se)));return p("div",{className:"smv-root",ref:De,"data-reduced-motion":d?"":void 0,style:{background:C.backgroundColor},onDragEnter:Tt,onDragOver:Vt,onDragLeave:Ot,onDrop:jt,children:[K&&R&&e(sn,{isOpen:Ct,onToggle:Rt,settings:C,onChange:Lt}),p("div",{className:"smv-canvasArea",children:[we!==null&&!bt&&p("div",{className:"smv-largeModelBanner",children:[e(Qt,{size:14,className:"smv-largeModelBanner__icon"}),e("span",{children:i("simpleLargeModelWarning",{millions:Math.round(we/1e6)})}),e("button",{type:"button",className:"smv-largeModelBanner__dismiss",onClick:()=>oe(!0),"aria-label":i("dismiss"),children:e(xe,{size:12})})]}),_?p(ut,{children:[e("input",{ref:m,type:"file",accept:Je,className:"smv-upload-input",onChange:t=>{ue(t.target.files),t.currentTarget.value=""}}),R?e("div",{className:"smv-upload-toolbar",children:p(ut,{children:[e("span",{className:"smv-upload-toolbar__name",children:xt??i("uploadedModel")}),p("button",{type:"button",className:"smv-upload-toolbar__button smv-upload-toolbar__button--ghost",onClick:St,children:[e(Jt,{size:14}),i("clear")]})]})}):null]}):null,R&&!I.live?e(Ye,{className:"ri-viewerPlaceholder--inset",background:C.backgroundColor,poster:G??r,onReveal:I.awaitingReveal?I.reveal:void 0}):R?p(Ht,{dpr:[1,2],frameloop:I.visible?"demand":"never",resize:{debounce:0,scroll:!1},raycaster:{firstHitOnly:!0},style:{background:C.backgroundColor},camera:{position:[0,0,5],fov:45,near:.1,far:1e3},children:[e(Ue,{captureRef:de}),e(We,{}),p(me,{fallback:null,children:[e("ambientLight",{intensity:C.ambientIntensity,color:C.ambientColor}),e("directionalLight",{position:[-4,5,7],intensity:C.directionalIntensity,color:C.directionalColor,castShadow:!0}),e("directionalLight",{position:[-5,5,5],intensity:.5}),e(me,{fallback:null,children:e(Kt,{preset:C.envPreset,background:C.backgroundEnabled})}),e(rn,{exposure:C.exposure}),e(an,{enabled:C.autoRotate,controlsRef:O}),e(he,{onLoadError:Pt,children:e(me,{fallback:null,children:e(tn,{url:R,format:Le?void 0:l,dracoDecoderPath:o,ktx2TranscoderPath:w,meshopt:z,hiddenKeys:ke,selectedKey:Ce,panelHoveredKey:ht,nodeRefsOut:A,onMeshesReady:Nt,onModelLoaded:Et,onLoadProgress:zt,onMeshClick:je,highlightOnHover:L})})},R),e(nn,{scene:re,controlsRef:O,refitOnResize:B,onInitialFitComplete:()=>ie(!0),resumeViewRef:pe}),e(At,{ref:O,makeDefault:!0,smoothTime:d?0:.3})]})]}):e("div",{className:"smv-upload-empty-state",style:{background:C.backgroundColor},children:p("div",{className:"smv-upload-empty-state__card",children:[e("div",{className:"smv-upload-empty-state__icon",children:e(ve,{size:24})}),e("p",{className:"smv-upload-empty-state__body",children:i("dropModelHint",{formats:".glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, .zip"})}),p("button",{type:"button",className:"smv-upload-empty-state__button",onClick:()=>m.current?.click(),children:[e(ve,{size:15}),i("chooseModel")]})]})}),R&&I.live?e(qe,{src:G??r,hidden:!!(re&&se)}):null,e(ot,{visible:It,message:i("loadingModel"),progress:Pe?void 0:yt??void 0}),_&&_t?e("div",{className:"smv-upload-drop-overlay",children:p("div",{className:"smv-upload-drop-overlay__card",children:[e(ve,{size:20}),e("span",{children:i("releaseToLoadYourModel")})]})}):null]}),y&&R&&e(ln,{meshKeys:ft,hiddenKeys:ke,selectedKey:Ce,isOpen:kt,onToggle:Mt,onFocus:je,onHover:Se,onToggleVisibility:Dt})]})}export{Bt as DEFAULT_MODEL_VIEWER_LABELS,gt as SimpleModelViewer};
1
+ "use client";import{a as st}from"./chunk-MMO7KCYU.mjs";import{C as Ze,D as et,G as tt,H as nt,I as rt,J as at,K as ot,a as Ie,b as Z,g as Be,j as Fe,k as Ae,l as Ke,m as He,n as Ue,o as We,s as Xe,t as $e,u as Ge,v as qe,w as Ye,x as Je,y as Qe}from"./chunk-OTSCPJWF.mjs";import{j as Bt}from"./chunk-V7WZUWJ5.mjs";import"./chunk-JR557W27.mjs";import{useRef as S,useState as u,useCallback as x,useEffect as k,useMemo as ee,Component as Ft,Suspense as me}from"react";import{CameraControls as At,Environment as Kt}from"@react-three/drei";import{useFrame as mt,useThree as $}from"@react-three/fiber";import{Canvas as Ht}from"@react-three/fiber";import{Box3 as Ut,MeshStandardMaterial as Wt,PerspectiveCamera as Xt,Vector3 as fe}from"three";import{SkeletonUtils as $t}from"three-stdlib";import{X as xe,Check as vt,Settings as Gt,ChevronDown as qt,Boxes as Yt,Trash2 as Jt,Upload as ve,AlertTriangle as Qt}from"lucide-react";import{Fragment as ut,jsx as e,jsxs as p}from"react/jsx-runtime";var it={color:"#93c5fd",intensity:.05},lt=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];function Zt(n){return!!(n&&"isMesh"in n&&n.isMesh)}function dt(n,r){Array.isArray(n)?n.forEach(r):r(n)}function en(n,r){if(!r)return;let s=r.camera;if(!(s instanceof Xt))return;let a=new Ut().setFromObject(n).getSize(new fe).length();!Number.isFinite(a)||a<=0||(s.near=a/100,s.far=a*100,s.updateProjectionMatrix(),r.maxDistance=a*10)}var he=class extends Ft{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s){this.props.onLoadError?.(s)}render(){return this.state.hasError?null:this.props.children}};function tn({url:n,format:r,dracoDecoderPath:s,ktx2TranscoderPath:a,meshopt:l,hiddenKeys:o,selectedKey:w,panelHoveredKey:z,nodeRefsOut:c,onMeshesReady:y,onModelLoaded:K,onLoadProgress:_,onMeshClick:D,highlightOnHover:L}){let{scene:g}=Ze(n,{dracoDecoderPath:s,ktx2TranscoderPath:a,meshopt:l},r,_),B=$(i=>i.invalidate),{setCanvasCursor:E,restoreCanvasCursor:T}=nt(),[N,V]=u(null),h=ee(()=>$t.clone(g),[g]),M=ee(()=>{let i={};return h.traverse(d=>{if(!Zt(d))return;let b=d.name||d.uuid;i[b]={key:b,label:d.name||d.type,ref:d}}),i},[h]),j=ee(()=>{let i={};for(let[d,{ref:b}]of Object.entries(M)){let A=(Array.isArray(b.material)?b.material:[b.material]).map(m=>{let f=(et(m)??new Wt).clone();return f.userData.baseColor=f.color.clone(),f.userData.baseMap=f.map,f.userData.baseEmissive=f.emissive.clone(),f.userData.baseEmissiveMap=f.emissiveMap,f.userData.baseEmissiveIntensity=f.emissiveIntensity,f});i[d]=Array.isArray(b.material)?A:A[0]}return i},[M]);k(()=>()=>{Object.values(j).forEach(i=>dt(i,d=>d.dispose()))},[j]);let H=S(null);k(()=>{H.current!==n&&(H.current=n,h.updateWorldMatrix(!0,!0),tt(h),y(M),K(h))},[n,h,M,y,K]),k(()=>{let i=new AbortController;return Ue(h,i.signal),()=>{i.abort(),We(h)}},[h]);let q=ee(()=>!Ke(h),[h]);k(()=>{for(let[i,{ref:d}]of Object.entries(M))c.current[i]=d},[M,c]),k(()=>{!L&&N!==null&&(V(null),T())},[L,N,T]),k(()=>{for(let[i,{ref:d}]of Object.entries(M)){d.visible=!o.has(i);let b=j[i];if(!b)continue;d.material=b;let O=L&&N===i,A=L&&z===i;dt(b,m=>{if(m.color.copy(m.userData.baseColor),m.map=m.userData.baseMap??null,m.emissive.copy(m.userData.baseEmissive),m.emissiveMap=m.userData.baseEmissiveMap??null,m.emissiveIntensity=m.userData.baseEmissiveIntensity,A||O){let U=!!m.userData.baseEmissiveMap;m.emissive.set(it.color),m.emissiveIntensity=U?m.userData.baseEmissiveIntensity:it.intensity}m.needsUpdate=!0})}B()},[M,j,N,w,z,L,o,B]);let F=i=>{let d=i;for(;d;){let b=d.name||d.uuid;if(M[b])return b;d=d.parent}return null},ne=q?{onClick:i=>{let d=F(i.object);d&&(i.stopPropagation(),D(d))},...L?{onPointerOver:i=>{let d=F(i.object);d&&(i.stopPropagation(),E("pointer"),V(d))},onPointerOut:i=>{i.stopPropagation(),T(),V(null)}}:{}}:{};return e("primitive",{object:h,...ne})}function nn({scene:n,controlsRef:r,refitOnResize:s,onInitialFitComplete:a,resumeViewRef:l}){let o=S(!1),w=$(y=>y.invalidate),z=$(y=>y.size),c=S(null);return k(()=>{o.current=!1,w()},[w,n]),mt(()=>{if(o.current)return;if(!n||!r.current){w();return}o.current=!0,en(n,r.current);let y=l.current;if(y){l.current=null,r.current.setLookAt(...y.position,...y.target,!1).catch(()=>{}).finally(a);return}r.current.fitToBox(n,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{}).finally(a)}),k(()=>{if(!(!s||!o.current||!n||!r.current))return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{r.current?.fitToBox(n,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{}),w()},150),()=>{c.current&&clearTimeout(c.current)}},[z.width,z.height,s]),null}function rn({exposure:n}){let r=$(a=>a.gl),s=$(a=>a.invalidate);return k(()=>{r.toneMappingExposure=n,s()},[r,n,s]),null}function an({enabled:n,controlsRef:r}){let s=$(a=>a.invalidate);return mt((a,l)=>{!n||!r.current||(r.current.rotate(l*.2,0,!1),s())}),null}function te(n){return Array.from(n.types).includes("Files")}function pt({label:n,checked:r,onChange:s}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),e("div",{className:"env-row__value",children:e("button",{className:"env-checkbox-btn",onClick:()=>s(!r),children:e("span",{className:`env-checkbox${r?" env-checkbox--checked":""}`,children:r&&e(vt,{size:9,strokeWidth:2,color:"white"})})})})]})}function ge({label:n,value:r,onChange:s}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),e("div",{className:"env-row__value",children:p("div",{className:"env-color-swatch",style:{background:r},children:[e("span",{className:"env-color-swatch__hex",children:r}),e("input",{type:"color",className:"env-color-swatch__input",value:r,onChange:a=>s(a.target.value)})]})})]})}function be({label:n,value:r,min:s,max:a,step:l,onChange:o}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),p("div",{className:"env-row__value env-row__value--slider",children:[e("input",{type:"range",className:"env-slider",min:s,max:a,step:l,value:r,onChange:w=>o(Number(w.target.value))}),e("span",{className:"env-slider__value",children:r.toFixed(2)})]})]})}function on({label:n,optionLabels:r,value:s,options:a,onChange:l}){return p("div",{className:"env-row",children:[e("span",{className:"env-row__label",children:n}),e("div",{className:"env-row__value",children:e("select",{className:"env-select",value:s,onChange:o=>l(o.target.value),children:a.map(o=>e("option",{value:o,children:r?.[o]??o},o))})})]})}function ct({title:n,children:r}){let[s,a]=u(!1);return p("div",{className:"env-section",children:[p("button",{className:"env-section__header",onClick:()=>a(l=>!l),children:[e(qt,{size:12,strokeWidth:2,className:`env-section__chevron${s?" env-section__chevron--collapsed":""}`}),e("span",{children:n})]}),!s&&e("div",{className:"env-section__body",children:r})]})}function sn({isOpen:n,onToggle:r,settings:s,onChange:a}){let l=Z();return p("div",{className:`left-panel-wrapper ${n?"left-panel-wrapper--open":"left-panel-wrapper--closed"}`,children:[!n&&e("button",{className:"side-panel__open-btn side-panel__open-btn--left",onClick:()=>r(!0),children:e(Gt,{size:20,strokeWidth:1.8})}),p("div",{className:`side-panel side-panel--left ${n?"side-panel--open-left":"side-panel--closed-left"}`,"aria-hidden":!n,children:[e("div",{className:"side-panel__header",children:p("div",{className:"side-panel__header-top",children:[e("span",{className:"side-panel__eyebrow",children:l("sceneSettings")}),e("button",{className:"side-panel__close-btn",onClick:()=>r(!1),title:l("close"),children:e(xe,{size:12,strokeWidth:1.6})})]})}),p("div",{className:"env-controls",children:[p(ct,{title:l("background"),children:[e(pt,{label:l("background"),checked:s.backgroundEnabled,onChange:o=>a("backgroundEnabled",o)}),e(ge,{label:l("backgroundColor"),value:s.backgroundColor,onChange:o=>a("backgroundColor",o)}),e(on,{label:l("environment"),value:s.envPreset,options:lt,optionLabels:Object.fromEntries(lt.map(o=>[o,l(`environment${o[0].toUpperCase()}${o.slice(1)}`)])),onChange:o=>a("envPreset",o)}),e(pt,{label:l("autoRotate"),checked:s.autoRotate,onChange:o=>a("autoRotate",o)})]}),p(ct,{title:l("lighting"),children:[e(be,{label:l("exposure"),value:s.exposure,min:0,max:2,step:.05,onChange:o=>a("exposure",o)}),e(be,{label:l("ambientLightIntensity"),value:s.ambientIntensity,min:0,max:3,step:.05,onChange:o=>a("ambientIntensity",o)}),e(ge,{label:l("ambientLightColor"),value:s.ambientColor,onChange:o=>a("ambientColor",o)}),e(be,{label:l("directLightIntensity"),value:s.directionalIntensity,min:0,max:5,step:.05,onChange:o=>a("directionalIntensity",o)}),e(ge,{label:l("directLightColor"),value:s.directionalColor,onChange:o=>a("directionalColor",o)})]})]})]})]})}function ln({meshKeys:n,hiddenKeys:r,selectedKey:s,isOpen:a,onToggle:l,onFocus:o,onHover:w,onToggleVisibility:z}){let c=Z(),[y,K]=u(""),[_,D]=u(null),L=Object.values(n).filter(g=>g.label.toLowerCase().includes(y.toLowerCase()));return p("div",{className:`right-panel-wrapper ${a?"right-panel-wrapper--open":"right-panel-wrapper--closed"}`,children:[!a&&e("button",{className:"side-panel__open-btn",onClick:()=>l(!0),children:e(Yt,{size:20,strokeWidth:1.8})}),p("div",{className:`side-panel ${a?"side-panel--open":"side-panel--closed"}`,"aria-hidden":!a,children:[p("div",{className:"side-panel__header",children:[p("div",{className:"side-panel__header-top",children:[e("span",{className:"side-panel__eyebrow",children:c("sceneObjects")}),e("button",{className:"side-panel__close-btn",onClick:()=>l(!1),title:c("close"),children:e(xe,{size:12,strokeWidth:1.6})})]}),e("p",{className:"side-panel__title",children:c("objectCount",{count:L.length})})]}),e("div",{className:"side-panel__search-wrap",children:e("input",{className:"side-panel__search",type:"text",placeholder:c("searchObjects"),value:y,onChange:g=>K(g.target.value)})}),e("div",{className:"side-panel__list",children:L.map(({key:g,label:B})=>{let E=!r.has(g),T=s===g,N=_===g;return p("div",{onClick:()=>o(g),onMouseEnter:()=>{D(g),w(g)},onMouseLeave:()=>{D(null),w(null)},className:["side-panel__row",N?"side-panel__row--hovered":"",T?"side-panel__row--selected":""].filter(Boolean).join(" "),children:[e("button",{type:"button",className:`side-panel__label side-panel__labelButton${N||T?" side-panel__label--hovered":""}`,"aria-current":T?"true":void 0,onFocus:()=>{D(g),w(g)},onBlur:()=>{D(null),w(null)},children:B}),e("button",{type:"button",className:"side-panel__vis-btn",title:c(E?"hide":"show"),"aria-label":c(E?"hideObject":"showObject",{name:B}),onClick:V=>{V.stopPropagation(),z(g)},children:e("span",{className:`side-panel__checkbox${E?" side-panel__checkbox--checked":""}`,children:E&&e(vt,{size:9,strokeWidth:5,color:"white"})})})]},g)})})]})]})}function gt(n){return e(Ie,{labels:n.labels,children:e(dn,{...n})})}function dn({modelUrl:n,poster:r,loading:s,reveal:a,modelFormat:l,dracoDecoderPath:o,ktx2TranscoderPath:w,meshopt:z=!0,backgroundColor:c="#1a1a1a",showSceneObjectsPanel:y=!0,showSceneSettingsPanel:K=!0,enableModelUpload:_=!1,zoomOnSelected:D=!1,highlightOnHover:L=!1,showLoadingOverlay:g=!0,refitOnResize:B=!0,backgroundEnabled:E=!1,autoRotate:T=!1,envPreset:N="city",exposure:V=1,ambientIntensity:h=.6,ambientColor:M="#ffffff",directionalIntensity:j=1.2,directionalColor:H="#ffffff",onModelLoaded:q,onLoadError:F,reducedMotion:ne="user"}){let i=Z(),d=at(ne),b=T&&!d;st("simple-model-viewer","SimpleModelViewer");let O=S(null),A=S({}),m=S(null),U=S(null),f=S(0),[re,ae]=u(null),[we,ye]=u(null),[bt,oe]=u(!1),[ft,_e]=u({}),[ke,Me]=u(new Set),[Ce,Re]=u(null),[ht,Se]=u(null),[Le,Ne]=u(null),[xt,Ee]=u(null),[wt,Y]=u(!1),[Pe,ze]=u(!1),[se,ie]=u(!1),[yt,J]=u(null),[_t,Q]=u(!1),[kt,Mt]=u(()=>typeof window>"u"?!0:window.innerWidth>900),[Ct,Rt]=u(()=>typeof window>"u"?!0:window.innerWidth>900),[C,le]=u({backgroundEnabled:E,backgroundColor:c,autoRotate:b,envPreset:N,exposure:V,ambientIntensity:h,ambientColor:M,directionalIntensity:j,directionalColor:H}),R=_?Le:n,De=S(null),de=S(null),pe=S(null),[G,Te]=u(null);k(()=>()=>{G&&URL.revokeObjectURL(G)},[G]);let Ve=S(R);Ve.current=R;let ce=S(null),I=Ye({loading:s,reveal:a,rootRef:De,onPark:()=>{ce.current=de.current?.gl??null;let t=O.current;if(t&&se){pe.current={position:t.getPosition(new fe).toArray(),target:t.getTarget(new fe).toArray()};let v=R;qe(de.current).then(P=>{P&&(v===Ve.current?Te(P):URL.revokeObjectURL(P))})}ae(null),ie(!1)}});k(()=>{if(I.live)return;let t=ce.current;ce.current=null,t&&Ge(t)},[I.live]);let W=x(()=>{pe.current=null,Te(null),ae(null),ye(null),oe(!1),_e({}),Me(new Set),Re(null),Se(null),Y(!1),ie(!1),J(null)},[]),X=x(()=>{U.current?.cleanup(),U.current=null},[]),St=x(()=>{X(),Ne(null),Ee(null),W(),le({backgroundEnabled:E,backgroundColor:c,autoRotate:b,envPreset:N,exposure:V,ambientIntensity:h,ambientColor:M,directionalIntensity:j,directionalColor:H})},[M,h,b,c,E,H,j,N,V,W,X]),Oe=x(async t=>{ze(!0);try{let v=await Fe(t);X(),U.current=v,Ne(v.url),Ee(v.name),W()}catch(v){Y(!0),F?.(v)}finally{ze(!1)}},[F,W,X]),ue=x(t=>{let v=t?.[0];v&&Oe(v)},[Oe]);k(()=>()=>{X()},[X]);let Lt=x((t,v)=>{le(P=>({...P,[t]:v}))},[]);k(()=>{le(t=>({...t,backgroundColor:c}))},[c]),k(()=>{W()},[R,W]);let Nt=x(t=>{_e(t)},[]),Et=x(t=>{ae(t),Y(!1);let v=He(t);ye(v>Ae?v:null),oe(!1),J(null),q?.(rt(t))},[q]),Pt=x(t=>{Y(!0),J(null),F?.(t)},[F]),zt=x(t=>{t.lengthComputable&&t.total>0&&J(t.loaded/t.total*100)},[]),je=x(t=>{if(Re(t),!D)return;let v=A.current[t];!v||!O.current||O.current.fitToBox(v,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{})},[D]),Dt=x(t=>{Me(v=>{let P=new Set(v);return P.has(t)?P.delete(t):P.add(t),P})},[]),Tt=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),f.current+=1,Q(!0))},[_]),Vt=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="copy",Q(!0))},[_]),Ot=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),f.current=Math.max(0,f.current-1),f.current===0&&Q(!1))},[_]),jt=x(t=>{!_||!te(t.dataTransfer)||(t.preventDefault(),t.stopPropagation(),f.current=0,Q(!1),ue(t.dataTransfer.files))},[_,ue]),It=g&&(Pe||!!(R&&I.live&&!wt&&(!re||!se)));return p("div",{className:"smv-root",ref:De,"data-reduced-motion":d?"":void 0,style:{background:C.backgroundColor},onDragEnter:Tt,onDragOver:Vt,onDragLeave:Ot,onDrop:jt,children:[K&&R&&e(sn,{isOpen:Ct,onToggle:Rt,settings:C,onChange:Lt}),p("div",{className:"smv-canvasArea",children:[we!==null&&!bt&&p("div",{className:"smv-largeModelBanner",children:[e(Qt,{size:14,className:"smv-largeModelBanner__icon"}),e("span",{children:i("simpleLargeModelWarning",{millions:Math.round(we/1e6)})}),e("button",{type:"button",className:"smv-largeModelBanner__dismiss",onClick:()=>oe(!0),"aria-label":i("dismiss"),children:e(xe,{size:12})})]}),_?p(ut,{children:[e("input",{ref:m,type:"file",accept:Be,className:"smv-upload-input",onChange:t=>{ue(t.target.files),t.currentTarget.value=""}}),R?e("div",{className:"smv-upload-toolbar",children:p(ut,{children:[e("span",{className:"smv-upload-toolbar__name",children:xt??i("uploadedModel")}),p("button",{type:"button",className:"smv-upload-toolbar__button smv-upload-toolbar__button--ghost",onClick:St,children:[e(Jt,{size:14}),i("clear")]})]})}):null]}):null,R&&!I.live?e(Qe,{className:"ri-viewerPlaceholder--inset",background:C.backgroundColor,poster:G??r,onReveal:I.awaitingReveal?I.reveal:void 0}):R?p(Ht,{dpr:[1,2],frameloop:I.visible?"demand":"never",resize:{debounce:0,scroll:!1},raycaster:{firstHitOnly:!0},style:{background:C.backgroundColor},camera:{position:[0,0,5],fov:45,near:.1,far:1e3},children:[e(Xe,{captureRef:de}),e($e,{}),p(me,{fallback:null,children:[e("ambientLight",{intensity:C.ambientIntensity,color:C.ambientColor}),e("directionalLight",{position:[-4,5,7],intensity:C.directionalIntensity,color:C.directionalColor,castShadow:!0}),e("directionalLight",{position:[-5,5,5],intensity:.5}),e(me,{fallback:null,children:e(Kt,{preset:C.envPreset,background:C.backgroundEnabled})}),e(rn,{exposure:C.exposure}),e(an,{enabled:C.autoRotate,controlsRef:O}),e(he,{onLoadError:Pt,children:e(me,{fallback:null,children:e(tn,{url:R,format:Le?void 0:l,dracoDecoderPath:o,ktx2TranscoderPath:w,meshopt:z,hiddenKeys:ke,selectedKey:Ce,panelHoveredKey:ht,nodeRefsOut:A,onMeshesReady:Nt,onModelLoaded:Et,onLoadProgress:zt,onMeshClick:je,highlightOnHover:L})})},R),e(nn,{scene:re,controlsRef:O,refitOnResize:B,onInitialFitComplete:()=>ie(!0),resumeViewRef:pe}),e(At,{ref:O,makeDefault:!0,smoothTime:d?0:.3})]})]}):e("div",{className:"smv-upload-empty-state",style:{background:C.backgroundColor},children:p("div",{className:"smv-upload-empty-state__card",children:[e("div",{className:"smv-upload-empty-state__icon",children:e(ve,{size:24})}),e("p",{className:"smv-upload-empty-state__body",children:i("dropModelHint",{formats:".glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, .zip"})}),p("button",{type:"button",className:"smv-upload-empty-state__button",onClick:()=>m.current?.click(),children:[e(ve,{size:15}),i("chooseModel")]})]})}),R&&I.live?e(Je,{src:G??r,hidden:!!(re&&se)}):null,e(ot,{visible:It,message:i("loadingModel"),progress:Pe?void 0:yt??void 0}),_&&_t?e("div",{className:"smv-upload-drop-overlay",children:p("div",{className:"smv-upload-drop-overlay__card",children:[e(ve,{size:20}),e("span",{children:i("releaseToLoadYourModel")})]})}):null]}),y&&R&&e(ln,{meshKeys:ft,hiddenKeys:ke,selectedKey:Ce,isOpen:kt,onToggle:Mt,onFocus:je,onHover:Se,onToggleVisibility:Dt})]})}export{Bt as DEFAULT_MODEL_VIEWER_LABELS,gt as SimpleModelViewer};
package/dist/utils.d.mts CHANGED
@@ -1,6 +1,9 @@
1
- import { a6 as SceneLight, o as ObjectBinding, L as ObjectBindingType } from './rendererBackend-QwMzISTn.mjs';
2
- export { f as AnimationLoopMode, B as BindingEdit, D as DEFAULT_SCENE_CONFIG, j as DEFAULT_SECTION_CONFIG, k as DeepPartial, E as EnvironmentPreset, G as GlitchModeName, I as IsolatedObjectBindings, K as KernelSizeName, M as MATERIAL_BLENDING_MODES, m as MATERIAL_SIDES, n as ObjectActionEvent, p as ObjectBindingAction, q as ObjectBindingCameraState, r as ObjectBindingDecal, s as ObjectBindingMaterial, t as ObjectBindingMaterialBlendingMode, u as ObjectBindingMaterialSide, v as ObjectBindingPatch, w as ObjectBindingSelector, x as ObjectBindingStatus, y as ObjectBindingStyle, z as ObjectBindingTarget, F as ObjectBindingTextureChannel, H as ObjectBindingTextureSlot, J as ObjectBindingTransform, P as ObjectPointerEvent, Q as ObjectSurfacePoint, R as RampTypeName, S as RendererBackend, T as SceneAnimationClipConfig, U as SceneAnimationConfig, V as SceneAnnotationCameraView, W as SceneAnnotationImage, X as SceneAnnotationLink, Y as SceneAnnotationMarker, Z as SceneBackgroundConfig, _ as SceneCameraConfig, $ as SceneCinematicConfig, a0 as SceneCinematicWaypoint, a1 as SceneConfig, a3 as SceneConfigPatch, a4 as SceneEnvironmentConfig, a5 as SceneGroundShadowConfig, a7 as SceneLightAttachment, a8 as SceneLightType, a9 as SceneLightingConfig, aa as SceneModelConfig, ab as SceneModelRenderer, ac as ScenePostProcessingConfig, ad as SceneSectionAxis, ae as SceneSectionConfig, af as SceneShadowConfig, ag as SceneStyleColorScale, ah as SceneStyleCondition, ai as SceneStylePulse, aj as SceneStyleRule, ak as SceneWireframeConfig, al as StyledObjectBindings, am as StyledObjectPulse, aq as ViewerIsolation, ar as ViewerObjectInfo, at as applyIsolation, au as applyStyleRules, av as colorScaleValue, aw as isolatedBindingKeys, ax as material, ay as patchBindings, az as patchSceneConfig, aA as selectBindingKeys, aB as selectBindings } from './rendererBackend-QwMzISTn.mjs';
3
- export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, b as ModelViewerLabelKey, c as ModelViewerLabels, R as ReducedMotionSetting, d as chooseMaterialVariant } from './materialVariants-DnZe9eMC.mjs';
1
+ import { b0 as SceneLight, ao as ObjectBinding, aD as ObjectBindingType, a9 as MeasurementUnit, a6 as MeasurementSettings, aL as SavedMeasurement, a3 as MeasurementPoint, a5 as MeasurementResult, a8 as MeasurementTool, a2 as MeasurementCollection, ay as ObjectBindingStyle, az as ObjectBindingTarget, V as InspectAssetOptions, q as AssetDiagnosticsReport, e as ARSnapshotSource, A as ARExportOptions, d as ARSnapshot, bv as ShareableViewerState, bM as ViewerStateStorage, bn as SequenceEasing, bd as SceneSequence, bs as SequenceTrack, bt as SequenceValue, bo as SequenceKeyframe, b8 as SceneSectionConfig, bb as SceneSectionSettings } from './modelViewerProps-Ce4-wb57.mjs';
2
+ export { a as ARHandoffOptions, b as ARHandoffRequest, c as ARHandoffStatus, l as AnimationLoopMode, p as AssetDiagnosticIssue, r as AssetDiagnosticsSource, s as AssetTextureDiagnostic, t as AssetTransform, B as BindingEdit, E as ComparisonCategory, F as ComparisonChange, G as ComparisonHighlight, H as ComparisonObject, I as ComparisonStatus, J as ConfigurationComparisonInput, K as ConfigurationComparisonReport, N as DEFAULT_SCENE_CONFIG, O as DEFAULT_SECTION_CONFIG, Q as DeepPartial, R as EnvironmentPreset, S as GlitchModeName, W as IsolatedObjectBindings, Y as KernelSizeName, Z as MATERIAL_BLENDING_MODES, _ as MATERIAL_SIDES, $ as MAX_VIEWER_STATE_BYTES, a1 as MeasurementAnchor, a4 as MeasurementPosition, a7 as MeasurementStatus, an as ObjectActionEvent, ap as ObjectBindingAction, aq as ObjectBindingCameraState, ar as ObjectBindingDecal, as as ObjectBindingMaterial, at as ObjectBindingMaterialBlendingMode, au as ObjectBindingMaterialSide, av as ObjectBindingPatch, aw as ObjectBindingSelector, ax as ObjectBindingStatus, aA as ObjectBindingTextureChannel, aB as ObjectBindingTextureSlot, aC as ObjectBindingTransform, aF as ObjectPointerEvent, aG as ObjectSurfacePoint, aJ as RampTypeName, aK as RendererBackend, aM as SceneAnimationClipConfig, aN as SceneAnimationConfig, aO as SceneAnnotationCameraView, aP as SceneAnnotationImage, aQ as SceneAnnotationLink, aR as SceneAnnotationMarker, aS as SceneBackgroundConfig, aT as SceneCameraConfig, aU as SceneCinematicConfig, aV as SceneCinematicWaypoint, aX as SceneConfig, aZ as SceneConfigPatch, a_ as SceneEnvironmentConfig, a$ as SceneGroundShadowConfig, b1 as SceneLightAttachment, b2 as SceneLightType, b3 as SceneLightingConfig, b4 as SceneModelConfig, b5 as SceneModelRenderer, b6 as ScenePostProcessingConfig, b7 as SceneSectionAxis, bc as SceneSelectionSet, be as SceneShadowConfig, bf as SceneStyleColorScale, bg as SceneStyleCondition, bh as SceneStylePulse, bi as SceneStyleRule, bj as SceneWireframeConfig, bk as SemanticComparisonOptions, bl as SequenceCameraView, bm as SequenceControls, bp as SequenceObjectProperty, bq as SequencePlaybackState, br as SequenceTarget, bu as SequenceVector3, bw as StreamingDiagnostics, bx as StyledObjectBindings, by as StyledObjectPulse, bG as ViewerConfiguration, bI as ViewerIsolation, bJ as ViewerObjectInfo, bL as ViewerRuntimeStats, bP as applyIsolation, bQ as applyStyleRules, bR as colorScaleValue, bS as compareViewerConfigurations, bT as groundAsset, bU as isolatedBindingKeys, bV as material, bW as parseAssetTransform, bX as parseSelectionSets, bY as parseViewerState, bZ as patchBindings, b_ as patchSceneConfig, b$ as prepareViewerState, c0 as selectBindingKeys, c1 as selectBindings, c2 as serializeViewerState, c3 as snapAssetToGrid } from './modelViewerProps-Ce4-wb57.mjs';
3
+ export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, c as ModelViewerLabelKey, d as ModelViewerLabels, R as ReducedMotionSetting, h as chooseMaterialVariant } from './modelFileResolver-Co7j1tdQ.mjs';
4
+ import { Object3D } from 'three';
5
+ import 'react';
6
+ import '@react-three/drei';
4
7
 
5
8
  /** A light's id plus whichever of its settings you want to set. */
6
9
  type SceneLightInput = Pick<SceneLight, "id"> & Partial<Omit<SceneLight, "id">>;
@@ -62,4 +65,59 @@ type ActionCatalogEntry = {
62
65
  declare const ACTION_CATALOG: readonly ActionCatalogEntry[];
63
66
  declare function findCatalogAction(id: string): ActionCatalogEntry | undefined;
64
67
 
65
- export { ACTION_CATALOG, type ActionCatalogEntry, type ActionHandling, ObjectBinding, type ObjectBindingActionId, type ObjectBindingKey, ObjectBindingType, SceneLight, type SceneLightInput, buildBindingsFromNodes, createDefaultBinding, defineObjectBindings, findCatalogAction, inferType, sceneLight };
68
+ declare const MEASUREMENT_UNITS: readonly MeasurementUnit[];
69
+ declare function measurementScale(settings?: MeasurementSettings, legacyUnit?: string): {
70
+ displayUnit: string;
71
+ metersPerUnit: number;
72
+ factor: number;
73
+ };
74
+ /** Uses an existing two-point distance as a known real-world length. */
75
+ declare function calibrateMeasurements(rawLength: number, knownLength: number, unit: MeasurementUnit, settings?: MeasurementSettings): MeasurementSettings;
76
+ declare function measurementValue(tool: MeasurementTool, points: readonly MeasurementPoint[]): {
77
+ value: number;
78
+ dimension: 0 | 1 | 2;
79
+ } | null;
80
+ declare function measurementResult(measurement: SavedMeasurement, settings?: MeasurementSettings, legacyUnit?: string, points?: MeasurementPoint[], status?: MeasurementResult["status"]): MeasurementResult;
81
+ /** Reject malformed measurement data before loading a file or shared scene. */
82
+ declare function parseMeasurements(input: unknown): MeasurementCollection;
83
+ declare function serializeMeasurements(collection: MeasurementCollection): string;
84
+ /** Supply live resolved results when exporting measurements on transformed objects. */
85
+ declare function measurementsToCsv(collection: MeasurementCollection, results?: readonly MeasurementResult[], legacyUnit?: string): string;
86
+
87
+ /** A structural node; objectId is present only on bindable, named meshes. */
88
+ type ViewerHierarchyNode = {
89
+ id: string;
90
+ parentId: string | null;
91
+ name: string;
92
+ objectId?: string;
93
+ };
94
+ /** Preserves source groups without renaming, reparenting, or changing transforms. */
95
+ declare function collectObjectHierarchy(root: Object3D): ViewerHierarchyNode[];
96
+
97
+ /** Detached style snapshot. Identity, transforms, decals, and actions stay with their object. */
98
+ declare function copyBindingStyle(binding: ObjectBinding): ObjectBindingStyle;
99
+ /** Replaces authored style overrides on every target, preserving all other fields. */
100
+ declare function pasteBindingStyle(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget, style: ObjectBindingStyle): Record<string, ObjectBinding>;
101
+
102
+ /** Inspect loaded data without fetching, rendering, modifying, or disposing it. */
103
+ declare function inspectAsset(scene: Object3D, options?: InspectAssetOptions): AssetDiagnosticsReport;
104
+
105
+ /** Exports the visible edited geometry, live PBR materials, decals and placements. */
106
+ declare function exportConfiguredUSDZ(sources: ARSnapshotSource[], options?: ARExportOptions): Promise<ARSnapshot>;
107
+
108
+ declare function createARHandoffUrl(state: ShareableViewerState, baseUrl: string, storage?: ViewerStateStorage, signal?: AbortSignal): Promise<string>;
109
+ declare function readARHandoffUrl(value: string, storage?: ViewerStateStorage, signal?: AbortSignal): Promise<ShareableViewerState | null>;
110
+
111
+ declare const SEQUENCE_OBJECT_PROPERTIES: readonly ["position", "rotation", "scale", "visible", "baseColor", "emissive", "opacity", "roughness", "metalness", "emissiveIntensity"];
112
+ declare const SEQUENCE_EASINGS: readonly SequenceEasing[];
113
+ /** Validates imported JSON and returns detached, sorted, executable-code-free data. */
114
+ declare function parseSequences(input: unknown): SceneSequence[];
115
+ declare function sampleSequenceTrack(track: SequenceTrack, time: number): SequenceValue | null;
116
+ declare function upsertSequenceKeyframe(track: SequenceTrack, frame: SequenceKeyframe): SequenceTrack;
117
+
118
+ /** Validate stored section settings, including legacy single-plane settings. */
119
+ declare function parseSectionConfig(input: unknown): SceneSectionConfig;
120
+ /** Detach a reusable snapshot without nesting the preset library. */
121
+ declare function sectionSnapshot(section: SceneSectionConfig): SceneSectionSettings;
122
+
123
+ export { ACTION_CATALOG, ARExportOptions, ARSnapshot, ARSnapshotSource, type ActionCatalogEntry, type ActionHandling, AssetDiagnosticsReport, InspectAssetOptions, MEASUREMENT_UNITS, MeasurementCollection, MeasurementPoint, MeasurementResult, MeasurementSettings, MeasurementTool, MeasurementUnit, ObjectBinding, type ObjectBindingActionId, type ObjectBindingKey, ObjectBindingStyle, ObjectBindingTarget, ObjectBindingType, SEQUENCE_EASINGS, SEQUENCE_OBJECT_PROPERTIES, SavedMeasurement, SceneLight, type SceneLightInput, SceneSectionConfig, SceneSequence, SequenceEasing, SequenceKeyframe, SequenceTrack, SequenceValue, ShareableViewerState, type ViewerHierarchyNode, ViewerStateStorage, buildBindingsFromNodes, calibrateMeasurements, collectObjectHierarchy, copyBindingStyle, createARHandoffUrl, createDefaultBinding, defineObjectBindings, exportConfiguredUSDZ, findCatalogAction, inferType, inspectAsset, measurementResult, measurementScale, measurementValue, measurementsToCsv, parseMeasurements, parseSectionConfig, parseSequences, pasteBindingStyle, readARHandoffUrl, sampleSequenceTrack, sceneLight, sectionSnapshot, serializeMeasurements, upsertSequenceKeyframe };
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { a6 as SceneLight, o as ObjectBinding, L as ObjectBindingType } from './rendererBackend-QwMzISTn.js';
2
- export { f as AnimationLoopMode, B as BindingEdit, D as DEFAULT_SCENE_CONFIG, j as DEFAULT_SECTION_CONFIG, k as DeepPartial, E as EnvironmentPreset, G as GlitchModeName, I as IsolatedObjectBindings, K as KernelSizeName, M as MATERIAL_BLENDING_MODES, m as MATERIAL_SIDES, n as ObjectActionEvent, p as ObjectBindingAction, q as ObjectBindingCameraState, r as ObjectBindingDecal, s as ObjectBindingMaterial, t as ObjectBindingMaterialBlendingMode, u as ObjectBindingMaterialSide, v as ObjectBindingPatch, w as ObjectBindingSelector, x as ObjectBindingStatus, y as ObjectBindingStyle, z as ObjectBindingTarget, F as ObjectBindingTextureChannel, H as ObjectBindingTextureSlot, J as ObjectBindingTransform, P as ObjectPointerEvent, Q as ObjectSurfacePoint, R as RampTypeName, S as RendererBackend, T as SceneAnimationClipConfig, U as SceneAnimationConfig, V as SceneAnnotationCameraView, W as SceneAnnotationImage, X as SceneAnnotationLink, Y as SceneAnnotationMarker, Z as SceneBackgroundConfig, _ as SceneCameraConfig, $ as SceneCinematicConfig, a0 as SceneCinematicWaypoint, a1 as SceneConfig, a3 as SceneConfigPatch, a4 as SceneEnvironmentConfig, a5 as SceneGroundShadowConfig, a7 as SceneLightAttachment, a8 as SceneLightType, a9 as SceneLightingConfig, aa as SceneModelConfig, ab as SceneModelRenderer, ac as ScenePostProcessingConfig, ad as SceneSectionAxis, ae as SceneSectionConfig, af as SceneShadowConfig, ag as SceneStyleColorScale, ah as SceneStyleCondition, ai as SceneStylePulse, aj as SceneStyleRule, ak as SceneWireframeConfig, al as StyledObjectBindings, am as StyledObjectPulse, aq as ViewerIsolation, ar as ViewerObjectInfo, at as applyIsolation, au as applyStyleRules, av as colorScaleValue, aw as isolatedBindingKeys, ax as material, ay as patchBindings, az as patchSceneConfig, aA as selectBindingKeys, aB as selectBindings } from './rendererBackend-QwMzISTn.js';
3
- export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, b as ModelViewerLabelKey, c as ModelViewerLabels, R as ReducedMotionSetting, d as chooseMaterialVariant } from './materialVariants-DnZe9eMC.js';
1
+ import { b0 as SceneLight, ao as ObjectBinding, aD as ObjectBindingType, a9 as MeasurementUnit, a6 as MeasurementSettings, aL as SavedMeasurement, a3 as MeasurementPoint, a5 as MeasurementResult, a8 as MeasurementTool, a2 as MeasurementCollection, ay as ObjectBindingStyle, az as ObjectBindingTarget, V as InspectAssetOptions, q as AssetDiagnosticsReport, e as ARSnapshotSource, A as ARExportOptions, d as ARSnapshot, bv as ShareableViewerState, bM as ViewerStateStorage, bn as SequenceEasing, bd as SceneSequence, bs as SequenceTrack, bt as SequenceValue, bo as SequenceKeyframe, b8 as SceneSectionConfig, bb as SceneSectionSettings } from './modelViewerProps-BibuMND7.js';
2
+ export { a as ARHandoffOptions, b as ARHandoffRequest, c as ARHandoffStatus, l as AnimationLoopMode, p as AssetDiagnosticIssue, r as AssetDiagnosticsSource, s as AssetTextureDiagnostic, t as AssetTransform, B as BindingEdit, E as ComparisonCategory, F as ComparisonChange, G as ComparisonHighlight, H as ComparisonObject, I as ComparisonStatus, J as ConfigurationComparisonInput, K as ConfigurationComparisonReport, N as DEFAULT_SCENE_CONFIG, O as DEFAULT_SECTION_CONFIG, Q as DeepPartial, R as EnvironmentPreset, S as GlitchModeName, W as IsolatedObjectBindings, Y as KernelSizeName, Z as MATERIAL_BLENDING_MODES, _ as MATERIAL_SIDES, $ as MAX_VIEWER_STATE_BYTES, a1 as MeasurementAnchor, a4 as MeasurementPosition, a7 as MeasurementStatus, an as ObjectActionEvent, ap as ObjectBindingAction, aq as ObjectBindingCameraState, ar as ObjectBindingDecal, as as ObjectBindingMaterial, at as ObjectBindingMaterialBlendingMode, au as ObjectBindingMaterialSide, av as ObjectBindingPatch, aw as ObjectBindingSelector, ax as ObjectBindingStatus, aA as ObjectBindingTextureChannel, aB as ObjectBindingTextureSlot, aC as ObjectBindingTransform, aF as ObjectPointerEvent, aG as ObjectSurfacePoint, aJ as RampTypeName, aK as RendererBackend, aM as SceneAnimationClipConfig, aN as SceneAnimationConfig, aO as SceneAnnotationCameraView, aP as SceneAnnotationImage, aQ as SceneAnnotationLink, aR as SceneAnnotationMarker, aS as SceneBackgroundConfig, aT as SceneCameraConfig, aU as SceneCinematicConfig, aV as SceneCinematicWaypoint, aX as SceneConfig, aZ as SceneConfigPatch, a_ as SceneEnvironmentConfig, a$ as SceneGroundShadowConfig, b1 as SceneLightAttachment, b2 as SceneLightType, b3 as SceneLightingConfig, b4 as SceneModelConfig, b5 as SceneModelRenderer, b6 as ScenePostProcessingConfig, b7 as SceneSectionAxis, bc as SceneSelectionSet, be as SceneShadowConfig, bf as SceneStyleColorScale, bg as SceneStyleCondition, bh as SceneStylePulse, bi as SceneStyleRule, bj as SceneWireframeConfig, bk as SemanticComparisonOptions, bl as SequenceCameraView, bm as SequenceControls, bp as SequenceObjectProperty, bq as SequencePlaybackState, br as SequenceTarget, bu as SequenceVector3, bw as StreamingDiagnostics, bx as StyledObjectBindings, by as StyledObjectPulse, bG as ViewerConfiguration, bI as ViewerIsolation, bJ as ViewerObjectInfo, bL as ViewerRuntimeStats, bP as applyIsolation, bQ as applyStyleRules, bR as colorScaleValue, bS as compareViewerConfigurations, bT as groundAsset, bU as isolatedBindingKeys, bV as material, bW as parseAssetTransform, bX as parseSelectionSets, bY as parseViewerState, bZ as patchBindings, b_ as patchSceneConfig, b$ as prepareViewerState, c0 as selectBindingKeys, c1 as selectBindings, c2 as serializeViewerState, c3 as snapAssetToGrid } from './modelViewerProps-BibuMND7.js';
3
+ export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, c as ModelViewerLabelKey, d as ModelViewerLabels, R as ReducedMotionSetting, h as chooseMaterialVariant } from './modelFileResolver-Co7j1tdQ.js';
4
+ import { Object3D } from 'three';
5
+ import 'react';
6
+ import '@react-three/drei';
4
7
 
5
8
  /** A light's id plus whichever of its settings you want to set. */
6
9
  type SceneLightInput = Pick<SceneLight, "id"> & Partial<Omit<SceneLight, "id">>;
@@ -62,4 +65,59 @@ type ActionCatalogEntry = {
62
65
  declare const ACTION_CATALOG: readonly ActionCatalogEntry[];
63
66
  declare function findCatalogAction(id: string): ActionCatalogEntry | undefined;
64
67
 
65
- export { ACTION_CATALOG, type ActionCatalogEntry, type ActionHandling, ObjectBinding, type ObjectBindingActionId, type ObjectBindingKey, ObjectBindingType, SceneLight, type SceneLightInput, buildBindingsFromNodes, createDefaultBinding, defineObjectBindings, findCatalogAction, inferType, sceneLight };
68
+ declare const MEASUREMENT_UNITS: readonly MeasurementUnit[];
69
+ declare function measurementScale(settings?: MeasurementSettings, legacyUnit?: string): {
70
+ displayUnit: string;
71
+ metersPerUnit: number;
72
+ factor: number;
73
+ };
74
+ /** Uses an existing two-point distance as a known real-world length. */
75
+ declare function calibrateMeasurements(rawLength: number, knownLength: number, unit: MeasurementUnit, settings?: MeasurementSettings): MeasurementSettings;
76
+ declare function measurementValue(tool: MeasurementTool, points: readonly MeasurementPoint[]): {
77
+ value: number;
78
+ dimension: 0 | 1 | 2;
79
+ } | null;
80
+ declare function measurementResult(measurement: SavedMeasurement, settings?: MeasurementSettings, legacyUnit?: string, points?: MeasurementPoint[], status?: MeasurementResult["status"]): MeasurementResult;
81
+ /** Reject malformed measurement data before loading a file or shared scene. */
82
+ declare function parseMeasurements(input: unknown): MeasurementCollection;
83
+ declare function serializeMeasurements(collection: MeasurementCollection): string;
84
+ /** Supply live resolved results when exporting measurements on transformed objects. */
85
+ declare function measurementsToCsv(collection: MeasurementCollection, results?: readonly MeasurementResult[], legacyUnit?: string): string;
86
+
87
+ /** A structural node; objectId is present only on bindable, named meshes. */
88
+ type ViewerHierarchyNode = {
89
+ id: string;
90
+ parentId: string | null;
91
+ name: string;
92
+ objectId?: string;
93
+ };
94
+ /** Preserves source groups without renaming, reparenting, or changing transforms. */
95
+ declare function collectObjectHierarchy(root: Object3D): ViewerHierarchyNode[];
96
+
97
+ /** Detached style snapshot. Identity, transforms, decals, and actions stay with their object. */
98
+ declare function copyBindingStyle(binding: ObjectBinding): ObjectBindingStyle;
99
+ /** Replaces authored style overrides on every target, preserving all other fields. */
100
+ declare function pasteBindingStyle(bindings: Record<string, ObjectBinding>, target: ObjectBindingTarget, style: ObjectBindingStyle): Record<string, ObjectBinding>;
101
+
102
+ /** Inspect loaded data without fetching, rendering, modifying, or disposing it. */
103
+ declare function inspectAsset(scene: Object3D, options?: InspectAssetOptions): AssetDiagnosticsReport;
104
+
105
+ /** Exports the visible edited geometry, live PBR materials, decals and placements. */
106
+ declare function exportConfiguredUSDZ(sources: ARSnapshotSource[], options?: ARExportOptions): Promise<ARSnapshot>;
107
+
108
+ declare function createARHandoffUrl(state: ShareableViewerState, baseUrl: string, storage?: ViewerStateStorage, signal?: AbortSignal): Promise<string>;
109
+ declare function readARHandoffUrl(value: string, storage?: ViewerStateStorage, signal?: AbortSignal): Promise<ShareableViewerState | null>;
110
+
111
+ declare const SEQUENCE_OBJECT_PROPERTIES: readonly ["position", "rotation", "scale", "visible", "baseColor", "emissive", "opacity", "roughness", "metalness", "emissiveIntensity"];
112
+ declare const SEQUENCE_EASINGS: readonly SequenceEasing[];
113
+ /** Validates imported JSON and returns detached, sorted, executable-code-free data. */
114
+ declare function parseSequences(input: unknown): SceneSequence[];
115
+ declare function sampleSequenceTrack(track: SequenceTrack, time: number): SequenceValue | null;
116
+ declare function upsertSequenceKeyframe(track: SequenceTrack, frame: SequenceKeyframe): SequenceTrack;
117
+
118
+ /** Validate stored section settings, including legacy single-plane settings. */
119
+ declare function parseSectionConfig(input: unknown): SceneSectionConfig;
120
+ /** Detach a reusable snapshot without nesting the preset library. */
121
+ declare function sectionSnapshot(section: SceneSectionConfig): SceneSectionSettings;
122
+
123
+ export { ACTION_CATALOG, ARExportOptions, ARSnapshot, ARSnapshotSource, type ActionCatalogEntry, type ActionHandling, AssetDiagnosticsReport, InspectAssetOptions, MEASUREMENT_UNITS, MeasurementCollection, MeasurementPoint, MeasurementResult, MeasurementSettings, MeasurementTool, MeasurementUnit, ObjectBinding, type ObjectBindingActionId, type ObjectBindingKey, ObjectBindingStyle, ObjectBindingTarget, ObjectBindingType, SEQUENCE_EASINGS, SEQUENCE_OBJECT_PROPERTIES, SavedMeasurement, SceneLight, type SceneLightInput, SceneSectionConfig, SceneSequence, SequenceEasing, SequenceKeyframe, SequenceTrack, SequenceValue, ShareableViewerState, type ViewerHierarchyNode, ViewerStateStorage, buildBindingsFromNodes, calibrateMeasurements, collectObjectHierarchy, copyBindingStyle, createARHandoffUrl, createDefaultBinding, defineObjectBindings, exportConfiguredUSDZ, findCatalogAction, inferType, inspectAsset, measurementResult, measurementScale, measurementValue, measurementsToCsv, parseMeasurements, parseSectionConfig, parseSequences, pasteBindingStyle, readARHandoffUrl, sampleSequenceTrack, sceneLight, sectionSnapshot, serializeMeasurements, upsertSequenceKeyframe };
package/dist/utils.js CHANGED
@@ -1 +1,2 @@
1
- "use strict";var h=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var t in e)h(n,t,{get:e[t],enumerable:!0})},Y=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of H(e))!K.call(n,i)&&i!==t&&h(n,i,{get:()=>e[i],enumerable:!(r=U(e,i))||r.enumerable});return n};var $=n=>Y(h({},"__esModule",{value:!0}),n);var ue={};W(ue,{ACTION_CATALOG:()=>b,DEFAULT_MODEL_VIEWER_LABELS:()=>B,DEFAULT_SCENE_CONFIG:()=>z,DEFAULT_SECTION_CONFIG:()=>G,MATERIAL_BLENDING_MODES:()=>F,MATERIAL_SIDES:()=>_,applyIsolation:()=>V,applyStyleRules:()=>L,buildBindingsFromNodes:()=>N,chooseMaterialVariant:()=>P,colorScaleValue:()=>x,createDefaultBinding:()=>v,defineObjectBindings:()=>j,findCatalogAction:()=>D,inferType:()=>w,isolatedBindingKeys:()=>O,material:()=>M,patchBindings:()=>A,patchSceneConfig:()=>E,sceneLight:()=>k,selectBindingKeys:()=>u,selectBindings:()=>T});module.exports=$(ue);function j(n){return n}function y(n){if(typeof n!="object"||n===null)return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function p(n,e){if(!y(e))return e;let t=y(n)?{...n}:{};for(let r of Object.keys(e)){let i=e[r];t[r]=y(i)?p(t[r],i):i}return t}function C(n,e){if(n[e])return e;let t=Object.entries(n).find(([,i])=>i.id===e)?.[0];return t||(Object.entries(n).find(([,i])=>i.modelObjectId===e)?.[0]??null)}function X(n){return typeof n=="object"&&!Array.isArray(n)}function q(n,e){return"group"in e?n.group===e.group:"tag"in e?n.tags?.includes(e.tag)??!1:(n.type??"other")===e.type}function u(n,e){if(X(e))return Object.entries(n).filter(([,i])=>q(i,e)).map(([i])=>i);let r=(typeof e=="string"?[e]:e).map(i=>C(n,i)).filter(i=>i!==null);return[...new Set(r)]}function T(n,e){return u(n,e).map(t=>n[t]).filter(t=>t!==void 0)}function Z(n){return Array.isArray(n)&&n.length>0&&typeof n[0]!="string"}function A(n,e,t){let r=Z(e)?e:[{ids:e,patch:t??{}}],i=n;for(let s of r)for(let o of u(i,s.ids)){let c=i[o];if(!c)continue;let a=p(c,s.patch);i===n&&(i={...n}),i[o]=a}return i}function M(n){return{style:{material:n}}}function E(n,e){return p(n,e)}var Q={type:"point",color:"#ffffff",intensity:1,position:[0,0,0],distance:0,decay:2,attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0};function k(n){return{...Q,...n}}var J="#ff3b30",ee=Object.freeze({}),R=n=>n;function ne(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function te(n,e){let t=n.metadata;for(let r of e.split(".")){if(!ne(t))return;t=t[r]}return t}function ie(n,e){if("metric"in e){let t=n.metrics?.[e.metric];return!(typeof t!="number"||!Number.isFinite(t)||e.above!==void 0&&!(t>e.above)||e.below!==void 0&&!(t<e.below))}if("status"in e){let t=n.status??"normal";return Array.isArray(e.status)?e.status.includes(t):e.status===t}return te(n,e.metadata)===e.equals}function oe(n){let e=n.trim().replace(/^#/,""),t=e.length===3?e.split("").map(r=>r+r).join(""):e;return/^[0-9a-f]{6}$/i.test(t)?[0,2,4].map(r=>parseInt(t.slice(r,r+2),16)):null}var S=n=>`#${n.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`;function x(n,e){let t=n.map(([a,l])=>({at:a,rgb:oe(l)})).filter(a=>Number.isFinite(a.at)&&a.rgb!==null).sort((a,l)=>a.at-l.at);if(t.length===0||!Number.isFinite(e))return null;if(e<=t[0].at)return S(t[0].rgb);let r=t[t.length-1];if(e>=r.at)return S(r.rgb);let i=t.findIndex(a=>a.at>=e),s=t[i-1],o=t[i],c=o.at===s.at?1:(e-s.at)/(o.at-s.at);return S(s.rgb.map((a,l)=>a+(o.rgb[l]-a)*c))}function L(n,e){if(!e?.length)return{bindings:n,pulses:ee,sourceOf:R};let t=new Map,r={};for(let o of e){let c=o.target?u(n,o.target):Object.keys(n),a=o.when?Array.isArray(o.when)?o.when:[o.when]:[];for(let l of c){let f=n[l];if(!a.every(d=>ie(f,d)))continue;let m={...o.material};if(o.colorScale){let d=f.metrics?.[o.colorScale.metric],g=typeof d=="number"?x(o.colorScale.stops,d):null;g&&(m={...m,[o.colorScale.channel??"baseColor"]:g})}if(o.pulse){let d=o.pulse===!0?{}:o.pulse;r[l]={color:d.color??J,speed:d.speed!==void 0&&d.speed>0?d.speed:1};let g=m.emissiveIntensity??t.get(l)?.emissiveIntensity??f.style?.material?.emissiveIntensity;g!==void 0&&g>0||(m.emissiveIntensity=1)}Object.keys(m).length>0&&t.set(l,{...t.get(l),...m})}}if(t.size===0)return{bindings:n,pulses:r,sourceOf:R};let i={...n},s=new WeakMap;for(let[o,c]of t){let a=n[o],l={...a,style:{...a.style,material:{...a.style?.material,...c}}};i[o]=l,s.set(l,a)}return{bindings:i,pulses:r,sourceOf:o=>s.get(o)??o}}function P(n,e,t){let r=t.find(s=>s.variants.some(o=>o.name===e)),i=new Set(r?.variants.map(s=>s.name)??[e]);return[...n.filter(s=>!i.has(s)),e]}var re=.12,I=new Set;function O(n,e){return e?new Set(u(n,e.target)):I}function V(n,e){let t=O(n.bindings,e);if(!e||t.size===0)return{...n,setAside:I};let r=Math.min(Math.max(e.ghostOpacity??re,0),1),i={...n.bindings},s=new WeakMap,o=new Set;for(let[c,a]of Object.entries(n.bindings)){if(t.has(c))continue;o.add(c);let l=e.mode==="hide"?{...a,visible:!1}:{...a,style:{...a.style,material:{...a.style?.material,opacity:Math.min(a.style?.material?.opacity??1,r)}}};i[c]=l,s.set(l,n.sourceOf(a))}return{bindings:i,pulses:n.pulses,sourceOf:c=>s.get(c)??n.sourceOf(c),setAside:o}}var b=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]);function D(n){return b.find(e=>e.id===n)}var Me=b.filter(n=>n.handling==="viewer").map(n=>n.id),Ee=new Set(["","New Action",...b.map(n=>n.label)]);function ae(n){return n.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function se(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function w(n){let e=n.toLowerCase();return e.includes("light")?"light":e.includes("wheel")||e.includes("rim")||e.includes("tire")?"wheel":e.includes("glass")||e.includes("window")||e.includes("windshield")||e.includes("sunroof")?"glass":e.includes("seat")||e.includes("dashboard")||e.includes("console")||e.includes("doorpanel")?"interior":e.includes("floor")?"floor":e.includes("wall")?"wall":e.includes("door")?"door":e.includes("chair")||e.includes("table")||e.includes("sofa")||e.includes("bed")?"furniture":"other"}function le(n,e=!0){return n==="light"||n.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},...e?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function v(n,e=!0){let t=w(n);return{id:ae(n),modelObjectId:n,type:t,label:se(n),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:le(t,e),metrics:{},metadata:{}}}function N(n,e){return Object.fromEntries(n.map(t=>[t,v(t,!e?.has(t))]))}var _=["front","back","double"],F=["normal","additive"];var G={enabled:!1,axis:"y",position:.5,flip:!1},ce={clips:[],autoplayClip:null},de={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},z={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:de,animations:ce,annotations:[]};var B={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Point Lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"SCENE OBJECTS",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text colour",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Colour",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};var Ie=new Map(Object.entries(B).map(([n,e])=>[e,n]));0&&(module.exports={ACTION_CATALOG,DEFAULT_MODEL_VIEWER_LABELS,DEFAULT_SCENE_CONFIG,DEFAULT_SECTION_CONFIG,MATERIAL_BLENDING_MODES,MATERIAL_SIDES,applyIsolation,applyStyleRules,buildBindingsFromNodes,chooseMaterialVariant,colorScaleValue,createDefaultBinding,defineObjectBindings,findCatalogAction,inferType,isolatedBindingKeys,material,patchBindings,patchSceneConfig,sceneLight,selectBindingKeys,selectBindings});
1
+ "use strict";var mn=Object.create;var xe=Object.defineProperty;var fn=Object.getOwnPropertyDescriptor;var pn=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var hn=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})},tt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of pn(t))!bn.call(e,o)&&o!==r&&xe(e,o,{get:()=>t[o],enumerable:!(n=fn(t,o))||n.enumerable});return e};var nt=(e,t,r)=>(r=e!=null?mn(gn(e)):{},tt(t||!e||!e.__esModule?xe(r,"default",{value:e,enumerable:!0}):r,e)),yn=e=>tt(xe({},"__esModule",{value:!0}),e);var ur={};hn(ur,{ACTION_CATALOG:()=>pe,DEFAULT_MODEL_VIEWER_LABELS:()=>We,DEFAULT_SCENE_CONFIG:()=>ee,DEFAULT_SECTION_CONFIG:()=>wt,MATERIAL_BLENDING_MODES:()=>xt,MATERIAL_SIDES:()=>St,MAX_VIEWER_STATE_BYTES:()=>Z,MEASUREMENT_UNITS:()=>$e,SEQUENCE_EASINGS:()=>_e,SEQUENCE_OBJECT_PROPERTIES:()=>Le,applyIsolation:()=>pt,applyStyleRules:()=>ut,buildBindingsFromNodes:()=>yt,calibrateMeasurements:()=>Et,chooseMaterialVariant:()=>mt,collectObjectHierarchy:()=>Gt,colorScaleValue:()=>Re,compareViewerConfigurations:()=>dn,copyBindingStyle:()=>Ht,createARHandoffUrl:()=>on,createDefaultBinding:()=>Pe,defineObjectBindings:()=>rt,exportConfiguredUSDZ:()=>Zt,findCatalogAction:()=>ht,groundAsset:()=>Ct,inferType:()=>Ee,inspectAsset:()=>Wt,isolatedBindingKeys:()=>Ie,material:()=>at,measurementResult:()=>qe,measurementScale:()=>He,measurementValue:()=>Ae,measurementsToCsv:()=>Vt,parseAssetTransform:()=>de,parseMeasurements:()=>ie,parseSectionConfig:()=>ge,parseSelectionSets:()=>ve,parseSequences:()=>Me,parseViewerState:()=>ue,pasteBindingStyle:()=>qt,patchBindings:()=>st,patchSceneConfig:()=>ct,prepareViewerState:()=>Oe,readARHandoffUrl:()=>sn,sampleSequenceTrack:()=>At,sceneLight:()=>lt,sectionSnapshot:()=>Mt,selectBindingKeys:()=>K,selectBindings:()=>it,serializeMeasurements:()=>Pt,serializeViewerState:()=>$t,snapAssetToGrid:()=>Ot,upsertSequenceKeyframe:()=>vt});module.exports=yn(ur);function rt(e){return e}function Be(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function me(e,t){if(!Be(t))return t;let r=Be(e)?{...e}:{};for(let n of Object.keys(t)){let o=t[n];r[n]=Be(o)?me(r[n],o):o}return r}function ot(e,t){if(e[t])return t;let r=Object.entries(e).find(([,o])=>o.id===t)?.[0];return r||(Object.entries(e).find(([,o])=>o.modelObjectId===t)?.[0]??null)}function Sn(e){return typeof e=="object"&&!Array.isArray(e)}function xn(e,t){return"group"in t?e.group===t.group:"tag"in t?e.tags?.includes(t.tag)??!1:(e.type??"other")===t.type}function K(e,t){if(Sn(t))return Object.entries(e).filter(([,o])=>xn(o,t)).map(([o])=>o);let n=(typeof t=="string"?[t]:t).map(o=>ot(e,o)).filter(o=>o!==null);return[...new Set(n)]}function it(e,t){return K(e,t).map(r=>e[r]).filter(r=>r!==void 0)}function wn(e){return Array.isArray(e)&&e.length>0&&typeof e[0]!="string"}function st(e,t,r){let n=wn(t)?t:[{ids:t,patch:r??{}}],o=e;for(let a of n)for(let s of K(o,a.ids)){let i=o[s];if(!i)continue;let c=me(i,a.patch);o===e&&(o={...e}),o[s]=c}return o}function at(e){return{style:{material:e}}}function ct(e,t){return me(e,t)}var Mn={type:"point",color:"#ffffff",intensity:1,position:[0,0,0],distance:0,decay:2,attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0};function lt(e){return{...Mn,...e}}var An="#ff3b30",vn=Object.freeze({}),dt=e=>e;function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Cn(e,t){let r=e.metadata;for(let n of t.split(".")){if(!On(r))return;r=r[n]}return r}function jn(e,t){if("metric"in t){let r=e.metrics?.[t.metric];return!(typeof r!="number"||!Number.isFinite(r)||t.above!==void 0&&!(r>t.above)||t.below!==void 0&&!(r<t.below))}if("status"in t){let r=e.status??"normal";return Array.isArray(t.status)?t.status.includes(r):t.status===r}return Cn(e,t.metadata)===t.equals}function Tn(e){let t=e.trim().replace(/^#/,""),r=t.length===3?t.split("").map(n=>n+n).join(""):t;return/^[0-9a-f]{6}$/i.test(r)?[0,2,4].map(n=>parseInt(r.slice(n,n+2),16)):null}var ke=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function Re(e,t){let r=e.map(([c,l])=>({at:c,rgb:Tn(l)})).filter(c=>Number.isFinite(c.at)&&c.rgb!==null).sort((c,l)=>c.at-l.at);if(r.length===0||!Number.isFinite(t))return null;if(t<=r[0].at)return ke(r[0].rgb);let n=r[r.length-1];if(t>=n.at)return ke(n.rgb);let o=r.findIndex(c=>c.at>=t),a=r[o-1],s=r[o],i=s.at===a.at?1:(t-a.at)/(s.at-a.at);return ke(a.rgb.map((c,l)=>c+(s.rgb[l]-c)*i))}function ut(e,t){if(!t?.length)return{bindings:e,pulses:vn,sourceOf:dt};let r=new Map,n={};for(let s of t){let i=s.target?K(e,s.target):Object.keys(e),c=s.when?Array.isArray(s.when)?s.when:[s.when]:[];for(let l of i){let m=e[l];if(!c.every(f=>jn(m,f)))continue;let d={...s.material};if(s.colorScale){let f=m.metrics?.[s.colorScale.metric],u=typeof f=="number"?Re(s.colorScale.stops,f):null;u&&(d={...d,[s.colorScale.channel??"baseColor"]:u})}if(s.pulse){let f=s.pulse===!0?{}:s.pulse;n[l]={color:f.color??An,speed:f.speed!==void 0&&f.speed>0?f.speed:1};let u=d.emissiveIntensity??r.get(l)?.emissiveIntensity??m.style?.material?.emissiveIntensity;u!==void 0&&u>0||(d.emissiveIntensity=1)}Object.keys(d).length>0&&r.set(l,{...r.get(l),...d})}}if(r.size===0)return{bindings:e,pulses:n,sourceOf:dt};let o={...e},a=new WeakMap;for(let[s,i]of r){let c=e[s],l={...c,style:{...c.style,material:{...c.style?.material,...i}}};o[s]=l,a.set(l,c)}return{bindings:o,pulses:n,sourceOf:s=>a.get(s)??s}}function mt(e,t,r){let n=r.find(a=>a.variants.some(s=>s.name===t)),o=new Set(n?.variants.map(a=>a.name)??[t]);return[...e.filter(a=>!o.has(a)),t]}var Bn=.12,ft=new Set;function Ie(e,t){return t?new Set(K(e,t.target)):ft}function pt(e,t){let r=Ie(e.bindings,t);if(!t||r.size===0)return{...e,setAside:ft};let n=Math.min(Math.max(t.ghostOpacity??Bn,0),1),o={...e.bindings},a=new WeakMap,s=new Set;for(let[i,c]of Object.entries(e.bindings)){if(r.has(i))continue;s.add(i);let l=t.mode==="hide"?{...c,visible:!1}:{...c,style:{...c.style,material:{...c.style?.material,opacity:Math.min(c.style?.material?.opacity??1,n)}}};o[i]=l,a.set(l,e.sourceOf(c))}return{bindings:o,pulses:e.pulses,sourceOf:i=>a.get(i)??e.sourceOf(i),setAside:s}}var kn=require("three"),gt=Symbol("react-immersive.model-node-id");function Rn(e,t){Object.defineProperty(e,gt,{value:t,configurable:!0})}function bt(e){let t=new Map;e.traverse(c=>{if(!c.name)return;let l=t.get(c.name);l?l.push(c):t.set(c.name,[c])});let r=Object.create(null),n=new WeakMap,o=new Map,a=new Set(Array.from(t,([c,l])=>l.length===1?c:null).filter(c=>c!==null)),s=new Set,i=(c,l)=>{Rn(c,l),r[l]=c,n.set(c,l),s.add(l)};for(let[c,l]of t)l.length===1&&i(l[0],c);for(let[c,l]of t){if(l.length<2)continue;let m=[];l.forEach((d,f)=>{let u=`${c} [${f+1}]`,A=u,C=2;for(;a.has(A)||s.has(A);)A=`${u}.${C++}`;i(d,A),m.push(A)}),o.set(c,m)}return{nodesById:r,idByNode:n,duplicateNames:o}}function fe(e){return e[gt]??e.name??null}var pe=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]);function ht(e){return pe.find(t=>t.id===e)}var kr=pe.filter(e=>e.handling==="viewer").map(e=>e.id),Rr=new Set(["","New Action",...pe.map(e=>e.label)]);function In(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function En(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function Ee(e){let t=e.toLowerCase();return t.includes("light")?"light":t.includes("wheel")||t.includes("rim")||t.includes("tire")?"wheel":t.includes("glass")||t.includes("window")||t.includes("windshield")||t.includes("sunroof")?"glass":t.includes("seat")||t.includes("dashboard")||t.includes("console")||t.includes("doorpanel")?"interior":t.includes("floor")?"floor":t.includes("wall")?"wall":t.includes("door")?"door":t.includes("chair")||t.includes("table")||t.includes("sofa")||t.includes("bed")?"furniture":"other"}function Pn(e,t=!0){return e==="light"||e.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},...t?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function Pe(e,t=!0){let r=Ee(e);return{id:In(e),modelObjectId:e,type:r,label:En(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:Pn(r,t),metrics:{},metadata:{}}}function yt(e,t){return Object.fromEntries(e.map(r=>[r,Pe(r,!t?.has(r))]))}var St=["front","back","double"],xt=["normal","additive"];var wt={enabled:!1,axis:"y",position:.5,flip:!1},Vn={clips:[],autoplayClip:null},Dn={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},ee={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:Dn,animations:Vn,annotations:[]};function ge(e){let t=m=>{throw new Error(`Invalid section: ${m}`)},r=m=>m&&typeof m=="object"&&!Array.isArray(m)?m:t("expected an object"),n=m=>typeof m=="string"&&m.trim().length>0&&m.length<=200?m:t("expected a nonempty name or id (up to 200 characters)"),o=m=>typeof m=="number"&&Number.isFinite(m)&&m>=0&&m<=1?m:t("position must be between 0 and 1"),a=m=>!Array.isArray(m)||m.length!==3||!m.every(d=>typeof d=="number"&&Number.isFinite(d))||Math.hypot(...m)<1e-8?t("normal must be a finite, nonzero vector"):[...m],s=m=>{let d=r(m);return!["x","y","z"].includes(d.axis)||typeof d.enabled!="boolean"||typeof d.flip!="boolean"?t("invalid plane"):{enabled:d.enabled,axis:d.axis,position:o(d.position),flip:d.flip,...d.normal!==void 0?{normal:a(d.normal)}:{}}},i=m=>{let d=r(m),f=s(d);if(d.mode!==void 0){if(!["plane","planes","box"].includes(d.mode))return t("invalid mode");f.mode=d.mode}if(d.planes!==void 0){if(!Array.isArray(d.planes)||d.planes.length>6)return t("at most six planes are supported");let u=new Set;f.planes=d.planes.map(A=>{let C=r(A),b=n(C.id);return u.has(b)?t("duplicate plane id"):(u.add(b),{...s(C),id:b,name:n(C.name)})})}if(d.activePlaneId!==void 0&&(f.activePlaneId=n(d.activePlaneId)),d.invertBox!==void 0){if(typeof d.invertBox!="boolean")return t("invalid box inversion");f.invertBox=d.invertBox}if(d.box!==void 0){let u=r(d.box),A=p=>!Array.isArray(p)||p.length!==3?t("invalid box bounds"):p.map(o),C=A(u.min),b=A(u.max);if(C.some((p,h)=>p>=b[h]))return t("box minimum must be below its maximum on every axis");f.box={min:C,max:b}}return f},c=r(e),l=i(c);if(c.presets!==void 0){if(!Array.isArray(c.presets)||c.presets.length>32)return t("at most 32 presets are supported");let m=new Set;l.presets=c.presets.map(d=>{let f=r(d),u=n(f.id);return m.has(u)?t("duplicate preset id"):(m.add(u),{id:u,name:n(f.name),settings:i(f.settings)})})}return l}function Mt(e){let{presets:t,...r}=ge(e);return r}var Ne=require("three"),Le=["position","rotation","scale","visible","baseColor","emissive","opacity","roughness","metalness","emissiveIntensity"],_e=["linear","ease-in","ease-out","ease-in-out","step"],Nn=new Set(["position","rotation","scale"]),Ln=new Set(["baseColor","emissive"]),ne=e=>typeof e=="string"&&e.length>0&&e.length<=256,oe=e=>typeof e=="number"&&Number.isFinite(e),Ve=e=>Array.isArray(e)&&e.length===3&&e.every(oe);function be(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function re(e){throw new Error(`Invalid sequences: ${e}`)}function _n(e){return e.kind==="object"?JSON.stringify([e.kind,e.objectId,e.property]):e.kind==="clip"?JSON.stringify([e.kind,e.clip]):"camera"}function Un(e,t){if(t.kind==="camera")return be(e)&&Ve(e.position)&&Ve(e.target)&&(e.fov===null||oe(e.fov)&&e.fov>0&&e.fov<180)&&oe(e.zoom)&&e.zoom>0;if(t.kind==="clip")return oe(e)&&e>=0;let r=t.property;return Nn.has(r)?Ve(e)&&(r!=="scale"||e.every(n=>n!==0)):Ln.has(r)?typeof e=="string"&&/^#[\da-f]{6}$/i.test(e):r==="visible"?typeof e=="boolean":oe(e)&&e>=0&&(r==="emissiveIntensity"||e<=1)}function Me(e){(!Array.isArray(e)||e.length>64)&&re("expected up to 64 sequences.");let t=new Set,r=0;return e.map(n=>{(!be(n)||!ne(n.id)||t.has(n.id)||!(typeof n.name=="string"&&ne(n.name.trim()))||!oe(n.duration)||n.duration<.1||n.duration>3600||typeof n.loop!="boolean"||typeof n.autoPlay!="boolean"||!Array.isArray(n.tracks)||n.tracks.length>128)&&re("each sequence needs a unique id, name, 0.1\u20133600 second duration, loop/autoplay flags and up to 128 tracks."),t.add(n.id);let o=new Set,a=new Set,s=n.tracks.map(i=>{(!be(i)||!ne(i.id)||o.has(i.id)||!(typeof i.name=="string"&&ne(i.name.trim()))||!be(i.target)||!Array.isArray(i.keyframes)||i.keyframes.length>2048||i.muted!==void 0&&typeof i.muted!="boolean")&&re("invalid or duplicate track."),o.add(i.id);let c;i.target.kind==="camera"?c={kind:"camera"}:i.target.kind==="clip"&&ne(i.target.clip)?c={kind:"clip",clip:i.target.clip}:i.target.kind==="object"&&ne(i.target.objectId)&&Le.includes(i.target.property)?c={kind:"object",objectId:i.target.objectId,property:i.target.property}:re("unknown track target or property.");let l=_n(c);a.has(l)&&re("only one track may own each target property in a sequence."),a.add(l);let m=new Set,d=new Set,f=i.keyframes.map(u=>{++r>2e4&&re("too many keyframes."),(!be(u)||!ne(u.id)||m.has(u.id)||!oe(u.time)||u.time<0||u.time>n.duration||d.has(u.time)||u.easing!==void 0&&!_e.includes(u.easing)||!Un(u.value,c))&&re("keyframes need unique ids/times, valid values and times inside the sequence."),m.add(u.id),d.add(u.time);let A=u.value,C=c.kind==="camera"?{position:[...A.position],target:[...A.target],fov:A.fov,zoom:A.zoom}:Array.isArray(u.value)?[...u.value]:u.value;return{id:u.id,time:u.time,value:C,...u.easing?{easing:u.easing}:{}}}).sort((u,A)=>u.time-A.time);return{id:i.id,name:i.name.trim(),target:c,keyframes:f,...i.muted!==void 0?{muted:i.muted}:{}}});return{id:n.id,name:n.name.trim(),duration:n.duration,loop:n.loop,autoPlay:n.autoPlay,tracks:s}})}function zn(e,t="ease-in-out"){let r=Math.max(0,Math.min(1,e));return t==="step"?0:t==="ease-in"?r*r:t==="ease-out"?1-(1-r)**2:t==="ease-in-out"?r*r*(3-2*r):r}var we=(e,t,r)=>e+(t-e)*r,De=(e,t,r)=>e.map((n,o)=>we(n,t[o],r));function At(e,t){if(e.muted||!e.keyframes.length||!Number.isFinite(t))return null;let r=e.keyframes;if(t<r[0].time)return null;let n=r[0],o;for(let c of r)if(c.time<=t)n=c;else{o=c;break}if(!o||typeof n.value=="boolean")return structuredClone(n.value);let a=zn((t-n.time)/(o.time-n.time),n.easing);if(typeof n.value=="number"&&typeof o.value=="number")return we(n.value,o.value,a);if(typeof n.value=="string"&&typeof o.value=="string")return`#${new Ne.Color(n.value).lerp(new Ne.Color(o.value),a).getHexString()}`;if(Array.isArray(n.value)&&Array.isArray(o.value))return De(n.value,o.value,a);let s=n.value,i=o.value;return{position:De(s.position,i.position,a),target:De(s.target,i.target,a),fov:s.fov!==null&&i.fov!==null?we(s.fov,i.fov,a):s.fov,zoom:we(s.zoom,i.zoom,a)}}function vt(e,t){return{...e,keyframes:[...e.keyframes.filter(r=>r.id!==t.id&&Math.abs(r.time-t.time)>1e-6),t].sort((r,n)=>r.time-n.time)}}var G=require("three");function Ue(e){return e.id??e.url}function de(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected an asset transform object.");let t={};for(let r of["position","rotation","scale"]){let n=e[r];if(n!==void 0){if(!Array.isArray(n)||n.length!==3||!n.every(o=>typeof o=="number"&&Number.isFinite(o))||r==="scale"&&n.some(o=>o===0))throw new Error(`Invalid asset ${r}: expected three finite ${r==="scale"?"nonzero ":""}numbers.`);t[r]=[...n]}}return t}function Ot(e,t){if(!Number.isFinite(t)||t<=0)throw new Error("Grid size must be positive.");let r=de(e),[n,o,a]=r.position??[0,0,0];return{...r,position:[Math.round(n/t)*t,o,Math.round(a/t)*t]}}function Ct(e,t){let r=de(e),n=r.position??[0,0,0],o=new G.Matrix4().compose(new G.Vector3(...n),new G.Quaternion().setFromEuler(new G.Euler(...r.rotation??[0,0,0])),new G.Vector3(...r.scale??[1,1,1])),a=new G.Box3(new G.Vector3(...t.min),new G.Vector3(...t.max)).applyMatrix4(o);if(!Number.isFinite(a.min.y))throw new Error("Cannot place an asset with empty bounds.");return{...r,position:[n[0],n[1]-a.min.y,n[2]]}}var X=require("three"),Fn=new Map,ze={color:"#93c5fd",intensity:.07},_r=new X.Color(ze.color).multiplyScalar(ze.intensity),Ur=new X.Color(ze.color);var $n=new Map;function jt(e){return $n.get(e)}function Tt(e){for(let t of Fn.values())if(t.texture.source===e.source&&(!t.loaded||t.failed))return!0;return!1}var I=require("three");function Bt(e){if(e.length!==3)return null;let t=new I.Vector3(...e[0]).sub(new I.Vector3(...e[1])),r=new I.Vector3(...e[2]).sub(new I.Vector3(...e[1]));return t.lengthSq()===0||r.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,t.normalize().dot(r.normalize()))))*180/Math.PI}function kt(e,t){if(!e.normal)return null;let r=new I.Vector3(...e.normal);if(r.lengthSq()===0)return null;r.normalize();let n=new I.Vector3(...t),o=n.clone().sub(new I.Vector3(...e.position)).dot(r);return{distance:Math.abs(o),projection:n.addScaledVector(r,-o).toArray()}}function Rt(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new I.Vector3(...e[0]),r=e.map(b=>new I.Vector3(...b).sub(t)),n=Math.max(...r.map(b=>b.length()));if(n===0)return{error:"Area points must be distinct."};let o=new I.Vector3;for(let b=1;b<r.length-1;b+=1){let p=r[b].clone().cross(r[b+1]);p.lengthSq()>o.lengthSq()&&o.copy(p)}if(o.length()<=n*n*1e-10)return{error:"Area points must not lie on one straight line."};o.normalize();let a=Math.max(n*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(r.some(b=>Math.abs(b.dot(o))>a))return{error:"Area points must lie on one plane."};let s=r.find(b=>b.length()>n*1e-10).clone().normalize(),i=o.clone().cross(s).normalize(),c=r.map(b=>new I.Vector2(b.dot(s),b.dot(i))),l=(b,p,h)=>(p.x-b.x)*(h.y-b.y)-(p.y-b.y)*(h.x-b.x),m=n*n*1e-10,d=(b,p,h)=>Math.abs(l(b,p,h))<=m&&h.x>=Math.min(b.x,p.x)-n*1e-10&&h.x<=Math.max(b.x,p.x)+n*1e-10&&h.y>=Math.min(b.y,p.y)-n*1e-10&&h.y<=Math.max(b.y,p.y)+n*1e-10;for(let b=0;b<c.length;b+=1){let p=c[b],h=c[(b+1)%c.length];if(p.distanceTo(h)<=n*1e-10)return{error:"Area points must be distinct."};for(let w=b+1;w<c.length;w+=1){if(w===b+1||b===0&&w===c.length-1)continue;let v=c[w],y=c[(w+1)%c.length],R=l(p,h,v),V=l(p,h,y),Q=l(v,y,p),x=l(v,y,h);if(R*V<0&&Q*x<0||d(p,h,v)||d(p,h,y)||d(v,y,p)||d(v,y,h))return{error:"Area edges must not cross or touch each other."}}}let f=0,u=0,A=0;for(let b=0;b<c.length;b+=1){let p=c[b],h=c[(b+1)%c.length],w=p.x*h.y-h.x*p.y;f+=w,u+=(p.x+h.x)*w,A+=(p.y+h.y)*w}if(Math.abs(f)<=m)return{error:"The polygon has no measurable area."};let C=t.clone().addScaledVector(s,u/(3*f)).addScaledVector(i,A/(3*f));return{area:Math.abs(f)/2,center:C.toArray(),triangles:I.ShapeUtils.triangulateShape(c,[])}}function It(e,t){if(e.length<2)return 0;let r=0;for(let n=1;n<e.length;n+=1)r+=new I.Vector3(...e[n]).distanceTo(new I.Vector3(...e[n-1]));return t&&(r+=new I.Vector3(...e[e.length-1]).distanceTo(new I.Vector3(...e[0]))),r}var $e=["m","cm","mm","in","ft"],Fe={m:1,cm:.01,mm:.001,in:.0254,ft:.3048},Gn=["distance","angle","area","pointToPlane","wrap","wrapHorizontal"];function Ge(e){return $e.includes(e)}function He(e={},t="m"){let r=e.displayUnit??t,n=e.metersPerUnit??Fe[e.sourceUnit??"m"];if(!Number.isFinite(n)||n<=0)throw new Error("Measurement scale must be a positive finite number.");return{displayUnit:r,metersPerUnit:n,factor:Ge(r)?n/Fe[r]:1}}function Et(e,t,r,n={}){if(!Ge(r)||!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)throw new Error("Calibration needs two distinct points and a positive known distance.");let o=t*Fe[r]/e;if(!Number.isFinite(o)||o<=0)throw new Error("Calibration scale is outside the supported range.");return{...n,metersPerUnit:o}}function Ae(e,t){let r=t.map(n=>n.position);if(e==="angle"){let n=Bt(r);return n===null?null:{value:n,dimension:0}}if(e==="area"){let n=Rt(r);return"error"in n?null:{value:n.area,dimension:2}}if(e==="pointToPlane"){let n=t.length===2?kt(t[0],t[1].position):null;return n?{value:n.distance,dimension:1}:null}return t.length<(e==="distance"?2:3)?null:{value:It(r,e!=="distance"),dimension:1}}function qe(e,t={},r="m",n=e.points,o=e.approximate?"approximate":"ready"){let a=Ae(e.tool,n),{factor:s,displayUnit:i}=He(t,r),c=o==="ready"||o==="approximate",l=c&&a?a.value*s**a.dimension:null;return{id:e.id,status:c?a&&l!==null&&Number.isFinite(l)?o:"invalid":o,rawValue:c&&a&&Number.isFinite(a.value)?a.value:null,value:l!==null&&Number.isFinite(l)?l:null,unit:e.tool==="angle"?"\xB0":e.tool==="area"?`${i}\xB2`:i}}function ie(e){function t(){throw new Error("Invalid measurements: expected settings and valid named measurements with finite points.")}let r=i=>!!i&&typeof i=="object"&&!Array.isArray(i),n=i=>Array.isArray(i)&&i.length===3&&i.every(c=>typeof c=="number"&&Number.isFinite(c));typeof e=="string"&&(e.length>5*1024*1024&&t(),e=JSON.parse(e)),(!r(e)||e.version!==void 0&&e.version!==1||!r(e.settings)||!Array.isArray(e.items)||e.items.length>256)&&t();let o={};for(let i of["sourceUnit","displayUnit"])e.settings[i]!==void 0&&(Ge(e.settings[i])||t(),o[i]=e.settings[i]);e.settings.metersPerUnit!==void 0&&((typeof e.settings.metersPerUnit!="number"||!Number.isFinite(e.settings.metersPerUnit)||e.settings.metersPerUnit<=0)&&t(),o.metersPerUnit=e.settings.metersPerUnit);let a=new Set,s=e.items.map(i=>{(!r(i)||typeof i.id!="string"||!i.id||a.has(i.id)||typeof i.name!="string"||!i.name.trim()||typeof i.modelId!="string"||!i.modelId||!Gn.includes(i.tool)||!Array.isArray(i.points)||i.points.length>8192||typeof i.createdAt!="string"||!Number.isFinite(Date.parse(i.createdAt)))&&t(),a.add(i.id),i.tilesetUrl!==void 0&&i.tilesetUrl!==null&&typeof i.tilesetUrl!="string"&&t(),(i.visible!==void 0&&typeof i.visible!="boolean"||i.approximate!==void 0&&typeof i.approximate!="boolean")&&t();let c=new Set,l=i.points.map(d=>{if((!r(d)||typeof d.id!="number"||!Number.isFinite(d.id)||!n(d.position))&&t(),c.has(d.id)&&t(),c.add(d.id),d.normal!==void 0&&!n(d.normal)&&t(),d.faceVertices!==void 0&&(!Array.isArray(d.faceVertices)||d.faceVertices.length!==3||!d.faceVertices.every(n))&&t(),d.snapped!==void 0&&!["vertex","edge"].includes(d.snapped)&&t(),d.anchor!==void 0){let u=d.anchor;(!r(u)||typeof u.nodeId!="string"||!u.nodeId||!n(u.localPosition)||typeof u.geometrySignature!="string"||typeof u.poseSignature!="string")&&t(),u.localNormal!==void 0&&!n(u.localNormal)&&t(),u.localFaceVertices!==void 0&&(!Array.isArray(u.localFaceVertices)||u.localFaceVertices.length!==3||!u.localFaceVertices.every(n))&&t(),u.instanceId!==void 0&&(!Number.isInteger(u.instanceId)||u.instanceId<0)&&t()}let f=d.anchor;return{id:d.id,position:[...d.position],...d.normal?{normal:[...d.normal]}:{},...d.faceVertices?{faceVertices:d.faceVertices.map(u=>[...u])}:{},...d.snapped?{snapped:d.snapped}:{},...f?{anchor:{nodeId:f.nodeId,localPosition:[...f.localPosition],geometrySignature:f.geometrySignature,poseSignature:f.poseSignature,...f.localNormal?{localNormal:[...f.localNormal]}:{},...f.localFaceVertices?{localFaceVertices:f.localFaceVertices.map(u=>[...u])}:{},...f.instanceId!==void 0?{instanceId:f.instanceId}:{}}}:{}}}),m={id:i.id,name:i.name,modelId:i.modelId,tool:i.tool,points:l,createdAt:i.createdAt,...i.tilesetUrl!==void 0?{tilesetUrl:i.tilesetUrl}:{},...i.visible!==void 0?{visible:i.visible}:{},...i.approximate!==void 0?{approximate:i.approximate}:{}};return Ae(m.tool,l)||t(),m});return{settings:o,items:s}}function Pt(e){return JSON.stringify({version:1,...ie(e)},null,2)}function Vt(e,t,r="m"){let n=ie(e),o=new Map(t?.map(s=>[s.id,s])),a=s=>{let i=String(s??"");return/^[=+@-]/.test(i)&&(i=`'${i}`),`"${i.replace(/"/g,'""')}"`};return[["id","name","modelId","type","status","value","unit","createdAt"],...n.items.map(s=>{let i=o.get(s.id)??qe(s,n.settings,r);return[s.id,s.name,s.modelId,s.tool,i.status,i.value,i.unit,s.createdAt]})].map(s=>s.map(a).join(",")).join(`\r
2
+ `)}function ve(e){if(!Array.isArray(e)||e.length>128)throw new Error("Invalid selections: expected up to 128 named selection sets.");let t=new Set;return e.map(r=>{if(!r||typeof r!="object"||typeof r.id!="string"||!r.id||t.has(r.id)||typeof r.name!="string"||!r.name.trim()||r.name.length>200||!Array.isArray(r.objectIds)||r.objectIds.length>1e5||r.objectIds.some(n=>typeof n!="string"||!n))throw new Error("Invalid selections: each set needs a unique id, a name, and model object ids.");return t.add(r.id),{id:r.id,name:r.name.trim(),objectIds:[...new Set(r.objectIds)]}})}var Z=5*1024*1024,Hn=["activeModelId","modelUrl","modelFormat","tilesetUrl","models","mergeModels","sceneConfig","isolation","multiSelectedKeys","activeAnnotation","annotationCategories","backgroundColor","shadows","cinematic","cameraControllerType","objectTransformSpace","arScaleMode","usdzUrl","measurements","measurementSettings","measurementUnit","measurementModelId"];function g(e,t){throw new Error(`Invalid viewer state at ${e}: ${t}`)}function P(e,t){(!e||typeof e!="object"||Array.isArray(e))&&g(t,"expected an object.")}function he(e,t){(!Array.isArray(e)||!e.every(r=>typeof r=="string"))&&g(t,"expected strings.")}function q(e,t,r){(!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n)))&&g(r,`expected ${t} finite numbers.`)}function qn(e){let t=new Set,r=0;function n(o,a,s){if((++r>2e5||s>64)&&g(a,"configuration is too complex."),o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;(typeof o!="object"||!o)&&g(a,"expected JSON data (finite numbers, no functions)."),t.has(o)&&g(a,"cyclic data."),!Array.isArray(o)&&Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null&&g(a,"expected plain JSON data."),t.add(o);let i=Array.isArray(o)?[]:{};for(let[c,l]of Object.entries(o))["__proto__","constructor","prototype"].includes(c)&&g(`${a}.${c}`,"reserved property."),l!==void 0?i[c]=n(l,`${a}.${c}`,s+1):Array.isArray(o)&&g(a,"undefined array entry.");return t.delete(o),i}return n(e,"state",0)}function W(e,t,r,n,o=!1,a){let s=e[t];if(s==null||s==="")return;typeof s!="string"&&g(r,"expected a URL.");let i=o?jt(s)??s:s;if(i.trim().startsWith("blob:")){if(o&&a){a.set(s,{source:i,path:r});return}g(r,o?"this image is temporary. Use getStateAsync() for JSON or createShareUrl() to include it.":"upload this model/environment asset to a durable URL before saving or sharing.")}if(i!==s&&(s=i,e[t]=i),o&&/^data:image\//i.test(s))return;let c;try{c=new URL(s,n??"https://relative.invalid/")}catch{g(r,"invalid asset URL.")}["http:","https:"].includes(c.protocol)||g(r,"use an HTTP(S) asset URL."),n&&(e[t]=c.href)}function Kn(e,t){P(e,t),q(e.position,3,`${t}.position`),q(e.target,3,`${t}.target`),(typeof e.zoom!="number"||e.zoom<=0)&&g(t,"zoom must be positive."),e.fov!==null&&(typeof e.fov!="number"||e.fov<=0||e.fov>=180)&&g(t,"fov must be null or between 0 and 180.");for(let r of["azimuthAngle","polarAngle"])e[r]!==void 0&&typeof e[r]!="number"&&g(t,`${r} must be a number.`)}function Lt(e,t,r,n){P(e,t),(typeof e.id!="number"||typeof e.title!="string"||typeof e.description!="string")&&g(t,"expected an annotation id, title and description.");for(let o of["worldPosition","localPosition"])q(e[o],3,`${t}.${o}`);e.images!==void 0&&(Array.isArray(e.images)||g(t,"images must be an array."),e.images.forEach(o=>{P(o,t),W(o,"src",t,r,!0,n)})),e.links!==void 0&&(Array.isArray(e.links)||g(t,"links must be an array."),e.links.forEach(o=>{P(o,t),W(o,"href",t,r,!1,n)}))}function _t(e,t){P(e,t),e.waypoints!==void 0&&(Array.isArray(e.waypoints)||g(t,"expected waypoints."),e.waypoints.forEach(r=>{P(r,t),q(r.position,3,t),q(r.target,3,t)}));for(let r of["enabled","loop","autoPlay"])e[r]!==void 0&&typeof e[r]!="boolean"&&g(t,`${r} must be boolean.`);e.duration!==void 0&&(typeof e.duration!="number"||e.duration<=0)&&g(t,"duration must be positive.")}function Ke(e,t,r){if(t!==null)if(Array.isArray(t))Array.isArray(e)||g(r,"expected an array."),t.length&&e.forEach(n=>Ke(n,t[0],r));else if(typeof t=="object"){P(e,r);for(let[n,o]of Object.entries(t))Ke(e[n],o,`${r}.${n}`)}else typeof e!=typeof t&&g(r,`expected ${typeof t}.`)}function Dt(e,t,r,n){if(Ke(e,ee,t),e.measurements!==void 0&&(e.measurements=ie(e.measurements)),e.sequences!==void 0&&(e.sequences=Me(e.sequences)),e.selectionSets!==void 0&&(e.selectionSets=ve(e.selectionSets)),q(e.model.rotation,3,`${t}.model.rotation`),e.lighting.lights.forEach(o=>q(o.position,3,`${t}.lighting.lights`)),e.annotations.forEach(o=>Lt(o,`${t}.annotations`,r,n)),e.animations.autoplayClip!==null&&typeof e.animations.autoplayClip!="string"&&g(t,"invalid autoplay clip."),e.animations.clips.forEach(o=>{P(o,t),(typeof o.sourceName!="string"||typeof o.displayName!="string"||typeof o.hidden!="boolean"||typeof o.speed!="number"||!["repeat","once","ping-pong"].includes(o.loopMode))&&g(t,"invalid animation clip settings.")}),e.cinematic!==void 0&&_t(e.cinematic,`${t}.cinematic`),e.styleRules!==void 0&&!Array.isArray(e.styleRules)&&g(t,"styleRules must be an array."),W(e.environment,"customEnvironmentUrl",`${t}.environment`,r,!1,n),W(e.background,"imageUrl",`${t}.background`,r,!0,n),e.model.activeVariants!==void 0&&he(e.model.activeVariants,t),e.section!==void 0)try{e.section=ge(e.section)}catch(o){g(`${t}.section`,o.message)}}function Ut(e,t,r,n){P(e,t);for(let[o,a]of Object.entries(e)){let s=`${t}.${o}`;P(a,s),(typeof a.id!="string"||typeof a.modelObjectId!="string")&&g(s,"expected binding id and modelObjectId.");for(let i of["label","group","type","status"])a[i]!==void 0&&typeof a[i]!="string"&&g(s,`${i} must be a string.`);a.tags!==void 0&&he(a.tags,s),a.metadata!==void 0&&P(a.metadata,`${s}.metadata`),a.metrics!==void 0&&(P(a.metrics,s),Object.values(a.metrics).some(i=>typeof i!="number")&&g(s,"metrics must be numbers.")),a.actions!==void 0&&(Array.isArray(a.actions)||g(s,"actions must be an array."),a.actions.forEach(i=>{P(i,s),(typeof i.id!="string"||typeof i.label!="string"||i.type!=="command"||i.effects!==void 0&&!Array.isArray(i.effects))&&g(s,"invalid action.")}));for(let i of["visible","removed","selectable","hoverable"])a[i]!==void 0&&typeof a[i]!="boolean"&&g(s,`${i} must be boolean.`);if(a.transform!==void 0){P(a.transform,s);for(let i of["position","rotation","scale","shear"])a.transform[i]!==void 0&&q(a.transform[i],3,`${s}.transform.${i}`);a.transform.pivot!==void 0&&(P(a.transform.pivot,s),q(a.transform.pivot.point,3,s),q(a.transform.pivot.offset,3,s))}if(a.style!==void 0&&(P(a.style,s),a.style.material!==void 0)){P(a.style.material,s);for(let[i,c]of Object.entries(a.style.material))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&W(c,"path",`${s}.style.material.${i}.path`,r,!0,n)}a.decals!==void 0&&(Array.isArray(a.decals)||g(s,"decals must be an array."),a.decals.forEach(i=>{P(i,s),(typeof i.id!="string"||typeof i.size!="number"||i.size<=0)&&g(s,"invalid decal."),q(i.position,3,s),q(i.normal,3,s),W(i,"image",s,r,!0,n)}))}}function Nt(e,t,r,n){Array.isArray(e)||g(t,"expected merge sources."),e.forEach(o=>{P(o,t),(typeof o.url!="string"||!o.url||typeof o.namePrefix!="string")&&g(t,"expected source URL and prefix."),W(o,"url",t,r,!1,n)})}function Wn(e,t,r){P(e,"configuration");let n=Object.fromEntries(Hn.filter(o=>e[o]!==void 0).map(o=>[o,e[o]]));(typeof n.modelUrl!="string"||!n.modelUrl)&&g("configuration.modelUrl","expected the active model URL.");for(let o of["modelUrl","tilesetUrl","usdzUrl"])W(n,o,`configuration.${o}`,t,!1,r);if(n.sceneConfig!==void 0&&Dt(n.sceneConfig,"configuration.sceneConfig",t,r),n.mergeModels!==void 0&&Nt(n.mergeModels,"configuration.mergeModels",t,r),n.models!==void 0){(!Array.isArray(n.models)||n.models.length===0)&&g("configuration.models","expected model entries.");let o=new Set,a=new Set;n.models.forEach(s=>{P(s,"model"),(typeof s.url!="string"||!s.url)&&g("model.url","expected a URL."),W(s,"url","model.url",t,!1,r),s.id!==void 0&&(typeof s.id!="string"||!s.id.trim())&&g("model.id","expected a nonempty instance ID.");let i=Ue({id:s.id,url:s.url});a.has(i)&&g("configuration.models","instance identities must be unique; assign IDs when reusing a URL."),a.add(i),s.transform!==void 0&&(s.transform=de(s.transform)),s.visible!==void 0&&typeof s.visible!="boolean"&&g("model.visible","expected boolean."),o.add(s.url),Ut(s.objectBindings,"model.objectBindings",t,r),s.sceneConfig!==void 0&&Dt(s.sceneConfig,"model.sceneConfig",t,r),s.mergeModels!==void 0&&Nt(s.mergeModels,"model.mergeModels",t,r)}),n.activeModelId!==void 0&&(typeof n.activeModelId!="string"||!a.has(n.activeModelId))&&g("configuration.activeModelId","active instance is not in models."),n.activeModelId!==void 0&&n.models.find(s=>Ue(s)===n.activeModelId)?.url!==n.modelUrl&&g("configuration.modelUrl","source does not match the active instance."),o.has(n.modelUrl)||g("configuration.modelUrl","active model is not in models.")}if(n.multiSelectedKeys!==void 0&&he(n.multiSelectedKeys,"configuration.multiSelectedKeys"),n.annotationCategories!==void 0&&n.annotationCategories!==null&&he(n.annotationCategories,"configuration.annotationCategories"),n.activeAnnotation!==void 0&&n.activeAnnotation!==null&&Lt(n.activeAnnotation,"configuration.activeAnnotation",t,r),n.measurements!==void 0||n.measurementSettings!==void 0){let o=ie({items:n.measurements??[],settings:n.measurementSettings??{}});n.measurements!==void 0&&(n.measurements=o.items),n.measurementSettings!==void 0&&(n.measurementSettings=o.settings)}n.measurementModelId!==void 0&&typeof n.measurementModelId!="string"&&g("configuration.measurementModelId","expected a stable id."),n.measurementUnit!==void 0&&typeof n.measurementUnit!="string"&&g("configuration.measurementUnit","expected a unit label.");for(let o of["backgroundColor"])n[o]!==void 0&&typeof n[o]!="string"&&g(o,"expected a string.");n.shadows!==void 0&&typeof n.shadows!="boolean"&&g("shadows","expected boolean.");for(let[o,a]of Object.entries({modelFormat:["glb","gltf","obj","fbx","usdz","stl","ply"],cameraControllerType:["orbit","pointerLock"],objectTransformSpace:["world","local"],arScaleMode:["normalized","real-world"]}))n[o]!==void 0&&!a.includes(n[o])&&g(o,"unsupported value.");if(n.cinematic!==void 0&&_t(n.cinematic,"cinematic"),n.isolation!==void 0&&n.isolation!==null){let{target:o,mode:a,ghostOpacity:s}=n.isolation;typeof o=="string"||Array.isArray(o)&&o.every(i=>typeof i=="string")||o&&typeof o=="object"&&["group","tag","type"].some(i=>typeof o[i]=="string")||g("configuration.isolation","invalid target."),a!==void 0&&!["ghost","hide"].includes(a)&&g("configuration.isolation","invalid mode."),s!==void 0&&(typeof s!="number"||s<0||s>1)&&g("configuration.isolation","opacity must be between 0 and 1.")}return n}function zt(e,t,r,n){if(!(!e||typeof e!="object"))for(let[o,a]of Object.entries(e))o!=="metadata"&&(typeof a=="string"&&["url","modelUrl","tilesetUrl","usdzUrl","path","image","src","href","imageUrl","customEnvironmentUrl"].includes(o)?W(e,o,`${t}.${o}`,r,["path","image","src","imageUrl"].includes(o),n):zt(a,`${t}.${o}`,r,n))}function Ft(e,t,r){typeof e=="string"&&(new TextEncoder().encode(e).length>Z&&g("state","exceeds the 5 MiB limit."),e=JSON.parse(e));let n=qn(e);P(n,"state"),new TextEncoder().encode(JSON.stringify(n)).length>Z&&g("state","exceeds the 5 MiB limit."),n.version!==void 0&&n.version!==1&&g("version","unsupported version."),n.version===void 0&&(n.objectBindings!==void 0||n.configuration!==void 0)&&g("version","full configurations require version 1.");let o={};return n.version!==void 0&&(o.version=1),n.camera!==void 0&&(Kn(n.camera,"camera"),o.camera=n.camera),n.hidden!==void 0&&(he(n.hidden,"hidden"),o.hidden=n.hidden),n.selected!==void 0&&(n.selected!==null&&typeof n.selected!="string"&&g("selected","expected an object id or null."),o.selected=n.selected),n.objectBindings!==void 0&&(Ut(n.objectBindings,"objectBindings",t,r),o.objectBindings=n.objectBindings),n.configuration!==void 0&&(o.configuration=Wn(n.configuration,t,r)),zt(o,"state",t,r),new TextEncoder().encode(JSON.stringify(o)).length>Z&&g("state","exceeds the 5 MiB limit."),o}function $t(e,t){return JSON.stringify(ue(e,t))}function ue(e,t){return Ft(e,t)}async function Oe(e,t){let r=new Map,n=Ft(e,t,r),o=new Map,a=new Map;for(let[i,{source:c,path:l}]of r){let m=o.get(c);m||(m=(async()=>{let d;try{d=await fetch(c)}catch{g(l,"this temporary image is no longer available. Reload or reselect it before saving.")}d.ok||g(l,"could not read the temporary image. Reload or reselect it before saving.");let f=await d.blob();f.size>Z*3/4&&g(l,"embedded image exceeds the 5 MiB configuration limit. Use a hosted image URL.");let u=new Uint8Array(await f.arrayBuffer()),A=f.type.split(";")[0].toLowerCase(),C=A.startsWith("image/")?A:Yn(u);C||g(l,"temporary asset is not a supported image. Use a hosted asset URL.");let b="";for(let p=0;p<u.length;p+=32768)b+=String.fromCharCode(...u.subarray(p,p+32768));return`data:${C};base64,${btoa(b)}`})(),o.set(c,m)),a.set(i,await m)}function s(i){if(!(!i||typeof i!="object"))for(let[c,l]of Object.entries(i))c!=="metadata"&&(["path","image","src","imageUrl"].includes(c)&&typeof l=="string"&&a.has(l)?i[c]=a.get(l):s(l))}return s(n),ue(n,t)}function Yn(e){let t=(r,n)=>String.fromCharCode(...e.subarray(r,n));if(e[0]===137&&t(1,4)==="PNG")return"image/png";if(e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";if(t(0,3)==="GIF")return"image/gif";if(t(0,4)==="RIFF"&&t(8,12)==="WEBP")return"image/webp";if(t(4,8)==="ftyp"&&["avif","avis"].includes(t(8,12)))return"image/avif";if(/<svg[\s>]/i.test(new TextDecoder().decode(e.subarray(0,1024))))return"image/svg+xml"}var We={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",sequencePlayer:"Sequence player",sequenceSelect:"Sequence",sequencePlay:"Play sequence",sequencePause:"Pause sequence",sequenceStop:"Stop and restore scene",sequencePlayhead:"Sequence playhead",sequenceTime:"Sequence time",sequenceIssues:"Unavailable sequence targets",arConfiguredButton:"AR handoff",arConfiguredTitle:"Take this configuration to AR",arConfiguredDescription:"Your current materials, visible models and placements are included.",arSnapshotStale:"Updating AR to include your latest changes\u2026",arPreparing:"Preparing your scene\u2026",arRefresh:"Refresh AR",arRetry:"Try again",arExportDetails:"Export details",arPrepare:"Prepare AR",arPrepareAgain:"Prepare again",arDownloadUSDZ:"Download USDZ for iPhone/iPad",arScanConfigured:"Scan to open this configuration on your phone.",arOpenConfiguredLink:"Open configuration link",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Point Lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadGLBDescription:"All visible models, material edits and animations in one file. No annotations or separate editor model slots. Duplicate mesh names may change on reimport.",downloadCombinedGLB:"Download as one GLB",downloadSeparateGLBs:"Download separate GLBs",downloadSeparateGLBsDescription:"One GLB file per model",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",wrap:"Circumference (Edge)",wrapHorizontal:"Circumference (Horizontal)",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",savedMeasurements:"Saved measurements ({count})",noSavedMeasurements:"No saved measurements yet. Pick points in the preview, then save a measurement here.",measurementFiles:"Import / export",measurementSourceUnit:"Model units",measurementDisplayUnit:"Display units",measurementName:"Measurement name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save measurement",knownMeasurementDistance:"Known distance",calibrationUnit:"Calibration unit",calibrateMeasurement:"Calibrate",measurementCalibrationHint:"Pick two distance points, enter their known length, then calibrate.",measurementCalibratedScale:"Calibrated: 1 model unit = {scale} m",resetMeasurementCalibration:"Reset calibration",showSavedMeasurement:"Show {name}",renameSavedMeasurement:"Rename {name}",deleteSavedMeasurement:"Delete {name}",exportMeasurementJson:"Export JSON",exportMeasurementCsv:"Export CSV",importMeasurementJson:"Import JSON",measurementReady:"Ready",measurementApproximate:"Approximate LOD",measurementModelChanged:"Different model",measurementObjectMissing:"Object unavailable",measurementGeometryChanged:"Geometry changed \u2014 measure again",measurementPoseChanged:"Pose changed \u2014 measure again",measurementObjectHidden:"Object hidden",measurementInvalid:"Invalid measurement",measurementWaiting:"Waiting for model",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"SCENE OBJECTS",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text colour",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Colour",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",wrapHint:"Click a point on the surface to measure its circumference, following the surface (best for limbs)",wrapHorizontalHint:"Click a point to measure a level circumference around it (best for the torso/waist)",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};var eo=new Map(Object.entries(We).map(([e,t])=>[t,e]));function Gt(e){bt(e);let t=[],r=[{node:e,path:"0",parentId:null}];for(;r.length;){let{node:o,path:a,parentId:s}=r.pop(),i=`node:${a}`,c=o.isMesh&&o.name?fe(o):null;t.push({id:i,parentId:s,name:o.name||o.type||"Group",...c?{objectId:c}:{}});for(let l=o.children.length-1;l>=0;l--)r.push({node:o.children[l],path:`${a}/${l}`,parentId:i})}let n=new Set;for(let o=t.length-1;o>=0;o--){let a=t[o];(a.objectId||n.has(a.id))&&(n.add(a.id),a.parentId&&n.add(a.parentId))}return t.filter(o=>n.has(o.id))}function Ht(e){return structuredClone(e.style??{})}function qt(e,t,r){let n=K(e,t).filter(a=>!e[a].removed);if(!n.length)return e;let o={...e};for(let a of n)o[a]={...e[a],style:structuredClone(r)};return o}var se=require("three"),Xn=new Set(["KHR_binary_glTF","KHR_draco_mesh_compression","KHR_lights_punctual","KHR_materials_clearcoat","KHR_materials_dispersion","KHR_materials_ior","KHR_materials_sheen","KHR_materials_specular","KHR_materials_transmission","KHR_materials_iridescence","KHR_materials_anisotropy","KHR_materials_unlit","KHR_materials_volume","KHR_texture_basisu","KHR_texture_transform","KHR_mesh_quantization","KHR_materials_emissive_strength","KHR_materials_variants","EXT_materials_bump","EXT_texture_webp","EXT_texture_avif","EXT_meshopt_compression","EXT_mesh_gpu_instancing"]),Zn=new WeakMap;function Jn(e){let t=Zn.get(e);return t?structuredClone(t):void 0}function Kt(e){if(/^(blob|data):/i.test(e))return"Local resource";let t=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1).slice(0,300)||"Resource"}function Qn(e){return/^(blob|data):/i.test(e)?"Local resource":e.split(/[?#]/,1)[0].replace(/\\/g,"/").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^\/+/,"").slice(0,500)||"Resource"}function er(e){let t=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null;return{...e.format?{format:e.format}:{},...e.name?{name:Kt(e.name)}:{},sourceBytes:t(e.sourceBytes),loadDurationMs:t(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(Qn))].slice(0,50)}}function tr(e){let t=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...t])].sort().map(r=>({name:r,required:t.has(r),recognized:Xn.has(r)}))}function nr(e,t){let r=e.image,n=l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0?l:null,o=n(r?.naturalWidth??r?.width),a=n(r?.naturalHeight??r?.height),s=!!e.isCompressedTexture,i=e.mipmaps.reduce((l,m)=>l+(m.data?.byteLength??0),0),c=o&&a?Math.ceil(o*a*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?Kt(e.name):t,width:o,height:a,compressed:s,estimatedBytes:s?i||null:c!==null&&Number.isSafeInteger(c)?c:null}}function Wt(e,t={}){let r=er({...Jn(e),...t.source}),n=[],o=new Set,a=new Map,s=new Set,i=new Map,c=new Map,l=new Set,m=new Map,d=0,f=0,u=0,A=0,C=0,b=(x,S)=>{let M=m.get(x)??{count:0,names:[]};M.count++,M.names.length<20&&M.names.push(S||"Unnamed object"),m.set(x,M)},p=x=>{let S=x?.array??x?.data?.array;S?.buffer&&!l.has(S.buffer)&&(l.add(S.buffer),C+=S.buffer.byteLength)};e.traverse(x=>{let S=x;if(!S.isMesh||!S.geometry)return;d++,f+=S.isInstancedMesh?Number.isSafeInteger(S.count)?Math.max(0,S.count??0):0:1;let M=S.geometry,E=M.getAttribute("position"),$=M.getAttribute("uv"),U=S.material?Array.isArray(S.material)?S.material:[S.material]:[];if(!a.has(M)){let L=!!E&&(!Number.isSafeInteger(E.count)||E.count<0);for(let D=0;!L&&E&&D<E.count;D++)if(!Number.isFinite(E.getX(D))||!Number.isFinite(E.getY(D))||!Number.isFinite(E.getZ(D))){L=!0;break}a.set(M,L)}if(a.get(M)&&b("invalid-positions",x.name),E?.count||b("empty-geometry",x.name),$||b("missing-uv",x.name),M.getAttribute("normal")||b("missing-normals",x.name),M.boundingBox&&[...M.boundingBox.min.toArray(),...M.boundingBox.max.toArray()].some(L=>!Number.isFinite(L))&&b("invalid-bounds",x.name),!o.has(M)){o.add(M),u+=Number.isSafeInteger(E?.count)?Math.max(0,E?.count??0):0;let L=M.index?.count??E?.count??0;A+=Number.isSafeInteger(L)?Math.floor(Math.max(0,L)/3):0,Object.values(M.attributes).forEach(p),Object.values(M.morphAttributes).flat().forEach(p),p(M.index)}let _=!1;for(let L of U){s.add(L);let D=i.get(L);if(!D){D=Object.values(L).filter(z=>!!z&&z.isTexture===!0),i.set(L,D);for(let z of D)c.has(z)||c.set(z,`Texture ${c.size+1}`)}for(let z of D){let ce=z.channel??0;M.getAttribute(ce===0?"uv":`uv${ce}`)||(_=!0)}}_&&b("textured-missing-uv",x.name)});let h=(x,S,M,E,$)=>{let U=m.get(x);U&&n.push({code:x,severity:S,title:M,detail:E,suggestion:$,count:U.count,objects:U.names})};h("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),h("invalid-positions","error","Invalid vertex coordinates","Some vertices contain non-finite coordinates.","Repair NaN or infinite vertex positions in the source application, then re-export."),h("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),h("textured-missing-uv","warning","Textures have no matching UV coordinates","A texture references a UV channel that its mesh does not contain.","Unwrap the affected meshes and export the UV channel used by each texture."),h("missing-uv","info","Meshes without UVs","Solid colors can work without UVs; image textures and surface decals need them.","Add a UV map before applying image textures or decals."),h("missing-normals","info","Meshes without normals","Some loaded meshes lack vertex normals; generated shading may differ from the source.","Export vertex normals to preserve hard edges and smooth surfaces."),d||n.push({code:"no-meshes",severity:"warning",title:"No mesh geometry found",detail:"This scene contains no loaded meshes.",suggestion:"Check that meshes were included in the export. Streamed scenes may still be loading."});let w=[...c].map(([x,S])=>nr(x,S)),v=w.filter(x=>(x.width??0)>4096||(x.height??0)>4096);v.length&&n.push({code:"large-textures",severity:"warning",title:"Large texture dimensions",detail:"Some textures exceed 4096 pixels on one side.",suggestion:"Resize textures for the visible detail needed; use KTX2/Basis where appropriate.",count:v.length,objects:v.slice(0,20).map(x=>x.name)}),A>1e6&&n.push({code:"high-triangle-count",severity:"warning",title:"High geometry count",detail:"The loaded geometry contains more than one million unique triangles.",suggestion:"Simplify hidden detail, create lower-detail exports, or use streamed assets for large scenes."}),s.size>100&&n.push({code:"many-materials",severity:"warning",title:"Many material definitions",detail:"More than 100 materials can increase rendering work.",suggestion:"Reuse materials and atlas compatible textures; inspect runtime draw calls to confirm the cost."});let y=tr(r);for(let x of y.filter(S=>!S.recognized))n.push({code:"unrecognized-extension",severity:x.required?"error":"warning",title:`${x.required?"Required":"Optional"} extension not recognized`,detail:x.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});r.failedResources?.length&&n.push({code:"failed-resources",severity:"error",title:"Some resources failed to load",detail:"The model may be missing textures or other referenced resources.",suggestion:"Include sidecar files in the ZIP, correct their paths, and check HTTP access and CORS.",count:r.failedResources.length,objects:r.failedResources.slice(0,20)});let R=null,V=[...a.values()].some(Boolean)?new se.Box3:new se.Box3().setFromObject(e);!V.isEmpty()&&[...V.min.toArray(),...V.max.toArray(),...V.getSize(new se.Vector3).toArray()].every(Number.isFinite)&&(R={min:V.min.toArray(),max:V.max.toArray(),center:V.getCenter(new se.Vector3).toArray(),size:V.getSize(new se.Vector3).toArray()}),t.scope==="resident-tiles"&&n.unshift({code:"partial-stream",severity:"info",title:"Loaded tiles only",detail:"Geometry and texture counts cover the current resident tiles, not the entire source asset.",suggestion:"Use the live cache/detail statistics to inspect streaming pressure. Rescan after moving the camera."});let Q=x=>x.code==="partial-stream"?-1:x.severity==="error"?0:x.severity==="warning"?1:2;return n.sort((x,S)=>Q(x)-Q(S)),{version:1,status:"ready",scope:t.scope??"asset",source:r,units:r.format==="glb"||r.format==="gltf"?"meters (glTF convention)":"unknown",bounds:R,statistics:{meshes:d,instances:f,geometries:o.size,materials:s.size,textures:c.size,vertices:u,triangles:A,geometryBytes:C,estimatedTextureBytes:w.reduce((x,S)=>x+(S.estimatedBytes??0),0),unknownTextureSizes:w.filter(x=>x.estimatedBytes===null).length,meshesWithoutUvs:m.get("missing-uv")?.count??0,meshesWithoutNormals:m.get("missing-normals")?.count??0},textures:w,extensions:y,issues:n}}var rr=new WeakMap;function Yt(e){e.traverse(t=>{let r=rr.get(t);if(r)throw new Error(r)})}var B=require("three");var Ye=require("three");function Ce(e){return e.isSkinnedMesh===!0}var or="reactImmersiveSkinFreeze";function Xe(e){return e.userData[or]?.frozenInverse??null}function Xt(e){let t=e,r=Xe(e);r&&t.bindMatrixInverse.copy(r),t.skeleton?.update?.();let n=t.geometry.clone(),o=n.getAttribute("position");if(o){let a=new Ye.Vector3;for(let s=0;s<o.count;s++)t.getVertexPosition(s,a),o.setXYZ(s,a.x,a.y,a.z);o.needsUpdate=!0}return n.deleteAttribute("skinIndex"),n.deleteAttribute("skinWeight"),n.morphAttributes={},n.morphTargetsRelative=!1,n.computeVertexNormals(),n.computeBoundingBox(),n.computeBoundingSphere(),n}function ir(e,t={}){t.signal?.throwIfAborted();let r=new B.Group,n=new B.Group;r.add(n);let o=new Set,a=[],s=[],i=[],c=new Map,l=0,m=0,d=()=>{a.forEach(f=>f.dispose()),s.forEach(f=>f.dispose()),i.forEach(f=>f.dispose())};try{for(let{scene:b,objectBindings:p={},materialOverrides:h={}}of e){Yt(b),b.updateWorldMatrix(!0,!0);let w=new Map(Object.entries(p).map(([v,y])=>[y.modelObjectId??v,v]));b.traverse(v=>{let y=v;if(!y.isMesh||!y.geometry)return;for(let M=v;M;M=M.parent){let E=fe(M)??M.name??M.uuid;if(!M.visible||p[w.get(E)??E]?.visible===!1||p[w.get(E)??E]?.removed)return}let R=fe(y)??y.name??y.uuid,V=h[w.get(R)??R]??y.material;if(!V)throw new Error(`Material for ${R} is not ready. Wait for the model to finish loading.`);let Q=Array.isArray(V)?V:[V],x=y.isInstancedMesh?y.count:1;if(y.userData.riDecal&&Ce(y)&&y.parent){let M=Xe(y.parent);M&&y.bindMatrixInverse.copy(M)}let S=Ce(y)?Xt(y):y.geometry.clone();try{if(!Ce(y)&&y.morphTargetInfluences?.some($=>$!==0)){let $=S.getAttribute("position"),U=new B.Vector3;for(let _=0;_<$.count;_++)y.getVertexPosition(_,U),$.setXYZ(_,U.x,U.y,U.z);S.morphAttributes={},S.computeVertexNormals()}if(!S.getAttribute("position"))throw new Error(`Mesh ${R} has no positions.`);let M=S.index?.count??S.getAttribute("position").count,E=Array.isArray(V)?S.groups:[{start:0,count:M,materialIndex:0}];if(!E.length)throw new Error(`Mesh ${R} has multiple materials without geometry groups.`);for(let $=0;$<x;$++){let U=y.matrixWorld.clone();if(y.isInstancedMesh){let _=new B.Matrix4;y.getMatrixAt($,_),U.multiply(_)}for(let _ of E){let L=Q[_.materialIndex??0];if(!L)throw new Error(`A material group on ${R} is missing its material.`);if(!L.visible)continue;let D=L;if(!D.isMeshStandardMaterial||D.wireframe||D.vertexColors)throw new Error(`AR snapshot cannot preserve ${L.type}${D.wireframe?" wireframe":D.vertexColors?" vertex colors":""} on ${R}. Use a PBR material or provide arHandoff.createUSDZ.`);let z=Math.max(_.start,S.drawRange.start),ce=Math.min(M,_.start+_.count,S.drawRange.start+S.drawRange.count);if(ce<=z)continue;if(z%3||(ce-z)%3)throw new Error(`Mesh ${R} has an incomplete triangle range.`);let N=new B.BufferGeometry;a.push(N);let Y=Array.from({length:ce-z},(O,T)=>S.index?S.index.getX(z+T):z+T);if(U.determinant()<0)for(let O=0;O<Y.length;O+=3)[Y[O+1],Y[O+2]]=[Y[O+2],Y[O+1]];for(let[O,T]of Object.entries(S.attributes)){let j=new Float32Array(Y.length*T.itemSize);for(let k=0;k<Y.length;k++)for(let H=0;H<T.itemSize;H++)j[k*T.itemSize+H]=T.getComponent(Y[k],H);N.setAttribute(O,new B.BufferAttribute(j,T.itemSize))}N.setIndex(Y.map((O,T)=>T)),N.applyMatrix4(U);let Se=N.getAttribute("position");for(let O=0;O<Se.count;O++)if(![Se.getX(O),Se.getY(O),Se.getZ(O)].every(Number.isFinite))throw new Error(`Mesh ${R} contains invalid coordinates.`);N.getAttribute("normal")||N.computeVertexNormals();let F=D.clone();s.push(F);let Qe=D.userData.reactImmersiveConfiguredEmissive;if(Qe?.isColor&&F.emissive.copy(Qe),F.side===B.DoubleSide){let O=N.toNonIndexed();a.push(O);let T=O.getAttribute("position").count,j=new B.BufferGeometry;a.push(j);for(let[k,H]of Object.entries(O.attributes)){let Te=new Float32Array(T*H.itemSize*2);for(let te=0;te<T;te++)for(let le=0;le<H.itemSize;le++){Te[te*H.itemSize+le]=H.getComponent(te,le);let un=Math.floor(te/3)*3+(2-te%3);Te[(T+te)*H.itemSize+le]=H.getComponent(un,le)*(k==="normal"?-1:1)}j.setAttribute(k,new B.BufferAttribute(Te,H.itemSize))}F.side=B.FrontSide,N.copy(j)}else if(F.side!==B.FrontSide){let O=N.getIndex();for(let j=0;j<O.count;j+=3){let k=O.getX(j+1);O.setX(j+1,O.getX(j+2)),O.setX(j+2,k)}let T=N.getAttribute("normal");for(let j=0;j<T.count;j++)T.setXYZ(j,-T.getX(j),-T.getY(j),-T.getZ(j));F.side=B.FrontSide}if(y.isInstancedMesh&&y.instanceColor){let O=new B.Color;y.getColorAt($,O),F.color.multiply(O)}for(let[O,T]of Object.entries(F)){if(!T?.isTexture)continue;let j=T;if(Tt(j)||!j.image||j.image.complete===!1)throw new Error(`Texture on ${R} is not ready. Wait for image loading or replace failed textures before preparing AR.`);let k=c.get(j);if(k||(k=j.clone(),c.set(j,k),i.push(k)),F[O]=k,!N.getAttribute(k.channel?`uv${k.channel}`:"uv"))throw new Error(`Texture on ${R} needs UV coordinates missing from this geometry.`)}if(y.userData.riDecal){N.computeBoundingBox();let O=Math.max(1e-6,N.boundingBox.getSize(new B.Vector3).length()*1e-4),T=N.getAttribute("position"),j=N.getAttribute("normal");for(let k=0;k<T.count;k++)T.setXYZ(k,T.getX(k)+j.getX(k)*O,T.getY(k)+j.getY(k)*O,T.getZ(k)+j.getZ(k)*O)}let et=new B.Mesh(N,F);et.name=`AR_${l++}`,n.add(et),m+=(N.index?.count??N.getAttribute("position").count)/3,(F.clearcoat||F.transmission||F.iridescence||F.anisotropy)&&o.add("Advanced PBR effects may look different in Quick Look.")}}}finally{S.dispose()}})}if(!l||!m)throw new Error("There is no visible model geometry to send to AR.");let f=new B.Box3().setFromObject(n),u=f.getSize(new B.Vector3),A=f.getCenter(new B.Vector3),C=t.scaleMode==="real-world"?1:1/Math.max(u.x,u.y,u.z,1e-9);return n.position.set(-A.x*C,-f.min.y*C,-A.z*C),n.scale.setScalar(C),r.updateMatrixWorld(!0),o.add("USDZ is a static snapshot. Viewer lighting, background, post-processing, annotations and measurement overlays stay in the web viewer."),{root:r,meshCount:l,triangleCount:m,scale:C,warnings:[...o],textures:i,dispose:d}}catch(f){throw d(),f}}async function Zt(e,t={}){let r=t.maxTextureSize??2048;if(!Number.isInteger(r)||r<256||r>4096)throw new Error("AR maxTextureSize must be an integer from 256 to 4096.");let n=ir(e,t),o=[];try{let{USDZExporter:a}=await import("three/examples/jsm/exporters/USDZExporter.js");t.signal?.throwIfAborted();for(let i of n.textures){if(!i.isCompressedTexture)continue;let{decompress:c}=await import("three/examples/jsm/utils/WebGLTextureUtils.js"),l=c(i,r);o.push(l),n.root.traverse(m=>{let d=m.material;if(d)for(let f of Object.keys(d))d[f]===i&&(d[f]=l)})}let s=await new a().parseAsync(n.root,{onlyVisible:!0,quickLookCompatible:!0,maxTextureSize:r});return t.signal?.throwIfAborted(),{blob:new Blob([new Uint8Array(s)],{type:"model/vnd.usdz+zip"}),meshCount:n.meshCount,triangleCount:n.triangleCount,scale:n.scale,warnings:n.warnings}}catch(a){throw t.signal?.aborted?a:new Error(`Could not prepare the configured USDZ: ${a instanceof Error?a.message:"export failed"}. Textures must allow cross-origin canvas access.`)}finally{n.dispose(),o.forEach(a=>a.dispose())}}var J=require("fflate");var Ze="ri-ar",Je="ri-ar-id",Jt=4096,sr=2200,ar=(0,J.strToU8)(JSON.stringify(ee)).byteLength;function Qt(e){return e==="localhost"||e.endsWith(".localhost")||/^127\./.test(e)||e==="[::1]"||e==="0.0.0.0"}function en(e){if(typeof e=="string"&&/^https?:\/\//i.test(e)&&Qt(new URL(e).hostname))throw new Error("An asset URL points to this computer. Use model and texture URLs reachable from the phone.");if(e&&typeof e=="object")for(let t of Object.values(e))en(t)}function cr(e,t){let r=new URL(e,t);if(!["https:","http:"].includes(r.protocol))throw new Error("AR handoff requires an HTTP(S) URL.");return r.toString()}function tn(e,t){if(JSON.stringify(e)!==JSON.stringify(t))return e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,tn(n,t[r])]).filter(([,r])=>r!==void 0)):e}function nn(e,t,r=0){if(r>64)throw new Error("AR configuration is too deeply nested.");if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let n=e,o=t;return Object.fromEntries([...new Set([...Object.keys(o),...Object.keys(n)])].map(a=>[a,Object.prototype.hasOwnProperty.call(n,a)?nn(n[a],o[a],r+1):o[a]]))}return e}function rn(e,t){let r=structuredClone(e);if(r.configuration){r.configuration.sceneConfig&&(r.configuration.sceneConfig=t(r.configuration.sceneConfig));for(let n of r.configuration.models??[])n.sceneConfig&&(n.sceneConfig=t(n.sceneConfig))}return r}function ye(e){e?.throwIfAborted()}async function on(e,t,r,n){ye(n);let o=new URL(cr(t));if(Qt(o.hostname))throw new Error("Phone links need a viewer URL reachable from your phone. Download the USDZ for local uploads, or provide a public viewer URL.");let a=await Oe(e,o.toString());ye(n),en(a);let s=new URLSearchParams(o.hash.slice(1));if(s.delete(Ze),s.delete(Je),s.delete("view"),s.delete("viewId"),s.delete("view-id"),r){let i=await r.save(a);if(ye(n),typeof i!="string"||!i||i.length>512)throw new Error("AR storage returned an invalid configuration ID.");s.set(Je,i)}else{let i=(0,J.zlibSync)((0,J.strToU8)(JSON.stringify({ar:1,state:rn(a,l=>tn(l,ee)??{})})),{level:9});if(i.byteLength>Jt)throw new Error("This configuration needs an AR storage adapter to share on a phone. The USDZ download is still available.");let c="";for(let l of i)c+=String.fromCharCode(l);s.set(Ze,btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""))}if(o.hash=s.toString(),o.toString().length>sr)throw new Error("This configuration is too large for a reliable QR code. Use an AR storage adapter or download the USDZ.");return o.toString()}async function sn(e,t,r){let n=new URL(e),o=new URLSearchParams(n.hash.slice(1)),a=o.get(Je),s=o.get(Ze);if(a!==null&&s!==null)throw new Error("AR link contains conflicting configurations.");if(a===null&&s===null)return null;ye(r);let i;if(a!==null){if(!t)throw new Error("This AR link requires the application's configuration storage adapter.");if(!a||a.length>512)throw new Error("Invalid AR configuration ID.");i=await t.load(a)}else{if(!s||s.length>Math.ceil(Jt*4/3)||!/^[\w-]+$/.test(s))throw new Error("Invalid or oversized AR link.");let l=atob(s.replace(/-/g,"+").replace(/_/g,"/")),m=Uint8Array.from(l,u=>u.charCodeAt(0)),d=(0,J.unzlibSync)(m);if(d.byteLength>Z)throw new Error("AR configuration exceeds the 5 MiB limit.");let f=JSON.parse((0,J.strFromU8)(d));if(f?.ar===1&&f.state){let u=f.state.configuration,A=(u?.sceneConfig?1:0)+(Array.isArray(u?.models)?u.models.filter(C=>C?.sceneConfig).length:0);if(d.byteLength+A*ar>Z)throw new Error("Expanded AR configuration exceeds the 5 MiB limit.");i=rn(f.state,C=>nn(C,ee))}else i=f}ye(r);let c=ue(i,n.toString());if(c.version!==1||!c.configuration)throw new Error("AR handoff requires a complete versioned viewer configuration.");return c}var ln={id:"identity",modelObjectId:"identity",label:"identity",type:"identity",group:"identity",tags:"identity",style:"appearance",decals:"appearance",transform:"transform",visible:"visibility",removed:"visibility",status:"visibility",selectable:"behavior",hoverable:"behavior",actions:"behavior",cameraState:"behavior",metadata:"data",metrics:"data"},lr=Object.keys(ln),dr=new Set(["__proto__","prototype","constructor"]);function ae(e,t=new Set){if(e==null||typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error("Comparison values must be finite JSON data");return e}if(typeof e!="object"||t.has(e))throw new Error("Comparison values must be acyclic JSON data");t.add(e);let r=Array.isArray(e)?e.map(n=>ae(n,t)):Object.fromEntries(Object.entries(e).filter(([n,o])=>!dr.has(n)&&o!==void 0).map(([n,o])=>[n,ae(o,t)]));return t.delete(e),r}var an=e=>e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).length;function cn(e,t){let r=ae(e);r.visible=e.visible??!0,r.selectable=e.selectable??!0,r.hoverable=e.hoverable??!0,r.status=e.status??"normal",r.type=e.type??"other",r.tags=[...new Set(e.tags??[])].sort(),an(r.transform)&&delete r.transform,r.metadata=Object.fromEntries(Object.entries(e.metadata??{}).filter(([n])=>!t.includes(n)));for(let n of["metrics","style","metadata"])an(r[n])&&delete r[n];for(let n of["actions","decals"])Array.isArray(r[n])&&!r[n].length&&delete r[n];return r}function je(e,t,r,n,o,a){if(Object.is(e,t)||typeof e=="number"&&typeof t=="number"&&Math.abs(e-t)<=o)return;let s=i=>!!i&&typeof i=="object"&&!Array.isArray(i);if(s(e)&&s(t)){for(let i of[...new Set([...Object.keys(e),...Object.keys(t)])].sort())je(e[i],t[i],`${r}.${i}`,n,o,a);return}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let i=0;i<e.length;i++)je(e[i],t[i],`${r}[${i}]`,n,o,a);return}a.push({path:r,category:n,...e!==void 0?{before:ae(e)}:{},...t!==void 0?{after:ae(t)}:{}})}function dn(e,t,r={}){let n=r.tolerance??1e-6;if(!Number.isFinite(n)||n<0)throw new Error("Comparison tolerance must be finite and nonnegative");let o=Object.entries(e.objectBindings).filter(([,p])=>!p.removed),a=Object.entries(t.objectBindings).filter(([,p])=>!p.removed),s=new Map(o),i=new Map(a),c=new Set,l=new Set,m=[],d=p=>{let h=r.matchBy??"modelObjectId",w=typeof h=="object"?p.metadata?.[h.metadataKey]:p[h];return typeof w=="string"&&w.length>0||typeof w=="number"?`${typeof w}:${w}`:null};function f(p,h,w){let v=p===void 0?void 0:s.get(p),y=h===void 0?void 0:i.get(h),R=[];if(v||y){let Q=v?cn(v,r.ignoreMetadataKeys??[]):{},x=y?cn(y,r.ignoreMetadataKeys??[]):{};for(let S of lr)je(Q[S],x[S],S,ln[S],n,R)}let V=v?y?R.length?"modified":"unchanged":"removed":"added";m.push({id:JSON.stringify([p??null,h??null]),identity:w,label:y?.label??v?.label??y?.modelObjectId??v?.modelObjectId??w,status:V,beforeKey:p,afterKey:h,beforeObjectId:v?.modelObjectId,afterObjectId:y?.modelObjectId,changes:R}),p!==void 0&&c.add(p),h!==void 0&&l.add(h)}let u=new Set;for(let[p,h]of Object.entries(r.mapping??{})){if(!s.has(p)||!i.has(h)||u.has(h))throw new Error("Comparison mapping must reference existing, unique binding keys");u.add(h),f(p,h,`mapped:${p}`)}let A=new Map;for(let[p,h,w]of[[o,c,"a"],[a,l,"b"]])for(let[v,y]of p){if(h.has(v))continue;let R=d(y);if(R===null){m.push({id:JSON.stringify([w,v]),identity:"",label:y.label??y.modelObjectId,status:"ambiguous",...w==="a"?{beforeKey:v,beforeObjectId:y.modelObjectId}:{afterKey:v,afterObjectId:y.modelObjectId},changes:[],message:"Missing match identity. Supply an explicit mapping or another match field."});continue}let V=A.get(R)??{a:[],b:[]};V[w].push(v),A.set(R,V)}for(let[p,h]of A){if(h.a.length<=1&&h.b.length<=1){f(h.a[0],h.b[0],p);continue}for(let w of["a","b"])for(let v of h[w]){let y=(w==="a"?s:i).get(v);m.push({id:JSON.stringify([w,v]),identity:p,label:y.label??y.modelObjectId,status:"ambiguous",...w==="a"?{beforeKey:v,beforeObjectId:y.modelObjectId}:{afterKey:v,afterObjectId:y.modelObjectId},changes:[],message:"Duplicate match identity. Supply an explicit one-to-one mapping."})}}m.sort((p,h)=>p.label.localeCompare(h.label)||p.id.localeCompare(h.id));let C=[];je(ae(e.sceneConfig??{}),ae(t.sceneConfig??{}),"sceneConfig","scene",n,C);let b={added:0,removed:0,modified:0,unchanged:0,ambiguous:0};for(let p of m)b[p.status]++;return{version:1,objects:m,counts:b,sceneChanges:C}}0&&(module.exports={ACTION_CATALOG,DEFAULT_MODEL_VIEWER_LABELS,DEFAULT_SCENE_CONFIG,DEFAULT_SECTION_CONFIG,MATERIAL_BLENDING_MODES,MATERIAL_SIDES,MAX_VIEWER_STATE_BYTES,MEASUREMENT_UNITS,SEQUENCE_EASINGS,SEQUENCE_OBJECT_PROPERTIES,applyIsolation,applyStyleRules,buildBindingsFromNodes,calibrateMeasurements,chooseMaterialVariant,collectObjectHierarchy,colorScaleValue,compareViewerConfigurations,copyBindingStyle,createARHandoffUrl,createDefaultBinding,defineObjectBindings,exportConfiguredUSDZ,findCatalogAction,groundAsset,inferType,inspectAsset,isolatedBindingKeys,material,measurementResult,measurementScale,measurementValue,measurementsToCsv,parseAssetTransform,parseMeasurements,parseSectionConfig,parseSelectionSets,parseSequences,parseViewerState,pasteBindingStyle,patchBindings,patchSceneConfig,prepareViewerState,readARHandoffUrl,sampleSequenceTrack,sceneLight,sectionSnapshot,selectBindingKeys,selectBindings,serializeMeasurements,serializeViewerState,snapAssetToGrid,upsertSequenceKeyframe});
package/dist/utils.mjs CHANGED
@@ -1 +1 @@
1
- import{a as m,b as B,c as y,d as C,e as O}from"./chunk-HYFJ5DYJ.mjs";import{A as p,C as S,D as s,E as f,I as b,J as u,a as n,c as t,p as i,q as o,u as c,v as a,x as l,y as d,z as g}from"./chunk-B7REIGDG.mjs";import{a as e,w as r}from"./chunk-4NLJSD3S.mjs";import"./chunk-JR557W27.mjs";export{n as ACTION_CATALOG,e as DEFAULT_MODEL_VIEWER_LABELS,o as DEFAULT_SCENE_CONFIG,i as DEFAULT_SECTION_CONFIG,u as MATERIAL_BLENDING_MODES,b as MATERIAL_SIDES,p as applyIsolation,d as applyStyleRules,f as buildBindingsFromNodes,r as chooseMaterialVariant,l as colorScaleValue,s as createDefaultBinding,O as defineObjectBindings,t as findCatalogAction,S as inferType,g as isolatedBindingKeys,B as material,m as patchBindings,y as patchSceneConfig,C as sceneLight,c as selectBindingKeys,a as selectBindings};
1
+ import{a as k,b as K,c as F,d as W,e as z}from"./chunk-P2JZ5Z7I.mjs";import{Aa as h,Ba as V,Da as I,Ha as L,Ia as _,K as a,Ka as N,L as s,La as q,M as c,Ma as D,N as p,Na as P,Oa as H,Pa as U,Qa as v,S as m,U as S,Ua as G,V as l,Wa as Q,Xa as J,Ya as X,Za as Y,_a as Z,da as f,f as e,fa as g,g as t,ha as u,ia as d,j as n,ja as y,k as o,ka as C,l as i,la as x,ma as A,na as B,oa as O,pa as b,qa as E,ra as M,wa as j,xa as T}from"./chunk-4JMJALRO.mjs";import{L as w,j as r,q as R}from"./chunk-V7WZUWJ5.mjs";import"./chunk-JR557W27.mjs";export{V as ACTION_CATALOG,r as DEFAULT_MODEL_VIEWER_LABELS,s as DEFAULT_SCENE_CONFIG,a as DEFAULT_SECTION_CONFIG,J as MATERIAL_BLENDING_MODES,Q as MATERIAL_SIDES,O as MAX_VIEWER_STATE_BYTES,f as MEASUREMENT_UNITS,t as SEQUENCE_EASINGS,e as SEQUENCE_OBJECT_PROPERTIES,P as applyIsolation,q as applyStyleRules,v as buildBindingsFromNodes,u as calibrateMeasurements,w as chooseMaterialVariant,X as collectObjectHierarchy,N as colorScaleValue,G as compareViewerConfigurations,Y as copyBindingStyle,j as createARHandoffUrl,U as createDefaultBinding,z as defineObjectBindings,h as exportConfiguredUSDZ,I as findCatalogAction,l as groundAsset,H as inferType,R as inspectAsset,D as isolatedBindingKeys,K as material,y as measurementResult,g as measurementScale,d as measurementValue,A as measurementsToCsv,m as parseAssetTransform,C as parseMeasurements,c as parseSectionConfig,B as parseSelectionSets,n as parseSequences,E as parseViewerState,Z as pasteBindingStyle,k as patchBindings,F as patchSceneConfig,M as prepareViewerState,T as readARHandoffUrl,o as sampleSequenceTrack,W as sceneLight,p as sectionSnapshot,L as selectBindingKeys,_ as selectBindings,x as serializeMeasurements,b as serializeViewerState,S as snapAssetToGrid,i as upsertSequenceKeyframe};