@liveroom-tech/react-immersive 6.0.1 → 6.1.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 (67) hide show
  1. package/README.md +26 -2
  2. package/dist/AnimationsTab-NUJTEMZ5.mjs +1 -0
  3. package/dist/AnnotationsTab-OHRVWRKI.mjs +1 -0
  4. package/dist/CinematicTab-IJAY2BS6.mjs +1 -0
  5. package/dist/ConfigureTab-UQRRATCY.mjs +6 -0
  6. package/dist/RulesTab-YVBZGJZX.mjs +1 -0
  7. package/dist/SequencesTab-IC5LWQ6N.css +1 -0
  8. package/dist/SequencesTab-RPJAG26Z.mjs +1 -0
  9. package/dist/binding-builder.css +1 -1
  10. package/dist/binding-builder.d.mts +3 -3
  11. package/dist/binding-builder.d.ts +3 -3
  12. package/dist/binding-builder.js +76 -23
  13. package/dist/binding-builder.mjs +1 -1
  14. package/dist/chunk-2DV2UCQH.mjs +1 -0
  15. package/dist/chunk-37YITTIK.mjs +1 -0
  16. package/dist/chunk-5FLX45O5.mjs +2 -0
  17. package/dist/chunk-6CTCV2Q5.mjs +1 -0
  18. package/dist/chunk-7JCFNZJM.mjs +1 -0
  19. package/dist/chunk-7OWHW66D.mjs +1 -0
  20. package/dist/chunk-AL6UIGWP.mjs +1 -0
  21. package/dist/chunk-BNKTI3CY.mjs +1 -0
  22. package/dist/chunk-CCBFMNAU.mjs +1 -0
  23. package/dist/chunk-E24EFHB5.mjs +1 -0
  24. package/dist/chunk-EV6THDXD.mjs +1 -0
  25. package/dist/chunk-F5QSXMME.mjs +1 -0
  26. package/dist/chunk-FGAJ2UT7.mjs +1 -0
  27. package/dist/chunk-FXV4CLAK.mjs +1 -0
  28. package/dist/chunk-GV4ZRXL6.mjs +1 -0
  29. package/dist/chunk-KHN55ZM7.mjs +3 -0
  30. package/dist/chunk-LX3GXQNU.mjs +1 -0
  31. package/dist/chunk-OPZJDP7T.mjs +1 -0
  32. package/dist/chunk-OREKYGO3.mjs +83 -0
  33. package/dist/chunk-PBVBZYOG.mjs +47 -0
  34. package/dist/chunk-T6AYLPCC.mjs +1 -0
  35. package/dist/hosted.css +1 -1
  36. package/dist/hosted.d.mts +22 -6
  37. package/dist/hosted.d.ts +22 -6
  38. package/dist/hosted.js +75 -22
  39. package/dist/hosted.mjs +1 -1
  40. package/dist/index.css +1 -1
  41. package/dist/index.d.mts +66 -6
  42. package/dist/index.d.ts +66 -6
  43. package/dist/index.js +69 -21
  44. package/dist/index.mjs +1 -1
  45. package/dist/{modelFileResolver-Co7j1tdQ.d.mts → modelFileResolver-BEW_95id.d.mts} +52 -7
  46. package/dist/{modelFileResolver-Co7j1tdQ.d.ts → modelFileResolver-BEW_95id.d.ts} +52 -7
  47. package/dist/{modelViewerProps-BibuMND7.d.ts → modelViewerProps-C7saa0i2.d.mts} +173 -3
  48. package/dist/{modelViewerProps-Ce4-wb57.d.mts → modelViewerProps-CbK_4uZj.d.ts} +173 -3
  49. package/dist/{publicProps-BaJHCDa_.d.mts → publicProps-NKTiohZO.d.mts} +1 -1
  50. package/dist/{publicProps-CP18d_mt.d.ts → publicProps-z7cJhUH8.d.ts} +1 -1
  51. package/dist/simple-model-viewer.css +1 -1
  52. package/dist/simple-model-viewer.d.mts +25 -3
  53. package/dist/simple-model-viewer.d.ts +25 -3
  54. package/dist/simple-model-viewer.js +49 -3
  55. package/dist/simple-model-viewer.mjs +1 -1
  56. package/dist/utils.d.mts +47 -4
  57. package/dist/utils.d.ts +47 -4
  58. package/dist/utils.js +2 -2
  59. package/dist/utils.mjs +1 -1
  60. package/package.json +5 -1
  61. package/dist/chunk-2JFUMJUP.mjs +0 -1
  62. package/dist/chunk-4JMJALRO.mjs +0 -2
  63. package/dist/chunk-OTSCPJWF.mjs +0 -1
  64. package/dist/chunk-P2JZ5Z7I.mjs +0 -1
  65. package/dist/chunk-UGPR4EPP.mjs +0 -81
  66. package/dist/chunk-V7WZUWJ5.mjs +0 -1
  67. package/dist/chunk-VQGYZOMX.mjs +0 -3
