@seatlayer/core 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/categoryInventory-BwarniiK.d.ts +109 -0
- package/dist/categoryInventory-D3qPwfKz.d.cts +109 -0
- package/dist/chunk-55NOSZK5.js +1 -0
- package/dist/chunk-6VTTBC5F.js +1 -0
- package/dist/chunk-6XJN4REG.js +1 -0
- package/dist/chunk-7PT7OQUO.js +1 -0
- package/dist/chunk-AQKYUJBX.js +1 -0
- package/dist/chunk-CXF32VPG.js +1 -0
- package/dist/chunk-DNGP2HDT.js +1 -0
- package/dist/chunk-EQM4FFN5.js +1 -0
- package/dist/chunk-HHM3PB66.js +1 -0
- package/dist/chunk-PXWKSYCK.js +1 -0
- package/dist/chunk-VDZ24QVV.js +1 -0
- package/dist/chunk-VI2CLV3Y.js +1 -0
- package/dist/core/chart-ops/index.cjs +1 -0
- package/dist/core/chart-ops/index.d.cts +1235 -0
- package/dist/core/chart-ops/index.d.ts +1235 -0
- package/dist/core/chart-ops/index.js +1 -0
- package/dist/core/color.cjs +1 -0
- package/dist/core/color.d.cts +192 -0
- package/dist/core/color.d.ts +192 -0
- package/dist/core/color.js +1 -0
- package/dist/core/inventory/index.cjs +1 -0
- package/dist/core/inventory/index.d.cts +209 -0
- package/dist/core/inventory/index.d.ts +209 -0
- package/dist/core/inventory/index.js +1 -0
- package/dist/core/layout/index.cjs +1 -0
- package/dist/core/layout/index.d.cts +376 -0
- package/dist/core/layout/index.d.ts +376 -0
- package/dist/core/layout/index.js +1 -0
- package/dist/core/quality/index.cjs +1 -0
- package/dist/core/quality/index.d.cts +132 -0
- package/dist/core/quality/index.d.ts +132 -0
- package/dist/core/quality/index.js +1 -0
- package/dist/core/render-assets/index.cjs +1 -0
- package/dist/core/render-assets/index.d.cts +99 -0
- package/dist/core/render-assets/index.d.ts +99 -0
- package/dist/core/render-assets/index.js +1 -0
- 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/seatConfidence.js +1 -1
- package/dist/core/sections/index.cjs +1 -0
- package/dist/core/sections/index.d.cts +346 -0
- package/dist/core/sections/index.d.ts +346 -0
- package/dist/core/sections/index.js +1 -0
- package/dist/{de-75NWRKC5.js → de-WPX4D3SY.js} +1 -1
- package/dist/{es-BM7EJ7PW.js → es-6KAJQVVX.js} +1 -1
- package/dist/{fr-HPXQHIB4.js → fr-5DTMRBN5.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +85 -534
- package/dist/index.d.ts +85 -534
- package/dist/index.js +1 -1
- package/dist/labeling-BmCzW50y.d.ts +90 -0
- package/dist/labeling-VfJBEOn0.d.cts +90 -0
- package/dist/layout-ClQkmixY.d.ts +181 -0
- package/dist/layout-Dlv5bIf2.d.cts +181 -0
- package/dist/renderedQuality-B3jgdgPO.d.ts +113 -0
- package/dist/renderedQuality-bDkUOyBL.d.cts +113 -0
- package/dist/renderer-B_g-W_QB.d.ts +534 -0
- package/dist/renderer-DySMcKAR.d.cts +534 -0
- package/dist/sections-DIzgtDjF.d.ts +123 -0
- package/dist/sections-Dna1nZgR.d.cts +123 -0
- package/dist/segmentedRowModel-BNXEUeHp.d.cts +75 -0
- package/dist/segmentedRowModel-COXw4GCh.d.ts +75 -0
- package/dist/ticketRestrictions-CzchbX_o.d.cts +72 -0
- package/dist/ticketRestrictions-DaYOCpEw.d.ts +72 -0
- package/dist/{types-tLOunI-B.d.cts → types-DTSG6_Hq.d.cts} +238 -761
- package/dist/{types-tLOunI-B.d.ts → types-DTSG6_Hq.d.ts} +238 -761
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +27 -27
- package/dist/view3d/index.d.cts +109 -2
- package/dist/view3d/index.d.ts +109 -2
- package/dist/view3d/index.js +26 -26
- package/package.json +94 -5
- package/dist/chunk-54A7LIL5.js +0 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var si=Object.create;var Pt=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var li=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var mi=(t,e)=>{for(var n in e)Pt(t,n,{get:e[n],enumerable:!0})},zn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of li(e))!di.call(t,o)&&o!==n&&Pt(t,o,{get:()=>e[o],enumerable:!(r=ci(e,o))||r.enumerable});return t};var Ze=(t,e,n)=>(n=t!=null?si(ui(t)):{},zn(e||!t||!t.__esModule?Pt(n,"default",{value:t,enumerable:!0}):n,t)),fi=t=>zn(Pt({},"__esModule",{value:!0}),t);var Ks={};mi(Ks,{buildSceneModel:()=>it,mountVenue3D:()=>Ws,prepareVenue3D:()=>oi});module.exports=fi(Ks);var jn=require("ogl");var pi=/^#?([\da-f]{3}|[\da-f]{6})$/i;function hi(t){let e=pi.exec((t??"").trim());if(!e)return null;let n=e[1].length===3?e[1].split("").map(o=>o+o).join(""):e[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ne(t){let e=hi(t);return e?[e[0]/255,e[1]/255,e[2]/255]:null}function on(t){let e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function bi(t){return .2126*on(t[0])+.7152*on(t[1])+.0722*on(t[2])}function Gn(t){return bi([t[0]*255,t[1]*255,t[2]*255])}function yi(t){return .2126*t[0]+.7152*t[1]+.0722*t[2]}function fe(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n,t[2]+(e[2]-t[2])*n]}function ut(t,e){let n=yi(t);return fe(t,[n,n,n],e)}var Me=["available","held","sold","selected","dimmed"];function dt(t){let e=Me.indexOf(t);return e<0?0:e}var Hn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Un(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 rn={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]},Xe={top:[.05,.06,.08],bottom:[.1,.12,.15]};function be(t,e){return[Math.min(1,t[0]*e),Math.min(1,t[1]*e),Math.min(1,t[2]*e)]}function gi(){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 jn.Renderer({canvas:this.canvas,dpr:gi(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Xe.top[0],Xe.top[1],Xe.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))}};var Je=require("ogl"),de=Math.PI/180,an=15*de,sn=80*de,Qe=.12,Yn=35,Xn=1.25,At=class{constructor(e,n,r,o){this.fovY=Yn;this.target=new Je.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;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 Je.Vec3;this.panAnchor=new Je.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Je.Camera(e,{fov:Yn,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 u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;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(an,Math.min(sn,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*de;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(an,Math.min(sn,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*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,u=-i,l=Math.cos(this.polar),d=Math.sin(this.polar),m=-i*l,p=-a*l;this.targetT.x+=(-e*s+n*m)*o,this.targetT.z+=(-e*u+n*p)*o,this.targetT.y+=n*d*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*de/2,u=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*u);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let d=this.fitDistance(e,s,l,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??Xn)),this.minDist=Math.max(2,a*.12),this.maxDist=d*4,n?(this.azimuth=this.azT,this.polar=12*de,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*de/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))*de;let u=this.fitDistance(e,i,s,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,o?.margin??Xn))}fitDistance(e,n,r,o,i){let a=Math.max(1,e.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),u=e.box;if(!u)return s;let l=Math.sin(i),d=-l*Math.sin(o),m=-Math.cos(i),p=-l*Math.cos(o);if(Math.abs(m)>.999)return s;let c=-p,f=d,h=Math.hypot(c,f);c/=h,f/=h;let b=-f*m,g=f*d-c*p,y=c*m,x=Math.tan(r),w=Math.tan(n),R=1;for(let M=0;M<8;M++){let k=(M&1?u.max[0]:u.min[0])-e.center[0],O=(M&2?u.max[1]:u.min[1])-e.center[1],L=(M&4?u.max[2]:u.min[2])-e.center[2],U=k*d+O*m+L*p,z=Math.abs(k*c+L*f),_=Math.abs(k*b+O*g+L*y);R=Math.max(R,z/x-U,_/w-U)}return Math.min(s,Math.max(R,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),u=Math.max(s+10,i+a);this.camera.perspective({near:s,far:u,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),u=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*Qe,this.polar+=n*Qe,this.distance+=r*Qe,this.target.x+=o*Qe,this.target.y+=i*Qe,this.target.z+=a*Qe,u&&this.applyPosition(),u}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(an,Math.min(sn,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 et=2.5,xi=1.15,mt=6,tt=10,Wn=6,Kn=9.5,qn=.9,$n=2.2,cn=30,ln=4,It=8192;var rc=tt+ln;function Zn(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:et};let o=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:et+o*(xi-et)}}function Qn(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function Jn(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}var vi=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],ac=new Map(vi.map(t=>[t.key,t]));var Si={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","plus-size":"#ec4899","lift-armrest":"#22c55e"};function eo(t){let e=t?.[0];return e&&Si[e]||"#3b82f6"}var Mi=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],sc=new Map(Mi.map(t=>[t.key,t]));var wi=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],cc=new Set(wi);var Ce=.02291666666666667,Ve=1/Ce,Pi=58,Ci=Pi*Ce;var Ai=3,to=0,un=120,Ri=0,Ii=45,Ti=7,Tt=1.2;function dn(t,e,n,r){return Number.isFinite(t)?Math.max(e,Math.min(n,t)):r}function Ei(t){return!Number.isFinite(t)||!Number.isInteger(t)||t<0?0:t<=Ti?t:Ai}function no(t,e={}){let n=dn(e.floorBaseHeightM,to,un,0),r=Math.min(un,n+Ei(t.elevation)*Ci),o=t.height===void 0?r:dn(t.height,to,un,r),i=dn(t.rake,Ri,Ii,0);return{height:o,rake:i}}var ro=Ze(require("earcut"),1),io=Ze(require("polygon-clipping"),1);var dc=Math.PI/180;function mn(t){let e=0,n=0;for(let o of t)e+=o.x,n+=o.y;let r=t.length||1;return{x:e/r,y:n/r}}function ft(t){return t.length?mn(t):null}function We(t){let e=0;for(let n=0,r=t.length;n<r;n+=1){let o=t[n],i=t[(n+1)%r];e+=o.x*i.y-i.x*o.y}return e/2}function pt(t,e,n){let r=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let a=t[o],s=t[i];a.y>n!=s.y>n&&e<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var D=Ce,ki=.002;function Fi(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<ki}var Ke=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)}},Ft=class{constructor(){this.pos=new Ke;this.nor=new Ke;this.col=new Ke;this.flr=new Ke;this.mat=new Ke;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){Fi(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,u=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(u[0],u[1],u[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 Di(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],u=n[2]-t[2],l=o*u-i*s,d=i*a-r*u,m=r*s-o*a,p=Math.hypot(l,d,m)||1;return l/=p,d/=p,m/=p,[l,d,m]}function Li(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=(0,ro.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function fn(t){return We(t)<0?[...t].reverse():t}var Oi=3;function _i(t,e,n,r){let o=r(t),i=r(e),a=r(n),s=(c,f,h,b)=>Math.abs(r({x:(c.x+f.x)/2,y:(c.y+f.y)/2})-(h+b)/2),u=(t.x+e.x+n.x)/3,l=(t.y+e.y+n.y)/3,d=(o+i+a)/3,m=Math.max(s(t,e,o,i),s(e,n,i,a),s(n,t,a,o),Math.abs(r({x:u,y:l})-d)),p=(c,f,h)=>{let b=Math.abs(r({x:(c+u)/2,y:(f+l)/2})-(h+d)/2);b>m&&(m=b)};return p((t.x+e.x)/2,(t.y+e.y)/2,(o+i)/2),p((e.x+n.x)/2,(e.y+n.y)/2,(i+a)/2),p((n.x+t.x)/2,(n.y+t.y)/2,(a+o)/2),m}function ht(t,e,n,r,o){if(o<=0)return _i(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(ht(t,i,s,r,o-1),ht(i,e,a,r,o-1),ht(s,a,n,r,o-1),ht(i,a,s,r,o-1))}function bt(t,e,n,r,o,i,a,s){if(a>0){let p={x:(e.x+n.x)/2,y:(e.y+n.y)/2},c={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+e.x)/2,y:(r.y+e.y)/2};bt(t,e,p,f,o,i,a-1,s),bt(t,p,n,c,o,i,a-1,s),bt(t,f,c,r,o,i,a-1,s),bt(t,p,c,f,o,i,a-1,s);return}let u=[e.x*D,o(e),e.y*D],l=[n.x*D,o(n),n.y*D],d=[r.x*D,o(r),r.y*D];if(s){t.triN(u,l,d,s(e),s(n),s(r),i);return}let m=Di(u,l,d);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(u,l,d,m,i)}var Bi=8;function oo(t,e,n){if(!Number.isFinite(n))return t;let r=[],o=(i,a,s,u,l)=>{if(l>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=e(d);if(Math.abs(m-(s+u)/2)>n){o(i,d,s,m,l-1),o(d,a,m,u,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),Bi)}return r}function Et(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],u=s.x-i.x,l=s.y-i.y,d=Math.hypot(u,l);d>e&&Math.abs((a.x-i.x)*l-(a.y-i.y)*u)/d<e||r.push(a)}return r.length>=3?r:n}var kt=.001*Ve*.1;function se(t,e,n,r,o,i,a,s,u=1/0,l){if(!e||e.length<3||(u===void 0&&(u=1/0),Math.abs(We(e))<1e-4))return;let d=Et(oo(Et(fn(e),kt),r,u),kt),m=n?.map(M=>Et(oo(Et(fn(M),kt),r,u),kt)).filter(M=>M.length>=3&&Math.abs(We(M))>=1e-4),{pts:p,tris:c}=Li(d,m),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],g=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],y=0;if(Number.isFinite(u))for(;y<Oi;y++){let M=0;for(let k=0;k<c.length;k+=3){let O=ht(p[c[k]],p[c[k+1]],p[c[k+2]],r,y);O>M&&(M=O)}if(M<=u)break}for(let M=0;M<c.length;M+=3){let k=p[c[M]],O=p[c[M+1]],L=p[c[M+2]];bt(t,k,O,L,r,f,y,l);let U=[k.x*D,o,k.y*D],z=[O.x*D,o,O.y*D],_=[L.x*D,o,L.y*D];t.tri(U,_,z,[0,-1,0],h)}let x=M=>{if(y<=0)return M;let k=1<<y,O=[];for(let L=0;L<M.length;L++){let U=M[L],z=M[(L+1)%M.length];for(let _=0;_<k;_++){let v=_/k;O.push({x:U.x+(z.x-U.x)*v,y:U.y+(z.y-U.y)*v})}}return O},w=mn(d),R=[{ring:x(d),flip:!1}];if(m)for(let M of m)M.length>=3&&R.push({ring:x(M),flip:!0});for(let{ring:M,flip:k}of R)for(let O=0;O<M.length;O++){let L=M[O],U=M[(O+1)%M.length],z=(U.x-L.x)*D,v=(U.y-L.y)*D,S=-z,C=Math.hypot(v,S)||1;v/=C,S/=C;let G=(L.x+U.x)/2-w.x,P=(L.y+U.y)/2-w.y,T=v*G+S*P;k&&(T=-T),T<0&&(v=-v,S=-S);let I=[v,0,S],E=[L.x*D,r(L),L.y*D],A=[U.x*D,r(U),U.y*D],F=[L.x*D,o,L.y*D],N=[U.x*D,o,U.y*D];t.tri(E,A,N,I,b,b,g),t.tri(E,N,F,I,b,g,g)}}function ao(t){let e=0;for(let u of t)e+=u.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 u of t)n.set(u.position,s*3),r.set(u.normal,s*3),o.set(u.color,s*3),i.set(u.floor,s),a.set(u.material,s),s+=u.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=fn(t),o=r.length,i=[];for(let s=0;s<o;s++){let u=r[s],l=r[(s+1)%o],d=l.x-u.x,m=l.y-u.y,p=Math.hypot(d,m)||1;i.push({x:m/p,y:-d/p})}let a=[];for(let s=0;s<o;s++){let u=r[s],l=i[(s-1+o)%o],d=i[s],m=l.x+d.x,p=l.y+d.y,c=Math.hypot(m,p),f=()=>{a.push([u.x+l.x*e,u.y+l.y*e]),a.push([u.x+d.x*e,u.y+d.y*e])};if(c<1e-9){f();continue}m/=c,p/=c;let h=m*l.x+p*l.y,b=1/Math.max(h,1e-6);if(!Number.isFinite(b)||b>n){f();continue}a.push([u.x+m*e*b,u.y+p*e*b])}if(a.length<3)return t;try{let s=io.default.union([[...a,a[0]]]),u=null,l=-1/0;for(let m of s){let p=Math.abs(We(m[0].map(([c,f])=>({x:c,y:f}))));p>l&&(l=p,u=m[0])}if(!u)return t;let d=u.map(([m,p])=>({x:m,y:p}));if(d.length>1){let m=d[0],p=d[d.length-1];Math.abs(m.x-p.x)<1e-9&&Math.abs(m.y-p.y)<1e-9&&d.pop()}return d.length>=3?d:t}catch{return t}}function Lt(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 yt(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 le={pedestal:0,pad:1,back:2,body:3,head:4},Ni=.44,Vi=.15,zi=.3,Gi=.24;function so(t){return t===void 0||!Number.isFinite(t)||t<=0?Gi:Math.min(zi,Math.max(Vi,t*Ni))}var pn=.21,Hi=.05,hn=.45,Ot=hn+Hi,Ui=[{part:le.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:le.pad,min:[-1,.36,-.95],max:[1,hn,1]},{part:le.back,min:[-1,Ot,-1],max:[1,.92,-.72]}],ji=[{part:le.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:le.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:le.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:le.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:le.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Yi=[{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 t=[],e=[],n=[],r=[],o=(C,G,P)=>{let T=n.length,[I,E,A]=C,F=[E[0]-I[0],E[1]-I[1],E[2]-I[2]],N=[A[0]-I[0],A[1]-I[1],A[2]-I[2]],Y=F[1]*N[2]-F[2]*N[1],V=F[2]*N[0]-F[0]*N[2],B=F[0]*N[1]-F[1]*N[0],j=Math.hypot(Y,V,B);j>1e-9?(Y/=j,V/=j,B/=j):[Y,V,B]=G,Y*G[0]+V*G[1]+B*G[2]<0&&(Y=-Y,V=-V,B=-B);for(let K of C)t.push(...K),e.push(Y,V,B),n.push(P);r.push(T,T+1,T+2,T,T+2,T+3)},i=C=>{for(let G of Yi){let P=G.c.map(T=>T.map((I,E)=>I?C.max[E]:C.min[E]));o(P,G.n,C.part)}};for(let C of Ui)i(C);for(let C of ji)i(C);let a=hn,s=1.08,u=.47,l=.69,d=-.55,m=.08,p=-.48,c=.01,f=[-u,a,d],h=[u,a,d],b=[-u,a,m],g=[u,a,m],y=[-l,s,p],x=[l,s,p],w=[-l,s,c],R=[l,s,c];o([h,x,R,g],[1,0,0],le.body),o([b,w,y,f],[-1,0,0],le.body),o([w,R,x,y],[0,1,0],le.body),o([f,h,g,b],[0,-1,0],le.body),o([g,R,w,b],[0,0,1],le.body),o([f,y,x,h],[0,0,-1],le.body);let M=10,k=8,O=[0,1.205,-.23],L=[.42,.115,.38],U=n.length;for(let C=0;C<=k;C++){let G=Math.PI*C/k,P=Math.cos(G),T=Math.sin(G);for(let I=0;I<=M;I++){let E=Math.PI*2*I/M,A=T*Math.cos(E),F=T*Math.sin(E);t.push(O[0]+L[0]*A,O[1]+L[1]*P,O[2]+L[2]*F);let N=A/L[0],Y=P/L[1],V=F/L[2],B=Math.hypot(N,Y,V)||1;N/=B,Y/=B,V/=B,e.push(N,Y,V),n.push(le.head)}}for(let C=0;C<k;C++)for(let G=0;G<M;G++){let P=U+C*(M+1)+G,T=P+M+1;r.push(P,T,P+1,P+1,T,T+1)}let z=new Float32Array(t),_=new Float32Array(e),v=new Float32Array(n),S=new Uint16Array(r);return{position:z,normal:_,part:v,index:S,vertexCount:n.length,indexCount:r.length}}function lo(t,e,n,r){let o=new Float32Array(e),i=l=>t[l*3],a=l=>t[l*3+2],s=0,u=(l,d)=>{let m=d-l;for(let p=l;p<d;p++){let[c,f]=r(p),h=c-i(p),b=f-a(p);if(m>=2){let g=Math.max(l,p-1),y=Math.min(d-1,p+1),x=i(y)-i(g),w=a(y)-a(g),R=Math.hypot(x,w);if(R>1e-6){let M=-w/R,k=x/R;M*h+k*b<0&&(M=-M,k=-k),h=M,b=k}}o[p]=h===0&&b===0?0:Math.atan2(h,b)}};for(let l=1;l<=e;l++)(l===e||n(l)!==n(s))&&(u(s,l),s=l);return o}var ke=.22;function uo(t,e){let n=Me[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 Xi=.42;function Wi(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 f of t)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),u=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*u/e),1e-6),d=Math.max(1,Math.ceil(s/l)+1),m=Math.max(1,Math.ceil(u/l)+1),p=new Map,c=(f,h)=>{let b=Math.min(d-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(m-1,Math.max(0,Math.floor((h-o)/l)))*d+b};for(let f=0;f<e;f++){let h=c(t[f].x,t[f].y),b=p.get(h);b?b.push(f):p.set(h,[f])}for(let f=0;f<e;f++){let h=t[f],b=Math.min(d-1,Math.max(0,Math.floor((h.x-r)/l))),g=Math.min(m-1,Math.max(0,Math.floor((h.y-o)/l))),y=1/0;for(let x=1;x<=4;x++){for(let w=g-x;w<=g+x;w++)if(!(w<0||w>=m))for(let R=b-x;R<=b+x;R++){if(R<0||R>=d||x>1&&Math.abs(w-g)<x&&Math.abs(R-b)<x)continue;let M=p.get(w*d+R);if(M)for(let k of M){if(k===f)continue;let O=Math.hypot(t[k].x-h.x,t[k].y-h.y);O<y&&(y=O)}}if(Number.isFinite(y)&&y<=x*l)break}n[f]=y}return n}function Ki(t){let e=t.eyeHeightM;return Number.isFinite(e)?Math.max(0,e-Tt):0}function mo(t,e,n,r,o){let i=t.length,a=new Float32Array(i*3),s=new Float32Array(i),u=new Float32Array(i*3),l=new Float32Array(i),d=new Float32Array(i),m=new Float32Array(i),p=new Float32Array(i*3),c=new Map,f=Wi(t);for(let h=0;h<i;h++){let b=t[h],y=(n?.seatPitchU(h)??f[h])*D;l[h]=Number.isFinite(y)?Math.max(.06,Math.min(ke,y*Xi)):ke,d[h]=so(Number.isFinite(y)?y:void 0),m[h]=b.wheelchairSpaceType==="no-seat"?0:1,a[h*3]=b.x*D,a[h*3+1]=n?n.seatDeckY(h):Ki(b),a[h*3+2]=b.y*D,s[h]=dt(e?e(b):"available");let x=ne(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[h*3]=x[0],u[h*3+1]=x[1],u[h*3+2]=x[2],b.accessibility?.length){let w=ne(eo(b.accessibility));w&&(p[h*3]=w[0],p[h*3+1]=w[1],p[h*3+2]=w[2])}c.set(b.id,h)}return{count:i,iPosition:a,iState:s,iCategory:u,iMaxRadius:l,iRing:p,idToIndex:c,iChairWidth:d,iPhysicalSeat:m,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var qi=64;function bn(t,e){let n=[];for(let a of e){let s=t.idToIndex.get(a.seatId);if(s===void 0)continue;let u=dt(a.state);t.iState[s]!==u&&(t.iState[s]=u,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+qi){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 $i=.15,Zi=.9,Qi=1.76,Ji=.7,ea=1.6;function ta(){return{background:{top:[...Xe.top],bottom:[...Xe.bottom]},structure:rn,seatStates:{...Hn},seatScale:1}}function fo(t){let e=ta();if(!t)return e;let n=ne(t.background);if(n){e.background={top:be(n,Zi),bottom:be(n,Qi)};let i={};for(let[a,s]of Object.entries(rn))i[a]=fe(s,n,$i);e.structure=i}let r=ne(t.selectionColor)??ne(t.accent);r&&(e.seatStates={...e.seatStates,selected:r});let o=t.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(e.seatScale=Math.min(ea,Math.max(Ji,o))),e}function po(t,e){let n=[];for(let r of e)n.push(...t.seatStates[r]);return n}function ho(t){let e=t.length;return e<=3?[...t]:[t[Math.floor(e*.25)],t[Math.floor(e*.5)],t[Math.floor(e*.75)]]}function nt(t,e,n){if(!t.length)return 1/0;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,u=a.y-i.y,l=s*s+u*u,d=l>1e-12?((e-i.x)*s+(n-i.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(e-(i.x+d*s),n-(i.y+d*u));m<r&&(r=m)}return r}function na(t){let e=0,n=0;for(let i of t)e+=i.x,n+=i.y;let r=t.length||1;e/=r,n/=r;let o=0;for(let i of t){let a=Math.hypot(i.x-e,i.y-n);a>o&&(o=a)}return{cx:e,cy:n,r:o}}function bo(t,e){return Math.hypot(t.cx-e.cx,t.cy-e.cy)-t.r-e.r}function yn(t,e){let n=1/0;for(let r of ho(t)){let o=nt(e,r.x,r.y);o<n&&(n=o)}for(let r of ho(e)){let o=nt(t,r.x,r.y);o<n&&(n=o)}return n}function oa(t,e){if(t.length<3)return{pts:t,seatIndices:e};let n=0,r=0;for(let d of t)n+=d.x,r+=d.y;n/=t.length,r/=t.length;let o=-1,i=t[0];for(let d of t){let m=Math.hypot(d.x-n,d.y-r);m>o&&(o=m,i=d)}let a=i.x-n,s=i.y-r,u=Math.hypot(a,s);u>1e-9?(a/=u,s/=u):(a=1,s=0);let l=t.map((d,m)=>({p:d,i:m,t:(d.x-n)*a+(d.y-r)*s})).sort((d,m)=>d.t-m.t);return{pts:l.map(d=>d.p),seatIndices:l.map(d=>e[d.i])}}function gn(t){let e=t.length;if(e<3)return null;let n=0,r=0;for(let y of t)n+=y.x,r+=y.y;n/=e,r/=e;let o=0,i=0,a=0,s=0,u=0,l=0,d=0;for(let y of t){let x=y.x-n,w=y.y-r;o+=x*x,a+=w*w,i+=x*w,s+=x*x*x,u+=w*w*w,l+=x*w*w,d+=w*x*x}let m=o*a-i*i;if(Math.abs(m)<1e-9)return null;let p=(s+l)/2,c=(u+d)/2,f=(p*a-c*i)/m,h=(c*o-p*i)/m,b=f+n,g=h+r;return!Number.isFinite(b)||!Number.isFinite(g)?null:{cx:b,cy:g}}var ra=.15;function ia(t){if(t.length<2)return null;let e=t.map(y=>{let x=0,w=0;for(let R of y.pts)x+=R.x,w+=R.y;return{x:x/y.pts.length,y:w/y.pts.length}}),n=0,r=0;for(let y of e)n+=y.x,r+=y.y;n/=e.length,r/=e.length;let o=0,i=0,a=0;for(let y of e){let x=y.x-n,w=y.y-r;o+=x*x,i+=x*w,a+=w*w}let s=o+a,u=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-u)),d,m;Math.abs(i)>1e-12?(d=l-a,m=i):o>=a?(d=1,m=0):(d=0,m=1);let p=Math.hypot(d,m);if(!(p>1e-12))return null;d/=p,m/=p;let c=1/0,f=-1/0,h=[];for(let y of t){let x=1/0,w=-1/0;for(let R of y.pts){let M=R.x*d+R.y*m;M<x&&(x=M),M>w&&(w=M),M<c&&(c=M),M>f&&(f=M)}h.push(w-x)}let b=f-c;return b>1e-9?(h.sort((y,x)=>y-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=aa?{x:d,y:m}:null):null}var aa=.35;function yo(t,e,n,r){let o=new Map;for(let b of n){let g=e[b],y=g.rowId||`__seat-${b}`,x=o.get(y);x||(x={pts:[],idx:[]},o.set(y,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(b)}if(!o.size)return{sectionId:t,rows:[],blockCount:0};let i=[];for(let[b,g]of o){let y=oa(g.pts,g.idx),x=0;for(let w of y.pts)x+=Math.hypot(w.x-r.x,w.y-r.y);i.push({id:b,pts:y.pts,seatIndices:y.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/y.pts.length})}let a=i.map(b=>na(b.pts)),s=[];for(let b=0;b<i.length;b++){let g=1/0;for(let y=0;y<i.length;y++){if(b===y||bo(a[b],a[y])>=g)continue;let x=yn(i[b].pts,i[y].pts);x<g&&(g=x)}Number.isFinite(g)&&s.push(g)}s.sort((b,g)=>b-g);let u=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(u*1.8,1e-6),d=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let g=b+1;g<i.length;g++)bo(a[b],a[g])>l||yn(i[b].pts,i[g].pts)<=l&&(d[b].push(g),d[g].push(b));let m=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let g=m++,y=[b];for(i[b].blockId=g;y.length;){let x=y.pop();for(let w of d[x])i[w].blockId===-1&&(i[w].blockId=g,y.push(w))}}let p=new Map;for(let b of i){let g=p.get(b.blockId)??[];g.push(b),p.set(b.blockId,g)}let c=[];for(let b of i){if(b.pts.length<4)continue;let g=gn(b.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||c.push({x:g.cx,y:g.cy}))}let f=c.length>=2?(()=>{let b=c.map(x=>x.x).sort((x,w)=>x-w),g=c.map(x=>x.y).sort((x,w)=>x-w),y=Math.floor(c.length/2);return{cx:b[y],cy:g[y]}})():null;if(f){let b=M=>Math.hypot(M.x-f.cx,M.y-f.cy),g=1/0,y=-1/0,x=[];for(let M of i){let k=1/0,O=-1/0;for(let L of M.pts){let U=b(L);U<k&&(k=U),U>O&&(O=U)}x.push(O-k),k<g&&(g=k),O>y&&(y=O)}let w=y-g;x.sort((M,k)=>M-k);let R=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(w>1e-9&&R/w<=ra){let M=i.map(_=>{let v=0;for(let S of _.pts)v+=b(S);return{row:_,radius:v/_.pts.length}}),k=1/0;for(let _ of M)_.radius<k&&(k=_.radius);M.sort((_,v)=>_.radius-v.radius);let O=-1,L=-1/0,U=w/Math.max(1,M.length)*.5,z=[];for(let _ of M)_.radius-L>U&&(O++,L=_.radius),_.row.ordinal=O,_.row.blockDepth=_.radius-k,z.push(_.row);return{sectionId:t,rows:z,blockCount:m}}}let h=[];for(let[,b]of p){let g=ia(b);if(g){let y=w=>{let R=0;for(let M of w.pts)R+=M.x*g.x+M.y*g.y;return R/w.pts.length};b.sort((w,R)=>y(w)-y(R));let x=0;for(let w=0;w<b.length;w++)w>0&&(x+=yn(b[w-1].pts,b[w].pts)),b[w].ordinal=w,b[w].blockDepth=x,h.push(b[w])}else{let y=1/0;for(let x of b)x.focalDistance<y&&(y=x.focalDistance);b.sort((x,w)=>x.focalDistance-w.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-y),h.push(b[x])}}return{sectionId:t,rows:h,blockCount:m}}var Tc=Math.PI/180;function go(t,e){let n=!1;for(let r=0,o=e.length-1;r<e.length;o=r++){let i=e[r].x,a=e[r].y,s=e[o].x,u=e[o].y;a>t.y!=u>t.y&&t.x<(s-i)*(t.y-a)/(u-a)+i&&(n=!n)}return n}function sa(t,e){return e.some((n,r)=>{let o=e[(r+1)%e.length],i=(t.y-n.y)*(o.x-n.x)-(t.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(t.x-n.x)*(o.x-n.x)+(t.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function xo(t,e,n){return go(t,e)&&!(n??[]).some(r=>go(t,r)||sa(t,r))}function ca(t){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(e,n)=>Math.hypot(e-t.x,n-t.y),gradientAt:(e,n)=>{let r=e-t.x,o=n-t.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function la(t,e){if(!t.length)return null;let n=0,r=0,o=0;for(let c of t)n+=c.x,r+=c.y,o+=Math.hypot(c.x-e.x,c.y-e.y);let i=t.length;n/=i,r/=i,o/=i;let a=t[0],s=-1;for(let c of t){let f=Math.hypot(c.x-n,c.y-r);f>s&&(s=f,a=c)}let u=a.x-n,l=a.y-r,d=Math.hypot(u,l);d>1e-9?(u/=d,l/=d):(u=1,l=0);let m=[...t].sort((c,f)=>(c.x-n)*u+(c.y-r)*l-((f.x-n)*u+(f.y-r)*l)),p=0;for(let c of m){let f=Math.hypot(c.x-n,c.y-r);f>p&&(p=f)}return{pts:m,cx:n,cy:r,radius:p,depth:o}}function vo(t,e,n){let r=t.pts;if(r.length===1)return Math.hypot(e-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],u=s.x-a.x,l=s.y-a.y,d=u*u+l*l,m=d>1e-12?((e-a.x)*u+(n-a.y)*l)/d:0;m<0?m=0:m>1&&(m=1);let p=Math.hypot(e-(a.x+m*u),n-(a.y+m*l));p<o&&(o=p)}return o}var _t=8;function ua(t,e,n){let r=new Array(_t).fill(1/0),o=new Array(_t).fill(-1);for(let d=0;d<t.length;d++){let m=t[d],p=Math.hypot(e-m.cx,n-m.cy)-m.radius;for(let c=0;c<_t;c++)if(p<r[c]){for(let f=_t-1;f>c;f--)r[f]=r[f-1],o[f]=o[f-1];r[c]=p,o[c]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let m=vo(t[d],e,n);for(let p=0;p<3;p++)if(m<i[p]){for(let c=2;c>p;c--)i[c]=i[c-1],a[c]=a[c-1];i[p]=m,a[p]=d;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return t[a[0]].depth;let s=i[0]*2.2,u=0,l=0;for(let d=0;d<3;d++){let m=a[d];if(m<0||i[d]>s)continue;let p=1/(i[d]*i[d]);u+=p*t[m].depth,l+=p}return l>0?u/l:t[a[0]].depth}function da(t){let e=(r,o)=>ua(t,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<t.length;s++){let u=t[s];if(Math.hypot(r-u.cx,o-u.cy)-u.radius>=i)continue;let l=vo(u,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:t.length,rows:t,nearestRow:n,depthAt:e,gradientAt:(r,o)=>{let i=(e(r+.5,o)-e(r-.5,o))/1,a=(e(r,o+.5)-e(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function So(t,e){let n=[];for(let r of t){let o=la(r.points,e);o&&n.push(o)}return n.length<2?ca(e):(n.sort((r,o)=>r.depth-o.depth),da(n))}var Sn=Ze(require("polygon-clipping"),1);var Co=Ze(require("earcut"),1);var ma=.58,Mo=.01,ye=ke*1.5*Ve,fa=.5,pa=.6;function ha(t,e){let n=t.length,r=[];for(let a=0;a<n;a++){let s=t[Math.max(0,a-1)],u=t[Math.min(n-1,a+1)],l=u.x-s.x,d=u.y-s.y,m=Math.hypot(l,d);if(m<1e-9){r.push([0,0]);continue}l/=m,d/=m,r.push([-d,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 ba(t,e){if(t.length<2||e<=0)return[...t];let n=[...t],r=(a,s)=>{let u=s.x-a.x,l=s.y-a.y,d=Math.hypot(u,l)||1;return{x:u/d,y:l/d}},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 wo=Math.PI/12;function ya(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 Ao(t,e){if(!t.length||!(e>0))return[];let n=ya(t),r=(s,u,l,d)=>{let m=l-u;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let p=Math.max(1,Math.ceil(m/wo)),c=e/Math.cos(m/p/2);for(let f=0;f<=p;f++){let h=u+m*f/p;d.push({x:s.x+Math.cos(h)*c,y:s.y+Math.sin(h)*c})}};if(n.length<3){let s=0,u=0;for(let c of n)s+=c.x,u+=c.y;s/=n.length||1,u/=n.length||1;let l=0;for(let c of n)l=Math.max(l,Math.hypot(c.x-s,c.y-u));let d=[],m=Math.max(3,Math.ceil(Math.PI*2/wo)),p=(l+e)/Math.cos(Math.PI/m);for(let c=0;c<m;c++){let f=c/m*Math.PI*2;d.push({x:s+Math.cos(f)*p,y:u+Math.sin(f)*p})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let u=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-u.x),l.y-u.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ko(a)}function ga(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,u=a.y-i.y,l=s*s+u*u,d=l>1e-12?((e-i.x)*s+(n-i.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(e-(i.x+d*s),n-(i.y+d*u));m<r&&(r=m)}return r}function Bt(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 u=0;for(let l of o.pts){let d=Math.hypot(l.x-i,l.y-a);d>u&&(u=d)}return{cx:i,cy:a,rad:u}}),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,u=null;for(let d of i){let m=1/0;for(let p=0;p<t.length;p++){if(p===o||Math.abs(t[p].y-t[o].y)<.001)continue;let c=e[p],f=Math.hypot(d.x-c.cx,d.y-c.cy)-c.rad;if(f>=m&&f>=s)continue;let h=ga(t[p].pts,d.x,d.y);h<m&&(m=h),t[p].depth<t[o].depth&&h<s&&(s=h,u=t[p].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((d,m)=>d-m);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:u})}return r}function Ro(t,e,n,r){let o=t[e],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],m=d.x-r.x,p=d.y-r.y,c=Math.hypot(m,p)||1;m/=c,p/=c;let f=Math.max(n[e].pitch,.001)*.5;return[{x:d.x+p*f,y:d.y-m*f},{x:d.x-p*f,y:d.y+m*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let m=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);m>1e-6&&(a+=m,s++)}let u=s>0?a/s:0,l=ba(i,Math.max(u*pa,ye));return{pts:l,nrm:ha(l,r),front:Math.max(n[e].pitch*ma,ye),back:Math.max(n[e].pitch*fa,ye)}}var ot=1.5,Io=.3;function xn(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,u=-1;for(let m=1;m<t.length-1;m++){let p=t[m],c=a>1e-12?Math.abs((p.x-n.x)*i-(p.y-n.y)*o)/a:Math.hypot(p.x-n.x,p.y-n.y);c>s&&(s=c,u=m)}if(s<=e||u<0)return[n,r];let l=xn(t.slice(0,u+1),e),d=xn(t.slice(u),e);return[...l.slice(0,-1),...d]}function To(t,e){if(t.length<4)return t;let n=xn([...t,t[0]],e);return n.pop(),n.length>=3?n:t}function Eo(t,e,n){if(t.length<2)return[];let r=n??Bt(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 y of a){let x=t[y].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:t[y].y}):s.push(y)}if(!s.length)continue;s.sort((y,x)=>t[y].depth-t[x].depth);let l=s.map(y=>Ro(t,y,r,e)).filter(y=>y!==null);if(!l.length)continue;let d=(y,x)=>({x:y.pts[x].x-y.nrm[x][0]*(y.front+ot),y:y.pts[x].y-y.nrm[x][1]*(y.front+ot)}),m=(y,x)=>({x:y.pts[x].x+y.nrm[x][0]*(y.back+ot),y:y.pts[x].y+y.nrm[x][1]*(y.back+ot)}),p=l[0],c=l[l.length-1],f=[];for(let y=0;y<p.pts.length;y++)f.push(d(p,y));for(let y of l)f.push(m(y,y.pts.length-1));for(let y=c.pts.length-1;y>=0;y--)f.push(m(c,y));for(let y=l.length-1;y>=0;y--)f.push(d(l[y],0));let h=ko(f),b=1/0;for(let y of s)t[y].y<b&&(b=t[y].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(We(h))>1e-6&&l.every(y=>{let x=y.pts[Math.floor(y.pts.length/2)];return pt(h,x.x,x.y)})){i.push({outline:To(h,Io),holes:[],topY:b});continue}for(let y of xa(l))i.push({outline:y,holes:[],topY:b})}return i}function xa(t){let e=[];for(let n of t){let r=[],o=[],i=n.front+ot,a=n.back+ot;for(let u=0;u<n.pts.length;u++){let l=n.pts[u],d=n.nrm[u];r.push([l.x-d[0]*i,l.y-d[1]*i]),o.push([l.x+d[0]*a,l.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),e.push([s]))}if(!e.length)return[];try{let n=Sn.default.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(([u,l])=>({x:u,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(To(i,Io))}return r}catch{return[]}}function ko(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 vn=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(!pt(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],d=r[0];for(let m=1;m+1<r.length;m++){let p=r[m],c=r[m+1];t.tri([d.x*D,o,d.y*D],[p.x*D,o,p.y*D],[c.x*D,o,c.y*D],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Sn.default.intersection([a],e)}catch{return}let u=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let d=l[0],m=[],p=[];for(let f=0;f<d.length-1;f++)m.push(d[f][0],d[f][1]),p.push([d[f][0],d[f][1]]);if(p.length<3)continue;let c=(0,Co.default)(m,void 0,2);for(let f=0;f<c.length;f+=3){let h=p[c[f]],b=p[c[f+1]],g=p[c[f+2]];t.tri([h[0]*D,o,h[1]*D],[b[0]*D,o,b[1]*D],[g[0]*D,o,g[1]*D],u,i)}}}function Fo(t,e,n,r,o,i,a){if(e.length<2)return;let s=a??Bt(e),u=[0,1,0],l=i&&i.length>=3?[[...i.map(c=>[c.x,c.y]),[i[0].x,i[0].y]]]:null,d=i&&i.length>=3?new vn([[...i]]):null,m=c=>{t.setMaterial(2),c(),t.setMaterial(0)},p=c=>{t.setMaterial(3),c(),t.setMaterial(0)};for(let c=0;c<e.length;c++){let f=e[c];if(f.patch&&f.patch.length>=3){let R=[...f.patch],M=s[c].belowY??r;if(p(()=>{if(l&&d)Po(t,l,d,R,f.y,o.tread);else{let k=R[0];for(let O=1;O+1<R.length;O++){let L=R[O],U=R[O+1];t.tri([k.x*D,f.y,k.y*D],[L.x*D,f.y,L.y*D],[U.x*D,f.y,U.y*D],u,o.tread)}}}),f.y>M+Mo){let k=0,O=0;for(let L of R)k+=L.x,O+=L.y;k/=R.length,O/=R.length,m(()=>{for(let L=0;L<R.length;L++){let U=R[L],z=R[(L+1)%R.length],_=z.x-U.x,v=z.y-U.y,S=Math.hypot(_,v);if(S<1e-6)continue;let C=v/S,G=-_/S;(U.x-k)*C+(U.y-O)*G<0&&(C=-C,G=-G);let P=[C,0,G],T=[U.x*D,f.y,U.y*D],I=[z.x*D,f.y,z.y*D],E=[U.x*D,M,U.y*D],A=[z.x*D,M,z.y*D];t.tri(T,I,A,P,o.riser),t.tri(T,A,E,P,o.riser)}})}continue}let h=Ro(e,c,s,n);if(!h)continue;let{pts:b,nrm:g,front:y,back:x}=h,w=s[c].belowY??r;for(let R=0;R+1<b.length;R++){let M=b[R],k=b[R+1],O=g[R],L=g[R+1];if(Math.hypot(k.x-M.x,k.y-M.y)<1e-6||O[0]===0&&O[1]===0||L[0]===0&&L[1]===0)continue;let U=[(M.x-O[0]*y)*D,f.y,(M.y-O[1]*y)*D],z=[(k.x-L[0]*y)*D,f.y,(k.y-L[1]*y)*D],_=[(M.x+O[0]*x)*D,f.y,(M.y+O[1]*x)*D],v=[(k.x+L[0]*x)*D,f.y,(k.y+L[1]*x)*D];if(p(()=>{l&&d?Po(t,l,d,[{x:M.x-O[0]*y,y:M.y-O[1]*y},{x:k.x-L[0]*y,y:k.y-L[1]*y},{x:k.x+L[0]*x,y:k.y+L[1]*x},{x:M.x+O[0]*x,y:M.y+O[1]*x}],f.y,o.tread):(t.tri(U,z,v,u,o.tread),t.tri(U,v,_,u,o.tread))}),f.y>w+Mo){let S=[U[0],w,U[2]],C=[z[0],w,z[2]],G=[-O[0],0,-O[1]];m(()=>{t.tri(U,z,C,G,o.riser),t.tri(U,C,S,G,o.riser)})}}}}function Do(t){let e=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of t)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<e&&(e=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:e,minY:n,maxX:r,maxY:o}:null}function Nt(t,e){return t.minX<=e.maxX&&e.minX<=t.maxX&&t.minY<=e.maxY&&e.minY<=t.maxY}var Mn=Ze(require("polygon-clipping"),1);function va(t,e){let n=t.eventConfigurationIds;return!n?.length||!!e&&n.includes(e)}function Lo(t,e){return t.filter(n=>n.type!=="shape"||va(n,e))}function Oo(t,e){let n=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Lo(r.objects,e),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Lo(t.objects,e),focal:n,baseHeightM:0,index:0}]}var Sa={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function rt(t){return Do(t)??Sa}function _o(t,e){let n=Dt(t.outline,ye),r=rt(n),o=e.filter(a=>a!==t&&a.outline&&a.outline.length>=3&&Nt(r,rt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(u=>[u.x,u.y]);return s.push(s[0]),s};try{let a=Mn.default.difference([i(n)],...o.map(u=>[i(u.outline)])),s=[];for(let u of a){if(!u.length)continue;let l=u[0].map(([d,m])=>({x:d,y:m}));if(l.length>1){let d=l[0],m=l[l.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Bo(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=Mn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let u=s[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&o.push({outline:u,holes:[],topY:i.topY})}}return o.length?o:t}var Ma=.05,No=.05,wa=.15,wn=25;function Vo(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),u=new Map,l=[],d=new Set;for(let m=0;m<t.length;m+=1){let p=t[m];for(let c of p.objects){if(c.type==="table"&&d.add(c.id),c.type!=="section"||!c.outline||c.outline.length<3)continue;let f=Dt(c.outline,ye);u.set(c.id,{section:c,unit:p,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:c.id,floorIndex:m,box:rt(f),section:c,unit:p,outline:f})}}for(let m=0;m<e.length;m++){let p=e[m];for(let c of l){if(n&&c.floorIndex!==n[m]||p.x<c.box.minX||p.x>c.box.maxX||p.y<c.box.minY||p.y>c.box.maxY||!xo({x:p.x,y:p.y},c.outline,c.section.holes))continue;o[m]=c.id;let f=u.get(c.id);f.hasSeats=!0;let h=p.focalPoint??c.unit.focal,b=Math.hypot(p.x-h.x,p.y-h.y);b<f.frontU&&(f.frontU=b),f.seatIndices.push(m);let g=p.rowId||`__seat-${m}`,y=f.rows.get(g);y?y.push({x:p.x,y:p.y}):f.rows.set(g,[{x:p.x,y:p.y}]);break}}for(let[m,p]of u){let c=no(p.section,{floorBaseHeightM:p.unit.baseHeightM}),f=p.unit.baseHeightM,h=c.rake>0?Math.tan(c.rake*Math.PI/180):0,b=c.rake<=.01&&c.height<=f+.001,g=p.section.surfaceKind,y=g==="flat"?!0:g==="rakedRows"&&c.rake>.01?!1:b,x=p.hasSeats?yo(m,e,p.seatIndices,p.unit.focal):{sectionId:m,rows:[],blockCount:0},R=x.rows.length<2?So([...p.rows.values()].map(P=>({points:P})),p.unit.focal):null,M=1/0;if(R){if(p.hasSeats)for(let P of p.rows.values())for(let T of P){let I=R.depthAt(T.x,T.y);I<M&&(M=I)}if(!p.hasSeats||!Number.isFinite(M)){M=1/0;for(let P of p.section.outline){let T=R.depthAt(P.x,P.y);T<M&&(M=T)}}}let k=f+Ma,O=Math.max(k,c.height),L=P=>{let T=Math.max(0,P-M)*Ce,I=Math.min(T*h,wn);return Math.max(k,c.height+I)},U=P=>{let T=Math.max(0,P)*Ce,I=Math.min(T*h,wn);return Math.max(k,c.height+I)},z=y?[]:x.rows.map(P=>({pts:P.pts,y:U(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...d.has(P.id)?{patch:Ao(P.pts,ye)}:{}})),_=z.length?z[0].y:O,v=z.map(P=>{let T=P.patch&&P.patch.length>=3?P.patch:P.pts,I=0,E=0;for(let N of T)I+=N.x,E+=N.y;let A=T.length||1;I/=A,E/=A;let F=0;for(let N of T){let Y=Math.hypot(N.x-I,N.y-E);Y>F&&(F=Y)}return{cx:I,cy:E,rad:F}}),S=y?()=>O:z.length>=2?(P,T)=>{let I=1/0,E=_;for(let A=0;A<z.length;A++){let F=v[A];if(Math.hypot(P-F.cx,T-F.cy)-F.rad>=I)continue;let N=z[A].patch,Y=N&&N.length>=3?pt(N,P,T)?0:nt(N,P,T):nt(z[A].pts,P,T);Y<I&&(I=Y,E=z[A].y)}return E}:(P,T)=>R?L(R.depthAt(P,T)):O,C=[0,1,0],G=z.length>=2||y?()=>C:(P,T)=>{if(!R)return C;let I=R.depthAt(P,T);if(I<=M)return C;let E=(I-M)*Ce;if(E*h>=wn||c.height+E*h<=k)return C;let[A,F]=R.gradientAt(P,T);if(A===0&&F===0)return C;let N=1/Math.hypot(h,1);return[-A*h*N,N,-F*h*N]};if(!y)for(let P of x.rows){let T=U(P.blockDepth);for(let I of P.seatIndices)a[I]=T}for(let P of x.rows){let T=[];for(let N=1;N<P.pts.length;N++){let Y=Math.hypot(P.pts[N].x-P.pts[N-1].x,P.pts[N].y-P.pts[N-1].y);Y>1e-6&&T.push(Y)}T.sort((N,Y)=>N-Y);let I=T.length?T[Math.floor(T.length/2)]:1/0,E=1/0,A=P.pts[Math.floor(P.pts.length/2)];if(A)for(let N of x.rows){if(N===P||N.blockId!==P.blockId)continue;let Y=nt(N.pts,A.x,A.y);Y>1e-6&&Y<E&&(E=Y)}let F=Math.min(I,Math.max(E,I*.5));if(Number.isFinite(F)&&F>0)for(let N of P.seatIndices)s[N]=F}r.set(m,{sectionId:m,deckAt:S,normalAt:G,flat:y,bottomY:f,rowLevels:z,landingY:_})}for(let m=0;m<e.length;m++){let p=o[m],c=e[m];if(p){let h=a[m];i[m]=(h??r.get(p).deckAt(c.x,c.y))+wa;continue}let f=c.eyeHeightM;i[m]=Number.isFinite(f)?Math.max(0,f-Tt):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function Fe(t,e){if(!t)return e;let n=be(ut(t,.4),.62);return fe(e,n,.72)}function zo(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,u=0,l=0,d=0;for(let[m,p]of a){let c=ne(n.get(m));c&&(s+=c[0]*p,u+=c[1]*p,l+=c[2]*p,d+=p)}d>0&&o.set(i,[s/d,u/d,l/d])}return o}function Go(t,e){return ne(t.color)??e.get(t.logicalSectionId??t.id)??null}var Ho=Ze(require("polygon-clipping"),1);function Pa(t,e){return t===void 0||e===void 0?!0:Math.abs(t-e)<.001}var Vt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(e,n){let r=e.map(u=>[u.x,u.y]);if(r.length<3)return[];r.push(r[0]);let o=rt(e),i=this.rings.filter((u,l)=>Nt(o,this.boxes[l])&&Pa(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ho.default.difference([r],...i).map(l=>l.map(d=>d.map(([m,p])=>[m,p])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let u of a){if(!u.length)continue;let l=u[0].map(([d,m])=>({x:d,y:m}));if(l.length>1){let d=l[0],m=l[l.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Ca(t,e){if(!e)return t;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let m of t)n=Math.min(n,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),i=Math.max(i,m.y);let a=(n+r)/2,s=(o+i)/2,u=e*Math.PI/180,l=Math.cos(u),d=Math.sin(u);return t.map(m=>{let p=m.x-a,c=m.y-s;return{x:a+p*l-c*d,y:s+p*d+c*l}})}function gt(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=yt(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=Lt(n,r,t.width/2,t.height/2)}return e?Ca(e,t.rotation):null}function xt(t){let e=t.role??"",r={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}}[e]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var Aa=.08;function Uo(t,e){let n=gt(t),r=xt(t),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,u=-1/0;for(let d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),u=Math.max(u,d.y);let l=o;for(let d of e)s>d.minX&&i<d.maxX&&u>d.minY&&a<d.maxY&&l<=d.topOffsetM+1e-6&&(l=d.topOffsetM+Aa);return e.push({minX:i,minY:a,maxX:s,maxY:u,topOffsetM:l}),l}function ze(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function jo(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 vt(t,e,n){return[ze(t[0],t[1],e),ze(t[0],t[1],n),ze(t[3],t[2],n),ze(t[3],t[2],e)]}function Yo(t,e,n){return[ze(t[0],t[3],e),ze(t[1],t[2],e),ze(t[1],t[2],n),ze(t[0],t[3],n)]}function De(t,e,n,r,o,i){se(t,e,void 0,()=>n,r,o,i,ae)}var Pn=2.4,Ra=.75,Ia=.15;function St(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),u=n/2,l=r/2;return[[-u,-l],[u,-l],[u,l],[-u,l]].map(([d,m])=>({x:e.x+d*a-m*s,y:e.y+d*s+m*a}))}function Xo(t,e,n,r,o){let i=St(e);i&&se(t,i,void 0,()=>n+Pn,n,Fe(r,o.boothTop),o.boothWall,ae)}function Cn(t){if(t.shape==="round"){let d=t.radius;return d?Lt(t.center.x,t.center.y,d,d,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),u=e/2,l=n/2;return[[-u,-l],[u,-l],[u,l],[-u,l]].map(([d,m])=>({x:o.x+d*a-m*s,y:o.y+d*s+m*a}))}function Wo(t,e,n,r,o){let i=Cn(e);i&&se(t,i,void 0,()=>n+Ra,n,Fe(r,o.tableTop),o.tableWall,ae)}function Ko(t,e,n,r,o,i,a){let s=gt(e);if(!s)return;let u=e.role==="stage",l=xt(e),d=n+r;if(u&&a){let h=1/0,b=-1/0,g=1/0,y=-1/0;for(let x of s)x.x<h&&(h=x.x),x.x>b&&(b=x.x),x.y<g&&(g=x.y),x.y>y&&(y=x.y);a.push({cx:(h+b)/2*D,cz:(g+y)/2*D,y:d,halfX:Math.max((b-h)/2*D,.5),halfZ:Math.max((y-g)/2*D,.5)})}let m=ne(e.fill),p=u&&m?fe(o.stageTop,be(ut(m,.18),.9),.9):Fe(m,u?o.stageTop:o.decorTop),c=e.role==="screen"?m:null,f=u?m?fe(o.stageWall,be(m,.58),.82):o.stageWall:e.role==="screen"?c?fe(be(c,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Fe(ne(e.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let h=jo(s);De(t,vt(h,0,.16),d,n,p,f),De(t,vt(h,.84,1),d,n,p,f),De(t,h,d,Math.max(n,d-.35),p,f);return}if(l.kind==="suite"&&s.length===4){let h=s.map((y,x)=>{let w=s[(x+1)%4],R=(y.x+w.x)/2,M=(y.y+w.y)/2;return Math.hypot(R-i.x,M-i.y)}),b=h.indexOf(Math.min(...h)),g=[0,1,2,3].map(y=>s[(b+y)%4]);De(t,vt(g,0,.08),d,n,p,f),De(t,vt(g,.92,1),d,n,p,f),De(t,Yo(g,.88,1),d,n,p,f),De(t,g,d,Math.max(n,d-.18),p,f);return}De(t,s,d,n,p,f)}function An(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,u=Math.cos(s),l=Math.sin(s),d=r/2,m=o/2;return[[-d,-m],[d,-m],[d,m],[-d,m]].map(([p,c])=>({x:i+p*u-c*l,y:a+p*l+c*u}))}function Ta(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 ne(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 u=ne(s[1].trim());u&&a.push(u)}return a.length?a.reduce((s,u,l)=>fe(s,u,1/(l+1)),a[0]):null}function qo(t,e,n,r){if(e.layer==="foreground")return;let o=An(e);if(!o)return;let i=n+Ia,a=Fe(Ta(e.href),r.decorTop),s=Math.max(0,Math.min(1,e.opacity??1));s<1&&(a=fe(r.ground,a,s)),se(t,o,void 0,()=>i,n,a,fe(a,r.decorWall,.5),ae)}function $o(t,e,n,r,o){if(!e.points||e.points.length<3)return;let i=Fe(r,o.gaTop);se(t,e.points,e.holes,()=>n+.15,n,i,o.gaWall,ae)}var Ea=Math.PI/180,te=96,ka=6,Fa=60,Da=150,Zo=.2,La=.35;function Rn(t,e){let n=Math.atan2(e.x-t.x,e.y-t.y)/Ea;return n<0?n+360:n}function zt(t){if(!t.length)return NaN;let e=[...t].sort((n,r)=>n-r);return e[Math.floor(e.length/2)]}function Gt(t,e,n=2){let r=t.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let u=-n;u<=n;u++){let l=i+u;if(e)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=t[l],s++}o[i]=a/s}return o}function Qo(t,e){let n=t.filter(p=>p.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let p of n)for(let c of p.rows){for(let f of c.pts)o+=f.x,i+=f.y,a++;if(c.pts.length>=4){let f=gn(c.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},u=s;if(r.length>=8){let p=zt(r.map(g=>g.x)),c=zt(r.map(g=>g.y)),f=0;for(let g of n)for(let y of g.rows)for(let x of y.pts){let w=Math.hypot(x.x-s.x,x.y-s.y);w>f&&(f=w)}let h=0,b=f*.2;for(let g of n)for(let y of g.rows)for(let x of y.pts)Math.hypot(x.x-p,x.y-c)<b&&h++;Math.hypot(p-s.x,c-s.y)<=f&&h/a<.01&&(u={x:p,y:c})}let l=[];for(let p of n){let c={sectionId:p.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of p.rows)for(let h of f.pts){let b=Math.hypot(h.x-u.x,h.y-u.y),g=Math.min(te-1,Math.floor(Rn(u,h)/(360/te)));c.samples.push({r:b,bin:g,levelM:f.levelM}),b<c.rMin&&(c.rMin=b),b>c.rMax&&(c.rMax=b)}c.samples.length&&l.push(c)}if(!l.length)return null;l.sort((p,c)=>p.rMin+p.rMax-(c.rMin+c.rMax));let d=[];for(let p of l){let c=!1;for(let f of d){let h=Math.min(p.rMax,f.rMax)-Math.max(p.rMin,f.rMin),b=Math.min(p.rMax-p.rMin,f.rMax-f.rMin);if(b>1e-9&&h>=La*b){f.members.push(p),f.rMin=Math.min(f.rMin,p.rMin),f.rMax=Math.max(f.rMax,p.rMax),c=!0;break}}c||d.push({members:[p],rMin:p.rMin,rMax:p.rMax})}let m=[];for(let p of d){let c=new Array(te).fill(null);for(let v of p.members)for(let S of v.samples){let C=c[S.bin];C||(C={samples:[]},c[S.bin]=C),C.samples.push({r:S.r,levelM:S.levelM})}let f=c.map(v=>!!v);if(!f.filter(Boolean).length)continue;let b=[],g=[];for(let v of c){if(!v)continue;let S=1/0,C=-1/0;for(let G of v.samples)G.r<S&&(S=G.r),G.r>C&&(C=G.r);b.push(S),g.push(C)}let y=zt(b),x=zt(g);if(!(y>=Zo*x)||!(x>0))continue;let w=[...b].sort((v,S)=>v-S);if(!(w[Math.floor(w.length*.1)]>=Zo*x))continue;let M=c.map(v=>{if(!v)return null;let S=[...v.samples].sort((F,N)=>F.r-N.r),C=S[0].r,G=S[S.length-1].r,P=S[0].levelM,T=-1/0;for(let F of S)F.levelM>T&&(T=F.levelM);let I=[];for(let F of S){let N={r:F.r,l:F.levelM};for(;I.length&&Math.abs(I[I.length-1].r-N.r)<1e-9;){if(I[I.length-1].l<=N.l){N.skip=!0;break}I.pop()}if(!N.skip){for(;I.length>=2;){let Y=I[I.length-2],V=I[I.length-1];if((V.r-Y.r)*(N.l-Y.l)-(V.l-Y.l)*(N.r-Y.r)<=0)I.pop();else break}I.push(N)}}let E=I.map(F=>F.r),A=I.map(F=>F.l);return{inner:C,outer:G,front:P,top:T,profile:{rs:E,ls:A}}}),k=f.slice();for(let v=0;v<te;v++){if(k[v])continue;let S=-1,C=-1,G=0;for(let B=1;B<=te;B++){let j=(v-B+te*2)%te;if(k[j]){S=j;break}}for(let B=1;B<=te;B++){let j=(v+B)%te;if(k[j]){C=j,G=B;break}}if(S<0||C<0)continue;let P=0;for(let B=1;B<=te;B++){let j=(v-B+te*2)%te;if(f[j]){P=B;break}}if(P-1+G>ka)continue;let I=M[S],E=M[C],A=P/(P+G),F=I.inner+(E.inner-I.inner)*A,N=I.outer+(E.outer-I.outer)*A,Y=I.front+(E.front-I.front)*A,V=I.top+(E.top-I.top)*A;M[v]={inner:F,outer:N,front:Y,top:V,profile:{rs:[F,N],ls:[Y,V]}}}for(let v=0;v<te;v++)M[v]&&(k[v]=!0);let O=360/te,L=[],U=k.filter(Boolean).length,z=[];if(U===te)z.push({start:0,len:te});else{let v=0;for(;k[v];)v=(v+1)%te;let S=-1;for(let C=0;C<=te;C++){let G=(v+C)%te,P=C<te&&k[G];if(P&&S<0)S=G;else if(!P&&S>=0){let T=(G-S+te)%te||te;z.push({start:S,len:T}),S=-1}}}for(let v of z){if(v.len*O<Fa&&v.len<te)continue;let S=v.len===te,C=new Float64Array(v.len),G=new Float64Array(v.len),P=new Float64Array(v.len),T=new Float64Array(v.len),I=[];for(let B=0;B<v.len;B++){let j=M[(v.start+B)%te];C[B]=j.inner,G[B]=j.outer,P[B]=j.front,T[B]=j.top,I.push(j.profile??{rs:[j.inner,j.outer],ls:[j.front,j.top]})}let E=Gt(C,S),A=Gt(G,S),F=Gt(P,S),N=Gt(T,S);for(let B=0;B<v.len;B++)E[B]>C[B]&&(E[B]=C[B]),A[B]<G[B]&&(A[B]=G[B]),E[B]>A[B]-1e-6&&(E[B]=Math.max(0,A[B]-1e-6)),N[B]<F[B]&&(N[B]=F[B]);let Y={startBin:v.start,binCount:v.len,closed:S,innerR:E,outerR:A,frontLevelM:F,topLevelM:N,profiles:I},V=(B,j,K)=>{let J=I[B],Z=J.rs,ee=J.ls;if(j<=Z[0]){ee[0]>K&&(ee[0]=K);return}if(j>=Z[Z.length-1]){ee[ee.length-1]>K&&(ee[ee.length-1]=K);return}for(let Q=0;Q+1<Z.length;Q++)if(j<=Z[Q+1]){ee[Q]>K&&(ee[Q]=K),ee[Q+1]>K&&(ee[Q+1]=K);return}};for(let B=0;B<v.len;B++){let j=c[(v.start+B)%te];if(j)for(let K of j.samples){V(B,K.r,K.levelM);let J=S?(B-1+v.len)%v.len:B-1,Z=S?(B+1)%v.len:B+1;J>=0&&V(J,K.r,K.levelM),Z<v.len&&V(Z,K.r,K.levelM)}}L.push(Y)}L.reduce((v,S)=>v+S.binCount*O,0)<Da||m.push({arcs:L,sectionIds:p.members.map(v=>v.sectionId),innerRMedian:y,outerRMedian:x})}if(!m.length)return null;if(m.sort((p,c)=>p.innerRMedian-c.innerRMedian),e){let p=m[m.length-1].outerRMedian;if(Math.hypot(e.x-u.x,e.y-u.y)>.9*p)return null}return{centre:u,binCount:te,binStepDeg:360/te,rings:m}}function Jo(t,e,n,r){let o=t.binStepDeg,i=n/o-.5-e.startBin;i=(i%t.binCount+t.binCount)%t.binCount,i>e.binCount-1&&(e.closed?i=i-e.binCount<e.binCount-i?0:e.binCount-1:i=i-(e.binCount-1)<t.binCount-i?e.binCount-1:0);let a=Math.floor(i),s=e.closed?(a+1)%e.binCount:Math.min(e.binCount-1,a+1),u=i-a,l=d=>{let m=e.profiles[d],p=m.rs,c=m.ls;if(r<=p[0])return c[0];if(r>=p[p.length-1])return c[c.length-1];for(let f=0;f+1<p.length;f++)if(r<=p[f+1]){let h=p[f+1]-p[f],b=h>1e-9?(r-p[f])/h:0;return c[f]+(c[f+1]-c[f])*b}return c[c.length-1]};return l(a)*(1-u)+l(s)*u}var er=.25,Oa=1.2,_a=.6,Ba=.45,Na=2.3,Va=Math.PI/180;function qe(t,e,n){let r=n*Va;return{x:t.x+e*Math.sin(r),y:t.y+e*Math.cos(r)}}function za(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 Ga=24;function Ha(t,e,n,r,o,i,a,s,u){let l=n.binCount,d=Ga,m=Ce,p=i+.02,c=[];for(let v=0;v<l;v++){let S=(n.startBin+v+.5)*e.binStepDeg,C=new Float64Array(d+1);for(let G=0;G<=d;G++){let P=r[v]+(o[v]-r[v])*G/d;C[G]=Math.max(p,Jo(e,n,S,P)-er)}c.push(C)}for(let v of u){let S=Rn(e.centre,v),C=Math.hypot(v.x-e.centre.x,v.y-e.centre.y),G=S/e.binStepDeg-.5-n.startBin;if(G=(G%e.binCount+e.binCount)%e.binCount,G>l-1&&!n.closed&&!(G<l-.5||G>e.binCount-.5))continue;let P=v.deckY-er,T=Math.min(l-1,Math.max(0,Math.floor(G))),I=[T,n.closed?(T+1)%l:Math.min(l-1,T+1)];for(let E of I){let A=o[E]-r[E];if(!(A>1e-9))continue;let F=(C-r[E])/A*d;if(F<-.75||F>d+.75)continue;let N=Math.min(d,Math.max(0,Math.floor(F))),Y=Math.min(d,N+1);c[E][N]>P&&(c[E][N]=Math.max(p,P)),c[E][Y]>P&&(c[E][Y]=Math.max(p,P))}}let f=[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],b=[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],y=(v,S)=>{let C=(n.startBin+v+.5)*e.binStepDeg,G=r[v]+(o[v]-r[v])*S/d,P=qe(e.centre,G,C);return[P.x*m,c[v][S],P.y*m]};{let v=Math.tan(12*Math.PI/180);for(let S=0;S<6;S++){let C=!1;for(let P=0;P<l;P++)for(let T=d-1;T>=0;T--)c[P][T]>c[P][T+1]&&(c[P][T]=c[P][T+1],C=!0);let G=n.closed?l:l-1;for(let P=0;P<G;P++){let T=(P+1)%l;for(let I=0;I<=d;I++){let E=c[T][I]-c[P][I];if(Math.abs(E)>1)continue;let A=r[P]+(o[P]-r[P])*I/d,F=r[T]+(o[T]-r[T])*I/d,N=qe(e.centre,A,(n.startBin+P+.5)*e.binStepDeg),Y=qe(e.centre,F,(n.startBin+T+.5)*e.binStepDeg),V=v*Math.hypot(Y.x-N.x,Y.y-N.y)*m;E>V?(c[T][I]=c[P][I]+V,C=!0):-E>V&&(c[P][I]=c[T][I]+V,C=!0)}}if(!C)break}}let x=1,w=(v,S)=>{for(let C=0;C<=d;C+=4)if(Math.abs(c[v][C]-c[S][C])>x)return!0;return Math.abs(c[v][d]-c[S][d])>x},R=Math.tan(38*Math.PI/180),M=v=>(o[v]-r[v])/d*m,k=(v,S)=>c[v][S+1]-c[v][S]>R*Math.max(1e-6,M(v)),O=(v,S)=>{let C=n.closed?(v-1+l)%l:Math.max(0,v-1),G=n.closed?(v+1)%l:Math.min(l-1,v+1);Math.abs(c[C][S]-c[v][S])>x&&(C=v),Math.abs(c[G][S]-c[v][S])>x&&(G=v);let P=Math.max(0,S-1),T=Math.min(d,S+1);P<S&&k(v,P)&&(P=S),T>S&&k(v,S)&&(T=S);let I=y(C,S),E=y(G,S),A=y(v,P),F=y(v,T),N=E[0]-I[0],Y=E[1]-I[1],V=E[2]-I[2],B=F[0]-A[0],j=F[1]-A[1],K=F[2]-A[2],J=Y*K-V*j,Z=V*B-N*K,ee=N*j-Y*B,Q=Math.hypot(J,Z,ee);return Q>1e-12?(J/=Q,Z/=Q,ee/=Q,Z<0&&(J=-J,Z=-Z,ee=-ee),[J,Z,ee]):[0,1,0]},L=(v,S)=>{let C=[v[0],i,v[2]],G=[S[0],i,S[2]],P=S[0]-v[0],T=S[2]-v[2],I=Math.hypot(P,T);if(!(I>1e-12))return;let E=[T/I,0,-P/I];t.tri(v,S,G,E,b,b,g),t.tri(v,G,C,E,b,g,g)},U=.05*Ve,z=v=>o[v]-r[v]<U,_=n.closed?l:l-1;for(let v=0;v<_;v++){let S=(v+1)%l;if(z(v)||z(S))continue;if(w(v,S)){let E=(n.startBin+v+1)*e.binStepDeg,A=(j,K)=>{let J=(r[v]+r[S])/2,Z=(o[v]+o[S])/2,ee=J+(Z-J)*K/d,Q=qe(e.centre,ee,E);return[Q.x*m,c[j][K],Q.y*m]};for(let j=0;j<d;j++){let K=y(v,j),J=y(v,j+1),Z=A(v,j),ee=A(v,j+1),Q=O(v,j),he=O(v,j+1);t.triN(K,Z,ee,Q,Q,he,f),t.triN(K,ee,J,Q,he,he,f);let je=y(S,j),Le=y(S,j+1),ge=A(S,j),Ie=A(S,j+1),Oe=O(S,j),me=O(S,j+1);t.triN(ge,je,Le,Oe,Oe,me,f),t.triN(ge,Le,Ie,Oe,me,me,f);let we=A(v,j),ce=A(v,j+1),Te=A(S,j+1),ct=A(S,j),$e=ce[0]-we[0],ie=ce[2]-we[2],Pe=Math.hypot($e,ie);if(Pe>1e-12){let wt=[ie/Pe,0,-$e/Pe];t.tri(we,ce,Te,wt,b),t.tri(we,Te,ct,wt,b)}}let F=y(v,0),N=y(S,0),Y=y(S,d),V=y(v,d),B=j=>[j[0],i,j[2]];t.tri(B(F),B(Y),B(N),[0,-1,0],h),t.tri(B(F),B(V),B(Y),[0,-1,0],h),L(F,N),L(V,Y);continue}for(let E=0;E<d;E++){let A=O(v,E),F=O(S,E),N=O(S,E+1),Y=O(v,E+1);if(k(v,E)||k(S,E)){let J=(ce,Te)=>{let ct=(n.startBin+ce+.5)*e.binStepDeg,$e=r[ce]+(o[ce]-r[ce])*(E+.5)/d,ie=qe(e.centre,$e,ct);return[ie.x*m,Te,ie.y*m]},Z=y(v,E),ee=y(S,E),Q=J(v,c[v][E]),he=J(S,c[S][E]);t.triN(Z,ee,he,A,F,F,f),t.triN(Z,he,Q,A,F,A,f);let je=y(S,E+1),Le=y(v,E+1),ge=J(v,c[v][E+1]),Ie=J(S,c[S][E+1]);t.triN(ge,Ie,je,Y,N,N,f),t.triN(ge,je,Le,Y,N,Y,f);let Oe=he[0]-Q[0],me=he[2]-Q[2],we=Math.hypot(Oe,me);if(we>1e-12){let ce=[-me/we,0,Oe/we];t.tri(Q,he,Ie,ce,b),t.tri(Q,Ie,ge,ce,b)}continue}let V=y(v,E),B=y(S,E),j=y(S,E+1),K=y(v,E+1);t.triN(V,B,j,A,F,N,f),t.triN(V,j,K,A,N,Y,f)}let C=y(v,0),G=y(S,0),P=y(S,d),T=y(v,d),I=E=>[E[0],i,E[2]];t.tri(I(C),I(P),I(G),[0,-1,0],h),t.tri(I(C),I(T),I(P),[0,-1,0],h),L(C,G),L(T,P)}if(!n.closed)for(let v of[0,l-1])for(let S=0;S<d;S++)L(y(v,S),y(v,S+1))}function tr(t,e,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(e.binCount).fill(-1/0);for(let d of e.rings)for(let m of d.arcs){let p=new Float64Array(m.binCount),c=new Float64Array(m.binCount);for(let h=0;h<m.binCount;h++){let b=(m.startBin+h)%e.binCount,g=Math.max(0,m.innerR[h]-ye);p[h]=Math.max(g,a[b]+.001),c[h]=Math.max(p[h]+.001,m.outerR[h]+ye)}let f=0;for(let h=0;h<m.binCount;h++){let b=m.topLevelM[h]-r;b>f&&(f=b)}f>=Oa&&Ha(t,e,m,p,c,r,o,i,n.seatGuards);for(let h=0;h<m.binCount;h++){let b=(m.startBin+h)%e.binCount;c[h]>a[b]&&(a[b]=c[h])}}if(za(n.shapes,e))return;let s=e.rings[e.rings.length-1],u=_a*Ve,l=Ba*Ve;for(let d of s.arcs){let m=[],p=[];for(let h=0;h<d.binCount;h++){let b=(d.startBin+h+.5)*e.binStepDeg,g=d.outerR[h]+ye+u;m.push(qe(e.centre,g,b)),p.push(qe(e.centre,g+l,b))}let c=-1/0;for(let h=0;h<d.binCount;h++)d.topLevelM[h]>c&&(c=d.topLevelM[h]);let f=()=>c+Na;d.closed?se(t,p,[m.slice().reverse()],f,r,o.shellTop,o.shellWall,i):se(t,[...p,...m.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function nr(t,e,n,r,o,i,a,s){if(!e.outline||e.outline.length<3)return;let u=n.baseHeightM,l=Fe(r,s.tierTop);if(!o)return;let d=b=>o.deckAt(b.x,b.y),m=_o(e,a),p=m[0]??e.outline;if(o.rowLevels.length>=2){let b=Bt(o.rowLevels),g=Bo(Eo(o.rowLevels,n.focal,b),m),y=()=>[0,1,0];for(let w of g){let R=Math.max(u,w.topY-.02);for(let M of i.subtract(w.outline,R))se(t,M,w.holes,()=>R,u,l,s.tierWall,ae,void 0,y)}g.length||se(t,p,e.holes,()=>o.landingY,u,l,s.tierWall,ae);let x={tread:[l[0]*ae.top,l[1]*ae.top,l[2]*ae.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let w of m.length?m:[p])Fo(t,o.rowLevels,n.focal,o.landingY,x,w,b);return}let c=o.flat?1/0:No,f=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(p,h))se(t,b,e.holes,d,u,l,s.tierWall,ae,c,f)}function Ua(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 u=n.bySection.get(s);if(u&&u.rowLevels.length>=2)continue;let l=e[a],d=o.get(s);d||(d=new Map,o.set(s,d));let m=l.rowId||`__seat-${a}`,p=d.get(m);p||(p={pts:[],levelM:0,n:0},d.set(m,p)),p.pts.push({x:l.x,y:l.y}),p.levelM+=n.seatDeckY(a),p.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(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let u=o.get(a.id);u&&i.push({sectionId:a.id,rows:[...u.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function or(t,e,n,r,o){let i=Ua(e,n,r);if(!i.length)return;let a=Qo(i,e.focal);if(!a)return;let s=new Set;for(let l of e.objects)l.type==="section"&&s.add(l.id);let u=[];for(let l=0;l<n.length;l++){let d=r.seatOwner[l];(!d||s.has(d))&&u.push({x:n[l].x,y:n[l].y,deckY:r.seatDeckY(l)})}t.setMaterial(0),tr(t,a,{bottomY:e.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:e.objects.filter(l=>l.type==="shape"),seatGuards:u})}function rr(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 ir(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 ja=1.15,Ya=3.25,Xa=4.5,Wa=.85,Ka=.5,qa=.26;function ar(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>=ja&&a.add("zone"),o<=(i?Ya:Xa)&&(a.add("section"),a.add("ga")),o<=Wa&&(a.add("annotation"),a.add("booth")),o<=Ka&&a.add("row"),o<=qa&&a.add("seat"),a}function Ht(t,e,n,r){let o=t,i=e[0],a=e[1],s=e[2],u=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],m=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let p=u/m,c=l/m,f=d/m,h=p>=-1.05&&p<=1.05&&c>=-1.05&&c<=1.05&&f<=1;return{x:(p*.5+.5)*n,y:(1-(c*.5+.5))*r,depth:f,visible:h}}function sr(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){let u=Math.abs(i.screen.x-s.screen.x),l=Math.abs(i.screen.y-s.screen.y);if(u<e&&l<n){a=!0;break}}a||r.push(i)}return r}var cr={row:8,seat:14};function lr(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 ur(t,e,n,r){let o=[...t].sort((a,s)=>(s.priority??0)-(a.priority??0)||a.focus-s.focus),i=[];for(let a of o){if(i.length>=r)break;let s=!1;for(let u of i)if(Math.abs(a.screen.x-u.screen.x)<e&&Math.abs(a.screen.y-u.screen.y)<n){s=!0;break}s||i.push(a)}return i}var $a=6,Za=2.2,dr=.1,Qa=.3,Ja=1.8,es=.9,ts=.55,ns=6e3;function mr(t){let{doc:e,units:n,seats:r,surfaces:o,focal:i}=t,a=e.zones??[],s=[];if(a.length){let u=new Map;for(let d of n)for(let m of d.objects)m.type==="section"&&m.zone&&u.set(m.id,m.zone);let l=new Map;for(let d=0;d<r.length;d++){let m=r[d],p=o.seatOwner[d],c=m.zoneId??(p?u.get(p):void 0);if(!c)continue;let f=l.get(c);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(c,f)),f.n++,m.x<f.minX&&(f.minX=m.x),m.y<f.minY&&(f.minY=m.y),m.x>f.maxX&&(f.maxX=m.x),m.y>f.maxY&&(f.maxY=m.y),f.sumY+=o.seatDeckY(d)}for(let d of a){let m=l.get(d.id),p=[];for(let[c,f]of u)f===d.id&&p.push(c);if(!m||m.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:p,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*D,1.5,(d.focalPoint??i).y*D]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:p,seatCount:m.n,center:[(m.minX+m.maxX)/2*D,m.sumY/m.n,(m.minY+m.maxY)/2*D],radius:.5*Math.hypot((m.maxX-m.minX)*D,(m.maxY-m.minY)*D)||1,focalWorld:[(d.focalPoint??i).x*D,1.5,(d.focalPoint??i).y*D]})}}return s}function fr(t){let{doc:e,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:u}=t,l=[],d=[],m=[];for(let p of s)p.seatCount!==0&&l.push({id:`zone:${p.id}`,kind:"zone",text:p.label,anchor:[p.center[0],p.center[1]+$a,p.center[2]],color:e.zones?.find(c=>c.id===p.id)?.color});{let p=new Map,c=new Map;for(let f=0;f<r.length;f++){let h=o.seatOwner[f];if(!h)continue;let b=p.get(h);b||(b={n:0,x:0,y:0,deck:0},p.set(h,b)),b.n++,b.x+=r[f].x,b.y+=r[f].y,b.deck+=o.seatDeckY(f);let g=c.get(h);g||(g={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},c.set(h,g)),r[f].x<g.minX&&(g.minX=r[f].x),r[f].x>g.maxX&&(g.maxX=r[f].x),r[f].y<g.minY&&(g.minY=r[f].y),r[f].y>g.maxY&&(g.maxY=r[f].y)}for(let f of n)for(let h of f.objects){if(h.type!=="section")continue;let b=p.get(h.id);if(!b||b.n===0)continue;let g=c.get(h.id),y=[b.x/b.n*D,b.deck/b.n,b.y/b.n*D],x=h.displayLabel||h.label||h.id;d.push({id:h.id,floorIndex:f.index,label:x,seatCount:b.n,center:y,radius:Math.max(1,Math.hypot(g.maxX-g.minX,g.maxY-g.minY)*.5*D),focalWorld:[f.focal.x*D,f.baseHeightM+1.5,f.focal.y*D]});let w=e.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[y[0],y[1]+Za,y[2]],floorIndex:f.index})}}{for(let f of n)for(let h of f.objects){if(h.type!=="gaArea")continue;let b=ft(h.points);if(!b)continue;let g=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${g} \xB7 ${h.capacity.toLocaleString()}`:g,anchor:[b.x*D,f.baseHeightM+Ja,b.y*D],floorIndex:f.index})}let p=new Map;for(let f=0;f<r.length;f++){let h=r[f],b=Math.hypot(h.x-u.x,h.y-u.y),g=p.get(h.rowId);(!g||b>g.far)&&p.set(h.rowId,{seat:h,index:f,far:b})}for(let[f,h]of p){let b=h.seat.label?h.seat.label.lastIndexOf("-"):-1,g=b>0?h.seat.label.slice(0,b):f;g&&l.push({id:`row:${f}`,kind:"row",text:g,anchor:[h.seat.x*D,o.seatDeckY(h.index)+es,h.seat.y*D],floorIndex:a[h.index]})}let c=new Map;for(let f=0;f<r.length;f++){let h=r[f],b=h.label?h.label.lastIndexOf("-"):-1,g=c.get(h.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?h.label.slice(0,b):h.rowId,sectionId:h.sectionId},c.set(h.rowId,g));let y=f*3,x=i.iPosition[y],w=i.iPosition[y+1],R=i.iPosition[y+2];g.n++,g.x+=x,g.y+=w,g.z+=R,g.minX=Math.min(g.minX,x),g.maxX=Math.max(g.maxX,x),g.minZ=Math.min(g.minZ,R),g.maxZ=Math.max(g.maxZ,R)}for(let[f,h]of c)m.push({id:f,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=ns)for(let f=0;f<r.length;f++){let h=r[f],b=h.displayLabel||h.label;b&&l.push({id:`seat:${h.id}`,kind:"seat",text:b,anchor:[h.x*D,o.seatDeckY(f)+ts,h.y*D],floorIndex:a[f]})}}for(let p of n)for(let c of p.objects)if(c.type==="shape"&&c.role&&["entrance","exit","screen","suite","obstruction"].includes(c.role)){let f=gt(c),h=f?ft(f):null;if(!h||!c.label)continue;l.push({id:`architecture:${c.id}`,kind:"annotation",text:c.label,anchor:[h.x*D,p.baseHeightM+xt(c).heightM+dr,h.y*D],color:c.fill,floorIndex:p.index})}else if(c.type==="text"){if(!c.text)continue;l.push({id:`text:${c.id}`,kind:"annotation",text:c.text,anchor:[c.position.x*D,p.baseHeightM+dr,c.position.y*D],color:c.color,rotation:c.rotation,floorIndex:p.index})}else if(c.type==="booth"){let f=St(c);if(!f)continue;let h=ft(f);if(!h)continue;l.push({id:`booth:${c.id}`,kind:"booth",text:c.displayLabel||c.label||c.id,anchor:[h.x*D,p.baseHeightM+Pn+Qa,h.y*D],floorIndex:p.index})}return{labels:l,sections:d,rows:m}}function pr(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 hr(t){let{doc:e,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=t,u=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let p=0;p<i.floor.length;p+=1){let c=Math.max(0,Math.min(n.length-1,Math.round(i.floor[p]))),f=p*3,h=l[c];h.minX=Math.min(h.minX,i.position[f]),h.minY=Math.min(h.minY,i.position[f+1]),h.minZ=Math.min(h.minZ,i.position[f+2]),h.maxX=Math.max(h.maxX,i.position[f]),h.maxY=Math.max(h.maxY,i.position[f+1]),h.maxZ=Math.max(h.maxZ,i.position[f+2])}let d=new Map;for(let p=0;p<n.length;p++)for(let c of n[p].objects)c.type==="section"&&d.set(c.id,p);let m=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 p=0;p<r.length;p++){let c=o.seatOwner[p],f=(c!==null?d.get(c):void 0)??a[p];if(f===void 0)continue;let h=m[f],b=r[p];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let g=o.seatDeckY(p);h.sumX+=b.x*D,h.sumDeck+=g,h.sumZ+=b.y*D,h.minDeck=Math.min(h.minDeck,g),h.maxDeck=Math.max(h.maxDeck,g+1.6),s[p]=f}for(let p=0;p<n.length;p++){let c=m[p],f=e.floors?.[p],h=l[p],b=Math.min(c.n?c.minX*D:n[p].focal.x*D-1,Number.isFinite(h.minX)?h.minX:1/0),g=Math.max(c.n?c.maxX*D:n[p].focal.x*D+1,Number.isFinite(h.maxX)?h.maxX:-1/0),y=Math.min(c.n?c.minY*D:n[p].focal.y*D-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(c.n?c.maxY*D:n[p].focal.y*D+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),w=Math.min(c.n?Math.min(n[p].baseHeightM,c.minDeck):n[p].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(c.n?Math.max(c.maxDeck,w+.5):w+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),M=[c.n?c.sumX/c.n:(b+g)/2,c.n?c.sumDeck/c.n:(w+R)/2,c.n?c.sumZ/c.n:(y+x)/2],k=Math.max(1,.5*Math.hypot(g-b,R-w,x-y));u.push({index:p,id:f?.id??`floor-${p}`,label:f?.name??(n.length>1?`Floor ${p+1}`:"Venue"),seatCount:c.n,center:M,radius:k,box:{min:[b,w,y],max:[g,R,x]},focalWorld:[n[p].focal.x*D,n[p].baseHeightM+1.5,n[p].focal.y*D]})}}return u}function In(t,e){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,u)=>{s<n&&(n=s),u<r&&(r=u),s>o&&(o=s),u>i&&(i=u)};for(let s of e)a(s.x,s.y);for(let s of t)for(let u of s.objects)if(u.type==="section")for(let l of u.outline)a(l.x,l.y);else if(u.type==="shape"&&u.points)for(let l of u.points)a(l.x,l.y);else if(u.type==="gaArea")for(let l of u.points)a(l.x,l.y);else if(u.type==="booth"){let l=St(u);if(l)for(let d of l)a(d.x,d.y)}else if(u.type==="table"){let l=Cn(u);if(l)for(let d of l)a(d.x,d.y)}else if(u.type==="decorImage"){let l=An(u);if(l)for(let d of l)a(d.x,d.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function br(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=yt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(t,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=e.reduce((c,f)=>f.baseHeightM<c.baseHeightM?f:c);t.setFloor(a.index);let s=n.filter((c,f)=>r[f]===a.index),u=In([a],s),l=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),d=Math.max(28,Math.min(80,l*.04)),m=yt(u.minX-d,u.minY-d,u.maxX-u.minX+d*2,u.maxY-u.minY+d*2),p=a.baseHeightM-.03;se(t,m,void 0,()=>p,p-.22,i.ground,i.ground,ae)}}function yr(t,e,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,u=1/0,l=-1/0,d=-1/0,m=-1/0,p=(h,b,g)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,b),d=Math.max(d,b),u=Math.min(u,g),m=Math.max(m,g)};for(let h=0;h<t.position.length;h+=3)p(t.position[h],t.position[h+1],t.position[h+2]);for(let h=0;h<e.count;h++){let b=h*3,g=e.iPosition[b],y=e.iPosition[b+1],x=e.iPosition[b+2],w=Math.max(.35,e.iMaxRadius[h]??.35);p(g-w,y,x-w),p(g+w,y+1.6,x+w)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,d=i*.16,u=o-i,m=o+i);let c=[(a+l)/2,(s+d)/2,(u+m)/2],f=Math.max(1,.5*Math.hypot(l-a,d-s,m-u));return{center:c,radius:f,minY:s,maxY:d}}function gr(t,e,n,r,o,i){let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let w=0;w<t.count;w++){let R=w*3,M=t.iPosition[R],k=t.iPosition[R+2];M<a&&(a=M),M>u&&(u=M),k<s&&(s=k),k>l&&(l=k)}for(let w of e)a=Math.min(a,w.cx-w.halfX),u=Math.max(u,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),l=Math.max(l,w.cz+w.halfZ);let d=n.minX*D,m=n.maxX*D,p=n.minY*D,c=n.maxY*D,f=d,h=m,b=p,g=c;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(u-a,l-s));f=Math.max(d,a-w),h=Math.min(m,u+w),b=Math.max(p,s-w),g=Math.min(c,l+w)}let y=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,y,b],max:[h,x,g]}}function it(t){let{doc:e}=t,n=fo(e.theme),r=n.structure,o=Oo(e,t.eventConfigurationId??e.eventConfigurationId),i=t.seats,a=new Ft,s=new Map;for(let _ of o)for(let v of _.objects)s.set(v.id,_.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,_.index);let u=i.map(_=>s.get(_.sectionId??"")??s.get(_.rowId??"")??0),l=In(o,i);br(a,o,i,u,l,r);let d=zo(e,i),m=new Map;for(let _ of e.categories??[])m.set(_.key,_.color);let p=[],c=Vo(o,i,u),f=new Float32Array(i.length);for(let _=0;_<o.length;_++){let v=o[_];a.setFloor(_);let S=new Vt,C=[],G=v.objects.filter(P=>P.type==="section"&&!!P.outline&&P.outline.length>=3);for(let P of v.objects)P.type==="section"?nr(a,P,v,Go(P,d),c.bySection.get(P.id),S,G,r):P.type==="shape"?(a.setMaterial(P.role==="screen"?1:0),Ko(a,P,v.baseHeightM,Uo(P,C),r,v.focal,p),a.setMaterial(0)):P.type==="gaArea"?$o(a,P,v.baseHeightM,ne(m.get(P.categoryKey)),r):P.type==="booth"?Xo(a,P,v.baseHeightM,ne(m.get(P.categoryKey)),r):P.type==="table"?Wo(a,P,v.baseHeightM,ne(m.get(P.categoryKey)),r):P.type==="decorImage"&&qo(a,P,v.baseHeightM,r);or(a,v,i,c,r)}let h=o.length>1?{x:o.reduce((_,v)=>_+v.focal.x,0)/o.length,y:o.reduce((_,v)=>_+v.focal.y,0)/o.length}:e.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=ao([a.build()]),g=mo(i,t.initialState,c,f,m),y=mr({doc:e,units:o,seats:i,surfaces:c,focal:h}),{labels:x,sections:w,rows:R}=fr({doc:e,units:o,seats:i,surfaces:c,seatData:g,hintedSeatFloor:u,zones:y,focal:h}),M=hr({doc:e,units:o,seats:i,surfaces:c,solids:b,hintedSeatFloor:u,seatFloor:f});pr(x,M),g.iYaw=lo(g.iPosition,i.length,_=>i[_].rowId,_=>{let v=o[f[_]]?.focal??h;return[v.x*D,v.y*D]});let k=(l.minX+l.maxX)/2*D,O=(l.minY+l.maxY)/2*D,L=.5*Math.hypot((l.maxX-l.minX)*D,(l.maxY-l.minY)*D)||10,U=yr(b,g,{cx:k,cz:O,radius:L}),z=gr(g,p,l,U.minY,U.maxY,L);return{solids:b,seats:g,bounds:{center:[(z.min[0]+z.max[0])/2,(z.min[1]+z.max[1])/2,(z.min[2]+z.max[2])/2],radius:L,groundY:0,box:z},renderBounds:{center:U.center,radius:U.radius},stateColorLUT:po(n,Me),theme:n,seatCount:i.length,focalWorld:[h.x*D,1.5,h.y*D],zones:y,stages:p,sections:w,rows:R,labels:x,floors:M}}var os=88,rs=20,is={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}},xr=new Set(["row","seat"]),vr={row:{x:62,y:16},seat:{x:46,y:18}},as=ne,Tn=t=>Gn(t);function ss(t,e){let n=Tn(t),r=Tn(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function cs(t,e=[.04,.06,.1]){let n=Tn(e)<.42,r=n?"#f4f7fb":"#0b1220",o=as(t),i=o&&ss(o,e)>=4.5?t:r;return n?{ink:i,backing:"rgba(8,12,22,.78)",border:"rgba(210,222,245,.24)"}:{ink:i,backing:"rgba(255,255,255,.84)",border:"rgba(11,18,32,.22)"}}var Ut=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}`))}update(e,n,r,o,i,a){if(!this.labels.length)return;let s=ar(o,i,{hasZoneLabels:this.labels.some(c=>c.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let u=[];for(let c of this.labels){if(!s.has(c.kind))continue;let f=Ht(e,c.anchor,n,r);if(!f.visible)continue;let h=a?Math.hypot(c.anchor[0]-a[0],c.anchor[1]-a[1],c.anchor[2]-a[2]):1;u.push({label:c,screen:f,focus:lr(f,h,n,r),...this.selectedSeatLabelIds.has(c.id)?{priority:1}:{}})}let l=ir(u.filter(c=>c.label.kind==="floor"),n),d=[...u.filter(c=>!xr.has(c.label.kind)&&c.label.kind!=="floor"),...l],m=[...sr(d,os,rs),...["row","seat"].flatMap(c=>ur(u.filter(f=>f.label.kind===c),vr[c].x,vr[c].y,cr[c]))],p=new Set(m.map(c=>c.label.id));for(let{label:c,screen:f}of m){let b=this.nodeFor(c).style;b.display="",b.transform=`translate(-50%, -50%) translate(${f.x.toFixed(1)}px, ${f.y.toFixed(1)}px)`}for(let[c,f]of this.nodes)p.has(c)||(f.style.display="none")}nodeFor(e){let n=this.nodes.get(e.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(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=is[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=cs(e.color??this.opts.ink,this.opts.backgroundRgb),s=!xr.has(e.kind);return i.color=r?"#ecf8ff":a.ink,i.background=r?"rgba(10,28,45,.9)":s?a.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${a.border}`:"",i.borderRadius=r||s?"999px":"",i.padding=r||s?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em",(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var pe=require("ogl");var Ge=require("ogl");var jt=`
|
|
1
|
+
"use strict";var gi=Object.create;var Tt=Object.defineProperty;var xi=Object.getOwnPropertyDescriptor;var vi=Object.getOwnPropertyNames;var Mi=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty;var wi=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},Yn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vi(t))!Si.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=xi(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?gi(Mi(e)):{},Yn(t||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Pi=e=>Yn(Tt({},"__esModule",{value:!0}),e);var lc={};wi(lc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Tr,buildSceneModel:()=>ct,inspectVenue3DQualityEvidence:()=>qt,mountVenue3D:()=>cc,prepareVenue3D:()=>pi});module.exports=Pi(lc);var $n=require("ogl");var Ci=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ai(e){let t=Ci.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ee(e){let t=Ai(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function mn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ri(e){return .2126*mn(e[0])+.7152*mn(e[1])+.0722*mn(e[2])}function Wn(e){return Ri([e[0]*255,e[1]*255,e[2]*255])}function Ii(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function pe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function pt(e,t){let n=Ii(e);return pe(e,[n,n,n],t)}var ge=["available","held","sold","selected","dimmed"];function ht(e){let t=ge.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 fn={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]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function be(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Ei(){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 $n.Renderer({canvas:this.canvas,dpr:Ei(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.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))}};var nt=require("ogl"),de=Math.PI/180,pn=15*de,hn=80*de,tt=.12,Zn=35,Qn=1.25,Dt=class{constructor(t,n,r,o){this.fovY=Zn;this.target=new nt.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;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 nt.Vec3;this.panAnchor=new nt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new nt.Camera(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(pn,Math.min(hn,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*de;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(pn,Math.min(hn,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*de/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),d=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*d)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*u*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*de/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*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??Qn)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*de,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*de/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))*de;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),u=-l*Math.sin(o),d=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(d)>.999)return s;let f=-m,p=u,h=Math.hypot(f,p);f/=h,p/=h;let b=-p*d,y=p*u-f*m,g=f*d,x=Math.tan(r),w=Math.tan(n),R=1;for(let S=0;S<8;S++){let F=(S&1?c.max[0]:c.min[0])-t.center[0],B=(S&2?c.max[1]:c.min[1])-t.center[1],N=(S&4?c.max[2]:c.min[2])-t.center[2],H=F*u+B*d+N*m,_=Math.abs(F*f+N*p),M=Math.abs(F*b+B*y+N*g);R=Math.max(R,_/x-H,M/w-H)}return Math.min(s,Math.max(R,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*tt,this.polar+=n*tt,this.distance+=r*tt,this.target.x+=o*tt,this.target.y+=i*tt,this.target.z+=a*tt,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(pn,Math.min(hn,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 kt=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 ot=2.5,Ti=1.15,bt=6,rt=10,Jn=6,eo=9.5,to=.9,no=2.2,bn=30,yn=4,Lt=8192;var gc=rt+yn;function oo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ot};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ot+o*(Ti-ot)}}function ro(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function io(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}var Fi=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],vc=new Map(Fi.map(e=>[e.key,e]));var Di={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function ao(e){let t=e?.[0];return t&&Di[t]||"#3b82f6"}var ki=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],Mc=new Map(ki.map(e=>[e.key,e]));var Li=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Sc=new Set(Li);var we=.02291666666666667,Be=1/we,_i=58,Oi=_i*we;var Bi=3,so=0,gn=120,Ni=0,Vi=45,zi=7,_t=1.2;function xn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Gi(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=zi?e:Bi}function co(e,t={}){let n=xn(t.floorBaseHeightM,so,gn,0),r=Math.min(gn,n+Gi(e.elevation)*Oi),o=e.height===void 0?r:xn(e.height,so,gn,r),i=xn(e.rake,Ni,Vi,0);return{height:o,rake:i}}var uo=et(require("earcut"),1),mo=et(require("polygon-clipping"),1);var Rc=Math.PI/180;function vn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function yt(e){return e.length?vn(e):null}function qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function gt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var L=we,Hi=.002;function Ui(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<Hi}var $e=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)}},Nt=class{constructor(){this.pos=new $e;this.nor=new $e;this.col=new $e;this.flr=new $e;this.mat=new $e;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){Ui(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 ji(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,u=i*a-r*c,d=r*s-o*a,m=Math.hypot(l,u,d)||1;return l/=m,u/=m,d/=m,[l,u,d]}function Xi(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=(0,uo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Mn(e){return qe(e)<0?[...e].reverse():e}var Yi=3;function Wi(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,p,h,b)=>Math.abs(r({x:(f.x+p.x)/2,y:(f.y+p.y)/2})-(h+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,d=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),m=(f,p,h)=>{let b=Math.abs(r({x:(f+c)/2,y:(p+l)/2})-(h+u)/2);b>d&&(d=b)};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),d}function xt(e,t,n,r,o){if(o<=0)return Wi(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(xt(e,i,s,r,o-1),xt(i,t,a,r,o-1),xt(s,a,n,r,o-1),xt(i,a,s,r,o-1))}function vt(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},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},p={x:(r.x+t.x)/2,y:(r.y+t.y)/2};vt(e,t,m,p,o,i,a-1,s),vt(e,m,n,f,o,i,a-1,s),vt(e,p,f,r,o,i,a-1,s),vt(e,m,f,p,o,i,a-1,s);return}let c=[t.x*L,o(t),t.y*L],l=[n.x*L,o(n),n.y*L],u=[r.x*L,o(r),r.y*L];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let d=ji(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var Ki=8;function lo(e,t,n){if(!Number.isFinite(n))return e;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},d=t(u);if(Math.abs(d-(s+c)/2)>n){o(i,u,s,d,l-1),o(u,a,d,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),Ki)}return r}function Ot(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,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Bt=.001*Be*.1;function se(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(qe(t))<1e-4))return;let u=Ot(lo(Ot(Mn(t),Bt),r,c),Bt),d=n?.map(S=>Ot(lo(Ot(Mn(S),Bt),r,c),Bt)).filter(S=>S.length>=3&&Math.abs(qe(S))>=1e-4),{pts:m,tris:f}=Xi(u,d),p=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[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],g=0;if(Number.isFinite(c))for(;g<Yi;g++){let S=0;for(let F=0;F<f.length;F+=3){let B=xt(m[f[F]],m[f[F+1]],m[f[F+2]],r,g);B>S&&(S=B)}if(S<=c)break}for(let S=0;S<f.length;S+=3){let F=m[f[S]],B=m[f[S+1]],N=m[f[S+2]];vt(e,F,B,N,r,p,g,l);let H=[F.x*L,o,F.y*L],_=[B.x*L,o,B.y*L],M=[N.x*L,o,N.y*L];e.tri(H,M,_,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let F=1<<g,B=[];for(let N=0;N<S.length;N++){let H=S[N],_=S[(N+1)%S.length];for(let M=0;M<F;M++){let v=M/F;B.push({x:H.x+(_.x-H.x)*v,y:H.y+(_.y-H.y)*v})}}return B},w=vn(u),R=[{ring:x(u),flip:!1}];if(d)for(let S of d)S.length>=3&&R.push({ring:x(S),flip:!0});for(let{ring:S,flip:F}of R)for(let B=0;B<S.length;B++){let N=S[B],H=S[(B+1)%S.length],_=(H.x-N.x)*L,v=(H.y-N.y)*L,A=-_,C=Math.hypot(v,A)||1;v/=C,A/=C;let O=(N.x+H.x)/2-w.x,P=(N.y+H.y)/2-w.y,D=v*O+A*P;F&&(D=-D),D<0&&(v=-v,A=-A);let I=[v,0,A],z=[N.x*L,r(N),N.y*L],E=[H.x*L,r(H),H.y*L],k=[N.x*L,o,N.y*L],G=[H.x*L,o,H.y*L];e.tri(z,E,G,I,b,b,y),e.tri(z,G,k,I,b,y,y)}}function fo(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 Vt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Mn(e),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,d=l.y-c.y,m=Math.hypot(u,d)||1;i.push({x:d/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],d=l.x+u.x,m=l.y+u.y,f=Math.hypot(d,m),p=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(f<1e-9){p();continue}d/=f,m/=f;let h=d*l.x+m*l.y,b=1/Math.max(h,1e-6);if(!Number.isFinite(b)||b>n){p();continue}a.push([c.x+d*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=mo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(qe(d[0].map(([f,p])=>({x:f,y:p}))));m>l&&(l=m,c=d[0])}if(!c)return e;let u=c.map(([d,m])=>({x:d,y:m}));if(u.length>1){let d=u[0],m=u[u.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function zt(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 Mt(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 le={pedestal:0,pad:1,back:2,body:3,head:4},qi=.44,$i=.15,Zi=.3,Qi=.24;function po(e){return e===void 0||!Number.isFinite(e)||e<=0?Qi:Math.min(Zi,Math.max($i,e*qi))}var Sn=.21,Ji=.05,wn=.45,Gt=wn+Ji,ea=[{part:le.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:le.pad,min:[-1,.36,-.95],max:[1,wn,1]},{part:le.back,min:[-1,Gt,-1],max:[1,.92,-.72]}],ta=[{part:le.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:le.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:le.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:le.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:le.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],na=[{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 ho(){let e=[],t=[],n=[],r=[],o=(C,O,P)=>{let D=n.length,[I,z,E]=C,k=[z[0]-I[0],z[1]-I[1],z[2]-I[2]],G=[E[0]-I[0],E[1]-I[1],E[2]-I[2]],X=k[1]*G[2]-k[2]*G[1],V=k[2]*G[0]-k[0]*G[2],T=k[0]*G[1]-k[1]*G[0],Y=Math.hypot(X,V,T);Y>1e-9?(X/=Y,V/=Y,T/=Y):[X,V,T]=O,X*O[0]+V*O[1]+T*O[2]<0&&(X=-X,V=-V,T=-T);for(let K of C)e.push(...K),t.push(X,V,T),n.push(P);r.push(D,D+1,D+2,D,D+2,D+3)},i=C=>{for(let O of na){let P=O.c.map(D=>D.map((I,z)=>I?C.max[z]:C.min[z]));o(P,O.n,C.part)}};for(let C of ea)i(C);for(let C of ta)i(C);let a=wn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,f=.01,p=[-c,a,u],h=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],w=[-l,s,f],R=[l,s,f];o([h,x,R,y],[1,0,0],le.body),o([b,w,g,p],[-1,0,0],le.body),o([w,R,x,g],[0,1,0],le.body),o([p,h,y,b],[0,-1,0],le.body),o([y,R,w,b],[0,0,1],le.body),o([p,g,x,h],[0,0,-1],le.body);let S=10,F=8,B=[0,1.205,-.23],N=[.42,.115,.38],H=n.length;for(let C=0;C<=F;C++){let O=Math.PI*C/F,P=Math.cos(O),D=Math.sin(O);for(let I=0;I<=S;I++){let z=Math.PI*2*I/S,E=D*Math.cos(z),k=D*Math.sin(z);e.push(B[0]+N[0]*E,B[1]+N[1]*P,B[2]+N[2]*k);let G=E/N[0],X=P/N[1],V=k/N[2],T=Math.hypot(G,X,V)||1;G/=T,X/=T,V/=T,t.push(G,X,V),n.push(le.head)}}for(let C=0;C<F;C++)for(let O=0;O<S;O++){let P=H+C*(S+1)+O,D=P+S+1;r.push(P,D,P+1,P+1,D,D+1)}let _=new Float32Array(e),M=new Float32Array(t),v=new Float32Array(n),A=new Uint16Array(r);return{position:_,normal:M,part:v,index:A,vertexCount:n.length,indexCount:r.length}}function bo(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let d=u-l;for(let m=l;m<u;m++){let[f,p]=r(m),h=f-i(m),b=p-a(m);if(d>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),w=a(g)-a(y),R=Math.hypot(x,w);if(R>1e-6){let S=-w/R,F=x/R;S*h+F*b<0&&(S=-S,F=-F),h=S,b=F}}o[m]=h===0&&b===0?0:Math.atan2(h,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Fe=.22;function yo(e,t){let n=ge[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 oa=.42;function ra(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 p of e)p.x<r&&(r=p.x),p.y<o&&(o=p.y),p.x>i&&(i=p.x),p.y>a&&(a=p.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),u=Math.max(1,Math.ceil(s/l)+1),d=Math.max(1,Math.ceil(c/l)+1),m=new Map,f=(p,h)=>{let b=Math.min(u-1,Math.max(0,Math.floor((p-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((h-o)/l)))*u+b};for(let p=0;p<t;p++){let h=f(e[p].x,e[p].y),b=m.get(h);b?b.push(p):m.set(h,[p])}for(let p=0;p<t;p++){let h=e[p],b=Math.min(u-1,Math.max(0,Math.floor((h.x-r)/l))),y=Math.min(d-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let w=y-x;w<=y+x;w++)if(!(w<0||w>=d))for(let R=b-x;R<=b+x;R++){if(R<0||R>=u||x>1&&Math.abs(w-y)<x&&Math.abs(R-b)<x)continue;let S=m.get(w*u+R);if(S)for(let F of S){if(F===p)continue;let B=Math.hypot(e[F].x-h.x,e[F].y-h.y);B<g&&(g=B)}}if(Number.isFinite(g)&&g<=x*l)break}n[p]=g}return n}function ia(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function go(e,t,n,r,o){let i=e.length,a=new Float32Array(i*3),s=new Float32Array(i),c=new Float32Array(i*3),l=new Float32Array(i),u=new Float32Array(i),d=new Float32Array(i),m=new Float32Array(i*3),f=new Map,p=ra(e);for(let h=0;h<i;h++){let b=e[h],g=(n?.seatPitchU(h)??p[h])*L;l[h]=Number.isFinite(g)?Math.max(.06,Math.min(Fe,g*oa)):Fe,u[h]=po(Number.isFinite(g)?g:void 0),d[h]=b.wheelchairSpaceType==="no-seat"?0:1,a[h*3]=b.x*L,a[h*3+1]=n?n.seatDeckY(h):ia(b),a[h*3+2]=b.y*L,s[h]=ht(t?t(b):"available");let x=ee(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[h*3]=x[0],c[h*3+1]=x[1],c[h*3+2]=x[2],b.accessibility?.length){let w=ee(ao(b.accessibility));w&&(m[h*3]=w[0],m[h*3+1]=w[1],m[h*3+2]=w[2])}f.set(b.id,h)}return{count:i,iPosition:a,iState:s,iCategory:c,iMaxRadius:l,iRing:m,idToIndex:f,iChairWidth:u,iPhysicalSeat:d,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var aa=64;function Pn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=ht(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+aa){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 sa=.15,ca=.9,la=1.76,ua=.7,da=1.6;function ma(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:fn,seatStates:{...Kn},seatScale:1}}function xo(e){let t=ma();if(!e)return t;let n=ee(e.background);if(n){t.background={top:be(n,ca),bottom:be(n,la)};let i={};for(let[a,s]of Object.entries(fn))i[a]=pe(s,n,sa);t.structure=i}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(da,Math.max(ua,o))),t}function vo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Mo(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function it(e,t,n){if(!e.length)return 1/0;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,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function fa(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function So(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Cn(e,t){let n=1/0;for(let r of Mo(e)){let o=it(t,r.x,r.y);o<n&&(n=o)}for(let r of Mo(t)){let o=it(e,r.x,r.y);o<n&&(n=o)}return n}function pa(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let d=Math.hypot(u.x-n,u.y-r);d>o&&(o=d,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,d)=>({p:u,i:d,t:(u.x-n)*a+(u.y-r)*s})).sort((u,d)=>u.t-d.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function An(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,w=g.y-r;o+=x*x,a+=w*w,i+=x*w,s+=x*x*x,c+=w*w*w,l+=x*w*w,u+=w*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,f=(c+u)/2,p=(m*a-f*i)/d,h=(f*o-m*i)/d,b=p+n,y=h+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var ha=.15;function ba(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,w=0;for(let R of g.pts)x+=R.x,w+=R.y;return{x:x/g.pts.length,y:w/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,w=g.y-r;o+=x*x,i+=x*w,a+=w*w}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,d;Math.abs(i)>1e-12?(u=l-a,d=i):o>=a?(u=1,d=0):(u=0,d=1);let m=Math.hypot(u,d);if(!(m>1e-12))return null;u/=m,d/=m;let f=1/0,p=-1/0,h=[];for(let g of e){let x=1/0,w=-1/0;for(let R of g.pts){let S=R.x*u+R.y*d;S<x&&(x=S),S>w&&(w=S),S<f&&(f=S),S>p&&(p=S)}h.push(w-x)}let b=p-f;return b>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=ya?{x:u,y:d}:null):null}var ya=.35;function wo(e,t,n,r){let o=new Map;for(let b of n){let y=t[b],g=y.rowId||`__seat-${b}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of o){let g=pa(y.pts,y.idx),x=0;for(let w of g.pts)x+=Math.hypot(w.x-r.x,w.y-r.y);i.push({id:b,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(b=>fa(b.pts)),s=[];for(let b=0;b<i.length;b++){let y=1/0;for(let g=0;g<i.length;g++){if(b===g||So(a[b],a[g])>=y)continue;let x=Cn(i[b].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((b,y)=>b-y);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)So(a[b],a[y])>l||Cn(i[b].pts,i[y].pts)<=l&&(u[b].push(y),u[y].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=d++,g=[b];for(i[b].blockId=y;g.length;){let x=g.pop();for(let w of u[x])i[w].blockId===-1&&(i[w].blockId=y,g.push(w))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let f=[];for(let b of i){if(b.pts.length<4)continue;let y=An(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||f.push({x:y.cx,y:y.cy}))}let p=f.length>=2?(()=>{let b=f.map(x=>x.x).sort((x,w)=>x-w),y=f.map(x=>x.y).sort((x,w)=>x-w),g=Math.floor(f.length/2);return{cx:b[g],cy:y[g]}})():null;if(p){let b=S=>Math.hypot(S.x-p.cx,S.y-p.cy),y=1/0,g=-1/0,x=[];for(let S of i){let F=1/0,B=-1/0;for(let N of S.pts){let H=b(N);H<F&&(F=H),H>B&&(B=H)}x.push(B-F),F<y&&(y=F),B>g&&(g=B)}let w=g-y;x.sort((S,F)=>S-F);let R=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(w>1e-9&&R/w<=ha){let S=i.map(M=>{let v=0;for(let A of M.pts)v+=b(A);return{row:M,radius:v/M.pts.length}}),F=1/0;for(let M of S)M.radius<F&&(F=M.radius);S.sort((M,v)=>M.radius-v.radius);let B=-1,N=-1/0,H=w/Math.max(1,S.length)*.5,_=[];for(let M of S)M.radius-N>H&&(B++,N=M.radius),M.row.ordinal=B,M.row.blockDepth=M.radius-F,_.push(M.row);return{sectionId:e,rows:_,blockCount:d}}}let h=[];for(let[,b]of m){let y=ba(b);if(y){let g=w=>{let R=0;for(let S of w.pts)R+=S.x*y.x+S.y*y.y;return R/w.pts.length};b.sort((w,R)=>g(w)-g(R));let x=0;for(let w=0;w<b.length;w++)w>0&&(x+=Cn(b[w-1].pts,b[w].pts)),b[w].ordinal=w,b[w].blockDepth=x,h.push(b[w])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,w)=>x.focalDistance-w.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),h.push(b[x])}}return{sectionId:e,rows:h,blockCount:d}}var Xc=Math.PI/180;function Po(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function ga(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Co(e,t,n){return Po(e,t)&&!(n??[]).some(r=>Po(e,r)||ga(e,r))}function xa(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function va(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let f of e){let p=Math.hypot(f.x-n,f.y-r);p>s&&(s=p,a=f)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let d=[...e].sort((f,p)=>(f.x-n)*c+(f.y-r)*l-((p.x-n)*c+(p.y-r)*l)),m=0;for(let f of d){let p=Math.hypot(f.x-n,f.y-r);p>m&&(m=p)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function Ao(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,d=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(t-(a.x+d*c),n-(a.y+d*l));m<o&&(o=m)}return o}var Ht=8;function Ma(e,t,n){let r=new Array(Ht).fill(1/0),o=new Array(Ht).fill(-1);for(let u=0;u<e.length;u++){let d=e[u],m=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let f=0;f<Ht;f++)if(m<r[f]){for(let p=Ht-1;p>f;p--)r[p]=r[p-1],o[p]=o[p-1];r[f]=m,o[f]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let d=Ao(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let f=2;f>m;f--)i[f]=i[f-1],a[f]=a[f-1];i[m]=d,a[m]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let d=a[u];if(d<0||i[u]>s)continue;let m=1/(i[u]*i[u]);c+=m*e[d].depth,l+=m}return l>0?c/l:e[a[0]].depth}function Sa(e){let t=(r,o)=>Ma(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=Ao(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Ro(e,t){let n=[];for(let r of e){let o=va(r.points,t);o&&n.push(o)}return n.length<2?xa(t):(n.sort((r,o)=>r.depth-o.depth),Sa(n))}var En=et(require("polygon-clipping"),1);var Fo=et(require("earcut"),1);var wa=.58,Io=.01,ye=Fe*1.5*Be,Pa=.5,Ca=.6;function Aa(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,u=c.y-s.y,d=Math.hypot(l,u);if(d<1e-9){r.push([0,0]);continue}l/=d,u/=d,r.push([-u,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 Ra(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,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*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 Eo=Math.PI/12;function Ia(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 Do(e,t){if(!e.length||!(t>0))return[];let n=Ia(e),r=(s,c,l,u)=>{let d=l-c;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let m=Math.max(1,Math.ceil(d/Eo)),f=t/Math.cos(d/m/2);for(let p=0;p<=m;p++){let h=c+d*p/m;u.push({x:s.x+Math.cos(h)*f,y:s.y+Math.sin(h)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let l=0;for(let f of n)l=Math.max(l,Math.hypot(f.x-s,f.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Eo)),m=(l+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let p=f/d*Math.PI*2;u.push({x:s+Math.cos(p)*m,y:c+Math.sin(p)*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 Bo(a)}function Ea(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,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function Ut(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 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<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let d=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let f=t[m],p=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(p>=d&&p>=s)continue;let h=Ea(e[m].pts,u.x,u.y);h<d&&(d=h),e[m].depth<e[o].depth&&h<s&&(s=h,c=e[m].y)}Number.isFinite(d)&&d>0&&a.push(d)}a.sort((u,d)=>u-d);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function ko(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],d=u.x-r.x,m=u.y-r.y,f=Math.hypot(d,m)||1;d/=f,m/=f;let p=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*p,y:u.y-d*p},{x:u.x-m*p,y:u.y+d*p}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let d=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);d>1e-6&&(a+=d,s++)}let c=s>0?a/s:0,l=Ra(i,Math.max(c*Ca,ye));return{pts:l,nrm:Aa(l,r),front:Math.max(n[t].pitch*wa,ye),back:Math.max(n[t].pitch*Pa,ye)}}var at=1.5,Lo=.3;function Rn(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 d=1;d<e.length-1;d++){let m=e[d],f=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);f>s&&(s=f,c=d)}if(s<=t||c<0)return[n,r];let l=Rn(e.slice(0,c+1),t),u=Rn(e.slice(c),t);return[...l.slice(0,-1),...u]}function _o(e,t){if(e.length<4)return e;let n=Rn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Oo(e,t,n){if(e.length<2)return[];let r=n??Ut(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 g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>ko(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+at),y:g.pts[x].y-g.nrm[x][1]*(g.front+at)}),d=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+at),y:g.pts[x].y+g.nrm[x][1]*(g.back+at)}),m=l[0],f=l[l.length-1],p=[];for(let g=0;g<m.pts.length;g++)p.push(u(m,g));for(let g of l)p.push(d(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)p.push(d(f,g));for(let g=l.length-1;g>=0;g--)p.push(u(l[g],0));let h=Bo(p),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(qe(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return gt(h,x.x,x.y)})){i.push({outline:_o(h,Lo),holes:[],topY:b});continue}for(let g of Ta(l))i.push({outline:g,holes:[],topY:b})}return i}function Ta(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+at,a=n.back+at;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]),t.push([s]))}if(!t.length)return[];try{let n=En.default.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(_o(i,Lo))}return r}catch{return[]}}function Bo(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 In=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(!gt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function To(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let d=1;d+1<r.length;d++){let m=r[d],f=r[d+1];e.tri([u.x*L,o,u.y*L],[m.x*L,o,m.y*L],[f.x*L,o,f.y*L],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=En.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],d=[],m=[];for(let p=0;p<u.length-1;p++)d.push(u[p][0],u[p][1]),m.push([u[p][0],u[p][1]]);if(m.length<3)continue;let f=(0,Fo.default)(d,void 0,2);for(let p=0;p<f.length;p+=3){let h=m[f[p]],b=m[f[p+1]],y=m[f[p+2]];e.tri([h[0]*L,o,h[1]*L],[b[0]*L,o,b[1]*L],[y[0]*L,o,y[1]*L],c,i)}}}function No(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Ut(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new In([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},m=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let p=t[f];if(p.patch&&p.patch.length>=3){let R=[...p.patch],S=s[f].belowY??r;if(m(()=>{if(l&&u)To(e,l,u,R,p.y,o.tread);else{let F=R[0];for(let B=1;B+1<R.length;B++){let N=R[B],H=R[B+1];e.tri([F.x*L,p.y,F.y*L],[N.x*L,p.y,N.y*L],[H.x*L,p.y,H.y*L],c,o.tread)}}}),p.y>S+Io){let F=0,B=0;for(let N of R)F+=N.x,B+=N.y;F/=R.length,B/=R.length,d(()=>{for(let N=0;N<R.length;N++){let H=R[N],_=R[(N+1)%R.length],M=_.x-H.x,v=_.y-H.y,A=Math.hypot(M,v);if(A<1e-6)continue;let C=v/A,O=-M/A;(H.x-F)*C+(H.y-B)*O<0&&(C=-C,O=-O);let P=[C,0,O],D=[H.x*L,p.y,H.y*L],I=[_.x*L,p.y,_.y*L],z=[H.x*L,S,H.y*L],E=[_.x*L,S,_.y*L];e.tri(D,I,E,P,o.riser),e.tri(D,E,z,P,o.riser)}})}continue}let h=ko(t,f,s,n);if(!h)continue;let{pts:b,nrm:y,front:g,back:x}=h,w=s[f].belowY??r;for(let R=0;R+1<b.length;R++){let S=b[R],F=b[R+1],B=y[R],N=y[R+1];if(Math.hypot(F.x-S.x,F.y-S.y)<1e-6||B[0]===0&&B[1]===0||N[0]===0&&N[1]===0)continue;let H=[(S.x-B[0]*g)*L,p.y,(S.y-B[1]*g)*L],_=[(F.x-N[0]*g)*L,p.y,(F.y-N[1]*g)*L],M=[(S.x+B[0]*x)*L,p.y,(S.y+B[1]*x)*L],v=[(F.x+N[0]*x)*L,p.y,(F.y+N[1]*x)*L];if(m(()=>{l&&u?To(e,l,u,[{x:S.x-B[0]*g,y:S.y-B[1]*g},{x:F.x-N[0]*g,y:F.y-N[1]*g},{x:F.x+N[0]*x,y:F.y+N[1]*x},{x:S.x+B[0]*x,y:S.y+B[1]*x}],p.y,o.tread):(e.tri(H,_,v,c,o.tread),e.tri(H,v,M,c,o.tread))}),p.y>w+Io){let A=[H[0],w,H[2]],C=[_[0],w,_[2]],O=[-B[0],0,-B[1]];d(()=>{e.tri(H,_,C,O,o.riser),e.tri(H,C,A,O,o.riser)})}}}}function Vo(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function jt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Tn=et(require("polygon-clipping"),1);function Fa(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function zo(e,t){return e.filter(n=>n.type!=="shape"||Fa(n,t))}function Go(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:zo(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:zo(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Da={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function st(e){return Vo(e)??Da}function Ho(e,t){let n=Vt(e.outline,ye),r=st(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(r,st(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=Tn.default.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,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Uo(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=Tn.default.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:e}var ka=.05,jo=.05,La=.15,Fn=25;function Xo(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=[],u=new Set;for(let d=0;d<e.length;d+=1){let m=e[d];for(let f of m.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=Vt(f.outline,ye);c.set(f.id,{section:f,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:f.id,floorIndex:d,box:st(p),section:f,unit:m,outline:p})}}for(let d=0;d<t.length;d++){let m=t[d];for(let f of l){if(n&&f.floorIndex!==n[d]||m.x<f.box.minX||m.x>f.box.maxX||m.y<f.box.minY||m.y>f.box.maxY||!Co({x:m.x,y:m.y},f.outline,f.section.holes))continue;o[d]=f.id;let p=c.get(f.id);p.hasSeats=!0;let h=m.focalPoint??f.unit.focal,b=Math.hypot(m.x-h.x,m.y-h.y);b<p.frontU&&(p.frontU=b),p.seatIndices.push(d);let y=m.rowId||`__seat-${d}`,g=p.rows.get(y);g?g.push({x:m.x,y:m.y}):p.rows.set(y,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let f=co(m.section,{floorBaseHeightM:m.unit.baseHeightM}),p=m.unit.baseHeightM,h=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=p+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&f.rake>.01?!1:b,x=m.hasSeats?wo(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},R=x.rows.length<2?Ro([...m.rows.values()].map(P=>({points:P})),m.unit.focal):null,S=1/0;if(R){if(m.hasSeats)for(let P of m.rows.values())for(let D of P){let I=R.depthAt(D.x,D.y);I<S&&(S=I)}if(!m.hasSeats||!Number.isFinite(S)){S=1/0;for(let P of m.section.outline){let D=R.depthAt(P.x,P.y);D<S&&(S=D)}}}let F=p+ka,B=Math.max(F,f.height),N=P=>{let D=Math.max(0,P-S)*we,I=Math.min(D*h,Fn);return Math.max(F,f.height+I)},H=P=>{let D=Math.max(0,P)*we,I=Math.min(D*h,Fn);return Math.max(F,f.height+I)},_=g?[]:x.rows.map(P=>({pts:P.pts,y:H(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...u.has(P.id)?{patch:Do(P.pts,ye)}:{}})),M=_.length?_[0].y:B,v=_.map(P=>{let D=P.patch&&P.patch.length>=3?P.patch:P.pts,I=0,z=0;for(let G of D)I+=G.x,z+=G.y;let E=D.length||1;I/=E,z/=E;let k=0;for(let G of D){let X=Math.hypot(G.x-I,G.y-z);X>k&&(k=X)}return{cx:I,cy:z,rad:k}}),A=g?()=>B:_.length>=2?(P,D)=>{let I=1/0,z=M;for(let E=0;E<_.length;E++){let k=v[E];if(Math.hypot(P-k.cx,D-k.cy)-k.rad>=I)continue;let G=_[E].patch,X=G&&G.length>=3?gt(G,P,D)?0:it(G,P,D):it(_[E].pts,P,D);X<I&&(I=X,z=_[E].y)}return z}:(P,D)=>R?N(R.depthAt(P,D)):B,C=[0,1,0],O=_.length>=2||g?()=>C:(P,D)=>{if(!R)return C;let I=R.depthAt(P,D);if(I<=S)return C;let z=(I-S)*we;if(z*h>=Fn||f.height+z*h<=F)return C;let[E,k]=R.gradientAt(P,D);if(E===0&&k===0)return C;let G=1/Math.hypot(h,1);return[-E*h*G,G,-k*h*G]};if(!g)for(let P of x.rows){let D=H(P.blockDepth);for(let I of P.seatIndices)a[I]=D}for(let P of x.rows){let D=[];for(let G=1;G<P.pts.length;G++){let X=Math.hypot(P.pts[G].x-P.pts[G-1].x,P.pts[G].y-P.pts[G-1].y);X>1e-6&&D.push(X)}D.sort((G,X)=>G-X);let I=D.length?D[Math.floor(D.length/2)]:1/0,z=1/0,E=P.pts[Math.floor(P.pts.length/2)];if(E)for(let G of x.rows){if(G===P||G.blockId!==P.blockId)continue;let X=it(G.pts,E.x,E.y);X>1e-6&&X<z&&(z=X)}let k=Math.min(I,Math.max(z,I*.5));if(Number.isFinite(k)&&k>0)for(let G of P.seatIndices)s[G]=k}r.set(d,{sectionId:d,deckAt:A,normalAt:O,flat:g,bottomY:p,rowLevels:_,landingY:M})}for(let d=0;d<t.length;d++){let m=o[d],f=t[d];if(m){let h=a[d];i[d]=(h??r.get(m).deckAt(f.x,f.y))+La;continue}let p=f.eyeHeightM;i[d]=Number.isFinite(p)?Math.max(0,p-_t):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function De(e,t){if(!e)return t;let n=be(pt(e,.4),.62);return pe(t,n,.72)}function Yo(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,u=0;for(let[d,m]of a){let f=ee(n.get(d));f&&(s+=f[0]*m,c+=f[1]*m,l+=f[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Wo(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Ko=et(require("polygon-clipping"),1);function _a(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Xt=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=st(t),i=this.rings.filter((c,l)=>jt(o,this.boxes[l])&&_a(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ko.default.difference([r],...i).map(l=>l.map(u=>u.map(([d,m])=>[d,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,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Oa(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(d=>{let m=d.x-a,f=d.y-s;return{x:a+m*l-f*u,y:s+m*u+f*l}})}function St(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=Mt(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=zt(n,r,e.width/2,e.height/2)}return t?Oa(t,e.rotation):null}function wt(e){let t=e.role??"",r={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}}[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Ba=.08;function qo(e,t){let n=St(e),r=wt(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 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 t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+Ba);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Ne(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function $o(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 Pt(e,t,n){return[Ne(e[0],e[1],t),Ne(e[0],e[1],n),Ne(e[3],e[2],n),Ne(e[3],e[2],t)]}function Zo(e,t,n){return[Ne(e[0],e[3],t),Ne(e[1],e[2],t),Ne(e[1],e[2],n),Ne(e[0],e[3],n)]}function ke(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Dn=2.4,Na=.75,Va=.15;function Ct(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(([u,d])=>({x:t.x+u*a-d*s,y:t.y+u*s+d*a}))}function Qo(e,t,n,r,o){let i=Ct(t);i&&se(e,i,void 0,()=>n+Dn,n,De(r,o.boothTop),o.boothWall,ae)}function kn(e){if(e.shape==="round"){let u=e.radius;return u?zt(e.center.x,e.center.y,u,u,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(([u,d])=>({x:o.x+u*a-d*s,y:o.y+u*s+d*a}))}function Jo(e,t,n,r,o){let i=kn(t);i&&se(e,i,void 0,()=>n+Na,n,De(r,o.tableTop),o.tableWall,ae)}function er(e,t,n,r,o,i,a){let s=St(t);if(!s)return;let c=t.role==="stage",l=wt(t),u=n+r;if(c&&a){let h=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<h&&(h=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(h+b)/2*L,cz:(y+g)/2*L,y:u,halfX:Math.max((b-h)/2*L,.5),halfZ:Math.max((g-y)/2*L,.5)})}let d=ee(t.fill),m=c&&d?pe(o.stageTop,be(pt(d,.18),.9),.9):De(d,c?o.stageTop:o.decorTop),f=t.role==="screen"?d:null,p=c?d?pe(o.stageWall,be(d,.58),.82):o.stageWall:t.role==="screen"?f?pe(be(f,1.42),[.24,.46,.82],.08):[.24,.46,.82]:De(ee(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let h=$o(s);ke(e,Pt(h,0,.16),u,n,m,p),ke(e,Pt(h,.84,1),u,n,m,p),ke(e,h,u,Math.max(n,u-.35),m,p);return}if(l.kind==="suite"&&s.length===4){let h=s.map((g,x)=>{let w=s[(x+1)%4],R=(g.x+w.x)/2,S=(g.y+w.y)/2;return Math.hypot(R-i.x,S-i.y)}),b=h.indexOf(Math.min(...h)),y=[0,1,2,3].map(g=>s[(b+g)%4]);ke(e,Pt(y,0,.08),u,n,m,p),ke(e,Pt(y,.92,1),u,n,m,p),ke(e,Zo(y,.88,1),u,n,m,p),ke(e,y,u,Math.max(n,u-.18),m,p);return}ke(e,s,u,n,m,p)}function Ln(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),u=r/2,d=o/2;return[[-u,-d],[u,-d],[u,d],[-u,d]].map(([m,f])=>({x:i+m*c-f*l,y:a+m*l+f*c}))}function za(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 ee(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=ee(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 tr(e,t,n,r){if(t.layer==="foreground")return;let o=Ln(t);if(!o)return;let i=n+Va,a=De(za(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=pe(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,pe(a,r.decorWall,.5),ae)}function nr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=De(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var Ga=Math.PI/180,Q=96,Ha=6,Ua=60,ja=150,or=.2,Xa=.35;function Ya(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Ga;return n<0?n+360:n}function Yt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Wt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function rr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let f of m.rows){for(let p of f.pts)o+=p.x,i+=p.y,a++;if(f.pts.length>=4){let p=An(f.pts);p&&Number.isFinite(p.cx)&&Number.isFinite(p.cy)&&r.push({x:p.cx,y:p.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=Yt(r.map(y=>y.x)),f=Yt(r.map(y=>y.y)),p=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let w=Math.hypot(x.x-s.x,x.y-s.y);w>p&&(p=w)}let h=0,b=p*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-f)<b&&h++;Math.hypot(m-s.x,f-s.y)<=p&&h/a<.01&&(c={x:m,y:f})}let l=[];for(let m of n){let f={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let p of m.rows)for(let h of p.pts){let b=Math.hypot(h.x-c.x,h.y-c.y),y=Math.min(Q-1,Math.floor(Ya(c,h)/(360/Q)));f.samples.push({r:b,bin:y,levelM:p.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((m,f)=>m.rMin+m.rMax-(f.rMin+f.rMax));let u=[];for(let m of l){let f=!1;for(let p of u){let h=Math.min(m.rMax,p.rMax)-Math.max(m.rMin,p.rMin),b=Math.min(m.rMax-m.rMin,p.rMax-p.rMin);if(b>1e-9&&h>=Xa*b){p.members.push(m),p.rMin=Math.min(p.rMin,m.rMin),p.rMax=Math.max(p.rMax,m.rMax),f=!0;break}}f||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let f=new Array(Q).fill(null);for(let v of m.members)for(let A of v.samples){let C=f[A.bin];C||(C={samples:[]},f[A.bin]=C),C.samples.push({r:A.r,levelM:A.levelM})}let p=f.map(v=>!!v);if(!p.filter(Boolean).length)continue;let b=[],y=[];for(let v of f){if(!v)continue;let A=1/0,C=-1/0;for(let O of v.samples)O.r<A&&(A=O.r),O.r>C&&(C=O.r);b.push(A),y.push(C)}let g=Yt(b),x=Yt(y);if(!(g>=or*x)||!(x>0))continue;let w=[...b].sort((v,A)=>v-A);if(!(w[Math.floor(w.length*.1)]>=or*x))continue;let S=f.map(v=>{if(!v)return null;let A=[...v.samples].sort((k,G)=>k.r-G.r),C=A[0].r,O=A[A.length-1].r,P=A[0].levelM,D=-1/0;for(let k of A)k.levelM>D&&(D=k.levelM);let I=[];for(let k of A){let G={r:k.r,l:k.levelM};for(;I.length&&Math.abs(I[I.length-1].r-G.r)<1e-9;){if(I[I.length-1].l<=G.l){G.skip=!0;break}I.pop()}if(!G.skip){for(;I.length>=2;){let X=I[I.length-2],V=I[I.length-1];if((V.r-X.r)*(G.l-X.l)-(V.l-X.l)*(G.r-X.r)<=0)I.pop();else break}I.push(G)}}let z=I.map(k=>k.r),E=I.map(k=>k.l);return{inner:C,outer:O,front:P,top:D,profile:{rs:z,ls:E}}}),F=p.slice();for(let v=0;v<Q;v++){if(F[v])continue;let A=-1,C=-1,O=0;for(let T=1;T<=Q;T++){let Y=(v-T+Q*2)%Q;if(F[Y]){A=Y;break}}for(let T=1;T<=Q;T++){let Y=(v+T)%Q;if(F[Y]){C=Y,O=T;break}}if(A<0||C<0)continue;let P=0;for(let T=1;T<=Q;T++){let Y=(v-T+Q*2)%Q;if(p[Y]){P=T;break}}if(P-1+O>Ha)continue;let I=S[A],z=S[C],E=P/(P+O),k=I.inner+(z.inner-I.inner)*E,G=I.outer+(z.outer-I.outer)*E,X=I.front+(z.front-I.front)*E,V=I.top+(z.top-I.top)*E;S[v]={inner:k,outer:G,front:X,top:V,profile:{rs:[k,G],ls:[X,V]}}}for(let v=0;v<Q;v++)S[v]&&(F[v]=!0);let B=360/Q,N=[],H=F.filter(Boolean).length,_=[];if(H===Q)_.push({start:0,len:Q});else{let v=0;for(;F[v];)v=(v+1)%Q;let A=-1;for(let C=0;C<=Q;C++){let O=(v+C)%Q,P=C<Q&&F[O];if(P&&A<0)A=O;else if(!P&&A>=0){let D=(O-A+Q)%Q||Q;_.push({start:A,len:D}),A=-1}}}for(let v of _){if(v.len*B<Ua&&v.len<Q)continue;let A=v.len===Q,C=new Float64Array(v.len),O=new Float64Array(v.len),P=new Float64Array(v.len),D=new Float64Array(v.len),I=[];for(let T=0;T<v.len;T++){let Y=S[(v.start+T)%Q];C[T]=Y.inner,O[T]=Y.outer,P[T]=Y.front,D[T]=Y.top,I.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let z=Wt(C,A),E=Wt(O,A),k=Wt(P,A),G=Wt(D,A);for(let T=0;T<v.len;T++)z[T]>C[T]&&(z[T]=C[T]),E[T]<O[T]&&(E[T]=O[T]),z[T]>E[T]-1e-6&&(z[T]=Math.max(0,E[T]-1e-6)),G[T]<k[T]&&(G[T]=k[T]);let X={startBin:v.start,binCount:v.len,closed:A,innerR:z,outerR:E,frontLevelM:k,topLevelM:G,profiles:I},V=(T,Y,K)=>{let J=I[T],Z=J.rs,$=J.ls;if(Y<=Z[0]){$[0]>K&&($[0]=K);return}if(Y>=Z[Z.length-1]){$[$.length-1]>K&&($[$.length-1]=K);return}for(let te=0;te+1<Z.length;te++)if(Y<=Z[te+1]){$[te]>K&&($[te]=K),$[te+1]>K&&($[te+1]=K);return}};for(let T=0;T<v.len;T++){let Y=f[(v.start+T)%Q];if(Y)for(let K of Y.samples){V(T,K.r,K.levelM);let J=A?(T-1+v.len)%v.len:T-1,Z=A?(T+1)%v.len:T+1;J>=0&&V(J,K.r,K.levelM),Z<v.len&&V(Z,K.r,K.levelM)}}N.push(X)}N.reduce((v,A)=>v+A.binCount*B,0)<ja||d.push({arcs:N,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,f)=>m.innerRMedian-f.innerRMedian),t){let m=d[d.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:Q,binStepDeg:360/Q,rings:d}}function ir(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let d=t.profiles[u],m=d.rs,f=d.ls;if(r<=m[0])return f[0];if(r>=m[m.length-1])return f[f.length-1];for(let p=0;p+1<m.length;p++)if(r<=m[p+1]){let h=m[p+1]-m[p],b=h>1e-9?(r-m[p])/h:0;return f[p]+(f[p+1]-f[p])*b}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Wa=.25,Ka=1.2,qa=.6,$a=.45,Za=2.3,Qa=Math.PI/180;function Ze(e,t,n){let r=n*Qa;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Ja(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 es=24;function ts(e,t,n,r,o,i,a,s){let c=n.binCount,l=es,u=we,d=i+.02,m=[];for(let M=0;M<c;M++){let v=(n.startBin+M+.5)*t.binStepDeg,A=new Float64Array(l+1);for(let C=0;C<=l;C++){let O=r[M]+(o[M]-r[M])*C/l;A[C]=Math.max(d,ir(t,n,v,O)-Wa)}m.push(A)}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],p=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(M,v)=>{let A=(n.startBin+M+.5)*t.binStepDeg,C=r[M]+(o[M]-r[M])*v/l,O=Ze(t.centre,C,A);return[O.x*u,m[M][v],O.y*u]};{let M=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let A=!1;for(let O=0;O<c;O++)for(let P=l-1;P>=0;P--)m[O][P]>m[O][P+1]&&(m[O][P]=m[O][P+1],A=!0);let C=n.closed?c:c-1;for(let O=0;O<C;O++){let P=(O+1)%c;for(let D=0;D<=l;D++){let I=m[P][D]-m[O][D];if(Math.abs(I)>1)continue;let z=r[O]+(o[O]-r[O])*D/l,E=r[P]+(o[P]-r[P])*D/l,k=Ze(t.centre,z,(n.startBin+O+.5)*t.binStepDeg),G=Ze(t.centre,E,(n.startBin+P+.5)*t.binStepDeg),X=M*Math.hypot(G.x-k.x,G.y-k.y)*u;I>X?(m[P][D]=m[O][D]+X,A=!0):-I>X&&(m[O][D]=m[P][D]+X,A=!0)}}if(!A)break}}let g=1,x=(M,v)=>{for(let A=0;A<=l;A+=4)if(Math.abs(m[M][A]-m[v][A])>g)return!0;return Math.abs(m[M][l]-m[v][l])>g},w=Math.tan(38*Math.PI/180),R=M=>(o[M]-r[M])/l*u,S=(M,v)=>m[M][v+1]-m[M][v]>w*Math.max(1e-6,R(M)),F=(M,v)=>{let A=n.closed?(M-1+c)%c:Math.max(0,M-1),C=n.closed?(M+1)%c:Math.min(c-1,M+1);Math.abs(m[A][v]-m[M][v])>g&&(A=M),Math.abs(m[C][v]-m[M][v])>g&&(C=M);let O=Math.max(0,v-1),P=Math.min(l,v+1);O<v&&S(M,O)&&(O=v),P>v&&S(M,v)&&(P=v);let D=y(A,v),I=y(C,v),z=y(M,O),E=y(M,P),k=I[0]-D[0],G=I[1]-D[1],X=I[2]-D[2],V=E[0]-z[0],T=E[1]-z[1],Y=E[2]-z[2],K=G*Y-X*T,J=X*V-k*Y,Z=k*T-G*V,$=Math.hypot(K,J,Z);return $>1e-12?(K/=$,J/=$,Z/=$,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},B=(M,v)=>{let A=[M[0],i,M[2]],C=[v[0],i,v[2]],O=v[0]-M[0],P=v[2]-M[2],D=Math.hypot(O,P);if(!(D>1e-12))return;let I=[P/D,0,-O/D];e.tri(M,v,C,I,h,h,b),e.tri(M,C,A,I,h,b,b)},N=.05*Be,H=M=>o[M]-r[M]<N,_=n.closed?c:c-1;for(let M=0;M<_;M++){let v=(M+1)%c;if(H(M)||H(v))continue;if(x(M,v)){let I=(n.startBin+M+1)*t.binStepDeg,z=(T,Y)=>{let K=(r[M]+r[v])/2,J=(o[M]+o[v])/2,Z=K+(J-K)*Y/l,$=Ze(t.centre,Z,I);return[$.x*u,m[T][Y],$.y*u]};for(let T=0;T<l;T++){let Y=y(M,T),K=y(M,T+1),J=z(M,T),Z=z(M,T+1),$=F(M,T),te=F(M,T+1);e.triN(Y,J,Z,$,$,te,f),e.triN(Y,Z,K,$,te,te,f);let Ue=y(v,T),je=y(v,T+1),Re=z(v,T),Ie=z(v,T+1),Ee=F(v,T),xe=F(v,T+1);e.triN(Re,Ue,je,Ee,Ee,xe,f),e.triN(Re,je,Ie,Ee,xe,xe,f);let ve=z(M,T),ie=z(M,T+1),Je=z(v,T+1),Le=z(v,T),Te=ie[0]-ve[0],Xe=ie[2]-ve[2],dt=Math.hypot(Te,Xe);if(dt>1e-12){let me=[Xe/dt,0,-Te/dt];e.tri(ve,ie,Je,me,h),e.tri(ve,Je,Le,me,h)}}let E=y(M,0),k=y(v,0),G=y(v,l),X=y(M,l),V=T=>[T[0],i,T[2]];e.tri(V(E),V(G),V(k),[0,-1,0],p),e.tri(V(E),V(X),V(G),[0,-1,0],p),B(E,k),B(X,G);continue}for(let I=0;I<l;I++){let z=F(M,I),E=F(v,I),k=F(v,I+1),G=F(M,I+1);if(S(M,I)||S(v,I)){let K=(ie,Je)=>{let Le=(n.startBin+ie+.5)*t.binStepDeg,Te=r[ie]+(o[ie]-r[ie])*(I+.5)/l,Xe=Ze(t.centre,Te,Le);return[Xe.x*u,Je,Xe.y*u]},J=y(M,I),Z=y(v,I),$=K(M,m[M][I]),te=K(v,m[v][I]);e.triN(J,Z,te,z,E,E,f),e.triN(J,te,$,z,E,z,f);let Ue=y(v,I+1),je=y(M,I+1),Re=K(M,m[M][I+1]),Ie=K(v,m[v][I+1]);e.triN(Re,Ie,Ue,G,k,k,f),e.triN(Re,Ue,je,G,k,G,f);let Ee=te[0]-$[0],xe=te[2]-$[2],ve=Math.hypot(Ee,xe);if(ve>1e-12){let ie=[-xe/ve,0,Ee/ve];e.tri($,te,Ie,ie,h),e.tri($,Ie,Re,ie,h)}continue}let X=y(M,I),V=y(v,I),T=y(v,I+1),Y=y(M,I+1);e.triN(X,V,T,z,E,k,f),e.triN(X,T,Y,z,k,G,f)}let A=y(M,0),C=y(v,0),O=y(v,l),P=y(M,l),D=I=>[I[0],i,I[2]];e.tri(D(A),D(O),D(C),[0,-1,0],p),e.tri(D(A),D(P),D(O),[0,-1,0],p),B(A,C),B(P,O)}if(!n.closed)for(let M of[0,c-1])for(let v=0;v<l;v++)B(y(M,v),y(M,v+1))}function ar(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let d of u.arcs){let m=new Float64Array(d.binCount),f=new Float64Array(d.binCount);for(let h=0;h<d.binCount;h++){let b=(d.startBin+h)%t.binCount,y=Math.max(0,d.innerR[h]-ye);m[h]=Math.max(y,a[b]+.001),f[h]=Math.max(m[h]+.001,d.outerR[h]+ye)}let p=0;for(let h=0;h<d.binCount;h++){let b=d.topLevelM[h]-r;b>p&&(p=b)}p>=Ka&&ts(e,t,d,m,f,r,o,i);for(let h=0;h<d.binCount;h++){let b=(d.startBin+h)%t.binCount;f[h]>a[b]&&(a[b]=f[h])}}if(Ja(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=qa*Be,l=$a*Be;for(let u of s.arcs){let d=[],m=[];for(let h=0;h<u.binCount;h++){let b=(u.startBin+h+.5)*t.binStepDeg,y=u.outerR[h]+ye+c;d.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let f=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>f&&(f=u.topLevelM[h]);let p=()=>f+Za;u.closed?se(e,m,[d.slice().reverse()],p,r,o.shellTop,o.shellWall,i):se(e,[...m,...d.slice().reverse()],void 0,p,r,o.shellTop,o.shellWall,i)}}function sr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=De(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=Ho(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Ut(o.rowLevels),y=Uo(Oo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let w of y){let R=Math.max(c,w.topY-.02);for(let S of i.subtract(w.outline,R))se(e,S,w.holes,()=>R,c,l,s.tierWall,ae,void 0,g)}y.length||se(e,m,t.holes,()=>o.landingY,c,l,s.tierWall,ae);let x={tread:[l[0]*ae.top,l[1]*ae.top,l[2]*ae.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let w of d.length?d:[m])No(e,o.rowLevels,n.focal,o.landingY,x,w,b);return}let f=o.flat?1/0:jo,p=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(m,h))se(e,b,t.holes,u,c,l,s.tierWall,ae,f,p)}function ns(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],u=o.get(s);u||(u=new Map,o.set(s,u));let d=l.rowId||`__seat-${a}`,m=u.get(d);m||(m={pts:[],levelM:0,n:0},u.set(d,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(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 cr(e,t,n,r,o){let i=ns(t,n,r);if(!i.length)return;let a=rr(i,t.focal);a&&(e.setMaterial(0),ar(e,a,{bottomY:t.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function lr(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 ur(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 os=1.15,rs=3.25,is=4.5,as=.85,ss=.5,cs=.26;function dr(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>=os&&a.add("zone"),o<=(i?rs:is)&&(a.add("section"),a.add("ga")),o<=as&&(a.add("annotation"),a.add("booth")),o<=ss&&a.add("row"),o<=cs&&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],u=o[2]*i+o[6]*a+o[10]*s+o[14],d=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(d>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/d,f=l/d,p=u/d,h=m>=-1.05&&m<=1.05&&f>=-1.05&&f<=1.05&&p<=1;return{x:(m*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:p,visible:h}}function mr(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){let c=Math.abs(i.screen.x-s.screen.x),l=Math.abs(i.screen.y-s.screen.y);if(c<t&&l<n){a=!0;break}}a||r.push(i)}return r}var fr={row:8,seat:14};function pr(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 hr(e,t,n,r){let o=[...e].sort((a,s)=>(s.priority??0)-(a.priority??0)||a.focus-s.focus),i=[];for(let a of o){if(i.length>=r)break;let s=!1;for(let c of i)if(Math.abs(a.screen.x-c.screen.x)<t&&Math.abs(a.screen.y-c.screen.y)<n){s=!0;break}s||i.push(a)}return i}var ls=6,us=2.2,br=.1,ds=.3,ms=1.8,fs=.9,ps=.55,hs=6e3;function yr(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 u of n)for(let d of u.objects)d.type==="section"&&d.zone&&c.set(d.id,d.zone);let l=new Map;for(let u=0;u<r.length;u++){let d=r[u],m=o.seatOwner[u],f=d.zoneId??(m?c.get(m):void 0);if(!f)continue;let p=l.get(f);p||(p={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,p)),p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y),p.sumY+=o.seatDeckY(u)}for(let u of a){let d=l.get(u.id),m=[];for(let[f,p]of c)p===u.id&&m.push(f);if(!d||d.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*L,1.5,(u.focalPoint??i).y*L]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:d.n,center:[(d.minX+d.maxX)/2*L,d.sumY/d.n,(d.minY+d.maxY)/2*L],radius:.5*Math.hypot((d.maxX-d.minX)*L,(d.maxY-d.minY)*L)||1,focalWorld:[(u.focalPoint??i).x*L,1.5,(u.focalPoint??i).y*L]})}}return s}function gr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],d=[];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]+ls,m.center[2]],color:t.zones?.find(f=>f.id===m.id)?.color});{let m=new Map,f=new Map;for(let p=0;p<r.length;p++){let h=o.seatOwner[p];if(!h)continue;let b=m.get(h);b||(b={n:0,x:0,y:0,deck:0},m.set(h,b)),b.n++,b.x+=r[p].x,b.y+=r[p].y,b.deck+=o.seatDeckY(p);let y=f.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(h,y)),r[p].x<y.minX&&(y.minX=r[p].x),r[p].x>y.maxX&&(y.maxX=r[p].x),r[p].y<y.minY&&(y.minY=r[p].y),r[p].y>y.maxY&&(y.maxY=r[p].y)}for(let p of n)for(let h of p.objects){if(h.type!=="section")continue;let b=m.get(h.id);if(!b||b.n===0)continue;let y=f.get(h.id),g=[b.x/b.n*L,b.deck/b.n,b.y/b.n*L],x=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:p.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*L),focalWorld:[p.focal.x*L,p.baseHeightM+1.5,p.focal.y*L]});let w=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+us,g[2]],floorIndex:p.index})}}{for(let p of n)for(let h of p.objects){if(h.type!=="gaArea")continue;let b=yt(h.points);if(!b)continue;let y=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${y} \xB7 ${h.capacity.toLocaleString()}`:y,anchor:[b.x*L,p.baseHeightM+ms,b.y*L],floorIndex:p.index})}let m=new Map;for(let p=0;p<r.length;p++){let h=r[p],b=Math.hypot(h.x-c.x,h.y-c.y),y=m.get(h.rowId);(!y||b>y.far)&&m.set(h.rowId,{seat:h,index:p,far:b})}for(let[p,h]of m){let b=h.seat.label?h.seat.label.lastIndexOf("-"):-1,y=b>0?h.seat.label.slice(0,b):p;y&&l.push({id:`row:${p}`,kind:"row",text:y,anchor:[h.seat.x*L,o.seatDeckY(h.index)+fs,h.seat.y*L],floorIndex:a[h.index]})}let f=new Map;for(let p=0;p<r.length;p++){let h=r[p],b=h.label?h.label.lastIndexOf("-"):-1,y=f.get(h.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?h.label.slice(0,b):h.rowId,sectionId:h.sectionId},f.set(h.rowId,y));let g=p*3,x=i.iPosition[g],w=i.iPosition[g+1],R=i.iPosition[g+2];y.n++,y.x+=x,y.y+=w,y.z+=R,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,R),y.maxZ=Math.max(y.maxZ,R)}for(let[p,h]of f)d.push({id:p,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=hs)for(let p=0;p<r.length;p++){let h=r[p],b=h.displayLabel||h.label;b&&l.push({id:`seat:${h.id}`,kind:"seat",text:b,anchor:[h.x*L,o.seatDeckY(p)+ps,h.y*L],floorIndex:a[p]})}}for(let m of n)for(let f of m.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let p=St(f),h=p?yt(p):null;if(!h||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[h.x*L,m.baseHeightM+wt(f).heightM+br,h.y*L],color:f.fill,floorIndex:m.index})}else if(f.type==="text"){if(!f.text)continue;l.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*L,m.baseHeightM+br,f.position.y*L],color:f.color,rotation:f.rotation,floorIndex:m.index})}else if(f.type==="booth"){let p=Ct(f);if(!p)continue;let h=yt(p);if(!h)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[h.x*L,m.baseHeightM+Dn+ds,h.y*L],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function xr(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 vr(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 f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),p=m*3,h=l[f];h.minX=Math.min(h.minX,i.position[p]),h.minY=Math.min(h.minY,i.position[p+1]),h.minZ=Math.min(h.minZ,i.position[p+2]),h.maxX=Math.max(h.maxX,i.position[p]),h.maxY=Math.max(h.maxY,i.position[p+1]),h.maxZ=Math.max(h.maxZ,i.position[p+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let f of n[m].objects)f.type==="section"&&u.set(f.id,m);let d=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 f=o.seatOwner[m],p=(f!==null?u.get(f):void 0)??a[m];if(p===void 0)continue;let h=d[p],b=r[m];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let y=o.seatDeckY(m);h.sumX+=b.x*L,h.sumDeck+=y,h.sumZ+=b.y*L,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),s[m]=p}for(let m=0;m<n.length;m++){let f=d[m],p=t.floors?.[m],h=l[m],b=Math.min(f.n?f.minX*L:n[m].focal.x*L-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(f.n?f.maxX*L:n[m].focal.x*L+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(f.n?f.minY*L:n[m].focal.y*L-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(f.n?f.maxY*L:n[m].focal.y*L+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),w=Math.min(f.n?Math.min(n[m].baseHeightM,f.minDeck):n[m].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(f.n?Math.max(f.maxDeck,w+.5):w+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[f.n?f.sumX/f.n:(b+y)/2,f.n?f.sumDeck/f.n:(w+R)/2,f.n?f.sumZ/f.n:(g+x)/2],F=Math.max(1,.5*Math.hypot(y-b,R-w,x-g));c.push({index:m,id:p?.id??`floor-${m}`,label:p?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:f.n,center:S,radius:F,box:{min:[b,w,g],max:[y,R,x]},focalWorld:[n[m].focal.x*L,n[m].baseHeightM+1.5,n[m].focal.y*L]})}}return c}function _n(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=Ct(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=kn(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Ln(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 Mr(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=Mt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((f,p)=>p.baseHeightM<f.baseHeightM?p:f);e.setFloor(a.index);let s=n.filter((f,p)=>r[p]===a.index),c=_n([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),d=Mt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;se(e,d,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function Sr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0,m=(h,b,y)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),d=Math.max(d,y)};for(let h=0;h<e.position.length;h+=3)m(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let b=h*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],w=Math.max(.35,t.iMaxRadius[h]??.35);m(y-w,g,x-w),m(y+w,g+1.6,x+w)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let f=[(a+l)/2,(s+u)/2,(c+d)/2],p=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:f,radius:p,minY:s,maxY:u}}function wr(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 R=w*3,S=e.iPosition[R],F=e.iPosition[R+2];S<a&&(a=S),S>c&&(c=S),F<s&&(s=F),F>l&&(l=F)}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 u=n.minX*L,d=n.maxX*L,m=n.minY*L,f=n.maxY*L,p=u,h=d,b=m,y=f;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(c-a,l-s));p=Math.max(u,a-w),h=Math.min(d,c+w),b=Math.max(m,s-w),y=Math.min(f,l+w)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[p,g,b],max:[h,x,y]}}function ct(e){let{doc:t}=e,n=xo(t.theme),r=n.structure,o=Go(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Nt,s=new Map;for(let M of o)for(let v of M.objects)s.set(v.id,M.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,M.index);let c=i.map(M=>s.get(M.sectionId??"")??s.get(M.rowId??"")??0),l=_n(o,i);Mr(a,o,i,c,l,r);let u=Yo(t,i),d=new Map;for(let M of t.categories??[])d.set(M.key,M.color);let m=[],f=Xo(o,i,c),p=new Float32Array(i.length);for(let M=0;M<o.length;M++){let v=o[M];a.setFloor(M);let A=new Xt,C=[],O=v.objects.filter(P=>P.type==="section"&&!!P.outline&&P.outline.length>=3);for(let P of v.objects)P.type==="section"?sr(a,P,v,Wo(P,u),f.bySection.get(P.id),A,O,r):P.type==="shape"?(a.setMaterial(P.role==="screen"?1:0),er(a,P,v.baseHeightM,qo(P,C),r,v.focal,m),a.setMaterial(0)):P.type==="gaArea"?nr(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="booth"?Qo(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="table"?Jo(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="decorImage"&&tr(a,P,v.baseHeightM,r);cr(a,v,i,f,r)}let h=o.length>1?{x:o.reduce((M,v)=>M+v.focal.x,0)/o.length,y:o.reduce((M,v)=>M+v.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=fo([a.build()]),y=go(i,e.initialState,f,p,d),g=yr({doc:t,units:o,seats:i,surfaces:f,focal:h}),{labels:x,sections:w,rows:R}=gr({doc:t,units:o,seats:i,surfaces:f,seatData:y,hintedSeatFloor:c,zones:g,focal:h}),S=vr({doc:t,units:o,seats:i,surfaces:f,solids:b,hintedSeatFloor:c,seatFloor:p});xr(x,S),y.iYaw=bo(y.iPosition,i.length,M=>i[M].rowId,M=>{let v=o[p[M]]?.focal??h;return[v.x*L,v.y*L]});let F=(l.minX+l.maxX)/2*L,B=(l.minY+l.maxY)/2*L,N=.5*Math.hypot((l.maxX-l.minX)*L,(l.maxY-l.minY)*L)||10,H=Sr(b,y,{cx:F,cz:B,radius:N}),_=wr(y,m,l,H.minY,H.maxY,N);return{solids:b,seats:y,bounds:{center:[(_.min[0]+_.max[0])/2,(_.min[1]+_.max[1])/2,(_.min[2]+_.max[2])/2],radius:N,groundY:0,box:_},renderBounds:{center:H.center,radius:H.radius},stateColorLUT:vo(n,ge),theme:n,seatCount:i.length,focalWorld:[h.x*L,1.5,h.y*L],zones:g,stages:m,sections:w,rows:R,labels:x,floors:S}}var bs=88,ys=20,gs={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}},On=new Set(["row","seat"]),Pr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Cr={row:{x:62,y:16},seat:{x:46,y:18}},Rr=ee,Bn=e=>Wn(e);function Ir(e,t){let n=Bn(e),r=Bn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ar(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 xs(e,t=[.04,.06,.1]){let n=Bn(t)<.42,r=n?"#f4f7fb":"#0b1220",o=Rr(e),i=o&&Ir(o,t)>=4.5?e:r;return n?{ink:i,backing:"rgba(8,12,22,.78)",border:"rgba(210,222,245,.24)"}:{ink:i,backing:"rgba(255,255,255,.84)",border:"rgba(11,18,32,.22)"}}var Kt=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=dr(o,i,{hasZoneLabels:this.labels.some(h=>h.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let h of this.labels){if(!s.has(h.kind))continue;let b=Ve(t,h.anchor,n,r);if(!b.visible)continue;let y=a?Math.hypot(h.anchor[0]-a[0],h.anchor[1]-a[1],h.anchor[2]-a[2]):1;c.push({label:h,screen:b,focus:pr(b,y,n,r),...this.selectedSeatLabelIds.has(h.id)?{priority:1}:{}})}let l=ur(c.filter(h=>h.label.kind==="floor"),n),u=[...c.filter(h=>!On.has(h.label.kind)&&h.label.kind!=="floor"),...l],d=[...mr(u,bs,ys),...["row","seat"].flatMap(h=>hr(c.filter(b=>b.label.kind===h),Cr[h].x,Cr[h].y,fr[h]))],m=new Set(d.map(h=>h.label.id));for(let{label:h,screen:b}of d){let g=this.nodeFor(h).style;g.display="",g.transform=`translate(-50%, -50%) translate(${b.x.toFixed(1)}px, ${b.y.toFixed(1)}px)`}let f=d.filter(({label:h})=>!On.has(h.kind)).sort((h,b)=>Pr[b.label.kind]-Pr[h.label.kind]||h.screen.depth-b.screen.depth||h.focus-b.focus),p=[];for(let{label:h}of f){let b=this.nodes.get(h.id);if(!b||b.style.display==="none")continue;let y=b.getBoundingClientRect();p.some(x=>y.left<x.right+3&&y.right+3>x.left&&y.top<x.bottom+3&&y.bottom+3>x.top)?b.style.display="none":p.push(y)}for(let[h,b]of this.nodes)m.has(h)||(b.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let d=n.style;d.position="absolute",d.left="0",d.top="0",d.whiteSpace="nowrap",d.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",d.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=gs[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=xs(t.color??this.opts.ink,this.opts.backgroundRgb),s=!On.has(t.kind);i.color=r?"#ecf8ff":a.ink,i.background=r?"rgba(10,28,45,.9)":s?a.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${a.border}`:"",i.borderRadius=r||s?"999px":"",i.padding=r||s?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"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=Rr(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Ar("rgba(10,28,45,.9)",c):s?Ar(a.backing,c):c;return n.dataset.qualityContrast=Ir(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Tr=1;var vs=new Set(["floor","zone","section","ga","booth","annotation"]);function Ms(e){return e.every(t=>Number.isFinite(t))}function Ss(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 Er(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Qe(e){return Math.round(e*1e4)/1e4}function ws(e){if(e)return{box:{x:Qe(e.box.x),y:Qe(e.box.y),width:Qe(e.box.width),height:Qe(e.box.height)},horizontalFillRatio:Qe(e.horizontalFillRatio),verticalFillRatio:Qe(e.verticalFillRatio),visibleAreaRatio:Qe(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Pe(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function qt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>vs.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)Ss(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=[Pe("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Pe("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Pe("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Pe("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}`}]),Pe("camera-invalid","The capture camera must have a finite physical pose",Ms(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Pe("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}]),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: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:ws(e.framing)},metrics:{minimumHierarchyFontPx:Er(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Er(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var he=require("ogl");var ze=require("ogl");var $t=`
|
|
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(${to.toFixed(1)}, ${no.toFixed(1)}, depth);
|
|
7
|
+
float farWeight = 1.0 - smoothstep(${Jn.toFixed(1)}, ${eo.toFixed(1)}, depth);
|
|
8
8
|
return nearWeight * farWeight;
|
|
9
|
-
}`,
|
|
9
|
+
}`,Ps=`#version 300 es
|
|
10
10
|
precision highp float;
|
|
11
11
|
in vec3 position;
|
|
12
12
|
in vec3 normal;
|
|
@@ -42,7 +42,7 @@ void main() {
|
|
|
42
42
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
43
43
|
vColor = color;
|
|
44
44
|
gl_Position = projectionMatrix * mv;
|
|
45
|
-
}`,
|
|
45
|
+
}`,Cs=`#version 300 es
|
|
46
46
|
precision highp float;
|
|
47
47
|
in vec3 vColor;
|
|
48
48
|
in vec3 vNormalWorld;
|
|
@@ -104,7 +104,7 @@ void main() {
|
|
|
104
104
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
105
105
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
106
106
|
fragColor = vec4(base, 1.0);
|
|
107
|
-
}`,
|
|
107
|
+
}`,As=`#version 300 es
|
|
108
108
|
precision highp float;
|
|
109
109
|
in vec2 position; // quad corner in [-1,1]
|
|
110
110
|
in vec3 iOffset; // per-instance world position
|
|
@@ -130,7 +130,7 @@ out float vDim;
|
|
|
130
130
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
131
131
|
out float vPhysicalSeat;
|
|
132
132
|
out float vPixelRadius;
|
|
133
|
-
${
|
|
133
|
+
${$t}
|
|
134
134
|
void main() {
|
|
135
135
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
136
136
|
float depth = max(-mv.z, 0.001);
|
|
@@ -163,7 +163,7 @@ void main() {
|
|
|
163
163
|
vPhysicalSeat = iPhysicalSeat;
|
|
164
164
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
165
165
|
gl_Position = projectionMatrix * mv;
|
|
166
|
-
}`,
|
|
166
|
+
}`,Rs=`#version 300 es
|
|
167
167
|
precision highp float;
|
|
168
168
|
in vec2 vUv;
|
|
169
169
|
in vec3 vColor;
|
|
@@ -221,7 +221,7 @@ void main() {
|
|
|
221
221
|
alpha *= vDotWeight;
|
|
222
222
|
if (alpha <= 0.0) discard;
|
|
223
223
|
fragColor = vec4(c, alpha);
|
|
224
|
-
}`,
|
|
224
|
+
}`,Is=`#version 300 es
|
|
225
225
|
precision highp float;
|
|
226
226
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
227
227
|
in vec3 normal;
|
|
@@ -251,8 +251,8 @@ out vec3 vRing;
|
|
|
251
251
|
out float vDim;
|
|
252
252
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
253
253
|
out vec3 vOccupantTint;
|
|
254
|
-
${
|
|
255
|
-
${
|
|
254
|
+
${$t}
|
|
255
|
+
${Fr}
|
|
256
256
|
void main() {
|
|
257
257
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
258
258
|
float viewDepth = -anchor.z;
|
|
@@ -335,7 +335,7 @@ void main() {
|
|
|
335
335
|
vRing = iRing;
|
|
336
336
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
337
337
|
gl_Position = projectionMatrix * mv;
|
|
338
|
-
}`,
|
|
338
|
+
}`,Es=`#version 300 es
|
|
339
339
|
precision highp float;
|
|
340
340
|
in vec3 vColor;
|
|
341
341
|
in vec3 vNormalWorld;
|
|
@@ -385,14 +385,14 @@ void main() {
|
|
|
385
385
|
// which is what stops a block of them merging into one mass up close.
|
|
386
386
|
base += vec3(0.26, 0.31, 0.38) * fres * 0.55;
|
|
387
387
|
fragColor = vec4(base, 1.0);
|
|
388
|
-
}`,
|
|
388
|
+
}`,Ts=`#version 300 es
|
|
389
389
|
precision highp float;
|
|
390
390
|
in vec2 position;
|
|
391
391
|
out vec2 vUv;
|
|
392
392
|
void main() {
|
|
393
393
|
vUv = position * 0.5 + 0.5;
|
|
394
394
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
395
|
-
}`,
|
|
395
|
+
}`,Fs=`#version 300 es
|
|
396
396
|
precision highp float;
|
|
397
397
|
in vec2 vUv;
|
|
398
398
|
uniform vec3 uTop;
|
|
@@ -403,7 +403,7 @@ void main() {
|
|
|
403
403
|
vec2 c = vUv - 0.5;
|
|
404
404
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
405
405
|
fragColor = vec4(col * vig, 1.0);
|
|
406
|
-
}`,
|
|
406
|
+
}`,Ds=`#version 300 es
|
|
407
407
|
precision highp float;
|
|
408
408
|
in vec2 position;
|
|
409
409
|
in vec3 iOffset;
|
|
@@ -424,7 +424,7 @@ out float vPhysicalSeat;
|
|
|
424
424
|
out float vDotWeight;
|
|
425
425
|
out float vHidden;
|
|
426
426
|
flat out vec3 vPick;
|
|
427
|
-
${
|
|
427
|
+
${$t}
|
|
428
428
|
void main() {
|
|
429
429
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
430
430
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -440,7 +440,7 @@ void main() {
|
|
|
440
440
|
vPhysicalSeat = iPhysicalSeat;
|
|
441
441
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
442
442
|
gl_Position = projectionMatrix * mv;
|
|
443
|
-
}`,
|
|
443
|
+
}`,ks=`#version 300 es
|
|
444
444
|
precision highp float;
|
|
445
445
|
in vec2 vUv;
|
|
446
446
|
in float vPhysicalSeat;
|
|
@@ -454,7 +454,7 @@ void main() {
|
|
|
454
454
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
455
455
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
456
456
|
fragColor = vec4(vPick, 1.0);
|
|
457
|
-
}`,
|
|
457
|
+
}`,Ls=`#version 300 es
|
|
458
458
|
precision highp float;
|
|
459
459
|
in vec3 position;
|
|
460
460
|
in float part;
|
|
@@ -474,8 +474,8 @@ uniform float uBackBase;
|
|
|
474
474
|
uniform float uFocusFloor;
|
|
475
475
|
flat out vec3 vPick;
|
|
476
476
|
out float vHidden;
|
|
477
|
-
${
|
|
478
|
-
${
|
|
477
|
+
${$t}
|
|
478
|
+
${Fr}
|
|
479
479
|
void main() {
|
|
480
480
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
481
481
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -505,7 +505,7 @@ void main() {
|
|
|
505
505
|
float c = cos(iYaw), s = sin(iYaw);
|
|
506
506
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
507
507
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
508
|
-
}`,
|
|
508
|
+
}`,_s=`#version 300 es
|
|
509
509
|
precision highp float;
|
|
510
510
|
flat in vec3 vPick;
|
|
511
511
|
in float vHidden;
|
|
@@ -513,7 +513,7 @@ out vec4 fragColor;
|
|
|
513
513
|
void main() {
|
|
514
514
|
if (vHidden > 0.5) discard;
|
|
515
515
|
fragColor = vec4(vPick, 1.0);
|
|
516
|
-
}`,
|
|
516
|
+
}`,Os=`#version 300 es
|
|
517
517
|
precision highp float;
|
|
518
518
|
in vec3 position;
|
|
519
519
|
in float floorIndex;
|
|
@@ -524,14 +524,14 @@ out float vHidden;
|
|
|
524
524
|
void main() {
|
|
525
525
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
526
526
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
527
|
-
}`,
|
|
527
|
+
}`,Bs=`#version 300 es
|
|
528
528
|
precision highp float;
|
|
529
529
|
in float vHidden;
|
|
530
530
|
out vec4 fragColor;
|
|
531
531
|
void main() {
|
|
532
532
|
if (vHidden > 0.5) discard;
|
|
533
533
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
534
|
-
}`;function Mr(t){return new Ge.Program(t,{vertex:ys,fragment:gs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:et},uPixelToWorld:{value:.002},uChairFull:{value:mt},uChairNone:{value:tt},uFocusFloor:{value:-1}}})}function wr(t){return new Ge.Program(t,{vertex:xs,fragment:vs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:mt},uChairNone:{value:tt},uBackRake:{value:pn},uBackBase:{value:Ot},uFocusFloor:{value:-1}}})}function Pr(t){return new Ge.Program(t,{vertex:Ss,fragment:Ms,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Cr(t){return new Ge.Program(t,{vertex:ls,fragment:us,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Ar(t){return new Ge.Program(t,{vertex:ds,fragment:ms,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:et},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:tt}}})}function Rr(t){return new Ge.Program(t,{vertex:fs,fragment:ps,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:tt},uBackRake:{value:pn},uBackBase:{value:Ot},uFocusFloor:{value:-1}}})}function Ir(t,e,n){return new Ge.Program(t,{vertex:hs,fragment:bs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}function Tr(t,e,n,r,o,i){for(let a=n;a<n+r;a++){let u=i&&e[a]===0?null:o[e[a]]??o[0];t[a*3]=u?u[0]:i[a*3],t[a*3+1]=u?u[1]:i[a*3+1],t[a*3+2]=u?u[2]:i[a*3+2]}}var ws=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Ps=new Float32Array([-1,-1,3,-1,-1,3]);function Er(t,e){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(t,{position:{size:2,data:Ps}}),i=Ir(t,e.theme.background.top,e.theme.background.bottom),a=new pe.Mesh(t,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(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}}),u=Cr(t),l=new pe.Mesh(t,{geometry:s,program:u});l.frustumCulled=!1,l.setParent(n);let d=Ar(t),m=new Float32Array(e.seats.count*3),p=Me.map(T=>e.theme.seatStates[T]);Tr(m,e.seats.iState,0,e.seats.count,p,e.seats.iCategory);let c=new pe.Geometry(t,{position:{size:2,data:ws},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:m,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}}),f=new pe.Mesh(t,{geometry:c,program:d});f.frustumCulled=!1,e.seats.count>0&&f.setParent(n);let h=c.attributes.iColor,b=co(),g=Rr(t),y=It,x=new Float32Array(y*3),w=new Float32Array(y*3),R=new Float32Array(y),M=new Float32Array(y),k=new Float32Array(y*3),O=new Float32Array(y),L=new Float32Array(y),U=new Float32Array(y),z=new Float32Array(y),_=new pe.Geometry(t,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:w,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:M,instanced:1},iRing:{size:3,data:k,instanced:1},iFloor:{size:1,data:O,instanced:1},iPhysicalSeat:{size:1,data:L,instanced:1},iSeed:{size:1,data:z,instanced:1},iPickIndex:{size:1,data:U,instanced:1}}),v=new pe.Mesh(t,{geometry:_,program:g});v.frustumCulled=!1;let S=0,C=new Int32Array(0),G=()=>{let T=e.seats;for(let I=0;I<S;I++){let E=C[I];z[I]=uo(T.iState[E],E);let F=T.iCategory&&T.iState[E]===0?null:p[T.iState[E]]??p[0];if(F)w[I*3]=F[0],w[I*3+1]=F[1],w[I*3+2]=F[2];else{let N=Un([T.iCategory[E*3],T.iCategory[E*3+1],T.iCategory[E*3+2]]);w[I*3]=N[0],w[I*3+1]=N[1],w[I*3+2]=N[2]}}_.attributes.iColor.needsUpdate=!0,_.attributes.iSeed.needsUpdate=!0},P={main:n,background:r,seatProgram:d,solidProgram:u,chairProgram:g,seatGeometry:c,chairGeometry:_,solidGeometry:s,drawCalls:3,setNearSeats(T,I){let E=Math.min(I,y);if(C=T,S=E,E===0){v.parent&&v.setParent(null),_.instancedCount=0,P.drawCalls=3;return}let A=e.seats;for(let F=0;F<E;F++){let N=T[F];x[F*3]=A.iPosition[N*3],x[F*3+1]=A.iPosition[N*3+1],x[F*3+2]=A.iPosition[N*3+2],R[F]=A.iChairWidth[N],M[F]=A.iYaw[N],k[F*3]=A.iRing[N*3],k[F*3+1]=A.iRing[N*3+1],k[F*3+2]=A.iRing[N*3+2],O[F]=A.iFloor[N],L[F]=A.iPhysicalSeat[N],U[F]=N+1}G(),_.attributes.iOffset.needsUpdate=!0,_.attributes.iRadius.needsUpdate=!0,_.attributes.iYaw.needsUpdate=!0,_.attributes.iRing.needsUpdate=!0,_.attributes.iFloor.needsUpdate=!0,_.attributes.iPhysicalSeat.needsUpdate=!0,_.attributes.iSeed.needsUpdate=!0,_.attributes.iPickIndex.needsUpdate=!0,_.instancedCount=E,v.parent||v.setParent(n),P.drawCalls=4},nearSeatCount(){return S},uploadSeatStateRuns(T){if(!T.length)return;S&&G();for(let E of T)Tr(m,e.seats.iState,E.start,E.length,p,e.seats.iCategory);let I=h.buffer;if(!I){h.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,I);for(let E of T){let A=m.subarray(E.start*3,(E.start+E.length)*3);t.bufferSubData(t.ARRAY_BUFFER,E.start*3*Float32Array.BYTES_PER_ELEMENT,A)}},dispose(){o.remove(),i.remove(),s.remove(),u.remove(),c.remove(),d.remove(),_.remove(),g.remove()}};return P}var Ae=require("ogl");function Cs(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function kr(t,e,n,r,o,i){let a=-1,s=1/0;for(let u=0;u<n;u++)for(let l=0;l<e;l++){let d=(u*e+l)*4,m=Cs(t[d],t[d+1],t[d+2]);if(m<0||m>=i)continue;let p=l-r,c=u-o,f=p*p+c*c;f<s&&(s=f,a=m)}return a}function Fr(t,e,n,r,o,i){let a=t-n.left,s=e-n.top,u=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,u)),y:Math.max(0,Math.min(i-1,l))}}var As=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Yt=class{constructor(e,n,r,o,i){this.seatScene=new Ae.Transform;this.chairScene=new Ae.Transform;this.solidScene=new Ae.Transform;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=wr(this.gl),this.depthProg=Pr(this.gl);let a=new Ae.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ae.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let u=new Ae.Mesh(this.gl,{geometry:o,program:this.depthProg});u.frustumCulled=!1,u.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of As)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 Ae.RenderTarget(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,u=i.drawingBufferHeight,l=Math.max(0,n-o),d=Math.max(0,r-o),m=Math.max(1,Math.min(s,n+o+1)-l),p=Math.max(1,Math.min(u,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(l,d,m,p);let[c,f,h]=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(c,f,h,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(m*p*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,d,m,p,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),kr(b,m,p,n-l,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Dr(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,dt(r.state)):n.push(r);return n}function Lr(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:Me[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}}var He=require("ogl");function Rs(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Or(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Is(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function _r(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 En(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function kn(t,e){return Math.max(0,Math.min(1,t+e))}function Br(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)],u=t[i],l=t[i+1],d=t[Math.min(n-1,i+2)],m=a*a,p=m*a,c=[0,0,0];for(let f=0;f<3;f++)c[f]=.5*(2*u[f]+(-s[f]+l[f])*a+(2*s[f]-5*u[f]+4*l[f]-d[f])*m+(-s[f]+3*u[f]-3*l[f]+d[f])*p);return c}function Fn(t,e,n,r,o){let i=_r(Rs(e,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Or(Or(e,Is(i,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],u=_r(s);u[0]===0&&u[2]===0&&(u=[i[0],0,i[2]]);let l=Math.max(1,o),d=[r[0]+u[0]*l*1.3,r[1]+l*.75,r[2]+u[2]*l*1.3];return{waypoints:[t,d,a],finalPos:a}}function Dn(t,e,n=35,r=28){let o=En(e),i=Br(t,o),a=En(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function zr(t,e,n){let r=t.position.clone(),o=new He.Quat().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new He.Vec3(n[0],n[1],n[2]));let i=new He.Quat().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(o),i}var Xt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new He.Quat;this.endQuat=new He.Quat;this.outQuat=new He.Quat;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}=Dn(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,kn(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 Ts=1.02,Es=1.5;function Gr(t,e,n=0,r){let o=Number.isFinite(r)?n+r:t[1]+Ts;return{eye:[t[0],o,t[2]],focal:[e.x*D,n+Es,e.y*D]}}function ks(t,e){return!Number.isFinite(t)||!Number.isFinite(e)||t<=0||e<=0?0:Math.ceil(t*e*4*(4/3))}function Fs(t){return(t!==void 0&&t<=2?32:t!==void 0&&t>=8?192:96)*1024*1024}function Wt(t){let e=typeof navigator>"u"?void 0:navigator;return{saveData:e?.connection?.saveData===!0,maxTextureSize:t,maxDecodedBytes:Fs(e?.deviceMemory)}}function Kt(t,e={}){let n=t.previewUrl?.trim();if(!n||n===t.url)return{initialUrl:t.url,initialWidth:t.sourceWidth,initialHeight:t.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:t.previewWidth,initialHeight:t.previewHeight};return e.saveData?{...r,reason:"save-data"}:e.maxTextureSize!==void 0&&t.sourceWidth!==void 0&&t.sourceHeight!==void 0&&Math.max(t.sourceWidth,t.sourceHeight)>e.maxTextureSize?{...r,reason:"texture-limit"}:e.maxDecodedBytes!==void 0&&t.sourceWidth!==void 0&&t.sourceHeight!==void 0&&ks(t.sourceWidth,t.sourceHeight)>e.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:t.url,reason:"progressive"}}function Hr(){return new DOMException("Panorama image load aborted","AbortError")}function Mt(t,e){return new Promise((n,r)=>{if(e?.aborted){r(Hr());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,e?.removeEventListener("abort",u)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},u=()=>{o.src="",s(Hr())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),e?.addEventListener("abort",u,{once:!0}),o.src=t})}function qt(t){let e=globalThis;if(e.requestIdleCallback){let r=e.requestIdleCallback(t,{timeout:1200});return()=>e.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(t,32);return()=>globalThis.clearTimeout(n)}function jr(t){let e=t.mediaKind==="demo-render",n=t.generated||t.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":e?t.coverage==="exact-seat"?"AI-generated exact-seat demo":t.coverage==="row-representative"?"AI-generated representative row demo":t.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":t.coverage==="exact-seat"?"Exact seat photo":t.coverage==="row-representative"?"Representative row view":t.coverage==="section-representative"?"Representative section view":t.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=t.capturedAt&&/^\d{4}/.test(t.capturedAt)?t.capturedAt.slice(0,4):"";return[n,r?`${e?"created":"captured"} ${r}`:"",t.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var Zt=70,Ds=35,Ls=90;function Ln(t){return Math.max(Ds,Math.min(Ls,t))}var Re=35;function Os(t,e,n){let r=(.5+t/360)*n;return e/2-r}function _s(t,e=Zt){return t*(180/e)}function Ur(t,e,n){return(t-e)/2+$t(n,e)}function $t(t,e){let n=Re/180*e;return Math.max(-n,Math.min(n,t))}function Yr(t,e,n={}){let r=n.fadeMs??400,o=e.initialBearingDeg??0,i=Kt(e,Wt()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let u=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;u.setAttribute("role","dialog"),u.setAttribute("aria-modal","true"),u.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),u.tabIndex=-1,Object.assign(u.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),u.appendChild(d);let m=document.createElement("button");if(m.type="button",m.setAttribute("aria-label","Close"),m.textContent="\u2715",Object.assign(m.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),u.appendChild(m),n.disclosure){let V=document.createElement("div");V.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(V.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),u.appendChild(V)}let p=document.createElement("div");p.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(p.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),u.appendChild(p),t.appendChild(u),m.focus({preventScroll:!0});let c=0,f=0,h=0,b=0,g=Zt,y=()=>{let V=u.clientHeight||1,B=u.clientWidth||1,j=R.naturalWidth||B*2,K=R.naturalHeight||V,J=c>0?(B/2-h)/c:0,Z=f>0?b/f:0;f=_s(V,g),c=f*(j/K),d.style.backgroundSize=`${c}px ${f}px`,x?h=B/2-J*c:(h=Os(o,B,c),b=$t((e.initialPitchDeg??0)/180*f,f),x=!0),b=$t(Z*f,f),d.style.backgroundPosition=`${h}px ${Ur(V,f,b)}px`},x=!1,w=()=>{let V=u.clientHeight||1;b=$t(b,f),d.style.backgroundPosition=`${h}px ${Ur(V,f,b)}px`},R=new Image;R.onload=y,R.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=qt(()=>{(e.resolveUrl?e.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(B=>!B||a.signal.aborted?null:Mt(B,a.signal).then(j=>({full:j,url:B}))).then(B=>{B&&(I||a.signal.aborted||(R=B.full,d.style.backgroundImage=`url("${B.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let k=!1,O=0,L=0,U=0,z=new Map,_=()=>{let[V,B]=[...z.values()];return V&&B?Math.hypot(V.x-B.x,V.y-B.y):0},v=V=>{let B=Ln(V);B!==g&&(g=B,y())},S=V=>{z.set(V.pointerId,{x:V.clientX,y:V.clientY}),k=z.size===1,O=V.clientX,L=V.clientY,z.size===2&&(U=_()),d.style.cursor="grabbing";try{d.setPointerCapture?.(V.pointerId)}catch{}},C=V=>{if(z.has(V.pointerId)){if(z.set(V.pointerId,{x:V.clientX,y:V.clientY}),z.size>=2){let B=_();U>0&&B>0&&v(g*(U/B)),U=B,k=!1;return}k&&(h+=V.clientX-O,b+=V.clientY-L,O=V.clientX,L=V.clientY,w())}},G=V=>{z.delete(V.pointerId),U=z.size===2?_():0;let B=z.values().next().value;k=z.size===1,B?(O=B.x,L=B.y):d.style.cursor="grab";try{d.releasePointerCapture?.(V.pointerId)}catch{}},P=V=>{V.preventDefault(),v(g+V.deltaY*.04)};d.addEventListener("pointerdown",S),d.addEventListener("pointermove",C),d.addEventListener("pointerup",G),d.addEventListener("pointercancel",G),d.addEventListener("wheel",P,{passive:!1});let T=!1,I=!1,E=0,A=()=>{d.removeEventListener("pointerdown",S),d.removeEventListener("pointermove",C),d.removeEventListener("pointerup",G),d.removeEventListener("pointercancel",G),d.removeEventListener("wheel",P),window.removeEventListener("keydown",Y)},F=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),E&&(window.clearTimeout(E),E=0),A(),u.parentNode&&u.parentNode.removeChild(u),l?.isConnected&&l.focus({preventScroll:!0})},N=()=>{if(T)return;T=!0,u.style.opacity="0";let V=()=>{E=0,!I&&(F(),n.onClose?.())};E=window.setTimeout(V,r)},Y=V=>{if(V.key==="Tab"){V.preventDefault(),m.focus({preventScroll:!0});return}if(V.key==="Escape"){V.stopPropagation(),N();return}if(V.key==="ArrowLeft"||V.key==="ArrowRight")h+=V.key==="ArrowLeft"?-32:32;else if(V.key==="ArrowUp"||V.key==="ArrowDown")b+=(V.key==="ArrowUp"?4:-4)*(f/180);else if(V.key==="+"||V.key==="="){v(g-5),V.preventDefault();return}else if(V.key==="-"){v(g+5),V.preventDefault();return}else return;V.preventDefault(),w()};return window.addEventListener("keydown",Y),m.addEventListener("click",N),requestAnimationFrame(()=>{u.style.opacity="1"}),{close:N,dispose(){T=!0,I=!0,F()}}}var Ue=require("ogl"),Bs=64,Ns=32,Vs=500;function zs(t=Bs,e=Ns,n=Vs){let r=t+1,o=e+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let m=d/e,p=m*Math.PI,c=Math.sin(p),f=Math.cos(p);for(let h=0;h<r;h++){let b=h/t,g=(b-.5)*Math.PI*2,y=d*r+h;a[y*3]=n*c*Math.sin(g),a[y*3+1]=n*f,a[y*3+2]=-n*c*Math.cos(g),s[y*2]=b,s[y*2+1]=m}}let u=new Uint16Array(t*e*6),l=0;for(let d=0;d<e;d++)for(let m=0;m<t;m++){let p=d*r+m,c=p+r;u[l++]=p,u[l++]=c,u[l++]=p+1,u[l++]=p+1,u[l++]=c,u[l++]=c+1}return{position:a,uv:s,index:u}}function Xr(t,e){let n=t*Math.PI/180,r=e*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var Gs=`#version 300 es
|
|
534
|
+
}`;function Dr(e){return new ze.Program(e,{vertex:Ds,fragment:ks,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Fe},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uChairFull:{value:bt},uChairNone:{value:rt},uFocusFloor:{value:-1}}})}function kr(e){return new ze.Program(e,{vertex:Ls,fragment:_s,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:bt},uChairNone:{value:rt},uBackRake:{value:Sn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Lr(e){return new ze.Program(e,{vertex:Os,fragment:Bs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function _r(e){return new ze.Program(e,{vertex:Ps,fragment:Cs,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Or(e){return new ze.Program(e,{vertex:As,fragment:Rs,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Fe},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:bt},uChairNone:{value:rt}}})}function Br(e){return new ze.Program(e,{vertex:Is,fragment:Es,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:bt},uChairNone:{value:rt},uBackRake:{value:Sn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Nr(e,t,n){return new ze.Program(e,{vertex:Ts,fragment:Fs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function Vr(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 Ns=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Vs=new Float32Array([-1,-1,3,-1,-1,3]);function zr(e,t){let n=new he.Transform,r=new he.Transform,o=new he.Geometry(e,{position:{size:2,data:Vs}}),i=Nr(e,t.theme.background.top,t.theme.background.bottom),a=new he.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new he.Geometry(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=_r(e),l=new he.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Or(e),d=new Float32Array(t.seats.count*3),m=ge.map(D=>t.theme.seatStates[D]);Vr(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let f=new he.Geometry(e,{position:{size:2,data:Ns},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:d,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}}),p=new he.Mesh(e,{geometry:f,program:u});p.frustumCulled=!1,t.seats.count>0&&p.setParent(n);let h=f.attributes.iColor,b=ho(),y=Br(e),g=Lt,x=new Float32Array(g*3),w=new Float32Array(g*3),R=new Float32Array(g),S=new Float32Array(g),F=new Float32Array(g*3),B=new Float32Array(g),N=new Float32Array(g),H=new Float32Array(g),_=new Float32Array(g),M=new he.Geometry(e,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:w,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:S,instanced:1},iRing:{size:3,data:F,instanced:1},iFloor:{size:1,data:B,instanced:1},iPhysicalSeat:{size:1,data:N,instanced:1},iSeed:{size:1,data:_,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),v=new he.Mesh(e,{geometry:M,program:y});v.frustumCulled=!1;let A=0,C=new Int32Array(0),O=()=>{let D=t.seats;for(let I=0;I<A;I++){let z=C[I];_[I]=yo(D.iState[z],z);let k=D.iCategory&&D.iState[z]===0?null:m[D.iState[z]]??m[0];if(k)w[I*3]=k[0],w[I*3+1]=k[1],w[I*3+2]=k[2];else{let G=qn([D.iCategory[z*3],D.iCategory[z*3+1],D.iCategory[z*3+2]]);w[I*3]=G[0],w[I*3+1]=G[1],w[I*3+2]=G[2]}}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},P={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:f,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(D,I){let z=Math.min(I,g);if(C=D,A=z,z===0){v.parent&&v.setParent(null),M.instancedCount=0,P.drawCalls=3;return}let E=t.seats;for(let k=0;k<z;k++){let G=D[k];x[k*3]=E.iPosition[G*3],x[k*3+1]=E.iPosition[G*3+1],x[k*3+2]=E.iPosition[G*3+2],R[k]=E.iChairWidth[G],S[k]=E.iYaw[G],F[k*3]=E.iRing[G*3],F[k*3+1]=E.iRing[G*3+1],F[k*3+2]=E.iRing[G*3+2],B[k]=E.iFloor[G],N[k]=E.iPhysicalSeat[G],H[k]=G+1}O(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=z,v.parent||v.setParent(n),P.drawCalls=4},nearSeatCount(){return A},uploadSeatStateRuns(D){if(!D.length)return;A&&O();for(let z of D)Vr(d,t.seats.iState,z.start,z.length,m,t.seats.iCategory);let I=h.buffer;if(!I){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,I);for(let z of D){let E=d.subarray(z.start*3,(z.start+z.length)*3);e.bufferSubData(e.ARRAY_BUFFER,z.start*3*Float32Array.BYTES_PER_ELEMENT,E)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),f.remove(),u.remove(),M.remove(),y.remove()}};return P}var Ce=require("ogl");function zs(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Gr(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 u=(c*t+l)*4,d=zs(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,f=c-o,p=m*m+f*f;p<s&&(s=p,a=d)}return a}function Hr(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 Gs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Zt=class{constructor(t,n,r,o,i){this.seatScene=new Ce.Transform;this.chairScene=new Ce.Transform;this.solidScene=new Ce.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=Dr(this.gl),this.chairProg=kr(this.gl),this.depthProg=Lr(this.gl);let a=new Ce.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ce.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ce.Mesh(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 Gs)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 Ce.RenderTarget(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),u=Math.max(0,r-o),d=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,d,m);let[f,p,h]=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(f,p,h,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(d*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,d,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),Gr(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ur(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,ht(r.state)):n.push(r);return n}function jr(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:ge[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}}var Ge=require("ogl");function Hs(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Xr(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Us(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Yr(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 Nn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Vn(e,t){return Math.max(0,Math.min(1,e+t))}function Wr(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],u=e[Math.min(n-1,i+2)],d=a*a,m=d*a,f=[0,0,0];for(let p=0;p<3;p++)f[p]=.5*(2*c[p]+(-s[p]+l[p])*a+(2*s[p]-5*c[p]+4*l[p]-u[p])*d+(-s[p]+3*c[p]-3*l[p]+u[p])*m);return f}function zn(e,t,n,r,o){let i=Yr(Hs(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Xr(Xr(t,Us(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Yr(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:[e,u,a],finalPos:a}}function Gn(e,t,n=35,r=28){let o=Nn(t),i=Wr(e,o),a=Nn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function $r(e,t,n){let r=e.position.clone(),o=new Ge.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Ge.Vec3(n[0],n[1],n[2]));let i=new Ge.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var Qt=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Ge.Quat;this.endQuat=new Ge.Quat;this.outQuat=new Ge.Quat;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}=Gn(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,Vn(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 js=1.02,Xs=1.5;function Zr(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+js;return{eye:[e[0],o,e[2]],focal:[t.x*L,n+Xs,t.y*L]}}function Ys(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Ws(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Jt(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Ws(t?.deviceMemory)}}function en(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return t.saveData?{...r,reason:"save-data"}:t.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>t.maxTextureSize?{...r,reason:"texture-limit"}:t.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Ys(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function Qr(){return new DOMException("Panorama image load aborted","AbortError")}function At(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Qr());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(Qr())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function tn(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}function ei(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var on=70,Ks=35,qs=90;function Hn(e){return Math.max(Ks,Math.min(qs,e))}var Ae=35;function $s(e,t,n){let r=(.5+e/360)*n;return t/2-r}function Zs(e,t=on){return e*(180/t)}function Jr(e,t,n){return(e-t)/2+nn(n,t)}function nn(e,t){let n=Ae/180*t;return Math.max(-n,Math.min(n,e))}function ti(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=en(t,Jt()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let d=document.createElement("button");if(d.type="button",d.setAttribute("aria-label","Close"),d.textContent="\u2715",Object.assign(d.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(d),n.disclosure){let V=document.createElement("div");V.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(V.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(V)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),d.focus({preventScroll:!0});let f=0,p=0,h=0,b=0,y=on,g=()=>{let V=c.clientHeight||1,T=c.clientWidth||1,Y=R.naturalWidth||T*2,K=R.naturalHeight||V,J=f>0?(T/2-h)/f:0,Z=p>0?b/p:0;p=Zs(V,y),f=p*(Y/K),u.style.backgroundSize=`${f}px ${p}px`,x?h=T/2-J*f:(h=$s(o,T,f),b=nn((t.initialPitchDeg??0)/180*p,p),x=!0),b=nn(Z*p,p),u.style.backgroundPosition=`${h}px ${Jr(V,p,b)}px`},x=!1,w=()=>{let V=c.clientHeight||1;b=nn(b,p),u.style.backgroundPosition=`${h}px ${Jr(V,p,b)}px`},R=new Image;R.onload=g,R.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=tn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(T=>!T||a.signal.aborted?null:At(T,a.signal).then(Y=>({full:Y,url:T}))).then(T=>{T&&(I||a.signal.aborted||(R=T.full,u.style.backgroundImage=`url("${T.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let F=!1,B=0,N=0,H=0,_=new Map,M=()=>{let[V,T]=[..._.values()];return V&&T?Math.hypot(V.x-T.x,V.y-T.y):0},v=V=>{let T=Hn(V);T!==y&&(y=T,g())},A=V=>{_.set(V.pointerId,{x:V.clientX,y:V.clientY}),F=_.size===1,B=V.clientX,N=V.clientY,_.size===2&&(H=M()),u.style.cursor="grabbing";try{u.setPointerCapture?.(V.pointerId)}catch{}},C=V=>{if(_.has(V.pointerId)){if(_.set(V.pointerId,{x:V.clientX,y:V.clientY}),_.size>=2){let T=M();H>0&&T>0&&v(y*(H/T)),H=T,F=!1;return}F&&(h+=V.clientX-B,b+=V.clientY-N,B=V.clientX,N=V.clientY,w())}},O=V=>{_.delete(V.pointerId),H=_.size===2?M():0;let T=_.values().next().value;F=_.size===1,T?(B=T.x,N=T.y):u.style.cursor="grab";try{u.releasePointerCapture?.(V.pointerId)}catch{}},P=V=>{V.preventDefault(),v(y+V.deltaY*.04)};u.addEventListener("pointerdown",A),u.addEventListener("pointermove",C),u.addEventListener("pointerup",O),u.addEventListener("pointercancel",O),u.addEventListener("wheel",P,{passive:!1});let D=!1,I=!1,z=0,E=()=>{u.removeEventListener("pointerdown",A),u.removeEventListener("pointermove",C),u.removeEventListener("pointerup",O),u.removeEventListener("pointercancel",O),u.removeEventListener("wheel",P),window.removeEventListener("keydown",X)},k=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),E(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},G=()=>{if(D)return;D=!0,c.style.opacity="0";let V=()=>{z=0,!I&&(k(),n.onClose?.())};z=window.setTimeout(V,r)},X=V=>{if(V.key==="Tab"){V.preventDefault(),d.focus({preventScroll:!0});return}if(V.key==="Escape"){V.stopPropagation(),G();return}if(V.key==="ArrowLeft"||V.key==="ArrowRight")h+=V.key==="ArrowLeft"?-32:32;else if(V.key==="ArrowUp"||V.key==="ArrowDown")b+=(V.key==="ArrowUp"?4:-4)*(p/180);else if(V.key==="+"||V.key==="="){v(y-5),V.preventDefault();return}else if(V.key==="-"){v(y+5),V.preventDefault();return}else return;V.preventDefault(),w()};return window.addEventListener("keydown",X),d.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){D=!0,I=!0,k()}}}var He=require("ogl"),Qs=64,Js=32,ec=500;function tc(e=Qs,t=Js,n=ec){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let d=u/t,m=d*Math.PI,f=Math.sin(m),p=Math.cos(m);for(let h=0;h<r;h++){let b=h/e,y=(b-.5)*Math.PI*2,g=u*r+h;a[g*3]=n*f*Math.sin(y),a[g*3+1]=n*p,a[g*3+2]=-n*f*Math.cos(y),s[g*2]=b,s[g*2+1]=d}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let d=0;d<e;d++){let m=u*r+d,f=m+r;c[l++]=m,c[l++]=f,c[l++]=m+1,c[l++]=m+1,c[l++]=f,c[l++]=f+1}return{position:a,uv:s,index:c}}function ni(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var nc=`#version 300 es
|
|
535
535
|
precision highp float;
|
|
536
536
|
in vec3 position;
|
|
537
537
|
in vec2 uv;
|
|
@@ -541,7 +541,7 @@ out vec2 vUv;
|
|
|
541
541
|
void main() {
|
|
542
542
|
vUv = uv;
|
|
543
543
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
544
|
-
}`,
|
|
544
|
+
}`,oc=`#version 300 es
|
|
545
545
|
precision highp float;
|
|
546
546
|
in vec2 vUv;
|
|
547
547
|
uniform sampler2D uPano;
|
|
@@ -550,4 +550,4 @@ out vec4 fragColor;
|
|
|
550
550
|
void main() {
|
|
551
551
|
vec3 rgb = texture(uPano, vUv).rgb;
|
|
552
552
|
fragColor = vec4(rgb, uOpacity);
|
|
553
|
-
}`;function Wr(t,e){let{position:n,uv:r,index:o}=zs(),i=new Ue.Geometry(t,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ue.Texture(t,{image:e,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ue.Program(t,{vertex:Gs,fragment:Hs,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),u=new Ue.Mesh(t,{geometry:i,program:s});return{mesh:u,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){u.setParent(null),i.remove(),a.texture&&t.deleteTexture(a.texture),s.remove()}}}var Kr=.15;async function qr(t,e,n,r={}){let o=r.fadeMs??400,i=e?.initialBearingDeg??0,a=Math.max(-Re,Math.min(Re,e?.initialPitchDeg??0)),s=Zt,u=!1,l=new AbortController,d=()=>l.abort();r.signal?.addEventListener("abort",d,{once:!0});let m=()=>{},p=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!e&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!e&&n.focalWorld){let A=n.camera.position,F=n.focalWorld[0]-A.x,N=n.focalWorld[1]-A.y,Y=n.focalWorld[2]-A.z,V=Math.hypot(F,Y);V>.001&&(i=Math.atan2(F,-Y)*180/Math.PI,a=Math.max(-Re,Math.min(Re,Math.atan2(N,V)*180/Math.PI)))}let c=null;if(e){let A=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=Kt(e,Wt(A)),N;try{let Y=e.resolveUrl?await e.resolveUrl(F.initialUrl):F.initialUrl;if(!Y)throw new Error("panorama_asset_unavailable");N=await Mt(Y,l.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{c=Wr(n.gl,N)}catch{return l.abort(),r.signal?.removeEventListener("abort",d),null}c.mesh.renderOrder=999,c.mesh.setParent(n.scene),F.upgradeUrl&&(m=qt(()=>{(e.resolveUrl?e.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(V=>!V||l.signal.aborted?null:Mt(V,l.signal)).then(V=>{V&&(u||l.signal.aborted||(c?.setImage(V),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let A=n.camera.position;c?.mesh.position.set(A.x,A.y,A.z);let[F,N,Y]=Xr(i,a);n.camera.lookAt([A.x+F,A.y+N,A.z+Y]),n.requestRender()};b();let g=document.createElement("div"),y=document.activeElement instanceof HTMLElement?document.activeElement:null;g.setAttribute("role","dialog"),g.setAttribute("aria-modal","true"),g.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),g.tabIndex=-1,Object.assign(g.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),g.appendChild(x),r.disclosure){let A=document.createElement("div");A.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(A.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),g.appendChild(A)}let w=document.createElement("div");w.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(w.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),g.appendChild(w),t.appendChild(g),x.focus({preventScroll:!0});let R=!1,M=0,k=0,O=0,L=new Map,U=()=>{let[A,F]=[...L.values()];return A&&F?Math.hypot(A.x-F.x,A.y-F.y):0},z=A=>{let F=Ln(A);F!==s&&(s=F,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},_=A=>{A.target!==x&&(L.set(A.pointerId,{x:A.clientX,y:A.clientY}),R=L.size===1,M=A.clientX,k=A.clientY,L.size===2&&(O=U()),g.setPointerCapture?.(A.pointerId),g.style.cursor="grabbing")},v=A=>{if(L.has(A.pointerId)){if(L.set(A.pointerId,{x:A.clientX,y:A.clientY}),L.size>=2){let F=U();O>0&&F>0&&z(s*(O/F)),O=F,R=!1;return}R&&(i+=(A.clientX-M)*Kr,a=Math.max(-Re,Math.min(Re,a+(A.clientY-k)*Kr)),M=A.clientX,k=A.clientY,b())}},S=A=>{L.delete(A.pointerId),O=L.size===2?U():0;let F=L.values().next().value;R=L.size===1,F?(M=F.x,k=F.y):g.style.cursor="grab";try{g.releasePointerCapture?.(A.pointerId)}catch{}},C=A=>{A.preventDefault(),z(s+A.deltaY*.04)};g.addEventListener("pointerdown",_),g.addEventListener("pointermove",v),g.addEventListener("pointerup",S),g.addEventListener("pointercancel",S),g.addEventListener("wheel",C,{passive:!1});let G=A=>{if(!u){if(A.key==="Tab"){A.preventDefault(),x.focus({preventScroll:!0});return}if(A.key==="Escape"){A.stopPropagation(),E.close();return}if(A.key==="ArrowLeft"||A.key==="ArrowRight")i+=A.key==="ArrowLeft"?-4:4;else if(A.key==="ArrowUp"||A.key==="ArrowDown")a=Math.max(-Re,Math.min(Re,a+(A.key==="ArrowUp"?4:-4)));else if(A.key==="+"||A.key==="="){z(s-5),A.preventDefault();return}else if(A.key==="-"){z(s+5),A.preventDefault();return}else return;A.preventDefault(),b()}};window.addEventListener("keydown",G);let P=0,T=(A,F)=>{if(!c){F?.();return}let N=A===1?0:1,Y=performance.now(),V=()=>{if(u)return;let B=o<=0?1:Math.min(1,(performance.now()-Y)/o);c?.setOpacity(N+(A-N)*B),n.requestRender(),B<1?P=requestAnimationFrame(V):F?.()};P=requestAnimationFrame(V)};T(1);let I=()=>{u||(u=!0,m(),l.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(P),g.removeEventListener("pointerdown",_),g.removeEventListener("pointermove",v),g.removeEventListener("pointerup",S),g.removeEventListener("pointercancel",S),g.removeEventListener("wheel",C),window.removeEventListener("keydown",G),g.remove(),y?.isConnected&&y.focus({preventScroll:!0}),c?.dispose(),n.camera.position.set(p[0],p[1],p[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},E={close(){if(u)return;let A=()=>{I(),r.onClose?.()};cancelAnimationFrame(P),T(0,A)},dispose:I};return x.addEventListener("click",()=>E.close()),E}var $r=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Qt=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=$r(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round($r()-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 Zr(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Qr(t){let{container:e,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=t,s=null,u=()=>{if(!s)return;let m=a();Object.assign(s.style,m?{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:(m,p,c=!1)=>{if(l(),t.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=o.get(m),b=h?.sectionId?n.sections.find(O=>O.id===h.sectionId):void 0,g=h?.label??m;f.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${g}`);let y=document.createElement("span");y.textContent=["Live 3D seat view",b?.label,g].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)"}),f.appendChild(y);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let w=h?.rowId?i.get(h.rowId):void 0,R=w?.indexOf(m)??-1,M=R>=0?[w?.[R-1],w?.[R+1]]:[void 0,void 0],k=(O,L,U,z=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=O,_.setAttribute("aria-label",L),Object.assign(_.style,{minHeight:"44px",padding:z?"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"}),z||(_.style.minWidth="44px"),z&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",U),x.appendChild(_)};if(M[0]){let O=o.get(M[0])?.label??M[0];k("\u2039",`View previous seat ${O}`,()=>{t.flyToSeat(M[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";k(c?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${c?"Retry":O} from seat ${g}`,()=>{if(t.isDisposed()||p!==t.flightGen()){l();return}l(),t.openPanorama(m,400,p)},!0)}if(M[1]){let O=o.get(M[1])?.label??M[1];k("\u203A",`View next seat ${O}`,()=>{t.flyToSeat(M[1])})}return x.childElementCount?(e.appendChild(f),s=f,u(),f):null},remove:l,layout:u}}function Jr(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 u=document.createElement("button");u.type="button",u.textContent="\u21BB",u.setAttribute("aria-label","Drag to rotate the 3D venue"),u.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 d=document.createElement("button");d.type="button",d.textContent="\u2212",d.setAttribute("aria-label","Zoom out of the 3D venue"),d.dataset.tooltip="Zoom out";let m=document.createElement("button");m.type="button",m.textContent="+",m.setAttribute("aria-label","Zoom into the 3D venue"),m.dataset.tooltip="Zoom in";for(let h of[u,l,d,m])h.className="sl-3d-icon-control",Object.assign(h.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(u,l),s.append(m,d);let p=h=>{n.setPrimaryDragMode(h);let b=h==="orbit";u.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),u.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};u.addEventListener("click",()=>p("orbit")),l.addEventListener("click",()=>p("pan")),d.addEventListener("click",()=>n.zoomBy(1.22)),m.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),p("orbit"),e.appendChild(o);let c=()=>{let h=r();o.style.display=i?"none":"flex",o.style.right=h?"12px":"14px",o.style.bottom=h?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=h?"none":"flex",m.style.display=h?"none":"",d.style.display=h?"none":""};return c(),{element:o,utilityControls:s,setNavigationMode:p,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),c()},seatViewLocked:()=>i,layout:c}}function ei(t){let{glctx:e,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:u,sectionIdBySeatId:l,tapSlop:d,tapMs:m,cancelFlight:p,focusSectionCamera:c,setSelection:f,ensureSeatView:h}=t,b=0,g=0,y=0,x=-1,w=!1,R=!1,M=z=>{t.seatViewLocked()||x===-1&&(x=z.pointerId,b=z.clientX,g=z.clientY,y=performance.now(),w=!1,R=a.active,a.active&&(s.cinematicCancelled(),p(),i.onViewTargetChange?.(null)))},k=z=>{z.pointerId===x&&Math.hypot(z.clientX-b,z.clientY-g)>d&&(w=!0)},O=(z,_,v,S,C)=>{let G=e.canvas.getBoundingClientRect(),P=e.canvas.clientWidth||G.width||1,T=e.canvas.clientHeight||G.height||1,I=z-G.left,E=_-G.top,A=S*S,F=-1,N=A,Y=1/0;for(let V of o){if(v&&V.sectionId!==v)continue;let B=r.seats.idToIndex.get(V.id);if(B===void 0)continue;if(C){let Q=Math.round(r.seats.iState[B]??0);if(Q!==0&&Q!==3)continue}let j=B*3,K=Ht(n.camera.projectionViewMatrix,[r.seats.iPosition[j],r.seats.iPosition[j+1]+.55,r.seats.iPosition[j+2]],P,T);if(!K.visible)continue;let J=K.x-I,Z=K.y-E,ee=J*J+Z*Z;(ee<N||Math.abs(ee-N)<1&&K.depth<Y)&&(F=B,N=ee,Y=K.depth)}return F},L=(z,_)=>{let v=t.gpu(),S=t.pick();if(!v||!S)return-1;S.syncFromSeatProgram(v.seatProgram);let C=e.canvas.getBoundingClientRect(),G=e.renderer.dpr,{x:P,y:T}=Fr(z,_,C,G,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*G));return S.pick(n.camera,P,T,I)};return{onDown:M,onMove:k,onUp:z=>{if(z.pointerId!==x)return;let _=!w&&performance.now()-y<m;if(x=-1,R){R=!1;return}let v=t.gpu(),S=t.pick();if(!_||!v||!S)return;let C=L(z.clientX,z.clientY);if(t.focusedSectionId()&&C>=0){let T=u[C],I=T?l.get(T):void 0;if(I&&I!==t.focusedSectionId()&&c(I))return}if(t.focusedSectionId()&&C<0&&(C=O(z.clientX,z.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&C<0){let T=O(z.clientX,z.clientY,null,72,!1),I=T>=0?u[T]:void 0,E=I?l.get(I):void 0;if(E&&E!==t.focusedSectionId()&&c(E))return}if(!t.focusedSectionId()){C<0&&(C=O(z.clientX,z.clientY,null,42,!1));let T=C>=0?u[C]:void 0,I=T?l.get(T):void 0;if(I&&c(I))return}if(C<0||C>=u.length){t.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let G=u[C],P=Me[Math.round(r.seats.iState[C]??0)]??"available";if(P!=="available"&&P!=="selected"){i.onSeatInspect?.(G,P);return}if(t.selection().has(G)&&t.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([G]),h(G),s.seatPicked(G,l.get(G)),i.onSeatPick?.(G)}}}var Jt=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 c=0;c<this.count;c++){let f=e[c*3],h=e[c*3+2];f<n&&(n=f),f>o&&(o=f),h<r&&(r=h),h>i&&(i=h)}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 u=this.cols*this.rows,l=new Int32Array(u+1),d=c=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((e[c*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[c*3+2]-r)/this.cell)))*this.cols+f};for(let c=0;c<this.count;c++)l[d(c)+1]++;for(let c=0;c<u;c++)l[c+1]+=l[c];let m=new Int32Array(this.count),p=l.slice(0,u);for(let c=0;c<this.count;c++)m[p[d(c)]++]=c;this.cellStart=l,this.cellItems=m}gather(e,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,u=r*r,l=Math.floor((e-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),m=Math.ceil(r/this.cell)+1,p=this.iPosition,c=0;for(let f=0;f<=m&&c<s;f++){let h=d-f,b=d+f,g=l-f,y=l+f;for(let x=h;x<=b&&c<s;x++){if(x<0||x>=this.rows)continue;let w=x===h||x===b;for(let R=g;R<=y&&c<s;R++){if(!w&&R!==g&&R!==y){R=y-1;continue}if(R<0||R>=this.cols)continue;let M=x*this.cols+R;for(let k=i[M],O=i[M+1];k<O&&c<s;k++){let L=a[k],U=p[L*3]-e,z=p[L*3+2]-n;U*U+z*z<=u&&(o[c++]=L)}}}}return c}};var en=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 Jt(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)<ln)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>cn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,cn,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)}};var tn=require("ogl");function ti(t){let{container:e,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:u,stageAzimuth:l,overviewFraming:d}=t,m=0,p=-1,c=(R,M,k=28)=>{o.camera.position.set(R[0],R[1],R[2]),o.camera.lookAt(new tn.Vec3(M[0],M[1],M[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.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 h=()=>{f.textContent="\u2302"};h();let b=R=>{p=R;let M=t.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=R,M.solidProgram.uniforms.uFocusFloor.value=R,M.chairProgram.uniforms.uFocusFloor.value=R),t.showSectionSeatLabels(null)},g=()=>{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(),f.style.display="",u.setVisible(!0),t.setFrozen(!1);let R=p>=0?n.floors[p]:null;if(t.setNearFieldDetailEnabled(!!R),t.setSeatViewLocked(!1),y(),t.removeArriveChip(),t.setNavigationMode("orbit"),R){let M=R.focalWorld[0]-R.center[0],k=R.focalWorld[2]-R.center[2],O=Math.hypot(M,k)>R.radius*.12?Math.atan2(M,k):l,L={center:R.center,radius:R.radius,box:R.box},U={polarDeg:58,margin:1.12};t.reducedMotion()?o.frame(L,!1,O,!1,U):o.frameSoft(L,O,!1,U)}else t.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,d):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,d);t.showSectionSeatLabels(null),s.requestRender()},y=()=>{m++,t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=R=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(R);if(M===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(R),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),f.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1),t.setSeatViewLocked(!1);let k=++m;t.removeArriveChip();let{eye:O,focal:L}=t.resolvedSeatViewPose(R,M),U=[o.camera.position.x,o.camera.position.y,o.camera.position.z],z=Fn(U,O,L,n.bounds.center,n.bounds.radius),_=r.arriveAtSeatEye?O:z.finalPos,v=r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?90:65:28,S=[z.waypoints[0],z.waypoints[1],_];if(u.setVisible(!1),t.reducedMotion())return c(_,L,v),s.requestRender(),a.cinematicSkipped(),t.isDisposed()||o.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),t.showArriveChip(R,k),Promise.resolve();let C=new tn.Quat().copy(o.camera.quaternion),G=zr(o.camera,_,L);return s.requestRender(),i.start(S,C,G,2500,v).then(()=>{t.isDisposed()||k!==m||(a.cinematicPlayed(2500),o.resumeAfterFlight(L),t.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),t.showArriveChip(R,k))})},w=R=>{let M=n.sections.find(U=>U.id===R);if(!M||M.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),n.floors.length>1&&p!==M.floorIndex&&b(M.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(R);let k=M.focalWorld[0]-M.center[0],O=M.focalWorld[2]-M.center[2],L=Math.hypot(k,O)>M.radius*.12?Math.atan2(k,O):void 0;return o.frame({center:M.center,radius:Math.max(5,M.radius*.5)},!1,L),r.onSectionFocusChange?.(R),s.requestRender(),!0};return f.addEventListener("click",g),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>m,focusedFloor:()=>p,applyFloorFocus:b,placeCameraFinal:c,cancelFlight:y,focusOverview:g,flyToSeat:x,focusSectionCamera:w}}var Us={};function ni(t){let e=performance.now();return{model:it(t),buildMs:performance.now()-e,source:"main"}}function oi(t){return typeof Worker>"u"?Promise.resolve(ni(t)):new Promise(e=>{let n=new Worker(new URL("./scene/scene.worker.ts",Us.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),e(s))},i=()=>o(ni(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 js=Math.PI/180,Ys=6,Xs=500;function Ws(t,e,n={}){let r=performance.now(),o=e.prepared?.model??it(e),i=new Qt(n.onAnalytics),a=new Array(o.seats.count);for(let[H,X]of o.seats.idToIndex)a[X]=H;let s=new Map(e.seats.map(H=>[H.id,H])),u=new Map;for(let H of e.seats){if(!H.rowId)continue;let X=u.get(H.rowId);X?X.push(H.id):u.set(H.rowId,[H.id])}let l=new Map;for(let H of e.seats)l.set(H.id,H.sectionId);let d=e.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(X=>X.objects)??e.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),m=null,p=null,c=!1,f=!1,h=!1,b=new Map,g=null,y=null,x=null,w=new Map,R=null,M=()=>{x===null&&(x=t.style.zIndex,t.style.zIndex="20")},k=()=>{x!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=x),x=null)},O=!1,L=()=>O?ie.focusedFloor():-1,U=()=>{m=Er(S.gl,o),p=new Yt(S.renderer,m.seatGeometry,m.chairGeometry,m.solidGeometry,o.seats.count),S.setClearColor(o.theme.background.top),p.setRestoreClear(o.theme.background.top),m.seatProgram.uniforms.uSeatRadius.value=ke*o.theme.seatScale,m.seatProgram.uniforms.uFocusFloor.value=L(),m.solidProgram.uniforms.uFocusFloor.value=L(),m.chairProgram.uniforms.uFocusFloor.value=L(),_.forceRegather()},z=!1,_=new en({model:o,orbit:()=>C,gpu:()=>m}),v=H=>_.setDetailEnabled(H),S=new Ct(t,{onContextLost:()=>{h||i.contextLost(),c=!0,j.stop(),m=null,p=null},onContextRestored:()=>{U(),c=!1,h||i.contextRestored(),j.requestRender()}}),C=new At(S.gl,S.canvas,()=>j.requestRender(),()=>i.orbitEngaged());C.setAspect(S.aspect);let G=(e.doc.floors?.flatMap(H=>H.objects)??e.doc.objects).some(H=>H.type==="section"&&H.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(G&&o.stages.length===0)return;let H=o.focalWorld[0]-o.bounds.center[0],X=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(H,X)>o.bounds.radius*.12?Math.atan2(H,X):void 0})(),T=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!I,P,n.portraitOverviewCrop===!0,T);let E=new Xt(C.camera),A=Zr(t),F=new Ut(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,Y=()=>rr(N,o.floors.length,L());F.setLabels(Y());let V=null,B=H=>{if(V=H,F.setForcedDense(!!H),!H){F.setLabels(Y());return}let X=e.seats.filter(q=>q.sectionId===H),W=new Set(X.map(q=>q.id)),$=new Set(X.map(q=>q.rowId)),re=new Set(b.keys()),oe=new Set(X.filter(q=>re.has(q.id)).map(q=>q.id)),ue=Y().filter(q=>q.kind!=="row"&&q.kind!=="seat"||(q.kind==="row"?$.has(q.id.slice(4)):W.has(q.id.slice(5))&&(oe.size===0||oe.has(q.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){F.setLabels(ue);return}let xe=oe.size?X.filter(q=>oe.has(q.id)):X,ve=new Set(xe.map(q=>`seat:${q.id}`)),Ee=xe.flatMap(q=>{let Se=o.seats.idToIndex.get(q.id);if(Se===void 0)return[];let Be=Se*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Be],o.seats.iPosition[Be+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[Be+2]]}]});F.setLabels([...ue.filter(q=>!ve.has(q.id)),...Ee])};U();let j=new Rt(H=>{if(c||!m||f)return!1;let W=E.active?E.update(performance.now()):C.update(),$=L()>=0?o.floors[L()]:null,re=$?.radius??o.bounds.radius,oe=Zn(C.currentDistance,re),ue=z?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(ue);let xe=$?.center??o.renderBounds.center,ve=$?.radius??o.renderBounds.radius,Ee=(Ye,nn)=>Math.hypot(C.camera.position.x-Ye[0],C.camera.position.y-Ye[1],C.camera.position.z-Ye[2])<=nn*(_.detailVisible?1.8:1.55),q=Ee(xe,ve);if(!q&&V){let Ye=o.sections.find(nn=>nn.id===V);Ye&&(q=Ee(Ye.center,Math.max(12,Ye.radius*2)))}_.detailVisible=q;let Se=m.seatProgram.uniforms;Se.uSeatScale.value=oe.scale,Se.uSeatFade.value=oe.fade;let Be=!!$&&Qn($.seatCount,S.canvas.clientWidth||1,S.canvas.clientHeight||1),lt=Jn(o.seats.count,re,C.currentDistance,C.camera.fov,S.canvas.clientHeight||1),Ne=_.detailVisible||Be||lt?1:0,Vn=_.detailVisible||L()>=0||o.floors.length>1?1:0;return _.ease(H,Ne,Vn),Se.uSeatDetail.value=_.seatDetailMix,m.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,Se.uMinPixels.value=oe.minPixels,Se.uPixelToWorld.value=2*Math.tan(C.camera.fov*js/2)/Math.max(1,S.pixelHeight),_.update(_.detailVisible),S.renderer.render({scene:m.background,clear:!0}),S.renderer.render({scene:m.main,camera:C.camera,clear:!1}),F.update(C.camera.projectionViewMatrix,S.canvas.clientWidth||1,S.canvas.clientHeight||1,C.currentDistance,re,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||_.seatDetailMix!==Ne||_.structureDetailMix!==Vn}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>Nn.resize()):null;K?.observe(t);let J=H=>{let X=re=>{let oe=o.seats.idToIndex.get(re);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:$}=Lr(b,H,X);if(b=$,F.setSelectedSeatIds(b.keys()),V&&B(V),W.length){let re=bn(o.seats,W);m&&m.uploadSeatStateRuns(re),j.requestRender()}},Z=()=>R!==null?R:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=8,Q=H=>{if(!n.getSeatView)return null;let X=w.get(H);if(!X)for(X=Promise.resolve(n.getSeatView(H)),w.set(H,X),X.catch(()=>{w.get(H)===X&&w.delete(H)});w.size>ee;){let W=w.keys().next().value;if(W===void 0)break;w.delete(W)}return X},he=(H,X)=>{let W=s.get(H),$=Math.max(0,Math.round(o.seats.iFloor[X]??0)),re=e.doc.floors?.[$],oe=o.floors[$],ue=re?.focalPoint??e.doc.focalPoint,xe=oe?{x:oe.focalWorld[0]/D,y:oe.focalWorld[2]/D}:ue,ve=W?.focalPoint?{x:W.focalPoint.x+xe.x-ue.x,y:W.focalPoint.y+xe.y-ue.y}:xe,Ee=[o.seats.iPosition[X*3],o.seats.iPosition[X*3+1],o.seats.iPosition[X*3+2]];return Gr(Ee,ve,re?.baseHeightM??0,W?.eyeHeightM)},je=()=>(t.clientWidth||S.canvas.clientWidth)<=520,Le=Qr({container:t,model:o,opts:n,expandedSeatById:s,seatIdsByRow:u,isNarrow:je,isDisposed:()=>h,flightGen:()=>ie.flightGen(),flyToSeat:H=>_n(H),openPanorama:(H,X,W)=>ai(H,X,W)}),ge=Le.show,Ie=Le.remove,Oe=Le.layout,me=Jr({container:t,orbit:C,isNarrow:je}),we=me.element,ce=me.setNavigationMode,Te=me.setSeatViewLocked,ct=me.layout,$e=me.utilityControls,ie=ti({container:t,model:o,opts:n,orbit:C,cinematic:E,analytics:i,loop:j,labelOverlay:F,stageAzimuth:P,overviewFraming:T,gpu:()=>m,isDisposed:()=>h,panorama:()=>g,setPanorama:H=>{g=H},setPanoramaSphereVisible:H=>{z=H},panoramaLoadAbort:()=>y,setPanoramaLoadAbort:H=>{y=H},setFrozen:H=>{f=H},restorePanoramaLayer:k,reducedMotion:Z,resolvedSeatViewPose:he,showSectionSeatLabels:B,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:ce,showArriveChip:ge,removeArriveChip:Ie});O=!0;let Pe=ie.overviewChip,wt=ie.layoutOverviewChip,ri=ie.applyFloorFocus,ii=ie.focusOverview,On=ie.cancelFlight,_n=ie.flyToSeat,Bn=ie.focusSectionCamera;$e.appendChild(Pe);let ai=async(H,X,W)=>{y?.abort();let $=new AbortController;y=$;let re=o.seats.idToIndex.get(H);if(re===void 0){C.syncFromCamera();return}let oe=s.get(H)?.label??H,ue=he(H,re),xe=Q(H);if(!xe){$.abort(),y===$&&(y=null),C.syncFromCamera();return}f=!0,j.stop();let ve;try{ve=await xe}catch{if(y===$&&(y=null),i.panoramaFailed(H,"source"),!h&&W===ie.flightGen()){f=!1,C.resumeAfterFlight(ue.focal),j.requestRender();let Ne=ge(H,W,!0);requestAnimationFrame(()=>Ne?.querySelector("[data-panorama-trigger]")?.focus())}return}if(h||W!==ie.flightGen()){$.abort(),y===$&&(y=null);return}Ie();let Ee=()=>{$.abort(),y===$&&(y=null),g=null,z=!1,k(),Pe.style.display="",F.setVisible(!n.arriveAtSeatEye),f=!1,i.panoramaClosed(),C.resumeAfterFlight(ue.focal),j.requestRender();let Ne=ge(H,ie.flightGen());requestAnimationFrame(()=>Ne?.querySelector("[data-panorama-trigger]")?.focus())},q=ve.generated===!0,Se=jr(ve);M(),z=!q,Pe.style.display="none";let Be=Z()?0:X,lt=m&&!c?await qr(t,q?null:ve,{gl:S.gl,scene:m.main,camera:C.camera,requestRender:()=>j.requestRender(),cameraOriginWorld:q?ue.eye:void 0,focalWorld:ue.focal},{fadeMs:Be,seatLabel:oe,disclosure:Se,disclosurePrefix:q?"Live seat-eye view":"360\xB0 panorama",onClose:Ee,signal:$.signal}):null;if(h||W!==ie.flightGen()){$.abort(),z=!1,y===$&&(y=null),lt?.dispose(),Pe.style.display="",k();return}if(lt)C.syncFromCamera(),F.setVisible(!1),f=!1,j.requestRender(),g=lt;else if(q){k(),Pe.style.display="",f=!1,C.resumeAfterFlight(ue.focal),j.requestRender(),g=null,z=!1,i.panoramaFailed(H,"mount");let Ne=ge(H,ie.flightGen(),!0);requestAnimationFrame(()=>Ne?.querySelector("[data-panorama-trigger]")?.focus()),y===$&&(y=null);return}else z=!1,i.panoramaFallback(H),g=Yr(t,ve,{fadeMs:Be,seatLabel:oe,disclosure:Se,onClose:Ee,signal:$.signal});i.panoramaOpened()},_e=ei({glctx:S,orbit:C,model:o,seats:e.seats,opts:n,cinematic:E,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:Ys,tapMs:Xs,gpu:()=>m,pick:()=>p,seatViewLocked:()=>me.seatViewLocked(),focusedSectionId:()=>V,selection:()=>b,cancelFlight:On,focusSectionCamera:Bn,setSelection:J,ensureSeatView:Q});S.canvas.addEventListener("pointerdown",_e.onDown),S.canvas.addEventListener("pointermove",_e.onMove),S.canvas.addEventListener("pointerup",_e.onUp),S.canvas.addEventListener("pointercancel",_e.onUp),j.requestRender();let Nn={setAvailability(H){let X=Dr(b,H),W=bn(o.seats,X);W.length&&m&&m.uploadSeatStateRuns(W),j.requestRender()},setSelection:J,flyToSeat:_n,focusOverview:ii,resize(){let{width:H,height:X}=S.resize();C.setAspect(H/Math.max(1,X)),Oe(),ct(),wt(),j.requestRender()},stats(){return{...j.stats(),drawCalls:m?m.drawCalls:0,seatCount:o.seatCount}},loseContextForTest(){S.simulateContextLossCycle()},floors(){return o.floors},focusFloor(H){if(H!==null&&!o.floors.some(W=>W.index===H))return!1;let X=H??-1;if(v(H!==null),Te(!1),ri(X),ce("orbit"),H===null)E.cancel(),Z()?C.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,T):C.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,T);else{let W=o.floors[H];if(W.seatCount>0){E.cancel();let $=W.focalWorld[0]-W.center[0],re=W.focalWorld[2]-W.center[2],oe=Math.hypot($,re)>W.radius*.12?Math.atan2($,re):P;C.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return j.requestRender(),!0},zones(){return o.zones},focusZone(H){let X=o.zones.find(oe=>oe.id===H);if(!X||X.seatCount===0)return!1;v(!1),Te(!1),E.cancel(),ce("orbit"),B(null),n.onSectionFocusChange?.(null);let W=X.focalWorld[0]-X.center[0],$=X.focalWorld[2]-X.center[2],re=Math.hypot(W,$)>X.radius*.12?Math.atan2(W,$):void 0;return C.frame({center:X.center,radius:X.radius*1.25},!1,re),j.requestRender(),!0},sections(){return o.sections},focusSection(H){return Bn(H)},rows(H){return H?o.rows.filter(X=>X.sectionId===H):o.rows},seatsInRow(H){return e.seats.filter(X=>X.rowId===H).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(H){let X=o.rows.find(W=>W.id===H);return!X||X.seatCount===0?!1:(v(!0),Te(!1),E.cancel(),ce("pan"),X.sectionId&&(B(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),C.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),j.requestRender(),!0)},setReducedMotionForTest(H){R=H},dispose(){h=!0,Ie(),Pe.remove(),we.remove(),On(),j.stop(),F.dispose(),K?.disconnect(),g&&(g.dispose(),g=null),k(),A(),S.canvas.removeEventListener("pointerdown",_e.onDown),S.canvas.removeEventListener("pointermove",_e.onMove),S.canvas.removeEventListener("pointerup",_e.onUp),S.canvas.removeEventListener("pointercancel",_e.onUp),C.dispose(),p&&p.dispose(),m&&m.dispose(),m=null,p=null,S.dispose()}};return i.opened(o.seatCount,d,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),Nn}0&&(module.exports={buildSceneModel,mountVenue3D,prepareVenue3D});
|
|
553
|
+
}`;function oi(e,t){let{position:n,uv:r,index:o}=tc(),i=new He.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new He.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new He.Program(e,{vertex:nc,fragment:oc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new He.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var ri=.15;async function ii(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ae,Math.min(Ae,t?.initialPitchDeg??0)),s=on,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let d=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let E=n.camera.position,k=n.focalWorld[0]-E.x,G=n.focalWorld[1]-E.y,X=n.focalWorld[2]-E.z,V=Math.hypot(k,X);V>.001&&(i=Math.atan2(k,-X)*180/Math.PI,a=Math.max(-Ae,Math.min(Ae,Math.atan2(G,V)*180/Math.PI)))}let f=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),k=en(t,Jt(E)),G;try{let X=t.resolveUrl?await t.resolveUrl(k.initialUrl):k.initialUrl;if(!X)throw new Error("panorama_asset_unavailable");G=await At(X,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=oi(n.gl,G)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),k.upgradeUrl&&(d=tn(()=>{(t.resolveUrl?t.resolveUrl(k.upgradeUrl):Promise.resolve(k.upgradeUrl)).then(V=>!V||l.signal.aborted?null:At(V,l.signal)).then(V=>{V&&(c||l.signal.aborted||(f?.setImage(V),n.requestRender()))}).catch(()=>{})}))}let p=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let E=n.camera.position;f?.mesh.position.set(E.x,E.y,E.z);let[k,G,X]=ni(i,a);n.camera.lookAt([E.x+k,E.y+G,E.z+X]),n.requestRender()};b();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(x),r.disclosure){let E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(E)}let w=document.createElement("div");w.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(w.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(w),e.appendChild(y),x.focus({preventScroll:!0});let R=!1,S=0,F=0,B=0,N=new Map,H=()=>{let[E,k]=[...N.values()];return E&&k?Math.hypot(E.x-k.x,E.y-k.y):0},_=E=>{let k=Hn(E);k!==s&&(s=k,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},M=E=>{E.target!==x&&(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),R=N.size===1,S=E.clientX,F=E.clientY,N.size===2&&(B=H()),y.setPointerCapture?.(E.pointerId),y.style.cursor="grabbing")},v=E=>{if(N.has(E.pointerId)){if(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),N.size>=2){let k=H();B>0&&k>0&&_(s*(B/k)),B=k,R=!1;return}R&&(i+=(E.clientX-S)*ri,a=Math.max(-Ae,Math.min(Ae,a+(E.clientY-F)*ri)),S=E.clientX,F=E.clientY,b())}},A=E=>{N.delete(E.pointerId),B=N.size===2?H():0;let k=N.values().next().value;R=N.size===1,k?(S=k.x,F=k.y):y.style.cursor="grab";try{y.releasePointerCapture?.(E.pointerId)}catch{}},C=E=>{E.preventDefault(),_(s+E.deltaY*.04)};y.addEventListener("pointerdown",M),y.addEventListener("pointermove",v),y.addEventListener("pointerup",A),y.addEventListener("pointercancel",A),y.addEventListener("wheel",C,{passive:!1});let O=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),z.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Ae,Math.min(Ae,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){_(s-5),E.preventDefault();return}else if(E.key==="-"){_(s+5),E.preventDefault();return}else return;E.preventDefault(),b()}};window.addEventListener("keydown",O);let P=0,D=(E,k)=>{if(!f){k?.();return}let G=E===1?0:1,X=performance.now(),V=()=>{if(c)return;let T=o<=0?1:Math.min(1,(performance.now()-X)/o);f?.setOpacity(G+(E-G)*T),n.requestRender(),T<1?P=requestAnimationFrame(V):k?.()};P=requestAnimationFrame(V)};D(1);let I=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(P),y.removeEventListener("pointerdown",M),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",A),y.removeEventListener("pointercancel",A),y.removeEventListener("wheel",C),window.removeEventListener("keydown",O),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:p,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},z={close(){if(c)return;let E=()=>{I(),r.onClose?.()};cancelAnimationFrame(P),D(0,E)},dispose:I};return x.addEventListener("click",()=>z.close()),z}function ai(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:d,isContextLost:m,isDisposed:f,flightGen:p,setPanorama:h,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:w,restorePanoramaLayer:R,getOverviewChip:S,labelOverlay:F,reducedMotion:B,removeArriveChip:N,showArriveChip:H}=e;return async(_,M,v)=>{b()?.abort();let A=new AbortController;y(A);let C=n.seats.idToIndex.get(_);if(C===void 0){i.syncFromCamera();return}let O=s.get(_)?.label??_,P=l(_,C),D=c(_);if(!D){A.abort(),b()===A&&y(null),i.syncFromCamera();return}x(!0),a.stop();let I;try{I=await D}catch{if(b()===A&&y(null),o.panoramaFailed(_,"source"),!f()&&v===p()){x(!1),i.resumeAfterFlight(P.focal),a.requestRender();let Y=H(_,v,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||v!==p()){A.abort(),b()===A&&y(null);return}N();let z=S(),E=()=>{A.abort(),b()===A&&y(null),h(null),g(!1),R(),z.style.display="",F.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(P.focal),a.requestRender();let Y=H(_,p());requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())},k=I.generated===!0,G=ei(I);w(),g(!k),z.style.display="none";let X=B()?0:M,V=u(),T=V&&!m()?await ii(t,k?null:I,{gl:d,scene:V.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:k?P.eye:void 0,focalWorld:P.focal},{fadeMs:X,seatLabel:O,disclosure:G,disclosurePrefix:k?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:A.signal}):null;if(f()||v!==p()){A.abort(),g(!1),b()===A&&y(null),T?.dispose(),z.style.display="",R();return}if(T)i.syncFromCamera(),F.setVisible(!1),x(!1),a.requestRender(),h(T);else if(k){R(),z.style.display="",x(!1),i.resumeAfterFlight(P.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(_,"mount");let Y=H(_,p(),!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus()),b()===A&&y(null);return}else g(!1),o.panoramaFallback(_),h(ti(t,I,{fadeMs:X,seatLabel:O,disclosure:G,onClose:E,signal:A.signal}));o.panoramaOpened()}}var si=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),rn=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=si(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(si()-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 ci(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function li(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let d=a();Object.assign(s.style,d?{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:(d,m,f=!1)=>{if(l(),e.isDisposed())return null;let p=document.createElement("div");p.setAttribute("role","group"),Object.assign(p.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=o.get(d),b=h?.sectionId?n.sections.find(B=>B.id===h.sectionId):void 0,y=h?.label??d;p.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${y}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",b?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(g.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)"}),p.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),p.appendChild(x);let w=h?.rowId?i.get(h.rowId):void 0,R=w?.indexOf(d)??-1,S=R>=0?[w?.[R-1],w?.[R+1]]:[void 0,void 0],F=(B,N,H,_=!1)=>{let M=document.createElement("button");M.type="button",M.textContent=B,M.setAttribute("aria-label",N),Object.assign(M.style,{minHeight:"44px",padding:_?"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"}),_||(M.style.minWidth="44px"),_&&(M.dataset.panoramaTrigger=""),M.addEventListener("click",H),x.appendChild(M)};if(S[0]){let B=o.get(S[0])?.label??S[0];F("\u2039",`View previous seat ${B}`,()=>{e.flyToSeat(S[0])})}if(r.getSeatView){let B=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";F(f?`\u21BB Retry ${B}`:`\u25C9 ${B}`,`${f?"Retry":B} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(S[1]){let B=o.get(S[1])?.label??S[1];F("\u203A",`View next seat ${B}`,()=>{e.flyToSeat(S[1])})}return x.childElementCount?(t.appendChild(p),s=p,c(),p):null},remove:l,layout:c}}function ui(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 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 d=document.createElement("button");d.type="button",d.textContent="+",d.setAttribute("aria-label","Zoom into the 3D venue"),d.dataset.tooltip="Zoom in";for(let h of[c,l,u,d])h.className="sl-3d-icon-control",Object.assign(h.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(d,u);let m=h=>{n.setPrimaryDragMode(h);let b=h==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"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)),d.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let f=()=>{let h=r();o.style.display=i?"none":"flex",o.style.right=h?"12px":"14px",o.style.bottom=h?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=h?"none":"flex",d.style.display=h?"none":"",u.style.display=h?"none":""};return f(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),f()},seatViewLocked:()=>i,layout:f}}function di(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:d,cancelFlight:m,focusSectionCamera:f,setSelection:p,ensureSeatView:h}=e,b=0,y=0,g=0,x=-1,w=!1,R=!1,S=_=>{e.seatViewLocked()||x===-1&&(x=_.pointerId,b=_.clientX,y=_.clientY,g=performance.now(),w=!1,R=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},F=_=>{_.pointerId===x&&Math.hypot(_.clientX-b,_.clientY-y)>u&&(w=!0)},B=(_,M,v,A,C)=>{let O=t.canvas.getBoundingClientRect(),P=t.canvas.clientWidth||O.width||1,D=t.canvas.clientHeight||O.height||1,I=_-O.left,z=M-O.top,E=A*A,k=-1,G=E,X=1/0;for(let V of o){if(v&&V.sectionId!==v)continue;let T=r.seats.idToIndex.get(V.id);if(T===void 0)continue;if(C){let te=Math.round(r.seats.iState[T]??0);if(te!==0&&te!==3)continue}let Y=T*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],P,D);if(!K.visible)continue;let J=K.x-I,Z=K.y-z,$=J*J+Z*Z;($<G||Math.abs($-G)<1&&K.depth<X)&&(k=T,G=$,X=K.depth)}return k},N=(_,M)=>{let v=e.gpu(),A=e.pick();if(!v||!A)return-1;A.syncFromSeatProgram(v.seatProgram);let C=t.canvas.getBoundingClientRect(),O=t.renderer.dpr,{x:P,y:D}=Hr(_,M,C,O,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*O));return A.pick(n.camera,P,D,I)};return{onDown:S,onMove:F,onUp:_=>{if(_.pointerId!==x)return;let M=!w&&performance.now()-g<d;if(x=-1,R){R=!1;return}let v=e.gpu(),A=e.pick();if(!M||!v||!A)return;let C=N(_.clientX,_.clientY);if(e.focusedSectionId()&&C>=0){let D=c[C],I=D?l.get(D):void 0;if(I&&I!==e.focusedSectionId()&&f(I))return}if(e.focusedSectionId()&&C<0&&(C=B(_.clientX,_.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&C<0){let D=B(_.clientX,_.clientY,null,72,!1),I=D>=0?c[D]:void 0,z=I?l.get(I):void 0;if(z&&z!==e.focusedSectionId()&&f(z))return}if(!e.focusedSectionId()){C<0&&(C=B(_.clientX,_.clientY,null,42,!1));let D=C>=0?c[C]:void 0,I=D?l.get(D):void 0;if(I&&f(I))return}if(C<0||C>=c.length){e.selection().size&&(p([]),i.onViewTargetChange?.(null));return}let O=c[C],P=ge[Math.round(r.seats.iState[C]??0)]??"available";if(P!=="available"&&P!=="selected"){i.onSeatInspect?.(O,P);return}if(e.selection().has(O)&&e.selection().size===1){p([]),i.onViewTargetChange?.(null);return}p([O]),h(O),s.seatPicked(O,l.get(O)),i.onSeatPick?.(O)}}}var an=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 f=0;f<this.count;f++){let p=t[f*3],h=t[f*3+2];p<n&&(n=p),p>o&&(o=p),h<r&&(r=h),h>i&&(i=h)}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=f=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-r)/this.cell)))*this.cols+p};for(let f=0;f<this.count;f++)l[u(f)+1]++;for(let f=0;f<c;f++)l[f+1]+=l[f];let d=new Int32Array(this.count),m=l.slice(0,c);for(let f=0;f<this.count;f++)d[m[u(f)]++]=f;this.cellStart=l,this.cellItems=d}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),u=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(r/this.cell)+1,m=this.iPosition,f=0;for(let p=0;p<=d&&f<s;p++){let h=u-p,b=u+p,y=l-p,g=l+p;for(let x=h;x<=b&&f<s;x++){if(x<0||x>=this.rows)continue;let w=x===h||x===b;for(let R=y;R<=g&&f<s;R++){if(!w&&R!==y&&R!==g){R=g-1;continue}if(R<0||R>=this.cols)continue;let S=x*this.cols+R;for(let F=i[S],B=i[S+1];F<B&&f<s;F++){let N=a[F],H=m[N*3]-t,_=m[N*3+2]-n;H*H+_*_<=c&&(o[f++]=N)}}}}return f}};var sn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Lt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new an(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)<yn)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>bn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,bn,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)}};var cn=require("ogl");function mi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,d=0,m=-1,f=(R,S,F=28)=>{o.camera.position.set(R[0],R[1],R[2]),o.camera.lookAt(new cn.Vec3(S[0],S[1],S[2])),o.camera.fov=F,o.camera.updateProjectionMatrix()},p=document.createElement("button");p.className="sl-3d-overview-control sl-3d-icon-control",p.type="button",p.textContent="\u2302",p.setAttribute("aria-label","Fit the active level or whole venue in view"),p.dataset.tooltip="Fit view",Object.assign(p.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 h=()=>{p.textContent="\u2302"};h();let b=R=>{m=R;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=R,S.solidProgram.uniforms.uFocusFloor.value=R,S.chairProgram.uniforms.uFocusFloor.value=R),e.showSectionSeatLabels(null)},y=()=>{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(),p.style.display="",c.setVisible(!0),e.setFrozen(!1);let R=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!R),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),R){let S=R.focalWorld[0]-R.center[0],F=R.focalWorld[2]-R.center[2],B=Math.hypot(S,F)>R.radius*.12?Math.atan2(S,F):l,N={center:R.center,radius:R.radius,box:R.box},H={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(N,!1,B,!1,H):o.frameSoft(N,B,!1,H)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{d++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=R=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(R);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(R),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),p.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let F=++d;e.removeArriveChip();let{eye:B,focal:N}=e.resolvedSeatViewPose(R,S),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],_=zn(H,B,N,n.bounds.center,n.bounds.radius),M=r.arriveAtSeatEye?B:_.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,A=[_.waypoints[0],_.waypoints[1],M];if(c.setVisible(!1),e.reducedMotion())return f(M,N,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(R,F),Promise.resolve();let C=new cn.Quat().copy(o.camera.quaternion),O=$r(o.camera,M,N);return s.requestRender(),i.start(A,C,O,2500,v).then(()=>{e.isDisposed()||F!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(N),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(R,F))})},w=R=>{let S=n.sections.find(H=>H.id===R);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==S.floorIndex&&b(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(R);let F=S.focalWorld[0]-S.center[0],B=S.focalWorld[2]-S.center[2],N=Math.hypot(F,B)>S.radius*.12?Math.atan2(F,B):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,N),r.onSectionFocusChange?.(R),s.requestRender(),!0};return p.addEventListener("click",y),{overviewChip:p,layoutOverviewChip:h,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:f,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:w}}var rc={};function fi(e){let t=performance.now();return{model:ct(e),buildMs:performance.now()-t,source:"main"}}function pi(e){return typeof Worker>"u"?Promise.resolve(fi(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",rc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(fi(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 ic=Math.PI/180,ac=6,sc=500;function cc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ct(t),i=new rn(n.onAnalytics),a=new Array(o.seats.count);for(let[U,j]of o.seats.idToIndex)a[j]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let j=c.get(U.rowId);j?j.push(U.id):c.set(U.rowId,[U.id])}let l=new Map;for(let U of t.seats)l.set(U.id,U.sectionId);let u=t.doc.floors?.some(j=>(j.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&((j.height??0)>0||(j.rake??0)>0)),d=null,m=null,f=!1,p=!1,h=!1,b=new Map,y=null,g=null,x=null,w=new Map,R=null,S=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},F=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},B=!1,N=()=>B?me.focusedFloor():-1,H=()=>{d=zr(A.gl,o),m=new Zt(A.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),A.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=Fe*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=N(),d.solidProgram.uniforms.uFocusFloor.value=N(),d.chairProgram.uniforms.uFocusFloor.value=N(),M.forceRegather()},_=!1,M=new sn({model:o,orbit:()=>C,gpu:()=>d}),v=U=>M.setDetailEnabled(U),A=new Ft(e,{onContextLost:()=>{h||i.contextLost(),f=!0,Y.stop(),d=null,m=null},onContextRestored:()=>{H(),f=!1,h||i.contextRestored(),Y.requestRender()}}),C=new Dt(A.gl,A.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());C.setAspect(A.aspect);let O=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(O&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],j=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,j)>o.bounds.radius*.12?Math.atan2(U,j):void 0})(),D=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,P,n.portraitOverviewCrop===!0,D);let z=new Qt(C.camera),E=ci(e),k=new Kt(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),G=o.labels,X=()=>lr(G,o.floors.length,N());k.setLabels(X());let V=null,T=U=>{if(V=U,k.setForcedDense(!!U),!U){k.setLabels(X());return}let j=t.seats.filter(q=>q.sectionId===U),W=new Set(j.map(q=>q.id)),ne=new Set(j.map(q=>q.rowId)),re=new Set(b.keys()),oe=new Set(j.filter(q=>re.has(q.id)).map(q=>q.id)),ce=X().filter(q=>q.kind!=="row"&&q.kind!=="seat"||(q.kind==="row"?ne.has(q.id.slice(4)):W.has(q.id.slice(5))&&(oe.size===0||oe.has(q.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){k.setLabels(ce);return}let ue=oe.size?j.filter(q=>oe.has(q.id)):j,Ye=new Set(ue.map(q=>`seat:${q.id}`)),Oe=ue.flatMap(q=>{let fe=o.seats.idToIndex.get(q.id);if(fe===void 0)return[];let Me=fe*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Me],o.seats.iPosition[Me+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[Me+2]]}]});k.setLabels([...ce.filter(q=>!Ye.has(q.id)),...Oe])};H();let Y=new kt(U=>{if(f||!d||p)return!1;let W=z.active?z.update(performance.now()):C.update(),ne=N()>=0?o.floors[N()]:null,re=ne?.radius??o.bounds.radius,oe=oo(C.currentDistance,re),ce=_?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(ce);let ue=ne?.center??o.renderBounds.center,Ye=ne?.radius??o.renderBounds.radius,Oe=(Se,ft)=>Math.hypot(C.camera.position.x-Se[0],C.camera.position.y-Se[1],C.camera.position.z-Se[2])<=ft*(M.detailVisible?1.8:1.55),q=Oe(ue,Ye);if(!q&&V){let Se=o.sections.find(ft=>ft.id===V);Se&&(q=Oe(Se.center,Math.max(12,Se.radius*2)))}M.detailVisible=q;let fe=d.seatProgram.uniforms;fe.uSeatScale.value=oe.scale,fe.uSeatFade.value=oe.fade;let Me=!!ne&&ro(ne.seatCount,A.canvas.clientWidth||1,A.canvas.clientHeight||1),Rt=io(o.seats.count,re,C.currentDistance,C.camera.fov,A.canvas.clientHeight||1),mt=M.detailVisible||Me||Rt?1:0,It=M.detailVisible||N()>=0||o.floors.length>1?1:0;return M.ease(U,mt,It),fe.uSeatDetail.value=M.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=M.structureDetailMix,fe.uMinPixels.value=oe.minPixels,fe.uPixelToWorld.value=2*Math.tan(C.camera.fov*ic/2)/Math.max(1,A.pixelHeight),M.update(M.detailVisible),A.renderer.render({scene:d.background,clear:!0}),A.renderer.render({scene:d.main,camera:C.camera,clear:!1}),k.update(C.camera.projectionViewMatrix,A.canvas.clientWidth||1,A.canvas.clientHeight||1,C.currentDistance,re,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||M.seatDetailMix!==mt||M.structureDetailMix!==It}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>un.resize()):null;K?.observe(e);let J=U=>{let j=re=>{let oe=o.seats.idToIndex.get(re);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:ne}=jr(b,U,j);if(b=ne,k.setSelectedSeatIds(b.keys()),V&&T(V),W.length){let re=Pn(o.seats,W);d&&d.uploadSeatStateRuns(re),Y.requestRender()}},Z=()=>R!==null?R:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=8,te=U=>{if(!n.getSeatView)return null;let j=w.get(U);if(!j)for(j=Promise.resolve(n.getSeatView(U)),w.set(U,j),j.catch(()=>{w.get(U)===j&&w.delete(U)});w.size>$;){let W=w.keys().next().value;if(W===void 0)break;w.delete(W)}return j},Ue=(U,j)=>{let W=s.get(U),ne=Math.max(0,Math.round(o.seats.iFloor[j]??0)),re=t.doc.floors?.[ne],oe=o.floors[ne],ce=re?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/L,y:oe.focalWorld[2]/L}:ce,Ye=W?.focalPoint?{x:W.focalPoint.x+ue.x-ce.x,y:W.focalPoint.y+ue.y-ce.y}:ue,Oe=[o.seats.iPosition[j*3],o.seats.iPosition[j*3+1],o.seats.iPosition[j*3+2]];return Zr(Oe,Ye,re?.baseHeightM??0,W?.eyeHeightM)},je=()=>(e.clientWidth||A.canvas.clientWidth)<=520,Re,Ie=li({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:je,isDisposed:()=>h,flightGen:()=>me.flightGen(),flyToSeat:U=>jn(U),openPanorama:(U,j,W)=>Re(U,j,W)}),Ee=Ie.show,xe=Ie.remove,ve=Ie.layout,ie=ui({container:e,orbit:C,isNarrow:je}),Je=ie.element,Le=ie.setNavigationMode,Te=ie.setSeatViewLocked,Xe=ie.layout,dt=ie.utilityControls,me=mi({container:e,model:o,opts:n,orbit:C,cinematic:z,analytics:i,loop:Y,labelOverlay:k,stageAzimuth:P,overviewFraming:D,gpu:()=>d,isDisposed:()=>h,panorama:()=>y,setPanorama:U=>{y=U},setPanoramaSphereVisible:U=>{_=U},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:U=>{g=U},setFrozen:U=>{p=U},restorePanoramaLayer:F,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:T,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:Le,showArriveChip:Ee,removeArriveChip:xe});B=!0;let ln=me.overviewChip,hi=me.layoutOverviewChip,bi=me.applyFloorFocus,yi=me.focusOverview,Un=me.cancelFlight,jn=me.flyToSeat,Xn=me.focusSectionCamera;dt.appendChild(ln),Re=ai({container:e,model:o,opts:n,analytics:i,orbit:C,loop:Y,seatsById:s,ensureSeatView:te,resolvedSeatViewPose:Ue,gpu:()=>d,gl:A.gl,isContextLost:()=>f,isDisposed:()=>h,flightGen:()=>me.flightGen(),setPanorama:U=>{y=U},getLoadAbort:()=>g,setLoadAbort:U=>{g=U},setPanoramaSphereVisible:U=>{_=U},setFrozen:U=>{p=U},raisePanoramaLayer:S,restorePanoramaLayer:F,getOverviewChip:()=>ln,labelOverlay:k,reducedMotion:Z,removeArriveChip:xe,showArriveChip:Ee});let _e=di({glctx:A,orbit:C,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:ac,tapMs:sc,gpu:()=>d,pick:()=>m,seatViewLocked:()=>ie.seatViewLocked(),focusedSectionId:()=>V,selection:()=>b,cancelFlight:Un,focusSectionCamera:Xn,setSelection:J,ensureSeatView:te});A.canvas.addEventListener("pointerdown",_e.onDown),A.canvas.addEventListener("pointermove",_e.onMove),A.canvas.addEventListener("pointerup",_e.onUp),A.canvas.addEventListener("pointercancel",_e.onUp),Y.requestRender();let un={setAvailability(U){let j=Ur(b,U),W=Pn(o.seats,j);W.length&&d&&d.uploadSeatStateRuns(W),Y.requestRender()},setSelection:J,flyToSeat:jn,focusOverview:yi,resize(){let{width:U,height:j}=A.resize();C.setAspect(U/Math.max(1,j)),ve(),Xe(),hi(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=Y.stats(),j=A.canvas.clientWidth||1,W=A.canvas.clientHeight||1,ne=o.bounds.center,re=Ve(C.camera.projectionViewMatrix,[ne[0],o.bounds.box.min[1],ne[2]],j,W),oe=Ve(C.camera.projectionViewMatrix,[ne[0],o.bounds.box.max[1],ne[2]],j,W),ce=o.bounds.box,ue=[ce.min[0],ce.max[0]].flatMap(q=>[ce.min[1],ce.max[1]].flatMap(fe=>[ce.min[2],ce.max[2]].map(Me=>Ve(C.camera.projectionViewMatrix,[q,fe,Me],j,W)))).filter(q=>Number.isFinite(q.x)&&Number.isFinite(q.y)&&Number.isFinite(q.depth)),Ye=ue.length?(()=>{let q=Math.min(...ue.map(We=>We.x)),fe=Math.max(...ue.map(We=>We.x)),Me=Math.min(...ue.map(We=>We.y)),Rt=Math.max(...ue.map(We=>We.y)),mt=Math.max(0,q),It=Math.min(j,fe),Se=Math.max(0,Me),ft=Math.min(W,Rt),Et=Math.max(0,It-mt),dn=Math.max(0,ft-Se);return{box:{x:mt,y:Se,width:Et,height:dn},horizontalFillRatio:Et/j,verticalFillRatio:dn/W,visibleAreaRatio:Et*dn/(j*W),clippedEdges:[...Me<0?["top"]:[],...fe>j?["right"]:[],...Rt>W?["bottom"]:[],...q<0?["left"]:[]]}})():void 0,Oe=String(A.gl.getParameter(A.gl.VERSION)??"");return{viewport:{width:j,height:W},context:{webgl2:/webgl\s*2/i.test(Oe),lost:f},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.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:re.visible&&oe.visible?Math.abs(re.y-oe.y):0},labels:k.qualityEvidence(),framing:Ye}},getQualityReport(){return qt(un.getQualityEvidence())},loseContextForTest(){A.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some(W=>W.index===U))return!1;let j=U??-1;if(v(U!==null),Te(!1),bi(j),Le("orbit"),U===null)z.cancel(),Z()?C.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,D):C.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,D);else{let W=o.floors[U];if(W.seatCount>0){z.cancel();let ne=W.focalWorld[0]-W.center[0],re=W.focalWorld[2]-W.center[2],oe=Math.hypot(ne,re)>W.radius*.12?Math.atan2(ne,re):P;C.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(U){let j=o.zones.find(oe=>oe.id===U);if(!j||j.seatCount===0)return!1;v(!1),Te(!1),z.cancel(),Le("orbit"),T(null),n.onSectionFocusChange?.(null);let W=j.focalWorld[0]-j.center[0],ne=j.focalWorld[2]-j.center[2],re=Math.hypot(W,ne)>j.radius*.12?Math.atan2(W,ne):void 0;return C.frame({center:j.center,radius:j.radius*1.25},!1,re),Y.requestRender(),!0},sections(){return o.sections},focusSection(U){return Xn(U)},rows(U){return U?o.rows.filter(j=>j.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(j=>j.rowId===U).map(j=>({id:j.id,label:j.displayLabel||j.label}))},focusRow(U){let j=o.rows.find(W=>W.id===U);return!j||j.seatCount===0?!1:(v(!0),Te(!1),z.cancel(),Le("pan"),j.sectionId&&(T(j.sectionId),n.onSectionFocusChange?.(j.sectionId)),C.frame({center:j.center,radius:Math.max(2.5,j.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(U){R=U},dispose(){h=!0,xe(),ln.remove(),Je.remove(),Un(),Y.stop(),k.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),F(),E(),A.canvas.removeEventListener("pointerdown",_e.onDown),A.canvas.removeEventListener("pointermove",_e.onMove),A.canvas.removeEventListener("pointerup",_e.onUp),A.canvas.removeEventListener("pointercancel",_e.onUp),C.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,A.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),un}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|