@seatlayer/core 0.67.13 → 0.67.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/{categoryInventory-CDGQe2Ag.d.ts → categoryInventory-DLDU-RSw.d.ts} +1 -1
- package/dist/{categoryInventory-BI3jJaqD.d.cts → categoryInventory-DZapeGK6.d.cts} +1 -1
- package/dist/chunk-6JWYLLWU.js +1 -0
- package/dist/chunk-JBGLFOJO.js +1 -0
- package/dist/chunk-WZ6ZNPNT.js +1 -0
- package/dist/{chunk-VI3IZS2B.js → chunk-YYRUKI7A.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +27 -6
- package/dist/core/chart-ops/index.d.ts +27 -6
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +4 -4
- package/dist/core/inventory/index.d.ts +4 -4
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.d.cts +4 -4
- package/dist/core/layout/index.d.ts +4 -4
- package/dist/core/quality/index.d.cts +3 -3
- package/dist/core/quality/index.d.ts +3 -3
- package/dist/core/render-assets/index.cjs +1 -1
- package/dist/core/render-assets/index.d.cts +1 -1
- package/dist/core/render-assets/index.d.ts +1 -1
- package/dist/core/render-assets/index.js +1 -1
- package/dist/core/seatConfidence.cjs +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/core/sections/index.js +1 -1
- package/dist/{eventConfigurations-DImP8Cd6.d.ts → eventConfigurations-C_dst7Ro.d.cts} +3 -1
- package/dist/{eventConfigurations-YqyHnreh.d.cts → eventConfigurations-kZpADDdx.d.ts} +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -1
- package/dist/{labeling-lXzjJrgV.d.cts → labeling-B07AFOvn.d.cts} +1 -1
- package/dist/{labeling-Cb7ZwhoO.d.ts → labeling-Br0U7E-5.d.ts} +1 -1
- package/dist/{layout-cZ3VfeJR.d.cts → layout-BjWtKYJY.d.cts} +3 -3
- package/dist/{layout-ByBMw1t7.d.ts → layout-pMOP6qgP.d.ts} +3 -3
- package/dist/{renderedQuality-BJKHot_g.d.ts → renderedQuality-CBmIp6_6.d.ts} +1 -1
- package/dist/{renderedQuality-6ta0nSPm.d.cts → renderedQuality-DoRJqHmW.d.cts} +1 -1
- package/dist/{renderer-B9GavToM.d.ts → renderer-BpeegL9d.d.ts} +1 -1
- package/dist/{renderer-C9BLd1g2.d.cts → renderer-Dg76Jprw.d.cts} +1 -1
- package/dist/{sections-ND5PRE4j.d.cts → sections-BjzyfqGZ.d.cts} +1 -1
- package/dist/{sections-BvZ1cQkD.d.ts → sections-DCRfHaw4.d.ts} +1 -1
- package/dist/{segmentedRowModel-CLKP-2ca.d.ts → segmentedRowModel-DQggl3UO.d.ts} +1 -1
- package/dist/{segmentedRowModel-BB9MPufB.d.cts → segmentedRowModel-jfYcGWPd.d.cts} +1 -1
- package/dist/{ticketRestrictions-DUQ8wHjG.d.ts → ticketRestrictions-KwkFXVnM.d.ts} +2 -2
- package/dist/{ticketRestrictions-CjV47RNG.d.cts → ticketRestrictions-NNo-tPmw.d.cts} +2 -2
- package/dist/{types-hv6QjPRV.d.cts → types-BjTzKc2D.d.cts} +49 -2
- package/dist/{types-hv6QjPRV.d.ts → types-BjTzKc2D.d.ts} +49 -2
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +52 -33
- package/dist/view3d/index.d.cts +15 -3
- package/dist/view3d/index.d.ts +15 -3
- package/dist/view3d/index.js +50 -31
- package/package.json +5 -2
- package/dist/chunk-3TAVIEVO.js +0 -1
- package/dist/chunk-BTW7IGNT.js +0 -1
- package/dist/chunk-DNGP2HDT.js +0 -1
package/dist/view3d/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{a as Hn,c as Un,d as Yn}from"../chunk-BV6FHURE.js";import{c as kn}from"../chunk-3TAVIEVO.js";import{d as Gn}from"../chunk-T2LWVOQ3.js";import{e as Dn,l as Ge,n as st,o as zn,q as Pt}from"../chunk-VI3IZS2B.js";import{e as Vn,k as Nn}from"../chunk-UL5OIGIF.js";import{W as ke,X as _e,ea as St,ga as Ln,ha as wt,ja as Bn,l as _n,m as it,va as Qt}from"../chunk-I6DNJFRF.js";import{d as Q,k as On,x as pe,z as at}from"../chunk-CXF32VPG.js";import"../chunk-CRCGO52K.js";import{Renderer as Yr}from"ogl";var ye=["available","held","sold","selected","dimmed"];function ct(t){let e=ye.indexOf(t);return e<0?0:e}var Xn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Wn(t){let e=.2126*t[0]+.7152*t[1]+.0722*t[2],n=.42,r=.62;return[(e+(t[0]-e)*n)*r,(e+(t[1]-e)*n)*r,(e+(t[2]-e)*n)*r]}var $t={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},He={top:[.05,.06,.08],bottom:[.1,.12,.15]};function fe(t,e){return[Math.min(1,t[0]*e),Math.min(1,t[1]*e),Math.min(1,t[2]*e)]}function Xr(){let t=typeof window<"u"&&window.devicePixelRatio||1,e=navigator.deviceMemory,n=typeof e=="number"&&e<=4?1.5:2;return Math.min(t,n)}var Ct=class{constructor(e,n){this.clearRgb=[0,0,0];this.container=e,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Yr({canvas:this.canvas,dpr:Xr(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[He.top[0],He.top[1],He.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Camera as Wr,Vec3 as Jt}from"ogl";var ue=Math.PI/180,en=15*ue,tn=80*ue,Ze=.12,jn=35,Kn=1.25,At=class{constructor(e,n,r,o){this.fovY=jn;this.target=new Jt;this.azimuth=-30*ue;this.polar=55*ue;this.distance=10;this.azT=-30*ue;this.polT=55*ue;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new Jt;this.panAnchor=new Jt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Wr(e,{fov:jn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(en,Math.min(tn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*ue;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(en,Math.min(tn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,r=0;for(let o of e)n+=o.x,r+=o.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*ue/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),p=-i*l,m=-a*l;this.targetT.x+=(-e*s+n*p)*o,this.targetT.z+=(-e*c+n*m)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(o-e,Math.min(o+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,o=!1,i){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5;let a=Math.max(1,e.radius),s=this.fovY*ue/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*ue,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*ue;let u=this.fitDistance(e,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??Kn)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*ue,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){this.camera.perspective({aspect:e})}frameSoft(e,n,r=!1,o){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*ue/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*ue;let c=this.fitDistance(e,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Kn))}fitDistance(e,n,r,o,i){let a=Math.max(1,e.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=e.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),p=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(p)>.999)return s;let d=-m,h=u,f=Math.hypot(d,h);d/=f,h/=f;let x=-h*p,y=h*u-d*m,b=d*p,M=Math.tan(r),C=Math.tan(n),P=1;for(let g=0;g<8;g++){let T=(g&1?c.max[0]:c.min[0])-e.center[0],E=(g&2?c.max[1]:c.min[1])-e.center[1],L=(g&4?c.max[2]:c.min[2])-e.center[2],G=T*u+E*p+L*m,N=Math.abs(T*d+L*h),v=Math.abs(T*x+E*y+L*b);P=Math.max(P,N/M-G,v/C-G)}return Math.min(s,Math.max(P,a*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],o=this.camera.position.z-e.center[2],i=Math.hypot(n,r,o),a=Math.max(1,e.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=e*Ze,this.polar+=n*Ze,this.distance+=r*Ze,this.target.x+=o*Ze,this.target.y+=i*Ze,this.target.z+=a*Ze,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let e=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(e,n,r)||1,i=Math.max(en,Math.min(tn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Rt=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var Qe=2.5,jr=1.15,lt=6,$e=10,qn=6,Zn=9.5,Qn=.9,$n=2.2,nn=30,on=4,It=8192;var os=$e+on;function Jn(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Qe};let o=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:Qe+o*(jr-Qe)}}function eo(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function to(t,e,n,r,o){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=e/(n*i)*(o/2);return Math.PI*a*a/t>=64}import Kr from"earcut";import qr from"polygon-clipping";var R=ke,Zr=.002;function Qr(t,e,n){let r=Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2]),o=Math.hypot(n[0]-e[0],n[1]-e[1],n[2]-e[2]),i=Math.hypot(t[0]-n[0],t[1]-n[1],t[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<Zr}var Ue=class{constructor(e=16384){this.len=0;this.buf=new Float32Array(e)}push3(e,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=e,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(e){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=e}grow(e){let n=this.buf.length*2;for(;n<e;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Et=class{constructor(){this.pos=new Ue;this.nor=new Ue;this.col=new Ue;this.flr=new Ue;this.mat=new Ue;this.currentFloor=0;this.currentMaterial=0}setFloor(e){this.currentFloor=e}setMaterial(e){this.currentMaterial=e}tri(e,n,r,o,i,a=i,s=i){Qr(e,n,r)||(this.pos.push3(e[0],e[1],e[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(e,n,r,o,i,a,s,c=s,l=s){[...e,...n,...r].every(Number.isFinite)&&(this.pos.push3(e[0],e[1],e[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function $r(t,e,n){let r=e[0]-t[0],o=e[1]-t[1],i=e[2]-t[2],a=n[0]-t[0],s=n[1]-t[1],c=n[2]-t[2],l=o*c-i*s,u=i*a-r*c,p=r*s-o*a,m=Math.hypot(l,u,p)||1;return l/=m,u/=m,p/=m,[l,u,p]}function Jr(t,e){let n=[...t],r=[];for(let a of t)r.push(a.x,a.y);let o=[];if(e){for(let a of e)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=Kr(r,o.length?o:void 0,2);return{pts:n,tris:i}}function rn(t){return Ge(t)<0?[...t].reverse():t}var ei=3;function ti(t,e,n,r){let o=r(t),i=r(e),a=r(n),s=(d,h,f,x)=>Math.abs(r({x:(d.x+h.x)/2,y:(d.y+h.y)/2})-(f+x)/2),c=(t.x+e.x+n.x)/3,l=(t.y+e.y+n.y)/3,u=(o+i+a)/3,p=Math.max(s(t,e,o,i),s(e,n,i,a),s(n,t,a,o),Math.abs(r({x:c,y:l})-u)),m=(d,h,f)=>{let x=Math.abs(r({x:(d+c)/2,y:(h+l)/2})-(f+u)/2);x>p&&(p=x)};return m((t.x+e.x)/2,(t.y+e.y)/2,(o+i)/2),m((e.x+n.x)/2,(e.y+n.y)/2,(i+a)/2),m((n.x+t.x)/2,(n.y+t.y)/2,(a+o)/2),p}function ut(t,e,n,r,o){if(o<=0)return ti(t,e,n,r);let i={x:(t.x+e.x)/2,y:(t.y+e.y)/2},a={x:(e.x+n.x)/2,y:(e.y+n.y)/2},s={x:(n.x+t.x)/2,y:(n.y+t.y)/2};return Math.max(ut(t,i,s,r,o-1),ut(i,e,a,r,o-1),ut(s,a,n,r,o-1),ut(i,a,s,r,o-1))}function mt(t,e,n,r,o,i,a,s){if(a>0){let m={x:(e.x+n.x)/2,y:(e.y+n.y)/2},d={x:(n.x+r.x)/2,y:(n.y+r.y)/2},h={x:(r.x+e.x)/2,y:(r.y+e.y)/2};mt(t,e,m,h,o,i,a-1,s),mt(t,m,n,d,o,i,a-1,s),mt(t,h,d,r,o,i,a-1,s),mt(t,m,d,h,o,i,a-1,s);return}let c=[e.x*R,o(e),e.y*R],l=[n.x*R,o(n),n.y*R],u=[r.x*R,o(r),r.y*R];if(s){t.triN(c,l,u,s(e),s(n),s(r),i);return}let p=$r(c,l,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),t.tri(c,l,u,p,i)}var ni=8;function no(t,e,n){if(!Number.isFinite(n))return t;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=e(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,l-1),o(u,a,p,c,l-1);return}}r.push(i)};for(let i=0;i<t.length;i++){let a=t[i],s=t[(i+1)%t.length];o(a,s,e(a),e(s),ni)}return r}function Ft(t,e){if(t.length<3)return t;let n=[];for(let o of t){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<e||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<e;)n.pop();if(n.length<3)return t;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>e&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<e||r.push(a)}return r.length>=3?r:n}var Tt=.001*_e*.1;function ie(t,e,n,r,o,i,a,s,c=1/0,l){if(!e||e.length<3||(c===void 0&&(c=1/0),Math.abs(Ge(e))<1e-4))return;let u=Ft(no(Ft(rn(e),Tt),r,c),Tt),p=n?.map(g=>Ft(no(Ft(rn(g),Tt),r,c),Tt)).filter(g=>g.length>=3&&Math.abs(Ge(g))>=1e-4),{pts:m,tris:d}=Jr(u,p),h=[i[0]*s.top,i[1]*s.top,i[2]*s.top],f=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],x=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],b=0;if(Number.isFinite(c))for(;b<ei;b++){let g=0;for(let T=0;T<d.length;T+=3){let E=ut(m[d[T]],m[d[T+1]],m[d[T+2]],r,b);E>g&&(g=E)}if(g<=c)break}for(let g=0;g<d.length;g+=3){let T=m[d[g]],E=m[d[g+1]],L=m[d[g+2]];mt(t,T,E,L,r,h,b,l);let G=[T.x*R,o,T.y*R],N=[E.x*R,o,E.y*R],v=[L.x*R,o,L.y*R];t.tri(G,v,N,[0,-1,0],f)}let M=g=>{if(b<=0)return g;let T=1<<b,E=[];for(let L=0;L<g.length;L++){let G=g[L],N=g[(L+1)%g.length];for(let v=0;v<T;v++){let A=v/T;E.push({x:G.x+(N.x-G.x)*A,y:G.y+(N.y-G.y)*A})}}return E},C=_n(u),P=[{ring:M(u),flip:!1}];if(p)for(let g of p)g.length>=3&&P.push({ring:M(g),flip:!0});for(let{ring:g,flip:T}of P)for(let E=0;E<g.length;E++){let L=g[E],G=g[(E+1)%g.length],N=(G.x-L.x)*R,A=(G.y-L.y)*R,F=-N,w=Math.hypot(A,F)||1;A/=w,F/=w;let _=(L.x+G.x)/2-C.x,U=(L.y+G.y)/2-C.y,I=A*_+F*U;T&&(I=-I),I<0&&(A=-A,F=-F);let S=[A,0,F],D=[L.x*R,r(L),L.y*R],H=[G.x*R,r(G),G.y*R],V=[L.x*R,o,L.y*R],z=[G.x*R,o,G.y*R];t.tri(D,H,z,S,x,x,y),t.tri(D,z,V,S,x,y,y)}}function oo(t){let e=0;for(let c of t)e+=c.count;let n=new Float32Array(e*3),r=new Float32Array(e*3),o=new Float32Array(e*3),i=new Float32Array(e),a=new Float32Array(e),s=0;for(let c of t)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:e}}function Dt(t,e,n=2.5){if(e<=0||t.length<3)return t;let r=rn(t),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,p=l.y-c.y,m=Math.hypot(u,p)||1;i.push({x:p/m,y:-u/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],p=l.x+u.x,m=l.y+u.y,d=Math.hypot(p,m),h=()=>{a.push([c.x+l.x*e,c.y+l.y*e]),a.push([c.x+u.x*e,c.y+u.y*e])};if(d<1e-9){h();continue}p/=d,m/=d;let f=p*l.x+m*l.y,x=1/Math.max(f,1e-6);if(!Number.isFinite(x)||x>n){h();continue}a.push([c.x+p*e*x,c.y+m*e*x])}if(a.length<3)return t;try{let s=qr.union([[...a,a[0]]]),c=null,l=-1/0;for(let p of s){let m=Math.abs(Ge(p[0].map(([d,h])=>({x:d,y:h}))));m>l&&(l=m,c=p[0])}if(!c)return t;let u=c.map(([p,m])=>({x:p,y:m}));if(u.length>1){let p=u[0],m=u[u.length-1];Math.abs(p.x-m.x)<1e-9&&Math.abs(p.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:t}catch{return t}}function kt(t,e,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:t+n*Math.cos(s),y:e+r*Math.sin(s)})}return i}function dt(t,e,n,r){return[{x:t,y:e},{x:t+n,y:e},{x:t+n,y:e+r},{x:t,y:e+r}]}var te={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},oi=.44,ri=.15,ii=.3,ai=.24;function ro(t){return t===void 0||!Number.isFinite(t)||t<=0?ai:Math.min(ii,Math.max(ri,t*oi))}var an=.21,si=.05,sn=.45,_t=sn+si,ci=[{part:te.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:te.pad,min:[-1,.36,-.95],max:[1,sn,1]},{part:te.back,min:[-1,_t,-1],max:[1,.92,-.72]},{part:te.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:te.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:te.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:te.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:te.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:te.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:te.leg,min:[.62,0,.48],max:[.82,.37,.7]}],li=[{part:te.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:te.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:te.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:te.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:te.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ui=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function io(){let t=[],e=[],n=[],r=[],o=(w,_,U)=>{let I=n.length,[S,D,H]=w,V=[D[0]-S[0],D[1]-S[1],D[2]-S[2]],z=[H[0]-S[0],H[1]-S[1],H[2]-S[2]],O=V[1]*z[2]-V[2]*z[1],W=V[2]*z[0]-V[0]*z[2],Y=V[0]*z[1]-V[1]*z[0],K=Math.hypot(O,W,Y);K>1e-9?(O/=K,W/=K,Y/=K):[O,W,Y]=_,O*_[0]+W*_[1]+Y*_[2]<0&&(O=-O,W=-W,Y=-Y);for(let q of w)t.push(...q),e.push(O,W,Y),n.push(U);r.push(I,I+1,I+2,I,I+2,I+3)},i=w=>{for(let _ of ui){let U=_.c.map(I=>I.map((S,D)=>S?w.max[D]:w.min[D]));o(U,_.n,w.part)}};for(let w of ci)i(w);for(let w of li)i(w);let a=sn,s=1.08,c=.47,l=.69,u=-.55,p=.08,m=-.48,d=.01,h=[-c,a,u],f=[c,a,u],x=[-c,a,p],y=[c,a,p],b=[-l,s,m],M=[l,s,m],C=[-l,s,d],P=[l,s,d];o([f,M,P,y],[1,0,0],te.body),o([x,C,b,h],[-1,0,0],te.body),o([C,P,M,b],[0,1,0],te.body),o([h,f,y,x],[0,-1,0],te.body),o([y,P,C,x],[0,0,1],te.body),o([h,b,M,f],[0,0,-1],te.body);let g=10,T=8,E=[0,1.205,-.23],L=[.42,.115,.38],G=n.length;for(let w=0;w<=T;w++){let _=Math.PI*w/T,U=Math.cos(_),I=Math.sin(_);for(let S=0;S<=g;S++){let D=Math.PI*2*S/g,H=I*Math.cos(D),V=I*Math.sin(D);t.push(E[0]+L[0]*H,E[1]+L[1]*U,E[2]+L[2]*V);let z=H/L[0],O=U/L[1],W=V/L[2],Y=Math.hypot(z,O,W)||1;z/=Y,O/=Y,W/=Y,e.push(z,O,W),n.push(te.head)}}for(let w=0;w<T;w++)for(let _=0;_<g;_++){let U=G+w*(g+1)+_,I=U+g+1;r.push(U,I,U+1,U+1,I,I+1)}let N=new Float32Array(t),v=new Float32Array(e),A=new Float32Array(n),F=new Uint16Array(r);return{position:N,normal:v,part:A,index:F,vertexCount:n.length,indexCount:r.length}}function ao(t,e,n,r){let o=new Float32Array(e),i=l=>t[l*3],a=l=>t[l*3+2],s=0,c=(l,u)=>{let p=u-l;for(let m=l;m<u;m++){let[d,h]=r(m),f=d-i(m),x=h-a(m);if(p>=2){let y=Math.max(l,m-1),b=Math.min(u-1,m+1),M=i(b)-i(y),C=a(b)-a(y),P=Math.hypot(M,C);if(P>1e-6){let g=-C/P,T=M/P;g*f+T*x<0&&(g=-g,T=-T),f=g,x=T}}o[m]=f===0&&x===0?0:Math.atan2(f,x)}};for(let l=1;l<=e;l++)(l===e||n(l)!==n(s))&&(c(s,l),s=l);return o}var Ce=.22;function so(t,e){let n=ye[t];if(n!=="sold"&&n!=="held")return-1;let r=(e+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var mi=.42;function di(t){let e=t.length,n=new Float64Array(e);if(e<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let h of t)h.x<r&&(r=h.x),h.y<o&&(o=h.y),h.x>i&&(i=h.x),h.y>a&&(a=h.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/e),1e-6),u=Math.max(1,Math.ceil(s/l)+1),p=Math.max(1,Math.ceil(c/l)+1),m=new Map,d=(h,f)=>{let x=Math.min(u-1,Math.max(0,Math.floor((h-r)/l)));return Math.min(p-1,Math.max(0,Math.floor((f-o)/l)))*u+x};for(let h=0;h<e;h++){let f=d(t[h].x,t[h].y),x=m.get(f);x?x.push(h):m.set(f,[h])}for(let h=0;h<e;h++){let f=t[h],x=Math.min(u-1,Math.max(0,Math.floor((f.x-r)/l))),y=Math.min(p-1,Math.max(0,Math.floor((f.y-o)/l))),b=1/0;for(let M=1;M<=4;M++){for(let C=y-M;C<=y+M;C++)if(!(C<0||C>=p))for(let P=x-M;P<=x+M;P++){if(P<0||P>=u||M>1&&Math.abs(C-y)<M&&Math.abs(P-x)<M)continue;let g=m.get(C*u+P);if(g)for(let T of g){if(T===h)continue;let E=Math.hypot(t[T].x-f.x,t[T].y-f.y);E<b&&(b=E)}}if(Number.isFinite(b)&&b<=M*l)break}n[h]=b}return n}function hi(t){let e=t.eyeHeightM;return Number.isFinite(e)?Math.max(0,e-St):0}function co(t,e,n,r,o,i){let a=t.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),d=new Float32Array(a),h=new Float32Array(a*3),f=new Map,x=di(t);for(let y=0;y<a;y++){let b=t[y],C=(n?.seatPitchU(y)??x[y])*R;u[y]=Number.isFinite(C)?Math.max(.06,Math.min(Ce,C*mi)):Ce,p[y]=ro(Number.isFinite(C)?C:void 0);let P=Nn(b.glyph,{seatGlyph:i?.get(b.categoryKey)});m[y]=Vn.indexOf(P),d[y]=b.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=b.x*R,s[y*3+1]=n?n.seatDeckY(y):hi(b),s[y*3+2]=b.y*R,c[y]=ct(e?e(b):"available");let g=Q(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=g[0],l[y*3+1]=g[1],l[y*3+2]=g[2],b.accessibility?.length){let T=Q(Dn(b.accessibility));T&&(h[y*3]=T[0],h[y*3+1]=T[1],h[y*3+2]=T[2])}f.set(b.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:h,idToIndex:f,iChairWidth:p,iGlyph:m,iPhysicalSeat:d,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var pi=64;function cn(t,e){let n=[];for(let a of e){let s=t.idToIndex.get(a.seatId);if(s===void 0)continue;let c=ct(a.state);t.iState[s]!==c&&(t.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+pi){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var fi=.15,bi=.9,yi=1.76,xi=.7,gi=1.6;function vi(){return{background:{top:[...He.top],bottom:[...He.bottom]},structure:$t,seatStates:{...Xn},seatScale:1}}function lo(t){let e=vi();if(!t)return e;let n=Q(t.background);if(n){e.background={top:fe(n,bi),bottom:fe(n,yi)};let i={};for(let[a,s]of Object.entries($t))i[a]=pe(s,n,fi);e.structure=i}let r=Q(t.selectionColor)??Q(t.accent);r&&(e.seatStates={...e.seatStates,selected:r});let o=t.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(e.seatScale=Math.min(gi,Math.max(xi,o))),e}function uo(t,e){let n=[];for(let r of e)n.push(...t.seatStates[r]);return n}import fo from"polygon-clipping";import Mi from"earcut";var Si=.58,mo=.01,be=Ce*1.5*_e,wi=.5,Pi=.6;function Ci(t,e){let n=t.length,r=[];for(let a=0;a<n;a++){let s=t[Math.max(0,a-1)],c=t[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,p=Math.hypot(l,u);if(p<1e-9){r.push([0,0]);continue}l/=p,u/=p,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(t[a].x-e.x)*r[a][0]+(t[a].y-e.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Ai(t,e){if(t.length<2||e<=0)return[...t];let n=[...t],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*e,y:n[0].y+o.y*e}),n.push({x:n[n.length-1].x+i.x*e,y:n[n.length-1].y+i.y*e}),n}var ho=Math.PI/12;function Ri(t){if(t.length<3)return[...t];let e=[...t].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(e),...r([...e].reverse())];return o.length>=3?o:[...t]}function bo(t,e){if(!t.length||!(e>0))return[];let n=Ri(t),r=(s,c,l,u)=>{let p=l-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let m=Math.max(1,Math.ceil(p/ho)),d=e/Math.cos(p/m/2);for(let h=0;h<=m;h++){let f=c+p*h/m;u.push({x:s.x+Math.cos(f)*d,y:s.y+Math.sin(f)*d})}};if(n.length<3){let s=0,c=0;for(let d of n)s+=d.x,c+=d.y;s/=n.length||1,c/=n.length||1;let l=0;for(let d of n)l=Math.max(l,Math.hypot(d.x-s,d.y-c));let u=[],p=Math.max(3,Math.ceil(Math.PI*2/ho)),m=(l+e)/Math.cos(Math.PI/p);for(let d=0;d<p;d++){let h=d/p*Math.PI*2;u.push({x:s+Math.cos(h)*m,y:c+Math.sin(h)*m})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Mo(a)}function Ii(t,e,n){if(t.length===1)return Math.hypot(e-t[0].x,n-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let i=t[o],a=t[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((e-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(e-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Lt(t){let e=t.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<t.length;o++){let i=n(t[o].pts),a=[],s=1/0,c=null;for(let u of i){let p=1/0;for(let m=0;m<t.length;m++){if(m===o||Math.abs(t[m].y-t[o].y)<.001)continue;let d=e[m],h=Math.hypot(u.x-d.cx,u.y-d.cy)-d.rad;if(h>=p&&h>=s)continue;let f=Ii(t[m].pts,u.x,u.y);f<p&&(p=f),t[m].depth<t[o].depth&&f<s&&(s=f,c=t[m].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function yo(t,e,n,r){let o=t[e],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,m=u.y-r.y,d=Math.hypot(p,m)||1;p/=d,m/=d;let h=Math.max(n[e].pitch,.001)*.5;return[{x:u.x+m*h,y:u.y-p*h},{x:u.x-m*h,y:u.y+p*h}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,l=Ai(i,Math.max(c*Pi,be));return{pts:l,nrm:Ci(l,r),front:Math.max(n[e].pitch*Si,be),back:Math.max(n[e].pitch*wi,be)}}var Je=1.5,xo=.3;function ln(t,e){if(t.length<3)return t;let n=t[0],r=t[t.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let p=1;p<t.length-1;p++){let m=t[p],d=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);d>s&&(s=d,c=p)}if(s<=e||c<0)return[n,r];let l=ln(t.slice(0,c+1),e),u=ln(t.slice(c),e);return[...l.slice(0,-1),...u]}function go(t,e){if(t.length<4)return t;let n=ln([...t,t[0]],e);return n.pop(),n.length>=3?n:t}function vo(t,e,n){if(t.length<2)return[];let r=n??Lt(t),o=new Map;for(let a=0;a<t.length;a++){let s=o.get(t[a].blockId);s?s.push(a):o.set(t[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let b of a){let M=t[b].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:t[b].y}):s.push(b)}if(!s.length)continue;s.sort((b,M)=>t[b].depth-t[M].depth);let l=s.map(b=>yo(t,b,r,e)).filter(b=>b!==null);if(!l.length)continue;let u=(b,M)=>({x:b.pts[M].x-b.nrm[M][0]*(b.front+Je),y:b.pts[M].y-b.nrm[M][1]*(b.front+Je)}),p=(b,M)=>({x:b.pts[M].x+b.nrm[M][0]*(b.back+Je),y:b.pts[M].y+b.nrm[M][1]*(b.back+Je)}),m=l[0],d=l[l.length-1],h=[];for(let b=0;b<m.pts.length;b++)h.push(u(m,b));for(let b of l)h.push(p(b,b.pts.length-1));for(let b=d.pts.length-1;b>=0;b--)h.push(p(d,b));for(let b=l.length-1;b>=0;b--)h.push(u(l[b],0));let f=Mo(h),x=1/0;for(let b of s)t[b].y<x&&(x=t[b].y);if(!Number.isFinite(x))continue;if(f.length>=3&&Math.abs(Ge(f))>1e-6&&l.every(b=>{let M=b.pts[Math.floor(b.pts.length/2)];return st(f,M.x,M.y)})){i.push({outline:go(f,xo),holes:[],topY:x});continue}for(let b of Fi(l))i.push({outline:b,holes:[],topY:x})}return i}function Fi(t){let e=[];for(let n of t){let r=[],o=[],i=n.front+Je,a=n.back+Je;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),e.push([s]))}if(!e.length)return[];try{let n=fo.union(e[0],...e.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(go(i,xo))}return r}catch{return[]}}function Mo(t){let e=[];for(let n of t){let r=e[e.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||e.push(n)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<1e-9;)e.pop();return e}var un=class{constructor(e){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=e;for(let n of e)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(e){for(let n of e)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of e)if(!st(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function po(t,e,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let p=1;p+1<r.length;p++){let m=r[p],d=r[p+1];t.tri([u.x*R,o,u.y*R],[m.x*R,o,m.y*R],[d.x*R,o,d.y*R],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=fo.intersection([a],e)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],p=[],m=[];for(let h=0;h<u.length-1;h++)p.push(u[h][0],u[h][1]),m.push([u[h][0],u[h][1]]);if(m.length<3)continue;let d=Mi(p,void 0,2);for(let h=0;h<d.length;h+=3){let f=m[d[h]],x=m[d[h+1]],y=m[d[h+2]];t.tri([f[0]*R,o,f[1]*R],[x[0]*R,o,x[1]*R],[y[0]*R,o,y[1]*R],c,i)}}}function So(t,e,n,r,o,i,a){if(e.length<2)return;let s=a??Lt(e),c=[0,1,0],l=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new un([[...i]]):null,p=d=>{t.setMaterial(2),d(),t.setMaterial(0)},m=d=>{t.setMaterial(3),d(),t.setMaterial(0)};for(let d=0;d<e.length;d++){let h=e[d];if(h.patch&&h.patch.length>=3){let P=[...h.patch],g=s[d].belowY??r;if(m(()=>{if(l&&u)po(t,l,u,P,h.y,o.tread);else{let T=P[0];for(let E=1;E+1<P.length;E++){let L=P[E],G=P[E+1];t.tri([T.x*R,h.y,T.y*R],[L.x*R,h.y,L.y*R],[G.x*R,h.y,G.y*R],c,o.tread)}}}),h.y>g+mo){let T=0,E=0;for(let L of P)T+=L.x,E+=L.y;T/=P.length,E/=P.length,p(()=>{for(let L=0;L<P.length;L++){let G=P[L],N=P[(L+1)%P.length],v=N.x-G.x,A=N.y-G.y,F=Math.hypot(v,A);if(F<1e-6)continue;let w=A/F,_=-v/F;(G.x-T)*w+(G.y-E)*_<0&&(w=-w,_=-_);let U=[w,0,_],I=[G.x*R,h.y,G.y*R],S=[N.x*R,h.y,N.y*R],D=[G.x*R,g,G.y*R],H=[N.x*R,g,N.y*R];t.tri(I,S,H,U,o.riser),t.tri(I,H,D,U,o.riser)}})}continue}let f=yo(e,d,s,n);if(!f)continue;let{pts:x,nrm:y,front:b,back:M}=f,C=s[d].belowY??r;for(let P=0;P+1<x.length;P++){let g=x[P],T=x[P+1],E=y[P],L=y[P+1];if(Math.hypot(T.x-g.x,T.y-g.y)<1e-6||E[0]===0&&E[1]===0||L[0]===0&&L[1]===0)continue;let G=[(g.x-E[0]*b)*R,h.y,(g.y-E[1]*b)*R],N=[(T.x-L[0]*b)*R,h.y,(T.y-L[1]*b)*R],v=[(g.x+E[0]*M)*R,h.y,(g.y+E[1]*M)*R],A=[(T.x+L[0]*M)*R,h.y,(T.y+L[1]*M)*R];if(m(()=>{l&&u?po(t,l,u,[{x:g.x-E[0]*b,y:g.y-E[1]*b},{x:T.x-L[0]*b,y:T.y-L[1]*b},{x:T.x+L[0]*M,y:T.y+L[1]*M},{x:g.x+E[0]*M,y:g.y+E[1]*M}],h.y,o.tread):(t.tri(G,N,A,c,o.tread),t.tri(G,A,v,c,o.tread))}),h.y>C+mo){let F=[G[0],C,G[2]],w=[N[0],C,N[2]],_=[-E[0],0,-E[1]];p(()=>{t.tri(G,N,w,_,o.riser),t.tri(G,w,F,_,o.riser)})}}}}import Po from"polygon-clipping";function Ti(t,e){let n=t.eventConfigurationIds;return!n?.length||!!e&&n.includes(e)}function wo(t,e){return t.filter(n=>n.type!=="shape"||Ti(n,e))}function Co(t,e){let n=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:wo(r.objects,e),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:wo(t.objects,e),focal:n,baseHeightM:0,index:0}]}var Ei={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function et(t){return zn(t)??Ei}function Ao(t,e){let n=Dt(t.outline,be),r=et(n),o=e.filter(a=>a!==t&&a.outline&&a.outline.length>=3&&Pt(r,et(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Po.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Ro(t,e){if(!e.length)return t;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=e.map(i=>[n(i)]),o=[];for(let i of t){let a;try{a=Po.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:t}var Di=.05,Io=.05,ki=.15,mn=25;function Fo(t,e,n){let r=new Map,o=new Array(e.length).fill(null),i=new Float64Array(e.length),a=new Array(e.length).fill(void 0),s=new Array(e.length).fill(void 0),c=new Map,l=[],u=new Set;for(let m=0;m<t.length;m+=1){let d=t[m];for(let h of d.objects){if(h.type==="table"&&u.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let f=Dt(h.outline,be);c.set(h.id,{section:h,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:m,box:et(f),section:h,unit:d,outline:f})}}let p=new Map;for(let m of l){let d=p.get(m.floorIndex);d?d.push(m):p.set(m.floorIndex,[m])}for(let m=0;m<e.length;m++){let d=e[m],h=n?p.get(n[m])??[]:l,f=d.sectionId?h.find(y=>y.id===d.sectionId)??h.find(y=>y.section.logicalSectionId===d.sectionId&&Qt({x:d.x,y:d.y},y.outline,y.section.holes)):void 0,x=f?[f]:h;for(let y of x){if(n&&y.floorIndex!==n[m]||!f&&(d.x<y.box.minX||d.x>y.box.maxX||d.y<y.box.minY||d.y>y.box.maxY||!Qt({x:d.x,y:d.y},y.outline,y.section.holes)))continue;o[m]=y.id;let b=c.get(y.id);b.hasSeats=!0;let M=d.focalPoint??y.unit.focal,C=Math.hypot(d.x-M.x,d.y-M.y);C<b.frontU&&(b.frontU=C),b.seatIndices.push(m);let P=d.rowId||`__seat-${m}`,g=b.rows.get(P);g?g.push({x:d.x,y:d.y}):b.rows.set(P,[{x:d.x,y:d.y}]);break}}for(let[m,d]of c){let h=Ln(d.section,{floorBaseHeightM:d.unit.baseHeightM}),f=d.unit.baseHeightM,x=h.rake>0?Math.tan(h.rake*Math.PI/180):0,y=h.rake<=.01&&h.height<=f+.001,b=d.section.surfaceKind,M=b==="flat"?!0:b==="rakedRows"&&h.rake>.01?!1:y,C=d.hasSeats?Bn(m,e,d.seatIndices,d.unit.focal):{sectionId:m,rows:[],blockCount:0},g=C.rows.length<2?Hn([...d.rows.values()].map(I=>({points:I})),d.unit.focal):null,T=1/0;if(g){if(d.hasSeats)for(let I of d.rows.values())for(let S of I){let D=g.depthAt(S.x,S.y);D<T&&(T=D)}if(!d.hasSeats||!Number.isFinite(T)){T=1/0;for(let I of d.section.outline){let S=g.depthAt(I.x,I.y);S<T&&(T=S)}}}let E=f+Di,L=Math.max(E,h.height),G=I=>{let S=Math.max(0,I-T)*ke,D=Math.min(S*x,mn);return Math.max(E,h.height+D)},N=I=>{let S=Math.max(0,I)*ke,D=Math.min(S*x,mn);return Math.max(E,h.height+D)},v=M?[]:C.rows.map(I=>({pts:I.pts,y:N(I.blockDepth),depth:I.blockDepth,blockId:I.blockId,...u.has(I.id)?{patch:bo(I.pts,be)}:{}})),A=v.length?v[0].y:L,F=v.map(I=>{let S=I.patch&&I.patch.length>=3?I.patch:I.pts,D=0,H=0;for(let O of S)D+=O.x,H+=O.y;let V=S.length||1;D/=V,H/=V;let z=0;for(let O of S){let W=Math.hypot(O.x-D,O.y-H);W>z&&(z=W)}return{cx:D,cy:H,rad:z}}),w=M?()=>L:v.length>=2?(I,S)=>{let D=1/0,H=A;for(let V=0;V<v.length;V++){let z=F[V];if(Math.hypot(I-z.cx,S-z.cy)-z.rad>=D)continue;let O=v[V].patch,W=O&&O.length>=3?st(O,I,S)?0:wt(O,I,S):wt(v[V].pts,I,S);W<D&&(D=W,H=v[V].y)}return H}:(I,S)=>g?G(g.depthAt(I,S)):L,_=[0,1,0],U=v.length>=2||M?()=>_:(I,S)=>{if(!g)return _;let D=g.depthAt(I,S);if(D<=T)return _;let H=(D-T)*ke;if(H*x>=mn||h.height+H*x<=E)return _;let[V,z]=g.gradientAt(I,S);if(V===0&&z===0)return _;let O=1/Math.hypot(x,1);return[-V*x*O,O,-z*x*O]};if(!M)for(let I of C.rows){let S=N(I.blockDepth);for(let D of I.seatIndices)a[D]=S}for(let I of C.rows){let S=[];for(let O=1;O<I.pts.length;O++){let W=Math.hypot(I.pts[O].x-I.pts[O-1].x,I.pts[O].y-I.pts[O-1].y);W>1e-6&&S.push(W)}S.sort((O,W)=>O-W);let D=S.length?S[Math.floor(S.length/2)]:1/0,H=1/0,V=I.pts[Math.floor(I.pts.length/2)];if(V)for(let O of C.rows){if(O===I||O.blockId!==I.blockId)continue;let W=wt(O.pts,V.x,V.y);W>1e-6&&W<H&&(H=W)}let z=Math.min(D,Math.max(H,D*.5));if(Number.isFinite(z)&&z>0)for(let O of I.seatIndices)s[O]=z}r.set(m,{sectionId:m,deckAt:w,normalAt:U,flat:M,bottomY:f,rowLevels:v,landingY:A})}for(let m=0;m<e.length;m++){let d=o[m],h=e[m];if(d){let x=a[m];i[m]=(x??r.get(d).deckAt(h.x,h.y))+ki;continue}let f=h.eyeHeightM;i[m]=Number.isFinite(f)?Math.max(0,f-St):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var re={top:1,wallBottom:.5,bottomCap:.4};function Ae(t,e){if(!t)return e;let n=fe(at(t,.4),.62);return pe(e,n,.72)}function To(t,e){let n=new Map;for(let i of t.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of e){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,u=0;for(let[p,m]of a){let d=Q(n.get(p));d&&(s+=d[0]*m,c+=d[1]*m,l+=d[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Eo(t,e){return Q(t.color)??e.get(t.logicalSectionId??t.id)??null}import _i from"polygon-clipping";function Li(t,e){return t===void 0||e===void 0?!0:Math.abs(t-e)<.001}var Bt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(e,n){let r=e.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=et(e),i=this.rings.filter((c,l)=>Pt(o,this.boxes[l])&&Li(n,this.levels[l])),a=[[r]];if(i.length)try{a=_i.difference([r],...i).map(l=>l.map(u=>u.map(([p,m])=>[p,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Bi(t,e){if(!e)return t;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of t)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=e*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return t.map(p=>{let m=p.x-a,d=p.y-s;return{x:a+m*l-d*u,y:s+m*u+d*l}})}function Ye(t){let e=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(e=t.points),t.kind==="rect"&&t.width&&t.height&&(e=dt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let n=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;e=kt(n,r,t.width/2,t.height/2)}return e?Bi(e,t.rotation):null}function ht(t){let e=t.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=e==="stage"&&Gn(t.stageKind)?{kind:"stage",heightM:.06}:n[e]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var Oi=.08;function Do(t,e){let n=Ye(t),r=ht(t),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of e)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+Oi);return e.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Le(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function ko(t){if(t.length!==4)return t;let e=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),n=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return e>=n?t:[t[1],t[2],t[3],t[0]]}function pt(t,e,n){return[Le(t[0],t[1],e),Le(t[0],t[1],n),Le(t[3],t[2],n),Le(t[3],t[2],e)]}function _o(t,e,n){return[Le(t[0],t[3],e),Le(t[1],t[2],e),Le(t[1],t[2],n),Le(t[0],t[3],n)]}function Re(t,e,n,r,o,i){ie(t,e,void 0,()=>n,r,o,i,re)}var dn=2.4,Vi=.75,Ni=.15;function ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:e,width:n,height:r,rotation:o}=t;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,p])=>({x:e.x+u*a-p*s,y:e.y+u*s+p*a}))}function Lo(t,e,n,r,o){let i=ft(e);i&&ie(t,i,void 0,()=>n+dn,n,Ae(r,o.boothTop),o.boothWall,re)}function hn(t){if(t.shape==="round"){let u=t.radius;return u?kt(t.center.x,t.center.y,u,u,24):null}let{width:e,height:n,rotation:r,center:o}=t;if(!e||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=e/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function Bo(t,e,n,r,o){let i=hn(e);i&&ie(t,i,void 0,()=>n+Vi,n,Ae(r,o.tableTop),o.tableWall,re)}function Oo(t,e,n,r,o,i,a,s){let c=Ye(e);if(!c)return;let l=s?s.kind==="stage":e.role==="stage",u=s?s.kind==="screen":e.role==="screen",p=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:ht(e),m=s?.baseY??n,d=s?.topY??n+r;if(l&&a){let b=1/0,M=-1/0,C=1/0,P=-1/0;for(let g of c)g.x<b&&(b=g.x),g.x>M&&(M=g.x),g.y<C&&(C=g.y),g.y>P&&(P=g.y);a.push({cx:(b+M)/2*R,cz:(C+P)/2*R,y:d,halfX:Math.max((M-b)/2*R,.5),halfZ:Math.max((P-C)/2*R,.5)})}let h=Q(e.fill),f=l&&h?pe(o.stageTop,fe(at(h,.18),.9),.9):Ae(h,l?o.stageTop:o.decorTop),x=u?h:null,y=l?h?pe(o.stageWall,fe(h,.58),.82):o.stageWall:u?x?pe(fe(x,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ae(Q(e.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let b=ko(c);Re(t,pt(b,0,.16),d,m,f,y),Re(t,pt(b,.84,1),d,m,f,y),Re(t,b,d,Math.max(m,d-.35),f,y);return}if(p.kind==="suite"&&c.length===4){let b=c.map((P,g)=>{let T=c[(g+1)%4],E=(P.x+T.x)/2,L=(P.y+T.y)/2;return Math.hypot(E-i.x,L-i.y)}),M=b.indexOf(Math.min(...b)),C=[0,1,2,3].map(P=>c[(M+P)%4]);Re(t,pt(C,0,.08),d,m,f,y),Re(t,pt(C,.92,1),d,m,f,y),Re(t,_o(C,.88,1),d,m,f,y),Re(t,C,d,Math.max(m,d-.18),f,y);return}Re(t,c,d,m,f,y)}function pn(t){let{x:e,y:n,width:r,height:o}=t;if(!r||!o)return null;let i=e+r/2,a=n+o/2,s=(t.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([m,d])=>({x:i+m*c-d*l,y:a+m*l+d*c}))}function zi(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let e=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{e=atob(e)}catch{return null}else try{e=decodeURIComponent(e)}catch{}let n=e.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return Q(r);let i=e.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=Q(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>pe(s,c,1/(l+1)),a[0]):null}function Vo(t,e,n,r){if(e.layer==="foreground")return;let o=pn(e);if(!o)return;let i=n+Ni,a=Ae(zi(e.href),r.decorTop),s=Math.max(0,Math.min(1,e.opacity??1));s<1&&(a=pe(r.ground,a,s)),ie(t,o,void 0,()=>i,n,a,pe(a,r.decorWall,.5),re)}function No(t,e,n,r,o){if(!e.points||e.points.length<3)return;let i=Ae(r,o.gaTop);ie(t,e.points,e.holes,()=>n+.15,n,i,o.gaWall,re)}var Gi=.25,Hi=1.2,Ui=.6,Yi=.45,Xi=2.3,Wi=Math.PI/180;function Xe(t,e,n){let r=n*Wi;return{x:t.x+e*Math.sin(r),y:t.y+e*Math.cos(r)}}function ji(t,e){let n=e.rings[e.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-e.centre.x,s.y-e.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var Ki=24;function qi(t,e,n,r,o,i,a,s){let c=n.binCount,l=Ki,u=ke,p=i+.02,m=[];for(let v=0;v<c;v++){let A=(n.startBin+v+.5)*e.binStepDeg,F=new Float64Array(l+1);for(let w=0;w<=l;w++){let _=r[v]+(o[v]-r[v])*w/l;F[w]=Math.max(p,Yn(e,n,A,_)-Gi)}m.push(F)}let d=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],f=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],x=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(v,A)=>{let F=(n.startBin+v+.5)*e.binStepDeg,w=r[v]+(o[v]-r[v])*A/l,_=Xe(e.centre,w,F);return[_.x*u,m[v][A],_.y*u]};{let v=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let F=!1;for(let _=0;_<c;_++)for(let U=l-1;U>=0;U--)m[_][U]>m[_][U+1]&&(m[_][U]=m[_][U+1],F=!0);let w=n.closed?c:c-1;for(let _=0;_<w;_++){let U=(_+1)%c;for(let I=0;I<=l;I++){let S=m[U][I]-m[_][I];if(Math.abs(S)>1)continue;let D=r[_]+(o[_]-r[_])*I/l,H=r[U]+(o[U]-r[U])*I/l,V=Xe(e.centre,D,(n.startBin+_+.5)*e.binStepDeg),z=Xe(e.centre,H,(n.startBin+U+.5)*e.binStepDeg),O=v*Math.hypot(z.x-V.x,z.y-V.y)*u;S>O?(m[U][I]=m[_][I]+O,F=!0):-S>O&&(m[_][I]=m[U][I]+O,F=!0)}}if(!F)break}}let b=1,M=(v,A)=>{for(let F=0;F<=l;F+=4)if(Math.abs(m[v][F]-m[A][F])>b)return!0;return Math.abs(m[v][l]-m[A][l])>b},C=Math.tan(38*Math.PI/180),P=v=>(o[v]-r[v])/l*u,g=(v,A)=>m[v][A+1]-m[v][A]>C*Math.max(1e-6,P(v)),T=(v,A)=>{let F=n.closed?(v-1+c)%c:Math.max(0,v-1),w=n.closed?(v+1)%c:Math.min(c-1,v+1);Math.abs(m[F][A]-m[v][A])>b&&(F=v),Math.abs(m[w][A]-m[v][A])>b&&(w=v);let _=Math.max(0,A-1),U=Math.min(l,A+1);_<A&&g(v,_)&&(_=A),U>A&&g(v,A)&&(U=A);let I=y(F,A),S=y(w,A),D=y(v,_),H=y(v,U),V=S[0]-I[0],z=S[1]-I[1],O=S[2]-I[2],W=H[0]-D[0],Y=H[1]-D[1],K=H[2]-D[2],q=z*K-O*Y,ne=O*W-V*K,oe=V*Y-z*W,$=Math.hypot(q,ne,oe);return $>1e-12?(q/=$,ne/=$,oe/=$,ne<0&&(q=-q,ne=-ne,oe=-oe),[q,ne,oe]):[0,1,0]},E=(v,A)=>{let F=[v[0],i,v[2]],w=[A[0],i,A[2]],_=A[0]-v[0],U=A[2]-v[2],I=Math.hypot(_,U);if(!(I>1e-12))return;let S=[U/I,0,-_/I];t.tri(v,A,w,S,f,f,x),t.tri(v,w,F,S,f,x,x)},L=.05*_e,G=v=>o[v]-r[v]<L,N=n.closed?c:c-1;for(let v=0;v<N;v++){let A=(v+1)%c;if(G(v)||G(A))continue;if(M(v,A)){let S=(n.startBin+v+1)*e.binStepDeg,D=(Y,K)=>{let q=(r[v]+r[A])/2,ne=(o[v]+o[A])/2,oe=q+(ne-q)*K/l,$=Xe(e.centre,oe,S);return[$.x*u,m[Y][K],$.y*u]};for(let Y=0;Y<l;Y++){let K=y(v,Y),q=y(v,Y+1),ne=D(v,Y),oe=D(v,Y+1),$=T(v,Y),ae=T(v,Y+1);t.triN(K,ne,oe,$,$,ae,d),t.triN(K,oe,q,$,ae,ae,d);let Oe=y(A,Y),Ve=y(A,Y+1),xe=D(A,Y),Ie=D(A,Y+1),Fe=T(A,Y),ge=T(A,Y+1);t.triN(xe,Oe,Ve,Fe,Fe,ge,d),t.triN(xe,Ve,Ie,Fe,ge,ge,d);let he=D(v,Y),se=D(v,Y+1),Ke=D(A,Y+1),ve=D(A,Y),qe=se[0]-he[0],Me=se[2]-he[2],Te=Math.hypot(qe,Me);if(Te>1e-12){let xt=[Me/Te,0,-qe/Te];t.tri(he,se,Ke,xt,f),t.tri(he,Ke,ve,xt,f)}}let H=y(v,0),V=y(A,0),z=y(A,l),O=y(v,l),W=Y=>[Y[0],i,Y[2]];t.tri(W(H),W(z),W(V),[0,-1,0],h),t.tri(W(H),W(O),W(z),[0,-1,0],h),E(H,V),E(O,z);continue}for(let S=0;S<l;S++){let D=T(v,S),H=T(A,S),V=T(A,S+1),z=T(v,S+1);if(g(v,S)||g(A,S)){let q=(se,Ke)=>{let ve=(n.startBin+se+.5)*e.binStepDeg,qe=r[se]+(o[se]-r[se])*(S+.5)/l,Me=Xe(e.centre,qe,ve);return[Me.x*u,Ke,Me.y*u]},ne=y(v,S),oe=y(A,S),$=q(v,m[v][S]),ae=q(A,m[A][S]);t.triN(ne,oe,ae,D,H,H,d),t.triN(ne,ae,$,D,H,D,d);let Oe=y(A,S+1),Ve=y(v,S+1),xe=q(v,m[v][S+1]),Ie=q(A,m[A][S+1]);t.triN(xe,Ie,Oe,z,V,V,d),t.triN(xe,Oe,Ve,z,V,z,d);let Fe=ae[0]-$[0],ge=ae[2]-$[2],he=Math.hypot(Fe,ge);if(he>1e-12){let se=[-ge/he,0,Fe/he];t.tri($,ae,Ie,se,f),t.tri($,Ie,xe,se,f)}continue}let O=y(v,S),W=y(A,S),Y=y(A,S+1),K=y(v,S+1);t.triN(O,W,Y,D,H,V,d),t.triN(O,Y,K,D,V,z,d)}let F=y(v,0),w=y(A,0),_=y(A,l),U=y(v,l),I=S=>[S[0],i,S[2]];t.tri(I(F),I(_),I(w),[0,-1,0],h),t.tri(I(F),I(U),I(_),[0,-1,0],h),E(F,w),E(U,_)}if(!n.closed)for(let v of[0,c-1])for(let A=0;A<l;A++)E(y(v,A),y(v,A+1))}function zo(t,e,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(e.binCount).fill(-1/0);for(let u of e.rings)for(let p of u.arcs){let m=new Float64Array(p.binCount),d=new Float64Array(p.binCount);for(let f=0;f<p.binCount;f++){let x=(p.startBin+f)%e.binCount,y=Math.max(0,p.innerR[f]-be);m[f]=Math.max(y,a[x]+.001),d[f]=Math.max(m[f]+.001,p.outerR[f]+be)}let h=0;for(let f=0;f<p.binCount;f++){let x=p.topLevelM[f]-r;x>h&&(h=x)}h>=Hi&&qi(t,e,p,m,d,r,o,i);for(let f=0;f<p.binCount;f++){let x=(p.startBin+f)%e.binCount;d[f]>a[x]&&(a[x]=d[f])}}if(ji(n.shapes,e))return;let s=e.rings[e.rings.length-1],c=Ui*_e,l=Yi*_e;for(let u of s.arcs){let p=[],m=[];for(let f=0;f<u.binCount;f++){let x=(u.startBin+f+.5)*e.binStepDeg,y=u.outerR[f]+be+c;p.push(Xe(e.centre,y,x)),m.push(Xe(e.centre,y+l,x))}let d=-1/0;for(let f=0;f<u.binCount;f++)u.topLevelM[f]>d&&(d=u.topLevelM[f]);let h=()=>d+Xi;u.closed?ie(t,m,[p.slice().reverse()],h,r,o.shellTop,o.shellWall,i):ie(t,[...m,...p.slice().reverse()],void 0,h,r,o.shellTop,o.shellWall,i)}}function Go(t,e,n,r,o,i,a,s){if(!e.outline||e.outline.length<3)return;let c=n.baseHeightM,l=Ae(r,s.tierTop);if(!o)return;let u=x=>o.deckAt(x.x,x.y),p=Ao(e,a),m=p[0]??e.outline;if(o.rowLevels.length>=2){let x=Lt(o.rowLevels),y=Ro(vo(o.rowLevels,n.focal,x),p),b=()=>[0,1,0];for(let C of y){let P=Math.max(c,C.topY-.02);for(let g of i.subtract(C.outline,P))ie(t,g,C.holes,()=>P,c,l,s.tierWall,re,void 0,b)}y.length||ie(t,m,e.holes,()=>o.landingY,c,l,s.tierWall,re);let M={tread:[l[0]*re.top,l[1]*re.top,l[2]*re.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let C of p.length?p:[m])So(t,o.rowLevels,n.focal,o.landingY,M,C,x);return}let d=o.flat?1/0:Io,h=x=>o.normalAt(x.x,x.y),f=o.flat?o.landingY:void 0;for(let x of i.subtract(m,f))ie(t,x,e.holes,u,c,l,s.tierWall,re,d,h)}function Zi(t,e,n){let r=new Set;for(let a of t.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<e.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=e[a],u=o.get(s);u||(u=new Map,o.set(s,u));let p=l.rowId||`__seat-${a}`,m=u.get(p);m||(m={pts:[],levelM:0,n:0},u.set(p,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of t.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function Ho(t,e,n,r,o){let i=Zi(e,n,r);if(!i.length)return;let a=Un(i,e.focal);a&&(t.setMaterial(0),zo(t,a,{bottomY:e.baseHeightM,colors:{bandTop:fe(o.tierTop,.8),bandWall:o.tierWall,shellTop:fe(o.tierWall,1.15),shellWall:o.tierWall},ao:re,shapes:e.objects.filter(s=>s.type==="shape")}))}function Uo(t,e,n){return n<0?e>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Yo(t,e){let n=[...t].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(e-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var Qi=1.15,$i=3.25,Ji=4.5,ea=.85,ta=.5,na=.26;function Xo(t,e,n){let r=Math.max(1e-6,e),o=t/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=Qi&&a.add("zone"),o<=(i?$i:Ji)&&(a.add("section"),a.add("ga")),o<=ea&&(a.add("annotation"),a.add("booth")),o<=ta&&a.add("row"),o<=na&&a.add("seat"),a}function Be(t,e,n,r){let o=t,i=e[0],a=e[1],s=e[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/p,d=l/p,h=u/p,f=m>=-1.05&&m<=1.05&&d>=-1.05&&d<=1.05&&h<=1;return{x:(m*.5+.5)*n,y:(1-(d*.5+.5))*r,depth:h,visible:f}}function Wo(t,e,n=e){let r=[],o=[...t].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(fn(i,s,e,n)){a=!0;break}a||r.push(i)}return r}var oa=6;function fn(t,e,n,r){let o=Math.abs(t.screen.x-e.screen.x),i=Math.abs(t.screen.y-e.screen.y),a=t.halfWidth!=null&&e.halfWidth!=null?Math.max(n,t.halfWidth+e.halfWidth+oa):n;return o<a&&i<r}function jo(t,e,n){return t.length*e*.58+(n?14:0)}var bn={row:8,seat:14};function Ko(t,e,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(t.x-n/2,t.y-r/2)/o);return e*(1+1.5*i)}function yn(t,e,n,r,o=[]){let i=[...t].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(fn(s,l,e,n)){c=!0;break}if(!c){for(let l of a)if(fn(s,l,e,n)){c=!0;break}}c||a.push(s)}return a}var ra=6,ia=2.2,qo=.1,aa=.3,sa=1.8,ca=.9,la=.55,ua=6e3;function Zo(t){let{doc:e,units:n,seats:r,surfaces:o,focal:i}=t,a=e.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let l=new Map;for(let u=0;u<r.length;u++){let p=r[u],m=o.seatOwner[u],d=p.zoneId??(m?c.get(m):void 0);if(!d)continue;let h=l.get(d);h||(h={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(d,h)),h.n++,p.x<h.minX&&(h.minX=p.x),p.y<h.minY&&(h.minY=p.y),p.x>h.maxX&&(h.maxX=p.x),p.y>h.maxY&&(h.maxY=p.y),h.sumY+=o.seatDeckY(u)}for(let u of a){let p=l.get(u.id),m=[];for(let[d,h]of c)h===u.id&&m.push(d);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:Q(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]});continue}s.push({id:u.id,label:u.label,color:Q(u.color),sectionIds:m,seatCount:p.n,center:[(p.minX+p.maxX)/2*R,p.sumY/p.n,(p.minY+p.maxY)/2*R],radius:.5*Math.hypot((p.maxX-p.minX)*R,(p.maxY-p.minY)*R)||1,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]})}}return s}function Qo(t){let{doc:e,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=t,l=[],u=[],p=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+ra,m.center[2]],color:e.zones?.find(d=>d.id===m.id)?.color});{let m=new Map,d=new Map;for(let h=0;h<r.length;h++){let f=o.seatOwner[h];if(!f)continue;let x=m.get(f);x||(x={n:0,x:0,y:0,deck:0},m.set(f,x)),x.n++,x.x+=r[h].x,x.y+=r[h].y,x.deck+=o.seatDeckY(h);let y=d.get(f);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},d.set(f,y)),r[h].x<y.minX&&(y.minX=r[h].x),r[h].x>y.maxX&&(y.maxX=r[h].x),r[h].y<y.minY&&(y.minY=r[h].y),r[h].y>y.maxY&&(y.maxY=r[h].y)}for(let h of n)for(let f of h.objects){if(f.type!=="section")continue;let x=m.get(f.id);if(!x||x.n===0)continue;let y=d.get(f.id),b=[x.x/x.n*R,x.deck/x.n,x.y/x.n*R],M=f.displayLabel||f.label||f.id;u.push({id:f.id,floorIndex:h.index,label:M,seatCount:x.n,center:b,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*R),focalWorld:[h.focal.x*R,h.baseHeightM+1.5,h.focal.y*R]});let C=e.floors?.[h.index]?.name?.trim().toLocaleLowerCase();n.length>1&&C===M.trim().toLocaleLowerCase()||l.push({id:`section:${f.id}`,kind:"section",text:M,anchor:[b[0],b[1]+ia,b[2]],floorIndex:h.index})}}{for(let h of n)for(let f of h.objects){if(f.type!=="gaArea")continue;let x=it(f.points);if(!x)continue;let y=f.displayLabel||f.label||f.id;l.push({id:`ga:${f.id}`,kind:"ga",text:f.capacity>0?`${y} \xB7 ${f.capacity.toLocaleString()}`:y,anchor:[x.x*R,h.baseHeightM+sa,x.y*R],floorIndex:h.index})}let m=new Map;for(let h=0;h<r.length;h++){let f=r[h],x=Math.hypot(f.x-c.x,f.y-c.y),y=m.get(f.rowId);(!y||x>y.far)&&m.set(f.rowId,{seat:f,index:h,far:x})}for(let[h,f]of m){let x=f.seat.label?f.seat.label.lastIndexOf("-"):-1,y=x>0?f.seat.label.slice(0,x):h;y&&l.push({id:`row:${h}`,kind:"row",text:y,anchor:[f.seat.x*R,o.seatDeckY(f.index)+ca,f.seat.y*R],floorIndex:a[f.index]})}let d=new Map;for(let h=0;h<r.length;h++){let f=r[h],x=f.label?f.label.lastIndexOf("-"):-1,y=d.get(f.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:x>0?f.label.slice(0,x):f.rowId,sectionId:f.sectionId},d.set(f.rowId,y));let b=h*3,M=i.iPosition[b],C=i.iPosition[b+1],P=i.iPosition[b+2];y.n++,y.x+=M,y.y+=C,y.z+=P,y.minX=Math.min(y.minX,M),y.maxX=Math.max(y.maxX,M),y.minZ=Math.min(y.minZ,P),y.maxZ=Math.max(y.maxZ,P)}for(let[h,f]of d)p.push({id:h,label:f.label,sectionId:f.sectionId,seatCount:f.n,center:[f.x/f.n,f.y/f.n,f.z/f.n],radius:Math.max(.8,Math.hypot(f.maxX-f.minX,f.maxZ-f.minZ)*.5)});if(r.length<=ua)for(let h=0;h<r.length;h++){let f=r[h],x=f.displayLabel||f.label;x&&l.push({id:`seat:${f.id}`,kind:"seat",text:x,anchor:[f.x*R,o.seatDeckY(h)+la,f.y*R],floorIndex:a[h]})}}for(let m of n)for(let d of m.objects)if(d.type==="shape"&&d.role&&["entrance","exit","screen","suite","obstruction"].includes(d.role)){let h=Ye(d),f=h?it(h):null;if(!f||!d.label)continue;l.push({id:`architecture:${d.id}`,kind:"annotation",text:d.label,anchor:[f.x*R,m.baseHeightM+ht(d).heightM+qo,f.y*R],color:d.fill,floorIndex:m.index})}else if(d.type==="text"){if(!d.text)continue;l.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*R,m.baseHeightM+qo,d.position.y*R],color:d.color,rotation:d.rotation,floorIndex:m.index})}else if(d.type==="booth"){let h=ft(d);if(!h)continue;let f=it(h);if(!f)continue;l.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[f.x*R,m.baseHeightM+dn+aa,f.y*R],floorIndex:m.index})}return{labels:l,sections:u,rows:p}}function $o(t,e){if(e.length>1)for(let n of e)t.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Jo(t){let{doc:e,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=t,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let d=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),h=m*3,f=l[d];f.minX=Math.min(f.minX,i.position[h]),f.minY=Math.min(f.minY,i.position[h+1]),f.minZ=Math.min(f.minZ,i.position[h+2]),f.maxX=Math.max(f.maxX,i.position[h]),f.maxY=Math.max(f.maxY,i.position[h+1]),f.maxZ=Math.max(f.maxZ,i.position[h+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let d of n[m].objects)d.type==="section"&&u.set(d.id,m);let p=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let d=o.seatOwner[m],h=(d!==null?u.get(d):void 0)??a[m];if(h===void 0)continue;let f=p[h],x=r[m];f.n++,x.x<f.minX&&(f.minX=x.x),x.y<f.minY&&(f.minY=x.y),x.x>f.maxX&&(f.maxX=x.x),x.y>f.maxY&&(f.maxY=x.y);let y=o.seatDeckY(m);f.sumX+=x.x*R,f.sumDeck+=y,f.sumZ+=x.y*R,f.minDeck=Math.min(f.minDeck,y),f.maxDeck=Math.max(f.maxDeck,y+1.6),s[m]=h}for(let m=0;m<n.length;m++){let d=p[m],h=e.floors?.[m],f=l[m],x=Math.min(d.n?d.minX*R:n[m].focal.x*R-1,Number.isFinite(f.minX)?f.minX:1/0),y=Math.max(d.n?d.maxX*R:n[m].focal.x*R+1,Number.isFinite(f.maxX)?f.maxX:-1/0),b=Math.min(d.n?d.minY*R:n[m].focal.y*R-1,Number.isFinite(f.minZ)?f.minZ:1/0),M=Math.max(d.n?d.maxY*R:n[m].focal.y*R+1,Number.isFinite(f.maxZ)?f.maxZ:-1/0),C=Math.min(d.n?Math.min(n[m].baseHeightM,d.minDeck):n[m].baseHeightM,Number.isFinite(f.minY)?f.minY:1/0),P=Math.max(d.n?Math.max(d.maxDeck,C+.5):C+.5,Number.isFinite(f.maxY)?f.maxY:-1/0),g=[d.n?d.sumX/d.n:(x+y)/2,d.n?d.sumDeck/d.n:(C+P)/2,d.n?d.sumZ/d.n:(b+M)/2],T=Math.max(1,.5*Math.hypot(y-x,P-C,M-b));c.push({index:m,id:h?.id??`floor-${m}`,label:h?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:d.n,center:g,radius:T,box:{min:[x,C,b],max:[y,P,M]},focalWorld:[n[m].focal.x*R,n[m].baseHeightM+1.5,n[m].focal.y*R]})}}return c}function xn(t,e){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of e)a(s.x,s.y);for(let s of t)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=ft(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=hn(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=pn(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function er(t,e,n,r,o,i){if(e.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=dt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ie(t,s,void 0,()=>0,-.4,i.ground,i.ground,re)}else{let a=e.reduce((d,h)=>h.baseHeightM<d.baseHeightM?h:d);t.setFloor(a.index);let s=n.filter((d,h)=>r[h]===a.index),c=xn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),p=dt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;ie(t,p,void 0,()=>m,m-.22,i.ground,i.ground,re)}}function tr(t,e,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,p=-1/0,m=(f,x,y)=>{a=Math.min(a,f),l=Math.max(l,f),s=Math.min(s,x),u=Math.max(u,x),c=Math.min(c,y),p=Math.max(p,y)};for(let f=0;f<t.position.length;f+=3)m(t.position[f],t.position[f+1],t.position[f+2]);for(let f=0;f<e.count;f++){let x=f*3,y=e.iPosition[x],b=e.iPosition[x+1],M=e.iPosition[x+2],C=Math.max(.35,e.iMaxRadius[f]??.35);m(y-C,b,M-C),m(y+C,b+1.6,M+C)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,p=o+i);let d=[(a+l)/2,(s+u)/2,(c+p)/2],h=Math.max(1,.5*Math.hypot(l-a,u-s,p-c));return{center:d,radius:h,minY:s,maxY:u}}function nr(t,e,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let C=0;C<t.count;C++){let P=C*3,g=t.iPosition[P],T=t.iPosition[P+2];g<a&&(a=g),g>c&&(c=g),T<s&&(s=T),T>l&&(l=T)}for(let C of e)a=Math.min(a,C.cx-C.halfX),c=Math.max(c,C.cx+C.halfX),s=Math.min(s,C.cz-C.halfZ),l=Math.max(l,C.cz+C.halfZ);let u=n.minX*R,p=n.maxX*R,m=n.minY*R,d=n.maxY*R,h=u,f=p,x=m,y=d;if(Number.isFinite(a)){let C=Math.max(2,.06*Math.hypot(c-a,l-s));h=Math.max(u,a-C),f=Math.min(p,c+C),x=Math.max(m,s-C),y=Math.min(d,l+C)}let b=Math.min(0,r),M=Math.max(o,i*.05);return{min:[h,b,x],max:[f,M,y]}}function or(t,e,n){let r=()=>({byObjectId:new Map,elements:[]});if(!e||!t)return r();let o=kn(e);if(!o.ok||o.value.id!==t)return r();let i=new Map;for(let u of n)for(let p of u.objects)p.type==="shape"&&i.set(p.id,{shape:p,unit:u});let a=new Set,s=new Set,c=[];for(let u of o.value.overlay.productionElements??[]){let p=i.get(u.objectId),m=p?Ye(p.shape):null,d=u.baseElevationM??0;if(!p||!m||m.length<3||!u.id||a.has(u.id)||s.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(d)||d<-10||d>100)return r();a.add(u.id),s.add(u.objectId);let h=m.map(y=>y.x*R),f=m.map(y=>y.y*R),x=p.unit.baseHeightM+d;c.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:p.unit.index,baseY:x,topY:x+u.heightM,bounds:{min:[Math.min(...h),x,Math.min(...f)],max:[Math.max(...h),x+u.heightM,Math.max(...f)]},occlusion:u.occlusion})}let l=c.sort((u,p)=>u.id.localeCompare(p.id));return{byObjectId:new Map(l.map(u=>[u.objectId,u])),elements:l}}function bt(t){let{doc:e}=t,n=lo(e.theme),r=n.structure,o=Co(e,t.eventConfigurationId??e.eventConfigurationId),i=or(t.eventConfigurationId,t.eventConfiguration,o),a=t.seats,s=new Et,c=new Map;for(let F of o)for(let w of F.objects)c.set(w.id,F.index),w.type==="section"&&c.set(w.logicalSectionId??w.id,F.index);let l=a.map(F=>c.get(F.sectionId??"")??c.get(F.rowId??"")??0),u=xn(o,a);er(s,o,a,l,u,r);let p=To(e,a),m=new Map,d=new Map;for(let F of e.categories??[])m.set(F.key,F.color),F.seatGlyph&&d.set(F.key,F.seatGlyph);let h=[],f=Fo(o,a,l),x=new Float32Array(a.length);for(let F=0;F<o.length;F++){let w=o[F];s.setFloor(F);let _=new Bt,U=[],I=w.objects.filter(S=>S.type==="section"&&!!S.outline&&S.outline.length>=3);for(let S of w.objects)if(S.type==="section")Go(s,S,w,Eo(S,p),f.bySection.get(S.id),_,I,r);else if(S.type==="shape"){let D=i.byObjectId.get(S.id);s.setMaterial((D?.kind??S.role)==="screen"?1:0),Oo(s,S,w.baseHeightM,Do(S,U),r,w.focal,h,D),s.setMaterial(0)}else S.type==="gaArea"?No(s,S,w.baseHeightM,Q(m.get(S.categoryKey)),r):S.type==="booth"?Lo(s,S,w.baseHeightM,Q(m.get(S.categoryKey)),r):S.type==="table"?Bo(s,S,w.baseHeightM,Q(m.get(S.categoryKey)),r):S.type==="decorImage"&&Vo(s,S,w.baseHeightM,r);Ho(s,w,a,f,r)}let y=o.length>1?{x:o.reduce((F,w)=>F+w.focal.x,0)/o.length,y:o.reduce((F,w)=>F+w.focal.y,0)/o.length}:e.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},b=oo([s.build()]),M=co(a,t.initialState,f,x,m,d),C=Zo({doc:e,units:o,seats:a,surfaces:f,focal:y}),{labels:P,sections:g,rows:T}=Qo({doc:e,units:o,seats:a,surfaces:f,seatData:M,hintedSeatFloor:l,zones:C,focal:y}),E=Jo({doc:e,units:o,seats:a,surfaces:f,solids:b,hintedSeatFloor:l,seatFloor:x});$o(P,E),M.iYaw=ao(M.iPosition,a.length,F=>a[F].rowId,F=>{let w=o[x[F]]?.focal??y;return[w.x*R,w.y*R]});let L=(u.minX+u.maxX)/2*R,G=(u.minY+u.maxY)/2*R,N=.5*Math.hypot((u.maxX-u.minX)*R,(u.maxY-u.minY)*R)||10,v=tr(b,M,{cx:L,cz:G,radius:N}),A=nr(M,h,u,v.minY,v.maxY,N);return{solids:b,seats:M,bounds:{center:[(A.min[0]+A.max[0])/2,(A.min[1]+A.max[1])/2,(A.min[2]+A.max[2])/2],radius:N,groundY:0,box:A},renderBounds:{center:v.center,radius:v.radius},stateColorLUT:uo(n,ye),theme:n,seatCount:a.length,focalWorld:[y.x*R,1.5,y.y*R],zones:C,stages:h,productionElements:i.elements,sections:g,rows:T,labels:P,floors:E}}var ma=88,da=20,rr={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},Ot=new Set(["row","seat"]),ir={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Vt={row:{x:62,y:16},seat:{x:46,y:18}},ar=Q,gn=t=>On(t);function sr(t,e){let n=gn(t),r=gn(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function vn(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+e[o-1]*(1-r))}function ha(t,e=[.04,.06,.1],n=!0){let r=gn(e)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?vn(i,e):e,s=ar(t),c=n?7:4.5,l=s&&sr(s,a)>=c?t:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var Nt=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;for(let[n,r]of this.nodes)e.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-e.x,y:i.y-e.y,width:i.width,height:i.height}}:{}}})}update(e,n,r,o,i,a){if(!this.labels.length)return;let s=Xo(o,i,{hasZoneLabels:this.labels.some(b=>b.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let b of this.labels){if(!s.has(b.kind))continue;let M=Be(e,b.anchor,n,r);if(!M.visible)continue;let C=a?Math.hypot(b.anchor[0]-a[0],b.anchor[1]-a[1],b.anchor[2]-a[2]):1;c.push({label:b,screen:M,focus:Ko(M,C,n,r),halfWidth:jo(b.text,rr[b.kind].size,!Ot.has(b.kind))/2,...this.selectedSeatLabelIds.has(b.id)?{priority:1}:{}})}let l=Yo(c.filter(b=>b.label.kind==="floor"),n),u=[...c.filter(b=>!Ot.has(b.label.kind)&&b.label.kind!=="floor"),...l],p=Wo(u,ma,da),m=yn(c.filter(b=>b.label.kind==="row"),Vt.row.x,Vt.row.y,bn.row,p),d=yn(c.filter(b=>b.label.kind==="seat"),Vt.seat.x,Vt.seat.y,bn.seat,[...p,...m]),h=[...p,...m,...d],f=new Set(h.map(b=>b.label.id));for(let{label:b,screen:M}of h){let P=this.nodeFor(b).style;P.display="",P.transform=`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let x=h.filter(({label:b})=>!Ot.has(b.kind)).sort((b,M)=>ir[M.label.kind]-ir[b.label.kind]||b.screen.depth-M.screen.depth||b.focus-M.focus),y=[];for(let{label:b}of x){let M=this.nodes.get(b.id);if(!M||M.style.display==="none")continue;let C=M.getBoundingClientRect();y.some(g=>C.left<g.right+3&&C.right+3>g.left&&C.top<g.bottom+3&&C.bottom+3>g.top)?M.style.display="none":y.push(C)}for(let[b,M]of this.nodes)f.has(b)||(M.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}n.textContent=e.text,n.setAttribute("data-label-kind",e.kind);let r=this.selectedSeatLabelIds.has(e.id);n.toggleAttribute("data-selected-seat",r);let o=rr[e.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!Ot.has(e.kind),s=ha(e.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=ar(r?"#ecf8ff":s.ink)??[1,1,1],u=r?vn("rgba(10,28,45,.9)",c):a?vn(s.backing,c):c;return n.dataset.qualityContrast=sr(l,u).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var pa=1;var fa=new Set(["floor","zone","section","ga","booth","annotation"]);function ba(t){return t.every(e=>Number.isFinite(e))}function ya(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function cr(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function We(t){return Math.round(t*1e4)/1e4}function xa(t){if(t)return{box:{x:We(t.box.x),y:We(t.box.y),width:We(t.box.width),height:We(t.box.height)},horizontalFillRatio:We(t.horizontalFillRatio),verticalFillRatio:We(t.verticalFillRatio),visibleAreaRatio:We(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function Pe(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Mn(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>fa.has(s.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)ya(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],a=[Pe("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Pe("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Pe("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Pe("viewport-empty","The 3D viewport must have visible dimensions",t.viewport.width>1&&t.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${t.viewport.width}\xD7${t.viewport.height}`}]),Pe("camera-invalid","The capture camera must have a finite physical pose",ba(i)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Pe("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!t.scene.authoredRelief||t.scene.renderedVerticalSpanM>.05&&t.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:t.scene.projectedReliefPx,minimum:2}]),Pe("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Pe("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Pe("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Pe("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:xa(t.framing)},metrics:{minimumHierarchyFontPx:cr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:cr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:a}}import{Geometry as Gt,Mesh as Ht,Transform as xr}from"ogl";import{Program as je}from"ogl";var zt=`
|
|
1
|
+
import{a as Xn,c as Wn,d as jn}from"../chunk-BV6FHURE.js";import{c as On}from"../chunk-WZ6ZNPNT.js";import{d as Yn}from"../chunk-T2LWVOQ3.js";import{e as Ln,o as He,q as lt,r as Hn,t as It}from"../chunk-YYRUKI7A.js";import{e as zn,k as Un}from"../chunk-UL5OIGIF.js";import{W as Le,X as Oe,ea as Rt,ga as Vn,ha as Ct,ja as Nn,l as Bn,m as st,va as en}from"../chunk-I6DNJFRF.js";import{d as $,k as Gn,x as be,z as ct}from"../chunk-CXF32VPG.js";import"../chunk-CRCGO52K.js";import{Renderer as qr}from"ogl";var xe=["available","held","sold","selected","dimmed"];function ut(e){let t=xe.indexOf(e);return t<0?0:t}var Kn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function qn(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var tn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ye={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ye(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Zr(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Ft=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new qr({canvas:this.canvas,dpr:Zr(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ye.top[0],Ye.top[1],Ye.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};import{Camera as Qr,Vec3 as nn}from"ogl";var ue=Math.PI/180,on=15*ue,rn=80*ue,$e=.12,Zn=35,Qn=1.25,Tt=class{constructor(t,n,r,o){this.fovY=Zn;this.target=new nn;this.azimuth=-30*ue;this.polar=55*ue;this.distance=10;this.azT=-30*ue;this.polT=55*ue;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new nn;this.panAnchor=new nn;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Qr(t,{fov:Zn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(on,Math.min(rn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*ue;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(on,Math.min(rn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*ue/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),f=Math.sin(this.polar),u=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*u)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*f*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*ue/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*ue,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*ue;let f=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=f*Math.max(1.05,Math.min(2,i?.margin??Qn)),this.minDist=Math.max(2,a*.12),this.maxDist=f*4,n?(this.azimuth=this.azT,this.polar=12*ue,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*ue/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*ue;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Qn))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),f=-l*Math.sin(o),u=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(u)>.999)return s;let h=-m,d=f,p=Math.hypot(h,d);h/=p,d/=p;let g=-d*u,b=d*f-h*m,y=h*u,S=Math.tan(r),w=Math.tan(n),P=1;for(let x=0;x<8;x++){let A=(x&1?c.max[0]:c.min[0])-t.center[0],T=(x&2?c.max[1]:c.min[1])-t.center[1],_=(x&4?c.max[2]:c.min[2])-t.center[2],N=A*f+T*u+_*m,O=Math.abs(A*h+_*d),M=Math.abs(A*g+T*b+_*y);P=Math.max(P,O/S-N,M/w-N)}return Math.min(s,Math.max(P,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*$e,this.polar+=n*$e,this.distance+=r*$e,this.target.x+=o*$e,this.target.y+=i*$e,this.target.z+=a*$e,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(on,Math.min(rn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Et=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var Je=2.5,$r=1.15,mt=6,et=10,$n=6,Jn=9.5,eo=.9,to=2.2,an=30,sn=4,Dt=8192;var Ms=et+sn;function no(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Je};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:Je+o*($r-Je)}}function oo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function ro(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}import Jr from"earcut";import ei from"polygon-clipping";var I=Le,ti=.002;function ni(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<ti}var Xe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Lt=class{constructor(){this.pos=new Xe;this.nor=new Xe;this.col=new Xe;this.flr=new Xe;this.mat=new Xe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){ni(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function oi(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,f=i*a-r*c,u=r*s-o*a,m=Math.hypot(l,f,u)||1;return l/=m,f/=m,u/=m,[l,f,u]}function ri(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=Jr(r,o.length?o:void 0,2);return{pts:n,tris:i}}function cn(e){return He(e)<0?[...e].reverse():e}var ii=3;function ai(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(h,d,p,g)=>Math.abs(r({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+g)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,f=(o+i+a)/3,u=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-f)),m=(h,d,p)=>{let g=Math.abs(r({x:(h+c)/2,y:(d+l)/2})-(p+f)/2);g>u&&(u=g)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),u}function dt(e,t,n,r,o){if(o<=0)return ai(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(dt(e,i,s,r,o-1),dt(i,t,a,r,o-1),dt(s,a,n,r,o-1),dt(i,a,s,r,o-1))}function ht(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+r.x)/2,y:(n.y+r.y)/2},d={x:(r.x+t.x)/2,y:(r.y+t.y)/2};ht(e,t,m,d,o,i,a-1,s),ht(e,m,n,h,o,i,a-1,s),ht(e,d,h,r,o,i,a-1,s),ht(e,m,h,d,o,i,a-1,s);return}let c=[t.x*I,o(t),t.y*I],l=[n.x*I,o(n),n.y*I],f=[r.x*I,o(r),r.y*I];if(s){e.triN(c,l,f,s(t),s(n),s(r),i);return}let u=oi(c,l,f);u[1]<0&&(u=[-u[0],-u[1],-u[2]]),e.tri(c,l,f,u,i)}var si=8;function io(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let f={x:(i.x+a.x)/2,y:(i.y+a.y)/2},u=t(f);if(Math.abs(u-(s+c)/2)>n){o(i,f,s,u,l-1),o(f,a,u,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),si)}return r}function kt(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,f=Math.hypot(c,l);f>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/f<t||r.push(a)}return r.length>=3?r:n}var _t=.001*Oe*.1;function ie(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(He(t))<1e-4))return;let f=kt(io(kt(cn(t),_t),r,c),_t),u=n?.map(x=>kt(io(kt(cn(x),_t),r,c),_t)).filter(x=>x.length>=3&&Math.abs(He(x))>=1e-4),{pts:m,tris:h}=ri(f,u),d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],g=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],y=0;if(Number.isFinite(c))for(;y<ii;y++){let x=0;for(let A=0;A<h.length;A+=3){let T=dt(m[h[A]],m[h[A+1]],m[h[A+2]],r,y);T>x&&(x=T)}if(x<=c)break}for(let x=0;x<h.length;x+=3){let A=m[h[x]],T=m[h[x+1]],_=m[h[x+2]];ht(e,A,T,_,r,d,y,l);let N=[A.x*I,o,A.y*I],O=[T.x*I,o,T.y*I],M=[_.x*I,o,_.y*I];e.tri(N,M,O,[0,-1,0],p)}let S=x=>{if(y<=0)return x;let A=1<<y,T=[];for(let _=0;_<x.length;_++){let N=x[_],O=x[(_+1)%x.length];for(let M=0;M<A;M++){let C=M/A;T.push({x:N.x+(O.x-N.x)*C,y:N.y+(O.y-N.y)*C})}}return T},w=Bn(f),P=[{ring:S(f),flip:!1}];if(u)for(let x of u)x.length>=3&&P.push({ring:S(x),flip:!0});for(let{ring:x,flip:A}of P)for(let T=0;T<x.length;T++){let _=x[T],N=x[(T+1)%x.length],O=(N.x-_.x)*I,C=(N.y-_.y)*I,k=-O,v=Math.hypot(C,k)||1;C/=v,k/=v;let F=(_.x+N.x)/2-w.x,V=(_.y+N.y)/2-w.y,R=C*F+k*V;A&&(R=-R),R<0&&(C=-C,k=-k);let E=[C,0,k],D=[_.x*I,r(_),_.y*I],X=[N.x*I,r(N),N.y*I],H=[_.x*I,o,_.y*I],W=[N.x*I,o,N.y*I];e.tri(D,X,W,E,g,g,b),e.tri(D,W,H,E,g,b,b)}}function ao(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function Ot(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=cn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],f=l.x-c.x,u=l.y-c.y,m=Math.hypot(f,u)||1;i.push({x:u/m,y:-f/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],f=i[s],u=l.x+f.x,m=l.y+f.y,h=Math.hypot(u,m),d=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+f.x*t,c.y+f.y*t])};if(h<1e-9){d();continue}u/=h,m/=h;let p=u*l.x+m*l.y,g=1/Math.max(p,1e-6);if(!Number.isFinite(g)||g>n){d();continue}a.push([c.x+u*t*g,c.y+m*t*g])}if(a.length<3)return e;try{let s=ei.union([[...a,a[0]]]),c=null,l=-1/0;for(let u of s){let m=Math.abs(He(u[0].map(([h,d])=>({x:h,y:d}))));m>l&&(l=m,c=u[0])}if(!c)return e;let f=c.map(([u,m])=>({x:u,y:m}));if(f.length>1){let u=f[0],m=f[f.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&f.pop()}return f.length>=3?f:e}catch{return e}}function Bt(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function ft(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var oe={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ci=.44,li=.15,ui=.3,mi=.24;function so(e){return e===void 0||!Number.isFinite(e)||e<=0?mi:Math.min(ui,Math.max(li,e*ci))}var ln=.21,di=.05,un=.45,Vt=un+di,hi=[{part:oe.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:oe.pad,min:[-1,.36,-.95],max:[1,un,1]},{part:oe.back,min:[-1,Vt,-1],max:[1,.92,-.72]},{part:oe.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:oe.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:oe.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:oe.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:oe.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:oe.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:oe.leg,min:[.62,0,.48],max:[.82,.37,.7]}],fi=[{part:oe.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:oe.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:oe.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:oe.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:oe.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],pi=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function co(){let e=[],t=[],n=[],r=[],o=(v,F,V)=>{let R=n.length,[E,D,X]=v,H=[D[0]-E[0],D[1]-E[1],D[2]-E[2]],W=[X[0]-E[0],X[1]-E[1],X[2]-E[2]],z=H[1]*W[2]-H[2]*W[1],G=H[2]*W[0]-H[0]*W[2],U=H[0]*W[1]-H[1]*W[0],Y=Math.hypot(z,G,U);Y>1e-9?(z/=Y,G/=Y,U/=Y):[z,G,U]=F,z*F[0]+G*F[1]+U*F[2]<0&&(z=-z,G=-G,U=-U);for(let K of v)e.push(...K),t.push(z,G,U),n.push(V);r.push(R,R+1,R+2,R,R+2,R+3)},i=v=>{for(let F of pi){let V=F.c.map(R=>R.map((E,D)=>E?v.max[D]:v.min[D]));o(V,F.n,v.part)}};for(let v of hi)i(v);for(let v of fi)i(v);let a=un,s=1.08,c=.47,l=.69,f=-.55,u=.08,m=-.48,h=.01,d=[-c,a,f],p=[c,a,f],g=[-c,a,u],b=[c,a,u],y=[-l,s,m],S=[l,s,m],w=[-l,s,h],P=[l,s,h];o([p,S,P,b],[1,0,0],oe.body),o([g,w,y,d],[-1,0,0],oe.body),o([w,P,S,y],[0,1,0],oe.body),o([d,p,b,g],[0,-1,0],oe.body),o([b,P,w,g],[0,0,1],oe.body),o([d,y,S,p],[0,0,-1],oe.body);let x=10,A=8,T=[0,1.205,-.23],_=[.42,.115,.38],N=n.length;for(let v=0;v<=A;v++){let F=Math.PI*v/A,V=Math.cos(F),R=Math.sin(F);for(let E=0;E<=x;E++){let D=Math.PI*2*E/x,X=R*Math.cos(D),H=R*Math.sin(D);e.push(T[0]+_[0]*X,T[1]+_[1]*V,T[2]+_[2]*H);let W=X/_[0],z=V/_[1],G=H/_[2],U=Math.hypot(W,z,G)||1;W/=U,z/=U,G/=U,t.push(W,z,G),n.push(oe.head)}}for(let v=0;v<A;v++)for(let F=0;F<x;F++){let V=N+v*(x+1)+F,R=V+x+1;r.push(V,R,V+1,V+1,R,R+1)}let O=new Float32Array(e),M=new Float32Array(t),C=new Float32Array(n),k=new Uint16Array(r);return{position:O,normal:M,part:C,index:k,vertexCount:n.length,indexCount:r.length}}function lo(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,f)=>{let u=f-l;for(let m=l;m<f;m++){let[h,d]=r(m),p=h-i(m),g=d-a(m);if(u>=2){let b=Math.max(l,m-1),y=Math.min(f-1,m+1),S=i(y)-i(b),w=a(y)-a(b),P=Math.hypot(S,w);if(P>1e-6){let x=-w/P,A=S/P;x*p+A*g<0&&(x=-x,A=-A),p=x,g=A}}o[m]=p===0&&g===0?0:Math.atan2(p,g)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Ce=.22;function uo(e,t){let n=xe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var bi=.42;function yi(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let d of e)d.x<r&&(r=d.x),d.y<o&&(o=d.y),d.x>i&&(i=d.x),d.y>a&&(a=d.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),f=Math.max(1,Math.ceil(s/l)+1),u=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(d,p)=>{let g=Math.min(f-1,Math.max(0,Math.floor((d-r)/l)));return Math.min(u-1,Math.max(0,Math.floor((p-o)/l)))*f+g};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),g=m.get(p);g?g.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],g=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/l))),b=Math.min(u-1,Math.max(0,Math.floor((p.y-o)/l))),y=1/0;for(let S=1;S<=4;S++){for(let w=b-S;w<=b+S;w++)if(!(w<0||w>=u))for(let P=g-S;P<=g+S;P++){if(P<0||P>=f||S>1&&Math.abs(w-b)<S&&Math.abs(P-g)<S)continue;let x=m.get(w*f+P);if(x)for(let A of x){if(A===d)continue;let T=Math.hypot(e[A].x-p.x,e[A].y-p.y);T<y&&(y=T)}}if(Number.isFinite(y)&&y<=S*l)break}n[d]=y}return n}function gi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Rt):0}function mo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),f=new Float32Array(a),u=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a*3),p=new Map,g=yi(e);for(let b=0;b<a;b++){let y=e[b],w=(n?.seatPitchU(b)??g[b])*I;f[b]=Number.isFinite(w)?Math.max(.06,Math.min(Ce,w*bi)):Ce,u[b]=so(Number.isFinite(w)?w:void 0);let P=Un(y.glyph,{seatGlyph:i?.get(y.categoryKey)});m[b]=zn.indexOf(P),h[b]=y.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=y.x*I,s[b*3+1]=n?n.seatDeckY(b):gi(y),s[b*3+2]=y.y*I,c[b]=ut(t?t(y):"available");let x=$(o?.get(y.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=x[0],l[b*3+1]=x[1],l[b*3+2]=x[2],y.accessibility?.length){let A=$(Ln(y.accessibility));A&&(d[b*3]=A[0],d[b*3+1]=A[1],d[b*3+2]=A[2])}p.set(y.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:f,iRing:d,idToIndex:p,iChairWidth:u,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var xi=64;function mn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=ut(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+xi){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var vi=.15,Mi=.9,wi=1.76,Si=.7,Pi=1.6;function Ai(){return{background:{top:[...Ye.top],bottom:[...Ye.bottom]},structure:tn,seatStates:{...Kn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function ho(e){let t=Ai();if(!e)return t;let n=$(e.background);if(n){t.background={top:ye(n,Mi),bottom:ye(n,wi)};let a={};for(let[s,c]of Object.entries(tn))a[s]=be(c,n,vi);t.structure=a}let r=$(e.selectionColor)??$(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(Pi,Math.max(Si,o)));let i=e.venue3d;if(i){let a=$(i.deck),s=$(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=$(i.seat),t.materials.shell=$(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function fo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}import go from"polygon-clipping";import Ri from"earcut";var Ci=.58,po=.01,ge=Ce*1.5*Oe,Ii=.5,Fi=.6;function Ti(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,f=c.y-s.y,u=Math.hypot(l,f);if(u<1e-9){r.push([0,0]);continue}l/=u,f/=u,r.push([-f,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Ei(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,f=Math.hypot(c,l)||1;return{x:c/f,y:l/f}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var bo=Math.PI/12;function Di(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function xo(e,t){if(!e.length||!(t>0))return[];let n=Di(e),r=(s,c,l,f)=>{let u=l-c;for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;let m=Math.max(1,Math.ceil(u/bo)),h=t/Math.cos(u/m/2);for(let d=0;d<=m;d++){let p=c+u*d/m;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(n.length<3){let s=0,c=0;for(let h of n)s+=h.x,c+=h.y;s/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let f=[],u=Math.max(3,Math.ceil(Math.PI*2/bo)),m=(l+t)/Math.cos(Math.PI/u);for(let h=0;h<u;h++){let d=h/u*Math.PI*2;f.push({x:s+Math.cos(d)*m,y:c+Math.sin(d)*m})}return f}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Po(a)}function ki(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,f=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;f<0?f=0:f>1&&(f=1);let u=Math.hypot(t-(i.x+f*s),n-(i.y+f*c));u<r&&(r=u)}return r}function Nt(e){let t=e.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let f=Math.hypot(l.x-i,l.y-a);f>c&&(c=f)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let f of i){let u=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let h=t[m],d=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(d>=u&&d>=s)continue;let p=ki(e[m].pts,f.x,f.y);p<u&&(u=p),e[m].depth<e[o].depth&&p<s&&(s=p,c=e[m].y)}Number.isFinite(u)&&u>0&&a.push(u)}a.sort((f,u)=>f-u);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function vo(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],u=f.x-r.x,m=f.y-r.y,h=Math.hypot(u,m)||1;u/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:f.x+m*d,y:f.y-u*d},{x:f.x-m*d,y:f.y+u*d}]})():[];if(i.length<2)return null;let a=0,s=0;for(let f=1;f<i.length;f++){let u=Math.hypot(i[f].x-i[f-1].x,i[f].y-i[f-1].y);u>1e-6&&(a+=u,s++)}let c=s>0?a/s:0,l=Ei(i,Math.max(c*Fi,ge));return{pts:l,nrm:Ti(l,r),front:Math.max(n[t].pitch*Ci,ge),back:Math.max(n[t].pitch*Ii,ge)}}var tt=1.5,Mo=.3;function dn(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let u=1;u<e.length-1;u++){let m=e[u],h=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);h>s&&(s=h,c=u)}if(s<=t||c<0)return[n,r];let l=dn(e.slice(0,c+1),t),f=dn(e.slice(c),t);return[...l.slice(0,-1),...f]}function wo(e,t){if(e.length<4)return e;let n=dn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function So(e,t,n){if(e.length<2)return[];let r=n??Nt(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let y of a){let S=e[y].patch;S&&S.length>=3?i.push({outline:[...S],holes:[],topY:e[y].y}):s.push(y)}if(!s.length)continue;s.sort((y,S)=>e[y].depth-e[S].depth);let l=s.map(y=>vo(e,y,r,t)).filter(y=>y!==null);if(!l.length)continue;let f=(y,S)=>({x:y.pts[S].x-y.nrm[S][0]*(y.front+tt),y:y.pts[S].y-y.nrm[S][1]*(y.front+tt)}),u=(y,S)=>({x:y.pts[S].x+y.nrm[S][0]*(y.back+tt),y:y.pts[S].y+y.nrm[S][1]*(y.back+tt)}),m=l[0],h=l[l.length-1],d=[];for(let y=0;y<m.pts.length;y++)d.push(f(m,y));for(let y of l)d.push(u(y,y.pts.length-1));for(let y=h.pts.length-1;y>=0;y--)d.push(u(h,y));for(let y=l.length-1;y>=0;y--)d.push(f(l[y],0));let p=Po(d),g=1/0;for(let y of s)e[y].y<g&&(g=e[y].y);if(!Number.isFinite(g))continue;if(p.length>=3&&Math.abs(He(p))>1e-6&&l.every(y=>{let S=y.pts[Math.floor(y.pts.length/2)];return lt(p,S.x,S.y)})){i.push({outline:wo(p,Mo),holes:[],topY:g});continue}for(let y of _i(l))i.push({outline:y,holes:[],topY:g})}return i}function _i(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+tt,a=n.back+tt;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],f=n.nrm[c];r.push([l.x-f[0]*i,l.y-f[1]*i]),o.push([l.x+f[0]*a,l.y+f[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=go.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(wo(i,Mo))}return r}catch{return[]}}function Po(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var hn=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!lt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function yo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],f=r[0];for(let u=1;u+1<r.length;u++){let m=r[u],h=r[u+1];e.tri([f.x*I,o,f.y*I],[m.x*I,o,m.y*I],[h.x*I,o,h.y*I],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=go.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let f=l[0],u=[],m=[];for(let d=0;d<f.length-1;d++)u.push(f[d][0],f[d][1]),m.push([f[d][0],f[d][1]]);if(m.length<3)continue;let h=Ri(u,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],g=m[h[d+1]],b=m[h[d+2]];e.tri([p[0]*I,o,p[1]*I],[g[0]*I,o,g[1]*I],[b[0]*I,o,b[1]*I],c,i)}}}function Ao(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Nt(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,f=i&&i.length>=3?new hn([[...i]]):null,u=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let d=t[h];if(d.patch&&d.patch.length>=3){let P=[...d.patch],x=s[h].belowY??r;if(m(()=>{if(l&&f)yo(e,l,f,P,d.y,o.tread);else{let A=P[0];for(let T=1;T+1<P.length;T++){let _=P[T],N=P[T+1];e.tri([A.x*I,d.y,A.y*I],[_.x*I,d.y,_.y*I],[N.x*I,d.y,N.y*I],c,o.tread)}}}),d.y>x+po){let A=0,T=0;for(let _ of P)A+=_.x,T+=_.y;A/=P.length,T/=P.length,u(()=>{for(let _=0;_<P.length;_++){let N=P[_],O=P[(_+1)%P.length],M=O.x-N.x,C=O.y-N.y,k=Math.hypot(M,C);if(k<1e-6)continue;let v=C/k,F=-M/k;(N.x-A)*v+(N.y-T)*F<0&&(v=-v,F=-F);let V=[v,0,F],R=[N.x*I,d.y,N.y*I],E=[O.x*I,d.y,O.y*I],D=[N.x*I,x,N.y*I],X=[O.x*I,x,O.y*I];e.tri(R,E,X,V,o.riser),e.tri(R,X,D,V,o.riser)}})}continue}let p=vo(t,h,s,n);if(!p)continue;let{pts:g,nrm:b,front:y,back:S}=p,w=s[h].belowY??r;for(let P=0;P+1<g.length;P++){let x=g[P],A=g[P+1],T=b[P],_=b[P+1];if(Math.hypot(A.x-x.x,A.y-x.y)<1e-6||T[0]===0&&T[1]===0||_[0]===0&&_[1]===0)continue;let N=[(x.x-T[0]*y)*I,d.y,(x.y-T[1]*y)*I],O=[(A.x-_[0]*y)*I,d.y,(A.y-_[1]*y)*I],M=[(x.x+T[0]*S)*I,d.y,(x.y+T[1]*S)*I],C=[(A.x+_[0]*S)*I,d.y,(A.y+_[1]*S)*I];if(m(()=>{l&&f?yo(e,l,f,[{x:x.x-T[0]*y,y:x.y-T[1]*y},{x:A.x-_[0]*y,y:A.y-_[1]*y},{x:A.x+_[0]*S,y:A.y+_[1]*S},{x:x.x+T[0]*S,y:x.y+T[1]*S}],d.y,o.tread):(e.tri(N,O,C,c,o.tread),e.tri(N,C,M,c,o.tread))}),d.y>w+po){let k=[N[0],w,N[2]],v=[O[0],w,O[2]],F=[-T[0],0,-T[1]];u(()=>{e.tri(N,O,v,F,o.riser),e.tri(N,v,k,F,o.riser)})}}}}import Co from"polygon-clipping";function Li(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Ro(e,t){return e.filter(n=>n.type!=="shape"||Li(n,t))}function Io(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Ro(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Ro(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Oi={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function nt(e){return Hn(e)??Oi}function Fo(e,t){let n=Ot(e.outline,ge),r=nt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&It(r,nt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Co.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([f,u])=>({x:f,y:u}));if(l.length>1){let f=l[0],u=l[l.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function To(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=Co.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,f])=>({x:l,y:f}));if(c.length>1){let l=c[0],f=c[c.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Bi=.05,Eo=.05,Vi=.15,fn=25;function Do(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],f=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];for(let d of h.objects){if(d.type==="table"&&f.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Ot(d.outline,ge);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:m,box:nt(p),section:d,unit:h,outline:p})}}let u=new Map;for(let m of l){let h=u.get(m.floorIndex);h?h.push(m):u.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?u.get(n[m])??[]:l,p=h.sectionId?d.find(b=>b.id===h.sectionId)??d.find(b=>b.section.logicalSectionId===h.sectionId&&en({x:h.x,y:h.y},b.outline,b.section.holes)):void 0,g=p?[p]:d;for(let b of g){if(n&&b.floorIndex!==n[m]||!p&&(h.x<b.box.minX||h.x>b.box.maxX||h.y<b.box.minY||h.y>b.box.maxY||!en({x:h.x,y:h.y},b.outline,b.section.holes)))continue;o[m]=b.id;let y=c.get(b.id);y.hasSeats=!0;let S=h.focalPoint??b.unit.focal,w=Math.hypot(h.x-S.x,h.y-S.y);w<y.frontU&&(y.frontU=w),y.seatIndices.push(m);let P=h.rowId||`__seat-${m}`,x=y.rows.get(P);x?x.push({x:h.x,y:h.y}):y.rows.set(P,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Vn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,g=d.rake>0?Math.tan(d.rake*Math.PI/180):0,b=d.rake<=.01&&d.height<=p+.001,y=h.section.surfaceKind,S=y==="flat"?!0:y==="rakedRows"&&d.rake>.01?!1:b,w=h.hasSeats?Nn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},x=w.rows.length<2?Xn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,A=1/0;if(x){if(h.hasSeats)for(let R of h.rows.values())for(let E of R){let D=x.depthAt(E.x,E.y);D<A&&(A=D)}if(!h.hasSeats||!Number.isFinite(A)){A=1/0;for(let R of h.section.outline){let E=x.depthAt(R.x,R.y);E<A&&(A=E)}}}let T=p+Bi,_=Math.max(T,d.height),N=R=>{let E=Math.max(0,R-A)*Le,D=Math.min(E*g,fn);return Math.max(T,d.height+D)},O=R=>{let E=Math.max(0,R)*Le,D=Math.min(E*g,fn);return Math.max(T,d.height+D)},M=S?[]:w.rows.map(R=>({pts:R.pts,y:O(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:xo(R.pts,ge)}:{}})),C=M.length?M[0].y:_,k=M.map(R=>{let E=R.patch&&R.patch.length>=3?R.patch:R.pts,D=0,X=0;for(let z of E)D+=z.x,X+=z.y;let H=E.length||1;D/=H,X/=H;let W=0;for(let z of E){let G=Math.hypot(z.x-D,z.y-X);G>W&&(W=G)}return{cx:D,cy:X,rad:W}}),v=S?()=>_:M.length>=2?(R,E)=>{let D=1/0,X=C;for(let H=0;H<M.length;H++){let W=k[H];if(Math.hypot(R-W.cx,E-W.cy)-W.rad>=D)continue;let z=M[H].patch,G=z&&z.length>=3?lt(z,R,E)?0:Ct(z,R,E):Ct(M[H].pts,R,E);G<D&&(D=G,X=M[H].y)}return X}:(R,E)=>x?N(x.depthAt(R,E)):_,F=[0,1,0],V=M.length>=2||S?()=>F:(R,E)=>{if(!x)return F;let D=x.depthAt(R,E);if(D<=A)return F;let X=(D-A)*Le;if(X*g>=fn||d.height+X*g<=T)return F;let[H,W]=x.gradientAt(R,E);if(H===0&&W===0)return F;let z=1/Math.hypot(g,1);return[-H*g*z,z,-W*g*z]};if(!S)for(let R of w.rows){let E=O(R.blockDepth);for(let D of R.seatIndices)a[D]=E}for(let R of w.rows){let E=[];for(let z=1;z<R.pts.length;z++){let G=Math.hypot(R.pts[z].x-R.pts[z-1].x,R.pts[z].y-R.pts[z-1].y);G>1e-6&&E.push(G)}E.sort((z,G)=>z-G);let D=E.length?E[Math.floor(E.length/2)]:1/0,X=1/0,H=R.pts[Math.floor(R.pts.length/2)];if(H)for(let z of w.rows){if(z===R||z.blockId!==R.blockId)continue;let G=Ct(z.pts,H.x,H.y);G>1e-6&&G<X&&(X=G)}let W=Math.min(D,Math.max(X,D*.5));if(Number.isFinite(W)&&W>0)for(let z of R.seatIndices)s[z]=W}r.set(m,{sectionId:m,deckAt:v,normalAt:V,flat:S,bottomY:p,rowLevels:M,landingY:C})}for(let m=0;m<t.length;m++){let h=o[m],d=t[m];if(h){let g=a[m];i[m]=(g??r.get(h).deckAt(d.x,d.y))+Vi;continue}let p=d.eyeHeightM;i[m]=Number.isFinite(p)?Math.max(0,p-Rt):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var re={top:1,wallBottom:.5,bottomCap:.4};function Ie(e,t){if(!e)return t;let n=ye(ct(e,.4),.62);return be(t,n,.72)}function ko(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,f=0;for(let[u,m]of a){let h=$(n.get(u));h&&(s+=h[0]*m,c+=h[1]*m,l+=h[2]*m,f+=m)}f>0&&o.set(i,[s/f,c/f,l/f])}return o}function _o(e,t){return $(e.color)??t.get(e.logicalSectionId??e.id)??null}import Ni from"polygon-clipping";function Gi(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Gt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=nt(t),i=this.rings.filter((c,l)=>It(o,this.boxes[l])&&Gi(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ni.difference([r],...i).map(l=>l.map(f=>f.map(([u,m])=>[u,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([f,u])=>({x:f,y:u}));if(l.length>1){let f=l[0],u=l[l.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function zi(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let u of e)n=Math.min(n,u.x),r=Math.max(r,u.x),o=Math.min(o,u.y),i=Math.max(i,u.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),f=Math.sin(c);return e.map(u=>{let m=u.x-a,h=u.y-s;return{x:a+m*l-h*f,y:s+m*f+h*l}})}function We(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=ft(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=Bt(n,r,e.width/2,e.height/2)}return t?zi(t,e.rotation):null}function pt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&Yn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Ui=.08;function Lo(e,t){let n=We(e),r=pt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let f of n)i=Math.min(i,f.x),a=Math.min(a,f.y),s=Math.max(s,f.x),c=Math.max(c,f.y);let l=o;for(let f of t)s>f.minX&&i<f.maxX&&c>f.minY&&a<f.maxY&&l<=f.topOffsetM+1e-6&&(l=f.topOffsetM+Ui);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Be(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Oo(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function bt(e,t,n){return[Be(e[0],e[1],t),Be(e[0],e[1],n),Be(e[3],e[2],n),Be(e[3],e[2],t)]}function Bo(e,t,n){return[Be(e[0],e[3],t),Be(e[1],e[2],t),Be(e[1],e[2],n),Be(e[0],e[3],n)]}function Fe(e,t,n,r,o,i){ie(e,t,void 0,()=>n,r,o,i,re)}var pn=2.4,Hi=.75,Yi=.15;function yt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([f,u])=>({x:t.x+f*a-u*s,y:t.y+f*s+u*a}))}function Vo(e,t,n,r,o){let i=yt(t);i&&ie(e,i,void 0,()=>n+pn,n,Ie(r,o.boothTop),o.boothWall,re)}function bn(e){if(e.shape==="round"){let f=e.radius;return f?Bt(e.center.x,e.center.y,f,f,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([f,u])=>({x:o.x+f*a-u*s,y:o.y+f*s+u*a}))}function No(e,t,n,r,o){let i=bn(t);i&&ie(e,i,void 0,()=>n+Hi,n,Ie(r,o.tableTop),o.tableWall,re)}function Go(e,t,n,r,o,i,a,s){let c=We(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",f=s?s.kind==="screen":t.role==="screen",u=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:pt(t),m=s?.baseY??n,h=s?.topY??n+r;if(l&&a){let y=1/0,S=-1/0,w=1/0,P=-1/0;for(let x of c)x.x<y&&(y=x.x),x.x>S&&(S=x.x),x.y<w&&(w=x.y),x.y>P&&(P=x.y);a.push({cx:(y+S)/2*I,cz:(w+P)/2*I,y:h,halfX:Math.max((S-y)/2*I,.5),halfZ:Math.max((P-w)/2*I,.5)})}let d=$(t.fill),p=l&&d?be(o.stageTop,ye(ct(d,.18),.9),.9):Ie(d,l?o.stageTop:o.decorTop),g=f?d:null,b=l?d?be(o.stageWall,ye(d,.58),.82):o.stageWall:f?g?be(ye(g,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ie($(t.fill),o.decorWall);if(u.kind==="portal"&&c.length===4){let y=Oo(c);Fe(e,bt(y,0,.16),h,m,p,b),Fe(e,bt(y,.84,1),h,m,p,b),Fe(e,y,h,Math.max(m,h-.35),p,b);return}if(u.kind==="suite"&&c.length===4){let y=c.map((P,x)=>{let A=c[(x+1)%4],T=(P.x+A.x)/2,_=(P.y+A.y)/2;return Math.hypot(T-i.x,_-i.y)}),S=y.indexOf(Math.min(...y)),w=[0,1,2,3].map(P=>c[(S+P)%4]);Fe(e,bt(w,0,.08),h,m,p,b),Fe(e,bt(w,.92,1),h,m,p,b),Fe(e,Bo(w,.88,1),h,m,p,b),Fe(e,w,h,Math.max(m,h-.18),p,b);return}Fe(e,c,h,m,p,b)}function yn(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),f=r/2,u=o/2;return[[-f,-u],[f,-u],[f,u],[-f,u]].map(([m,h])=>({x:i+m*c-h*l,y:a+m*l+h*c}))}function Xi(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return $(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=$(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>be(s,c,1/(l+1)),a[0]):null}function zo(e,t,n,r){if(t.layer==="foreground")return;let o=yn(t);if(!o)return;let i=n+Yi,a=Ie(Xi(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=be(r.ground,a,s)),ie(e,o,void 0,()=>i,n,a,be(a,r.decorWall,.5),re)}function Uo(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Ie(r,o.gaTop);ie(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,re)}var Wi=.25,ji=1.2,Ki=.6,qi=.45,Zi=2.3,Qi=Math.PI/180;function je(e,t,n){let r=n*Qi;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function $i(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var Ji=24;function ea(e,t,n,r,o,i,a,s){let c=n.binCount,l=Ji,f=Le,u=i+.02,m=[];for(let M=0;M<c;M++){let C=(n.startBin+M+.5)*t.binStepDeg,k=new Float64Array(l+1);for(let v=0;v<=l;v++){let F=r[M]+(o[M]-r[M])*v/l;k[v]=Math.max(u,jn(t,n,C,F)-Wi)}m.push(k)}let h=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],d=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],g=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(M,C)=>{let k=(n.startBin+M+.5)*t.binStepDeg,v=r[M]+(o[M]-r[M])*C/l,F=je(t.centre,v,k);return[F.x*f,m[M][C],F.y*f]};{let M=Math.tan(12*Math.PI/180);for(let C=0;C<6;C++){let k=!1;for(let F=0;F<c;F++)for(let V=l-1;V>=0;V--)m[F][V]>m[F][V+1]&&(m[F][V]=m[F][V+1],k=!0);let v=n.closed?c:c-1;for(let F=0;F<v;F++){let V=(F+1)%c;for(let R=0;R<=l;R++){let E=m[V][R]-m[F][R];if(Math.abs(E)>1)continue;let D=r[F]+(o[F]-r[F])*R/l,X=r[V]+(o[V]-r[V])*R/l,H=je(t.centre,D,(n.startBin+F+.5)*t.binStepDeg),W=je(t.centre,X,(n.startBin+V+.5)*t.binStepDeg),z=M*Math.hypot(W.x-H.x,W.y-H.y)*f;E>z?(m[V][R]=m[F][R]+z,k=!0):-E>z&&(m[F][R]=m[V][R]+z,k=!0)}}if(!k)break}}let y=1,S=(M,C)=>{for(let k=0;k<=l;k+=4)if(Math.abs(m[M][k]-m[C][k])>y)return!0;return Math.abs(m[M][l]-m[C][l])>y},w=Math.tan(38*Math.PI/180),P=M=>(o[M]-r[M])/l*f,x=(M,C)=>m[M][C+1]-m[M][C]>w*Math.max(1e-6,P(M)),A=(M,C)=>{let k=n.closed?(M-1+c)%c:Math.max(0,M-1),v=n.closed?(M+1)%c:Math.min(c-1,M+1);Math.abs(m[k][C]-m[M][C])>y&&(k=M),Math.abs(m[v][C]-m[M][C])>y&&(v=M);let F=Math.max(0,C-1),V=Math.min(l,C+1);F<C&&x(M,F)&&(F=C),V>C&&x(M,C)&&(V=C);let R=b(k,C),E=b(v,C),D=b(M,F),X=b(M,V),H=E[0]-R[0],W=E[1]-R[1],z=E[2]-R[2],G=X[0]-D[0],U=X[1]-D[1],Y=X[2]-D[2],K=W*Y-z*U,Z=z*G-H*Y,Q=H*U-W*G,ee=Math.hypot(K,Z,Q);return ee>1e-12?(K/=ee,Z/=ee,Q/=ee,Z<0&&(K=-K,Z=-Z,Q=-Q),[K,Z,Q]):[0,1,0]},T=(M,C)=>{let k=[M[0],i,M[2]],v=[C[0],i,C[2]],F=C[0]-M[0],V=C[2]-M[2],R=Math.hypot(F,V);if(!(R>1e-12))return;let E=[V/R,0,-F/R];e.tri(M,C,v,E,p,p,g),e.tri(M,v,k,E,p,g,g)},_=.05*Oe,N=M=>o[M]-r[M]<_,O=n.closed?c:c-1;for(let M=0;M<O;M++){let C=(M+1)%c;if(N(M)||N(C))continue;if(S(M,C)){let E=(n.startBin+M+1)*t.binStepDeg,D=(U,Y)=>{let K=(r[M]+r[C])/2,Z=(o[M]+o[C])/2,Q=K+(Z-K)*Y/l,ee=je(t.centre,Q,E);return[ee.x*f,m[U][Y],ee.y*f]};for(let U=0;U<l;U++){let Y=b(M,U),K=b(M,U+1),Z=D(M,U),Q=D(M,U+1),ee=A(M,U),ae=A(M,U+1);e.triN(Y,Z,Q,ee,ee,ae,h),e.triN(Y,Q,K,ee,ae,ae,h);let Ne=b(C,U),Ge=b(C,U+1),ve=D(C,U),Te=D(C,U+1),Ee=A(C,U),Me=A(C,U+1);e.triN(ve,Ne,Ge,Ee,Ee,Me,h),e.triN(ve,Ge,Te,Ee,Me,Me,h);let pe=D(M,U),se=D(M,U+1),Ze=D(C,U+1),we=D(C,U),Qe=se[0]-pe[0],Se=se[2]-pe[2],De=Math.hypot(Qe,Se);if(De>1e-12){let wt=[Se/De,0,-Qe/De];e.tri(pe,se,Ze,wt,p),e.tri(pe,Ze,we,wt,p)}}let X=b(M,0),H=b(C,0),W=b(C,l),z=b(M,l),G=U=>[U[0],i,U[2]];e.tri(G(X),G(W),G(H),[0,-1,0],d),e.tri(G(X),G(z),G(W),[0,-1,0],d),T(X,H),T(z,W);continue}for(let E=0;E<l;E++){let D=A(M,E),X=A(C,E),H=A(C,E+1),W=A(M,E+1);if(x(M,E)||x(C,E)){let K=(se,Ze)=>{let we=(n.startBin+se+.5)*t.binStepDeg,Qe=r[se]+(o[se]-r[se])*(E+.5)/l,Se=je(t.centre,Qe,we);return[Se.x*f,Ze,Se.y*f]},Z=b(M,E),Q=b(C,E),ee=K(M,m[M][E]),ae=K(C,m[C][E]);e.triN(Z,Q,ae,D,X,X,h),e.triN(Z,ae,ee,D,X,D,h);let Ne=b(C,E+1),Ge=b(M,E+1),ve=K(M,m[M][E+1]),Te=K(C,m[C][E+1]);e.triN(ve,Te,Ne,W,H,H,h),e.triN(ve,Ne,Ge,W,H,W,h);let Ee=ae[0]-ee[0],Me=ae[2]-ee[2],pe=Math.hypot(Ee,Me);if(pe>1e-12){let se=[-Me/pe,0,Ee/pe];e.tri(ee,ae,Te,se,p),e.tri(ee,Te,ve,se,p)}continue}let z=b(M,E),G=b(C,E),U=b(C,E+1),Y=b(M,E+1);e.triN(z,G,U,D,X,H,h),e.triN(z,U,Y,D,H,W,h)}let k=b(M,0),v=b(C,0),F=b(C,l),V=b(M,l),R=E=>[E[0],i,E[2]];e.tri(R(k),R(F),R(v),[0,-1,0],d),e.tri(R(k),R(V),R(F),[0,-1,0],d),T(k,v),T(V,F)}if(!n.closed)for(let M of[0,c-1])for(let C=0;C<l;C++)T(b(M,C),b(M,C+1))}function Ho(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let f of t.rings)for(let u of f.arcs){let m=new Float64Array(u.binCount),h=new Float64Array(u.binCount);for(let p=0;p<u.binCount;p++){let g=(u.startBin+p)%t.binCount,b=Math.max(0,u.innerR[p]-ge);m[p]=Math.max(b,a[g]+.001),h[p]=Math.max(m[p]+.001,u.outerR[p]+ge)}let d=0;for(let p=0;p<u.binCount;p++){let g=u.topLevelM[p]-r;g>d&&(d=g)}d>=ji&&ea(e,t,u,m,h,r,o,i);for(let p=0;p<u.binCount;p++){let g=(u.startBin+p)%t.binCount;h[p]>a[g]&&(a[g]=h[p])}}if(n.deriveShell===!1||$i(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Ki*Oe,l=qi*Oe;for(let f of s.arcs){let u=[],m=[];for(let p=0;p<f.binCount;p++){let g=(f.startBin+p+.5)*t.binStepDeg,b=f.outerR[p]+ge+c;u.push(je(t.centre,b,g)),m.push(je(t.centre,b+l,g))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let d=()=>h+Zi;f.closed?ie(e,m,[u.slice().reverse()],d,r,o.shellTop,o.shellWall,i):ie(e,[...m,...u.slice().reverse()],void 0,d,r,o.shellTop,o.shellWall,i)}}function Yo(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Ie(r,s.tierTop);if(!o)return;let f=g=>o.deckAt(g.x,g.y),u=Fo(t,a),m=u[0]??t.outline;if(o.rowLevels.length>=2){let g=Nt(o.rowLevels),b=To(So(o.rowLevels,n.focal,g),u),y=()=>[0,1,0];for(let w of b){let P=Math.max(c,w.topY-.02);for(let x of i.subtract(w.outline,P))ie(e,x,w.holes,()=>P,c,l,s.tierWall,re,void 0,y)}b.length||ie(e,m,t.holes,()=>o.landingY,c,l,s.tierWall,re);let S={tread:[l[0]*re.top,l[1]*re.top,l[2]*re.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let w of u.length?u:[m])Ao(e,o.rowLevels,n.focal,o.landingY,S,w,g);return}let h=o.flat?1/0:Eo,d=g=>o.normalAt(g.x,g.y),p=o.flat?o.landingY:void 0;for(let g of i.subtract(m,p))ie(e,g,t.holes,f,c,l,s.tierWall,re,h,d)}function ta(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],f=o.get(s);f||(f=new Map,o.set(s,f));let u=l.rowId||`__seat-${a}`,m=f.get(u);m||(m={pts:[],levelM:0,n:0},f.set(u,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function Xo(e,t,n,r,o,i,a=!0){let s=ta(t,n,r);if(!s.length)return;let c=Wn(s,t.focal);c&&(e.setMaterial(0),Ho(e,c,{bottomY:t.baseHeightM,colors:{bandTop:ye(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ye(o.tierWall,1.15),shellWall:i??o.tierWall},ao:re,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}function Wo(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function jo(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var na=1.15,oa=3.25,ra=4.5,ia=.85,aa=.5,sa=.26;function Ko(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=na&&a.add("zone"),o<=(i?oa:ra)&&(a.add("section"),a.add("ga")),o<=ia&&(a.add("annotation"),a.add("booth")),o<=aa&&a.add("row"),o<=sa&&a.add("seat"),a}function Ve(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],f=o[2]*i+o[6]*a+o[10]*s+o[14],u=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(u>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/u,h=l/u,d=f/u,p=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&d<=1;return{x:(m*.5+.5)*n,y:(1-(h*.5+.5))*r,depth:d,visible:p}}function qo(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(gn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var ca=6;function gn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+ca):n;return o<a&&i<r}function Zo(e,t,n){return e.length*t*.58+(n?14:0)}var xn={row:8,seat:14};function Qo(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function vn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(gn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(gn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var la=6,ua=2.2,$o=.1,ma=.3,da=1.8,ha=.9,fa=.55,pa=6e3;function Jo(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let f of n)for(let u of f.objects)u.type==="section"&&u.zone&&c.set(u.id,u.zone);let l=new Map;for(let f=0;f<r.length;f++){let u=r[f],m=o.seatOwner[f],h=u.zoneId??(m?c.get(m):void 0);if(!h)continue;let d=l.get(h);d||(d={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(h,d)),d.n++,u.x<d.minX&&(d.minX=u.x),u.y<d.minY&&(d.minY=u.y),u.x>d.maxX&&(d.maxX=u.x),u.y>d.maxY&&(d.maxY=u.y),d.sumY+=o.seatDeckY(f)}for(let f of a){let u=l.get(f.id),m=[];for(let[h,d]of c)d===f.id&&m.push(h);if(!u||u.n===0){s.push({id:f.id,label:f.label,color:$(f.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??i).x*I,1.5,(f.focalPoint??i).y*I]});continue}s.push({id:f.id,label:f.label,color:$(f.color),sectionIds:m,seatCount:u.n,center:[(u.minX+u.maxX)/2*I,u.sumY/u.n,(u.minY+u.maxY)/2*I],radius:.5*Math.hypot((u.maxX-u.minX)*I,(u.maxY-u.minY)*I)||1,focalWorld:[(f.focalPoint??i).x*I,1.5,(f.focalPoint??i).y*I]})}}return s}function er(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],f=[],u=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+la,m.center[2]],color:t.zones?.find(h=>h.id===m.id)?.color});{let m=new Map,h=new Map;for(let d=0;d<r.length;d++){let p=o.seatOwner[d];if(!p)continue;let g=m.get(p);g||(g={n:0,x:0,y:0,deck:0},m.set(p,g)),g.n++,g.x+=r[d].x,g.y+=r[d].y,g.deck+=o.seatDeckY(d);let b=h.get(p);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,b)),r[d].x<b.minX&&(b.minX=r[d].x),r[d].x>b.maxX&&(b.maxX=r[d].x),r[d].y<b.minY&&(b.minY=r[d].y),r[d].y>b.maxY&&(b.maxY=r[d].y)}for(let d of n)for(let p of d.objects){if(p.type!=="section")continue;let g=m.get(p.id);if(!g||g.n===0)continue;let b=h.get(p.id),y=[g.x/g.n*I,g.deck/g.n,g.y/g.n*I],S=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:d.index,label:S,seatCount:g.n,center:y,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*I),focalWorld:[d.focal.x*I,d.baseHeightM+1.5,d.focal.y*I]});let w=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===S.trim().toLocaleLowerCase()||l.push({id:`section:${p.id}`,kind:"section",text:S,anchor:[y[0],y[1]+ua,y[2]],floorIndex:d.index})}}{for(let d of n)for(let p of d.objects){if(p.type!=="gaArea")continue;let g=st(p.points);if(!g)continue;let b=p.displayLabel||p.label||p.id;l.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${b} \xB7 ${p.capacity.toLocaleString()}`:b,anchor:[g.x*I,d.baseHeightM+da,g.y*I],floorIndex:d.index})}let m=new Map;for(let d=0;d<r.length;d++){let p=r[d],g=Math.hypot(p.x-c.x,p.y-c.y),b=m.get(p.rowId);(!b||g>b.far)&&m.set(p.rowId,{seat:p,index:d,far:g})}for(let[d,p]of m){let g=p.seat.label?p.seat.label.lastIndexOf("-"):-1,b=g>0?p.seat.label.slice(0,g):d;b&&l.push({id:`row:${d}`,kind:"row",text:b,anchor:[p.seat.x*I,o.seatDeckY(p.index)+ha,p.seat.y*I],floorIndex:a[p.index]})}let h=new Map;for(let d=0;d<r.length;d++){let p=r[d],g=p.label?p.label.lastIndexOf("-"):-1,b=h.get(p.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:g>0?p.label.slice(0,g):p.rowId,sectionId:p.sectionId},h.set(p.rowId,b));let y=d*3,S=i.iPosition[y],w=i.iPosition[y+1],P=i.iPosition[y+2];b.n++,b.x+=S,b.y+=w,b.z+=P,b.minX=Math.min(b.minX,S),b.maxX=Math.max(b.maxX,S),b.minZ=Math.min(b.minZ,P),b.maxZ=Math.max(b.maxZ,P)}for(let[d,p]of h)u.push({id:d,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=pa)for(let d=0;d<r.length;d++){let p=r[d],g=p.displayLabel||p.label;g&&l.push({id:`seat:${p.id}`,kind:"seat",text:g,anchor:[p.x*I,o.seatDeckY(d)+fa,p.y*I],floorIndex:a[d]})}}for(let m of n)for(let h of m.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let d=We(h),p=d?st(d):null;if(!p||!h.label)continue;l.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*I,m.baseHeightM+pt(h).heightM+$o,p.y*I],color:h.fill,floorIndex:m.index})}else if(h.type==="text"){if(!h.text)continue;l.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*I,m.baseHeightM+$o,h.position.y*I],color:h.color,rotation:h.rotation,floorIndex:m.index})}else if(h.type==="booth"){let d=yt(h);if(!d)continue;let p=st(d);if(!p)continue;l.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*I,m.baseHeightM+pn+ma,p.y*I],floorIndex:m.index})}return{labels:l,sections:f,rows:u}}function tr(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function nr(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*3,p=l[h];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let f=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&f.set(h.id,m);let u=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let h=o.seatOwner[m],d=(h!==null?f.get(h):void 0)??a[m];if(d===void 0)continue;let p=u[d],g=r[m];p.n++,g.x<p.minX&&(p.minX=g.x),g.y<p.minY&&(p.minY=g.y),g.x>p.maxX&&(p.maxX=g.x),g.y>p.maxY&&(p.maxY=g.y);let b=o.seatDeckY(m);p.sumX+=g.x*I,p.sumDeck+=b,p.sumZ+=g.y*I,p.minDeck=Math.min(p.minDeck,b),p.maxDeck=Math.max(p.maxDeck,b+1.6),s[m]=d}for(let m=0;m<n.length;m++){let h=u[m],d=t.floors?.[m],p=l[m],g=Math.min(h.n?h.minX*I:n[m].focal.x*I-1,Number.isFinite(p.minX)?p.minX:1/0),b=Math.max(h.n?h.maxX*I:n[m].focal.x*I+1,Number.isFinite(p.maxX)?p.maxX:-1/0),y=Math.min(h.n?h.minY*I:n[m].focal.y*I-1,Number.isFinite(p.minZ)?p.minZ:1/0),S=Math.max(h.n?h.maxY*I:n[m].focal.y*I+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),P=Math.max(h.n?Math.max(h.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),x=[h.n?h.sumX/h.n:(g+b)/2,h.n?h.sumDeck/h.n:(w+P)/2,h.n?h.sumZ/h.n:(y+S)/2],A=Math.max(1,.5*Math.hypot(b-g,P-w,S-y));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:x,radius:A,box:{min:[g,w,y],max:[b,P,S]},focalWorld:[n[m].focal.x*I,n[m].baseHeightM+1.5,n[m].focal.y*I]})}}return c}function Mn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=yt(c);if(l)for(let f of l)a(f.x,f.y)}else if(c.type==="table"){let l=bn(c);if(l)for(let f of l)a(f.x,f.y)}else if(c.type==="decorImage"){let l=yn(c);if(l)for(let f of l)a(f.x,f.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function or(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=ft(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ie(e,s,void 0,()=>0,-.4,i.ground,i.ground,re)}else{let a=t.reduce((h,d)=>d.baseHeightM<h.baseHeightM?d:h);e.setFloor(a.index);let s=n.filter((h,d)=>r[d]===a.index),c=Mn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),f=Math.max(28,Math.min(80,l*.04)),u=ft(c.minX-f,c.minY-f,c.maxX-c.minX+f*2,c.maxY-c.minY+f*2),m=a.baseHeightM-.03;ie(e,u,void 0,()=>m,m-.22,i.ground,i.ground,re)}}function rr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,f=-1/0,u=-1/0,m=(p,g,b)=>{a=Math.min(a,p),l=Math.max(l,p),s=Math.min(s,g),f=Math.max(f,g),c=Math.min(c,b),u=Math.max(u,b)};for(let p=0;p<e.position.length;p+=3)m(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let g=p*3,b=t.iPosition[g],y=t.iPosition[g+1],S=t.iPosition[g+2],w=Math.max(.35,t.iMaxRadius[p]??.35);m(b-w,y,S-w),m(b+w,y+1.6,S+w)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,f=i*.16,c=o-i,u=o+i);let h=[(a+l)/2,(s+f)/2,(c+u)/2],d=Math.max(1,.5*Math.hypot(l-a,f-s,u-c));return{center:h,radius:d,minY:s,maxY:f}}function ir(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let w=0;w<e.count;w++){let P=w*3,x=e.iPosition[P],A=e.iPosition[P+2];x<a&&(a=x),x>c&&(c=x),A<s&&(s=A),A>l&&(l=A)}for(let w of t)a=Math.min(a,w.cx-w.halfX),c=Math.max(c,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),l=Math.max(l,w.cz+w.halfZ);let f=n.minX*I,u=n.maxX*I,m=n.minY*I,h=n.maxY*I,d=f,p=u,g=m,b=h;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(c-a,l-s));d=Math.max(f,a-w),p=Math.min(u,c+w),g=Math.max(m,s-w),b=Math.min(h,l+w)}let y=Math.min(0,r),S=Math.max(o,i*.05);return{min:[d,y,g],max:[p,S,b]}}function ar(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=On(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let u of n)for(let m of u.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:u});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(u=>{let m=u.runtimeContentImageUrl;return[u.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),l=[];for(let u of o.value.overlay.productionElements??[]){let m=i.get(u.objectId),h=m?We(m.shape):null,d=u.baseElevationM??0;if(!m||!h||h.length<3||!u.id||a.has(u.id)||s.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(d)||d<-10||d>100)return r();a.add(u.id),s.add(u.objectId);let p=h.map(T=>T.x*I),g=h.map(T=>T.y*I),b=m.unit.baseHeightM+d,y=Math.min(...p),S=Math.max(...p),w=Math.min(...g),P=Math.max(...g),x,A=c.get(u.id)??u.contentImageUrl;if(u.kind==="screen"&&A)if(S-y>=P-w){let T=Math.abs(w-m.unit.focal.y*I)<=Math.abs(P-m.unit.focal.y*I)?w-.006:P+.006;x=[[y,b,T],[S,b,T],[y,b+u.heightM,T],[S,b+u.heightM,T]]}else{let T=Math.abs(y-m.unit.focal.x*I)<=Math.abs(S-m.unit.focal.x*I)?y-.006:S+.006;x=[[T,b,w],[T,b,P],[T,b+u.heightM,w],[T,b+u.heightM,P]]}l.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:m.unit.index,baseY:b,topY:b+u.heightM,bounds:{min:[y,b,w],max:[S,b+u.heightM,P]},occlusion:u.occlusion,...A?{contentImageUrl:A}:{},...x?{contentPlane:x}:{}})}let f=l.sort((u,m)=>u.id.localeCompare(m.id));return{byObjectId:new Map(f.map(u=>[u.objectId,u])),elements:f}}function fe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function he(e){return Array.isArray(e)?e:[]}function ba(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!fe(n))continue;let r=fe(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function zt(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function ya(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ga(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function xa(e){let t=zt(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:zt(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:zt(e.rotation,4),o=e.scale===void 0?[1,1,1]:zt(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let f=i/l,u=a/l,m=s/l,h=c/l,d=f+f,p=u+u,g=m+m,b=f*d,y=f*p,S=f*g,w=u*p,P=u*g,x=m*g,A=h*d,T=h*p,_=h*g;return[(1-(w+x))*o[0],(y+_)*o[0],(S-T)*o[0],0,(y-_)*o[1],(1-(b+x))*o[1],(P+A)*o[1],0,(S+T)*o[2],(P-A)*o[2],(1-(b+w))*o[2],0,n[0],n[1],n[2],1]}function va(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function Ma(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],f=i*l-a*c,u=a*s-o*l,m=o*c-i*s,h=t*f+n*u+r*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[f*d,u*d,m*d,(r*c-n*l)*d,(t*l-r*s)*d,(n*s-t*c)*d,(n*a-r*i)*d,(r*o-t*a)*d,(t*i-n*o)*d]}function sr(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function wa(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!fe(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Sa(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Pa(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Aa(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Ra(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=wa(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!fe(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=he(r.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||ba(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||he(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(he(r.images).length||he(r.textures).length)return{ok:!1,issue:"external_resource"};let a=he(r.buffers);if(a.length!==1||!fe(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=he(r.accessors),c=he(r.bufferViews),l=he(r.meshes),f=he(r.nodes),u=he(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!fe(u[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),d=(w,P,x)=>{if(typeof w!="number"||!Number.isInteger(w)||!fe(s[w]))return null;let A=s[w];if(A.type!==P||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!x.includes(A.componentType)||typeof A.bufferView!="number")return null;let T=c[A.bufferView];if(!fe(T)||T.buffer!==0||typeof T.byteLength!="number"||!Number.isInteger(T.byteLength)||T.byteLength<0)return null;let _=Pa(A.type),N=Sa(A.componentType),O=typeof T.byteStride=="number"?T.byteStride:_*N,M=typeof T.byteOffset=="number"?T.byteOffset:0,C=typeof A.byteOffset=="number"?A.byteOffset:0,k=M+C,v=C+(A.count-1)*O+_*N;if(!Number.isInteger(O)||!Number.isInteger(M)||!Number.isInteger(C)||O<_*N||M<0||C<0||M+T.byteLength>o.byteLength||v>T.byteLength)return null;let F=[];for(let V=0;V<A.count;V++){let R=[];for(let E=0;E<_;E++){let D=Aa(h,k+V*O+E*N,A.componentType);if(!Number.isFinite(D))return null;R.push(D)}F.push(R)}return F},p=[],g=[],b=0,y=new Set,S=(w,P)=>{if(typeof w!="number"||!Number.isInteger(w)||!fe(f[w])||y.has(w))return!1;y.add(w);let x=f[w],A=xa(x);if(!A)return!1;let T=ga(P,A),_=Ma(T);if(!_)return!1;if(x.mesh!==void 0){if(typeof x.mesh!="number")return!1;let N=l[x.mesh];if(!fe(N))return!1;for(let O of he(N.primitives)){if(!fe(O)||O.mode!==void 0&&O.mode!==4||!fe(O.attributes))return!1;let M=d(O.attributes.POSITION,"VEC3",[5126]),C=O.attributes.NORMAL===void 0?null:d(O.attributes.NORMAL,"VEC3",[5126]);if(!M||O.attributes.NORMAL!==void 0&&!C)return!1;let k=M.length;if(O.indices!==void 0){let F=typeof O.indices=="number"?s[O.indices]:null;k=fe(F)?F.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(b+=k/3,b>1e5))return!1;let v=O.indices===void 0?M.map((F,V)=>[V]):d(O.indices,"SCALAR",[5121,5123,5125]);if(!v||v.length%3!==0||v.length!==k)return!1;for(let F=0;F<v.length;F+=3){let V=[v[F][0],v[F+1][0],v[F+2][0]];if(V.some(D=>!Number.isInteger(D)||D<0||D>=M.length))return!1;let R=V.map(D=>va(T,...M[D])),E=null;if(!C){let D=R[1][0]-R[0][0],X=R[1][1]-R[0][1],H=R[1][2]-R[0][2],W=R[2][0]-R[0][0],z=R[2][1]-R[0][1],G=R[2][2]-R[0][2];E=sr([1,0,0,0,1,0,0,0,1],X*G-H*z,H*W-D*G,D*z-X*W)}for(let D=0;D<3;D++)p.push(...R[D]),g.push(...C?sr(_,...C[V[D]]):E)}}}for(let N of he(x.children))if(!S(N,T))return!1;return y.delete(w),!0};for(let w of he(u[m].nodes))if(!S(w,ya()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||p.length!==b*9||g.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(p),normal:new Float32Array(g)}}function cr(e){try{return Ra(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function gt(e){let{doc:t}=e,n=ho(t.theme),r=n.structure,o=Io(t,e.eventConfigurationId??t.eventConfigurationId),i=ar(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new Lt,c=null;if(e.registeredShellGlb){let v=cr(e.registeredShellGlb);if(v.ok){let F=v.position.length/3,V=new Float32Array(v.position.length),R=n.materials.shell??r.tierWall;for(let E=0;E<F;E++){let D=v.normal[E*3+1],X=D<-.25?.4:.62+.38*Math.max(0,D);V[E*3]=R[0]*X,V[E*3+1]=R[1]*X,V[E*3+2]=R[2]*X}c={position:v.position,normal:v.normal,color:V,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let l=new Map;for(let v of o)for(let F of v.objects)l.set(F.id,v.index),F.type==="section"&&l.set(F.logicalSectionId??F.id,v.index);let f=a.map(v=>l.get(v.sectionId??"")??l.get(v.rowId??"")??0),u=Mn(o,a);or(s,o,a,f,u,r);let m=ko(t,a),h=new Map,d=new Map;for(let v of t.categories??[])h.set(v.key,v.color),v.seatGlyph&&d.set(v.key,v.seatGlyph);let p=[],g=Do(o,a,f),b=new Float32Array(a.length);for(let v=0;v<o.length;v++){let F=o[v];s.setFloor(v);let V=new Gt,R=[],E=F.objects.filter(D=>D.type==="section"&&!!D.outline&&D.outline.length>=3);for(let D of F.objects)if(D.type==="section")Yo(s,D,F,_o(D,m),g.bySection.get(D.id),V,E,r);else if(D.type==="shape"){let X=i.byObjectId.get(D.id);s.setMaterial((X?.kind??D.role)==="screen"?1:0),Go(s,D,F.baseHeightM,Lo(D,R),r,F.focal,p,X),s.setMaterial(0)}else D.type==="gaArea"?Uo(s,D,F.baseHeightM,$(h.get(D.categoryKey)),r):D.type==="booth"?Vo(s,D,F.baseHeightM,$(h.get(D.categoryKey)),r):D.type==="table"?No(s,D,F.baseHeightM,$(h.get(D.categoryKey)),r):D.type==="decorImage"&&zo(s,D,F.baseHeightM,r);Xo(s,F,a,g,r,n.materials.shell,!c)}let y=o.length>1?{x:o.reduce((v,F)=>v+F.focal.x,0)/o.length,y:o.reduce((v,F)=>v+F.focal.y,0)/o.length}:t.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},S=ao(c?[s.build(),c]:[s.build()]),w=mo(a,e.initialState,g,b,h,d),P=Jo({doc:t,units:o,seats:a,surfaces:g,focal:y}),{labels:x,sections:A,rows:T}=er({doc:t,units:o,seats:a,surfaces:g,seatData:w,hintedSeatFloor:f,zones:P,focal:y}),_=nr({doc:t,units:o,seats:a,surfaces:g,solids:S,hintedSeatFloor:f,seatFloor:b});tr(x,_),w.iYaw=lo(w.iPosition,a.length,v=>a[v].rowId,v=>{let F=o[b[v]]?.focal??y;return[F.x*I,F.y*I]});let N=(u.minX+u.maxX)/2*I,O=(u.minY+u.maxY)/2*I,M=.5*Math.hypot((u.maxX-u.minX)*I,(u.maxY-u.minY)*I)||10,C=rr(S,w,{cx:N,cz:O,radius:M}),k=ir(w,p,u,C.minY,C.maxY,M);return{solids:S,seats:w,bounds:{center:[(k.min[0]+k.max[0])/2,(k.min[1]+k.max[1])/2,(k.min[2]+k.max[2])/2],radius:M,groundY:0,box:k},renderBounds:{center:C.center,radius:C.radius},stateColorLUT:fo(n,xe),theme:n,seatCount:a.length,focalWorld:[y.x*I,1.5,y.y*I],zones:P,stages:p,productionElements:i.elements,sections:A,rows:T,labels:x,floors:_}}var Ca=88,Ia=20,lr={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},Ut=new Set(["row","seat"]),ur={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ht={row:{x:62,y:16},seat:{x:46,y:18}},mr=$,wn=e=>Gn(e);function dr(e,t){let n=wn(e),r=wn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Sn(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Fa(e,t=[.04,.06,.1],n=!0){let r=wn(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Sn(i,t):t,s=mr(e),c=n?7:4.5,l=s&&dr(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var Yt=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=Ko(o,i,{hasZoneLabels:this.labels.some(y=>y.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let y of this.labels){if(!s.has(y.kind))continue;let S=Ve(t,y.anchor,n,r);if(!S.visible)continue;let w=a?Math.hypot(y.anchor[0]-a[0],y.anchor[1]-a[1],y.anchor[2]-a[2]):1;c.push({label:y,screen:S,focus:Qo(S,w,n,r),halfWidth:Zo(y.text,lr[y.kind].size,!Ut.has(y.kind))/2,...this.selectedSeatLabelIds.has(y.id)?{priority:1}:{}})}let l=jo(c.filter(y=>y.label.kind==="floor"),n),f=[...c.filter(y=>!Ut.has(y.label.kind)&&y.label.kind!=="floor"),...l],u=qo(f,Ca,Ia),m=vn(c.filter(y=>y.label.kind==="row"),Ht.row.x,Ht.row.y,xn.row,u),h=vn(c.filter(y=>y.label.kind==="seat"),Ht.seat.x,Ht.seat.y,xn.seat,[...u,...m]),d=[...u,...m,...h],p=new Set(d.map(y=>y.label.id));for(let{label:y,screen:S}of d){let P=this.nodeFor(y).style;P.display="",P.transform=`translate(-50%, -50%) translate(${S.x.toFixed(1)}px, ${S.y.toFixed(1)}px)`}let g=d.filter(({label:y})=>!Ut.has(y.kind)).sort((y,S)=>ur[S.label.kind]-ur[y.label.kind]||y.screen.depth-S.screen.depth||y.focus-S.focus),b=[];for(let{label:y}of g){let S=this.nodes.get(y.id);if(!S||S.style.display==="none")continue;let w=S.getBoundingClientRect();b.some(x=>w.left<x.right+3&&w.right+3>x.left&&w.top<x.bottom+3&&w.bottom+3>x.top)?S.style.display="none":b.push(w)}for(let[y,S]of this.nodes)p.has(y)||(S.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let u=n.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=lr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!Ut.has(t.kind),s=Fa(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=mr(r?"#ecf8ff":s.ink)??[1,1,1],f=r?Sn("rgba(10,28,45,.9)",c):a?Sn(s.backing,c):c;return n.dataset.qualityContrast=dr(l,f).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Ta=1;var Ea=new Set(["floor","zone","section","ga","booth","annotation"]);function Da(e){return e.every(t=>Number.isFinite(t))}function ka(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function hr(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Ke(e){return Math.round(e*1e4)/1e4}function _a(e){if(e)return{box:{x:Ke(e.box.x),y:Ke(e.box.y),width:Ke(e.box.width),height:Ke(e.box.height)},horizontalFillRatio:Ke(e.horizontalFillRatio),verticalFillRatio:Ke(e.verticalFillRatio),visibleAreaRatio:Ke(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Re(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Pn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Ea.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)ka(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Re("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Re("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Re("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Re("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Re("camera-invalid","The capture camera must have a finite physical pose",Da(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Re("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Re("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Re("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Re("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Re("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:_a(e.framing)},metrics:{minimumHierarchyFontPx:hr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:hr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}import{Geometry as xt,Mesh as vt,Program as qa,Texture as Za,Transform as Sr}from"ogl";import{Program as qe}from"ogl";var Xt=`
|
|
2
2
|
float chairWeight(float depth) {
|
|
3
3
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
4
|
-
}`,
|
|
4
|
+
}`,fr=`
|
|
5
5
|
float occupantWeight(float depth) {
|
|
6
|
-
float nearWeight = smoothstep(${
|
|
7
|
-
float farWeight = 1.0 - smoothstep(${
|
|
6
|
+
float nearWeight = smoothstep(${eo.toFixed(1)}, ${to.toFixed(1)}, depth);
|
|
7
|
+
float farWeight = 1.0 - smoothstep(${$n.toFixed(1)}, ${Jn.toFixed(1)}, depth);
|
|
8
8
|
return nearWeight * farWeight;
|
|
9
|
-
}`,
|
|
9
|
+
}`,pr=`
|
|
10
10
|
float glyphEq(float glyph, float expected) {
|
|
11
11
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
12
12
|
}
|
|
@@ -55,7 +55,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
|
|
|
55
55
|
p.y += 0.16;
|
|
56
56
|
}
|
|
57
57
|
return p;
|
|
58
|
-
}`,
|
|
58
|
+
}`,La=`#version 300 es
|
|
59
59
|
precision highp float;
|
|
60
60
|
in vec3 position;
|
|
61
61
|
in vec3 normal;
|
|
@@ -78,7 +78,9 @@ out float vMaterial;
|
|
|
78
78
|
void main() {
|
|
79
79
|
// Per-floor isolation without splitting the merged mesh into a draw call per
|
|
80
80
|
// floor. The fragment pass removes non-focused floors for a clean level view.
|
|
81
|
-
|
|
81
|
+
// A registered venue-wide shell uses floor -2 and remains context while a
|
|
82
|
+
// buyer focuses an individual level. Ordinary authored solids stay scoped.
|
|
83
|
+
vDim = (floorIndex < -1.5 || uFocusFloor < -0.5 || abs(floorIndex - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
82
84
|
vMaterial = materialIndex;
|
|
83
85
|
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
84
86
|
vec4 mv = modelViewMatrix * vec4(position, 1.0);
|
|
@@ -91,7 +93,7 @@ void main() {
|
|
|
91
93
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
92
94
|
vColor = color;
|
|
93
95
|
gl_Position = projectionMatrix * mv;
|
|
94
|
-
}`,
|
|
96
|
+
}`,Oa=`#version 300 es
|
|
95
97
|
precision highp float;
|
|
96
98
|
in vec3 vColor;
|
|
97
99
|
in vec3 vNormalWorld;
|
|
@@ -102,6 +104,7 @@ in float vDim;
|
|
|
102
104
|
in float vMaterial;
|
|
103
105
|
uniform vec3 uKeyDir; // WORLD space, unit, points at the light
|
|
104
106
|
uniform float uStructureDetail;
|
|
107
|
+
uniform float uRoughness;
|
|
105
108
|
out vec4 fragColor;
|
|
106
109
|
void main() {
|
|
107
110
|
if (vDim > 0.5) discard;
|
|
@@ -132,7 +135,12 @@ void main() {
|
|
|
132
135
|
float fill = max(dot(N, fillDir), 0.0);
|
|
133
136
|
vec3 base = vColorRung * (0.52 + 0.34 * hemi) + vColorRung * key * 0.34 + vColorRung * fill * 0.10;
|
|
134
137
|
float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
|
|
135
|
-
|
|
138
|
+
// Material 1 is a powered display and keeps its authored emission treatment.
|
|
139
|
+
// Every architectural material uses the venue roughness token; 0.78 maps to
|
|
140
|
+
// exactly the historical rim strength so an unthemed chart does not shift.
|
|
141
|
+
float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
|
|
142
|
+
float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
|
|
143
|
+
base += vec3(0.26, 0.31, 0.38) * fres * 0.35 * sheen; // cool rim, restrained
|
|
136
144
|
// Bright, saturated authored screen faces should read as powered displays,
|
|
137
145
|
// not painted slabs. Vertex colour is deliberately the material signal here:
|
|
138
146
|
// muted tiers and structure never cross these thresholds. The broad waves
|
|
@@ -158,7 +166,7 @@ void main() {
|
|
|
158
166
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
159
167
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
160
168
|
fragColor = vec4(base, 1.0);
|
|
161
|
-
}`,
|
|
169
|
+
}`,Ba=`#version 300 es
|
|
162
170
|
precision highp float;
|
|
163
171
|
in vec2 position; // quad corner in [-1,1]
|
|
164
172
|
in vec3 iOffset; // per-instance world position
|
|
@@ -184,7 +192,7 @@ out float vDim;
|
|
|
184
192
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
185
193
|
out float vPhysicalSeat;
|
|
186
194
|
out float vPixelRadius;
|
|
187
|
-
${
|
|
195
|
+
${Xt}
|
|
188
196
|
void main() {
|
|
189
197
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
190
198
|
float depth = max(-mv.z, 0.001);
|
|
@@ -217,7 +225,7 @@ void main() {
|
|
|
217
225
|
vPhysicalSeat = iPhysicalSeat;
|
|
218
226
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
219
227
|
gl_Position = projectionMatrix * mv;
|
|
220
|
-
}`,
|
|
228
|
+
}`,Va=`#version 300 es
|
|
221
229
|
precision highp float;
|
|
222
230
|
in vec2 vUv;
|
|
223
231
|
in vec3 vColor;
|
|
@@ -230,6 +238,7 @@ in float vPixelRadius;
|
|
|
230
238
|
uniform float uSeatFade; // fade toward tier colour with distance (LOD)
|
|
231
239
|
uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/seat
|
|
232
240
|
uniform vec3 uFadeColor;
|
|
241
|
+
uniform float uRoughness;
|
|
233
242
|
out vec4 fragColor;
|
|
234
243
|
void main() {
|
|
235
244
|
if (vDim > 0.5) discard;
|
|
@@ -275,7 +284,7 @@ void main() {
|
|
|
275
284
|
alpha *= vDotWeight;
|
|
276
285
|
if (alpha <= 0.0) discard;
|
|
277
286
|
fragColor = vec4(c, alpha);
|
|
278
|
-
}`,
|
|
287
|
+
}`,Na=`#version 300 es
|
|
279
288
|
precision highp float;
|
|
280
289
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
281
290
|
in vec3 normal;
|
|
@@ -306,9 +315,9 @@ out vec3 vRing;
|
|
|
306
315
|
out float vDim;
|
|
307
316
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
308
317
|
out vec3 vOccupantTint;
|
|
309
|
-
${
|
|
310
|
-
${
|
|
311
|
-
${
|
|
318
|
+
${Xt}
|
|
319
|
+
${fr}
|
|
320
|
+
${pr}
|
|
312
321
|
void main() {
|
|
313
322
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
314
323
|
float viewDepth = -anchor.z;
|
|
@@ -394,7 +403,7 @@ void main() {
|
|
|
394
403
|
vRing = iRing;
|
|
395
404
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
396
405
|
gl_Position = projectionMatrix * mv;
|
|
397
|
-
}`,
|
|
406
|
+
}`,Ga=`#version 300 es
|
|
398
407
|
precision highp float;
|
|
399
408
|
in vec3 vColor;
|
|
400
409
|
in vec3 vNormalWorld;
|
|
@@ -408,6 +417,7 @@ in float vOccupant;
|
|
|
408
417
|
in vec3 vOccupantTint;
|
|
409
418
|
uniform vec3 uKeyDir;
|
|
410
419
|
uniform vec3 uFadeColor;
|
|
420
|
+
uniform float uRoughness;
|
|
411
421
|
out vec4 fragColor;
|
|
412
422
|
void main() {
|
|
413
423
|
if (vDim > 0.5) discard;
|
|
@@ -447,16 +457,17 @@ void main() {
|
|
|
447
457
|
float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
|
|
448
458
|
// A brighter rim than the solids get: it picks out every chair's own edge,
|
|
449
459
|
// which is what stops a block of them merging into one mass up close.
|
|
450
|
-
|
|
460
|
+
float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
|
|
461
|
+
base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
|
|
451
462
|
fragColor = vec4(base, 1.0);
|
|
452
|
-
}`,
|
|
463
|
+
}`,za=`#version 300 es
|
|
453
464
|
precision highp float;
|
|
454
465
|
in vec2 position;
|
|
455
466
|
out vec2 vUv;
|
|
456
467
|
void main() {
|
|
457
468
|
vUv = position * 0.5 + 0.5;
|
|
458
469
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
459
|
-
}`,
|
|
470
|
+
}`,Ua=`#version 300 es
|
|
460
471
|
precision highp float;
|
|
461
472
|
in vec2 vUv;
|
|
462
473
|
uniform vec3 uTop;
|
|
@@ -467,7 +478,7 @@ void main() {
|
|
|
467
478
|
vec2 c = vUv - 0.5;
|
|
468
479
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
469
480
|
fragColor = vec4(col * vig, 1.0);
|
|
470
|
-
}`,
|
|
481
|
+
}`,Ha=`#version 300 es
|
|
471
482
|
precision highp float;
|
|
472
483
|
in vec2 position;
|
|
473
484
|
in vec3 iOffset;
|
|
@@ -488,7 +499,7 @@ out float vPhysicalSeat;
|
|
|
488
499
|
out float vDotWeight;
|
|
489
500
|
out float vHidden;
|
|
490
501
|
flat out vec3 vPick;
|
|
491
|
-
${
|
|
502
|
+
${Xt}
|
|
492
503
|
void main() {
|
|
493
504
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
494
505
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -504,7 +515,7 @@ void main() {
|
|
|
504
515
|
vPhysicalSeat = iPhysicalSeat;
|
|
505
516
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
506
517
|
gl_Position = projectionMatrix * mv;
|
|
507
|
-
}`,
|
|
518
|
+
}`,Ya=`#version 300 es
|
|
508
519
|
precision highp float;
|
|
509
520
|
in vec2 vUv;
|
|
510
521
|
in float vPhysicalSeat;
|
|
@@ -518,7 +529,7 @@ void main() {
|
|
|
518
529
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
519
530
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
520
531
|
fragColor = vec4(vPick, 1.0);
|
|
521
|
-
}`,
|
|
532
|
+
}`,Xa=`#version 300 es
|
|
522
533
|
precision highp float;
|
|
523
534
|
in vec3 position;
|
|
524
535
|
in float part;
|
|
@@ -539,9 +550,9 @@ uniform float uBackBase;
|
|
|
539
550
|
uniform float uFocusFloor;
|
|
540
551
|
flat out vec3 vPick;
|
|
541
552
|
out float vHidden;
|
|
542
|
-
${
|
|
543
|
-
${
|
|
544
|
-
${
|
|
553
|
+
${Xt}
|
|
554
|
+
${fr}
|
|
555
|
+
${pr}
|
|
545
556
|
void main() {
|
|
546
557
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
547
558
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -574,7 +585,7 @@ void main() {
|
|
|
574
585
|
float c = cos(iYaw), s = sin(iYaw);
|
|
575
586
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
576
587
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
577
|
-
}`,
|
|
588
|
+
}`,Wa=`#version 300 es
|
|
578
589
|
precision highp float;
|
|
579
590
|
flat in vec3 vPick;
|
|
580
591
|
in float vHidden;
|
|
@@ -582,7 +593,7 @@ out vec4 fragColor;
|
|
|
582
593
|
void main() {
|
|
583
594
|
if (vHidden > 0.5) discard;
|
|
584
595
|
fragColor = vec4(vPick, 1.0);
|
|
585
|
-
}`,
|
|
596
|
+
}`,ja=`#version 300 es
|
|
586
597
|
precision highp float;
|
|
587
598
|
in vec3 position;
|
|
588
599
|
in float floorIndex;
|
|
@@ -593,11 +604,19 @@ out float vHidden;
|
|
|
593
604
|
void main() {
|
|
594
605
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
595
606
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
596
|
-
}`,
|
|
607
|
+
}`,Ka=`#version 300 es
|
|
597
608
|
precision highp float;
|
|
598
609
|
in float vHidden;
|
|
599
610
|
out vec4 fragColor;
|
|
600
611
|
void main() {
|
|
601
612
|
if (vHidden > 0.5) discard;
|
|
602
613
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
603
|
-
}`;function mr(t){return new je(t,{vertex:Ra,fragment:Ia,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ce},uSeatScale:{value:1},uMinPixels:{value:Qe},uPixelToWorld:{value:.002},uChairFull:{value:lt},uChairNone:{value:$e},uFocusFloor:{value:-1}}})}function dr(t){return new je(t,{vertex:Fa,fragment:Ta,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:lt},uChairNone:{value:$e},uBackRake:{value:an},uBackBase:{value:_t},uFocusFloor:{value:-1}}})}function hr(t){return new je(t,{vertex:Ea,fragment:Da,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function pr(t){return new je(t,{vertex:ga,fragment:va,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function fr(t){return new je(t,{vertex:Ma,fragment:Sa,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Ce},uSeatScale:{value:1},uMinPixels:{value:Qe},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:lt},uChairNone:{value:$e}}})}function br(t){return new je(t,{vertex:wa,fragment:Pa,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:lt},uChairNone:{value:$e},uBackRake:{value:an},uBackBase:{value:_t},uFocusFloor:{value:-1}}})}function yr(t,e,n){return new je(t,{vertex:Ca,fragment:Aa,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}function gr(t,e,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&e[a]===0?null:o[e[a]]??o[0];t[a*3]=c?c[0]:i[a*3],t[a*3+1]=c?c[1]:i[a*3+1],t[a*3+2]=c?c[2]:i[a*3+2]}}var ka=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),_a=new Float32Array([-1,-1,3,-1,-1,3]);function vr(t,e){let n=new xr,r=new xr,o=new Gt(t,{position:{size:2,data:_a}}),i=yr(t,e.theme.background.top,e.theme.background.bottom),a=new Ht(t,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new Gt(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),c=pr(t),l=new Ht(t,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=fr(t),p=new Float32Array(e.seats.count*3),m=ye.map(S=>e.theme.seatStates[S]);gr(p,e.seats.iState,0,e.seats.count,m,e.seats.iCategory);let d=new Gt(t,{position:{size:2,data:ka},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:p,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1}}),h=new Ht(t,{geometry:d,program:u});h.frustumCulled=!1,e.seats.count>0&&h.setParent(n);let f=d.attributes.iColor,x=io(),y=br(t),b=It,M=new Float32Array(b*3),C=new Float32Array(b*3),P=new Float32Array(b),g=new Float32Array(b),T=new Float32Array(b),E=new Float32Array(b*3),L=new Float32Array(b),G=new Float32Array(b),N=new Float32Array(b),v=new Float32Array(b),A=new Gt(t,{position:{size:3,data:x.position},normal:{size:3,data:x.normal},part:{size:1,data:x.part},index:{data:x.index},iOffset:{size:3,data:M,instanced:1},iColor:{size:3,data:C,instanced:1},iRadius:{size:1,data:P,instanced:1},iYaw:{size:1,data:g,instanced:1},iGlyph:{size:1,data:T,instanced:1},iRing:{size:3,data:E,instanced:1},iFloor:{size:1,data:L,instanced:1},iPhysicalSeat:{size:1,data:G,instanced:1},iSeed:{size:1,data:v,instanced:1},iPickIndex:{size:1,data:N,instanced:1}}),F=new Ht(t,{geometry:A,program:y});F.frustumCulled=!1;let w=0,_=new Int32Array(0),U=()=>{let S=e.seats;for(let D=0;D<w;D++){let H=_[D];v[D]=so(S.iState[H],H);let z=S.iCategory&&S.iState[H]===0?null:m[S.iState[H]]??m[0];if(z)C[D*3]=z[0],C[D*3+1]=z[1],C[D*3+2]=z[2];else{let O=Wn([S.iCategory[H*3],S.iCategory[H*3+1],S.iCategory[H*3+2]]);C[D*3]=O[0],C[D*3+1]=O[1],C[D*3+2]=O[2]}}A.attributes.iColor.needsUpdate=!0,A.attributes.iSeed.needsUpdate=!0},I={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:d,chairGeometry:A,solidGeometry:s,drawCalls:3,setNearSeats(S,D){let H=Math.min(D,b);if(_=S,w=H,H===0){F.parent&&F.setParent(null),A.instancedCount=0,I.drawCalls=3;return}let V=e.seats;for(let z=0;z<H;z++){let O=S[z];M[z*3]=V.iPosition[O*3],M[z*3+1]=V.iPosition[O*3+1],M[z*3+2]=V.iPosition[O*3+2],P[z]=V.iChairWidth[O],g[z]=V.iYaw[O],T[z]=V.iGlyph[O],E[z*3]=V.iRing[O*3],E[z*3+1]=V.iRing[O*3+1],E[z*3+2]=V.iRing[O*3+2],L[z]=V.iFloor[O],G[z]=V.iPhysicalSeat[O],N[z]=O+1}U(),A.attributes.iOffset.needsUpdate=!0,A.attributes.iRadius.needsUpdate=!0,A.attributes.iYaw.needsUpdate=!0,A.attributes.iGlyph.needsUpdate=!0,A.attributes.iRing.needsUpdate=!0,A.attributes.iFloor.needsUpdate=!0,A.attributes.iPhysicalSeat.needsUpdate=!0,A.attributes.iSeed.needsUpdate=!0,A.attributes.iPickIndex.needsUpdate=!0,A.instancedCount=H,F.parent||F.setParent(n),I.drawCalls=4},nearSeatCount(){return w},uploadSeatStateRuns(S){if(!S.length)return;w&&U();for(let H of S)gr(p,e.seats.iState,H.start,H.length,m,e.seats.iCategory);let D=f.buffer;if(!D){f.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,D);for(let H of S){let V=p.subarray(H.start*3,(H.start+H.length)*3);t.bufferSubData(t.ARRAY_BUFFER,H.start*3*Float32Array.BYTES_PER_ELEMENT,V)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),d.remove(),u.remove(),A.remove(),y.remove()}};return I}import{Mesh as Sn,RenderTarget as Ba,Transform as wn}from"ogl";function La(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function Mr(t,e,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<e;l++){let u=(c*e+l)*4,p=La(t[u],t[u+1],t[u+2]);if(p<0||p>=i)continue;let m=l-r,d=c-o,h=m*m+d*d;h<s&&(s=h,a=p)}return a}function Sr(t,e,n,r,o,i){let a=t-n.left,s=e-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var Oa=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Ut=class{constructor(e,n,r,o,i){this.seatScene=new wn;this.chairScene=new wn;this.solidScene=new wn;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=mr(this.gl),this.chairProg=dr(this.gl),this.depthProg=hr(this.gl);let a=new Sn(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Sn(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Sn(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of Oa)this.seatProg.uniforms[r].value=e.uniforms[r].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let e=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ba(this.gl,{width:e,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&e.deleteTexture(n.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,p,m);let[d,h,f]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:a,clear:!1}),i.clearColor(d,h,f,1),i.disable(i.SCISSOR_TEST);let x=new Uint8Array(p*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,p,m,i.RGBA,i.UNSIGNED_BYTE,x),this.renderer.bindFramebuffer(),Mr(x,p,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function wr(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,ct(r.state)):n.push(r);return n}function Pr(t,e,n){let r=new Set;for(let a of e)(t.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(t),i=[];for(let[a,s]of t)r.has(a)||(i.push({seatId:a,state:ye[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}import{Quat as yt,Vec3 as za}from"ogl";function Va(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Cr(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Na(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ar(t){let e=Math.hypot(t[0],t[1],t[2]);return e>1e-6?[t[0]/e,t[1]/e,t[2]/e]:[0,0,0]}function Pn(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Cn(t,e){return Math.max(0,Math.min(1,t+e))}function Rr(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=t[Math.max(0,i-1)],c=t[i],l=t[i+1],u=t[Math.min(n-1,i+2)],p=a*a,m=p*a,d=[0,0,0];for(let h=0;h<3;h++)d[h]=.5*(2*c[h]+(-s[h]+l[h])*a+(2*s[h]-5*c[h]+4*l[h]-u[h])*p+(-s[h]+3*c[h]-3*l[h]+u[h])*m);return d}function An(t,e,n,r,o){let i=Ar(Va(e,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Cr(Cr(e,Na(i,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],c=Ar(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[t,u,a],finalPos:a}}function Rn(t,e,n=35,r=28){let o=Pn(e),i=Rr(t,o),a=Pn(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Tr(t,e,n){let r=t.position.clone(),o=new yt().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new za(n[0],n[1],n[2]));let i=new yt().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(o),i}var Yt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new yt;this.endQuat=new yt;this.outQuat=new yt;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,o=2500,i=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Rn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Cn(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Ga=1.02,Ha=1.5;function Er(t,e,n=0,r){let o=Number.isFinite(r)?n+r:t[1]+Ga;return{eye:[t[0],o,t[2]],focal:[e.x*R,n+Ha,e.y*R]}}var In=null;function Dr(){return In??=import("../openPanorama-HGRYMWKC.js").catch(t=>{throw In=null,t}),In}var kr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Xt=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,n){if(this.cb)try{this.cb(e,n)}catch{}}opened(e,n,r,o){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=kr(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(kr()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,n){this.emit("3d_panorama_failed",{seatId:e,phase:n})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function _r(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Lr(t){let{container:e,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=t,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(p,m,d=!1)=>{if(l(),t.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let f=o.get(p),x=f?.sectionId?n.sections.find(E=>E.id===f.sectionId):void 0,y=f?.label??p;h.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${y}`);let b=document.createElement("span");b.textContent=["Live 3D seat view",x?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(b.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),h.appendChild(b);let M=document.createElement("div");Object.assign(M.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(M);let C=f?.rowId?i.get(f.rowId):void 0,P=C?.indexOf(p)??-1,g=P>=0?[C?.[P-1],C?.[P+1]]:[void 0,void 0],T=(E,L,G,N=!1)=>{let v=document.createElement("button");v.type="button",v.textContent=E,v.setAttribute("aria-label",L),Object.assign(v.style,{minHeight:"44px",padding:N?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),N||(v.style.minWidth="44px"),N&&(v.dataset.panoramaTrigger=""),v.addEventListener("click",G),M.appendChild(v)};if(g[0]){let E=o.get(g[0])?.label??g[0];T("\u2039",`View previous seat ${E}`,()=>{t.flyToSeat(g[0])})}if(r.getSeatView){let E=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";T(d?`\u21BB Retry ${E}`:`\u25C9 ${E}`,`${d?"Retry":E} from seat ${y}`,()=>{if(t.isDisposed()||m!==t.flightGen()){l();return}l(),t.openPanorama(p,400,m)},!0)}if(g[1]){let E=o.get(g[1])?.label??g[1];T("\u203A",`View next seat ${E}`,()=>{t.flyToSeat(g[1])})}return M.childElementCount?(e.appendChild(h),s=h,c(),h):null},remove:l,layout:c}}function Br(t){let{container:e,orbit:n,isNarrow:r}=t,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let f of[c,l,u,p])f.className="sl-3d-icon-control",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(p,u);let m=f=>{n.setPrimaryDragMode(f);let x=f==="orbit";c.setAttribute("aria-pressed",String(x)),l.setAttribute("aria-pressed",String(!x)),c.style.background=x?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=x?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=x?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),p.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),e.appendChild(o);let d=()=>{let f=r();o.style.display=i?"none":"flex",o.style.right=f?"12px":"14px",o.style.bottom=f?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=f?"none":"flex",p.style.display=f?"none":"",u.style.display=f?"none":""};return d(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:f=>{i=f,n.setInteractionEnabled(!f),d()},seatViewLocked:()=>i,layout:d}}function Or(t){let{glctx:e,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:p,cancelFlight:m,focusSectionCamera:d,setSelection:h,ensureSeatView:f}=t,x=0,y=0,b=0,M=-1,C=!1,P=!1,g=N=>{t.seatViewLocked()||M===-1&&(M=N.pointerId,x=N.clientX,y=N.clientY,b=performance.now(),C=!1,P=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},T=N=>{N.pointerId===M&&Math.hypot(N.clientX-x,N.clientY-y)>u&&(C=!0)},E=(N,v,A,F,w)=>{let _=e.canvas.getBoundingClientRect(),U=e.canvas.clientWidth||_.width||1,I=e.canvas.clientHeight||_.height||1,S=N-_.left,D=v-_.top,H=F*F,V=-1,z=H,O=1/0;for(let W of o){if(A&&W.sectionId!==A)continue;let Y=r.seats.idToIndex.get(W.id);if(Y===void 0)continue;if(w){let ae=Math.round(r.seats.iState[Y]??0);if(ae!==0&&ae!==3)continue}let K=Y*3,q=Be(n.camera.projectionViewMatrix,[r.seats.iPosition[K],r.seats.iPosition[K+1]+.55,r.seats.iPosition[K+2]],U,I);if(!q.visible)continue;let ne=q.x-S,oe=q.y-D,$=ne*ne+oe*oe;($<z||Math.abs($-z)<1&&q.depth<O)&&(V=Y,z=$,O=q.depth)}return V},L=(N,v)=>{let A=t.gpu(),F=t.pick();if(!A||!F)return-1;F.syncFromSeatProgram(A.seatProgram);let w=e.canvas.getBoundingClientRect(),_=e.renderer.dpr,{x:U,y:I}=Sr(N,v,w,_,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),S=Math.max(2,Math.round(8*_));return F.pick(n.camera,U,I,S)};return{onDown:g,onMove:T,onUp:N=>{if(N.pointerId!==M)return;let v=!C&&performance.now()-b<p;if(M=-1,P){P=!1;return}let A=t.gpu(),F=t.pick();if(!v||!A||!F)return;let w=L(N.clientX,N.clientY);if(t.focusedSectionId()&&w>=0){let I=c[w],S=I?l.get(I):void 0;if(S&&S!==t.focusedSectionId()&&d(S))return}if(t.focusedSectionId()&&w<0&&(w=E(N.clientX,N.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&w<0){let I=E(N.clientX,N.clientY,null,72,!1),S=I>=0?c[I]:void 0,D=S?l.get(S):void 0;if(D&&D!==t.focusedSectionId()&&d(D))return}if(!t.focusedSectionId()){w<0&&(w=E(N.clientX,N.clientY,null,42,!1));let I=w>=0?c[w]:void 0,S=I?l.get(I):void 0;if(S&&d(S))return}if(w<0||w>=c.length){t.selection().size&&(h([]),i.onViewTargetChange?.(null));return}let _=c[w],U=ye[Math.round(r.seats.iState[w]??0)]??"available";if(U!=="available"&&U!=="selected"){i.onSeatInspect?.(_,U);return}if(t.selection().has(_)&&t.selection().size===1){h([]),i.onViewTargetChange?.(null);return}h([_]),f(_),s.seatPicked(_,l.get(_)),i.onSeatPick?.(_)}}}var Wt=class{constructor(e,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let d=0;d<this.count;d++){let h=e[d*3],f=e[d*3+2];h<n&&(n=h),h>o&&(o=h),f<r&&(r=f),f>i&&(i=f)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),u=d=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((e[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[d*3+2]-r)/this.cell)))*this.cols+h};for(let d=0;d<this.count;d++)l[u(d)+1]++;for(let d=0;d<c;d++)l[d+1]+=l[d];let p=new Int32Array(this.count),m=l.slice(0,c);for(let d=0;d<this.count;d++)p[m[u(d)]++]=d;this.cellStart=l,this.cellItems=p}gather(e,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((e-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,m=this.iPosition,d=0;for(let h=0;h<=p&&d<s;h++){let f=u-h,x=u+h,y=l-h,b=l+h;for(let M=f;M<=x&&d<s;M++){if(M<0||M>=this.rows)continue;let C=M===f||M===x;for(let P=y;P<=b&&d<s;P++){if(!C&&P!==y&&P!==b){P=b-1;continue}if(P<0||P>=this.cols)continue;let g=M*this.cols+P;for(let T=i[g],E=i[g+1];T<E&&d<s;T++){let L=a[T],G=m[L*3]-e,N=m[L*3+2]-n;G*G+N*N<=c&&(o[d++]=L)}}}}return d}};var jt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(It);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Wt(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let n=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(e){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<on)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>nn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,nn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let o=1-Math.exp(-e*9),i=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};import{Quat as Ua,Vec3 as Ya}from"ogl";function Vr(t){let{container:e,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=t,p=0,m=-1,d=(P,g,T=28)=>{o.camera.position.set(P[0],P[1],P[2]),o.camera.lookAt(new Ya(g[0],g[1],g[2])),o.camera.fov=T,o.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.textContent="\u2302",h.setAttribute("aria-label","Fit the active level or whole venue in view"),h.dataset.tooltip="Fit view",Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let f=()=>{h.textContent="\u2302"};f();let x=P=>{m=P;let g=t.gpu();g&&(g.seatProgram.uniforms.uFocusFloor.value=P,g.solidProgram.uniforms.uFocusFloor.value=P,g.chairProgram.uniforms.uFocusFloor.value=P),t.showSectionSeatLabels(null)},y=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),a.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),h.style.display="",c.setVisible(!0),t.setFrozen(!1);let P=m>=0?n.floors[m]:null;if(t.setNearFieldDetailEnabled(!!P),t.setSeatViewLocked(!1),b(),t.removeArriveChip(),t.setNavigationMode("orbit"),P){let g=P.focalWorld[0]-P.center[0],T=P.focalWorld[2]-P.center[2],E=Math.hypot(g,T)>P.radius*.12?Math.atan2(g,T):l,L={center:P.center,radius:P.radius,box:P.box},G={polarDeg:58,margin:1.12};t.reducedMotion()?o.frame(L,!1,E,!1,G):o.frameSoft(L,E,!1,G)}else t.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);t.showSectionSeatLabels(null),s.requestRender()},b=()=>{p++,t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},M=P=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let g=n.seats.idToIndex.get(P);if(g===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(P),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),h.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1),t.setSeatViewLocked(!1);let T=++p;t.removeArriveChip();let{eye:E,focal:L}=t.resolvedSeatViewPose(P,g),G=[o.camera.position.x,o.camera.position.y,o.camera.position.z],N=An(G,E,L,n.bounds.center,n.bounds.radius),v=r.arriveAtSeatEye?E:N.finalPos,A=r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?90:65:28,F=[N.waypoints[0],N.waypoints[1],v];if(c.setVisible(!1),t.reducedMotion())return d(v,L,A),s.requestRender(),a.cinematicSkipped(),t.isDisposed()||o.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),t.showArriveChip(P,T),Promise.resolve();let w=new Ua().copy(o.camera.quaternion),_=Tr(o.camera,v,L);return s.requestRender(),i.start(F,w,_,2500,A).then(()=>{t.isDisposed()||T!==p||(a.cinematicPlayed(2500),o.resumeAfterFlight(L),t.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),t.showArriveChip(P,T))})},C=P=>{let g=n.sections.find(G=>G.id===P);if(!g||g.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),n.floors.length>1&&m!==g.floorIndex&&x(g.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(P);let T=g.focalWorld[0]-g.center[0],E=g.focalWorld[2]-g.center[2],L=Math.hypot(T,E)>g.radius*.12?Math.atan2(T,E):void 0;return o.frame({center:g.center,radius:Math.max(5,g.radius*.5)},!1,L),r.onSectionFocusChange?.(P),s.requestRender(),!0};return h.addEventListener("click",y),{overviewChip:h,layoutOverviewChip:f,flightGen:()=>p,focusedFloor:()=>m,applyFloorFocus:x,placeCameraFinal:d,cancelFlight:b,focusOverview:y,flyToSeat:M,focusSectionCamera:C}}function Nr(t){let e=performance.now();return{model:bt(t),buildMs:performance.now()-e,source:"main"}}function Xa(t){return typeof Worker>"u"?Promise.resolve(Nr(t)):new Promise(e=>{let n=new Worker(new URL("./scene/scene.worker.ts",import.meta.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),e(s))},i=()=>o(Nr(t)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(t)})}var Wa=Math.PI/180,ja=6,Ka=500;function Ru(t,e,n={}){let r=performance.now(),o=e.prepared?.model??bt(e),i=new Xt(n.onAnalytics),a=new Array(o.seats.count);for(let[k,B]of o.seats.idToIndex)a[B]=k;let s=new Map(e.seats.map(k=>[k.id,k])),c=new Map;for(let k of e.seats){if(!k.rowId)continue;let B=c.get(k.rowId);B?B.push(k.id):c.set(k.rowId,[k.id])}let l=new Map;for(let k of e.seats)l.set(k.id,k.sectionId);let u=e.doc.floors?.some(B=>(B.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(B=>B.objects)??e.doc.objects).some(B=>B.type==="section"&&((B.height??0)>0||(B.rake??0)>0)),p=null,m=null,d=!1,h=!1,f=!1,x=new Map,y=null,b=null,M=null,C=new Map,P=null,g=()=>{M===null&&(M=t.style.zIndex,t.style.zIndex="20")},T=()=>{M!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=M),M=null)},E=!1,L=()=>E?me.focusedFloor():-1,G=()=>{p=vr(F.gl,o),m=new Ut(F.renderer,p.seatGeometry,p.chairGeometry,p.solidGeometry,o.seats.count),F.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),p.seatProgram.uniforms.uSeatRadius.value=Ce*o.theme.seatScale,p.seatProgram.uniforms.uFocusFloor.value=L(),p.solidProgram.uniforms.uFocusFloor.value=L(),p.chairProgram.uniforms.uFocusFloor.value=L(),v.forceRegather()},N=!1,v=new jt({model:o,orbit:()=>w,gpu:()=>p}),A=k=>v.setDetailEnabled(k),F=new Ct(t,{onContextLost:()=>{f||i.contextLost(),d=!0,K.stop(),p=null,m=null},onContextRestored:()=>{G(),d=!1,f||i.contextRestored(),K.requestRender()}}),w=new At(F.gl,F.canvas,()=>K.requestRender(),()=>i.orbitEngaged());w.setAspect(F.aspect);let _=(e.doc.floors?.flatMap(k=>k.objects)??e.doc.objects).some(k=>k.type==="section"&&k.physical3dProvenance?.surfaceKind?.status==="inferred"),U=(()=>{if(_&&o.stages.length===0)return;let k=o.focalWorld[0]-o.bounds.center[0],B=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(k,B)>o.bounds.radius*.12?Math.atan2(k,B):void 0})(),I=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,S=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;w.frame(o.bounds,!S&&n.skipInitialOverviewAnimation!==!0,U,n.portraitOverviewCrop===!0,I);let D=new Yt(w.camera),H=_r(t),V=new Nt(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),z=o.labels,O=()=>Uo(z,o.floors.length,L());V.setLabels(O());let W=null,Y=k=>{if(W=k,V.setForcedDense(!!k),!k){V.setLabels(O());return}let B=e.seats.filter(j=>j.sectionId===k),X=new Set(B.map(j=>j.id)),Z=new Set(B.map(j=>j.rowId)),J=new Set(x.keys()),ee=new Set(B.filter(j=>J.has(j.id)).map(j=>j.id)),ce=O().filter(j=>j.kind!=="row"&&j.kind!=="seat"||(j.kind==="row"?Z.has(j.id.slice(4)):X.has(j.id.slice(5))&&(ee.size===0||ee.has(j.id.slice(5)))));if(o.seatCount<=6e3&&ee.size===0){V.setLabels(ce);return}let le=ee.size?B.filter(j=>ee.has(j.id)):B,Ne=new Set(le.map(j=>`seat:${j.id}`)),De=le.flatMap(j=>{let de=o.seats.idToIndex.get(j.id);if(de===void 0)return[];let Se=de*3;return[{id:`seat:${j.id}`,kind:"seat",text:j.displayLabel||j.label,anchor:[o.seats.iPosition[Se],o.seats.iPosition[Se+1]+(J.has(j.id)?1.05:.55),o.seats.iPosition[Se+2]]}]});V.setLabels([...ce.filter(j=>!Ne.has(j.id)),...De])};G();let K=new Rt(k=>{if(d||!p||h)return!1;let X=D.active?D.update(performance.now()):w.update(),Z=L()>=0?o.floors[L()]:null,J=Z?.radius??o.bounds.radius,ee=Jn(w.currentDistance,J),ce=N?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:o.renderBounds;w.updateClipping(ce);let le=Z?.center??o.renderBounds.center,Ne=Z?.radius??o.renderBounds.radius,De=(we,rt)=>Math.hypot(w.camera.position.x-we[0],w.camera.position.y-we[1],w.camera.position.z-we[2])<=rt*(v.detailVisible?1.8:1.55),j=De(le,Ne);if(!j&&W){let we=o.sections.find(rt=>rt.id===W);we&&(j=De(we.center,Math.max(12,we.radius*2)))}v.detailVisible=j;let de=p.seatProgram.uniforms;de.uSeatScale.value=ee.scale,de.uSeatFade.value=ee.fade;let Se=!!Z&&eo(Z.seatCount,F.canvas.clientWidth||1,F.canvas.clientHeight||1),gt=to(o.seats.count,J,w.currentDistance,w.camera.fov,F.canvas.clientHeight||1),ot=v.detailVisible||Se||gt?1:0,vt=v.detailVisible||L()>=0||o.floors.length>1?1:0;return v.ease(k,ot,vt),de.uSeatDetail.value=v.seatDetailMix,p.solidProgram.uniforms.uStructureDetail.value=v.structureDetailMix,de.uMinPixels.value=ee.minPixels,de.uPixelToWorld.value=2*Math.tan(w.camera.fov*Wa/2)/Math.max(1,F.pixelHeight),v.update(v.detailVisible),F.renderer.render({scene:p.background,clear:!0}),F.renderer.render({scene:p.main,camera:w.camera,clear:!1}),V.update(w.camera.projectionViewMatrix,F.canvas.clientWidth||1,F.canvas.clientHeight||1,w.currentDistance,J,[w.camera.position.x,w.camera.position.y,w.camera.position.z]),X||v.seatDetailMix!==ot||v.structureDetailMix!==vt}),q=typeof ResizeObserver<"u"?new ResizeObserver(()=>qt.resize()):null;q?.observe(t);let ne=k=>{let B=J=>{let ee=o.seats.idToIndex.get(J);return ee===void 0?void 0:o.seats.iState[ee]},{updates:X,next:Z}=Pr(x,k,B);if(x=Z,V.setSelectedSeatIds(x.keys()),W&&Y(W),X.length){let J=cn(o.seats,X);p&&p.uploadSeatStateRuns(J),K.requestRender()}},oe=()=>P!==null?P:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=8,ae=k=>{if(!n.getSeatView)return null;let B=C.get(k);if(!B)for(B=Promise.resolve(n.getSeatView(k)),C.set(k,B),B.catch(()=>{C.get(k)===B&&C.delete(k)});C.size>$;){let X=C.keys().next().value;if(X===void 0)break;C.delete(X)}return B},Oe=(k,B)=>{let X=s.get(k),Z=Math.max(0,Math.round(o.seats.iFloor[B]??0)),J=e.doc.floors?.[Z],ee=o.floors[Z],ce=J?.focalPoint??e.doc.focalPoint,le=ee?{x:ee.focalWorld[0]/R,y:ee.focalWorld[2]/R}:ce,Ne=X?.focalPoint?{x:X.focalPoint.x+le.x-ce.x,y:X.focalPoint.y+le.y-ce.y}:le,De=[o.seats.iPosition[B*3],o.seats.iPosition[B*3+1],o.seats.iPosition[B*3+2]];return Er(De,Ne,J?.baseHeightM??0,X?.eyeHeightM)},Ve=()=>(t.clientWidth||F.canvas.clientWidth)<=520,xe=null,Ie=null,Fe=async(k,B,X)=>{if(!n.getSeatView||f||X!==me.flightGen())return;let Z;try{Z=await Dr()}catch{if(i.panoramaFailed(k,"mount"),!f&&X===me.flightGen()){let J=he(k,X,!0);requestAnimationFrame(()=>J?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(f||X!==me.flightGen()||!xe))return Ie??=Z.createOpenPanorama(xe),Ie(k,B,X)},ge=Lr({container:t,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Ve,isDisposed:()=>f,flightGen:()=>me.flightGen(),flyToSeat:k=>Tn(k),openPanorama:(k,B,X)=>Fe(k,B,X)}),he=ge.show,se=ge.remove,Ke=ge.layout,ve=Br({container:t,orbit:w,isNarrow:Ve}),qe=ve.element,Me=ve.setNavigationMode,Te=ve.setSeatViewLocked,xt=ve.layout,zr=ve.utilityControls,me=Vr({container:t,model:o,opts:n,orbit:w,cinematic:D,analytics:i,loop:K,labelOverlay:V,stageAzimuth:U,overviewFraming:I,gpu:()=>p,isDisposed:()=>f,panorama:()=>y,setPanorama:k=>{y=k},setPanoramaSphereVisible:k=>{N=k},panoramaLoadAbort:()=>b,setPanoramaLoadAbort:k=>{b=k},setFrozen:k=>{h=k},restorePanoramaLayer:T,reducedMotion:oe,resolvedSeatViewPose:Oe,showSectionSeatLabels:Y,setNearFieldDetailEnabled:A,setSeatViewLocked:Te,setNavigationMode:Me,showArriveChip:he,removeArriveChip:se});E=!0;let Kt=me.overviewChip,Gr=me.layoutOverviewChip,Hr=me.applyFloorFocus,Ur=me.focusOverview,Fn=me.cancelFlight,Tn=me.flyToSeat,En=me.focusSectionCamera;zr.appendChild(Kt),xe={container:t,model:o,opts:n,analytics:i,orbit:w,loop:K,seatsById:s,ensureSeatView:ae,resolvedSeatViewPose:Oe,gpu:()=>p,gl:F.gl,isContextLost:()=>d,isDisposed:()=>f,flightGen:()=>me.flightGen(),setPanorama:k=>{y=k},getLoadAbort:()=>b,setLoadAbort:k=>{b=k},setPanoramaSphereVisible:k=>{N=k},setFrozen:k=>{h=k},raisePanoramaLayer:g,restorePanoramaLayer:T,getOverviewChip:()=>Kt,labelOverlay:V,reducedMotion:oe,removeArriveChip:se,showArriveChip:he};let Ee=Or({glctx:F,orbit:w,model:o,seats:e.seats,opts:n,cinematic:D,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:ja,tapMs:Ka,gpu:()=>p,pick:()=>m,seatViewLocked:()=>ve.seatViewLocked(),focusedSectionId:()=>W,selection:()=>x,cancelFlight:Fn,focusSectionCamera:En,setSelection:ne,ensureSeatView:ae});F.canvas.addEventListener("pointerdown",Ee.onDown),F.canvas.addEventListener("pointermove",Ee.onMove),F.canvas.addEventListener("pointerup",Ee.onUp),F.canvas.addEventListener("pointercancel",Ee.onUp),K.requestRender();let qt={setAvailability(k){let B=wr(x,k),X=cn(o.seats,B);X.length&&p&&p.uploadSeatStateRuns(X),K.requestRender()},setSelection:ne,flyToSeat:Tn,focusOverview:Ur,resize(){let{width:k,height:B}=F.resize();w.setAspect(k/Math.max(1,B)),Ke(),xt(),Gr(),K.requestRender()},stats(){return{...K.stats(),drawCalls:p?p.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let k=K.stats(),B=F.canvas.clientWidth||1,X=F.canvas.clientHeight||1,Z=o.bounds.center,J=Be(w.camera.projectionViewMatrix,[Z[0],o.bounds.box.min[1],Z[2]],B,X),ee=Be(w.camera.projectionViewMatrix,[Z[0],o.bounds.box.max[1],Z[2]],B,X),ce=o.bounds.box,le=[ce.min[0],ce.max[0]].flatMap(j=>[ce.min[1],ce.max[1]].flatMap(de=>[ce.min[2],ce.max[2]].map(Se=>Be(w.camera.projectionViewMatrix,[j,de,Se],B,X)))).filter(j=>Number.isFinite(j.x)&&Number.isFinite(j.y)&&Number.isFinite(j.depth)),Ne=le.length?(()=>{let j=Math.min(...le.map(ze=>ze.x)),de=Math.max(...le.map(ze=>ze.x)),Se=Math.min(...le.map(ze=>ze.y)),gt=Math.max(...le.map(ze=>ze.y)),ot=Math.max(0,j),vt=Math.min(B,de),we=Math.max(0,Se),rt=Math.min(X,gt),Mt=Math.max(0,vt-ot),Zt=Math.max(0,rt-we);return{box:{x:ot,y:we,width:Mt,height:Zt},horizontalFillRatio:Mt/B,verticalFillRatio:Zt/X,visibleAreaRatio:Mt*Zt/(B*X),clippedEdges:[...Se<0?["top"]:[],...de>B?["right"]:[],...gt>X?["bottom"]:[],...j<0?["left"]:[]]}})():void 0,De=String(F.gl.getParameter(F.gl.VERSION)??"");return{viewport:{width:B,height:X},context:{webgl2:/webgl\s*2/i.test(De),lost:d},frame:{rendered:k.rendered,idle:k.idle},camera:{position:[w.camera.position.x,w.camera.position.y,w.camera.position.z],distance:w.currentDistance,verticalFovDeg:w.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:J.visible&&ee.visible?Math.abs(J.y-ee.y):0},labels:V.qualityEvidence(),framing:Ne}},getQualityReport(){return Mn(qt.getQualityEvidence())},loseContextForTest(){F.simulateContextLossCycle()},floors(){return o.floors},focusFloor(k){if(k!==null&&!o.floors.some(X=>X.index===k))return!1;let B=k??-1;if(A(k!==null),Te(!1),Hr(B),Me("orbit"),k===null)D.cancel(),oe()?w.frame(o.bounds,!1,U,n.portraitOverviewCrop===!0,I):w.frameSoft(o.bounds,U,n.portraitOverviewCrop===!0,I);else{let X=o.floors[k];if(X.seatCount>0){D.cancel();let Z=X.focalWorld[0]-X.center[0],J=X.focalWorld[2]-X.center[2],ee=Math.hypot(Z,J)>X.radius*.12?Math.atan2(Z,J):U;w.frame({center:X.center,radius:X.radius,box:X.box},!1,ee,!1,{polarDeg:58,margin:1.12})}}return K.requestRender(),!0},zones(){return o.zones},focusZone(k){let B=o.zones.find(ee=>ee.id===k);if(!B||B.seatCount===0)return!1;A(!1),Te(!1),D.cancel(),Me("orbit"),Y(null),n.onSectionFocusChange?.(null);let X=B.focalWorld[0]-B.center[0],Z=B.focalWorld[2]-B.center[2],J=Math.hypot(X,Z)>B.radius*.12?Math.atan2(X,Z):void 0;return w.frame({center:B.center,radius:B.radius*1.25},!1,J),K.requestRender(),!0},sections(){return o.sections},focusSection(k){return En(k)},rows(k){return k?o.rows.filter(B=>B.sectionId===k):o.rows},seatsInRow(k){return e.seats.filter(B=>B.rowId===k).map(B=>({id:B.id,label:B.displayLabel||B.label}))},focusRow(k){let B=o.rows.find(X=>X.id===k);return!B||B.seatCount===0?!1:(A(!0),Te(!1),D.cancel(),Me("pan"),B.sectionId&&(Y(B.sectionId),n.onSectionFocusChange?.(B.sectionId)),w.frame({center:B.center,radius:Math.max(2.5,B.radius*.65)}),K.requestRender(),!0)},setReducedMotionForTest(k){P=k},dispose(){f=!0,se(),Kt.remove(),qe.remove(),Fn(),K.stop(),V.dispose(),q?.disconnect(),y&&(y.dispose(),y=null),T(),H(),F.canvas.removeEventListener("pointerdown",Ee.onDown),F.canvas.removeEventListener("pointermove",Ee.onMove),F.canvas.removeEventListener("pointerup",Ee.onUp),F.canvas.removeEventListener("pointercancel",Ee.onUp),w.dispose(),m&&m.dispose(),p&&p.dispose(),p=null,m=null,F.dispose()}};return i.opened(o.seatCount,u,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),qt}export{pa as VENUE3D_QUALITY_REPORT_VERSION,bt as buildSceneModel,Mn as inspectVenue3DQualityEvidence,Ru as mountVenue3D,Xa as prepareVenue3D};
|
|
614
|
+
}`;function br(e){return new qe(e,{vertex:Ha,fragment:Ya,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ce},uSeatScale:{value:1},uMinPixels:{value:Je},uPixelToWorld:{value:.002},uChairFull:{value:mt},uChairNone:{value:et},uFocusFloor:{value:-1}}})}function yr(e){return new qe(e,{vertex:Xa,fragment:Wa,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:mt},uChairNone:{value:et},uBackRake:{value:ln},uBackBase:{value:Vt},uFocusFloor:{value:-1}}})}function gr(e){return new qe(e,{vertex:ja,fragment:Ka,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function xr(e,t=.78){return new qe(e,{vertex:La,fragment:Oa,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function vr(e){return new qe(e,{vertex:Ba,fragment:Va,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Ce},uSeatScale:{value:1},uMinPixels:{value:Je},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:et}}})}function Mr(e,t=.78){return new qe(e,{vertex:Na,fragment:Ga,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:et},uBackRake:{value:ln},uBackBase:{value:Vt},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function wr(e,t,n){return new qe(e,{vertex:za,fragment:Ua,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function Pr(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var Qa=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),$a=new Float32Array([-1,-1,3,-1,-1,3]);function Ar(e,t){let n=new Sr,r=new Sr,o=new xt(e,{position:{size:2,data:$a}}),i=wr(e,t.theme.background.top,t.theme.background.bottom),a=new vt(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new xt(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=xr(e,t.theme.materials.roughness),l=new vt(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let f=vr(e),u=new Float32Array(t.seats.count*3),m=xe.map(G=>t.theme.seatStates[G]);Pr(u,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let h=new xt(e,{position:{size:2,data:Qa},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:u,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),d=new vt(e,{geometry:h,program:f});d.frustumCulled=!1,t.seats.count>0&&d.setParent(n);let p=h.attributes.iColor,g=co(),b=Mr(e,t.theme.materials.roughness),y=Dt,S=new Float32Array(y*3),w=new Float32Array(y*3),P=new Float32Array(y),x=new Float32Array(y),A=new Float32Array(y),T=new Float32Array(y*3),_=new Float32Array(y),N=new Float32Array(y),O=new Float32Array(y),M=new Float32Array(y),C=new xt(e,{position:{size:3,data:g.position},normal:{size:3,data:g.normal},part:{size:1,data:g.part},index:{data:g.index},iOffset:{size:3,data:S,instanced:1},iColor:{size:3,data:w,instanced:1},iRadius:{size:1,data:P,instanced:1},iYaw:{size:1,data:x,instanced:1},iGlyph:{size:1,data:A,instanced:1},iRing:{size:3,data:T,instanced:1},iFloor:{size:1,data:_,instanced:1},iPhysicalSeat:{size:1,data:N,instanced:1},iSeed:{size:1,data:M,instanced:1},iPickIndex:{size:1,data:O,instanced:1}}),k=new vt(e,{geometry:C,program:b});k.frustumCulled=!1;let v=0,F=!1,V=!1,R=null,E=null,D=null,X=new Int32Array(0),H=()=>{let G=t.seats;for(let U=0;U<v;U++){let Y=X[U];M[U]=uo(G.iState[Y],Y);let Z=G.iCategory&&G.iState[Y]===0?null:m[G.iState[Y]]??m[0];if(Z)w[U*3]=Z[0],w[U*3+1]=Z[1],w[U*3+2]=Z[2];else{let Q=t.theme.materials.seat??qn([G.iCategory[Y*3],G.iCategory[Y*3+1],G.iCategory[Y*3+2]]);w[U*3]=Q[0],w[U*3+1]=Q[1],w[U*3+2]=Q[2]}}C.attributes.iColor.needsUpdate=!0,C.attributes.iSeed.needsUpdate=!0},W={main:n,background:r,seatProgram:f,solidProgram:c,chairProgram:b,seatGeometry:h,chairGeometry:C,solidGeometry:s,drawCalls:3,setNearSeats(G,U){let Y=Math.min(U,y);if(X=G,v=Y,Y===0){k.parent&&k.setParent(null),C.instancedCount=0,W.drawCalls=3+(F?1:0);return}let K=t.seats;for(let Z=0;Z<Y;Z++){let Q=G[Z];S[Z*3]=K.iPosition[Q*3],S[Z*3+1]=K.iPosition[Q*3+1],S[Z*3+2]=K.iPosition[Q*3+2],P[Z]=K.iChairWidth[Q],x[Z]=K.iYaw[Q],A[Z]=K.iGlyph[Q],T[Z*3]=K.iRing[Q*3],T[Z*3+1]=K.iRing[Q*3+1],T[Z*3+2]=K.iRing[Q*3+2],_[Z]=K.iFloor[Q],N[Z]=K.iPhysicalSeat[Q],O[Z]=Q+1}H(),C.attributes.iOffset.needsUpdate=!0,C.attributes.iRadius.needsUpdate=!0,C.attributes.iYaw.needsUpdate=!0,C.attributes.iGlyph.needsUpdate=!0,C.attributes.iRing.needsUpdate=!0,C.attributes.iFloor.needsUpdate=!0,C.attributes.iPhysicalSeat.needsUpdate=!0,C.attributes.iSeed.needsUpdate=!0,C.attributes.iPickIndex.needsUpdate=!0,C.instancedCount=Y,k.parent||k.setParent(n),W.drawCalls=4+(F?1:0)},nearSeatCount(){return v},uploadSeatStateRuns(G){if(!G.length)return;v&&H();for(let Y of G)Pr(u,t.seats.iState,Y.start,Y.length,m,t.seats.iCategory);let U=p.buffer;if(!U){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,U);for(let Y of G){let K=u.subarray(Y.start*3,(Y.start+Y.length)*3);e.bufferSubData(e.ARRAY_BUFFER,Y.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},dispose(){V=!0,o.remove(),i.remove(),s.remove(),c.remove(),h.remove(),f.remove(),C.remove(),b.remove(),R?.remove(),E?.remove(),D?.texture&&e.deleteTexture(D.texture)}},z=t.productionElements.find(G=>G.contentImageUrl&&G.contentPlane);if(z?.contentImageUrl&&z.contentPlane?.length===4&&typeof Image<"u"){let G=new Image;G.crossOrigin="anonymous",G.onload=()=>{if(V)return;let U=z.contentPlane;R=new xt(e,{position:{size:3,data:new Float32Array(U.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(z.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),D=new Za(e,{image:G,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),E=new qa(e,{vertex:`#version 300 es
|
|
615
|
+
precision highp float;
|
|
616
|
+
in vec3 position; in vec2 uv; in float floorIndex;
|
|
617
|
+
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
618
|
+
out vec2 vUv; out float vDim;
|
|
619
|
+
void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
|
|
620
|
+
precision highp float;
|
|
621
|
+
in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
|
|
622
|
+
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:D},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let Y=new vt(e,{geometry:R,program:E});Y.frustumCulled=!1,Y.setParent(n),W.screenProgram=E,F=!0,W.drawCalls=3+(v?1:0)+1},G.src=z.contentImageUrl}return W}import{Mesh as An,RenderTarget as es,Transform as Rn}from"ogl";function Ja(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Rr(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let f=(c*t+l)*4,u=Ja(e[f],e[f+1],e[f+2]);if(u<0||u>=i)continue;let m=l-r,h=c-o,d=m*m+h*h;d<s&&(s=d,a=u)}return a}function Cr(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var ts=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Wt=class{constructor(t,n,r,o,i){this.seatScene=new Rn;this.chairScene=new Rn;this.solidScene=new Rn;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=br(this.gl),this.chairProg=yr(this.gl),this.depthProg=gr(this.gl);let a=new An(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new An(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new An(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of ts)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new es(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),f=Math.max(0,r-o),u=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-f);i.enable(i.SCISSOR_TEST),i.scissor(l,f,u,m);let[h,d,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(h,d,p,1),i.disable(i.SCISSOR_TEST);let g=new Uint8Array(u*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,f,u,m,i.RGBA,i.UNSIGNED_BYTE,g),this.renderer.bindFramebuffer(),Rr(g,u,m,n-l,r-f,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ir(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,ut(r.state)):n.push(r);return n}function Fr(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:xe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}import{Quat as Mt,Vec3 as rs}from"ogl";function ns(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Tr(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function os(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Er(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Cn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function In(e,t){return Math.max(0,Math.min(1,e+t))}function Dr(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],f=e[Math.min(n-1,i+2)],u=a*a,m=u*a,h=[0,0,0];for(let d=0;d<3;d++)h[d]=.5*(2*c[d]+(-s[d]+l[d])*a+(2*s[d]-5*c[d]+4*l[d]-f[d])*u+(-s[d]+3*c[d]-3*l[d]+f[d])*m);return h}function Fn(e,t,n,r,o){let i=Er(ns(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Tr(Tr(t,os(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Er(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),f=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,f,a],finalPos:a}}function Tn(e,t,n=35,r=28){let o=Cn(t),i=Dr(e,o),a=Cn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Lr(e,t,n){let r=e.position.clone(),o=new Mt().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new rs(n[0],n[1],n[2]));let i=new Mt().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var jt=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Mt;this.endQuat=new Mt;this.outQuat=new Mt;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Tn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,In(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var is=1.02,as=1.5;function Or(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+is;return{eye:[e[0],o,e[2]],focal:[t.x*I,n+as,t.y*I]}}var En=null;function Br(){return En??=import("../openPanorama-HGRYMWKC.js").catch(e=>{throw En=null,e}),En}var Vr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Kt=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Vr(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Vr()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function Nr(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Gr(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let u=a();Object.assign(s.style,u?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(u,m,h=!1)=>{if(l(),e.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(u),g=p?.sectionId?n.sections.find(T=>T.id===p.sectionId):void 0,b=p?.label??u;d.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${b}`);let y=document.createElement("span");y.textContent=["Live 3D seat view",g?.label,b].filter(Boolean).join(" \xB7 "),Object.assign(y.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),d.appendChild(y);let S=document.createElement("div");Object.assign(S.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(S);let w=p?.rowId?i.get(p.rowId):void 0,P=w?.indexOf(u)??-1,x=P>=0?[w?.[P-1],w?.[P+1]]:[void 0,void 0],A=(T,_,N,O=!1)=>{let M=document.createElement("button");M.type="button",M.textContent=T,M.setAttribute("aria-label",_),Object.assign(M.style,{minHeight:"44px",padding:O?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),O||(M.style.minWidth="44px"),O&&(M.dataset.panoramaTrigger=""),M.addEventListener("click",N),S.appendChild(M)};if(x[0]){let T=o.get(x[0])?.label??x[0];A("\u2039",`View previous seat ${T}`,()=>{e.flyToSeat(x[0])})}if(r.getSeatView){let T=r.seatViewActionLabel?.(u)??"Open 360\xB0 panorama";A(h?`\u21BB Retry ${T}`:`\u25C9 ${T}`,`${h?"Retry":T} from seat ${b}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(u,400,m)},!0)}if(x[1]){let T=o.get(x[1])?.label??x[1];A("\u203A",`View next seat ${T}`,()=>{e.flyToSeat(x[1])})}return S.childElementCount?(t.appendChild(d),s=d,c(),d):null},remove:l,layout:c}}function zr(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let f=document.createElement("button");f.type="button",f.textContent="\u2212",f.setAttribute("aria-label","Zoom out of the 3D venue"),f.dataset.tooltip="Zoom out";let u=document.createElement("button");u.type="button",u.textContent="+",u.setAttribute("aria-label","Zoom into the 3D venue"),u.dataset.tooltip="Zoom in";for(let p of[c,l,f,u])p.className="sl-3d-icon-control",Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(u,f);let m=p=>{n.setPrimaryDragMode(p);let g=p==="orbit";c.setAttribute("aria-pressed",String(g)),l.setAttribute("aria-pressed",String(!g)),c.style.background=g?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=g?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=g?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),f.addEventListener("click",()=>n.zoomBy(1.22)),u.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let h=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",u.style.display=p?"none":"",f.style.display=p?"none":""};return h(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),h()},seatViewLocked:()=>i,layout:h}}function Ur(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:f,tapMs:u,cancelFlight:m,focusSectionCamera:h,setSelection:d,ensureSeatView:p}=e,g=0,b=0,y=0,S=-1,w=!1,P=!1,x=O=>{e.seatViewLocked()||S===-1&&(S=O.pointerId,g=O.clientX,b=O.clientY,y=performance.now(),w=!1,P=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},A=O=>{O.pointerId===S&&Math.hypot(O.clientX-g,O.clientY-b)>f&&(w=!0)},T=(O,M,C,k,v)=>{let F=t.canvas.getBoundingClientRect(),V=t.canvas.clientWidth||F.width||1,R=t.canvas.clientHeight||F.height||1,E=O-F.left,D=M-F.top,X=k*k,H=-1,W=X,z=1/0;for(let G of o){if(C&&G.sectionId!==C)continue;let U=r.seats.idToIndex.get(G.id);if(U===void 0)continue;if(v){let ae=Math.round(r.seats.iState[U]??0);if(ae!==0&&ae!==3)continue}let Y=U*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],V,R);if(!K.visible)continue;let Z=K.x-E,Q=K.y-D,ee=Z*Z+Q*Q;(ee<W||Math.abs(ee-W)<1&&K.depth<z)&&(H=U,W=ee,z=K.depth)}return H},_=(O,M)=>{let C=e.gpu(),k=e.pick();if(!C||!k)return-1;k.syncFromSeatProgram(C.seatProgram);let v=t.canvas.getBoundingClientRect(),F=t.renderer.dpr,{x:V,y:R}=Cr(O,M,v,F,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),E=Math.max(2,Math.round(8*F));return k.pick(n.camera,V,R,E)};return{onDown:x,onMove:A,onUp:O=>{if(O.pointerId!==S)return;let M=!w&&performance.now()-y<u;if(S=-1,P){P=!1;return}let C=e.gpu(),k=e.pick();if(!M||!C||!k)return;let v=_(O.clientX,O.clientY);if(e.focusedSectionId()&&v>=0){let R=c[v],E=R?l.get(R):void 0;if(E&&E!==e.focusedSectionId()&&h(E))return}if(e.focusedSectionId()&&v<0&&(v=T(O.clientX,O.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&v<0){let R=T(O.clientX,O.clientY,null,72,!1),E=R>=0?c[R]:void 0,D=E?l.get(E):void 0;if(D&&D!==e.focusedSectionId()&&h(D))return}if(!e.focusedSectionId()){v<0&&(v=T(O.clientX,O.clientY,null,42,!1));let R=v>=0?c[v]:void 0,E=R?l.get(R):void 0;if(E&&h(E))return}if(v<0||v>=c.length){e.selection().size&&(d([]),i.onViewTargetChange?.(null));return}let F=c[v],V=xe[Math.round(r.seats.iState[v]??0)]??"available";if(V!=="available"&&V!=="selected"){i.onSeatInspect?.(F,V);return}if(e.selection().has(F)&&e.selection().size===1){d([]),i.onViewTargetChange?.(null);return}d([F]),p(F),s.seatPicked(F,l.get(F)),i.onSeatPick?.(F)}}}var qt=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let h=0;h<this.count;h++){let d=t[h*3],p=t[h*3+2];d<n&&(n=d),d>o&&(o=d),p<r&&(r=p),p>i&&(i=p)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),f=h=>{let d=Math.min(this.cols-1,Math.max(0,Math.floor((t[h*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[h*3+2]-r)/this.cell)))*this.cols+d};for(let h=0;h<this.count;h++)l[f(h)+1]++;for(let h=0;h<c;h++)l[h+1]+=l[h];let u=new Int32Array(this.count),m=l.slice(0,c);for(let h=0;h<this.count;h++)u[m[f(h)]++]=h;this.cellStart=l,this.cellItems=u}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),f=Math.floor((n-this.minZ)/this.cell),u=Math.ceil(r/this.cell)+1,m=this.iPosition,h=0;for(let d=0;d<=u&&h<s;d++){let p=f-d,g=f+d,b=l-d,y=l+d;for(let S=p;S<=g&&h<s;S++){if(S<0||S>=this.rows)continue;let w=S===p||S===g;for(let P=b;P<=y&&h<s;P++){if(!w&&P!==b&&P!==y){P=y-1;continue}if(P<0||P>=this.cols)continue;let x=S*this.cols+P;for(let A=i[x],T=i[x+1];A<T&&h<s;A++){let _=a[A],N=m[_*3]-t,O=m[_*3+2]-n;N*N+O*O<=c&&(o[h++]=_)}}}}return h}};var Zt=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Dt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new qt(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<sn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>an){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,an,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};import{Quat as ss,Vec3 as cs}from"ogl";function Hr(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:f}=e,u=0,m=-1,h=(P,x,A=28)=>{o.camera.position.set(P[0],P[1],P[2]),o.camera.lookAt(new cs(x[0],x[1],x[2])),o.camera.fov=A,o.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.textContent="\u2302",d.setAttribute("aria-label","Fit the active level or whole venue in view"),d.dataset.tooltip="Fit view",Object.assign(d.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let p=()=>{d.textContent="\u2302"};p();let g=P=>{m=P;let x=e.gpu();x&&(x.seatProgram.uniforms.uFocusFloor.value=P,x.solidProgram.uniforms.uFocusFloor.value=P,x.chairProgram.uniforms.uFocusFloor.value=P),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),d.style.display="",c.setVisible(!0),e.setFrozen(!1);let P=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!P),e.setSeatViewLocked(!1),y(),e.removeArriveChip(),e.setNavigationMode("orbit"),P){let x=P.focalWorld[0]-P.center[0],A=P.focalWorld[2]-P.center[2],T=Math.hypot(x,A)>P.radius*.12?Math.atan2(x,A):l,_={center:P.center,radius:P.radius,box:P.box},N={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(_,!1,T,!1,N):o.frameSoft(_,T,!1,N)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,f):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,f);e.showSectionSeatLabels(null),s.requestRender()},y=()=>{u++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},S=P=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let x=n.seats.idToIndex.get(P);if(x===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(P),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),d.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let A=++u;e.removeArriveChip();let{eye:T,focal:_}=e.resolvedSeatViewPose(P,x),N=[o.camera.position.x,o.camera.position.y,o.camera.position.z],O=Fn(N,T,_,n.bounds.center,n.bounds.radius),M=r.arriveAtSeatEye?T:O.finalPos,C=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,k=[O.waypoints[0],O.waypoints[1],M];if(c.setVisible(!1),e.reducedMotion())return h(M,_,C),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(P,A),Promise.resolve();let v=new ss().copy(o.camera.quaternion),F=Lr(o.camera,M,_);return s.requestRender(),i.start(k,v,F,2500,C).then(()=>{e.isDisposed()||A!==u||(a.cinematicPlayed(2500),o.resumeAfterFlight(_),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(P,A))})},w=P=>{let x=n.sections.find(N=>N.id===P);if(!x||x.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==x.floorIndex&&g(x.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(P);let A=x.focalWorld[0]-x.center[0],T=x.focalWorld[2]-x.center[2],_=Math.hypot(A,T)>x.radius*.12?Math.atan2(A,T):void 0;return o.frame({center:x.center,radius:Math.max(5,x.radius*.5)},!1,_),r.onSectionFocusChange?.(P),s.requestRender(),!0};return d.addEventListener("click",b),{overviewChip:d,layoutOverviewChip:p,flightGen:()=>u,focusedFloor:()=>m,applyFloorFocus:g,placeCameraFinal:h,cancelFlight:y,focusOverview:b,flyToSeat:S,focusSectionCamera:w}}function Yr(e){let t=performance.now();return{model:gt(e),buildMs:performance.now()-t,source:"main"}}function ls(e){return typeof Worker>"u"?Promise.resolve(Yr(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",import.meta.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Yr(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var us=Math.PI/180,ms=6,ds=500;function Wu(e,t,n={}){let r=performance.now(),o=t.prepared?.model??gt(t),i=new Kt(n.onAnalytics),a=new Array(o.seats.count);for(let[L,B]of o.seats.idToIndex)a[B]=L;let s=new Map(t.seats.map(L=>[L.id,L])),c=new Map;for(let L of t.seats){if(!L.rowId)continue;let B=c.get(L.rowId);B?B.push(L.id):c.set(L.rowId,[L.id])}let l=new Map;for(let L of t.seats)l.set(L.id,L.sectionId);let f=t.doc.floors?.some(B=>(B.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(B=>B.objects)??t.doc.objects).some(B=>B.type==="section"&&((B.height??0)>0||(B.rake??0)>0)),u=null,m=null,h=!1,d=!1,p=!1,g=new Map,b=null,y=null,S=null,w=new Map,P=null,x=()=>{S===null&&(S=e.style.zIndex,e.style.zIndex="20")},A=()=>{S!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=S),S=null)},T=!1,_=()=>T?me.focusedFloor():-1,N=()=>{u=Ar(k.gl,o),m=new Wt(k.renderer,u.seatGeometry,u.chairGeometry,u.solidGeometry,o.seats.count),k.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),u.seatProgram.uniforms.uSeatRadius.value=Ce*o.theme.seatScale,u.seatProgram.uniforms.uFocusFloor.value=_(),u.solidProgram.uniforms.uFocusFloor.value=_(),u.chairProgram.uniforms.uFocusFloor.value=_(),u.screenProgram&&(u.screenProgram.uniforms.uFocusFloor.value=_()),M.forceRegather()},O=!1,M=new Zt({model:o,orbit:()=>v,gpu:()=>u}),C=L=>M.setDetailEnabled(L),k=new Ft(e,{onContextLost:()=>{p||i.contextLost(),h=!0,Y.stop(),u=null,m=null},onContextRestored:()=>{N(),h=!1,p||i.contextRestored(),Y.requestRender()}}),v=new Tt(k.gl,k.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());v.setAspect(k.aspect);let F=(t.doc.floors?.flatMap(L=>L.objects)??t.doc.objects).some(L=>L.type==="section"&&L.physical3dProvenance?.surfaceKind?.status==="inferred"),V=(()=>{if(F&&o.stages.length===0)return;let L=o.focalWorld[0]-o.bounds.center[0],B=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(L,B)>o.bounds.radius*.12?Math.atan2(L,B):void 0})(),R=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,E=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;v.frame(o.bounds,!E&&n.skipInitialOverviewAnimation!==!0,V,n.portraitOverviewCrop===!0,R);let D=new jt(v.camera),X=Nr(e),H=new Yt(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),W=o.labels,z=()=>Wo(W,o.floors.length,_());H.setLabels(z());let G=null,U=L=>{if(G=L,H.setForcedDense(!!L),!L){H.setLabels(z());return}let B=t.seats.filter(q=>q.sectionId===L),j=new Set(B.map(q=>q.id)),J=new Set(B.map(q=>q.rowId)),te=new Set(g.keys()),ne=new Set(B.filter(q=>te.has(q.id)).map(q=>q.id)),ce=z().filter(q=>q.kind!=="row"&&q.kind!=="seat"||(q.kind==="row"?J.has(q.id.slice(4)):j.has(q.id.slice(5))&&(ne.size===0||ne.has(q.id.slice(5)))));if(o.seatCount<=6e3&&ne.size===0){H.setLabels(ce);return}let le=ne.size?B.filter(q=>ne.has(q.id)):B,ze=new Set(le.map(q=>`seat:${q.id}`)),_e=le.flatMap(q=>{let de=o.seats.idToIndex.get(q.id);if(de===void 0)return[];let Pe=de*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Pe],o.seats.iPosition[Pe+1]+(te.has(q.id)?1.05:.55),o.seats.iPosition[Pe+2]]}]});H.setLabels([...ce.filter(q=>!ze.has(q.id)),..._e])};N();let Y=new Et(L=>{if(h||!u||d)return!1;let j=D.active?D.update(performance.now()):v.update(),J=_()>=0?o.floors[_()]:null,te=J?.radius??o.bounds.radius,ne=no(v.currentDistance,te),ce=O?{center:[v.camera.position.x,v.camera.position.y,v.camera.position.z],radius:520}:o.renderBounds;v.updateClipping(ce);let le=J?.center??o.renderBounds.center,ze=J?.radius??o.renderBounds.radius,_e=(Ae,at)=>Math.hypot(v.camera.position.x-Ae[0],v.camera.position.y-Ae[1],v.camera.position.z-Ae[2])<=at*(M.detailVisible?1.8:1.55),q=_e(le,ze);if(!q&&G){let Ae=o.sections.find(at=>at.id===G);Ae&&(q=_e(Ae.center,Math.max(12,Ae.radius*2)))}M.detailVisible=q;let de=u.seatProgram.uniforms;de.uSeatScale.value=ne.scale,de.uSeatFade.value=ne.fade;let Pe=!!J&&oo(J.seatCount,k.canvas.clientWidth||1,k.canvas.clientHeight||1),St=ro(o.seats.count,te,v.currentDistance,v.camera.fov,k.canvas.clientHeight||1),it=M.detailVisible||Pe||St?1:0,Pt=M.detailVisible||_()>=0||o.floors.length>1?1:0;return M.ease(L,it,Pt),de.uSeatDetail.value=M.seatDetailMix,u.solidProgram.uniforms.uStructureDetail.value=M.structureDetailMix,de.uMinPixels.value=ne.minPixels,de.uPixelToWorld.value=2*Math.tan(v.camera.fov*us/2)/Math.max(1,k.pixelHeight),M.update(M.detailVisible),k.renderer.render({scene:u.background,clear:!0}),k.renderer.render({scene:u.main,camera:v.camera,clear:!1}),H.update(v.camera.projectionViewMatrix,k.canvas.clientWidth||1,k.canvas.clientHeight||1,v.currentDistance,te,[v.camera.position.x,v.camera.position.y,v.camera.position.z]),j||M.seatDetailMix!==it||M.structureDetailMix!==Pt}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>$t.resize()):null;K?.observe(e);let Z=L=>{let B=te=>{let ne=o.seats.idToIndex.get(te);return ne===void 0?void 0:o.seats.iState[ne]},{updates:j,next:J}=Fr(g,L,B);if(g=J,H.setSelectedSeatIds(g.keys()),G&&U(G),j.length){let te=mn(o.seats,j);u&&u.uploadSeatStateRuns(te),Y.requestRender()}},Q=()=>P!==null?P:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=8,ae=L=>{if(!n.getSeatView)return null;let B=w.get(L);if(!B)for(B=Promise.resolve(n.getSeatView(L)),w.set(L,B),B.catch(()=>{w.get(L)===B&&w.delete(L)});w.size>ee;){let j=w.keys().next().value;if(j===void 0)break;w.delete(j)}return B},Ne=(L,B)=>{let j=s.get(L),J=Math.max(0,Math.round(o.seats.iFloor[B]??0)),te=t.doc.floors?.[J],ne=o.floors[J],ce=te?.focalPoint??t.doc.focalPoint,le=ne?{x:ne.focalWorld[0]/I,y:ne.focalWorld[2]/I}:ce,ze=j?.focalPoint?{x:j.focalPoint.x+le.x-ce.x,y:j.focalPoint.y+le.y-ce.y}:le,_e=[o.seats.iPosition[B*3],o.seats.iPosition[B*3+1],o.seats.iPosition[B*3+2]];return Or(_e,ze,te?.baseHeightM??0,j?.eyeHeightM)},Ge=()=>(e.clientWidth||k.canvas.clientWidth)<=520,ve=null,Te=null,Ee=async(L,B,j)=>{if(!n.getSeatView||p||j!==me.flightGen())return;let J;try{J=await Br()}catch{if(i.panoramaFailed(L,"mount"),!p&&j===me.flightGen()){let te=pe(L,j,!0);requestAnimationFrame(()=>te?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(p||j!==me.flightGen()||!ve))return Te??=J.createOpenPanorama(ve),Te(L,B,j)},Me=Gr({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Ge,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:L=>kn(L),openPanorama:(L,B,j)=>Ee(L,B,j)}),pe=Me.show,se=Me.remove,Ze=Me.layout,we=zr({container:e,orbit:v,isNarrow:Ge}),Qe=we.element,Se=we.setNavigationMode,De=we.setSeatViewLocked,wt=we.layout,Xr=we.utilityControls,me=Hr({container:e,model:o,opts:n,orbit:v,cinematic:D,analytics:i,loop:Y,labelOverlay:H,stageAzimuth:V,overviewFraming:R,gpu:()=>u,isDisposed:()=>p,panorama:()=>b,setPanorama:L=>{b=L},setPanoramaSphereVisible:L=>{O=L},panoramaLoadAbort:()=>y,setPanoramaLoadAbort:L=>{y=L},setFrozen:L=>{d=L},restorePanoramaLayer:A,reducedMotion:Q,resolvedSeatViewPose:Ne,showSectionSeatLabels:U,setNearFieldDetailEnabled:C,setSeatViewLocked:De,setNavigationMode:Se,showArriveChip:pe,removeArriveChip:se});T=!0;let Qt=me.overviewChip,Wr=me.layoutOverviewChip,jr=me.applyFloorFocus,Kr=me.focusOverview,Dn=me.cancelFlight,kn=me.flyToSeat,_n=me.focusSectionCamera;Xr.appendChild(Qt),ve={container:e,model:o,opts:n,analytics:i,orbit:v,loop:Y,seatsById:s,ensureSeatView:ae,resolvedSeatViewPose:Ne,gpu:()=>u,gl:k.gl,isContextLost:()=>h,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:L=>{b=L},getLoadAbort:()=>y,setLoadAbort:L=>{y=L},setPanoramaSphereVisible:L=>{O=L},setFrozen:L=>{d=L},raisePanoramaLayer:x,restorePanoramaLayer:A,getOverviewChip:()=>Qt,labelOverlay:H,reducedMotion:Q,removeArriveChip:se,showArriveChip:pe};let ke=Ur({glctx:k,orbit:v,model:o,seats:t.seats,opts:n,cinematic:D,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:ms,tapMs:ds,gpu:()=>u,pick:()=>m,seatViewLocked:()=>we.seatViewLocked(),focusedSectionId:()=>G,selection:()=>g,cancelFlight:Dn,focusSectionCamera:_n,setSelection:Z,ensureSeatView:ae});k.canvas.addEventListener("pointerdown",ke.onDown),k.canvas.addEventListener("pointermove",ke.onMove),k.canvas.addEventListener("pointerup",ke.onUp),k.canvas.addEventListener("pointercancel",ke.onUp),Y.requestRender();let $t={setAvailability(L){let B=Ir(g,L),j=mn(o.seats,B);j.length&&u&&u.uploadSeatStateRuns(j),Y.requestRender()},setSelection:Z,flyToSeat:kn,focusOverview:Kr,resize(){let{width:L,height:B}=k.resize();v.setAspect(L/Math.max(1,B)),Ze(),wt(),Wr(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:u?u.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let L=Y.stats(),B=k.canvas.clientWidth||1,j=k.canvas.clientHeight||1,J=o.bounds.center,te=Ve(v.camera.projectionViewMatrix,[J[0],o.bounds.box.min[1],J[2]],B,j),ne=Ve(v.camera.projectionViewMatrix,[J[0],o.bounds.box.max[1],J[2]],B,j),ce=o.bounds.box,le=[ce.min[0],ce.max[0]].flatMap(q=>[ce.min[1],ce.max[1]].flatMap(de=>[ce.min[2],ce.max[2]].map(Pe=>Ve(v.camera.projectionViewMatrix,[q,de,Pe],B,j)))).filter(q=>Number.isFinite(q.x)&&Number.isFinite(q.y)&&Number.isFinite(q.depth)),ze=le.length?(()=>{let q=Math.min(...le.map(Ue=>Ue.x)),de=Math.max(...le.map(Ue=>Ue.x)),Pe=Math.min(...le.map(Ue=>Ue.y)),St=Math.max(...le.map(Ue=>Ue.y)),it=Math.max(0,q),Pt=Math.min(B,de),Ae=Math.max(0,Pe),at=Math.min(j,St),At=Math.max(0,Pt-it),Jt=Math.max(0,at-Ae);return{box:{x:it,y:Ae,width:At,height:Jt},horizontalFillRatio:At/B,verticalFillRatio:Jt/j,visibleAreaRatio:At*Jt/(B*j),clippedEdges:[...Pe<0?["top"]:[],...de>B?["right"]:[],...St>j?["bottom"]:[],...q<0?["left"]:[]]}})():void 0,_e=String(k.gl.getParameter(k.gl.VERSION)??"");return{viewport:{width:B,height:j},context:{webgl2:/webgl\s*2/i.test(_e),lost:h},frame:{rendered:L.rendered,idle:L.idle},camera:{position:[v.camera.position.x,v.camera.position.y,v.camera.position.z],distance:v.currentDistance,verticalFovDeg:v.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:f,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:te.visible&&ne.visible?Math.abs(te.y-ne.y):0},labels:H.qualityEvidence(),framing:ze}},getQualityReport(){return Pn($t.getQualityEvidence())},loseContextForTest(){k.simulateContextLossCycle()},floors(){return o.floors},focusFloor(L){if(L!==null&&!o.floors.some(j=>j.index===L))return!1;let B=L??-1;if(C(L!==null),De(!1),jr(B),Se("orbit"),L===null)D.cancel(),Q()?v.frame(o.bounds,!1,V,n.portraitOverviewCrop===!0,R):v.frameSoft(o.bounds,V,n.portraitOverviewCrop===!0,R);else{let j=o.floors[L];if(j.seatCount>0){D.cancel();let J=j.focalWorld[0]-j.center[0],te=j.focalWorld[2]-j.center[2],ne=Math.hypot(J,te)>j.radius*.12?Math.atan2(J,te):V;v.frame({center:j.center,radius:j.radius,box:j.box},!1,ne,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(L){let B=o.zones.find(ne=>ne.id===L);if(!B||B.seatCount===0)return!1;C(!1),De(!1),D.cancel(),Se("orbit"),U(null),n.onSectionFocusChange?.(null);let j=B.focalWorld[0]-B.center[0],J=B.focalWorld[2]-B.center[2],te=Math.hypot(j,J)>B.radius*.12?Math.atan2(j,J):void 0;return v.frame({center:B.center,radius:B.radius*1.25},!1,te),Y.requestRender(),!0},sections(){return o.sections},focusSection(L){return _n(L)},rows(L){return L?o.rows.filter(B=>B.sectionId===L):o.rows},seatsInRow(L){return t.seats.filter(B=>B.rowId===L).map(B=>({id:B.id,label:B.displayLabel||B.label}))},focusRow(L){let B=o.rows.find(j=>j.id===L);return!B||B.seatCount===0?!1:(C(!0),De(!1),D.cancel(),Se("pan"),B.sectionId&&(U(B.sectionId),n.onSectionFocusChange?.(B.sectionId)),v.frame({center:B.center,radius:Math.max(2.5,B.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(L){P=L},dispose(){p=!0,se(),Qt.remove(),Qe.remove(),Dn(),Y.stop(),H.dispose(),K?.disconnect(),b&&(b.dispose(),b=null),A(),X(),k.canvas.removeEventListener("pointerdown",ke.onDown),k.canvas.removeEventListener("pointermove",ke.onMove),k.canvas.removeEventListener("pointerup",ke.onUp),k.canvas.removeEventListener("pointercancel",ke.onUp),v.dispose(),m&&m.dispose(),u&&u.dispose(),u=null,m=null,k.dispose()}};return i.opened(o.seatCount,f,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),$t}export{Ta as VENUE3D_QUALITY_REPORT_VERSION,gt as buildSceneModel,Pn as inspectVenue3DQualityEvidence,Wu as mountVenue3D,ls as prepareVenue3D};
|