@@ -1 +1 @@
1
- "use client";import{a as i,b as t,c as a}from"./chunk-2JFUMJUP.mjs";import{a as d}from"./chunk-MMO7KCYU.mjs";import{c as f}from"./chunk-VQGYZOMX.mjs";import"./chunk-UGPR4EPP.mjs";import"./chunk-OTSCPJWF.mjs";import{sa as r,ta as o}from"./chunk-4JMJALRO.mjs";import"./chunk-V7WZUWJ5.mjs";import"./chunk-JR557W27.mjs";import{useEffect as m,useState as B}from"react";import{jsx as l}from"react/jsx-runtime";function s(e){d("binding-builder","BindingBuilder");let[u,c]=B(!1);return m(()=>{let n=()=>c(e.arHandoff!==!1&&r(e.arHandoff)?.autoRestore!==!1&&o(window.location.href));return n(),window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[e.arHandoff]),u?l(a,{modelUrl:"",licenseKey:e.licenseKey,enableXR:!0,arHandoff:e.arHandoff??!0,mobileHandoffUrl:e.mobileHandoffUrl,dracoDecoderPath:e.dracoDecoderPath,ktx2TranscoderPath:e.ktx2TranscoderPath,meshopt:e.meshopt}):l(f,{...t(e,i)})}export{s as BindingBuilder};
1
+ "use client";import{a as o,b as t,c as a}from"./chunk-2DV2UCQH.mjs";import{a as d}from"./chunk-MMO7KCYU.mjs";import{c as f}from"./chunk-KHN55ZM7.mjs";import"./chunk-E24EFHB5.mjs";import"./chunk-FXV4CLAK.mjs";import"./chunk-AL6UIGWP.mjs";import"./chunk-OREKYGO3.mjs";import"./chunk-7OWHW66D.mjs";import"./chunk-OPZJDP7T.mjs";import"./chunk-FGAJ2UT7.mjs";import"./chunk-PBVBZYOG.mjs";import"./chunk-T6AYLPCC.mjs";import"./chunk-37YITTIK.mjs";import{ka as i,la as r}from"./chunk-5FLX45O5.mjs";import"./chunk-CCBFMNAU.mjs";import"./chunk-LX3GXQNU.mjs";import"./chunk-7JCFNZJM.mjs";import"./chunk-GV4ZRXL6.mjs";import"./chunk-EV6THDXD.mjs";import"./chunk-6CTCV2Q5.mjs";import"./chunk-BNKTI3CY.mjs";import"./chunk-JR557W27.mjs";import{useEffect as h,useState as m}from"react";import{jsx as l}from"react/jsx-runtime";function c(e){d("binding-builder","BindingBuilder");let[s,u]=m(!1);return h(()=>{let n=()=>u(e.arHandoff!==!1&&i(e.arHandoff)?.autoRestore!==!1&&r(window.location.href));return n(),window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[e.arHandoff]),s?l(a,{modelUrl:"",licenseKey:e.licenseKey,enableXR:!0,arHandoff:e.arHandoff??!0,mobileHandoffUrl:e.mobileHandoffUrl,dracoDecoderPath:e.dracoDecoderPath,ktx2TranscoderPath:e.ktx2TranscoderPath,meshopt:e.meshopt,hideLicenseCheckingOverlay:e.hideLicenseCheckingOverlay}):l(f,{...t(e,o)})}export{c as BindingBuilder};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-MMO7KCYU.mjs";import{w as i}from"./chunk-OREKYGO3.mjs";var a={licenseKey:!0,arHandoff:!0,mobileHandoffUrl:!0,dracoDecoderPath:!0,ktx2TranscoderPath:!0,meshopt:!0,hideLicenseCheckingOverlay:!0},d={licenseValidationUrl:!0,gizmoTool:!0,showFloorGrid:!0,onObjectEditLeaseChange:!0,onSelectionClear:!0,onSceneLoaded:!0,onTexturePositioningChange:!0,endTexturePositioningRef:!0};function f(e,t){let o={};for(let r of Object.keys(t))r in e&&(o[r]=e[r]);return o}function s(e,t){let o={...e};for(let r of Object.keys(t))delete o[r];return o}import{jsx as c}from"react/jsx-runtime";function l(e){return n("model-viewer","ModelViewer"),c(i,{...s(e,d)})}export{a,f as b,l as c};
@@ -0,0 +1 @@
1
+ import{useSyncExternalStore as t}from"react";var r="(prefers-reduced-motion: reduce)";function o(e){if(typeof window>"u"||!window.matchMedia)return()=>{};let n=window.matchMedia(r);return n.addEventListener("change",e),()=>n.removeEventListener("change",e)}var d=()=>typeof window<"u"&&!!window.matchMedia?.(r).matches;function u(e="user"){let n=t(o,d,()=>!1);return e==="always"?!0:e==="never"?!1:n}export{u as a};
@@ -0,0 +1,2 @@
1
+ import{e as Fe}from"./chunk-LX3GXQNU.mjs";import{p as He}from"./chunk-7JCFNZJM.mjs";import{b as ue}from"./chunk-GV4ZRXL6.mjs";import{a as de,e as Ge,h as We,p as Ke}from"./chunk-EV6THDXD.mjs";function Lt(e){let n=e.trim();return n?/\.(hdr|exr|jpg|jpeg|png|webp)(?:[?#].*)?$/i.test(n):!1}var Dt=["none","directional","point","spot","hemisphere"],_t=["pbr","matcap","uv-checker"],Ut=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];var zt=["sporadic","constantMild","constantWild"],$t=["linear","radial","mirroredLinear"],Ft=["verySmall","small","medium","large","veryLarge","huge"];var Oe={enabled:!1,axis:"y",position:.5,flip:!1},Un={clips:[],autoplayClip:null},zn={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:zn,animations:Un,annotations:[]};function ee(e){let n=m=>{throw new Error(`Invalid section: ${m}`)},t=m=>m&&typeof m=="object"&&!Array.isArray(m)?m:n("expected an object"),r=m=>typeof m=="string"&&m.trim().length>0&&m.length<=200?m:n("expected a nonempty name or id (up to 200 characters)"),o=m=>typeof m=="number"&&Number.isFinite(m)&&m>=0&&m<=1?m:n("position must be between 0 and 1"),i=m=>!Array.isArray(m)||m.length!==3||!m.every(u=>typeof u=="number"&&Number.isFinite(u))||Math.hypot(...m)<1e-8?n("normal must be a finite, nonzero vector"):[...m],a=m=>{let u=t(m);return!["x","y","z"].includes(u.axis)||typeof u.enabled!="boolean"||typeof u.flip!="boolean"?n("invalid plane"):{enabled:u.enabled,axis:u.axis,position:o(u.position),flip:u.flip,...u.normal!==void 0?{normal:i(u.normal)}:{}}},s=m=>{let u=t(m),l=a(u);if(u.mode!==void 0){if(!["plane","planes","box"].includes(u.mode))return n("invalid mode");l.mode=u.mode}if(u.planes!==void 0){if(!Array.isArray(u.planes)||u.planes.length>6)return n("at most six planes are supported");let f=new Set;l.planes=u.planes.map(g=>{let y=t(g),p=r(y.id);return f.has(p)?n("duplicate plane id"):(f.add(p),{...a(y),id:p,name:r(y.name)})})}if(u.activePlaneId!==void 0&&(l.activePlaneId=r(u.activePlaneId)),u.invertBox!==void 0){if(typeof u.invertBox!="boolean")return n("invalid box inversion");l.invertBox=u.invertBox}if(u.box!==void 0){let f=t(u.box),g=b=>!Array.isArray(b)||b.length!==3?n("invalid box bounds"):b.map(o),y=g(f.min),p=g(f.max);if(y.some((b,h)=>b>=p[h]))return n("box minimum must be below its maximum on every axis");l.box={min:y,max:p}}return l},c=t(e),d=s(c);if(c.presets!==void 0){if(!Array.isArray(c.presets)||c.presets.length>32)return n("at most 32 presets are supported");let m=new Set;d.presets=c.presets.map(u=>{let l=t(u),f=r(l.id);return m.has(f)?n("duplicate preset id"):(m.add(f),{id:f,name:r(l.name),settings:s(l.settings)})})}return d}function Ht(e){let{presets:n,...t}=ee(e);return t}function Kt(e){try{return ee(e)}catch{return Oe}}function Yt(e,n){if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid section: expected an object");let t=["enabled","axis","position","flip"].every(r=>Object.prototype.hasOwnProperty.call(n,r));return ee(t?n:{...Oe,...e,...n})}import{Box3 as Ye,Matrix4 as fe,Quaternion as $n,Vector3 as me,Euler as Fn}from"three";var Zt={version:1,placements:{},gridSize:1};function je(e){return e.id??e.url}function ne(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected an asset transform object.");let n={};for(let t of["position","rotation","scale"]){let r=e[t];if(r!==void 0){if(!Array.isArray(r)||r.length!==3||!r.every(o=>typeof o=="number"&&Number.isFinite(o))||t==="scale"&&r.some(o=>o===0))throw new Error(`Invalid asset ${t}: expected three finite ${t==="scale"?"nonzero ":""}numbers.`);n[t]=[...r]}}return n}function Jt(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid scene composition.");let n=e;if(n.version!==1||!Number.isFinite(n.gridSize)||n.gridSize<=0||!n.placements||typeof n.placements!="object"||Array.isArray(n.placements)||Object.keys(n.placements).length>256)throw new Error("Invalid scene composition version, grid size or placements (maximum 256).");let t={};for(let[r,o]of Object.entries(n.placements)){if(!r||["__proto__","constructor","prototype"].includes(r))throw new Error("Invalid asset instance ID.");let i=ne(o);if(o.label!==void 0&&(typeof o.label!="string"||o.label.length>512))throw new Error("Invalid asset label.");for(let a of["visible","deleted"])if(o[a]!==void 0&&typeof o[a]!="boolean")throw new Error(`Invalid asset ${a}.`);t[r]={...i,...o.label!==void 0?{label:o.label}:{},...o.visible!==void 0?{visible:o.visible}:{},...o.deleted!==void 0?{deleted:o.deleted}:{}}}return{version:1,gridSize:n.gridSize,placements:t}}function Qt(e,n){if(!Number.isFinite(n)||n<=0)throw new Error("Grid size must be positive.");let t=ne(e),[r,o,i]=t.position??[0,0,0];return{...t,position:[Math.round(r/n)*n,o,Math.round(i/n)*n]}}function er(e,n){let t=ne(e),r=t.position??[0,0,0],o=new fe().compose(new me(...r),new $n().setFromEuler(new Fn(...t.rotation??[0,0,0])),new me(...t.scale??[1,1,1])),i=new Ye(new me(...n.min),new me(...n.max)).applyMatrix4(o);if(!Number.isFinite(i.min.y))throw new Error("Cannot place an asset with empty bounds.");return{...t,position:[r[0],r[1]-i.min.y,r[2]]}}function nr(e){e.updateWorldMatrix(!0,!0);let n=new fe().copy(e.parent?.parent?.matrixWorld??new fe).invert(),t=new Ye;return e.traverse(r=>{let o=r;o.geometry&&(o.geometry.computeBoundingBox(),o.geometry.boundingBox&&t.union(o.geometry.boundingBox.clone().applyMatrix4(new fe().multiplyMatrices(n,o.matrixWorld))))}),t.isEmpty()||![...t.min.toArray(),...t.max.toArray()].every(Number.isFinite)?null:{min:t.min.toArray(),max:t.max.toArray()}}import{BufferGeometry as Gn,Float32BufferAttribute as Wn,Matrix4 as qe,Mesh as ve,ShapeUtils as Hn,Vector2 as Ze,Vector3 as I,Vector4 as Kn}from"three";function Je(e){if(e.length!==3)return null;let n=new I(...e[0]).sub(new I(...e[1])),t=new I(...e[2]).sub(new I(...e[1]));return n.lengthSq()===0||t.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,n.normalize().dot(t.normalize()))))*180/Math.PI}function Qe(e,n){if(!e.normal)return null;let t=new I(...e.normal);if(t.lengthSq()===0)return null;t.normalize();let r=new I(...n),o=r.clone().sub(new I(...e.position)).dot(t);return{distance:Math.abs(o),projection:r.addScaledVector(t,-o).toArray()}}function en(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let n=new I(...e[0]),t=e.map(p=>new I(...p).sub(n)),r=Math.max(...t.map(p=>p.length()));if(r===0)return{error:"Area points must be distinct."};let o=new I;for(let p=1;p<t.length-1;p+=1){let b=t[p].clone().cross(t[p+1]);b.lengthSq()>o.lengthSq()&&o.copy(b)}if(o.length()<=r*r*1e-10)return{error:"Area points must not lie on one straight line."};o.normalize();let i=Math.max(r*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(t.some(p=>Math.abs(p.dot(o))>i))return{error:"Area points must lie on one plane."};let a=t.find(p=>p.length()>r*1e-10).clone().normalize(),s=o.clone().cross(a).normalize(),c=t.map(p=>new Ze(p.dot(a),p.dot(s))),d=(p,b,h)=>(b.x-p.x)*(h.y-p.y)-(b.y-p.y)*(h.x-p.x),m=r*r*1e-10,u=(p,b,h)=>Math.abs(d(p,b,h))<=m&&h.x>=Math.min(p.x,b.x)-r*1e-10&&h.x<=Math.max(p.x,b.x)+r*1e-10&&h.y>=Math.min(p.y,b.y)-r*1e-10&&h.y<=Math.max(p.y,b.y)+r*1e-10;for(let p=0;p<c.length;p+=1){let b=c[p],h=c[(p+1)%c.length];if(b.distanceTo(h)<=r*1e-10)return{error:"Area points must be distinct."};for(let w=p+1;w<c.length;w+=1){if(w===p+1||p===0&&w===c.length-1)continue;let A=c[w],x=c[(w+1)%c.length],M=d(b,h,A),R=d(b,h,x),B=d(A,x,b),Q=d(A,x,h);if(M*R<0&&B*Q<0||u(b,h,A)||u(b,h,x)||u(A,x,b)||u(A,x,h))return{error:"Area edges must not cross or touch each other."}}}let l=0,f=0,g=0;for(let p=0;p<c.length;p+=1){let b=c[p],h=c[(p+1)%c.length],w=b.x*h.y-h.x*b.y;l+=w,f+=(b.x+h.x)*w,g+=(b.y+h.y)*w}if(Math.abs(l)<=m)return{error:"The polygon has no measurable area."};let y=n.clone().addScaledVector(a,f/(3*l)).addScaledVector(s,g/(3*l));return{area:Math.abs(l)/2,center:y.toArray(),triangles:Hn.triangulateShape(c,[])}}function Ie(e,n){if(e.length<2)return 0;let t=0;for(let r=1;r<e.length;r+=1)t+=new I(...e[r]).distanceTo(new I(...e[r-1]));return n&&(t+=new I(...e[e.length-1]).distanceTo(new I(...e[0]))),t}var Yn=1e-5;function Xn(e,n){let t=e.getAttribute("position"),r=e.getIndex(),o=t.count,i=Math.max(n,1e-9),a=(g,y,p)=>`${Math.round(g/i)}_${Math.round(y/i)}_${Math.round(p/i)}`,s=new Int32Array(o),c=[],d=new Map;for(let g=0;g<o;g+=1){let y=t.getX(g),p=t.getY(g),b=t.getZ(g),h=a(y,p,b),w=d.get(h);w===void 0&&(w=c.length,c.push(new I(y,p,b)),d.set(h,w)),s[g]=w}let m=c.map(()=>new Map),u=(g,y)=>{if(g===y)return;let p=c[g].distanceTo(c[y]);m[g].has(y)||m[g].set(y,p),m[y].has(g)||m[y].set(g,p)},l=(r?r.count:o)/3,f=g=>r?r.getX(g):g;for(let g=0;g<l;g+=1)u(s[f(g*3)],s[f(g*3+1)]),u(s[f(g*3+1)],s[f(g*3+2)]),u(s[f(g*3+2)],s[f(g*3)]);return{weldedId:s,weldedPosition:c,neighbors:m}}function qn(e,n,t){let r=new Map([[n,0]]),o=[n];for(let i=0;i<t&&o.length>0;i+=1){let a=[];for(let s of o){let c=r.get(s)??0;for(let[d,m]of e[s]??[])r.has(d)||(r.set(d,c+m),a.push(d))}o=a}return r}function Zn(e){let t=(Math.abs(e.y)<.9?new I(0,1,0):new I(1,0,0)).clone().cross(e).normalize(),r=e.clone().cross(t).normalize();return[t,r]}function Jn(e,n,t){let[r,o]=Zn(n),i=0,a=0,s=0;for(let y of t){let p=y.clone().sub(e),b=p.dot(r),h=p.dot(o);i+=b*b,a+=b*h,s+=h*h}let c=i+s,d=i*s-a*a,m=Math.sqrt(Math.max(0,c*c/4-d)),u=c/2+m,l=1,f=0;Math.abs(a)>1e-12?(l=u-s,f=a):s>i&&(l=0,f=1);let g=Math.hypot(l,f)||1;return r.clone().multiplyScalar(l/g).add(o.clone().multiplyScalar(f/g)).normalize()}function Qn(e,n,t,r){let o=e.getAttribute("position"),i=e.getIndex(),a=o.count,s=(i?i.count:a)/3,c=l=>i?i.getX(l):l,d=l=>new I(o.getX(l),o.getY(l),o.getZ(l)).applyMatrix4(n),m=l=>l.clone().sub(t).dot(r),u=[];for(let l=0;l<s;l+=1){let f=d(c(l*3)),g=d(c(l*3+1)),y=d(c(l*3+2)),p=m(f),b=m(g),h=m(y),w=[],A=(x,M,R,B)=>{M>0!=B>0&&w.push(x.clone().lerp(R,M/(M-B)))};A(f,p,g,b),A(g,b,y,h),A(y,h,f,p),w.length===2&&u.push([w[0],w[1]])}return u}function et(e,n){let t=Math.max(n,1e-9),r=l=>`${Math.round(l.x/t)}_${Math.round(l.y/t)}_${Math.round(l.z/t)}`,o=new Map,i=[],a=l=>{let f=r(l),g=o.get(f);return g===void 0&&(g=i.length,i.push(l),o.set(f,g)),g},s=[],c=l=>{for(;s.length<=l;)s.push(new Map)};for(let[l,f]of e){let g=a(l),y=a(f);g!==y&&(c(g),c(y),s[g].set(y,(s[g].get(y)??0)+1),s[y].set(g,(s[y].get(g)??0)+1))}let d=(l,f)=>l<f?`${l}_${f}`:`${f}_${l}`,m=new Set,u=[];for(let l=0;l<s.length;l+=1)for(let f of s[l]?.keys()??[]){if(m.has(d(l,f)))continue;let g=[l],y=l,p=f;m.add(d(y,p));let b=0;for(;p!==l&&p>=0&&b<s.length+4;){g.push(p);let h=[...s[p].keys()].filter(A=>A!==y),w;if(h.length<=1)w=h[0];else{let A=i[p].clone().sub(i[y]).normalize(),x=-1/0;for(let M of h){let R=i[M].clone().sub(i[p]).normalize(),B=A.dot(R);B>x&&(x=B,w=M)}}if(w===void 0){p=-1;break}m.add(d(p,w)),y=p,p=w,b+=1}p===l&&g.length>=3&&u.push(g.map(h=>i[h]))}return u}function Xe(e,n){let t=1/0;for(let r of e)t=Math.min(t,r.distanceTo(n));return t}function nt(e,n){let t=0,r=1/0;return e.forEach((o,i)=>{let a=o.distanceTo(n);a<r&&(r=a,t=i)}),[...e.slice(t),...e.slice(0,t)]}function nn(e,n,t,r,o){let i=Qn(e,n,r,o);if(i.length===0)return{error:"Couldn't trace a loop around this point."};let a=et(i,t*n.getMaxScaleOnAxis());if(a.length===0)return{error:"The surface here doesn't form a closed loop around this point (it may be near an open edge)."};let s=a[0],c=Xe(s,r);for(let m of a.slice(1)){let u=Xe(m,r);u<c&&(c=u,s=m)}let d=nt(s,r).map(m=>m.toArray());return{points:d,length:Ie(d,!0)}}function tn(e){if(!(e.object instanceof ve)||!e.face)return null;let n=e.object,t=n.geometry;if(n.isSkinnedMesh||n.morphTargetInfluences?.some(i=>i!==0)){let i=t.getAttribute("position"),a=new Wn(new Float32Array(i.count*3),3),s=new I;for(let c=0;c<i.count;c++)n.getVertexPosition(c,s),a.setXYZ(c,s.x,s.y,s.z);t=new Gn().setAttribute("position",a).setIndex(t.getIndex())}let r=n.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in n){let i=new qe;n.getMatrixAt(e.instanceId,i),r.multiply(i)}t.computeBoundingSphere();let o=t.boundingSphere&&t.boundingSphere.radius>0?t.boundingSphere.radius:1;return{face:e.face,geometry:t,matrix:r,weldTolerance:o*Yn}}function or(e,n=6){let t=tn(e);if(!t)return{error:"Pick a point on the mesh surface to trace a loop around it."};let{face:r,geometry:o,matrix:i,weldTolerance:a}=t,s=rn(e);if(!s)return{error:"Pick a point on the mesh surface to trace a loop around it."};let c=s[1].clone().sub(s[0]).cross(s[2].clone().sub(s[0]));if(c.lengthSq()===0)return{error:"Couldn't determine the surface direction at this point."};c.normalize();let{weldedId:d,weldedPosition:m,neighbors:u}=Xn(o,a),l=o.getAttribute("position"),f=e.point.clone().applyMatrix4(i.clone().invert()),g=[r.a,r.b,r.c],y=g[0],p=1/0;for(let M of g){let B=new I(l.getX(M),l.getY(M),l.getZ(M)).distanceTo(f);B<p&&(p=B,y=M)}let b=d[y],h=m[b].clone().applyMatrix4(i),w=qn(u,b,n),A=[];for(let M of w.keys())A.push(m[M].clone().applyMatrix4(i));if(A.length<6)return{error:"Not enough surface detail near this point to trace a loop. Try a different spot."};let x=Jn(h,c,A);return nn(o,i,a,e.point.clone(),x)}function ir(e,n=new I(0,1,0)){let t=tn(e);if(!t)return{error:"Pick a point on the mesh surface to trace a loop around it."};let{geometry:r,matrix:o,weldTolerance:i}=t,a=n.clone().normalize();return a.lengthSq()===0?{error:"Couldn't determine a horizontal direction."}:nn(r,o,i,e.point.clone(),a)}function rn(e){if(!(e.object instanceof ve)||!e.face)return null;let n=e.object,t=n.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in n){let r=new qe;n.getMatrixAt(e.instanceId,r),t.multiply(r)}return[e.face.a,e.face.b,e.face.c].map(r=>n.getVertexPosition(r,new I).applyMatrix4(t))}function sr(e){if(!(e.object instanceof ve))return!1;for(let t=e.object;t;t=t.parent)if(!t.visible||t.userData.riEditorGizmo||t.userData.riDecal)return!1;return(Array.isArray(e.object.material)?e.object.material:[e.object.material])[e.face?.materialIndex??0]?.visible!==!1}function ar(e,n,t,r,o,i=12){let a=rn(e),s=a?a[1].clone().sub(a[0]).cross(a[2].clone().sub(a[0])).normalize():null,c={position:e.point.toArray(),...s&&s.lengthSq()>0?{normal:s.toArray()}:{},...a?{faceVertices:a.map(l=>l.toArray())}:{}};if(!a||o==="none")return c;let d=l=>{let f=new Kn(l.x,l.y,l.z,1).applyMatrix4(n.matrixWorldInverse).applyMatrix4(n.projectionMatrix);return f.w<=0||f.z/f.w<-1||f.z/f.w>1?null:{screen:new Ze((f.x/f.w+1)*r.width/2,(1-f.y/f.w)*r.height/2),w:f.w}},m=a.map(d),u=i;if((o==="vertex"||o==="auto")&&(m.forEach((l,f)=>{let g=l?.screen.distanceTo(t)??1/0;g<=u&&(u=g,c.position=a[f].toArray(),c.snapped="vertex")}),c.snapped))return c;if(o==="edge"||o==="auto")for(let l=0;l<3;l+=1){let f=(l+1)%3,g=m[l],y=m[f];if(!g||!y)continue;let p=y.screen.clone().sub(g.screen);if(p.lengthSq()===0)continue;let b=Math.max(0,Math.min(1,t.clone().sub(g.screen).dot(p)/p.lengthSq())),h=g.screen.clone().addScaledVector(p,b).distanceTo(t);if(h<=u){u=h;let w=b*g.w/((1-b)*y.w+b*g.w);c.position=a[l].clone().lerp(a[f],w).toArray(),c.snapped="edge"}}return c}var tt=["m","cm","mm","in","ft"],Te={m:1,cm:.01,mm:.001,in:.0254,ft:.3048},rt=["distance","angle","area","pointToPlane","wrap","wrapHorizontal"];function Ee(e){return tt.includes(e)}function ot(e={},n="m"){let t=e.displayUnit??n,r=e.metersPerUnit??Te[e.sourceUnit??"m"];if(!Number.isFinite(r)||r<=0)throw new Error("Measurement scale must be a positive finite number.");return{displayUnit:t,metersPerUnit:r,factor:Ee(t)?r/Te[t]:1}}function dr(e){try{return new URL(e,typeof window<"u"?window.location?.href:void 0).href}catch{return e}}function ur(e,n,t,r={}){if(!Ee(t)||!Number.isFinite(e)||e<=0||!Number.isFinite(n)||n<=0)throw new Error("Calibration needs two distinct points and a positive known distance.");let o=n*Te[t]/e;if(!Number.isFinite(o)||o<=0)throw new Error("Calibration scale is outside the supported range.");return{...r,metersPerUnit:o}}function on(e,n){let t=n.map(r=>r.position);if(e==="angle"){let r=Je(t);return r===null?null:{value:r,dimension:0}}if(e==="area"){let r=en(t);return"error"in r?null:{value:r.area,dimension:2}}if(e==="pointToPlane"){let r=n.length===2?Qe(n[0],n[1].position):null;return r?{value:r.distance,dimension:1}:null}return n.length<(e==="distance"?2:3)?null:{value:Ie(t,e!=="distance"),dimension:1}}function it(e,n={},t="m",r=e.points,o=e.approximate?"approximate":"ready"){let i=on(e.tool,r),{factor:a,displayUnit:s}=ot(n,t),c=o==="ready"||o==="approximate",d=c&&i?i.value*a**i.dimension:null;return{id:e.id,status:c?i&&d!==null&&Number.isFinite(d)?o:"invalid":o,rawValue:c&&i&&Number.isFinite(i.value)?i.value:null,value:d!==null&&Number.isFinite(d)?d:null,unit:e.tool==="angle"?"\xB0":e.tool==="area"?`${s}\xB2`:s}}function te(e){function n(){throw new Error("Invalid measurements: expected settings and valid named measurements with finite points.")}let t=s=>!!s&&typeof s=="object"&&!Array.isArray(s),r=s=>Array.isArray(s)&&s.length===3&&s.every(c=>typeof c=="number"&&Number.isFinite(c));typeof e=="string"&&(e.length>5*1024*1024&&n(),e=JSON.parse(e)),(!t(e)||e.version!==void 0&&e.version!==1||!t(e.settings)||!Array.isArray(e.items)||e.items.length>256)&&n();let o={};for(let s of["sourceUnit","displayUnit"])e.settings[s]!==void 0&&(Ee(e.settings[s])||n(),o[s]=e.settings[s]);e.settings.metersPerUnit!==void 0&&((typeof e.settings.metersPerUnit!="number"||!Number.isFinite(e.settings.metersPerUnit)||e.settings.metersPerUnit<=0)&&n(),o.metersPerUnit=e.settings.metersPerUnit);let i=new Set,a=e.items.map(s=>{(!t(s)||typeof s.id!="string"||!s.id||i.has(s.id)||typeof s.name!="string"||!s.name.trim()||typeof s.modelId!="string"||!s.modelId||!rt.includes(s.tool)||!Array.isArray(s.points)||s.points.length>8192||typeof s.createdAt!="string"||!Number.isFinite(Date.parse(s.createdAt)))&&n(),i.add(s.id),s.tilesetUrl!==void 0&&s.tilesetUrl!==null&&typeof s.tilesetUrl!="string"&&n(),(s.visible!==void 0&&typeof s.visible!="boolean"||s.approximate!==void 0&&typeof s.approximate!="boolean")&&n();let c=new Set,d=s.points.map(u=>{if((!t(u)||typeof u.id!="number"||!Number.isFinite(u.id)||!r(u.position))&&n(),c.has(u.id)&&n(),c.add(u.id),u.normal!==void 0&&!r(u.normal)&&n(),u.faceVertices!==void 0&&(!Array.isArray(u.faceVertices)||u.faceVertices.length!==3||!u.faceVertices.every(r))&&n(),u.snapped!==void 0&&!["vertex","edge"].includes(u.snapped)&&n(),u.anchor!==void 0){let f=u.anchor;(!t(f)||typeof f.nodeId!="string"||!f.nodeId||!r(f.localPosition)||typeof f.geometrySignature!="string"||typeof f.poseSignature!="string")&&n(),f.localNormal!==void 0&&!r(f.localNormal)&&n(),f.localFaceVertices!==void 0&&(!Array.isArray(f.localFaceVertices)||f.localFaceVertices.length!==3||!f.localFaceVertices.every(r))&&n(),f.instanceId!==void 0&&(!Number.isInteger(f.instanceId)||f.instanceId<0)&&n()}let l=u.anchor;return{id:u.id,position:[...u.position],...u.normal?{normal:[...u.normal]}:{},...u.faceVertices?{faceVertices:u.faceVertices.map(f=>[...f])}:{},...u.snapped?{snapped:u.snapped}:{},...l?{anchor:{nodeId:l.nodeId,localPosition:[...l.localPosition],geometrySignature:l.geometrySignature,poseSignature:l.poseSignature,...l.localNormal?{localNormal:[...l.localNormal]}:{},...l.localFaceVertices?{localFaceVertices:l.localFaceVertices.map(f=>[...f])}:{},...l.instanceId!==void 0?{instanceId:l.instanceId}:{}}}:{}}}),m={id:s.id,name:s.name,modelId:s.modelId,tool:s.tool,points:d,createdAt:s.createdAt,...s.tilesetUrl!==void 0?{tilesetUrl:s.tilesetUrl}:{},...s.visible!==void 0?{visible:s.visible}:{},...s.approximate!==void 0?{approximate:s.approximate}:{}};return on(m.tool,d)||n(),m});return{settings:o,items:a}}function mr(e){return JSON.stringify({version:1,...te(e)},null,2)}function fr(e,n,t="m"){let r=te(e),o=new Map(n?.map(a=>[a.id,a])),i=a=>{let s=String(a??"");return/^[=+@-]/.test(s)&&(s=`'${s}`),`"${s.replace(/"/g,'""')}"`};return[["id","name","modelId","type","status","value","unit","createdAt"],...r.items.map(a=>{let s=o.get(a.id)??it(a,r.settings,t);return[a.id,a.name,a.modelId,a.tool,s.status,s.value,s.unit,a.createdAt]})].map(a=>a.map(i).join(",")).join(`\r
2
+ `)}function sn(e){if(!Array.isArray(e)||e.length>128)throw new Error("Invalid selections: expected up to 128 named selection sets.");let n=new Set;return e.map(t=>{if(!t||typeof t!="object"||typeof t.id!="string"||!t.id||n.has(t.id)||typeof t.name!="string"||!t.name.trim()||t.name.length>200||!Array.isArray(t.objectIds)||t.objectIds.length>1e5||t.objectIds.some(r=>typeof r!="string"||!r))throw new Error("Invalid selections: each set needs a unique id, a name, and model object ids.");return n.add(t.id),{id:t.id,name:t.name.trim(),objectIds:[...new Set(t.objectIds)]}})}import{CanvasTexture as an,Color as cn,ImageLoader as st,NoColorSpace as pe,RepeatWrapping as ge,SRGBColorSpace as Pe,Texture as at}from"three";var H=new Map,Be={color:"#93c5fd",intensity:.07},hr=new cn(Be.color).multiplyScalar(Be.intensity),yr=new cn(Be.color),Sr=.28,J=new Map,Ne=new Map;function ct(e){return`${e.name}|${e.size}|${e.lastModified}`}function xr(e){let n=ct(e),t=e.name.lastIndexOf("."),r=t>0?e.name.slice(0,t):e.name,o=t>0?e.name.slice(t):"",i=`materials/${e.name}`,a=2;for(;;){let s=Ne.get(i);if(s===void 0||s===n)return Ne.set(i,n),i;i=`materials/${r}-${a}${o}`,a+=1}}function be(e){return J.get(e)}function ln(e,n){let t=++e.loadGeneration;e.loaded=!1,e.failed=!1;let r=()=>{if(e.loadGeneration!==t)return;e.loaded=!0;let o=e.pending;e.pending=[];for(let i of o)i()};new st().load(n,o=>{e.loadGeneration===t&&(e.texture.image=o,e.texture.needsUpdate=!0,r())},void 0,()=>{e.loadGeneration===t&&(e.failed=!0,console.warn(`Failed to load texture: ${n}`),r())})}function dn(e,n){for(let t of[Pe,pe]){let r=H.get(re(e,t));r&&ln(r,n)}}function wr(e,n){let t=J.get(e);t&&t!==n&&t.startsWith("blob:")&&URL.revokeObjectURL(t),J.set(e,n),dn(e,n)}function Ar(e){let n=J.get(e);n&&(n.startsWith("blob:")&&URL.revokeObjectURL(n),J.delete(e),Ne.delete(e),dn(e,e))}function re(e,n){return`${n}|${e}`}function lt(e,n=pe,t){let r=re(e,n),o=H.get(r);if(o)return t&&!o.loaded&&o.pending.push(t),o.texture;let i=J.get(e)??e,a={texture:new at,refCount:0,loaded:!1,pending:t?[t]:[],loadGeneration:0};return a.texture.flipY=!1,a.texture.colorSpace=n,H.set(r,a),ln(a,i),a.texture}function Mr(e,n=pe,t){let r=lt(e,n,t);return H.get(re(e,n)).refCount+=1,r}function Cr(e,n=pe){let t=H.get(re(e,n));t&&(t.refCount-=1,t.refCount<=0&&(t.loadGeneration+=1,t.pending=[],t.texture.dispose(),H.delete(re(e,n))))}function Or(e,n,t,r,o,i=1,a=0){let s=e.offsetTextures??(e.offsetTextures={}),c=s[n],d=c;if(!d||d.sourcePath!==r||d.base!==t){c?.texture.dispose();let u=t.clone();u.wrapS=ge,u.wrapT=ge,u.center.set(.5,.5),u.needsUpdate=!0,d={texture:u,sourcePath:r,base:t},s[n]=d}let m=i>0?i:1;return d.texture.offset.set(o[0],o[1]),d.texture.repeat.set(1/m,1/m),d.texture.rotation=a,d.texture}function jr(e,n){let t=e.offsetTextures,r=t?.[n];r&&(r.texture.dispose(),delete t[n])}function vr(e){let n=e.offsetTextures;if(n){for(let t of Object.values(n))t.texture.dispose();delete e.offsetTextures}}var ke=null;function Ir(){if(ke)return ke;let e=256,n=document.createElement("canvas");n.width=e,n.height=e;let t=n.getContext("2d"),r=t.createRadialGradient(e*.35,e*.35,e*.02,e*.5,e*.5,e*.55);r.addColorStop(0,"#ffffff"),r.addColorStop(.4,"#b5b5b5"),r.addColorStop(1,"#3a3a3a"),t.fillStyle=r,t.fillRect(0,0,e,e);let o=new an(n);return o.colorSpace=Pe,ke=o,o}var Re=null;function Tr(){if(Re)return Re;let e=1024,n=8,t=e/n,r=["#ef4444","#f59e0b","#22c55e","#6366f1"],o=document.createElement("canvas");o.width=e,o.height=e;let i=o.getContext("2d");i.textAlign="center",i.textBaseline="middle";for(let s=0;s<n;s+=1)for(let c=0;c<n;c+=1){let d=c*t,m=s*t,u=(Math.floor(c/2)+Math.floor(s/2))%4;i.fillStyle=r[u],i.fillRect(d,m,t,t),i.strokeStyle="rgba(0, 0, 0, 0.28)",i.lineWidth=2;for(let h=1;h<4;h+=1){let w=h*t/4;i.beginPath(),i.moveTo(d+w,m),i.lineTo(d+w,m+t),i.moveTo(d,m+w),i.lineTo(d+t,m+w),i.stroke()}i.strokeStyle="#09090b",i.lineWidth=7,i.strokeRect(d,m,t,t);let l=d+t*.23,f=m+t*.72,g=d+t*.72,y=m+t*.23;i.lineCap="round",i.lineJoin="round",i.beginPath(),i.moveTo(l,f),i.lineTo(g,y),i.lineTo(g-t*.2,y),i.moveTo(g,y),i.lineTo(g,y+t*.2),i.stroke();let p=s*n+c+1;i.font=`700 ${Math.round(t*.2)}px ui-monospace, SFMono-Regular, Menlo, monospace`,i.fillStyle="#ffffff",i.strokeStyle="rgba(0, 0, 0, 0.85)",i.lineWidth=6;let b=String(p).padStart(2,"0");i.strokeText(b,d+t/2,m+t*.82),i.fillText(b,d+t/2,m+t*.82)}let a=new an(o);return a.colorSpace=Pe,a.wrapS=ge,a.wrapT=ge,a.flipY=!1,a.anisotropy=8,a.needsUpdate=!0,Re=a,a}function un(e){for(let n of H.values())if(n.texture.source===e.source&&(!n.loaded||n.failed))return!0;return!1}var K=5*1024*1024,dt=["activeModelId","modelUrl","modelFormat","tilesetUrl","models","mergeModels","sceneConfig","isolation","multiSelectedKeys","activeAnnotation","annotationCategories","backgroundColor","shadows","cinematic","cameraControllerType","objectTransformSpace","arScaleMode","usdzUrl","measurements","measurementSettings","measurementUnit","measurementModelId"];function S(e,n){throw new Error(`Invalid viewer state at ${e}: ${n}`)}function T(e,n){(!e||typeof e!="object"||Array.isArray(e))&&S(n,"expected an object.")}function oe(e,n){(!Array.isArray(e)||!e.every(t=>typeof t=="string"))&&S(n,"expected strings.")}function D(e,n,t){(!Array.isArray(e)||e.length!==n||!e.every(r=>typeof r=="number"&&Number.isFinite(r)))&&S(t,`expected ${n} finite numbers.`)}function ut(e){let n=new Set,t=0;function r(o,i,a){if((++t>2e5||a>64)&&S(i,"configuration is too complex."),o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;(typeof o!="object"||!o)&&S(i,"expected JSON data (finite numbers, no functions)."),n.has(o)&&S(i,"cyclic data."),!Array.isArray(o)&&Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null&&S(i,"expected plain JSON data."),n.add(o);let s=Array.isArray(o)?[]:{};for(let[c,d]of Object.entries(o))["__proto__","constructor","prototype"].includes(c)&&S(`${i}.${c}`,"reserved property."),d!==void 0?s[c]=r(d,`${i}.${c}`,a+1):Array.isArray(o)&&S(i,"undefined array entry.");return n.delete(o),s}return r(e,"state",0)}function _(e,n,t,r,o=!1,i){let a=e[n];if(a==null||a==="")return;typeof a!="string"&&S(t,"expected a URL.");let s=o?be(a)??a:a;if(s.trim().startsWith("blob:")){if(o&&i){i.set(a,{source:s,path:t});return}S(t,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(s!==a&&(a=s,e[n]=s),o&&/^data:image\//i.test(a))return;let c;try{c=new URL(a,r??"https://relative.invalid/")}catch{S(t,"invalid asset URL.")}["http:","https:"].includes(c.protocol)||S(t,"use an HTTP(S) asset URL."),r&&(e[n]=c.href)}function mt(e,n){T(e,n),D(e.position,3,`${n}.position`),D(e.target,3,`${n}.target`),(typeof e.zoom!="number"||e.zoom<=0)&&S(n,"zoom must be positive."),e.fov!==null&&(typeof e.fov!="number"||e.fov<=0||e.fov>=180)&&S(n,"fov must be null or between 0 and 180.");for(let t of["azimuthAngle","polarAngle"])e[t]!==void 0&&typeof e[t]!="number"&&S(n,`${t} must be a number.`)}function gn(e,n,t,r){T(e,n),(typeof e.id!="number"||typeof e.title!="string"||typeof e.description!="string")&&S(n,"expected an annotation id, title and description.");for(let o of["worldPosition","localPosition"])D(e[o],3,`${n}.${o}`);e.images!==void 0&&(Array.isArray(e.images)||S(n,"images must be an array."),e.images.forEach(o=>{T(o,n),_(o,"src",n,t,!0,r)})),e.links!==void 0&&(Array.isArray(e.links)||S(n,"links must be an array."),e.links.forEach(o=>{T(o,n),_(o,"href",n,t,!1,r)}))}function pn(e,n){T(e,n),e.waypoints!==void 0&&(Array.isArray(e.waypoints)||S(n,"expected waypoints."),e.waypoints.forEach(t=>{T(t,n),D(t.position,3,n),D(t.target,3,n)}));for(let t of["enabled","loop","autoPlay"])e[t]!==void 0&&typeof e[t]!="boolean"&&S(n,`${t} must be boolean.`);e.duration!==void 0&&(typeof e.duration!="number"||e.duration<=0)&&S(n,"duration must be positive.")}function Ve(e,n,t){if(n!==null)if(Array.isArray(n))Array.isArray(e)||S(t,"expected an array."),n.length&&e.forEach(r=>Ve(r,n[0],t));else if(typeof n=="object"){T(e,t);for(let[r,o]of Object.entries(n))Ve(e[r],o,`${t}.${r}`)}else typeof e!=typeof n&&S(t,`expected ${typeof n}.`)}function mn(e,n,t,r){if(Ve(e,Z,n),e.measurements!==void 0&&(e.measurements=te(e.measurements)),e.sequences!==void 0&&(e.sequences=Fe(e.sequences)),e.selectionSets!==void 0&&(e.selectionSets=sn(e.selectionSets)),e.product!==void 0&&(e.product=He(e.product),e.product.definition.groups.forEach(o=>o.options.forEach(i=>i.appearance?.forEach(a=>{for(let[s,c]of Object.entries(a.material??{}))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&_(c,"path",`${n}.product.material.${s}.path`,t,!0,r)})))),D(e.model.rotation,3,`${n}.model.rotation`),e.lighting.lights.forEach(o=>D(o.position,3,`${n}.lighting.lights`)),e.annotations.forEach(o=>gn(o,`${n}.annotations`,t,r)),e.animations.autoplayClip!==null&&typeof e.animations.autoplayClip!="string"&&S(n,"invalid autoplay clip."),e.animations.clips.forEach(o=>{T(o,n),(typeof o.sourceName!="string"||typeof o.displayName!="string"||typeof o.hidden!="boolean"||typeof o.speed!="number"||!["repeat","once","ping-pong"].includes(o.loopMode))&&S(n,"invalid animation clip settings.")}),e.cinematic!==void 0&&pn(e.cinematic,`${n}.cinematic`),e.styleRules!==void 0&&!Array.isArray(e.styleRules)&&S(n,"styleRules must be an array."),_(e.environment,"customEnvironmentUrl",`${n}.environment`,t,!1,r),_(e.background,"imageUrl",`${n}.background`,t,!0,r),e.model.activeVariants!==void 0&&oe(e.model.activeVariants,n),e.section!==void 0)try{e.section=ee(e.section)}catch(o){S(`${n}.section`,o.message)}}function bn(e,n,t,r){T(e,n);for(let[o,i]of Object.entries(e)){let a=`${n}.${o}`;T(i,a),(typeof i.id!="string"||typeof i.modelObjectId!="string")&&S(a,"expected binding id and modelObjectId.");for(let s of["label","group","type","status"])i[s]!==void 0&&typeof i[s]!="string"&&S(a,`${s} must be a string.`);i.tags!==void 0&&oe(i.tags,a),i.metadata!==void 0&&T(i.metadata,`${a}.metadata`),i.metrics!==void 0&&(T(i.metrics,a),Object.values(i.metrics).some(s=>typeof s!="number")&&S(a,"metrics must be numbers.")),i.actions!==void 0&&(Array.isArray(i.actions)||S(a,"actions must be an array."),i.actions.forEach(s=>{T(s,a),(typeof s.id!="string"||typeof s.label!="string"||s.type!=="command"||s.effects!==void 0&&!Array.isArray(s.effects))&&S(a,"invalid action.")}));for(let s of["visible","removed","selectable","hoverable"])i[s]!==void 0&&typeof i[s]!="boolean"&&S(a,`${s} must be boolean.`);if(i.transform!==void 0){T(i.transform,a);for(let s of["position","rotation","scale","shear"])i.transform[s]!==void 0&&D(i.transform[s],3,`${a}.transform.${s}`);i.transform.pivot!==void 0&&(T(i.transform.pivot,a),D(i.transform.pivot.point,3,a),D(i.transform.pivot.offset,3,a))}if(i.style!==void 0&&(T(i.style,a),i.style.material!==void 0)){T(i.style.material,a);for(let[s,c]of Object.entries(i.style.material))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&_(c,"path",`${a}.style.material.${s}.path`,t,!0,r)}i.decals!==void 0&&(Array.isArray(i.decals)||S(a,"decals must be an array."),i.decals.forEach(s=>{T(s,a),(typeof s.id!="string"||typeof s.size!="number"||s.size<=0)&&S(a,"invalid decal."),D(s.position,3,a),D(s.normal,3,a),_(s,"image",a,t,!0,r)}))}}function fn(e,n,t,r){Array.isArray(e)||S(n,"expected merge sources."),e.forEach(o=>{T(o,n),(typeof o.url!="string"||!o.url||typeof o.namePrefix!="string")&&S(n,"expected source URL and prefix."),_(o,"url",n,t,!1,r)})}function ft(e,n,t){T(e,"configuration");let r=Object.fromEntries(dt.filter(o=>e[o]!==void 0).map(o=>[o,e[o]]));(typeof r.modelUrl!="string"||!r.modelUrl)&&S("configuration.modelUrl","expected the active model URL.");for(let o of["modelUrl","tilesetUrl","usdzUrl"])_(r,o,`configuration.${o}`,n,!1,t);if(r.sceneConfig!==void 0&&mn(r.sceneConfig,"configuration.sceneConfig",n,t),r.mergeModels!==void 0&&fn(r.mergeModels,"configuration.mergeModels",n,t),r.models!==void 0){(!Array.isArray(r.models)||r.models.length===0)&&S("configuration.models","expected model entries.");let o=new Set,i=new Set;r.models.forEach(a=>{T(a,"model"),(typeof a.url!="string"||!a.url)&&S("model.url","expected a URL."),_(a,"url","model.url",n,!1,t),a.id!==void 0&&(typeof a.id!="string"||!a.id.trim())&&S("model.id","expected a nonempty instance ID.");let s=je({id:a.id,url:a.url});i.has(s)&&S("configuration.models","instance identities must be unique; assign IDs when reusing a URL."),i.add(s),a.transform!==void 0&&(a.transform=ne(a.transform)),a.visible!==void 0&&typeof a.visible!="boolean"&&S("model.visible","expected boolean."),o.add(a.url),bn(a.objectBindings,"model.objectBindings",n,t),a.sceneConfig!==void 0&&mn(a.sceneConfig,"model.sceneConfig",n,t),a.mergeModels!==void 0&&fn(a.mergeModels,"model.mergeModels",n,t)}),r.activeModelId!==void 0&&(typeof r.activeModelId!="string"||!i.has(r.activeModelId))&&S("configuration.activeModelId","active instance is not in models."),r.activeModelId!==void 0&&r.models.find(a=>je(a)===r.activeModelId)?.url!==r.modelUrl&&S("configuration.modelUrl","source does not match the active instance."),o.has(r.modelUrl)||S("configuration.modelUrl","active model is not in models.")}if(r.multiSelectedKeys!==void 0&&oe(r.multiSelectedKeys,"configuration.multiSelectedKeys"),r.annotationCategories!==void 0&&r.annotationCategories!==null&&oe(r.annotationCategories,"configuration.annotationCategories"),r.activeAnnotation!==void 0&&r.activeAnnotation!==null&&gn(r.activeAnnotation,"configuration.activeAnnotation",n,t),r.measurements!==void 0||r.measurementSettings!==void 0){let o=te({items:r.measurements??[],settings:r.measurementSettings??{}});r.measurements!==void 0&&(r.measurements=o.items),r.measurementSettings!==void 0&&(r.measurementSettings=o.settings)}r.measurementModelId!==void 0&&typeof r.measurementModelId!="string"&&S("configuration.measurementModelId","expected a stable id."),r.measurementUnit!==void 0&&typeof r.measurementUnit!="string"&&S("configuration.measurementUnit","expected a unit label.");for(let o of["backgroundColor"])r[o]!==void 0&&typeof r[o]!="string"&&S(o,"expected a string.");r.shadows!==void 0&&typeof r.shadows!="boolean"&&S("shadows","expected boolean.");for(let[o,i]of Object.entries({modelFormat:["glb","gltf","obj","fbx","usdz","stl","ply"],cameraControllerType:["orbit","pointerLock"],objectTransformSpace:["world","local"],arScaleMode:["normalized","real-world"]}))r[o]!==void 0&&!i.includes(r[o])&&S(o,"unsupported value.");if(r.cinematic!==void 0&&pn(r.cinematic,"cinematic"),r.isolation!==void 0&&r.isolation!==null){let{target:o,mode:i,ghostOpacity:a}=r.isolation;typeof o=="string"||Array.isArray(o)&&o.every(s=>typeof s=="string")||o&&typeof o=="object"&&["group","tag","type"].some(s=>typeof o[s]=="string")||S("configuration.isolation","invalid target."),i!==void 0&&!["ghost","hide"].includes(i)&&S("configuration.isolation","invalid mode."),a!==void 0&&(typeof a!="number"||a<0||a>1)&&S("configuration.isolation","opacity must be between 0 and 1.")}return r}function hn(e,n,t,r){if(!(!e||typeof e!="object"))for(let[o,i]of Object.entries(e))o!=="metadata"&&(typeof i=="string"&&["url","modelUrl","tilesetUrl","usdzUrl","path","image","src","href","imageUrl","customEnvironmentUrl"].includes(o)?_(e,o,`${n}.${o}`,t,["path","image","src","imageUrl"].includes(o),r):hn(i,`${n}.${o}`,t,r))}function yn(e,n,t){typeof e=="string"&&(new TextEncoder().encode(e).length>K&&S("state","exceeds the 5 MiB limit."),e=JSON.parse(e));let r=ut(e);T(r,"state"),new TextEncoder().encode(JSON.stringify(r)).length>K&&S("state","exceeds the 5 MiB limit."),r.version!==void 0&&r.version!==1&&S("version","unsupported version."),r.version===void 0&&(r.objectBindings!==void 0||r.configuration!==void 0)&&S("version","full configurations require version 1.");let o={};return r.version!==void 0&&(o.version=1),r.camera!==void 0&&(mt(r.camera,"camera"),o.camera=r.camera),r.hidden!==void 0&&(oe(r.hidden,"hidden"),o.hidden=r.hidden),r.selected!==void 0&&(r.selected!==null&&typeof r.selected!="string"&&S("selected","expected an object id or null."),o.selected=r.selected),r.objectBindings!==void 0&&(bn(r.objectBindings,"objectBindings",n,t),o.objectBindings=r.objectBindings),r.configuration!==void 0&&(o.configuration=ft(r.configuration,n,t)),hn(o,"state",n,t),new TextEncoder().encode(JSON.stringify(o)).length>K&&S("state","exceeds the 5 MiB limit."),o}function _r(e,n){return JSON.stringify(he(e,n))}function he(e,n){return yn(e,n)}async function Sn(e,n){let t=new Map,r=yn(e,n,t),o=new Map,i=new Map;for(let[s,{source:c,path:d}]of t){let m=o.get(c);m||(m=(async()=>{let u;try{u=await fetch(c)}catch{S(d,"this temporary image is no longer available. Reload or reselect it before saving.")}u.ok||S(d,"could not read the temporary image. Reload or reselect it before saving.");let l=await u.blob();l.size>K*3/4&&S(d,"embedded image exceeds the 5 MiB configuration limit. Use a hosted image URL.");let f=new Uint8Array(await l.arrayBuffer()),g=l.type.split(";")[0].toLowerCase(),y=g.startsWith("image/")?g:gt(f);y||S(d,"temporary asset is not a supported image. Use a hosted asset URL.");let p="";for(let b=0;b<f.length;b+=32768)p+=String.fromCharCode(...f.subarray(b,b+32768));return`data:${y};base64,${btoa(p)}`})(),o.set(c,m)),i.set(s,await m)}function a(s){if(!(!s||typeof s!="object"))for(let[c,d]of Object.entries(s))c!=="metadata"&&(["path","image","src","imageUrl"].includes(c)&&typeof d=="string"&&i.has(d)?s[c]=i.get(d):a(d))}return a(r),he(r,n)}function gt(e){let n=(t,r)=>String.fromCharCode(...e.subarray(t,r));if(e[0]===137&&n(1,4)==="PNG")return"image/png";if(e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";if(n(0,3)==="GIF")return"image/gif";if(n(0,4)==="RIFF"&&n(8,12)==="WEBP")return"image/webp";if(n(4,8)==="ftyp"&&["avif","avis"].includes(n(8,12)))return"image/avif";if(/<svg[\s>]/i.test(new TextDecoder().decode(e.subarray(0,1024))))return"image/svg+xml"}import{strFromU8 as pt,strToU8 as xn,unzlibSync as bt,zlibSync as ht}from"fflate";var ye="ri-ar",Se="ri-ar-id",wn=4096,yt=2200,St=xn(JSON.stringify(Z)).byteLength;function An(e){return e==="localhost"||e.endsWith(".localhost")||/^127\./.test(e)||e==="[::1]"||e==="0.0.0.0"}function Mn(e){if(typeof e=="string"&&/^https?:\/\//i.test(e)&&An(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 n of Object.values(e))Mn(n)}function Wr(e){return e&&typeof e=="object"?e:void 0}function Hr(e){let n=new URLSearchParams(new URL(e,"https://viewer.invalid/").hash.slice(1));return n.has(ye)||n.has(Se)}function xt(e,n){let t=new URL(e,n);if(!["https:","http:"].includes(t.protocol))throw new Error("AR handoff requires an HTTP(S) URL.");return t.toString()}function Kr(e,n="",t=2048){let r=new Set,o=i=>{if(typeof i=="string")return be(i)??i;if(i===null||typeof i!="object")return i;if(r.has(i))throw new Error("AR configuration cannot contain cycles.");r.add(i);let a=Array.isArray(i)?i.map(o):Object.fromEntries(Object.keys(i).sort().map(s=>[s,o(i[s])]));return r.delete(i),a};return JSON.stringify([n,t,o({...e,camera:void 0})])}function Cn(e,n){if(JSON.stringify(e)!==JSON.stringify(n))return e&&n&&typeof e=="object"&&typeof n=="object"&&!Array.isArray(e)&&!Array.isArray(n)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Cn(r,n[t])]).filter(([,t])=>t!==void 0)):e}function On(e,n,t=0){if(t>64)throw new Error("AR configuration is too deeply nested.");if(e&&n&&typeof e=="object"&&typeof n=="object"&&!Array.isArray(e)&&!Array.isArray(n)){let r=e,o=n;return Object.fromEntries([...new Set([...Object.keys(o),...Object.keys(r)])].map(i=>[i,Object.prototype.hasOwnProperty.call(r,i)?On(r[i],o[i],t+1):o[i]]))}return e}function jn(e,n){let t=structuredClone(e);if(t.configuration){t.configuration.sceneConfig&&(t.configuration.sceneConfig=n(t.configuration.sceneConfig));for(let r of t.configuration.models??[])r.sceneConfig&&(r.sceneConfig=n(r.sceneConfig))}return t}function ie(e){e?.throwIfAborted()}async function Yr(e,n,t,r){ie(r);let o=new URL(xt(n));if(An(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 i=await Sn(e,o.toString());ie(r),Mn(i);let a=new URLSearchParams(o.hash.slice(1));if(a.delete(ye),a.delete(Se),a.delete("view"),a.delete("viewId"),a.delete("view-id"),t){let s=await t.save(i);if(ie(r),typeof s!="string"||!s||s.length>512)throw new Error("AR storage returned an invalid configuration ID.");a.set(Se,s)}else{let s=ht(xn(JSON.stringify({ar:1,state:jn(i,d=>Cn(d,Z)??{})})),{level:9});if(s.byteLength>wn)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 d of s)c+=String.fromCharCode(d);a.set(ye,btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""))}if(o.hash=a.toString(),o.toString().length>yt)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 Xr(e,n,t){let r=new URL(e),o=new URLSearchParams(r.hash.slice(1)),i=o.get(Se),a=o.get(ye);if(i!==null&&a!==null)throw new Error("AR link contains conflicting configurations.");if(i===null&&a===null)return null;ie(t);let s;if(i!==null){if(!n)throw new Error("This AR link requires the application's configuration storage adapter.");if(!i||i.length>512)throw new Error("Invalid AR configuration ID.");s=await n.load(i)}else{if(!a||a.length>Math.ceil(wn*4/3)||!/^[\w-]+$/.test(a))throw new Error("Invalid or oversized AR link.");let d=atob(a.replace(/-/g,"+").replace(/_/g,"/")),m=Uint8Array.from(d,f=>f.charCodeAt(0)),u=bt(m);if(u.byteLength>K)throw new Error("AR configuration exceeds the 5 MiB limit.");let l=JSON.parse(pt(u));if(l?.ar===1&&l.state){let f=l.state.configuration,g=(f?.sceneConfig?1:0)+(Array.isArray(f?.models)?f.models.filter(y=>y?.sceneConfig).length:0);if(u.byteLength+g*St>K)throw new Error("Expanded AR configuration exceeds the 5 MiB limit.");s=jn(l.state,y=>On(y,Z))}else s=l}ie(t);let c=he(s,r.toString());if(c.version!==1||!c.configuration)throw new Error("AR handoff requires a complete versioned viewer configuration.");return c}var Le=new WeakMap;function Zr(e,n){n?Le.set(e,n):Le.delete(e)}function vn(e){e.traverse(n=>{let t=Le.get(n);if(t)throw new Error(t)})}import{Box3 as At,BufferAttribute as In,BufferGeometry as Tn,Color as Mt,DoubleSide as Ct,FrontSide as Ue,Group as En,Matrix4 as Ot,Mesh as jt,Vector3 as xe}from"three";import{PropertyBinding as De}from"three";var _e=Symbol("react-immersive.model-node-id");function wt(e,n){Object.defineProperty(e,_e,{value:n,configurable:!0})}function se(e){let n=new Map;e.traverse(c=>{if(!c.name)return;let d=n.get(c.name);d?d.push(c):n.set(c.name,[c])});let t=Object.create(null),r=new WeakMap,o=new Map,i=new Set(Array.from(n,([c,d])=>d.length===1?c:null).filter(c=>c!==null)),a=new Set,s=(c,d)=>{wt(c,d),t[d]=c,r.set(c,d),a.add(d)};for(let[c,d]of n)d.length===1&&s(d[0],c);for(let[c,d]of n){if(d.length<2)continue;let m=[];d.forEach((u,l)=>{let f=`${c} [${l+1}]`,g=f,y=2;for(;i.has(g)||a.has(g);)g=`${f}.${y++}`;s(u,g),m.push(g)}),o.set(c,m)}return{nodesById:t,idByNode:r,duplicateNames:o}}function ae(e){return e[_e]??e.name??null}function eo(e,n){let t=n.replace(/\.[^./\\]+$/,"");e.traverse(r=>{r.name&&(r.name=De.sanitizeNodeName(`${t}_${r.name}`))})}function no(e,n){let t=n.replace(/\.[^./\\]+$/,""),r=e.clone();for(let o of r.tracks){let a=De.parseTrackName(o.name).nodeName??"",s=De.sanitizeNodeName(`${t}_${a}`);o.name=s+o.name.slice(a.length)}return r}function to(e,n){let t=null,r=[];return e.traverse(o=>{o[_e]===n&&(t=o),o.name===n&&r.push(o)}),t??(r.length===1?r[0]:null)}function vt(e,n={}){n.signal?.throwIfAborted();let t=new En,r=new En;t.add(r);let o=new Set,i=[],a=[],s=[],c=new Map,d=0,m=0,u=()=>{i.forEach(l=>l.dispose()),a.forEach(l=>l.dispose()),s.forEach(l=>l.dispose())};try{for(let{scene:p,objectBindings:b={},materialOverrides:h={}}of e){vn(p),p.updateWorldMatrix(!0,!0);let w=new Map(Object.entries(b).map(([A,x])=>[x.modelObjectId??A,A]));p.traverse(A=>{let x=A;if(!x.isMesh||!x.geometry)return;for(let P=A;P;P=P.parent){let F=ae(P)??P.name??P.uuid;if(!P.visible||b[w.get(F)??F]?.visible===!1||b[w.get(F)??F]?.removed)return}let M=ae(x)??x.name??x.uuid,R=h[w.get(M)??M]??x.material;if(!R)throw new Error(`Material for ${M} is not ready. Wait for the model to finish loading.`);let B=Array.isArray(R)?R:[R],Q=x.isInstancedMesh?x.count:1;if(x.userData.riDecal&&de(x)&&x.parent){let P=Ge(x.parent);P&&x.bindMatrixInverse.copy(P)}let E=de(x)?We(x):x.geometry.clone();try{if(!de(x)&&x.morphTargetInfluences?.some(U=>U!==0)){let U=E.getAttribute("position"),$=new xe;for(let V=0;V<U.count;V++)x.getVertexPosition(V,$),U.setXYZ(V,$.x,$.y,$.z);E.morphAttributes={},E.computeVertexNormals()}if(!E.getAttribute("position"))throw new Error(`Mesh ${M} has no positions.`);let P=E.index?.count??E.getAttribute("position").count,F=Array.isArray(R)?E.groups:[{start:0,count:P,materialIndex:0}];if(!F.length)throw new Error(`Mesh ${M} has multiple materials without geometry groups.`);for(let U=0;U<Q;U++){let $=x.matrixWorld.clone();if(x.isInstancedMesh){let V=new Ot;x.getMatrixAt(U,V),$.multiply(V)}for(let V of F){let ce=B[V.materialIndex??0];if(!ce)throw new Error(`A material group on ${M} is missing its material.`);if(!ce.visible)continue;let G=ce;if(!G.isMeshStandardMaterial||G.wireframe||G.vertexColors)throw new Error(`AR snapshot cannot preserve ${ce.type}${G.wireframe?" wireframe":G.vertexColors?" vertex colors":""} on ${M}. Use a PBR material or provide arHandoff.createUSDZ.`);let X=Math.max(V.start,E.drawRange.start),Me=Math.min(P,V.start+V.count,E.drawRange.start+E.drawRange.count);if(Me<=X)continue;if(X%3||(Me-X)%3)throw new Error(`Mesh ${M} has an incomplete triangle range.`);let k=new Tn;i.push(k);let z=Array.from({length:Me-X},(C,j)=>E.index?E.index.getX(X+j):X+j);if($.determinant()<0)for(let C=0;C<z.length;C+=3)[z[C+1],z[C+2]]=[z[C+2],z[C+1]];for(let[C,j]of Object.entries(E.attributes)){let O=new Float32Array(z.length*j.itemSize);for(let v=0;v<z.length;v++)for(let L=0;L<j.itemSize;L++)O[v*j.itemSize+L]=j.getComponent(z[v],L);k.setAttribute(C,new In(O,j.itemSize))}k.setIndex(z.map((C,j)=>j)),k.applyMatrix4($);let le=k.getAttribute("position");for(let C=0;C<le.count;C++)if(![le.getX(C),le.getY(C),le.getZ(C)].every(Number.isFinite))throw new Error(`Mesh ${M} contains invalid coordinates.`);k.getAttribute("normal")||k.computeVertexNormals();let N=G.clone();a.push(N);let ze=G.userData.reactImmersiveConfiguredEmissive;if(ze?.isColor&&N.emissive.copy(ze),N.side===Ct){let C=k.toNonIndexed();i.push(C);let j=C.getAttribute("position").count,O=new Tn;i.push(O);for(let[v,L]of Object.entries(C.attributes)){let Ce=new Float32Array(j*L.itemSize*2);for(let W=0;W<j;W++)for(let q=0;q<L.itemSize;q++){Ce[W*L.itemSize+q]=L.getComponent(W,q);let _n=Math.floor(W/3)*3+(2-W%3);Ce[(j+W)*L.itemSize+q]=L.getComponent(_n,q)*(v==="normal"?-1:1)}O.setAttribute(v,new In(Ce,L.itemSize))}N.side=Ue,k.copy(O)}else if(N.side!==Ue){let C=k.getIndex();for(let O=0;O<C.count;O+=3){let v=C.getX(O+1);C.setX(O+1,C.getX(O+2)),C.setX(O+2,v)}let j=k.getAttribute("normal");for(let O=0;O<j.count;O++)j.setXYZ(O,-j.getX(O),-j.getY(O),-j.getZ(O));N.side=Ue}if(x.isInstancedMesh&&x.instanceColor){let C=new Mt;x.getColorAt(U,C),N.color.multiply(C)}for(let[C,j]of Object.entries(N)){if(!j?.isTexture)continue;let O=j;if(un(O)||!O.image||O.image.complete===!1)throw new Error(`Texture on ${M} is not ready. Wait for image loading or replace failed textures before preparing AR.`);let v=c.get(O);if(v||(v=O.clone(),c.set(O,v),s.push(v)),N[C]=v,!k.getAttribute(v.channel?`uv${v.channel}`:"uv"))throw new Error(`Texture on ${M} needs UV coordinates missing from this geometry.`)}if(x.userData.riDecal){k.computeBoundingBox();let C=Math.max(1e-6,k.boundingBox.getSize(new xe).length()*1e-4),j=k.getAttribute("position"),O=k.getAttribute("normal");for(let v=0;v<j.count;v++)j.setXYZ(v,j.getX(v)+O.getX(v)*C,j.getY(v)+O.getY(v)*C,j.getZ(v)+O.getZ(v)*C)}let $e=new jt(k,N);$e.name=`AR_${d++}`,r.add($e),m+=(k.index?.count??k.getAttribute("position").count)/3,(N.clearcoat||N.transmission||N.iridescence||N.anisotropy)&&o.add("Advanced PBR effects may look different in Quick Look.")}}}finally{E.dispose()}})}if(!d||!m)throw new Error("There is no visible model geometry to send to AR.");let l=new At().setFromObject(r),f=l.getSize(new xe),g=l.getCenter(new xe),y=n.scaleMode==="real-world"?1:1/Math.max(f.x,f.y,f.z,1e-9);return r.position.set(-g.x*y,-l.min.y*y,-g.z*y),r.scale.setScalar(y),t.updateMatrixWorld(!0),o.add("USDZ is a static snapshot. Viewer lighting, background, post-processing, annotations and measurement overlays stay in the web viewer."),{root:t,meshCount:d,triangleCount:m,scale:y,warnings:[...o],textures:s,dispose:u}}catch(l){throw u(),l}}async function fo(e,n={}){let t=n.maxTextureSize??2048;if(!Number.isInteger(t)||t<256||t>4096)throw new Error("AR maxTextureSize must be an integer from 256 to 4096.");let r=vt(e,n),o=[];try{let{USDZExporter:i}=await import("three/examples/jsm/exporters/USDZExporter.js");n.signal?.throwIfAborted();for(let s of r.textures){if(!s.isCompressedTexture)continue;let{decompress:c}=await import("three/examples/jsm/utils/WebGLTextureUtils.js"),d=c(s,t);o.push(d),r.root.traverse(m=>{let u=m.material;if(u)for(let l of Object.keys(u))u[l]===s&&(u[l]=d)})}let a=await new i().parseAsync(r.root,{onlyVisible:!0,quickLookCompatible:!0,maxTextureSize:t});return n.signal?.throwIfAborted(),{blob:new Blob([new Uint8Array(a)],{type:"model/vnd.usdz+zip"}),meshCount:r.meshCount,triangleCount:r.triangleCount,scale:r.scale,warnings:r.warnings}}catch(i){throw n.signal?.aborted?i:new Error(`Could not prepare the configured USDZ: ${i instanceof Error?i.message:"export failed"}. Textures must allow cross-origin canvas access.`)}finally{r.dispose(),o.forEach(i=>i.dispose())}}var we=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."}]),po="__custom__";function It(e){return we.find(n=>n.id===e)}var Rn=we.filter(e=>e.handling==="viewer").map(e=>e.id),Tt=new Set(["","New Action",...we.map(e=>e.label)]);function bo(e){return Tt.has(e.trim())}function kn(e,n){let t=Array.from({length:n.length+1},(r,o)=>o);for(let r=1;r<=e.length;r+=1){let o=[r];for(let i=1;i<=n.length;i+=1){let a=t[i-1]+(e[r-1]===n[i-1]?0:1);o[i]=Math.min(o[i-1]+1,t[i]+1,a)}t=o}return t[n.length]}function ho(e){if(It(e))return null;let n=e.trim().toLowerCase();if(!n)return null;let t=n.replace(/[^a-z0-9]/g,""),r=null;for(let o of we){let i=Math.min(kn(n,o.id),kn(t,o.id.replace(/[^a-z0-9]/g,"")));(!r||i<r.distance)&&(r={id:o.id,distance:i})}return r&&r.distance<=2?r.id:null}var Et=.12,Bn=new Set;function kt(e,n){return n?new Set(ue(e,n.target)):Bn}function xo(e,n){let t=kt(e.bindings,n);if(!n||t.size===0)return{...e,setAside:Bn};let r=Math.min(Math.max(n.ghostOpacity??Et,0),1),o={...e.bindings},i=new WeakMap,a=new Set;for(let[s,c]of Object.entries(e.bindings)){if(t.has(s))continue;a.add(s);let d=n.mode==="hide"?{...c,visible:!1}:{...c,style:{...c.style,material:{...c.style?.material,opacity:Math.min(c.style?.material?.opacity??1,r)}}};o[s]=d,i.set(d,e.sourceOf(c))}return{bindings:o,pulses:e.pulses,sourceOf:s=>i.get(s)??e.sourceOf(s),setAside:a}}function Rt(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 Bt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function Nt(e){let n=e.toLowerCase();return n.includes("light")?"light":n.includes("wheel")||n.includes("rim")||n.includes("tire")?"wheel":n.includes("glass")||n.includes("window")||n.includes("windshield")||n.includes("sunroof")?"glass":n.includes("seat")||n.includes("dashboard")||n.includes("console")||n.includes("doorpanel")?"interior":n.includes("floor")?"floor":n.includes("wall")?"wall":n.includes("door")?"door":n.includes("chair")||n.includes("table")||n.includes("sofa")||n.includes("bed")?"furniture":"other"}function Nn(e,n=!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"},...n?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function Pn(e,n=!0){let t=Nt(e);return{id:Rt(e),modelObjectId:e,type:t,label:Bt(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:Nn(t,n),metrics:{},metadata:{}}}function Oo(e,n){return Object.fromEntries(e.map(t=>[t,Pn(t,!n?.has(t))]))}function jo(e,n){let t=new Set,r={};for(let o of e){let i=Pn(o,!n?.has(o)),a=i.id||"object",s=a;for(let d=2;t.has(s);d++)s=`${a}-${d}`;t.add(s),i.id=s;let c=(i.actions??[]).filter(d=>Rn.includes(d.id));i.actions=c.length>0?c:Nn("other",!n?.has(o)),r[o]=i}return r}function vo(e){let n=new Set;for(let[t,r]of Object.entries(se(e).nodesById))Ke(r)||n.add(t);return n}function Io(e){let{nodesById:n}=se(e),t=[];for(let[r,o]of Object.entries(n)){let i=o;i.isMesh&&i.geometry&&o.name&&t.push(r)}return t.sort((r,o)=>r.localeCompare(o))}var Dn={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"},Pt=Object.keys(Dn),Vt=new Set(["__proto__","prototype","constructor"]);function Y(e,n=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"||n.has(e))throw new Error("Comparison values must be acyclic JSON data");n.add(e);let t=Array.isArray(e)?e.map(r=>Y(r,n)):Object.fromEntries(Object.entries(e).filter(([r,o])=>!Vt.has(r)&&o!==void 0).map(([r,o])=>[r,Y(o,n)]));return n.delete(e),t}var Vn=e=>e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).length;function Ln(e,n){let t=Y(e);t.visible=e.visible??!0,t.selectable=e.selectable??!0,t.hoverable=e.hoverable??!0,t.status=e.status??"normal",t.type=e.type??"other",t.tags=[...new Set(e.tags??[])].sort(),Vn(t.transform)&&delete t.transform,t.metadata=Object.fromEntries(Object.entries(e.metadata??{}).filter(([r])=>!n.includes(r)));for(let r of["metrics","style","metadata"])Vn(t[r])&&delete t[r];for(let r of["actions","decals"])Array.isArray(t[r])&&!t[r].length&&delete t[r];return t}function Ae(e,n,t,r,o,i){let a=c=>c===void 0||Array.isArray(c)&&c.length===0;if(Object.is(e,n)||a(e)&&a(n)||typeof e=="number"&&typeof n=="number"&&Math.abs(e-n)<=o)return;let s=c=>!!c&&typeof c=="object"&&!Array.isArray(c);if(s(e)&&s(n)){for(let c of[...new Set([...Object.keys(e),...Object.keys(n)])].sort())Ae(e[c],n[c],`${t}.${c}`,r,o,i);return}if(Array.isArray(e)&&Array.isArray(n)&&e.length===n.length){for(let c=0;c<e.length;c++)Ae(e[c],n[c],`${t}[${c}]`,r,o,i);return}i.push({path:t,category:r,...e!==void 0?{before:Y(e)}:{},...n!==void 0?{after:Y(n)}:{}})}function Eo(e,n,t={}){let r=t.tolerance??1e-6;if(!Number.isFinite(r)||r<0)throw new Error("Comparison tolerance must be finite and nonnegative");let o=Object.entries(e.objectBindings).filter(([,b])=>!b.removed),i=Object.entries(n.objectBindings).filter(([,b])=>!b.removed),a=new Map(o),s=new Map(i),c=new Set,d=new Set,m=[],u=b=>{let h=t.matchBy??"modelObjectId",w=typeof h=="object"?b.metadata?.[h.metadataKey]:b[h];return typeof w=="string"&&w.length>0||typeof w=="number"?`${typeof w}:${w}`:null};function l(b,h,w){let A=b===void 0?void 0:a.get(b),x=h===void 0?void 0:s.get(h),M=[];if(A||x){let B=A?Ln(A,t.ignoreMetadataKeys??[]):{},Q=x?Ln(x,t.ignoreMetadataKeys??[]):{};for(let E of Pt)Ae(B[E],Q[E],E,Dn[E],r,M)}let R=A?x?M.length?"modified":"unchanged":"removed":"added";m.push({id:JSON.stringify([b??null,h??null]),identity:w,label:x?.label??A?.label??x?.modelObjectId??A?.modelObjectId??w,status:R,beforeKey:b,afterKey:h,beforeObjectId:A?.modelObjectId,afterObjectId:x?.modelObjectId,changes:M}),b!==void 0&&c.add(b),h!==void 0&&d.add(h)}let f=new Set;for(let[b,h]of Object.entries(t.mapping??{})){if(!a.has(b)||!s.has(h)||f.has(h))throw new Error("Comparison mapping must reference existing, unique binding keys");f.add(h),l(b,h,`mapped:${b}`)}let g=new Map;for(let[b,h,w]of[[o,c,"a"],[i,d,"b"]])for(let[A,x]of b){if(h.has(A))continue;let M=u(x);if(M===null){m.push({id:JSON.stringify([w,A]),identity:"",label:x.label??x.modelObjectId,status:"ambiguous",...w==="a"?{beforeKey:A,beforeObjectId:x.modelObjectId}:{afterKey:A,afterObjectId:x.modelObjectId},changes:[],message:"Missing match identity. Supply an explicit mapping or another match field."});continue}let R=g.get(M)??{a:[],b:[]};R[w].push(A),g.set(M,R)}for(let[b,h]of g){if(h.a.length<=1&&h.b.length<=1){l(h.a[0],h.b[0],b);continue}for(let w of["a","b"])for(let A of h[w]){let x=(w==="a"?a:s).get(A);m.push({id:JSON.stringify([w,A]),identity:b,label:x.label??x.modelObjectId,status:"ambiguous",...w==="a"?{beforeKey:A,beforeObjectId:x.modelObjectId}:{afterKey:A,afterObjectId:x.modelObjectId},changes:[],message:"Duplicate match identity. Supply an explicit one-to-one mapping."})}}m.sort((b,h)=>b.label.localeCompare(h.label)||b.id.localeCompare(h.id));let y=[];Ae(Y(e.sceneConfig??{}),Y(n.sceneConfig??{}),"sceneConfig","scene",r,y);let p={added:0,removed:0,modified:0,unchanged:0,ambiguous:0};for(let b of m)p[b.status]++;return{version:1,objects:m,counts:p,sceneChanges:y}}function ko(e,n,t){let r={added:"#22c55e",removed:"#f87171",modified:"#fbbf24",unchanged:"#94a3b8",ambiguous:"#c084fc"};return e.objects.flatMap(o=>{let i=n==="before"?o.beforeObjectId:o.afterObjectId;return i&&(o.status!=="unchanged"||o.id===t)?[{objectId:i,color:o.id===t?"#22d3ee":r[o.status]}]:[]})}var Bo=["front","back","double"],No=["normal","additive"];function Lo(e){se(e);let n=[],t=[{node:e,path:"0",parentId:null}];for(;t.length;){let{node:o,path:i,parentId:a}=t.pop(),s=`node:${i}`,c=o.isMesh&&o.name?ae(o):null;n.push({id:s,parentId:a,name:o.name||o.type||"Group",...c?{objectId:c}:{}});for(let d=o.children.length-1;d>=0;d--)t.push({node:o.children[d],path:`${i}/${d}`,parentId:s})}let r=new Set;for(let o=n.length-1;o>=0;o--){let i=n[o];(i.objectId||r.has(i.id))&&(r.add(i.id),i.parentId&&r.add(i.parentId))}return n.filter(o=>r.has(o.id))}function Uo(e){return structuredClone(e.style??{})}function zo(e,n,t){let r=ue(e,n).filter(i=>!e[i].removed);if(!r.length)return e;let o={...e};for(let i of r)o[i]={...e[i],style:structuredClone(t)};return o}export{se as a,ae as b,eo as c,no as d,to as e,Be as f,hr as g,yr as h,Sr as i,xr as j,be as k,wr as l,Ar as m,lt as n,Mr as o,Cr as p,Or as q,jr as r,vr as s,Ir as t,Tr as u,Lt as v,Dt as w,_t as x,Ut as y,zt as z,$t as A,Ft as B,Oe as C,Z as D,ee as E,Ht as F,Kt as G,Yt as H,Zt as I,je as J,ne as K,Jt as L,Qt as M,er as N,nr as O,Je as P,Qe as Q,en as R,Ie as S,or as T,ir as U,sr as V,ar as W,tt as X,Ee as Y,ot as Z,dr as _,ur as $,on as aa,it as ba,te as ca,mr as da,fr as ea,sn as fa,K as ga,_r as ha,he as ia,Sn as ja,Wr as ka,Hr as la,xt as ma,Kr as na,Yr as oa,Xr as pa,Zr as qa,vn as ra,fo as sa,we as ta,po as ua,It as va,Rn as wa,bo as xa,ho as ya,kt as za,xo as Aa,Nt as Ba,Pn as Ca,Oo as Da,jo as Ea,vo as Fa,Io as Ga,Eo as Ha,ko as Ia,Bo as Ja,No as Ka,Lo as La,Uo as Ma,zo as Na};
@@ -0,0 +1 @@
1
+ var i={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:"Pointer 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:"Name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save",knownMeasurementDistance:"Known length",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 color",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Color",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",productOptions:"Options",productOptionsFor:"{product} options",productReset:"Reset",productOptional:"optional",productNone:"None",productAlsoChanges:"Also changes: {changes}",productUnavailable:"Currently unavailable.",productQuantity:"Quantity",productCheckingPrice:"Checking price and availability\u2026",productTotal:"Total",productAddToCart:"Add to cart",productAddingToCart:"Adding\u2026",productRequestQuote:"Request quote",productRequestingQuote:"Requesting\u2026",productRefresh:"Refresh",productBuy:"Buy now",productCopyLink:"Copy link",productLinkCopied:"Link copied",productShowOptions:"Show options",productHideOptions:"Hide options",productIssues:"Configuration issues",productRequestDone:"Request completed.",productSaved:"Saved: {id}",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",showEnvironmentAsBackground:"Show as background",backgroundBlur:"Background Blur",environmentPreset:"Preset",environmentIntensity:"Intensity",toneMapping:"Tone Mapping",toneMappingAces:"ACES Filmic",toneMappingAgx:"AgX",toneMappingNeutral:"Neutral",toneMappingNone:"None",ground:"Ground",groundShadow:"Ground Shadow",groundShadowOpacity:"Shadow Opacity",floorGrid:"Floor Grid",display:"Display",wireframe:"Wireframe",autoRotateSpeed:"Rotation Speed",fieldOfView:"Field of View",modelInfo:"Model",modelInfoObjects:"Objects",modelInfoTriangles:"Triangles",modelInfoMaterials:"Materials",resetSettings:"Reset Settings",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"};function r(o,e,t={}){return(o?.[e]??i[e]).replace(/\{(\w+)\}/g,(a,n)=>Object.prototype.hasOwnProperty.call(t,n)?String(t[n]):a)}var s=new Map(Object.entries(i).map(([o,e])=>[e,o]));function l(o,e){let t=s.get(e);return t?r(o,t):e}export{i as a,r as b,l as c};
@@ -0,0 +1 @@
1
+ import{b as P}from"./chunk-GV4ZRXL6.mjs";import{c as j}from"./chunk-BNKTI3CY.mjs";function O(n){if(typeof n!="object"||n===null)return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function S(n,e){if(!O(e))return e;let r=O(n)?{...n}:{};for(let s of Object.keys(e)){let i=e[s];r[s]=O(i)?S(r[s],i):i}return r}function M(n){return Array.isArray(n)&&n.length>0&&typeof n[0]!="string"}function x(n,e,r){let s=M(e)?e:[{ids:e,patch:r??{}}],i=n;for(let t of s)for(let o of P(i,t.ids)){let c=i[o];if(!c)continue;let a=S(c,t.patch);i===n&&(i={...n}),i[o]=a}return i}function J(n){return{style:{material:n}}}var A=new Set(["__proto__","constructor","prototype"]),I=(n,e)=>n<e?-1:n>e?1:0;function f(n){throw new Error(`Invalid product: ${n}`)}var g=n=>!!n&&typeof n=="object"&&!Array.isArray(n),y=n=>typeof n=="string"&&n.length>0&&n.length<=200&&!A.has(n),h=n=>typeof n=="string"&&n.trim().length>0&&n.length<=500;function D(n){let e=0;function r(s,i){return(++e>1e5||i>32)&&f("definition is too complex."),s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)?s:Array.isArray(s)?s.map(t=>r(t,i+1)):(g(s)||f("expected JSON data."),Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0).map(([t,o])=>(A.has(t)&&f("reserved property name."),[t,r(o,i+1)]))))}return r(n,0)}function q(n){if(typeof n!="string"||n.length>2048)return!1;try{return["http:","https:"].includes(new URL(n.replace(/\{[a-zA-Z]+\}/g,"x")).protocol)}catch{return!1}}function C(n){let e=D(typeof n=="string"?JSON.parse(n):n);(!g(e)||!y(e.id)||!h(e.label)||!y(e.revision)||!Array.isArray(e.groups)||!e.groups.length||e.groups.length>64)&&f("id, label, revision, and 1\u201364 option groups are required.");let r=new Map;for(let i of e.groups){(!g(i)||!y(i.id)||r.has(i.id)||!h(i.label)||i.required!==void 0&&typeof i.required!="boolean"||!Array.isArray(i.options)||!i.options.length||i.options.length>128)&&f("groups need unique ids, labels, and 1\u2013128 options.");let t=new Set;r.set(i.id,t);for(let o of i.options)if((!g(o)||!y(o.id)||t.has(o.id)||!h(o.label)||o.sku!==void 0&&!h(o.sku))&&f("options need unique ids and labels."),t.add(o.id),o.description!==void 0&&!h(o.description)&&f("an option description must be text."),o.swatch!==void 0&&!(typeof o.swatch=="string"&&/^#[0-9a-f]{3,8}$/i.test(o.swatch))&&f("a swatch must be a hex color."),o.priceDeltaMinor!==void 0&&!Number.isSafeInteger(o.priceDeltaMinor)&&f("a price change must be a whole number of minor units."),o.variants!==void 0&&(!Array.isArray(o.variants)||o.variants.some(c=>!h(c)))&&f("variant names must be strings."),o.appearance!==void 0){(!Array.isArray(o.appearance)||o.appearance.length>128)&&f("invalid appearance edits.");for(let c of o.appearance){g(c)||f("invalid appearance edit.");let a=c.target;typeof a=="string"&&a||Array.isArray(a)&&a.every(u=>typeof u=="string"&&!!u)||g(a)&&Object.keys(a).length===1&&["group","tag","type"].some(u=>typeof a[u]=="string")||f("appearance needs an object id, id list, or selector."),c.visible!==void 0&&typeof c.visible!="boolean"&&f("visibility must be boolean."),c.material!==void 0&&!g(c.material)&&f("material must be an object.");for(let u of Object.values(c.material??{}))typeof u=="string"||typeof u=="number"||typeof u=="boolean"||u===null||g(u)&&typeof u.path=="string"&&(u.offset===void 0||Array.isArray(u.offset)&&u.offset.length===2&&u.offset.every(d=>typeof d=="number"))||f("invalid material field.")}}i.defaultOptionId!==void 0&&!t.has(i.defaultOptionId)&&f("a default must name an option in its group."),i.display!==void 0&&!["list","chips","swatches"].includes(i.display)&&f("a group's display must be list, chips or swatches.")}e.pricing!==void 0&&!(g(e.pricing)&&/^[A-Z]{3}$/.test(e.pricing.currency)&&Number.isSafeInteger(e.pricing.basePriceMinor)&&e.pricing.basePriceMinor>=0)&&f("pricing needs a 3-letter currency and a base price of zero or more."),e.checkout!==void 0&&(!g(e.checkout)||e.checkout.label!==void 0&&!h(e.checkout.label)||!q(e.checkout.urlTemplate))&&f("a checkout link needs an http or https URL.");let s=i=>g(i)&&typeof i.groupId=="string"&&typeof i.optionId=="string"&&!!r.get(i.groupId)?.has(i.optionId);if(e.rules!==void 0){(!Array.isArray(e.rules)||e.rules.length>2048)&&f("invalid rules.");let i=new Set;for(let t of e.rules){(!g(t)||!y(t.id)||i.has(t.id)||!s(t.when)||t.message!==void 0&&!h(t.message))&&f("rules need unique ids and valid option references."),i.add(t.id),["requires","excludes"].some(o=>Array.isArray(t[o])&&t[o].length>0)||f("a rule needs a requires or excludes constraint.");for(let o of["requires","excludes"])t[o]!==void 0&&(!Array.isArray(t[o])||t[o].length>128||!t[o].every(s))&&f("rule references must name existing options.")}}if(e.skus!==void 0){(!Array.isArray(e.skus)||e.skus.length>4096)&&f("invalid SKU table.");let i=new Set;for(let t of e.skus){(!g(t)||!h(t.sku)||!g(t.selections)||Object.keys(t.selections).length!==r.size)&&f("SKU mappings need one selection per group.");for(let[c,a]of Object.entries(t.selections))(!r.has(c)||a!==null&&!r.get(c).has(a))&&f("SKU mapping references an unknown option.");let o=JSON.stringify(Object.entries(t.selections).sort(([c],[a])=>I(c,a)));i.has(o)&&f("a combination can map to only one SKU."),i.add(o)}}return{id:e.id,label:e.label,revision:e.revision,groups:e.groups.map(i=>({id:i.id,label:i.label,...i.required!==void 0?{required:i.required}:{},...i.defaultOptionId!==void 0?{defaultOptionId:i.defaultOptionId}:{},...i.display!==void 0?{display:i.display}:{},options:i.options.map(t=>({id:t.id,label:t.label,...t.sku!==void 0?{sku:t.sku}:{},...t.description!==void 0?{description:t.description}:{},...t.swatch!==void 0?{swatch:t.swatch}:{},...t.priceDeltaMinor!==void 0?{priceDeltaMinor:t.priceDeltaMinor}:{},...t.variants!==void 0?{variants:t.variants}:{},...t.appearance!==void 0?{appearance:t.appearance.map(o=>({target:o.target,...o.material!==void 0?{material:o.material}:{},...o.visible!==void 0?{visible:o.visible}:{}}))}:{}}))})),...e.rules!==void 0?{rules:e.rules.map(i=>({id:i.id,when:i.when,...i.requires?{requires:i.requires}:{},...i.excludes?{excludes:i.excludes}:{},...i.message?{message:i.message}:{}}))}:{},...e.skus!==void 0?{skus:e.skus.map(i=>({sku:i.sku,selections:i.selections}))}:{},...e.pricing!==void 0?{pricing:{currency:e.pricing.currency,basePriceMinor:e.pricing.basePriceMinor}}:{},...e.checkout!==void 0?{checkout:{urlTemplate:e.checkout.urlTemplate,...e.checkout.label!==void 0?{label:e.checkout.label}:{}}}:{}}}function w(n){return Object.fromEntries(n.groups.map(e=>[e.id,e.defaultOptionId??null]))}function E(n,e){let r=[];for(let s of n.groups){if(e[s.id]===null)continue;let i=s.options.find(t=>t.id===e[s.id])?.sku;if(!i)return null;r.push(i)}return r.length?r.join("-"):null}function m(n,e=w(n),r=1){if(!Number.isSafeInteger(r)||r<1||r>9999)throw new Error("Quantity must be an integer from 1 to 9999.");if(!g(e)||Object.values(e).some(d=>d!==null&&typeof d!="string"))throw new Error("Product selections must map group ids to option ids or null.");let s=[],i=[...n.groups].sort((d,l)=>I(d.id,l.id)),t=Object.fromEntries(i.map(d=>[d.id,!Object.prototype.hasOwnProperty.call(e,d.id)||e[d.id]===void 0?d.defaultOptionId??null:e[d.id]]));for(let d of Object.keys(e).sort())n.groups.some(l=>l.id===d)||s.push({code:"unknown-group",groupIds:[d],message:`Unknown option group: ${d}.`});let o=[];for(let d of i){let l=t[d.id],p=d.options.find(b=>b.id===l);l!==null&&!p?s.push({code:"unknown-option",groupIds:[d.id],message:`Unknown choice for ${d.label}: ${l}.`}):d.required&&l===null&&s.push({code:"required",groupIds:[d.id],message:`Choose ${d.label}.`}),p&&o.push({groupId:d.id,optionId:p.id,label:p.label,...p.sku?{sku:p.sku}:{}})}let c=d=>n.groups.find(l=>l.id===d.groupId)?.options.find(l=>l.id===d.optionId)?.label??d.optionId;for(let d of[...n.rules??[]].sort((l,p)=>I(l.id,p.id)))if(t[d.when.groupId]===d.when.optionId){for(let l of d.requires??[])t[l.groupId]!==l.optionId&&s.push({code:"requires",ruleId:d.id,groupIds:[...new Set([d.when.groupId,l.groupId])],message:d.message??`${c(d.when)} requires ${c(l)}.`});for(let l of d.excludes??[])t[l.groupId]===l.optionId&&s.push({code:"excludes",ruleId:d.id,groupIds:[...new Set([d.when.groupId,l.groupId])],message:d.message??`${c(d.when)} cannot be combined with ${c(l)}.`})}let a=n.skus?.length?n.skus.find(d=>i.every(l=>d.selections[l.id]===t[l.id]))?.sku??null:E(n,t);n.skus?.length&&!a&&!s.length&&s.push({code:"sku",groupIds:i.map(d=>d.id),message:"This combination has no product SKU."});let u=JSON.stringify({productId:n.id,revision:n.revision,quantity:r,selections:t});return{version:1,productId:n.id,revision:n.revision,key:u,quantity:r,selections:t,sku:a,items:o,valid:!s.length,issues:s}}var T=new Set(["requires","excludes"]);function R(n,e,r,s,i=1){let t={...m(n,e,i).selections,[r]:s},o=new Set([JSON.stringify(t)]),c=[t];for(let a=0;a<c.length&&a<2e3;a++){let u=c[a],d=m(n,u,i).issues.filter(l=>T.has(l.code));if(!d.length)return u;for(let l of new Set(d.flatMap(p=>p.groupIds))){if(l===r)continue;let p=n.groups.find(b=>b.id===l);if(p)for(let b of[...p.options.map(k=>k.id),...p.required?[]:[null]]){let k={...u,[l]:b},v=JSON.stringify(k);o.has(v)||(o.add(v),c.push(k))}}}return null}function U(n,e,r,s,i){let t=R(n,e,r,s,i);return t?Object.entries(t).filter(([o,c])=>o!==r&&c!==e[o]&&c!==null).map(([o,c])=>({groupId:o,optionId:c})):null}function W(n,e){if(!n.pricing)return null;let r=n.pricing.basePriceMinor;for(let s of e.items)r+=n.groups.find(i=>i.id===s.groupId)?.options.find(i=>i.id===s.optionId)?.priceDeltaMinor??0;return{amountMinor:Math.max(0,r)*e.quantity,currency:n.pricing.currency}}function Z(n,e,r=!1){try{let s=new Intl.NumberFormat(void 0,{style:"currency",currency:e,...r?{signDisplay:"exceptZero"}:{}});return s.format(n/10**(s.resolvedOptions().maximumFractionDigits??2))}catch{return`${n} ${e}`}}function L(n,e){let r=n.checkout?.urlTemplate;if(!r||!e.valid||r.includes("{sku}")&&!e.sku)return null;let s={sku:e.sku??"",quantity:String(e.quantity),productId:n.id,revision:n.revision,selections:$(e.selections)};return r.replace(/\{([a-zA-Z]+)\}/g,(i,t)=>Object.prototype.hasOwnProperty.call(s,t)?encodeURIComponent(s[t]):i)}function $(n){return Object.entries(n).filter(([,e])=>e!==null).map(([e,r])=>`${encodeURIComponent(e)}:${encodeURIComponent(r)}`).join(",")}function Q(n,e){let r={...w(e)};for(let s of n.split(",")){let[i,t]=s.split(":");if(!i||!t)continue;let o,c;try{o=decodeURIComponent(i),c=decodeURIComponent(t)}catch{continue}e.groups.find(a=>a.id===o)?.options.some(a=>a.id===c)&&(r[o]=c)}return r}var B=4096;function X(n,e="-"){let r=[{}];for(let t of n.groups){let o=[...t.options.map(c=>c.id),...t.required?[]:[null]];if(r.length*o.length>B*8)throw new Error("This product has too many combinations to list. Use a pricing service to resolve SKUs instead.");r=r.flatMap(c=>o.map(a=>({...c,[t.id]:a})))}let s={...n,skus:void 0},i=[];for(let t of r){if(m(s,t).issues.length)continue;let o=n.groups.flatMap(c=>{let a=t[c.id];return a===null?[]:[c.options.find(u=>u.id===a)?.sku??null]});if(!(!o.length||o.includes(null))&&(i.push({sku:o.join(e),selections:t}),i.length>B))throw new Error("This product has too many combinations to list. Use a pricing service to resolve SKUs instead.")}return i}function H(n,e={},r){let s=[],i=w(n),t=m({...n,skus:void 0},i).issues.filter(c=>T.has(c.code));for(let c of t)s.push({code:"invalid-default",message:`The default choices conflict: ${c.message}`});n.checkout?.urlTemplate.includes("{sku}")&&!n.skus?.length&&n.groups.some(c=>c.options.some(a=>!a.sku))&&s.push({code:"missing-sku",message:"The buy link uses {sku}, but it won't appear until every option has an SKU."});let o=Object.keys(e).length>0;for(let c of n.groups)for(let a of c.options){let u=`${c.label} \u203A ${a.label}`,d={groupId:c.id,optionId:a.id};if(o)for(let p of a.appearance??[])P(e,p.target).length||s.push({code:"no-objects",message:`${u} changes objects that aren't in this model.`,...d});if(r)for(let p of a.variants??[])r.includes(p)||s.push({code:"missing-variant",message:`${u} uses a material variant this model doesn't have: ${p}.`,...d});let l={...i,[c.id]:a.id};R(n,l,c.id,a.id)||s.push({code:"unreachable",message:`The rules leave no way to choose ${u}.`,...d})}return s}function Y(n,e,r,s=1){return e=m(n,e,s).selections,n.groups.flatMap(i=>i.options.map(t=>{let c=m(n,{...e,[i.id]:t.id},s).issues.filter(d=>d.groupIds.includes(i.id)&&d.code!=="sku").map(d=>d.message),a=r?.options?.find(d=>d.groupId===i.id&&d.optionId===t.id);a?.available===!1&&c.push(a.reason??"Currently unavailable.");let u=c.length&&a?.available!==!1?U(n,e,i.id,t.id,s):null;return{groupId:i.id,optionId:t.id,selected:e[i.id]===t.id,available:!c.length,...u?{fix:u}:{},reasons:[...new Set(c)]}}))}function ee(n){g(n)||f("expected a product definition and selections.");let e=C(n.definition),r=m(e,n.selections??w(e));return r.issues.some(s=>s.code==="unknown-group"||s.code==="unknown-option")&&f("selections reference unknown options."),{definition:e,selections:r.selections}}function ne(n){return JSON.stringify({version:1,productId:n.productId,revision:n.revision,quantity:n.quantity,selections:n.selections})}function ie(n,e){let r=D(typeof n=="string"?JSON.parse(n):n);if(!g(r)||r.version!==1||r.productId!==e.id||r.revision!==e.revision)throw new Error("This configuration belongs to a different product or revision.");if(!g(r.selections)||!Number.isSafeInteger(r.quantity))throw new Error("Invalid product configuration selections or quantity.");let s=m(e,r.selections,r.quantity);if(s.issues.some(i=>i.code==="unknown-group"||i.code==="unknown-option"))throw new Error("This configuration references unknown product options.");return s}function te(n,e,r=[],s=[]){let i=n,t=[...r];if(!e)return{objectBindings:i,activeVariants:t};for(let o of e.definition.groups){let c=o.options.find(a=>a.id===(e.selections[o.id]===void 0?o.defaultOptionId:e.selections[o.id]));if(c){for(let a of c.appearance??[])i=x(i,a.target,{...a.material!==void 0?{style:{material:a.material}}:{},...a.visible!==void 0?{visible:a.visible}:{}});if(c.variants?.length){let a=new Set(o.options.flatMap(u=>u.variants??[]));t=t.filter(u=>!a.has(u));for(let u of c.variants)t=j(t,u,s)}}}return{objectBindings:i,activeVariants:t}}export{S as a,x as b,J as c,C as d,w as e,m as f,R as g,W as h,Z as i,L as j,$ as k,Q as l,X as m,H as n,Y as o,ee as p,ne as q,ie as r,te as s};
@@ -0,0 +1 @@
1
+ import{Vector3 as o}from"three";function f(t){if(!t?.trim()||/[\u0000-\u001f\u007f]/.test(t))return null;try{let n=new URL(t.trim(),"https://annotation.invalid/");return n.protocol==="https:"||n.protocol==="http:"?t.trim():null}catch{return null}}function i(t){return t.category?.trim()??""}function c(t,n){if(n===null)return t;let e=new Set(n.map(r=>r.trim()));return t.filter(r=>e.has(i(r)))}function l(t,n){let e=Number.isFinite(t.minDistance)?Math.max(0,t.minDistance):0,r=Number.isFinite(t.maxDistance)?Math.max(0,t.maxDistance):1/0;return n>=e&&n<=r}function a(t){return!!t&&[t.position,t.target].every(n=>Array.isArray(n)&&n.length===3&&n.every(Number.isFinite))}function p(t){let n=t.camera;return{position:t.getPosition(new o,!1).toArray(),target:t.getTarget(new o,!1).toArray(),azimuthAngle:t.azimuthAngle,polarAngle:t.polarAngle,fov:"fov"in n?Number(n.fov):null,zoom:n.zoom}}function s(t,n){a(n)&&(t.setLookAt(...n.position,...n.target,!0),Number.isFinite(n.azimuthAngle)&&Number.isFinite(n.polarAngle)&&t.rotateTo(n.azimuthAngle,n.polarAngle,!0),m(t,n))}function m(t,n){let e=!1;n.fov!=null&&Number.isFinite(n.fov)&&n.fov>0&&n.fov<180&&"fov"in t.camera&&(t.camera.fov=n.fov,t.camera.updateProjectionMatrix(),e=!0),n.zoom!=null&&Number.isFinite(n.zoom)&&n.zoom>0&&t.zoomTo(n.zoom,!0),e&&t.dispatchEvent({type:"update"})}export{f as a,i as b,c,l as d,a as e,p as f,s as g,m as h};
@@ -0,0 +1 @@
1
+ import{useLayoutEffect as y,useRef as x,useState as g}from"react";import{createPortal as T}from"react-dom";import{ChevronRight as P,Info as H}from"lucide-react";import{HexColorInput as I,HexColorPicker as S}from"react-colorful";import{useEffect as L}from"react";function w(e,n,t){L(()=>{if(!t)return;let a=Array.isArray(e)?e:[e],s=i=>{let o=i.target;a.some(u=>u.current?.contains(o))||n()};return document.addEventListener("pointerdown",s,!0),()=>{document.removeEventListener("pointerdown",s,!0)}},[e,n,t])}import{jsx as r,jsxs as c}from"react/jsx-runtime";function M({anchorRef:e,onClose:n,children:t}){let a=x(null),[s,i]=g(null);return w([a,e],n,!0),y(()=>{let o=e.current;if(!o)return;let l=o.getBoundingClientRect(),u=222,p=8,d=Math.min(Math.max(l.right-u,p),window.innerWidth-u-p),b=Math.min(l.bottom+6,window.innerHeight-200);i({top:b,left:d})},[e]),s?T(r("div",{ref:a,className:"se-colorPickerPopover",style:{position:"fixed",top:s.top,left:s.left},children:t}),document.body):null}function F(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function G({label:e,title:n,path:t,children:a}){return c("div",{className:"se-field se-fieldInline","data-ri-path":t,children:[r("span",{className:"se-fieldLabel",title:n??e,children:e}),a]})}function U({children:e}){return r("div",{className:"rui-actions",children:e})}function W({title:e,children:n}){return c("div",{className:"se-listHeader",children:[r("span",{children:e}),n?r("span",{className:"se-listHeaderActions",children:n}):null]})}function _({title:e,actions:n,children:t}){return c("div",{className:"rui-group",children:[c("div",{className:"rui-groupHeader",children:[r("span",{children:e}),n]}),t]})}function q({title:e,children:n}){return c("section",{className:"se-section",children:[r("h3",{className:"se-sectionTitle",children:e}),r("div",{className:"se-sectionBody",children:n})]})}function J({title:e,open:n,onToggle:t,trailing:a,children:s,disabled:i,tooltip:o}){return c("section",{className:"se-panel","data-ri-section":e,children:[c("div",{className:"se-panelHeaderRow",children:[c("button",{type:"button",className:"se-panelHeader",onClick:t,"aria-expanded":n,title:o,children:[r(P,{size:13,className:`se-panelChevron ${n?"se-panelChevron--open":""}`}),r("span",{className:"se-panelTitle",children:e}),o?r(H,{size:11,className:"se-panelHelp","aria-hidden":"true"}):null]}),a?r("span",{className:"se-panelTrailing",children:a}):null]}),n?r("div",{className:`se-panelBody ${i?"se-panelBody--disabled":""}`,children:s}):null]})}function Q({checked:e,onChange:n,label:t}){return c("label",{className:"se-switch","aria-label":t,children:[r("input",{type:"checkbox",checked:e,onChange:a=>n(a.target.checked)}),r("span",{className:"se-switchTrack",children:r("span",{className:"se-switchThumb"})})]})}function k(e){return e>=1||!Number.isFinite(e)?0:Math.min(6,Math.ceil(-Math.log10(e)-1e-9))}function N(e,n,t){let a=e;return n!==void 0&&Number.isFinite(n)&&(a=Math.max(n,a)),t!==void 0&&Number.isFinite(t)&&(a=Math.min(t,a)),a}function $({value:e,step:n,min:t,max:a,disabled:s,onChange:i}){return{onPointerDown(o){if(s||o.button!==0)return;o.preventDefault();let l=o.currentTarget;l.setPointerCapture(o.pointerId);let u=o.clientX,p=e,d=k(n),b=v=>{let h=(v.clientX-u)*n*(v.shiftKey?10:1);i(N(Number((p+h).toFixed(d)),t,a))},f=()=>{l.removeEventListener("pointermove",b),l.removeEventListener("pointerup",f),l.removeEventListener("pointercancel",f)};l.addEventListener("pointermove",b),l.addEventListener("pointerup",f),l.addEventListener("pointercancel",f)}}}function D({label:e,value:n,min:t,max:a,step:s,formatValue:i,onChange:o,disabled:l=!1,unset:u=!1}){let[p,d]=g(!1),[b,f]=g(""),v=a>t?N((n-t)/(a-t)*100,0,100):0,h=u?"\u2013":i?i(n):String(Number(n.toFixed(k(s)))),C=()=>{l||(f(String(n)),d(!0))},R=()=>{let m=Number(b);b.trim()!==""&&Number.isFinite(m)&&o(m),d(!1)};return p?r("input",{className:"rui-sliderInput",type:"number","aria-label":e,autoFocus:!0,step:s,value:b,onFocus:m=>m.currentTarget.select(),onChange:m=>f(m.target.value),onBlur:R,onKeyDown:m=>{m.key==="Enter"&&R(),m.key==="Escape"&&(m.stopPropagation(),d(!1))}}):c("div",{className:`rui-slider ${l?"rui-slider--disabled":""}`,children:[r("i",{className:"rui-sliderFill",style:{width:`${v}%`}}),r("span",{className:"rui-sliderValue",children:h}),r("input",{type:"range","aria-label":e,min:t,max:a,step:s,value:N(n,t,a),disabled:l,onChange:m=>o(Number(m.target.value)),onDoubleClick:C,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),C())}})]})}function ee({label:e,value:n,min:t,max:a,step:s,formatValue:i,onChange:o,disabled:l=!1,path:u}){return c("div",{className:`se-field se-fieldInline ${l?"se-field--disabled":""}`,"data-ri-path":u,children:[r("span",{className:"se-fieldLabel",title:e,children:e}),r(D,{label:e,value:n,min:t,max:a,step:s,formatValue:i,onChange:o,disabled:l})]})}function ne({label:e,checked:n,onChange:t,path:a}){return c("label",{className:"se-field se-fieldInline","data-ri-path":a,children:[r("span",{className:"se-fieldLabel",title:e,children:e}),r("span",{className:"rui-checkCell",children:r("input",{type:"checkbox",className:"se-checkbox",checked:n,onChange:s=>t(s.target.checked)})})]})}function te({label:e,value:n,options:t,onChange:a,path:s}){return c("label",{className:"se-field se-fieldInline","data-ri-path":s,children:[r("span",{className:"se-fieldLabel",title:e,children:e}),r("select",{className:"se-select",value:n,onChange:i=>a(i.target.value),children:t.map(i=>r("option",{value:i,children:F(i)},i))})]})}function V({label:e,value:n,onChange:t}){let[a,s]=g(!1),i=x(null);return c("span",{className:"rui-color",ref:i,children:[r("button",{type:"button",className:"rui-colorSwatch",style:{background:n},"aria-label":`Pick ${e}`,"aria-expanded":a,onClick:()=>s(o=>!o)}),r(I,{prefixed:!0,className:"rui-colorHex","aria-label":e,color:n,onChange:t}),a?r(M,{anchorRef:i,onClose:()=>s(!1),children:r(S,{color:n,onChange:t})}):null]})}function ae({label:e,value:n,onChange:t,path:a}){return c("div",{className:"se-field se-fieldInline","data-ri-path":a,children:[r("span",{className:"se-fieldLabel",title:e,children:e}),r(V,{label:e,value:n,onChange:t})]})}function O({value:e,min:n,max:t,step:a,label:s,onChange:i}){let[o,l]=g(String(e)),u=x(!1);return y(()=>{u.current||l(String(e))},[e]),r("input",{type:"number",className:"se-numberInput","aria-label":s,min:n,max:t,step:a,value:o,onFocus:()=>{u.current=!0},onChange:p=>{let d=p.target.value;l(d),d!==""&&d!=="-"&&!Number.isNaN(Number(d))&&i(Number(d))},onBlur:()=>{u.current=!1,l(String(e))}})}function E({axis:e,label:n,value:t,min:a,max:s,step:i,onChange:o}){let l=$({value:t,step:i,min:a,max:s,onChange:o});return c("span",{className:"se-vectorAxis",children:[r("span",{className:`rui-axis rui-axis--${e.toLowerCase()}`,title:`Drag to change ${e}`,...l,children:e}),r(O,{value:t,min:a,max:s,step:i,label:`${n} ${e}`,onChange:o})]})}function re({label:e,value:n,min:t,max:a,step:s,onChange:i,path:o}){return c("div",{className:"se-field se-fieldInline","data-ri-path":o,children:[r("span",{className:"se-fieldLabel",title:e,children:e}),r("div",{className:"se-vectorRow",children:["X","Y","Z"].map((u,p)=>r(E,{axis:u,label:e,value:n[p],min:t,max:a,step:s,onChange:d=>{let b=[...n];b[p]=d,i(b)}},u))})]})}function se({label:e,value:n,min:t,max:a,step:s,onChange:i,path:o}){return c("div",{className:"se-field se-fieldInline","data-ri-path":o,children:[r("span",{className:"se-fieldLabel",title:e,children:e}),r("div",{className:"se-vectorRow se-vectorRow--2",children:["X","Y"].map((u,p)=>r(E,{axis:u,label:e,value:n[p],min:t,max:a,step:s,onChange:d=>{let b=[...n];b[p]=d,i(b)}},u))})]})}export{w as a,G as b,U as c,W as d,_ as e,q as f,J as g,Q as h,$ as i,D as j,ee as k,ne as l,te as m,V as n,ae as o,re as p,se as q};
@@ -0,0 +1 @@
1
+ var v="KHR_materials_variants",I="riMaterialVariants",N="riMaterialVariantGroups";function o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e){if(!o(e)||!o(e.extensions))return[];let r=e.extensions[v];if(!o(r)||!Array.isArray(r.variants))return[];let n=new Set;return r.variants.map((a,g)=>{let m=o(a)&&typeof a.name=="string"&&a.name?a.name:`Variant ${g+1}`,u=m;for(let b=2;n.has(u);b+=1)u=`${m} (${b})`;return n.add(u),u})}function _(e){let r=e.userData?.gltfExtensions;if(!o(r))return[];let n=r[v];return!o(n)||!Array.isArray(n.mappings)?[]:n.mappings.filter(a=>o(a)&&Number.isInteger(a.material)&&Array.isArray(a.variants)&&a.variants.every(Number.isInteger))}function j(e,r){for(let n=r.length-1;n>=0;n-=1){let a=r[n];if(a<0)continue;let g=e.find(m=>m.variants.includes(a));if(g)return g.material}return null}var P=/^\s*(.+?)\s*(?::|\s\/\s)\s*(.+?)\s*$/;function D(e){let r=Math.min(Math.max(e,0),1),n=r<=.0031308?r*12.92:1.055*r**(1/2.4)-.055;return Math.round(n*255)}function R(e){if(!o(e))return;let r=o(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{};if(r.baseColorTexture!==void 0)return;let n=Array.isArray(r.baseColorFactor)?r.baseColorFactor:[1,1,1,1];if(n.slice(0,3).every(a=>typeof a=="number"))return`#${n.slice(0,3).map(a=>D(a).toString(16).padStart(2,"0")).join("")}`}function T(e,r){if(r.length===0)return[];let n=o(e)?e:{},a=Array.isArray(n.meshes)?n.meshes:[],g=Array.isArray(n.accessors)?n.accessors:[],m=Array.isArray(n.materials)?n.materials:[],u=r.map(()=>new Set),b=r.map(()=>new Map);a.forEach((t,s)=>{(o(t)&&Array.isArray(t.primitives)?t.primitives:[]).forEach((c,i)=>{if(!o(c))return;let p=o(c.extensions)?c.extensions[v]:void 0;if(!o(p)||!Array.isArray(p.mappings))return;let M=o(c.attributes)?c.attributes.POSITION:void 0,A=typeof M=="number"?g[M]:void 0,O=o(A)&&typeof A.count=="number"?A.count:1;for(let d of p.mappings)if(!(!o(d)||!Number.isInteger(d.material)||!Array.isArray(d.variants)))for(let h of d.variants){if(!Number.isInteger(h)||!u[h])continue;u[h].add(`${s}/${i}`);let w=b[h],G=d.material;w.set(G,(w.get(G)??0)+O)}})});let x=r.map((t,s)=>{let l=null;for(let[i,p]of b[s])(l===null||p>(b[s].get(l)??0))&&(l=i);let c=l===null?void 0:R(m[l]);return{name:t,label:t,...c?{swatch:c}:{}}}),y=r.map(()=>-1),f=[],V=new Map;return r.forEach((t,s)=>{let l=P.exec(t);if(!l)return;let[,c,i]=l;V.has(c)||(V.set(c,f.length),f.push({name:c,members:[]})),y[s]=V.get(c),f[y[s]].members.push(s),x[s].label=i}),r.map((t,s)=>s).filter(t=>y[t]<0).sort((t,s)=>+(u[t].size===0)-+(u[s].size===0)).forEach(t=>{let s=f.map((i,p)=>({group:i,groupIndex:p})).filter(({group:i})=>i.name===null&&i.members.some(p=>u[t].size===0||u[p].size===0?!1:[...u[t]].some(M=>u[p].has(M)))).map(({groupIndex:i})=>i);if(s.length===0&&u[t].size===0){let i=f.findIndex(p=>p.name===null);i>=0&&s.push(i)}if(s.length===0){y[t]=f.length,f.push({name:null,members:[t]});return}let[l,...c]=s;for(let i of c){for(let p of f[i].members)y[p]=l;f[l].members.push(...f[i].members),f[i].members=[]}y[t]=l,f[l].members.push(t)}),f.filter(t=>t.members.length>0).sort((t,s)=>Math.min(...t.members)-Math.min(...s.members)).map(t=>({name:t.name,variants:[...t.members].sort((s,l)=>s-l).map(s=>x[s])}))}function L(e,r,n){let a=n.find(m=>m.variants.some(u=>u.name===r)),g=new Set(a?.variants.map(m=>m.name)??[r]);return[...e.filter(m=>!g.has(m)),r]}function $(e){if(Array.isArray(e.activeVariants))return e.activeVariants.filter(n=>typeof n=="string");let r=e.materialVariant;return typeof r=="string"&&r?[r]:[]}function z(e){let r=e.parser,n=S(r?.json);if(!(!r||n.length===0))return e.scene.userData[I]=n,e.scene.userData[N]=T(r.json,n),{names:n,resolveMaterial:async(a,g)=>{let m={geometry:g.geometry,material:await r.getDependency("material",a),isPoints:g.isPoints,isLine:g.isLine};return r.assignFinalMaterial(m),m.material}}}function E(e){let r=e.userData?.[I];return Array.isArray(r)&&r.every(n=>typeof n=="string")?r:[]}function F(e){let r=e.userData?.[N];if(Array.isArray(r))return r;let n=E(e);return n.length>0?[{name:null,variants:n.map(a=>({name:a,label:a}))}]:[]}function B(e,r){let{materialVariant:n,...a}=e;return{...a,activeVariants:r}}export{_ as a,j as b,L as c,$ as d,z as e,E as f,F as g,B as h};
@@ -0,0 +1 @@
1
+ import{b as d}from"./chunk-GV4ZRXL6.mjs";var g="#ff3b30",S=Object.freeze({}),y=n=>n;function O(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function j(n,t){let e=n.metadata;for(let i of t.split(".")){if(!O(e))return;e=e[i]}return e}function B(n,t){if("metric"in t){let e=n.metrics?.[t.metric];return!(typeof e!="number"||!Number.isFinite(e)||t.above!==void 0&&!(e>t.above)||t.below!==void 0&&!(e<t.below))}if("status"in t){let e=n.status??"normal";return Array.isArray(t.status)?t.status.includes(e):t.status===e}return j(n,t.metadata)===t.equals}function h(n){let t=n.trim().replace(/^#/,""),e=t.length===3?t.split("").map(i=>i+i).join(""):t;return/^[0-9a-f]{6}$/i.test(e)?[0,2,4].map(i=>parseInt(e.slice(i,i+2),16)):null}var p=n=>`#${n.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function w(n,t){let e=n.map(([s,o])=>({at:s,rgb:h(o)})).filter(s=>Number.isFinite(s.at)&&s.rgb!==null).sort((s,o)=>s.at-o.at);if(e.length===0||!Number.isFinite(t))return null;if(t<=e[0].at)return p(e[0].rgb);let i=e[e.length-1];if(t>=i.at)return p(i.rgb);let a=e.findIndex(s=>s.at>=t),l=e[a-1],r=e[a],f=r.at===l.at?1:(t-l.at)/(r.at-l.at);return p(l.rgb.map((s,o)=>s+(r.rgb[o]-s)*f))}function k(n,t){if(!t?.length)return{bindings:n,pulses:S,sourceOf:y};let e=new Map,i={};for(let r of t){let f=r.target?d(n,r.target):Object.keys(n),s=r.when?Array.isArray(r.when)?r.when:[r.when]:[];for(let o of f){let m=n[o];if(!s.every(c=>B(m,c)))continue;let u={...r.material};if(r.colorScale){let c=m.metrics?.[r.colorScale.metric],b=typeof c=="number"?w(r.colorScale.stops,c):null;b&&(u={...u,[r.colorScale.channel??"baseColor"]:b})}if(r.pulse){let c=r.pulse===!0?{}:r.pulse;i[o]={color:c.color??g,speed:c.speed!==void 0&&c.speed>0?c.speed:1};let b=u.emissiveIntensity??e.get(o)?.emissiveIntensity??m.style?.material?.emissiveIntensity;b!==void 0&&b>0||(u.emissiveIntensity=1)}Object.keys(u).length>0&&e.set(o,{...e.get(o),...u})}}if(e.size===0)return{bindings:n,pulses:i,sourceOf:y};let a={...n},l=new WeakMap;for(let[r,f]of e){let s=n[r],o={...s,style:{...s.style,material:{...s.style?.material,...f}}};a[r]=o,l.set(o,s)}return{bindings:a,pulses:i,sourceOf:r=>l.get(r)??r}}export{B as a,w as b,k as c};
@@ -0,0 +1 @@
1
+ var e=["other","body","light","wheel","glass","interior","floor","wall","door","furniture","decor","electronics","seat","table","chair","window","sofa","bed","engine","headlight"],t=["normal","hidden","selected","disabled"];export{e as a,t as b};
@@ -0,0 +1 @@
1
+ import{Box3 as F,Vector3 as O}from"three";var P=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"]),K=new WeakMap;function ae(e,n){K.set(e,structuredClone(n))}function G(e){let n=K.get(e);return n?structuredClone(n):void 0}function U(e){if(/^(blob|data):/i.test(e))return"Local resource";let n=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return n.slice(n.lastIndexOf("/")+1).slice(0,300)||"Resource"}function V(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 H(e){let n=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null;return{...e.format?{format:e.format}:{},...e.name?{name:U(e.name)}:{},sourceBytes:n(e.sourceBytes),loadDurationMs:n(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(V))].slice(0,50)}}function L(e){let n=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...n])].sort().map(t=>({name:t,required:n.has(t),recognized:P.has(t)}))}function X(e,n){let t=e.image,r=m=>typeof m=="number"&&Number.isSafeInteger(m)&&m>0?m:null,a=r(t?.naturalWidth??t?.width),u=r(t?.naturalHeight??t?.height),l=!!e.isCompressedTexture,y=e.mipmaps.reduce((m,g)=>m+(g.data?.byteLength??0),0),c=a&&u?Math.ceil(a*u*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?U(e.name):n,width:a,height:u,compressed:l,estimatedBytes:l?y||null:c!==null&&Number.isSafeInteger(c)?c:null}}function ue(e,n={}){let t=H({...G(e),...n.source}),r=[],a=new Set,u=new Map,l=new Set,y=new Map,c=new Map,m=new Set,g=new Map,v=0,R=0,T=0,B=0,I=0,b=(s,i)=>{let o=g.get(s)??{count:0,names:[]};o.count++,o.names.length<20&&o.names.push(i||"Unnamed object"),g.set(s,o)},w=s=>{let i=s?.array??s?.data?.array;i?.buffer&&!m.has(i.buffer)&&(m.add(i.buffer),I+=i.buffer.byteLength)};e.traverse(s=>{let i=s;if(!i.isMesh||!i.geometry)return;v++,R+=i.isInstancedMesh?Number.isSafeInteger(i.count)?Math.max(0,i.count??0):0:1;let o=i.geometry,d=o.getAttribute("position"),D=o.getAttribute("uv"),k=i.material?Array.isArray(i.material)?i.material:[i.material]:[];if(!u.has(o)){let p=!!d&&(!Number.isSafeInteger(d.count)||d.count<0);for(let f=0;!p&&d&&f<d.count;f++)if(!Number.isFinite(d.getX(f))||!Number.isFinite(d.getY(f))||!Number.isFinite(d.getZ(f))){p=!0;break}u.set(o,p)}if(u.get(o)&&b("invalid-positions",s.name),d?.count||b("empty-geometry",s.name),D||b("missing-uv",s.name),o.getAttribute("normal")||b("missing-normals",s.name),o.boundingBox&&[...o.boundingBox.min.toArray(),...o.boundingBox.max.toArray()].some(p=>!Number.isFinite(p))&&b("invalid-bounds",s.name),!a.has(o)){a.add(o),T+=Number.isSafeInteger(d?.count)?Math.max(0,d?.count??0):0;let p=o.index?.count??d?.count??0;B+=Number.isSafeInteger(p)?Math.floor(Math.max(0,p)/3):0,Object.values(o.attributes).forEach(w),Object.values(o.morphAttributes).flat().forEach(w),w(o.index)}let j=!1;for(let p of k){l.add(p);let f=y.get(p);if(!f){f=Object.values(p).filter(h=>!!h&&h.isTexture===!0),y.set(p,f);for(let h of f)c.has(h)||c.set(h,`Texture ${c.size+1}`)}for(let h of f){let E=h.channel??0;o.getAttribute(E===0?"uv":`uv${E}`)||(j=!0)}}j&&b("textured-missing-uv",s.name)});let S=(s,i,o,d,D)=>{let k=g.get(s);k&&r.push({code:s,severity:i,title:o,detail:d,suggestion:D,count:k.count,objects:k.names})};S("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),S("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."),S("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),S("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."),S("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."),S("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."),v||r.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 A=[...c].map(([s,i])=>X(s,i)),_=A.filter(s=>(s.width??0)>4096||(s.height??0)>4096);_.length&&r.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:_.length,objects:_.slice(0,20).map(s=>s.name)}),B>1e6&&r.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."}),l.size>100&&r.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 N=L(t);for(let s of N.filter(i=>!i.recognized))r.push({code:"unrecognized-extension",severity:s.required?"error":"warning",title:`${s.required?"Required":"Optional"} extension not recognized`,detail:s.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});t.failedResources?.length&&r.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:t.failedResources.length,objects:t.failedResources.slice(0,20)});let z=null,M=[...u.values()].some(Boolean)?new F:new F().setFromObject(e);!M.isEmpty()&&[...M.min.toArray(),...M.max.toArray(),...M.getSize(new O).toArray()].every(Number.isFinite)&&(z={min:M.min.toArray(),max:M.max.toArray(),center:M.getCenter(new O).toArray(),size:M.getSize(new O).toArray()}),n.scope==="resident-tiles"&&r.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 C=s=>s.code==="partial-stream"?-1:s.severity==="error"?0:s.severity==="warning"?1:2;return r.sort((s,i)=>C(s)-C(i)),{version:1,status:"ready",scope:n.scope??"asset",source:t,units:t.format==="glb"||t.format==="gltf"?"meters (glTF convention)":"unknown",bounds:z,statistics:{meshes:v,instances:R,geometries:a.size,materials:l.size,textures:c.size,vertices:T,triangles:B,geometryBytes:I,estimatedTextureBytes:A.reduce((s,i)=>s+(i.estimatedBytes??0),0),unknownTextureSizes:A.filter(s=>s.estimatedBytes===null).length,meshesWithoutUvs:g.get("missing-uv")?.count??0,meshesWithoutNormals:g.get("missing-normals")?.count??0},textures:A,extensions:N,issues:r}}function ce(e={}){return{version:1,status:"failed",scope:"asset",source:H(e),units:"unknown",bounds:null,statistics:null,textures:[],extensions:L(e),issues:[{code:"load-failed",severity:"error",title:"Asset could not be loaded",detail:"Geometry and textures could not be inspected.",suggestion:"Check the file format, required decoders, sidecar paths, HTTP access and CORS, then reload the asset."}]}}import{Matrix4 as q,Vector3 as Y}from"three";function Z(e){return e.isSkinnedMesh===!0}function fe(e){let n=[];return e.traverse(t=>{Z(t)&&n.push(t)}),n}var x="reactImmersiveSkinFreeze";function ge(e){return!!e.userData[x]}function Me(e,n,t=[n]){let r=e.userData,a=new q().copy(n).invert(),u=r[x];if(u){u.frozenInverse.copy(a),u.restWorldTransforms=t.map(c=>c.clone()),e.bindMatrixInverse.copy(a);return}let l={frozenInverse:a,restWorldTransforms:t.map(c=>c.clone()),previousOnBeforeRender:e.onBeforeRender,previousUpdateMatrixWorld:Object.prototype.hasOwnProperty.call(e,"updateMatrixWorld")?e.updateMatrixWorld:void 0};e.bindMatrixInverse.copy(a);let y=e.updateMatrixWorld;e.updateMatrixWorld=function(c){y.call(this,c),e.bindMatrixInverse.copy(l.frozenInverse)},e.onBeforeRender=function(c,m,g,v,R,T){l.previousOnBeforeRender.call(this,c,m,g,v,R,T),e.bindMatrixInverse.copy(l.frozenInverse)},r[x]=l}function $(e){return e.userData[x]?.frozenInverse??null}function he(e){return e.userData[x]?.restWorldTransforms??null}function xe(e){let n=e.userData,t=n[x];t&&(e.onBeforeRender=t.previousOnBeforeRender,t.previousUpdateMatrixWorld?e.updateMatrixWorld=t.previousUpdateMatrixWorld:delete e.updateMatrixWorld,delete n[x],e.updateMatrixWorld(!0))}function ye(e){let n=e,t=$(e);t&&n.bindMatrixInverse.copy(t),n.skeleton?.update?.();let r=n.geometry.clone(),a=r.getAttribute("position");if(a){let u=new Y;for(let l=0;l<a.count;l++)n.getVertexPosition(l,u),a.setXYZ(l,u.x,u.y,u.z);a.needsUpdate=!0}return r.deleteAttribute("skinIndex"),r.deleteAttribute("skinWeight"),r.morphAttributes={},r.morphTargetsRelative=!1,r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function be(e){return e.matrixWorld.clone()}import{AdditiveBlending as J,BackSide as Q,DoubleSide as ee,FrontSide as te,NoColorSpace as ne,NormalBlending as re,SRGBColorSpace as se,Vector2 as W}from"three";function De(e){let n=!0;return e?.traverse(t=>{let r=t.isMesh?t.geometry:null;r&&!r.getAttribute("uv")&&(n=!1)}),n}function Oe(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function Ie(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function Ne(e){return!!(e&&"isMesh"in e&&e.isMesh)}var ze=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],Ce={texture:"map",metalnessMap:"metalnessMap",roughnessMap:"roughnessMap",emissiveMap:"emissiveMap",alphaMap:"alphaMap",normalMap:"normalMap",bumpMap:"bumpMap",aoMap:"aoMap",displacementMap:"displacementMap",clearcoatMap:"clearcoatMap",clearcoatRoughnessMap:"clearcoatRoughnessMap",clearcoatNormalMap:"clearcoatNormalMap",anisotropyMap:"anisotropyMap",transmissionMap:"transmissionMap",thicknessMap:"thicknessMap",sheenColorMap:"sheenColorMap",sheenRoughnessMap:"sheenRoughnessMap",specularIntensityMap:"specularIntensityMap",specularColorMap:"specularColorMap"},ie=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function je(e){return ie.has(e)?se:ne}function Ee(e,n){return e?.[n]?.path}function Fe(e,n){let t=e?.[n]?.offset;if(!t)return;let[r,a]=t;if(!(!Number.isFinite(r)||!Number.isFinite(a)))return r===0&&a===0?void 0:[r,a]}function Ke(e,n){let t=e?.[n]?.scale;if(!(!Number.isFinite(t)||!t))return t===1?void 0:t}function Ue(e,n){let t=e?.[n]?.rotation;if(!(!Number.isFinite(t)||!t))return t}function He(e){return e==="back"?Q:e==="double"?ee:te}function Le(e){return e==="additive"?J:re}function We(e,n=1,t=n){if(e&&typeof e=="object"){let r=e;if(typeof r.x=="number"&&Number.isFinite(r.x)&&typeof r.y=="number"&&Number.isFinite(r.y))return new W(r.x,r.y)}return new W(n,t)}function Pe(e){return Number.isFinite(e)&&e>0?e:1}function Ge(e,n){return e?.animations.clips.find(t=>t.sourceName===n)}function Ve(e){return e?.loopMode??"repeat"}export{Z as a,fe as b,ge as c,Me as d,$ as e,he as f,xe as g,ye as h,be as i,ae as j,G as k,U as l,V as m,ue as n,ce as o,De as p,Oe as q,Ie as r,Ne as s,ze as t,Ce as u,je as v,Ee as w,Fe as x,Ke as y,Ue as z,He as A,Le as B,We as C,Pe as D,Ge as E,Ve as F};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-7JCFNZJM.mjs";function c(e,i){return n(e,i)}var t={type:"point",color:"#ffffff",intensity:1,position:[0,0,0],distance:0,decay:2,attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0};function r(e){return{...t,...e}}function s(e){return e}export{c as a,r as b,s as c};
@@ -0,0 +1 @@
1
+ var i={free:0,starter:1,growth:2};function p(e){return e==="starter"||e==="growth"?e:"free"}function n(e,t){return i[e]>=i[t]}var o={free:"Free",starter:"Starter",growth:"Growth"};var a={advancedMaterials:"starter",materialVariants:"starter",customEnvironment:"starter",backgroundImages:"starter",sectionPlanes:"starter",calibratedMeasurements:"starter",animationConfig:"starter",sceneBundle:"starter",cinematic:"starter",rules:"growth",postLighting:"starter",postSelection:"growth",productCommerce:"starter"};function b(e,t){return n(e,a[t])}var u={decalsPerObject:{free:1,starter:1/0,growth:1/0},lights:{free:3,starter:1/0,growth:1/0},annotations:{free:3,starter:1/0,growth:1/0},sequences:{free:1,starter:1/0,growth:1/0},selectionSets:{free:3,starter:1/0,growth:1/0},models:{free:1,starter:3,growth:1/0},productGroups:{free:2,starter:1/0,growth:1/0}};function d(e,t,r){return r<u[t][e]}function y(e,t){return["free","starter","growth"].find(r=>d(r,e,t))??"growth"}import{createContext as c,useContext as l}from"react";var g=c({isInsideEditor:!1,activeTab:"object",activeSubTab:"model",tier:"free"});var h=()=>l(g);import{Lock as T}from"lucide-react";import{jsx as f,jsxs as s}from"react/jsx-runtime";function R({requiredTier:e,feature:t}){return s("div",{className:"bb-tierLock",children:[f(T,{size:16}),s("p",{className:"bb-tierLockMessage",children:[t," requires the ",o[e]," plan or higher."]})]})}export{p as a,o as b,b as c,u as d,d as e,y as f,g,h,R as i};
@@ -0,0 +1 @@
1
+ import{useEffect as y,useId as E,useRef as b}from"react";import{X as N}from"lucide-react";import{jsx as o,jsxs as f}from"react/jsx-runtime";var h='button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function L({title:m,icon:v,onCancel:a,children:g,footer:p}){let d=E(),t=b(null),l=b(a);return l.current=a,y(()=>{let r=document.activeElement;t.current?.contains(document.activeElement)||t.current?.focus();let c=e=>{if(e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),l.current()),e.key!=="Tab"||!t.current)return;let i=Array.from(t.current.querySelectorAll(h)),s=i[0],u=i[i.length-1],n=document.activeElement;e.shiftKey&&(n===s||n===t.current)?(e.preventDefault(),u?.focus()):!e.shiftKey&&n===u&&(e.preventDefault(),s?.focus())};return document.addEventListener("keydown",c,!0),()=>{document.removeEventListener("keydown",c,!0),r?.focus?.()}},[]),o("div",{className:"bb-dialogBackdrop",onMouseDown:r=>{r.target===r.currentTarget&&a()},children:f("div",{ref:t,className:"bb-dialog",role:"dialog","aria-modal":"true","aria-labelledby":d,tabIndex:-1,children:[f("div",{className:"bb-dialogHeader",children:[v,o("h3",{id:d,children:m}),o("button",{type:"button",className:"bb-dialogClose",onClick:a,"aria-label":"Close dialog",children:o(N,{size:14})})]}),o("div",{className:"bb-dialogBody",children:g}),o("div",{className:"bb-dialogFooter",children:p})]})})}export{L as a};
@@ -0,0 +1 @@
1
+ function c(n,e){if(n[e])return e;let i=Object.entries(n).find(([,t])=>t.id===e)?.[0];return i||(Object.entries(n).find(([,t])=>t.modelObjectId===e)?.[0]??null)}function o(n){return typeof n=="object"&&!Array.isArray(n)}function g(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 d(n,e){if(o(e))return Object.entries(n).filter(([,t])=>g(t,e)).map(([t])=>t);let r=(typeof e=="string"?[e]:e).map(t=>c(n,t)).filter(t=>t!==null);return[...new Set(r)]}function l(n,e){return d(n,e).map(i=>n[i]).filter(i=>i!==void 0)}export{c as a,d as b,l as c};