@seatlayer/core 0.99.0 → 0.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{categoryInventory-DdJdJ4Og.d.ts → categoryInventory-DZ5IcDOy.d.ts} +1 -1
  2. package/dist/{categoryInventory-DuOez0-4.d.cts → categoryInventory-H77A_8pF.d.cts} +1 -1
  3. package/dist/{chunk-KFVUBZMK.js → chunk-2RNZOV5I.js} +1 -1
  4. package/dist/{chunk-HYEZPOZU.js → chunk-52XO3LA7.js} +1 -1
  5. package/dist/{chunk-VWT44HBR.js → chunk-5HXTEMRE.js} +1 -1
  6. package/dist/{chunk-UIMDB6GZ.js → chunk-5PFYIYM5.js} +1 -1
  7. package/dist/chunk-FLZKBXHA.js +1 -0
  8. package/dist/{chunk-23OTKCJU.js → chunk-JK3DUFRX.js} +1 -1
  9. package/dist/chunk-NO6OLVTT.js +1 -0
  10. package/dist/core/chart-ops/index.cjs +1 -1
  11. package/dist/core/chart-ops/index.d.cts +4 -4
  12. package/dist/core/chart-ops/index.d.ts +4 -4
  13. package/dist/core/chart-ops/index.js +1 -1
  14. package/dist/core/inventory/index.d.cts +4 -4
  15. package/dist/core/inventory/index.d.ts +4 -4
  16. package/dist/core/inventory/index.js +1 -1
  17. package/dist/core/layout/index.d.cts +5 -5
  18. package/dist/core/layout/index.d.ts +5 -5
  19. package/dist/core/quality/index.d.cts +3 -3
  20. package/dist/core/quality/index.d.ts +3 -3
  21. package/dist/core/quality/index.js +1 -1
  22. package/dist/core/render-assets/index.d.cts +2 -2
  23. package/dist/core/render-assets/index.d.ts +2 -2
  24. package/dist/core/seatConfidence.d.cts +1 -1
  25. package/dist/core/seatConfidence.d.ts +1 -1
  26. package/dist/core/sections/index.d.cts +5 -5
  27. package/dist/core/sections/index.d.ts +5 -5
  28. package/dist/{eventConfigurations-BISNREZL.d.ts → eventConfigurations-B6aS6c-_.d.ts} +1 -1
  29. package/dist/{eventConfigurations-DYn5XP3J.d.cts → eventConfigurations-ClFqXQi9.d.cts} +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.cts +18 -13
  32. package/dist/index.d.ts +18 -13
  33. package/dist/index.js +1 -1
  34. package/dist/{labeling-owTTG6e0.d.cts → labeling-ByEZkLee.d.cts} +1 -1
  35. package/dist/{labeling-CzuSxAkr.d.ts → labeling-CP3GhUrf.d.ts} +1 -1
  36. package/dist/{renderedQuality-Bl1Kq_XO.d.cts → renderedQuality--H0toc-2.d.cts} +1 -1
  37. package/dist/{renderedQuality-BMSbVkwu.d.ts → renderedQuality-Bo4k99GE.d.ts} +1 -1
  38. package/dist/{renderer-njHDbIqI.d.ts → renderer-BPhSZUGh.d.cts} +12 -1
  39. package/dist/{renderer-Ccv8ZDZS.d.cts → renderer-CWbam_zr.d.ts} +12 -1
  40. package/dist/{seatTypeIcons-QwEebl3k.d.cts → seatTypeIcons-B2tvcQ0H.d.cts} +1 -1
  41. package/dist/{seatTypeIcons-dy3XQVWN.d.ts → seatTypeIcons-CSt1isBY.d.ts} +1 -1
  42. package/dist/{sections-DSIfnBJY.d.cts → sections-C_AKwOIh.d.cts} +1 -1
  43. package/dist/{sections-C8VTe6BN.d.ts → sections-JHox6Lsw.d.ts} +1 -1
  44. package/dist/{segmentedRowModel-CDvvJJ4-.d.cts → segmentedRowModel-CZ0Ciea-.d.cts} +1 -1
  45. package/dist/{segmentedRowModel-I8eYUQft.d.ts → segmentedRowModel-DQO0vHR1.d.ts} +1 -1
  46. package/dist/{tableSizing-BLtQ-KV0.d.ts → tableSizing-ClgbhNks.d.ts} +3 -3
  47. package/dist/{tableSizing-CB8g2Fs0.d.cts → tableSizing-Cp5T_6Lw.d.cts} +3 -3
  48. package/dist/{ticketRestrictions-BvlWLw10.d.cts → ticketRestrictions-BHNbxzFT.d.cts} +2 -2
  49. package/dist/{ticketRestrictions-DUjN2bZn.d.ts → ticketRestrictions-DUdzkp4F.d.ts} +2 -2
  50. package/dist/{types-DWx32xXH.d.cts → types-5AlKCD4j.d.cts} +17 -0
  51. package/dist/{types-DWx32xXH.d.ts → types-5AlKCD4j.d.ts} +17 -0
  52. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  53. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  54. package/dist/view3d/index.cjs +127 -53
  55. package/dist/view3d/index.d.cts +34 -5
  56. package/dist/view3d/index.d.ts +34 -5
  57. package/dist/view3d/index.js +125 -51
  58. package/dist/view3d/scene/scene.worker.cjs +1 -1
  59. package/dist/view3d/scene/scene.worker.js +1 -1
  60. package/package.json +1 -1
  61. package/dist/chunk-K22SISYC.js +0 -1
  62. package/dist/chunk-QJXSZT3H.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var Wu=Object.create;var zn=Object.defineProperty;var Yu=Object.getOwnPropertyDescriptor;var Ku=Object.getOwnPropertyNames;var qu=Object.getPrototypeOf,$u=Object.prototype.hasOwnProperty;var cn=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var wi=(e,t)=>{for(var n in t)zn(e,n,{get:t[n],enumerable:!0})},Pi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ku(t))!$u.call(e,r)&&r!==n&&zn(e,r,{get:()=>t[r],enumerable:!(o=Yu(t,r))||o.enumerable});return e};var it=(e,t,n)=>(n=e!=null?Wu(qu(e)):{},Pi(t||!e||!e.__esModule?zn(n,"default",{value:e,enumerable:!0}):n,e)),Zu=e=>Pi(zn({},"__esModule",{value:!0}),e);function qy(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function $y(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function To(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:$y(t?.deviceMemory)}}function ko(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 o={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...o,reason:"save-data"};let r=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,l)=>c.width*c.height-l.width*l.height);if(!r.length)return{...o,upgradeUrl:e.url,reason:"progressive"};let i=r.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...o,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||qy(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...o,reason:"memory-limit"};let s=a[a.length-1];return{...o,upgradeUrl:s.url,reason:"progressive"}}function au(){return new DOMException("Panorama image load aborted","AbortError")}function Dn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(au());return}let r=new Image;r.crossOrigin="anonymous";let i=!1,a=()=>{r.onload=null,r.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?o(l):n(r))},c=()=>{r.src="",s(au())};r.onload=()=>{(typeof r.decode=="function"?r.decode():Promise.resolve()).then(()=>s(),()=>s())},r.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),r.src=e})}function Lo(e){let t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(o)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var ai=cn(()=>{"use strict"});function cu(e){if(e.generated||e.mediaKind==="model")return"built from the chart";let t=e.mediaKind==="demo-render",n=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":e.coverage==="floor-representative"?"AI-generated representative floor 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==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",o=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,o?`${t?"created":"captured"} ${o}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function si(e){return Math.max(Zy,Math.min(Qy,e))}function Jy(e,t,n){let o=(.5+e/360)*n;return t/2-o}function e0(e,t=Oo){return e*(180/t)}function su(e,t,n){return(e-t)/2+Fo(n,t)}function Fo(e,t){let n=rt/180*t;return Math.max(-n,Math.min(n,e))}function t0(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function ci(e){return e||(t0()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function lu(e,t,n={}){let o=n.fadeMs??400,r=t.initialBearingDeg??0,i=ko(t,To()),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 ${o}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 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"}),c.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:"calc(12px + var(--sl-3d-top-inset, 0px))",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 h=document.createElement("div");h.textContent=ci(n.lookAroundHint),Object.assign(h.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(h),e.appendChild(c),m.focus({preventScroll:!0});let d=0,f=0,p=0,b=0,y=Oo,g=()=>{let V=c.clientHeight||1,z=c.clientWidth||1,q=I.naturalWidth||z*2,$=I.naturalHeight||V,re=d>0?(z/2-p)/d:0,Q=f>0?b/f:0;f=e0(V,y),d=f*(q/$),u.style.backgroundSize=`${d}px ${f}px`,M?p=z/2-re*d:(p=Jy(r,z,d),b=Fo((t.initialPitchDeg??0)/180*f,f),M=!0),b=Fo(Q*f,f),u.style.backgroundPosition=`${p}px ${su(V,f,b)}px`},M=!1,P=()=>{let V=c.clientHeight||1;b=Fo(b,f),u.style.backgroundPosition=`${p}px ${su(V,f,b)}px`},I=new Image;I.onload=g,I.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=Lo(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(z=>!z||a.signal.aborted?null:Dn(z,a.signal).then(q=>({full:q,url:z}))).then(z=>{z&&(F||a.signal.aborted||(I=z.full,u.style.backgroundImage=`url("${z.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let x=!1,v=0,w=0,R=0,T=new Map,O=()=>{let[V,z]=[...T.values()];return V&&z?Math.hypot(V.x-z.x,V.y-z.y):0},C=V=>{let z=si(V);z!==y&&(y=z,g())},A=V=>{T.set(V.pointerId,{x:V.clientX,y:V.clientY}),x=T.size===1,v=V.clientX,w=V.clientY,T.size===2&&(R=O()),u.style.cursor="grabbing";try{u.setPointerCapture?.(V.pointerId)}catch{}},_=V=>{if(T.has(V.pointerId)){if(T.set(V.pointerId,{x:V.clientX,y:V.clientY}),T.size>=2){let z=O();R>0&&z>0&&C(y*(R/z)),R=z,x=!1;return}x&&(p+=V.clientX-v,b+=V.clientY-w,v=V.clientX,w=V.clientY,P())}},L=V=>{T.delete(V.pointerId),R=T.size===2?O():0;let z=T.values().next().value;x=T.size===1,z?(v=z.x,w=z.y):u.style.cursor="grab";try{u.releasePointerCapture?.(V.pointerId)}catch{}},N=V=>{V.preventDefault(),C(y+V.deltaY*.04)};u.addEventListener("pointerdown",A),u.addEventListener("pointermove",_),u.addEventListener("pointerup",L),u.addEventListener("pointercancel",L),u.addEventListener("wheel",N,{passive:!1});let k=!1,F=!1,H=0,B=()=>{u.removeEventListener("pointerdown",A),u.removeEventListener("pointermove",_),u.removeEventListener("pointerup",L),u.removeEventListener("pointercancel",L),u.removeEventListener("wheel",N),window.removeEventListener("keydown",j)},D=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),H&&(window.clearTimeout(H),H=0),B(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},G=()=>{if(k)return;k=!0,c.style.opacity="0";let V=()=>{H=0,!F&&(D(),n.onClose?.())};H=window.setTimeout(V,o)},j=V=>{if(V.key==="Tab"){V.preventDefault(),m.focus({preventScroll:!0});return}if(V.key==="Escape"){V.stopPropagation(),G();return}if(V.key==="ArrowLeft"||V.key==="ArrowRight")p+=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==="="){C(y-5),V.preventDefault();return}else if(V.key==="-"){C(y+5),V.preventDefault();return}else return;V.preventDefault(),P()};return window.addEventListener("keydown",j),m.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){k=!0,F=!0,D()}}}var Oo,Zy,Qy,rt,Do=cn(()=>{"use strict";ai();Oo=70,Zy=35,Qy=90;rt=35});function i0(e=n0,t=o0,n=r0){let o=e+1,r=t+1,i=o*r,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<r;u++){let m=u/t,h=m*Math.PI,d=Math.sin(h),f=Math.cos(h);for(let p=0;p<o;p++){let b=p/e,y=(b-.5)*Math.PI*2,g=u*o+p;a[g*3]=n*d*Math.sin(y),a[g*3+1]=n*f,a[g*3+2]=-n*d*Math.cos(y),s[g*2]=b,s[g*2+1]=m}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let m=0;m<e;m++){let h=u*o+m,d=h+o;c[l++]=h,c[l++]=d,c[l++]=h+1,c[l++]=h+1,c[l++]=d,c[l++]=d+1}return{position:a,uv:s,index:c}}function uu(e,t){let n=e*Math.PI/180,o=t*Math.PI/180,r=Math.cos(o);return[r*Math.sin(n),Math.sin(o),-r*Math.cos(n)]}function mu(e,t){let{position:n,uv:o,index:r}=i0(),i=new wt.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:r}}),a=new wt.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new wt.Program(e,{vertex:a0,fragment:s0,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new wt.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 wt,n0,o0,r0,a0,s0,fu=cn(()=>{"use strict";wt=require("ogl"),n0=64,o0=32,r0=500;a0=`#version 300 es
1
+ "use strict";var Sm=Object.create;var Qn=Object.defineProperty;var wm=Object.getOwnPropertyDescriptor;var Pm=Object.getOwnPropertyNames;var Im=Object.getPrototypeOf,Am=Object.prototype.hasOwnProperty;var yn=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Ki=(e,t)=>{for(var n in t)Qn(e,n,{get:t[n],enumerable:!0})},$i=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pm(t))!Am.call(e,i)&&i!==n&&Qn(e,i,{get:()=>t[i],enumerable:!(o=wm(t,i))||o.enumerable});return e};var nt=(e,t,n)=>(n=e!=null?Sm(Im(e)):{},$i(t||!e||!e.__esModule?Qn(n,"default",{value:e,enumerable:!0}):n,e)),Rm=e=>$i(Qn({},"__esModule",{value:!0}),e);function fg(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function dg(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function zo(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:dg(t?.deviceMemory)}}function Uo(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 o={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...o,reason:"save-data"};let i=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,m)=>c.width*c.height-m.width*m.height);if(!i.length)return{...o,upgradeUrl:e.url,reason:"progressive"};let r=i.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!r.length)return{...o,reason:"texture-limit"};let a=r.filter(c=>t.maxDecodedBytes===void 0||fg(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...o,reason:"memory-limit"};let s=a[a.length-1];return{...o,upgradeUrl:s.url,reason:"progressive"}}function Nu(){return new DOMException("Panorama image load aborted","AbortError")}function Yn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(Nu());return}let i=new Image;i.crossOrigin="anonymous";let r=!1,a=()=>{i.onload=null,i.onerror=null,t?.removeEventListener("abort",c)},s=m=>{r||(r=!0,a(),m?o(m):n(i))},c=()=>{i.src="",s(Nu())};i.onload=()=>{(typeof i.decode=="function"?i.decode():Promise.resolve()).then(()=>s(),()=>s())},i.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),i.src=e})}function jo(e){let t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(o)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Ai=yn(()=>{"use strict"});function Vu(e){if(e.generated||e.mediaKind==="model")return"built from the chart";let t=e.mediaKind==="demo-render",n=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":e.coverage==="floor-representative"?"AI-generated representative floor 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==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",o=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,o?`${t?"created":"captured"} ${o}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Ri(e){return Math.max(hg,Math.min(pg,e))}function bg(e,t,n){let o=(.5+e/360)*n;return t/2-o}function yg(e,t=Xo){return e*(180/t)}function Bu(e,t,n){return(e-t)/2+Wo(n,t)}function Wo(e,t){let n=lt/180*t;return Math.max(-n,Math.min(n,e))}function gg(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Ei(e){return e||(gg()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function Hu(e,t,n={}){let o=n.fadeMs??400,i=t.initialBearingDeg??0,r=Uo(t,zo()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),m=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 ${o}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let l=document.createElement("div");Object.assign(l.style,{position:"absolute",inset:"0",backgroundImage:`url("${r.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(l);let u=document.createElement("button");if(u.type="button",u.setAttribute("aria-label","Close"),u.textContent="\u2715",Object.assign(u.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(u),n.disclosure){let H=document.createElement("div");H.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(H.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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(H)}let h=document.createElement("div");h.textContent=Ei(n.lookAroundHint),Object.assign(h.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(h),e.appendChild(c),u.focus({preventScroll:!0});let f=0,d=0,p=0,b=0,g=Xo,x=()=>{let H=c.clientHeight||1,U=c.clientWidth||1,q=M.naturalWidth||U*2,$=M.naturalHeight||H,ee=f>0?(U/2-p)/f:0,Q=d>0?b/d:0;d=yg(H,g),f=d*(q/$),l.style.backgroundSize=`${f}px ${d}px`,S?p=U/2-ee*f:(p=bg(i,U,f),b=Wo((t.initialPitchDeg??0)/180*d,d),S=!0),b=Wo(Q*d,d),l.style.backgroundPosition=`${p}px ${Bu(H,d,b)}px`},S=!1,I=()=>{let H=c.clientHeight||1;b=Wo(b,d),l.style.backgroundPosition=`${p}px ${Bu(H,d,b)}px`},M=new Image;M.onload=x,M.src=r.initialUrl;let y=()=>{};r.upgradeUrl&&(y=jo(()=>{(t.resolveUrl?t.resolveUrl(r.upgradeUrl):Promise.resolve(r.upgradeUrl)).then(U=>!U||a.signal.aborted?null:Yn(U,a.signal).then(q=>({full:q,url:U}))).then(U=>{U&&(G||a.signal.aborted||(M=U.full,l.style.backgroundImage=`url("${U.url}")`,x()))}).catch(()=>{})})),requestAnimationFrame(x);let P=!1,v=0,w=0,R=0,C=new Map,O=()=>{let[H,U]=[...C.values()];return H&&U?Math.hypot(H.x-U.x,H.y-U.y):0},E=H=>{let U=Ri(H);U!==g&&(g=U,x())},A=H=>{C.set(H.pointerId,{x:H.clientX,y:H.clientY}),P=C.size===1,v=H.clientX,w=H.clientY,C.size===2&&(R=O()),l.style.cursor="grabbing";try{l.setPointerCapture?.(H.pointerId)}catch{}},T=H=>{if(C.has(H.pointerId)){if(C.set(H.pointerId,{x:H.clientX,y:H.clientY}),C.size>=2){let U=O();R>0&&U>0&&E(g*(R/U)),R=U,P=!1;return}P&&(p+=H.clientX-v,b+=H.clientY-w,v=H.clientX,w=H.clientY,I())}},L=H=>{C.delete(H.pointerId),R=C.size===2?O():0;let U=C.values().next().value;P=C.size===1,U?(v=U.x,w=U.y):l.style.cursor="grab";try{l.releasePointerCapture?.(H.pointerId)}catch{}},V=H=>{H.preventDefault(),E(g+H.deltaY*.04)};l.addEventListener("pointerdown",A),l.addEventListener("pointermove",T),l.addEventListener("pointerup",L),l.addEventListener("pointercancel",L),l.addEventListener("wheel",V,{passive:!1});let F=!1,G=!1,j=0,N=()=>{l.removeEventListener("pointerdown",A),l.removeEventListener("pointermove",T),l.removeEventListener("pointerup",L),l.removeEventListener("pointercancel",L),l.removeEventListener("wheel",V),window.removeEventListener("keydown",D)},k=()=>{y(),a.abort(),n.signal?.removeEventListener("abort",s),j&&(window.clearTimeout(j),j=0),N(),c.parentNode&&c.parentNode.removeChild(c),m?.isConnected&&m.focus({preventScroll:!0})},B=()=>{if(F)return;F=!0,c.style.opacity="0";let H=()=>{j=0,!G&&(k(),n.onClose?.())};j=window.setTimeout(H,o)},D=H=>{if(H.key==="Tab"){H.preventDefault(),u.focus({preventScroll:!0});return}if(H.key==="Escape"){H.stopPropagation(),B();return}if(H.key==="ArrowLeft"||H.key==="ArrowRight")p+=H.key==="ArrowLeft"?-32:32;else if(H.key==="ArrowUp"||H.key==="ArrowDown")b+=(H.key==="ArrowUp"?4:-4)*(d/180);else if(H.key==="+"||H.key==="="){E(g-5),H.preventDefault();return}else if(H.key==="-"){E(g+5),H.preventDefault();return}else return;H.preventDefault(),I()};return window.addEventListener("keydown",D),u.addEventListener("click",B),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:B,dispose(){F=!0,G=!0,k()}}}var Xo,hg,pg,lt,Yo=yn(()=>{"use strict";Ai();Xo=70,hg=35,pg=90;lt=35});function Sg(e=xg,t=vg,n=Mg){let o=e+1,i=t+1,r=o*i,a=new Float32Array(r*3),s=new Float32Array(r*2);for(let l=0;l<i;l++){let u=l/t,h=u*Math.PI,f=Math.sin(h),d=Math.cos(h);for(let p=0;p<o;p++){let b=p/e,g=(b-.5)*Math.PI*2,x=l*o+p;a[x*3]=n*f*Math.sin(g),a[x*3+1]=n*d,a[x*3+2]=-n*f*Math.cos(g),s[x*2]=b,s[x*2+1]=u}}let c=new Uint16Array(e*t*6),m=0;for(let l=0;l<t;l++)for(let u=0;u<e;u++){let h=l*o+u,f=h+o;c[m++]=h,c[m++]=f,c[m++]=h+1,c[m++]=h+1,c[m++]=f,c[m++]=f+1}return{position:a,uv:s,index:c}}function Gu(e,t){let n=e*Math.PI/180,o=t*Math.PI/180,i=Math.cos(o);return[i*Math.sin(n),Math.sin(o),-i*Math.cos(n)]}function zu(e,t){let{position:n,uv:o,index:i}=Sg(),r=new Rt.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:i}}),a=new Rt.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Rt.Program(e,{vertex:wg,fragment:Pg,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Rt.Mesh(e,{geometry:r,program:s});return{mesh:c,setOpacity(m){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,m))},setImage(m){a.image=m,a.needsUpdate=!0},dispose(){c.setParent(null),r.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Rt,xg,vg,Mg,wg,Pg,Uu=yn(()=>{"use strict";Rt=require("ogl"),xg=64,vg=32,Mg=500;wg=`#version 300 es
2
2
  precision highp float;
3
3
  in vec3 position;
4
4
  in vec2 uv;
@@ -8,7 +8,7 @@ out vec2 vUv;
8
8
  void main() {
9
9
  vUv = uv;
10
10
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
11
- }`,s0=`#version 300 es
11
+ }`,Pg=`#version 300 es
12
12
  precision highp float;
13
13
  in vec2 vUv;
14
14
  uniform sampler2D uPano;
@@ -17,15 +17,30 @@ out vec4 fragColor;
17
17
  void main() {
18
18
  vec3 rgb = texture(uPano, vUv).rgb;
19
19
  fragColor = vec4(rgb, uOpacity);
20
- }`});async function hu(e,t,n,o={}){let r=o.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-rt,Math.min(rt,t?.initialPitchDeg??0)),s=Oo,c=!1,l=new AbortController,u=()=>l.abort();o.signal?.addEventListener("abort",u,{once:!0});let m=()=>{},h=[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 B=n.camera.position,D=n.focalWorld[0]-B.x,G=n.focalWorld[1]-B.y,j=n.focalWorld[2]-B.z,V=Math.hypot(D,j);V>.001&&(i=Math.atan2(D,-j)*180/Math.PI,a=Math.max(-rt,Math.min(rt,Math.atan2(G,V)*180/Math.PI)))}let d=null;if(t){let B=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),D=ko(t,To(B)),G;try{let j=t.resolveUrl?await t.resolveUrl(D.initialUrl):D.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");G=await Dn(j,l.signal)}catch{return o.signal?.removeEventListener("abort",u),null}try{d=mu(n.gl,G)}catch{return l.abort(),o.signal?.removeEventListener("abort",u),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),D.upgradeUrl&&(m=Lo(()=>{(t.resolveUrl?t.resolveUrl(D.upgradeUrl):Promise.resolve(D.upgradeUrl)).then(V=>!V||l.signal.aborted?null:Dn(V,l.signal)).then(V=>{V&&(c||l.signal.aborted||(d?.setImage(V),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let B=n.camera.position;d?.mesh.position.set(B.x,B.y,B.z);let[D,G,j]=uu(i,a);n.camera.lookAt([B.x+D,B.y+G,B.z+j]),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",o.seatLabel?`View from ${o.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});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"}),y.appendChild(M),o.disclosure){let B=document.createElement("div");B.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.disclosure}`,Object.assign(B.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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(B)}let P=document.createElement("div");P.textContent=ci(o.lookAroundHint),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"}),y.appendChild(P),e.appendChild(y),M.focus({preventScroll:!0});let I=!1,S=0,x=0,v=0,w=new Map,R=()=>{let[B,D]=[...w.values()];return B&&D?Math.hypot(B.x-D.x,B.y-D.y):0},T=B=>{let D=si(B);D!==s&&(s=D,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},O=B=>{B.target!==M&&(w.set(B.pointerId,{x:B.clientX,y:B.clientY}),I=w.size===1,S=B.clientX,x=B.clientY,w.size===2&&(v=R()),y.setPointerCapture?.(B.pointerId),y.style.cursor="grabbing")},C=B=>{if(w.has(B.pointerId)){if(w.set(B.pointerId,{x:B.clientX,y:B.clientY}),w.size>=2){let D=R();v>0&&D>0&&T(s*(v/D)),v=D,I=!1;return}I&&(i+=(B.clientX-S)*du,a=Math.max(-rt,Math.min(rt,a+(B.clientY-x)*du)),S=B.clientX,x=B.clientY,b())}},A=B=>{w.delete(B.pointerId),v=w.size===2?R():0;let D=w.values().next().value;I=w.size===1,D?(S=D.x,x=D.y):y.style.cursor="grab";try{y.releasePointerCapture?.(B.pointerId)}catch{}},_=B=>{B.preventDefault(),T(s+B.deltaY*.04)};y.addEventListener("pointerdown",O),y.addEventListener("pointermove",C),y.addEventListener("pointerup",A),y.addEventListener("pointercancel",A),y.addEventListener("wheel",_,{passive:!1});let L=B=>{if(!c){if(B.key==="Tab"){B.preventDefault(),M.focus({preventScroll:!0});return}if(B.key==="Escape"){B.stopPropagation(),H.close();return}if(B.key==="ArrowLeft"||B.key==="ArrowRight")i+=B.key==="ArrowLeft"?-4:4;else if(B.key==="ArrowUp"||B.key==="ArrowDown")a=Math.max(-rt,Math.min(rt,a+(B.key==="ArrowUp"?4:-4)));else if(B.key==="+"||B.key==="="){T(s-5),B.preventDefault();return}else if(B.key==="-"){T(s+5),B.preventDefault();return}else return;B.preventDefault(),b()}};window.addEventListener("keydown",L);let N=0,k=(B,D)=>{if(!d){D?.();return}let G=B===1?0:1,j=performance.now(),V=()=>{if(c)return;let z=r<=0?1:Math.min(1,(performance.now()-j)/r);d?.setOpacity(G+(B-G)*z),n.requestRender(),z<1?N=requestAnimationFrame(V):D?.()};N=requestAnimationFrame(V)};k(1);let F=()=>{c||(c=!0,m(),l.abort(),o.signal?.removeEventListener("abort",u),cancelAnimationFrame(N),y.removeEventListener("pointerdown",O),y.removeEventListener("pointermove",C),y.removeEventListener("pointerup",A),y.removeEventListener("pointercancel",A),y.removeEventListener("wheel",_),window.removeEventListener("keydown",L),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),d?.dispose(),n.camera.position.set(h[0],h[1],h[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},H={close(){if(c)return;let B=()=>{F(),o.onClose?.()};cancelAnimationFrame(N),k(0,B)},dispose:F};return M.addEventListener("click",()=>H.close()),H}var du,pu=cn(()=>{"use strict";fu();Do();Do();ai();du=.15});var bu={};wi(bu,{createOpenPanorama:()=>c0});function c0(e){let{container:t,model:n,opts:o,analytics:r,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:m,isContextLost:h,isDisposed:d,flightGen:f,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:M,raisePanoramaLayer:P,restorePanoramaLayer:I,getOverviewChip:S,labelOverlay:x,reducedMotion:v,removeArriveChip:w,showArriveChip:R}=e;return async(T,O,C)=>{b()?.abort();let A=new AbortController;y(A);let _=n.seats.idToIndex.get(T);if(_===void 0){i.syncFromCamera();return}let L=s.get(T)?.label??T,N=l(T,_),k=c(T);if(!k){A.abort(),b()===A&&y(null),i.syncFromCamera();return}M(!0),a.stop();let F;try{F=await k}catch{if(b()===A&&y(null),r.panoramaFailed(T,"source"),!d()&&C===f()){M(!1),i.resumeAfterFlight(N.focal),a.requestRender();let q=R(T,C,!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||C!==f()){A.abort(),b()===A&&y(null);return}w();let H=S(),B=()=>{A.abort(),b()===A&&y(null),p(null),g(!1),I(),H.style.display="",x.setVisible(!o.arriveAtSeatEye),M(!1),r.panoramaClosed(),i.resumeAfterFlight(N.focal),a.requestRender();let q=R(T,f());requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())},D=F.generated===!0,G=cu(F);P(),g(!D),H.style.display="none";let j=v()?0:O,V=u(),z=V&&!h()?await hu(t,D?null:F,{gl:m,scene:V.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:D?N.eye:void 0,focalWorld:N.focal},{fadeMs:j,seatLabel:L,disclosure:G,disclosurePrefix:D?"Live 3D view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:B,signal:A.signal}):null;if(d()||C!==f()){A.abort(),g(!1),b()===A&&y(null),z?.dispose(),H.style.display="",I();return}if(z)i.syncFromCamera(),x.setVisible(!1),M(!1),a.requestRender(),p(z);else if(D){I(),H.style.display="",M(!1),i.resumeAfterFlight(N.focal),a.requestRender(),p(null),g(!1),r.panoramaFailed(T,"mount");let q=R(T,f(),!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus()),b()===A&&y(null);return}else g(!1),r.panoramaFallback(T),p(lu(t,F,{fadeMs:j,seatLabel:L,disclosure:G,onClose:B,signal:A.signal,lookAroundHint:o.lookAroundHint}));r.panoramaOpened()}}var yu=cn(()=>{"use strict";Do();pu()});var w0={};wi(w0,{VENUE3D_QUALITY_REPORT_VERSION:()=>ll,autoVenue3d:()=>vo,buildSceneModel:()=>Qt,estimateVenue3D:()=>Bn,inspectVenue3DQualityEvidence:()=>Po,mountVenue3D:()=>S0,prepareVenue3D:()=>ku,prepareVenue3DFromChart:()=>Lu});module.exports=Zu(w0);function Ii(e,t,n){let o=Math.floor(t.length/3),r=n.center[0],i=n.center[2];if(o>0){let c=Math.max(1,Math.floor(o/4e3)),l=0,u=0,m=0;for(let h=0;h<o;h+=c)l+=t[h*3],u+=t[h*3+2],m++;r=l/m,i=u/m}let a=e[0]-r,s=e[2]-i;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var Fu=require("ogl");function Ri(e,t,n="#ffffff"){let{iPosition:o,count:r}=t.seats;if(r<2||typeof document>"u")return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let I=0;I<r;I++){let S=o[I*3],x=o[I*3+2];S<i&&(i=S),S>a&&(a=S),x<s&&(s=x),x>c&&(c=x)}for(let I of t.stages)i=Math.min(i,I.cx-I.halfX),a=Math.max(a,I.cx+I.halfX),s=Math.min(s,I.cz-I.halfZ),c=Math.max(c,I.cz+I.halfZ);let l=Math.min(130/Math.max(.001,a-i),86/Math.max(.001,c-s)),u=(148-(a-i)*l)/2,m=(104-(c-s)*l)/2,h=I=>u+(I-i)*l,d=I=>m+(I-s)*l,f=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),p=document.createElement("canvas");p.width=Math.round(148*f),p.height=Math.round(104*f),p.setAttribute("aria-hidden","true"),p.setAttribute("data-seat-locator","");let b=p.style;b.position="absolute",b.left="12px",b.bottom="12px",b.width="148px",b.height="104px",b.borderRadius="10px",b.background="rgba(10,14,22,.72)",b.border="1px solid rgba(255,255,255,.14)",b.boxShadow="0 4px 14px rgba(0,0,0,.35)",b.pointerEvents="none",b.zIndex="3",b.display="none",e.appendChild(p);let y=document.createElement("canvas");y.width=p.width,y.height=p.height;let g=y.getContext("2d");if(g){g.scale(f,f),g.fillStyle="rgba(214,222,234,.28)";let I=Math.max(1,Math.ceil(r/6e3));for(let S=0;S<r;S+=I)g.fillRect(h(o[S*3])-.6,d(o[S*3+2])-.6,1.2,1.2);g.fillStyle="rgba(236,240,246,.16)",g.strokeStyle="rgba(236,240,246,.55)",g.lineWidth=1;for(let S of t.stages){let x=h(S.cx-S.halfX),v=d(S.cz-S.halfZ),w=S.halfX*2*l,R=S.halfZ*2*l;g.fillRect(x,v,w,R),g.strokeRect(x+.5,v+.5,Math.max(0,w-1),Math.max(0,R-1))}}let M=p.getContext("2d"),P="";return{el:p,update(I,S){if(!I||!M||e.clientWidth>0&&e.clientWidth<560){b.display!=="none"&&(b.display="none"),P="";return}let x=h(I[0]),v=d(I[2]),w=S?Math.atan2(S[2],S[0]):0,R=`${x.toFixed(1)},${v.toFixed(1)},${w.toFixed(2)}`;if(R!==P){if(P=R,b.display="block",M.setTransform(1,0,0,1,0,0),M.clearRect(0,0,p.width,p.height),M.drawImage(y,0,0),M.setTransform(f,0,0,f,0,0),S){let T=M.createRadialGradient(x,v,0,x,v,26);T.addColorStop(0,"rgba(255,255,255,.55)"),T.addColorStop(1,"rgba(255,255,255,0)"),M.fillStyle=T,M.beginPath(),M.moveTo(x,v),M.arc(x,v,26,w-.5,w+.5),M.closePath(),M.fill()}M.fillStyle=n,M.strokeStyle="rgba(10,14,22,.9)",M.lineWidth=1.5,M.beginPath(),M.arc(x,v,3.6,0,Math.PI*2),M.fill(),M.stroke()}},dispose(){p.remove()}}}var Me={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Qu=.44,Ju=.15,Ai=.3,em=.24;function Ei(e){return e===void 0||!Number.isFinite(e)||e<=0?em:Math.min(Ai,Math.max(Ju,e*Qu))}var un=.21,tm=.05,qo=.45,ft=qo+tm,mn=.92,ln=.66,$o=1.205,Ci=-.23,_i=.38,nm=[{part:Me.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Me.pad,min:[-1,.36,-.95],max:[1,qo,1]},{part:Me.back,min:[-1,ft,-1],max:[1,mn,-.72]},{part:Me.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Me.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Me.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Me.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Me.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Me.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Me.leg,min:[.62,0,.48],max:[.82,.37,.7]}],om=[{part:Me.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Me.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Me.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Me.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Me.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],rm=[{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 Ti(){let e=[],t=[],n=[],o=[],r=(L,N,k)=>{let F=n.length,[H,B,D]=L,G=[B[0]-H[0],B[1]-H[1],B[2]-H[2]],j=[D[0]-H[0],D[1]-H[1],D[2]-H[2]],V=G[1]*j[2]-G[2]*j[1],z=G[2]*j[0]-G[0]*j[2],q=G[0]*j[1]-G[1]*j[0],$=Math.hypot(V,z,q);$>1e-9?(V/=$,z/=$,q/=$):[V,z,q]=N,V*N[0]+z*N[1]+q*N[2]<0&&(V=-V,z=-z,q=-q);for(let re of L)e.push(...re),t.push(V,z,q),n.push(k);o.push(F,F+1,F+2,F,F+2,F+3)},i=L=>{for(let N of rm){let k=N.c.map(F=>F.map((H,B)=>H?L.max[B]:L.min[B]));r(k,N.n,L.part)}},a=(L,N)=>{let[k,F,H]=N?[0,1,2]:[0,2,1],B=L.min[k],D=L.max[k],G=L.min[F],j=L.max[F],V=(D-B)*.1,z=(j-G)*.1,q=N?[[B+V,G],[D-V,G],[D,G+z],[D*.94,j-(j-G)*.23],[D*ln,j],[B*ln,j],[B*.94,j-(j-G)*.23],[B,G+z]]:[[B+V,G],[D-V,G],[D,G+z],[D,j-z],[D-V,j],[B+V,j],[B,j-z],[B,G+z]],$=(Q,W,Y)=>{let K=[0,0,0];return K[k]=Q,K[F]=W,K[H]=Y,K},re=[L.min[H],L.max[H]].map(Q=>q.map(([W,Y])=>$(W,Y,Q)));for(let Q=0;Q<q.length;Q++){let W=(Q+1)%q.length,Y=[0,0,0];Y[k]=(q[Q][0]+q[W][0])/2-(B+D)/2,Y[F]=(q[Q][1]+q[W][1])/2-(G+j)/2,r([re[0][Q],re[0][W],re[1][W],re[1][Q]],Y,L.part)}for(let Q=0;Q<2;Q++){let W=[0,0,0];W[H]=Q?1:-1;let Y=re[Q];for(let K=1;K<Y.length-1;K++){let oe=n.length;for(let ee of[Y[0],Y[K],Y[K+1]])e.push(...ee),t.push(...W),n.push(L.part);o.push(oe,oe+1,oe+2)}}};for(let L of nm)L.part===Me.pad||L.part===Me.back?a(L,L.part===Me.back):i(L);for(let L of om)i(L);let s=qo,c=1.08,l=.47,u=.69,m=-.55,h=.08,d=-.48,f=.01,p=[-l,s,m],b=[l,s,m],y=[-l,s,h],g=[l,s,h],M=[-u,c,d],P=[u,c,d],I=[-u,c,f],S=[u,c,f];r([b,P,S,g],[1,0,0],Me.body),r([y,I,M,p],[-1,0,0],Me.body),r([I,S,P,M],[0,1,0],Me.body),r([p,b,g,y],[0,-1,0],Me.body),r([g,S,I,y],[0,0,1],Me.body),r([p,M,P,b],[0,0,-1],Me.body);let x=10,v=8,w=[0,$o,Ci],R=[.42,.115,_i],T=n.length;for(let L=0;L<=v;L++){let N=Math.PI*L/v,k=Math.cos(N),F=Math.sin(N);for(let H=0;H<=x;H++){let B=Math.PI*2*H/x,D=F*Math.cos(B),G=F*Math.sin(B);e.push(w[0]+R[0]*D,w[1]+R[1]*k,w[2]+R[2]*G);let j=D/R[0],V=k/R[1],z=G/R[2],q=Math.hypot(j,V,z)||1;j/=q,V/=q,z/=q,t.push(j,V,z),n.push(Me.head)}}for(let L=0;L<v;L++)for(let N=0;N<x;N++){let k=T+L*(x+1)+N,F=k+x+1;o.push(k,F,k+1,k+1,F,F+1)}let O=new Float32Array(e),C=new Float32Array(t),A=new Float32Array(n),_=new Uint16Array(o);return{position:O,normal:C,part:A,index:_,vertexCount:n.length,indexCount:o.length}}function ki(e,t,n,o){let r=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let m=u-l;for(let h=l;h<u;h++){let[d,f]=o(h),p=d-i(h),b=f-a(h);if(m>=2){let y=Math.max(l,h-1),g=Math.min(u-1,h+1),M=i(g)-i(y),P=a(g)-a(y),I=Math.hypot(M,P);if(I>1e-6){let S=-P/I,x=M/I;S*p+x*b<0&&(S=-S,x=-x),p=S,b=x}}r[h]=p===0&&b===0?0:Math.atan2(p,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return r}var Zo=78,Li=18;function Fi(){let e=[],t=[],n=[],o=[],r=[],i=[{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]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,ft,-1],max:[1,mn,-.72]}])for(let c of i){let l=e.length/3,u=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-ln)/(mn-ft):0),m=Math.hypot(c.n[0],u,c.n[2]),h=[c.n[0]/m,u/m,c.n[2]/m];for(let[d,f]of c.c.entries()){let p=f.map((b,y)=>s.min[y]+b*(s.max[y]-s.min[y]));s.part===2&&(p[0]*=1-f[1]*(1-ln)),e.push(...p),t.push(...h),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][d])}r.push(l,l+1,l+2,l,l+2,l+3)}let a=e.length/3;for(let[s,c]of[[-1,-1],[1,-1],[1,1],[-1,1]])e.push(s,c,0),t.push(0,1,0),n.push(0),o.push(s,c);return r.push(a,a+1,a+2,a,a+2,a+3),r.push(...r.slice(12,18),...r.slice(60,66),...r.slice(72,78)),{position:new Float32Array(e),normal:new Float32Array(t),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(r)}}var Gi=require("ogl");var im=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Oi(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function am(e){let t=im.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function pe(e){let t=am(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Qo(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function sm(e){return .2126*Qo(e[0])+.7152*Qo(e[1])+.0722*Qo(e[2])}function Di(e){return sm([e[0]*255,e[1]*255,e[2]*255])}function cm(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function be(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 Ye(e,t){let n=cm(e);return be(e,[n,n,n],t)}function Bi({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,a=Math.max(o,r,i),s=Math.min(o,r,i),c=(a+s)/2;if(a===s)return{h:0,s:0,l:c};let l=a-s,u=c>.5?l/(2-a-s):l/(a+s),m;return a===o?m=((r-i)/l+(r<i?6:0))/6:a===r?m=((i-o)/l+2)/6:m=((o-r)/l+4)/6,{h:m,s:u,l:c}}var Ce=["available","held","sold","selected","dimmed"];function fn(e){let t=Ce.indexOf(e);return t<0?0:t}var Ni={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Vi(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.78,o=.86;return[(t+(e[0]-t)*n)*o,(t+(e[1]-t)*n)*o,(t+(e[2]-t)*n)*o]}var Jo={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]},Et={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ie(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function lm(){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 Un=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 Gi.Renderer({canvas:this.canvas,dpr:lm(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Et.top[0],Et.top[1],Et.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=o=>{o.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 Bt=require("ogl"),Re=Math.PI/180,er=15*Re,tr=80*Re,Dt=.12,Hi=35,nr=1.25,zi=.006,um=4,Nt=.82,dn=1/Nt,mm=.12,fm=2;function dm(e,t){return{azimuth:e*zi,polar:-t*zi}}function hm(e,t,n){if(!n)return 1;let o=t[0]-e[0],r=t[2]-e[2];return(n[0]-t[0])*o+(n[2]-t[2])*r<0?-1:1}function Ui(e,t,n){let o=Math.max(fm,Math.max(1,t)*mm),r=n*um;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,r):r}}var pm=1.5;function bm(e,t,n){let o=Math.max(1,n)*pm;if(!e)return{anchor:[t[0],t[1],t[2]],limit:o};let[r,i,a]=e.anchor,s=t[1]-i,c=Math.max(Math.abs(t[0]-r),Math.abs(t[2]-a),s>=0?s:-s*2);return{anchor:e.anchor,limit:Math.max(e.limit,c+o)}}function ji(e,t,n,o,r,i,a,s){let c=Math.sin(n),l=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],u=[e[0]+o*l[0],e[1]+o*l[1],e[2]+o*l[2]],m=[-l[0],-l[1],-l[2]],h=[-m[2],0,m[0]],d=Math.hypot(h[0],h[2])||1;h=[h[0]/d,0,h[2]/d];let f=[h[1]*m[2]-h[2]*m[1],h[2]*m[0]-h[0]*m[2],h[0]*m[1]-h[1]*m[0]],p=Math.tan(r*Re/2),b=p*(i>0?i:1),y=[0,1,2].map(P=>m[P]+a*b*h[P]+s*p*f[P]);if(y[1]>=-1e-6)return null;let g=(e[1]-u[1])/y[1],M=Math.hypot(y[0],y[1],y[2]);return!(g>0)||g*M>o*ym?null:[u[0]+y[0]*g,e[1],u[2]+y[2]*g]}var Xi=3,ym=4,Wi=.72;function Yi(e,t){let n=Math.sin(t),o=-n*Math.sin(e),r=-Math.cos(t),i=-n*Math.cos(e);if(Math.abs(r)>.999)return null;let a=-i,s=o,c=Math.hypot(a,s);return a/=c,s/=c,{fx:o,fy:r,fz:i,rx:a,rz:s,ux:-s*r,uy:s*o-a*i,uz:a*r}}var gm=.4;function xm(e,t,n,o,r,i){let a=[e.center[0],e.center[1],e.center[2]],s=i(a),c=e.fitPoints,l=Yi(o,r);if(!c||c.length<9||!l)return{center:a,distance:s};let{fx:u,fy:m,fz:h,rx:d,rz:f,ux:p,uy:b,uz:y}=l,g=Math.hypot(u,h),M=u/g,P=h/g,I=M*p+P*y,S=gm*Math.max(1,e.radius);for(let x=0;x<3;x++){let v=1/0,w=-1/0,R=1/0,T=-1/0;for(let N=0;N+2<c.length;N+=3){let k=c[N]-a[0],F=c[N+1]-a[1],H=c[N+2]-a[2],B=s+k*u+F*m+H*h;if(!(B>.001))continue;let D=(k*d+H*f)/(B*t),G=(k*p+F*b+H*y)/(B*n);D<v&&(v=D),D>w&&(w=D),G<R&&(R=G),G>T&&(T=G)}if(!Number.isFinite(v))break;let O=(v+w)/2*s*t,C=Math.abs(I)>.1?(R+T)/2*s*n/I:0,A=O*d+C*M,_=O*f+C*P;if(Math.hypot(a[0]+A-e.center[0],a[2]+_-e.center[2])>S){let N=a[0]-e.center[0],k=a[2]-e.center[2],F=N+A,H=k+_,B=S/Math.hypot(F,H);A=F*B-N,_=H*B-k}a=[a[0]+A,a[1],a[2]+_],s=i(a)}return{center:a,distance:s}}var jn=class{constructor(t,n,o,r){this.fovY=Hi;this.target=new Bt.Vec3;this.azimuth=-30*Re;this.polar=55*Re;this.distance=10;this.azT=-30*Re;this.polT=55*Re;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;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 Bt.Vec3;this.panAnchor=new Bt.Vec3;this.panLimit=0;this.panBox=null;this.grabSign=1;this.zoomPointResolver=null;this.primaryDragMode="orbit";this.camera=new Bt.Camera(t,{fov:Hi,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=r,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.dragging&&(this.grabSign=this.grabSignAt(i.clientX,i.clientY)),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 l=this.currentPinchDistance(),u=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-l)*.005),u.x,u.y),this.fireGesture()),this.pinchDist=l,this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.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}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=dm(a,s);this.azT+=c.azimuth*this.grabSign,this.polT=Math.max(er,Math.min(tr,this.polT+c.polar)),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.dollyAt(Math.exp(s*.22),i.clientX,i.clientY),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*Re;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(er,Math.min(tr,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(Nt);else if(i.key==="-"||i.key==="_")this.dollyBy(dn);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,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}panBy(t,n){let o=this.canvas.clientHeight||1,r=2*this.distance*Math.tan(this.fovY*Re/2)/o,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),m=-i*l,h=-a*l;this.targetT.x+=(-t*s+n*m)*r,this.targetT.z+=(-t*c+n*h)*r,this.targetT.y+=n*u*r,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=bm(this.panBox,t.center,t.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,r=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(r-t,Math.min(r+t,this.targetT.z)),this.targetT.y=Math.max(o-t*.5,Math.min(o+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()}dollyAt(t,n,o){let r=this.distT,i=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max(Xi,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(Xi,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/r);return}let s=i&&i.width>0&&i.height>0?ji([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||i.width/i.height,(n-i.left)/i.width*2-1,1-(o-i.top)/i.height*2):null;this.dollyBy(t),s&&this.scaleTargetAbout(s,this.distT/r)}scaleTargetAbout(t,n){!Number.isFinite(n)||n===1||(this.targetT.x=t[0]+(this.targetT.x-t[0])*n,this.targetT.y=t[1]+(this.targetT.y-t[1])*n,this.targetT.z=t[2]+(this.targetT.z-t[2])*n,this.clampPan())}grabSignAt(t,n){let o=this.canvas.getBoundingClientRect?.(),r=this.zoomPointResolver?.(t,n)??(o&&o.width>0&&o.height>0?ji([this.target.x,this.target.y,this.target.z],this.azimuth,this.polar,this.distance,this.fovY,this.camera.aspect||o.width/o.height,(t-o.left)/o.width*2-1,1-(n-o.top)/o.height*2):null),i=this.camera.position;return hm([i.x,i.y,i.z],[this.target.x,this.target.y,this.target.z],r)}setZoomPointResolver(t){this.zoomPointResolver=t}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}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,o,r=!1,i){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t);let a=Math.max(1,t.radius),s=this.fovY*Re/2,c=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=o??-30*Re,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*Re;let u=this.framedOn(t,s,l),m=u.distance;this.target.set(u.center[0],u.center[1],u.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,i?.margin??nr)),this.envelope=Ui(this.envelope,a,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*Re,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){if(!(t>0)||!Number.isFinite(t))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(t,1);this.distance*=o,this.distT*=o,this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:t})}glideTo(t,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(t),this.targetT.set(t.center[0],t.center[1],t.center[2]);let o=this.fovY*Re/2,r=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*Re;let i=this.framedOn(t,o,r),a=i.distance;this.targetT.set(i.center[0],i.center[1],i.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??nr)),this.envelope=Ui(this.envelope,Math.max(1,t.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(t,n,o=!1,r){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*Re/2,a=o?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,r?.polarDeg??55))*Re;let c=this.framedOn(t,i,s);this.targetT.set(c.center[0],c.center[1],c.center[2]),this.distT=c.distance*Math.max(1.05,Math.min(2,r?.margin??nr))}framedOn(t,n,o){return xm(t,Math.tan(o),Math.tan(n),this.azT,this.polT,r=>this.fitDistance({...t,center:r},n,o,this.azT,this.polT))}fitDistance(t,n,o,r,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),c=t.box;if(!c)return s;let l=Yi(r,i);if(!l)return s;let{fx:u,fy:m,fz:h,rx:d,rz:f,ux:p,uy:b,uz:y}=l,g=Math.tan(o),M=Math.tan(n),P=1;for(let R=0;R<8;R++){let T=(R&1?c.max[0]:c.min[0])-t.center[0],O=(R&2?c.max[1]:c.min[1])-t.center[1],C=(R&4?c.max[2]:c.min[2])-t.center[2],A=T*u+O*m+C*h,_=Math.abs(T*d+C*f),L=Math.abs(T*p+O*b+C*y);P=Math.max(P,_/g-A,L/M-A)}let I=Math.min(s,Math.max(P,a*.35)),S=t.fitPoints;if(!S||S.length<9)return I;let x=0,v=1/(g*Wi),w=1/(M*Wi);for(let R=0;R+2<S.length;R+=3){let T=S[R]-t.center[0],O=S[R+1]-t.center[1],C=S[R+2]-t.center[2],A=T*u+O*m+C*h,_=Math.abs(T*d+C*f),L=Math.abs(T*p+O*b+C*y);x=Math.max(x,_*v-A,L*w-A)}return Math.min(I*1.5,Math.max(I*.55,x))}updateClipping(t){let n=this.camera.position.x-t.center[0],o=this.camera.position.y-t.center[1],r=this.camera.position.z-t.center[2],i=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(i-this.distance)<=this.distance*.01,{near:s,far:c}=Sm(Math.hypot(n,o,r),t.radius,a?this.distance:null);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,r=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(o)>1e-4||Math.abs(r)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*Dt,this.polar+=n*Dt,this.distance+=o*Dt,this.target.x+=r*Dt,this.target.y+=i*Dt,this.target.z+=a*Dt,c&&this.applyPosition(),c}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,r=Math.hypot(t,n,o)||1,i=Math.max(er,Math.min(tr,Math.acos(Math.max(-1,Math.min(1,n/r)))));this.distance=this.distT=r,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,o)}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),o=this.target.y+this.distance*Math.cos(this.polar),r=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,o,r),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()}},vm=.1,Mm=.25;function Sm(e,t,n){let o=Math.max(1,t)*1.18,r=n==null?Mm:Math.max(.05,n*vm),i=Math.max(r,e-o),a=Math.max(i+10,e+o);return{near:i,far:a}}var Xn=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 r=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+r*.1:r}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}};function Ki(e){let t=!1;return n=>{n!==t&&(t=n,n?e.dataset.slReady="1":delete e.dataset.slReady)}}function qi(e,t,n){return Math.max(t,Math.min(n,e))}var Vt=2.5,wm=1.15,hn=12,Gt=22,$i=6,Zi=9.5,Qi=.9,Ji=2.2,or=30,rr=4,Wn=8192;var G0=Gt+rr;function ea(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Vt};let r=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-r*.4,fade:r*.55,minPixels:Vt+r*(wm-Vt)}}function ta(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var Pm=12;function na(e,t,n,o,r){if(!(e>0)||!(t>0)||!(n>0)||!(o>0)||!(r>0))return!1;let i=Math.tan(o/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(r/2);return Math.PI*a*a/e>=Pm}var Im=[{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"}],z0=new Map(Im.map(e=>[e.key,e]));var Rm={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 oa(e){let t=e?.[0];return t&&Rm[t]||"#3b82f6"}var Am=[{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"}],U0=new Map(Am.map(e=>[e.key,e]));var Em=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],j0=new Set(Em);var ia=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21},mark:{x:12,y:10,radius:6}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22},mark:{x:12,y:10,radius:4.5}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5},mark:{x:12,y:7.5,radius:5.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5},mark:{x:12,y:8,radius:5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20},mark:{x:12,y:9.25,radius:6.5}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22},mark:{x:12,y:12.25,radius:4.75}}],aa=ia.map(e=>e.key),Cm=new Map(ia.map(e=>[e.key,e]));function ra(e){return typeof e=="string"&&Cm.has(e)}function sa(e,t){return ra(e)?e:ra(t?.seatGlyph)?t.seatGlyph:"circle"}var fe=.02291666666666667,ze=1/fe,_m=58,Tm=_m*fe;var km=3,ca=0,ir=120,Lm=0,Fm=45,Om=7,Qe=1.2;function ar(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Dm(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Om?e:km}function dt(e,t={}){let n=ar(t.floorBaseHeightM,ca,ir,0),o=Math.min(ir,n+Dm(e.elevation)*Tm),r=e.height===void 0?o:ar(e.height,ca,ir,o),i=ar(e.rake,Lm,Fm,0);return{height:r,rake:i}}var ua=it(require("earcut"),1),cr=it(require("polygon-clipping"),1);var $0=Math.PI/180;function sr(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function pn(e){return e.length?sr(e):null}function Be(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function Ne(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}var E=fe,Bm=.002;function Nm(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=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(o,r,i);if(a<1e-9)return!0;let s=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-o)*(s-r)*(s-i)))/a<Bm}var Ct=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){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++]=o}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 o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},qn=class{constructor(){this.pos=new Ct;this.nor=new Ct;this.col=new Ct;this.flr=new Ct;this.mat=new Ct;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,a=i,s=i){Nm(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[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,o,r,i,a,s,c=s,l=s){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[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 Vm(e,t,n){let o=t[0]-e[0],r=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=r*c-i*s,u=i*a-o*c,m=o*s-r*a,h=Math.hypot(l,u,m)||1;return l/=h,u/=h,m/=h,[l,u,m]}function Gm(e,t){let n=[...e],o=[];for(let a of e)o.push(a.x,a.y);let r=[];if(t){for(let a of t)if(!(a.length<3)){r.push(n.length);for(let s of a)n.push(s),o.push(s.x,s.y)}}let i=(0,ua.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Je(e){return Be(e)<0?[...e].reverse():e}var Hm=3;function zm(e,t,n,o){let r=o(e),i=o(t),a=o(n),s=(d,f,p,b)=>Math.abs(o({x:(d.x+f.x)/2,y:(d.y+f.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(r+i+a)/3,m=Math.max(s(e,t,r,i),s(t,n,i,a),s(n,e,a,r),Math.abs(o({x:c,y:l})-u)),h=(d,f,p)=>{let b=Math.abs(o({x:(d+c)/2,y:(f+l)/2})-(p+u)/2);b>m&&(m=b)};return h((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),h((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),h((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),m}function bn(e,t,n,o,r){if(r<=0)return zm(e,t,n,o);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(bn(e,i,s,o,r-1),bn(i,t,a,o,r-1),bn(s,a,n,o,r-1),bn(i,a,s,o,r-1))}function yn(e,t,n,o,r,i,a,s){if(a>0){let h={x:(t.x+n.x)/2,y:(t.y+n.y)/2},d={x:(n.x+o.x)/2,y:(n.y+o.y)/2},f={x:(o.x+t.x)/2,y:(o.y+t.y)/2};yn(e,t,h,f,r,i,a-1,s),yn(e,h,n,d,r,i,a-1,s),yn(e,f,d,o,r,i,a-1,s),yn(e,h,d,f,r,i,a-1,s);return}let c=[t.x*E,r(t),t.y*E],l=[n.x*E,r(n),n.y*E],u=[o.x*E,r(o),o.y*E];if(s){e.triN(c,l,u,s(t),s(n),s(o),i);return}let m=Vm(c,l,u);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,l,u,m,i)}var Um=8;function la(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=t(u);if(Math.abs(m-(s+c)/2)>n){r(i,u,s,m,l-1),r(u,a,m,c,l-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];r(a,s,t(a),t(s),Um)}return o}function Yn(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}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 o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],a=n[r],s=n[(r+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||o.push(a)}return o.length>=3?o:n}var Kn=.001*ze*.1;function ae(e,t,n,o,r,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Be(t))<1e-4))return;let u=Yn(la(Yn(Je(t),Kn),o,c),Kn),m=n?.map(S=>Yn(la(Yn(Je(S),Kn),o,c),Kn)).filter(S=>S.length>=3&&Math.abs(Be(S))>=1e-4),{pts:h,tris:d}=Gm(u,m),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],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<Hm;g++){let S=0;for(let x=0;x<d.length;x+=3){let v=bn(h[d[x]],h[d[x+1]],h[d[x+2]],o,g);v>S&&(S=v)}if(S<=c)break}for(let S=0;S<d.length;S+=3){let x=h[d[S]],v=h[d[S+1]],w=h[d[S+2]];yn(e,x,v,w,o,f,g,l);let R=[x.x*E,r,x.y*E],T=[v.x*E,r,v.y*E],O=[w.x*E,r,w.y*E];e.tri(R,O,T,[0,-1,0],p)}let M=S=>{if(g<=0)return S;let x=1<<g,v=[];for(let w=0;w<S.length;w++){let R=S[w],T=S[(w+1)%S.length];for(let O=0;O<x;O++){let C=O/x;v.push({x:R.x+(T.x-R.x)*C,y:R.y+(T.y-R.y)*C})}}return v},P=sr(u),I=[{ring:M(u),flip:!1}];if(m)for(let S of m)S.length>=3&&I.push({ring:M(S),flip:!0});for(let{ring:S,flip:x}of I)for(let v=0;v<S.length;v++){let w=S[v],R=S[(v+1)%S.length],T=(R.x-w.x)*E,C=(R.y-w.y)*E,A=-T,_=Math.hypot(C,A)||1;C/=_,A/=_;let L=(w.x+R.x)/2-P.x,N=(w.y+R.y)/2-P.y,k=C*L+A*N;x&&(k=-k),k<0&&(C=-C,A=-A);let F=[C,0,A],H=[w.x*E,o(w),w.y*E],B=[R.x*E,o(R),R.y*E],D=[w.x*E,r,w.y*E],G=[R.x*E,r,R.y*E];e.tri(H,B,G,F,b,b,y),e.tri(H,G,D,F,b,y,y)}}function ma(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=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),o.set(c.normal,s*3),r.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:o,color:r,floor:i,material:a,count:t}}function Ke(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Je(e),r=o.length,i=[];for(let s=0;s<r;s++){let c=o[s],l=o[(s+1)%r],u=l.x-c.x,m=l.y-c.y,h=Math.hypot(u,m)||1;i.push({x:m/h,y:-u/h})}let a=[];for(let s=0;s<r;s++){let c=o[s],l=i[(s-1+r)%r],u=i[s],m=l.x+u.x,h=l.y+u.y,d=Math.hypot(m,h),f=()=>{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(d<1e-9){f();continue}m/=d,h/=d;let p=m*l.x+h*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){f();continue}a.push([c.x+m*t*b,c.y+h*t*b])}if(a.length<3)return e;try{let s=cr.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let m of s){let h=Math.abs(Be(m[0].map(([d,f])=>({x:d,y:f}))));h>l&&(l=h,c=m[0])}if(!c)return e;let u=c.map(([m,h])=>({x:m,y:h}));if(u.length>1){let m=u[0],h=u[u.length-1];Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function ht(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=Je(e),r=o.length,i=[];for(let c=0;c<r;c++){let l=o[c],u=o[(c+1)%r],m=Math.hypot(u.x-l.x,u.y-l.y)||1;i.push({x:-(u.y-l.y)/m,y:(u.x-l.x)/m})}let a=[],s=[];for(let c=0;c<r;c++){let l=o[c],u=i[(c-1+r)%r],m=i[c],h=u.x+m.x,d=u.y+m.y,f=Math.hypot(h,d),p=f<1e-9?1/0:1/Math.max(h/f*u.x+d/f*u.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:l.x+u.x*t,y:l.y+u.y*t},{x:l.x+m.x*t,y:l.y+m.y*t}),s.push(c,c);continue}h/=f,d/=f,a.push({x:l.x+h*t*p,y:l.y+d*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let l=(c+1)%a.length,u=s[c],m=s[l];if(m!==(u+1)%r)continue;let h=o[u],d=o[m];if((a[l].x-a[c].x)*(d.x-h.x)+(a[l].y-a[c].y)*(d.y-h.y)<=0)return[]}try{let c=cr.default.intersection([[...a.map(f=>[f.x,f.y]),[a[0].x,a[0].y]]],[[...o.map(f=>[f.x,f.y]),[o[0].x,o[0].y]]]),l=null,u=0;for(let f of c){let p=Math.abs(Be(f[0].map(([b,y])=>({x:b,y}))));p>u&&(u=p,l=f[0])}if(!l)return[];let m=l.map(([f,p])=>({x:f,y:p})),h=m[0],d=m[m.length-1];return m.length>1&&Math.abs(h.x-d.x)<1e-9&&Math.abs(h.y-d.y)<1e-9&&m.pop(),m.length>=3?Je(m):[]}catch{return[]}}function $n(e,t,n,o,r=28){let i=[];for(let a=0;a<r;a++){let s=a/r*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function gn(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var at=.22;function fa(e,t){let n=Ce[e];if(n!=="sold"&&n!=="held")return-1;let o=(t+1)*2654435761;return o^=o>>>15,o=Math.imul(o,2246822519),o^=o>>>13,(o>>>0)%1e5/1e5}var jm=.42;function Xm(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<o&&(o=f.x),f.y<r&&(r=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-o,1e-6),c=Math.max(a-r,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),m=Math.max(1,Math.ceil(c/l)+1),h=new Map,d=(f,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((f-o)/l)));return Math.min(m-1,Math.max(0,Math.floor((p-r)/l)))*u+b};for(let f=0;f<t;f++){let p=d(e[f].x,e[f].y),b=h.get(p);b?b.push(f):h.set(p,[f])}for(let f=0;f<t;f++){let p=e[f],b=Math.min(u-1,Math.max(0,Math.floor((p.x-o)/l))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-r)/l))),g=1/0;for(let M=1;M<=4;M++){for(let P=y-M;P<=y+M;P++)if(!(P<0||P>=m))for(let I=b-M;I<=b+M;I++){if(I<0||I>=u||M>1&&Math.abs(P-y)<M&&Math.abs(I-b)<M)continue;let S=h.get(P*u+I);if(S)for(let x of S){if(x===f)continue;let v=Math.hypot(e[x].x-p.x,e[x].y-p.y);v<g&&(g=v)}}if(Number.isFinite(g)&&g<=M*l)break}n[f]=g}return n}function Wm(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Qe):0}function da(e,t,n,o,r,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a*3),p=new Map,b=Xm(e);for(let y=0;y<a;y++){let g=e[y],P=(n?.seatPitchU(y)??b[y])*E;u[y]=Number.isFinite(P)?Math.max(.06,Math.min(at,P*jm)):at,m[y]=Ei(Number.isFinite(P)?P:void 0);let I=sa(g.glyph,{seatGlyph:i?.get(g.categoryKey)});h[y]=aa.indexOf(I),d[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*E,s[y*3+1]=n?n.seatDeckY(y):Wm(g),s[y*3+2]=g.y*E,c[y]=fn(t?t(g):"available");let S=pe(r?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=S[0],l[y*3+1]=S[1],l[y*3+2]=S[2],g.accessibility?.length){let x=pe(oa(g.accessibility));x&&(f[y*3]=x[0],f[y*3+1]=x[1],f[y*3+2]=x[2])}p.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:f,idToIndex:p,iChairWidth:m,iGlyph:h,iPhysicalSeat:d,iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var Ym=64;function lr(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=fn(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let o=[],r=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Ym){i=s;continue}o.push({start:r,length:i-r+1}),r=s,i=s}}return o.push({start:r,length:i-r+1}),o}var xn=3,_t=.38,vn=.24;function Km(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*E,i=(n.y-t.y)*E,a=(o.x-t.x)*E,s=(o.y-t.y)*E,c=2*(r*s-i*a);if(Math.abs(c)<1e-7)return null;let l=r*r+i*i,u=a*a+s*s,m=(l*s-u*i)/c+t.x*E,h=(r*u-a*l)/c+t.y*E,d=Math.hypot(t.x*E-m,t.y*E-h);return d<1||d>200||!Number.isFinite(d)||e.some(f=>Math.abs(Math.hypot(f.x*E-m,f.y*E-h)-d)>.03)?null:{x:m,z:h,radius:d}}function ha(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/xn)},${Math.floor(l/xn)}`;for(let c of e)for(let l of c.rows){for(let m of l.pts){let h=m.x*E,d=m.y*E,f=o(h,d),p=n.get(f)??[];p.push({x:h,z:d,y:l.y,floor:c.floorIndex}),n.set(f,p)}if(l.patch||l.pts.length<2)continue;let u=Km(l.pts);for(let m of[0,l.pts.length-1]){let h=l.pts[m],d=l.pts[m===0?1:m-1],f=h.x-d.x,p=h.y-d.y,b=Math.hypot(f,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:h,x:h.x*E,z:h.y*E,dx:f/b,dz:p/b})}}let r=new Map;t.forEach((c,l)=>{let u=o(c.x,c.z),m=r.get(u)??[];m.push(l),r.set(u,m)});let i=(c,l)=>{let u=Math.floor(c/xn),m=Math.floor(l/xn);return[-1,0,1].flatMap(h=>[-1,0,1].map(d=>`${u+h},${m+d}`))},a=new Map;t.forEach((c,l)=>{let u=-1,m=1/0,h=!1;for(let d of i(c.x,c.z))for(let f of r.get(d)??[]){let p=t[f];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let b=p.x-c.x,y=p.z-c.z,g=Math.hypot(b,y);if(g<_t*2+.45||g>xn)continue;let M=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,P=Math.min((b*c.dx+y*c.dz)/g,(-b*p.dx-y*p.dz)/g);(M?P<.8:P<.98)||!M&&(Math.abs(b*c.dz-y*c.dx)>.15||Math.abs(b*p.dz-y*p.dx)>.15)||(g<m-.02?(u=f,m=g,h=!1):Math.abs(g-m)<=.02&&(h=!0))}u>=0&&!h&&a.set(l,u)});let s=[];for(let[c,l]of a){if(c>=l||a.get(l)!==c)continue;let u=t[c],m=t[l],h=Math.hypot(m.x-u.x,m.z-u.z),d=(m.x-u.x)/h,f=(m.z-u.z)/h,p=!1;for(let y of i((u.x+m.x)/2,(u.z+m.z)/2))for(let g of n.get(y)??[]){if(g.floor!==u.floorIndex||Math.abs(g.y-u.row.y)>.75)continue;let M=(g.x-u.x)*d+(g.z-u.z)*f,P=Math.abs((g.x-u.x)*f-(g.z-u.z)*d);M>.01&&M<h-.01&&P<vn+_t&&(p=!0)}if(p)continue;let b=(y,g)=>({x:(u.x+d*y-f*g)/E,y:(u.z+f*y+d*g)/E});s.push({sections:[u.sectionId,m.sectionId],blocks:[u.row.blockId,m.row.blockId],floorIndex:u.floorIndex,ends:[u.point,m.point],clearWidthM:h-2*_t,heightM:(u.row.y+m.row.y)/2,outline:[b(_t,-vn),b(h-_t,-vn),b(h-_t,vn),b(_t,vn)]})}return s}var qm=.15,$m=1.6;function pa(e){return qi(e??1,qm,$m)}var Zm=.15,Qm=.9,Jm=1.76;function ba(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function ef(){return{background:{top:[...Et.top],bottom:[...Et.bottom]},sky:ba(null),structure:Jo,seatStates:{...Ni},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function tf(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{deck:"#a8ada9",fascia:"#69777c",shell:"#8d9ca0",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function ya(e){let t=ef();e??={};let n=pe(e.background);if(n){t.background={top:ie(n,Qm),bottom:ie(n,Jm)},t.sky=ba(n);let s={};for(let[l,u]of Object.entries(Jo))s[l]=be(u,n,Zm);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(s.ground=ie(n,.86)),t.structure=s}let o=pe(e.selectionColor)??pe(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=pa(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,s])=>s!=null)),a={...tf(n),...i};if(a){let s=pe(a.deck),c=pe(a.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=pe(a.seat),t.materials.shell=pe(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return t}function ga(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var nf=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),of=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Tt(e){return!!e&&nf.has(e)}function Zn(e){return!!e&&of.has(e)}var Qn=1.1,rf={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},af={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var sf=Math.PI*2;function cf(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function xa(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let a=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(a),y:t*Math.sin(a)})}for(let i=0;i<=r;i++){let a=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(a),y:t*Math.sin(a)})}return o}var va=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,a=[],s=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let l=0;l<=24;l++){let u=s+(c-s)*l/24;a.push({x:i*Math.cos(u),y:r+i*Math.sin(u)})}return{half:70,home:t,backstop:n,fence:a}})();var Jn="#f1f5f9";function Mn(e){return Tt(e)}function pt(e,t,n,o,r=32){let i=[];for(let a=0;a<r;a++){let s=a/r*sf;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function st(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function lf(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,a=(e.rotation??0)*Math.PI/180,s=Math.cos(a),c=Math.sin(a),l=r/2,u=i/2,m=[],h=rf[t],d=p=>h?p/h.width*r:0,f=p=>h?p/h.height*i:0;switch(t){case"pitch-football":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1}),m.push({points:pt(0,0,d(9.15),f(9.15)),closed:!0});for(let p of[-1,1])m.push({points:st(p*(l-d(16.5)/2),0,d(16.5)/2,f(40.32)/2),closed:!0}),m.push({points:st(p*(l-d(5.5)/2),0,d(5.5)/2,f(18.32)/2),closed:!0});break}case"rink-hockey":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*d(7.5),y:-u},{x:p*d(7.5),y:u}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(l-d(4)),y:-f(11)},{x:p*(l-d(4)),y:f(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:pt(p*d(20.5),b*f(7),d(4.5),f(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:pt(0,0,d(4.5),f(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=u-f(1.22)*8;b>0&&m.push({points:xa(l-d(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let y=1;y<8;y++){let g=f(1.22)*y,M=u-g;if(M<=0)break;m.push({points:xa(l-d(1.22)*y,M),closed:!0})}break}case"oval-cricket":{m.push({points:pt(0,0,d(27.4),f(27.4+20.12/2),40),closed:!0}),m.push({points:st(0,0,d(3.05)/2,f(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:d(b),y:-u},{x:d(b),y:u}],closed:!1});m.push(p(0));for(let b of[-1,1]){m.push(p(b*50),p(b*28));for(let y=-35;y<35;y+=4)m.push({points:[{x:d(b*10),y:f(y)},{x:d(b*10),y:f(Math.min(35,y+2))}],closed:!1})}break}case"diamond-baseball":{let p=(L,N)=>({x:d(L),y:f(N)}),{home:b}=va,y=27.43,g=y/Math.SQRT2,M={x:b.x+g,y:b.y-g},P={x:b.x,y:b.y-2*g},I={x:b.x-g,y:b.y-g},S={x:b.x,y:b.y-18.44},x="#b98a59",v=af["diamond-baseball"],w=38.94,R=[p(b.x,b.y)],T=Math.atan2(b.y-w/Math.SQRT2-S.y,w/Math.SQRT2),O=Math.PI-T;for(let L=0;L<=16;L++){let N=T-(T+Math.PI*2-O)%(Math.PI*2)*(L/16);R.push(p(S.x+29*Math.cos(N),S.y+29*Math.sin(N)))}m.push({points:R,closed:!0,fill:x,ink:x});let C={x:b.x,y:b.y-g},A=[{x:b.x,y:b.y},M,P,I].map(L=>p(C.x+(L.x-C.x)*.84,C.y+(L.y-C.y)*.84));m.push({points:A,closed:!0,fill:v,ink:v}),m.push({points:pt(d(S.x),f(S.y),d(2.74),f(2.74),20),closed:!0,fill:x,ink:x}),m.push({points:pt(d(b.x),f(b.y),d(3.96),f(3.96),20),closed:!0,fill:x,ink:x});let _=va.fence;m.push({points:[p(b.x,b.y),p(_[0].x,_[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(_[_.length-1].x,_[_.length-1].y)],closed:!1});for(let L of[M,P,I])m.push({points:st(d(L.x),f(L.y),d(.3),f(.3)),closed:!0,fill:Jn});break}case"court-basketball":{m.push({points:st(0,0,d(14),f(7.5)),closed:!0}),m.push({points:[{x:0,y:-f(7.5)},{x:0,y:f(7.5)}],closed:!1}),m.push({points:pt(0,0,d(1.8),f(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,y=p*(14-5.8),g=p*(14-1.575);m.push({points:st(d((b+y)/2),0,d(2.9),f(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:pt(d(y),0,d(1.8),f(1.8),24),closed:!0});let M=Math.sqrt(6.75*6.75-6.6*6.6),P=[{x:d(b),y:-f(6.6)}],I=Math.atan2(-6.6,-p*M),S=2*Math.atan2(6.6,M);for(let x=0;x<=16;x++){let v=I-p*S*(x/16);P.push({x:d(g+6.75*Math.cos(v)),y:f(6.75*Math.sin(v))})}P.push({x:d(b),y:f(6.6)}),m.push({points:P,closed:!1})}break}case"court-tennis":{m.push({points:st(0,0,d(11.885),f(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])m.push({points:[{x:-d(11.885),y:p*f(4.115)},{x:d(11.885),y:p*f(4.115)}],closed:!1}),m.push({points:[{x:p*d(6.4),y:-f(4.115)},{x:p*d(6.4),y:f(4.115)}],closed:!1});m.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),m.push({points:[{x:0,y:-f(6.4)},{x:0,y:f(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{m.push({points:st(0,0,d(3.05),f(3.05)),closed:!0});let y=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[g,M,P]of y)m.push({points:st(g*d(3.05),M*f(3.05),d(.3),f(.3)),closed:!0,fill:P,ink:P});break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>cf(b.x,b.y,s,c,n,o))}))}function Ma(e){if(e.role!=="stage"||!Mn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(u=>u.x),o=e.points.map(u=>u.y),r=Math.min(...n),i=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,i-r),l=Math.max(1,s-a);t={cx:r+c/2,cy:a+l/2,width:c,height:l}}return t?lf({kind:e.stageKind,...t}):[]}function Sa(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+a*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+a*e.end.y}}function wa(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Sa(e,.5)];let o=Array.from({length:n+1},(c,l)=>Sa(e,l/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let l=o[c].x-o[c-1].x,u=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(l,u)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;s<r.length-1&&r[s]<l;)s+=1;let u=r[s-1],m=r[s],h=m===u?0:(l-u)/(m-u);a.push({x:o[s-1].x+(o[s].x-o[s-1].x)*h,y:o[s-1].y+(o[s].y-o[s-1].y)*h})}return a}function Pa(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((h,d)=>h.segmentedRow.componentIndex-d.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((h,d)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===o&&h.segmentedRow.componentCount===a&&h.segmentedRow.componentIndex===d&&h.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(d===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===s.displayLabel)))continue;let l=i.reduce((h,d)=>h+d.seatCount,0),u=0,m=0;for(let h of i)h.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(h.id,{groupId:o,adjacencyOffset:u,displayOffset:m,displayLabel:s.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=h.seatCount,m+=h.seatCount}return t}var uf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var mf="abcdefghijklmnopqrstuvwxyz";function ff(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function ur(e,t=!1){let n=t?mf:uf;return ff(Math.max(0,Math.floor(e)-1),n)}var df=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ia(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of df)for(;t>=o;)n+=r,t-=o;return n}function hf(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function eo(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let d=Math.ceil(c/2),f=i==="updown"?t<d?n+2*t:n-1+2*(c-t):t<d?n+2*(d-1-t):n+1+2*(t-d);return`${a}${f}`}let l=i==="odd"||i==="even"?2:r,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,m=o==="center"?hf(c)[t]:o==="rtl"?c-1-t:t,h;switch(i){case"odd":{let d=u%2===1?u:u+1;h=String(d+m*2);break}case"even":{let d=u%2===0?u:u+1;h=String(d+m*2);break}case"roman":h=Ia(u+m*r);break;case"letters-upper":h=ur(u+m*r,!1);break;case"letters-lower":h=ur(u+m*r,!0);break;default:h=String(u+m*r);break}return`${a}${h}`}function pf(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Ra(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${eo(e,t)}`}function mr(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(e.seatDisplayLabelMode==="number")return eo(e,t);if(!n)return`${e.displayLabel||e.label}-${eo(e,t)}`;let r=pf(n),i=n.displayOffset+t;return`${n.displayLabel}-${eo(r,i)}`}function Aa(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 Ht(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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 m=t-(i.x+u*s),h=n-(i.y+u*c);if(Math.abs(m)>=o||Math.abs(h)>=o)continue;let d=Math.hypot(m,h);d<o&&(o=d)}return o}function bf(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>r&&(r=a)}return{cx:t,cy:n,r}}function Ea(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function fr(e,t){let n=1/0;for(let o of Aa(e)){let r=Ht(t,o.x,o.y);r<n&&(n=r)}for(let o of Aa(t)){let r=Ht(e,o.x,o.y);r<n&&(n=r)}return n}function yf(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let u of e){let m=Math.hypot(u.x-n,u.y-o);m>r&&(r=m,i=u)}let a=i.x-n,s=i.y-o,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,m)=>({p:u,i:m,t:(u.x-n)*a+(u.y-o)*s})).sort((u,m)=>u.t-m.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function dr(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let g of e)n+=g.x,o+=g.y;n/=t,o/=t;let r=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let M=g.x-n,P=g.y-o;r+=M*M,a+=P*P,i+=M*P,s+=M*M*M,c+=P*P*P,l+=M*P*P,u+=P*M*M}let m=r*a-i*i;if(Math.abs(m)<1e-9)return null;let h=(s+l)/2,d=(c+u)/2,f=(h*a-d*i)/m,p=(d*r-h*i)/m,b=f+n,y=p+o;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var gf=.15;function xf(e){if(e.length<2)return null;let t=e.map(I=>{let S=0,x=0;for(let v of I.pts)S+=v.x,x+=v.y;return{x:S/I.pts.length,y:x/I.pts.length}}),n=0,o=0;for(let I of t)n+=I.x,o+=I.y;n/=t.length,o/=t.length;let r=0,i=0,a=0;for(let I of t){let S=I.x-n,x=I.y-o;r+=S*S,i+=S*x,a+=x*x}let s=r+a,c=r*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,m;Math.abs(i)>1e-12?(u=l-a,m=i):r>=a?(u=1,m=0):(u=0,m=1);let h=Math.hypot(u,m);if(!(h>1e-12))return null;u/=h,m/=h;let d=0,f=0,p=0;for(let I of e){if(I.pts.length<2)continue;let S=I.pts[0],x=I.pts[I.pts.length-1],v=x.x-S.x,w=x.y-S.y,R=Math.hypot(v,w);if(!(R>1e-9))continue;let T=v/R,O=w/R;d+=(T*T-O*O)*R,f+=2*T*O*R,p+=R}if(p>0&&Math.hypot(d,f)>=Mf*p){let I=Math.atan2(f,d)/2,S=Math.cos(I),x=Math.sin(I);Math.abs(u*S+m*x)>Sf&&(u=-x,m=S)}let b=1/0,y=-1/0,g=[];for(let I of e){let S=1/0,x=-1/0;for(let v of I.pts){let w=v.x*u+v.y*m;w<S&&(S=w),w>x&&(x=w),w<b&&(b=w),w>y&&(y=w)}g.push(x-S)}let M=y-b;return M>1e-9?(g.sort((I,S)=>I-S),g[Math.min(g.length-1,Math.floor(g.length*.9))]/M<=vf?{x:u,y:m}:null):null}var vf=.35,Mf=.8,Sf=.7;function to(e,t,n,o){let r=new Map;for(let S of n){let x=t[S],v=x.rowId||`__seat-${S}`,w=r.get(v);w||(w={pts:[],idx:[]},r.set(v,w)),w.pts.push({x:x.x,y:x.y}),w.idx.push(S)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[S,x]of r){let v=yf(x.pts,x.idx),w=0;for(let R of v.pts)w+=Math.hypot(R.x-o.x,R.y-o.y);i.push({id:S,pts:v.pts,seatIndices:v.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:w/v.pts.length})}let a=i.map(S=>bf(S.pts)),s=i.length<=256?i.length*(i.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let l=c?new Map(i.map((S,x)=>[S,x])):null,u=(S,x)=>(S>x&&([S,x]=[x,S]),S*(2*i.length-S-1)/2+(x-S-1)),m=(S,x)=>{if(!c)return fr(i[S].pts,i[x].pts);let v=u(S,x),w=c[v];if(!Number.isNaN(w))return w;let R=fr(i[S].pts,i[x].pts);return c[v]=R,R},h=(S,x)=>l?m(l.get(S),l.get(x)):fr(S.pts,x.pts),d=[];for(let S=0;S<i.length;S++){let x=1/0;for(let v=0;v<i.length;v++){if(S===v||Ea(a[S],a[v])>=x)continue;let w=m(S,v);w<x&&(x=w)}Number.isFinite(x)&&d.push(x)}d.sort((S,x)=>S-x);let f=d.length?d[Math.floor(d.length/2)]:1,p=Math.max(f*1.8,1e-6),b=i.map(()=>[]);for(let S=0;S<i.length;S++)for(let x=S+1;x<i.length;x++)Ea(a[S],a[x])>p||m(S,x)<=p&&(b[S].push(x),b[x].push(S));let y=0;for(let S=0;S<i.length;S++){if(i[S].blockId!==-1)continue;let x=y++,v=[S];for(i[S].blockId=x;v.length;){let w=v.pop();for(let R of b[w])i[R].blockId===-1&&(i[R].blockId=x,v.push(R))}}let g=new Map;for(let S of i){let x=g.get(S.blockId)??[];x.push(S),g.set(S.blockId,x)}let M=[];for(let S of i){if(S.pts.length<4)continue;let x=dr(S.pts);x&&(!Number.isFinite(x.cx)||!Number.isFinite(x.cy)||M.push({x:x.cx,y:x.cy}))}let P=M.length>=2?(()=>{let S=M.map(w=>w.x).sort((w,R)=>w-R),x=M.map(w=>w.y).sort((w,R)=>w-R),v=Math.floor(M.length/2);return{cx:S[v],cy:x[v]}})():null;if(P){let S=O=>Math.hypot(O.x-P.cx,O.y-P.cy),x=1/0,v=-1/0,w=[];for(let O of i){let C=1/0,A=-1/0;for(let _ of O.pts){let L=S(_);L<C&&(C=L),L>A&&(A=L)}w.push(A-C),C<x&&(x=C),A>v&&(v=A)}let R=v-x;w.sort((O,C)=>O-C);let T=w[Math.min(w.length-1,Math.floor(w.length*.9))];if(R>1e-9&&T/R<=gf){let O=i.map(D=>{let G=0;for(let j of D.pts)G+=S(j);return{row:D,radius:G/D.pts.length}}),C=0,A=0;for(let D of O)C+=D.radius,A+=D.row.focalDistance;C/=O.length,A/=O.length;let _=0;for(let D of O)_+=(D.radius-C)*(D.row.focalDistance-A);if(_<0)for(let D of O)D.radius=-D.radius;let N=1/0;for(let D of O)D.radius<N&&(N=D.radius);O.sort((D,G)=>D.radius-G.radius);let k=-1,F=-1/0,H=R/Math.max(1,O.length)*.5,B=[];for(let D of O)D.radius-F>H&&(k++,F=D.radius),D.row.ordinal=k,D.row.blockDepth=D.radius-N,B.push(D.row);return{sectionId:e,rows:B,blockCount:y}}}let I=[];for(let[,S]of g){let x=xf(S);if(x){let v=O=>{let C=0;for(let A of O.pts)C+=A.x*x.x+A.y*x.y;return C/O.pts.length};S.sort((O,C)=>v(O)-v(C)),S.length>=2&&S[0].focalDistance>S[S.length-1].focalDistance&&S.reverse();let w=[],R=f*.5;for(let O of S){let C=w[w.length-1];C&&Math.abs(v(O)-v(C[0]))<R?C.push(O):w.push([O])}let T=0;for(let O=0;O<w.length;O++){if(O>0){let C=1/0;for(let A of w[O-1])for(let _ of w[O])C=Math.min(C,h(A,_));T+=C}for(let C of w[O])C.ordinal=O,C.blockDepth=T,I.push(C)}}else{let v=1/0;for(let w of S)w.focalDistance<v&&(v=w.focalDistance);S.sort((w,R)=>w.focalDistance-R.focalDistance);for(let w=0;w<S.length;w++)S[w].ordinal=w,S[w].blockDepth=Math.max(0,S[w].focalDistance-v),I.push(S[w])}}return{sectionId:e,rows:I,blockCount:y}}var wf=/^\d{4}-\d{2}-\d{2}$/;function Pf(e){let t=Date.parse(e);return Number.isFinite(t)?wf.test(e)?t+864e5:t:null}function If(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Pf(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Rf(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Af(e){return e.status!=="draft"&&e.status!=="retracted"}function Ef(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function Ca(e,t={}){return!!e&&Af(e)&&Rf(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Ef(e,t.activeBasisSha256)&&If(e,t.now)}var Cf=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,_f=/[\s"'<>`\\]/;function Tf(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Cf.test(e);if(_f.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function _a(e){let t=e.trim();return Tf(t)?t:null}var hr="seatlayer.event-configuration/1";var zt=100,kf=120,Lf=2e5,Ff=1e4,Of=/^[a-f0-9]{64}$/,Df=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Sn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Bf(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ta(e){return!Array.isArray(e)||e.length>Lf||!e.every(t=>kt(t,zt))?null:[...new Set(e)].sort()}function Nf(e){return!Sn(e)||!kt(e.chartId,zt)||!kt(e.version,zt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Of.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function pr(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Vf(e){return Sn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&pr(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gf(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Ff)return null;let n=new Set(t),o=new Set,r=new Set,i=0,a=[];for(let s of e){if(!Sn(s)||!kt(s.id,zt)||!kt(s.objectId,zt)||!n.has(s.objectId)||!Df.has(String(s.kind))||!pr(s.heightM,.05,50)||s.baseElevationM!==void 0&&!pr(s.baseElevationM,-10,100))return null;let c=Vf(s.occlusion);if(!c||o.has(s.id)||r.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?_a(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;o.add(s.id),r.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function Hf(e){let t=[];if(!Sn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==hr&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${hr}`}),kt(e.id,zt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),kt(e.label,kf)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Bf(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Nf(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let o=Sn(e.overlay)?e.overlay:null,r=Ta(o?.objectIds),i=Ta(o?.productionKillSeatIds),a=r?Gf(o?.productionElements,r):null;return(!o||!r||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!r||!i||a===null?{issues:t}:{issues:t,value:{schema:hr,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function ka(e){let t=Hf(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function zf(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function Uf(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*r-s*i,y:t.y+a*i+s*r}}function La(e){let t=zf(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Uf(c,{x:t.reduce((l,u)=>l+u.x,0)/t.length,y:t.reduce((l,u)=>l+u.y,0)/t.length},n)),r=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(r)||a-r<1e-6||s-i<1e-6?null:{minX:r,minY:i,maxX:a,maxY:s}}var jf=5,Xf=3,Wf=.92,Yf=1.9,Kf=2,qf=.6,$f=1,Zf=.06;function Qf(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?Qn:Mn(e.stageKind)?Zf:$f}function Fa(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let a of Ba(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=La(c);l&&(t=Math.min(t,l.minX),n=Math.min(n,l.minY),o=Math.max(o,l.maxX),r=Math.max(r,l.maxY),i=Math.max(i,s+Qf(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function Jf(e,t,n,o){let r=1/0,i=1/0,a=-1/0,s=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(r=Math.min(r,d.x),a=Math.max(a,d.x),i=Math.min(i,d.y),s=Math.max(s,d.y));if(!Number.isFinite(r))return null;let c=r*t,l=i*t,u=Math.max(1,Math.ceil((a-r)*t/n)+1),m=Math.max(1,Math.ceil((s-i)*t/n)+1),h=new Float64Array(u*m).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let f=d.eyeHeightM-Qe,p=Math.min(u-1,Math.max(0,Math.floor((d.x*t-c)/n))),y=Math.min(m-1,Math.max(0,Math.floor((d.y*t-l)/n)))*u+p,g=f+o;g>h[y]&&(h[y]=g)}return{cellM:n,minX:c,minY:l,cols:u,rows:m,top:h}}function ed(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function Oa(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??fe,i=n.cellM??qf,a=n.chairBackM??Wf,s=n.selfRowSkipM??Kf,c=n.clearThreshold??.9,l=n.partialThreshold??.25,u=Math.max(1,n.columns??jf),m=Math.max(1,n.rows??Xf),h=Jf(e,r,i,a);if(!h)return o;let d=(t.maxX-t.minX)*r,f=(t.maxY-t.minY)*r,p=d>=f,b=(t.minX+t.maxX)/2*r,y=(t.minY+t.maxY)/2*r,g=[];for(let P=0;P<u;P++){let I=(P+.5)/u-.5,S=p?b+I*d:b,x=p?y:y+I*f;for(let v=0;v<m;v++){let w=t.deckTopM+(m===1?0:v/(m-1)*Yf);g.push({x:S,y:x,z:w})}}let M=i/2;for(let P of e){if(!Number.isFinite(P.eyeHeightM))continue;let I=P.x*r,S=P.y*r,x=P.eyeHeightM,v=0,w=1/0;for(let T of g){let O=T.x-I,C=T.y-S,A=Math.hypot(O,C);if(!(A>s)){v++;continue}let _=O/A,L=C/A,N=0;for(let k=s;k<A;k+=M){let F=ed(h,I+_*k,S+L*k);if(!(!Number.isFinite(F)||F>=x)&&F>x+(T.z-x)*k/A){N=k;break}}N?w=Math.min(w,N):v++}let R=v/g.length;R>=c||o.set(P.id,{seatId:P.id,mark:R<l?"obstructedView":"restrictedView",visibleFraction:R,totalRays:g.length,atDistanceM:Number.isFinite(w)?w:0})}return o}function Da(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function br(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var oo=Math.PI/180;var wn=16;function yr(e,t,n,o){let r=n*oo,i=Math.cos(r),a=Math.sin(r);return{x:o.x+e*i-t*a,y:o.y+e*a+t*i}}function za(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,a=[];if(e.path)return wa(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(o===0){for(let l=0;l<t;l++)a.push(yr(l*n,0,r,i));return a}let s=o/(t-1)*oo,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,m=c*Math.sin(u),h=-c+c*Math.cos(u);a.push(yr(m,h,r,i))}return a}function Ua(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function td(e,t){let n=Ua(e);return za(e).map((o,r)=>{let i=n.get(r),a=br(i),s=Ra(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:s,displayLabel:mr(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function nd(e){let t=[];for(let n of td(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function od(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function rd(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),r=(u,m,h,d)=>{let f=o.get(u),p=br(f),b=f?.label??`${e.label}-${u+1}`,y=e.displayLabel??e.label;return{index:u,label:b,displayLabel:f?.displayLabel??`${y}-${u+1}`,x:m+(f?.dx??0),y:h+(f?.dy??0),categoryKey:f?.categoryKey??e.categoryKey,skipped:!!f?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:f?.wheelchairSpaceType,commercial:f?.commercial,glyph:f?.glyph,viewUrl:f?.viewFromSeatUrl,viewMeta:f?.viewFromSeatUrl?f.viewFromSeatMeta:void 0,labelStyle:f?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let u=(e.radius??40)+wn,m=e.rotation*oo,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let b=0;b<n;b++){let y=m+b/n*2*Math.PI;t.push(r(b,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let d=h*oo,f=(2*Math.PI-d)/2,p=m+f;for(let b=0;b<n;b++){let y=p+b/(n-1)*d;t.push(r(b,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=od(e),c=["top","bottom","left","right"],l=0;for(let u of c){let m=s[u];for(let h=0;h<m;h++){let d,f;u==="top"?(d=-i/2+(h+.5)*i/m,f=-a/2-wn):u==="bottom"?(d=-i/2+(h+.5)*i/m,f=a/2+wn):u==="left"?(d=-i/2-wn,f=-a/2+(h+.5)*a/m):(d=i/2+wn,f=-a/2+(h+.5)*a/m);let p=yr(d,f,e.rotation,e.center);t.push(r(l++,p.x,p.y,u))}}return t}function id(e){return rd(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function ad(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Na(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,a=t[o].y,s=t[r].x,c=t[r].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function sd(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),s=(r.x-n.x)**2+(r.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function gr(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Le(e,t,n){return Na(e,t)&&!gr(n).some(o=>Na(e,o)||sd(e,o))}function no(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function ja(e){switch(e.type){case"row":{let t=za(e),n=Ua(e),o=0,r=0,i=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(o+=t[a].x+(s?.dx??0),r+=t[a].y+(s?.dy??0),i++)}return i?{x:o/i,y:r/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return no(e.points);case"section":return no(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?no(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Va(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function cd(e,t){if(e.type!=="gaArea"||!Va(e.points,t.outline))return!1;let n=gr(e.holes),o=gr(t.holes);return n.length===o.length&&n.every((r,i)=>Va(r,o[i]))}function ld(e,t,n=e.filter(r=>r.type==="section"),o=ja(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(cd(t,a)||Le(o,a.outline,a.holes))):void 0)??n.find(a=>Le(o,a.outline,a.holes))}function Ba(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Ga(e,t,n,o,r,i,a,s,c){let l=[],u=e.filter(p=>p.type==="section"),m=Pa(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),d=p=>Ca(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:s}),f=(p,b)=>d(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=nd(p):p.type==="table"?b=id(p):p.type==="booth"&&(b=ad(p)),!b.length)continue;for(let I of b)I.viewUrl&&!h(I.viewMeta)&&(I.viewUrl=void 0,I.viewMeta=void 0);if(p.type==="row"){let I=m.get(p.id);if(I){let S=new Map((p.overrides??[]).map(x=>[x.index,x]));for(let x of b){let v=Number(x.id.slice(x.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;x.logicalRowId=I.groupId,x.logicalSeatIndex=I.adjacencyOffset+v,S.get(v)?.displayLabel||(x.displayLabel=mr(p,v,I)),!x.viewUrl&&I.viewFromSeatUrl&&h(I.viewFromSeatMeta)&&(x.viewUrl=I.viewFromSeatUrl,x.viewMeta=I.viewFromSeatMeta);let w=S.get(v)?.confidenceEvidence;x.confidenceEvidence=f(w,"exact-seat")??f(p.confidenceEvidence,"row-representative")??f(I.confidenceEvidence,"row-representative")}}}let y=ld(e,p,u,p.type==="row"?no(b):ja(p)),g=y?.viewFromSeatUrl,P=(y?.zone?t?.find(I=>I.id===y.zone):void 0)?.focalPoint??n;for(let I of b){if(!I.confidenceEvidence){let S=Number(I.id.slice(I.id.lastIndexOf(":")+1)),x=(p.type==="row"||p.type==="table")&&Number.isInteger(S)?p.overrides?.find(v=>v.index===S)?.confidenceEvidence:void 0;I.confidenceEvidence=f(x,"exact-seat")??(p.type==="row"?f(p.confidenceEvidence,"row-representative"):void 0)}I.confidenceEvidence??=f(y?.confidenceEvidence,"section-representative")??(a?f(a.evidence,a.coverage):void 0),!I.viewUrl&&g&&h(y?.viewFromSeatMeta)&&(I.viewUrl=g,I.viewMeta=y?.viewFromSeatMeta),!I.viewUrl&&i&&h(i.meta)&&(I.viewUrl=i.url,I.viewMeta=i.meta),y&&(I.sectionId=y.logicalSectionId??y.id),y?.zone&&(I.zoneId=y.zone),P&&(I.focalPoint={...P})}l.push(...b)}return l}function Ut(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,a=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Ga(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ha(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let l of c)l.floorId=r.id;for(let l of c)o.push(l)}return o}let n=Ga(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Ha(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),ud(e,n,t)}function ud(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Da(t,Oa(t,Fa(e))),t}function Ha(e,t,n,o){let r=e.filter(m=>m.type==="section"),i=n>0||r.some(m=>m.height!==void 0||m.rake!==void 0||(m.elevation??0)>0);if(!r.length||!i||!t){for(let m of o)m.eyeHeightM=n+Qe;return}let a=new Array(o.length),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,m);let c=new Map,l=new Map;for(let m=0;m<o.length;m++){let h=o[m],f=(h.sectionId?s.get(h.sectionId)??r.find(b=>b.logicalSectionId===h.sectionId&&Le({x:h.x,y:h.y},b.outline,b.holes)):void 0)??r.find(b=>Le({x:h.x,y:h.y},b.outline,b.holes))??null;if(a[m]=f,!f)continue;c.has(f.id)||c.set(f.id,dt(f,{floorBaseHeightM:n}));let p=l.get(f.id);p?p.push(m):l.set(f.id,[m])}let u=new Array(o.length).fill(void 0);for(let[m,h]of l){let d=c.get(m);if(!d)continue;let f=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=to(m,o,h,t);for(let b of p.rows){let y=b.blockDepth*fe*f,g=d.height+y;for(let M of b.seatIndices)u[M]=g}}for(let m=0;m<o.length;m++){let h=o[m],d=a[m];if(!d){h.eyeHeightM=n+Qe;continue}let f=c.get(d.id);h.eyeHeightM=(u[m]??f.height)+Qe}}function Xa(e){let t=1/0,n=1/0,o=-1/0,r=-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>o&&(o=a.x),a.y>r&&(r=a.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function jt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function Pn(e){if(e.length<3)return e.map(i=>({...i}));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),o=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},r=[...o(t),...o([...t].reverse())];return r.length>=3?r.map(i=>({...i})):t.map(i=>({...i}))}var ms=it(require("polygon-clipping"),1);var ne={top:1,wallBottom:.58,bottomCap:.4};function Lt(e,t){if(!e)return t;let n=ie(Ye(e,.4),.62);return be(t,n,.22)}function Wa(e,t){return e?be(t,ie(Ye(e,.25),.74),.62):t}function Ya(e,t){return e?be(t,ie(Ye(e,.08),.9),.82):t}function Ka(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let a=o.get(i.sectionId);a||(a=new Map,o.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,a]of o){let s=0,c=0,l=0,u=0;for(let[m,h]of a){let d=pe(n.get(m));d&&(s+=d[0]*h,c+=d[1]*h,l+=d[2]*h,u+=h)}u>0&&r.set(i,[s/u,c/u,l/u])}return r}function qa(e,t){return pe(e.color)??t.get(e.logicalSectionId??e.id)??null}var Sr=it(require("polygon-clipping"),1);var Mr=it(require("polygon-clipping"),1);var Ja=it(require("earcut"),1);var md=.58,$a=.01,Ue=at*1.5*ze,fd=.5,dd=.6;function hd(e,t){let n=e.length,o=[];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,m=Math.hypot(l,u);if(m<1e-9){o.push([0,0]);continue}l/=m,u/=m,o.push([-u,l])}let r=0;for(let a=0;a<n;a++)r+=(e[a].x-t.x)*o[a][0]+(e[a].y-t.y)*o[a][1];return r<0?o.map(([a,s])=>[-a,-s]):o}function pd(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(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}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Za=Math.PI/12;function bd(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),o=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},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function es(e,t){if(!e.length||!(t>0))return[];let n=bd(e),o=(s,c,l,u)=>{let m=l-c;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let h=Math.max(1,Math.ceil(m/Za)),d=t/Math.cos(m/h/2);for(let f=0;f<=h;f++){let p=c+m*f/h;u.push({x:s.x+Math.cos(p)*d,y:s.y+Math.sin(p)*d})}};if(n.length<3){let s=0,c=0;for(let d of n)s+=d.x,c+=d.y;s/=n.length||1,c/=n.length||1;let l=0;for(let d of n)l=Math.max(l,Math.hypot(d.x-s,d.y-c));let u=[],m=Math.max(3,Math.ceil(Math.PI*2/Za)),h=(l+t)/Math.cos(Math.PI/m);for(let d=0;d<m;d++){let f=d/m*Math.PI*2;u.push({x:s+Math.cos(f)*h,y:c+Math.sin(f)*h})}return u}let r=n.length,i=[];for(let s=0;s<r;s++){let c=n[s],l=n[(s+1)%r];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<r;s++)o(n[s],i[(s+r-1)%r],i[s],a);return is(a)}function yd(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+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 m=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));m<o&&(o=m)}return o}function ro(e){let t=e.map(r=>{let i=0,a=0;for(let l of r.pts)i+=l.x,a+=l.y;let s=r.pts.length||1;i/=s,a/=s;let c=0;for(let l of r.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),a=[],s=1/0,c=null;for(let u of i){let m=1/0;for(let h=0;h<e.length;h++){if(h===r||Math.abs(e[h].y-e[r].y)<.001)continue;let d=t[h],f=Math.hypot(u.x-d.cx,u.y-d.cy)-d.rad;if(f>=m&&f>=s)continue;let p=yd(e[h].pts,u.x,u.y);p<m&&(m=p),e[h].depth<e[r].depth&&p<s&&(s=p,c=e[h].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((u,m)=>u-m);let l=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function ts(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],m=u.x-o.x,h=u.y-o.y,d=Math.hypot(m,h)||1;m/=d,h/=d;let f=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+h*f,y:u.y-m*f},{x:u.x-h*f,y:u.y+m*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let m=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,l=pd(i,Math.max(c*dd,Ue));return{pts:l,nrm:hd(l,o),front:Math.max(n[t].pitch*md,Ue),back:Math.max(n[t].pitch*fd,Ue)}}var Xt=1.5,ns=.3;function xr(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,a=Math.hypot(r,i),s=-1,c=-1;for(let m=1;m<e.length-1;m++){let h=e[m],d=a>1e-12?Math.abs((h.x-n.x)*i-(h.y-n.y)*r)/a:Math.hypot(h.x-n.x,h.y-n.y);d>s&&(s=d,c=m)}if(s<=t||c<0)return[n,o];let l=xr(e.slice(0,c+1),t),u=xr(e.slice(c),t);return[...l.slice(0,-1),...u]}function os(e,t){if(e.length<4)return e;let n=xr([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function gd(e){let t=e.map((o,r)=>{let i=e[(r+1)%e.length];return{a:o,b:i,i:r,minX:Math.min(o.x,i.x),maxX:Math.max(o.x,i.x),minY:Math.min(o.y,i.y),maxY:Math.max(o.y,i.y)}}).sort((o,r)=>o.minX-r.minX),n=(o,r,i)=>(r.x-o.x)*(i.y-o.y)-(r.y-o.y)*(i.x-o.x);for(let o=0;o<t.length;o++){let r=t[o];for(let i=o+1;i<t.length&&t[i].minX<=r.maxX;i++){let a=t[i];if(!(Math.abs(r.i-a.i)===1||Math.abs(r.i-a.i)===e.length-1||r.maxY<a.minY||a.maxY<r.minY)&&n(r.a,r.b,a.a)*n(r.a,r.b,a.b)<=0&&n(a.a,a.b,r.a)*n(a.a,a.b,r.b)<=0)return!0}}return!1}function rs(e,t,n){if(e.length<2)return[];let o=n??ro(e),r=new Map;for(let a=0;a<e.length;a++){let s=r.get(e[a].blockId);s?s.push(a):r.set(e[a].blockId,[a])}let i=[];for(let[,a]of r){let s=[];for(let g of a){let M=e[g].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,M)=>e[g].depth-e[M].depth);let l=s.map(g=>ts(e,g,o,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,M)=>({x:g.pts[M].x-g.nrm[M][0]*(g.front+Xt),y:g.pts[M].y-g.nrm[M][1]*(g.front+Xt)}),m=(g,M)=>({x:g.pts[M].x+g.nrm[M][0]*(g.back+Xt),y:g.pts[M].y+g.nrm[M][1]*(g.back+Xt)}),h=l[0],d=l[l.length-1],f=[];for(let g=0;g<h.pts.length;g++)f.push(u(h,g));for(let g of l)f.push(m(g,g.pts.length-1));for(let g=d.pts.length-1;g>=0;g--)f.push(m(d,g));for(let g=l.length-1;g>=0;g--)f.push(u(l[g],0));let p=is(f),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Be(p))>1e-6&&l.every(g=>{let M=g.pts[Math.floor(g.pts.length/2)];return Ne(p,M.x,M.y)})&&!gd(p)){i.push({outline:os(p,ns),holes:[],topY:b});continue}for(let g of xd(l))i.push({outline:g,holes:[],topY:b})}return i}function xd(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Xt,a=n.back+Xt;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];o.push([l.x-u[0]*i,l.y-u[1]*i]),r.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...o,...r.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Mr.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[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&&o.push(os(i,ns))}return o}catch{return[]}}function is(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.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 vr=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 o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.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 o=!0;for(let r of t)if(!Ne(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function Qa(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let l=[0,1,0],u=o[0];for(let m=1;m+1<o.length;m++){let h=o[m],d=o[m+1];e.tri([u.x*E,r,u.y*E],[h.x*E,r,h.y*E],[d.x*E,r,d.y*E],l,i)}return}let a=o.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Mr.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],m=[],h=[];for(let f=0;f<u.length-1;f++)m.push(u[f][0],u[f][1]),h.push([u[f][0],u[f][1]]);if(h.length<3)continue;let d=(0,Ja.default)(m,void 0,2);for(let f=0;f<d.length;f+=3){let p=h[d[f]],b=h[d[f+1]],y=h[d[f+2]];e.tri([p[0]*E,r,p[1]*E],[b[0]*E,r,b[1]*E],[y[0]*E,r,y[1]*E],c,i)}}}function as(e,t,n,o,r,i,a){if(t.length<2)return;let s=a??ro(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new vr([[...i]]):null,m=d=>{e.setMaterial(2),d(),e.setMaterial(0)},h=d=>{e.setMaterial(3),d(),e.setMaterial(0)};for(let d=0;d<t.length;d++){let f=t[d];if(f.patch&&f.patch.length>=3){let I=[...f.patch],S=s[d].belowY??o;if(h(()=>{if(l&&u)Qa(e,l,u,I,f.y,r.tread);else{let x=I[0];for(let v=1;v+1<I.length;v++){let w=I[v],R=I[v+1];e.tri([x.x*E,f.y,x.y*E],[w.x*E,f.y,w.y*E],[R.x*E,f.y,R.y*E],c,r.tread)}}}),f.y>S+$a){let x=0,v=0;for(let w of I)x+=w.x,v+=w.y;x/=I.length,v/=I.length,m(()=>{for(let w=0;w<I.length;w++){let R=I[w],T=I[(w+1)%I.length],O=T.x-R.x,C=T.y-R.y,A=Math.hypot(O,C);if(A<1e-6)continue;let _=C/A,L=-O/A;(R.x-x)*_+(R.y-v)*L<0&&(_=-_,L=-L);let N=[_,0,L],k=[R.x*E,f.y,R.y*E],F=[T.x*E,f.y,T.y*E],H=[R.x*E,S,R.y*E],B=[T.x*E,S,T.y*E];e.tri(k,F,B,N,r.riser),e.tri(k,B,H,N,r.riser)}})}continue}let p=ts(t,d,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:M}=p,P=s[d].belowY??o;for(let I=0;I+1<b.length;I++){let S=b[I],x=b[I+1],v=y[I],w=y[I+1];if(Math.hypot(x.x-S.x,x.y-S.y)<1e-6||v[0]===0&&v[1]===0||w[0]===0&&w[1]===0)continue;let R=[(S.x-v[0]*g)*E,f.y,(S.y-v[1]*g)*E],T=[(x.x-w[0]*g)*E,f.y,(x.y-w[1]*g)*E],O=[(S.x+v[0]*M)*E,f.y,(S.y+v[1]*M)*E],C=[(x.x+w[0]*M)*E,f.y,(x.y+w[1]*M)*E];if(h(()=>{l&&u?Qa(e,l,u,[{x:S.x-v[0]*g,y:S.y-v[1]*g},{x:x.x-w[0]*g,y:x.y-w[1]*g},{x:x.x+w[0]*M,y:x.y+w[1]*M},{x:S.x+v[0]*M,y:S.y+v[1]*M}],f.y,r.tread):(e.tri(R,T,C,c,r.tread),e.tri(R,C,O,c,r.tread))}),f.y>P+$a){let A=[R[0],P,R[2]],_=[T[0],P,T[2]],L=[-v[0],0,-v[1]];m(()=>{e.tri(R,T,_,L,r.riser),e.tri(R,_,A,L,r.riser)})}}}}function vd(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ss(e,t){return e.filter(n=>n.type!=="shape"||vd(n,t))}function cs(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:ss(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:ss(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Md={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ct(e){return Xa(e)??Md}function ls(e,t){let n=Ke(e.outline,Ue),o=ct(n),r=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(o,ct(a.outline)));if(!r.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Sr.default.difference([i(n)],...r.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function us(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},o=t.map(i=>[n(i)]),r=[];for(let i of e){let a;try{a=Sr.default.intersection([n(i.outline)],o.flat())}catch{r.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&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function Sd(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var io=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=ct(t),i=this.rings.filter((c,l)=>jt(r,this.boxes[l])&&Sd(n,this.levels[l])),a=[[o]];if(i.length)try{a=ms.default.difference([o],...i).map(l=>l.map(u=>u.map(([m,h])=>[m,h])))}catch{a=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function ao(e,t){if(!t)return e;let n=1/0,o=-1/0,r=1/0,i=-1/0;for(let m of e)n=Math.min(n,m.x),o=Math.max(o,m.x),r=Math.min(r,m.y),i=Math.max(i,m.y);let a=(n+o)/2,s=(r+i)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(m=>{let h=m.x-a,d=m.y-s;return{x:a+h*l-d*u,y:s+h*u+d*l}})}function ge(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=gn(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,o=(e.y??0)+e.height/2;t=$n(n,o,e.width/2,e.height/2)}return t?ao(t,e.rotation):null}function qe(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},o=t==="stage"&&Mn(e.stageKind)?{kind:"stage",heightM:e.stageKind==="ring-boxing"?Qn:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var wd=.08,Pd=30,Id=.015;function Rd(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function fs(e,t){let n=ge(e)??(e.points?.length?ao(e.points,e.rotation):null),o=qe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Be(n))*fe**2>=Pd?Id:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let d of n)a=Math.min(a,d.x),s=Math.min(s,d.y),c=Math.max(c,d.x),l=Math.max(l,d.y);let u=i,m=0,h=1e-6*Math.max(1,c-a,l-s);for(let d of t)c>d.minX&&a<d.maxX&&l>d.minY&&s<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+wd),a>=d.minX-h&&c<=d.maxX+h&&s>=d.minY-h&&l<=d.maxY+h&&(!d.poly||n.every(b=>Rd(b,d.poly)||Ad(b,d.poly,h)))&&(m=Math.max(m,d.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:a,minY:s,maxX:c,maxY:l,topOffsetM:u,poly:n}),{topOffsetM:u,supportOffsetM:Math.min(m,u)}}function Ad(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l)):0;if(Math.hypot(e.x-(i.x+u*s),e.y-(i.y+u*c))<=n)return!0}return!1}function bt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ve(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 _e(e,t,n){return[bt(e[0],e[1],t),bt(e[0],e[1],n),bt(e[3],e[2],n),bt(e[3],e[2],t)]}function In(e,t,n){return[bt(e[0],e[3],t),bt(e[1],e[2],t),bt(e[1],e[2],n),bt(e[0],e[3],n)]}function he(e,t,n,o,r,i){ae(e,t,void 0,()=>n,o,r,i,ne)}var Ed=.8,Cd=.6,_d=2;function Wt(e,t){if(!t.length)return null;let n=[],o=0;for(let a of e.objects){if(a.type!=="shape"||a.role!=="wall")continue;let s=ge(a)??[],c=ds(s)/2;!(c>0)||Ld(s)/c*E>_d||(n.push(...s),o+=c)}if(n.length<3)return null;let r=Pn(n);if(r.length<3||o<ds(r)*Cd)return null;let i=0;for(let a of t)Fd(a,r)&&(i+=1);return i>=t.length*Ed?r:null}var hs=6,Td=5,kd=8;function ps(e){return Math.max(kd,(Number.isFinite(e)?e:0)+Td)}function bs(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length],s=i.x*a.y-a.x*i.y;t+=s,n+=(i.x+a.x)*s,o+=(i.y+a.y)*s}if(Math.abs(t)<1e-9){let r=0,i=0;for(let a of e)r+=a.x,i+=a.y;return{x:r/Math.max(1,e.length),y:i/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function Ld(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function ds(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=Math.hypot(r.x-o.x,r.y-o.y)}return t}function Fd(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Od(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function Dd(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let d of e)n+=d.x,o+=d.y,r+=Math.hypot(d.x-t.x,d.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let a=e[0],s=-1;for(let d of e){let f=Math.hypot(d.x-n,d.y-o);f>s&&(s=f,a=d)}let c=a.x-n,l=a.y-o,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let m=[...e].sort((d,f)=>(d.x-n)*c+(d.y-o)*l-((f.x-n)*c+(f.y-o)*l)),h=0;for(let d of m){let f=Math.hypot(d.x-n,d.y-o);f>h&&(h=f)}return{pts:m,cx:n,cy:o,radius:h,depth:r}}function ys(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let a=o[i],s=o[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,m=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;m<0?m=0:m>1&&(m=1);let h=Math.hypot(t-(a.x+m*c),n-(a.y+m*l));h<r&&(r=h)}return r}var so=8;function Bd(e,t,n){let o=new Array(so).fill(1/0),r=new Array(so).fill(-1);for(let u=0;u<e.length;u++){let m=e[u],h=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let d=0;d<so;d++)if(h<o[d]){for(let f=so-1;f>d;f--)o[f]=o[f-1],r[f]=r[f-1];o[d]=h,r[d]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let m=ys(e[u],t,n);for(let h=0;h<3;h++)if(m<i[h]){for(let d=2;d>h;d--)i[d]=i[d-1],a[d]=a[d-1];i[h]=m,a[h]=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 m=a[u];if(m<0||i[u]>s)continue;let h=1/(i[u]*i[u]);c+=h*e[m].depth,l+=h}return l>0?c/l:e[a[0]].depth}function Nd(e){let t=(o,r)=>Bd(e,o,r),n=(o,r)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let l=ys(c,o,r);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,a=(t(o,r+.5)-t(o,r-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function gs(e,t){let n=[];for(let o of e){let r=Dd(o.points,t);r&&n.push(r)}return n.length<2?Od(t):(n.sort((o,r)=>o.depth-r.depth),Nd(n))}var yt=.06,Vd=.05,vs=.05,xs=.15,wr=25;function Ms(e,t,n){let o=new Map,r=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 h=0;h<e.length;h+=1){let d=e[h];for(let f of d.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=Ke(f.outline,Ue);c.set(f.id,{section:f,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:f.id,floorIndex:h,box:ct(p),section:f,unit:d,outline:p})}}let m=new Map;for(let h of l){let d=m.get(h.floorIndex);d?d.push(h):m.set(h.floorIndex,[h])}for(let h=0;h<t.length;h++){let d=t[h],f=n?m.get(n[h])??[]:l,p=d.sectionId?f.find(y=>y.id===d.sectionId)??f.find(y=>y.section.logicalSectionId===d.sectionId&&Le({x:d.x,y:d.y},y.outline,y.section.holes)):void 0,b=p?[p]:f;for(let y of b){if(n&&y.floorIndex!==n[h]||!p&&(d.x<y.box.minX||d.x>y.box.maxX||d.y<y.box.minY||d.y>y.box.maxY||!Le({x:d.x,y:d.y},y.outline,y.section.holes)))continue;r[h]=y.id;let g=c.get(y.id);g.hasSeats=!0;let M=d.focalPoint??y.unit.focal,P=Math.hypot(d.x-M.x,d.y-M.y);P<g.frontU&&(g.frontU=P),g.seatIndices.push(h);let I=d.rowId||`__seat-${h}`,S=g.rows.get(I);S?S.push({x:d.x,y:d.y}):g.rows.set(I,[{x:d.x,y:d.y}]);break}}for(let[h,d]of c){let f=dt(d.section,{floorBaseHeightM:d.unit.baseHeightM}),p=d.unit.baseHeightM,b=f.rake>0?Math.tan(f.rake*Math.PI/180):0,y=f.rake<=.01&&f.height<=p+.001,g=d.section.surfaceKind,M=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:y,P=d.hasSeats?to(h,t,d.seatIndices,d.unit.focal):{sectionId:h,rows:[],blockCount:0},S=P.rows.length<2?gs([...d.rows.values()].map(k=>({points:k})),d.unit.focal):null,x=1/0;if(S){if(d.hasSeats)for(let k of d.rows.values())for(let F of k){let H=S.depthAt(F.x,F.y);H<x&&(x=H)}if(!d.hasSeats||!Number.isFinite(x)){x=1/0;for(let k of d.section.outline){let F=S.depthAt(k.x,k.y);F<x&&(x=F)}}}let v=p+Vd,w=Math.max(v,f.height),R=k=>{let F=Math.max(0,k-x)*fe,H=Math.min(F*b,wr);return Math.max(v,f.height+H)},T=k=>{let F=Math.max(0,k)*fe,H=Math.min(F*b,wr);return Math.max(v,f.height+H)},O=M?[]:P.rows.map(k=>({pts:k.pts,y:T(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...u.has(k.id)?{patch:es(k.pts,Ue)}:{}})),C=O.length?O[0].y:w,A=O.map(k=>{let F=k.patch&&k.patch.length>=3?k.patch:k.pts,H=0,B=0;for(let j of F)H+=j.x,B+=j.y;let D=F.length||1;H/=D,B/=D;let G=0;for(let j of F){let V=Math.hypot(j.x-H,j.y-B);V>G&&(G=V)}return{cx:H,cy:B,rad:G}}),_=M?()=>w:O.length>=2?(k,F)=>{let H=1/0,B=C;for(let D=0;D<O.length;D++){let G=A[D];if(Math.hypot(k-G.cx,F-G.cy)-G.rad>=H)continue;let j=O[D].patch,V=j&&j.length>=3?Ne(j,k,F)?0:Ht(j,k,F):Ht(O[D].pts,k,F);V<H&&(H=V,B=O[D].y)}return B}:(k,F)=>S?R(S.depthAt(k,F)):w,L=[0,1,0],N=O.length>=2||M?()=>L:(k,F)=>{if(!S)return L;let H=S.depthAt(k,F);if(H<=x)return L;let B=(H-x)*fe;if(B*b>=wr||f.height+B*b<=v)return L;let[D,G]=S.gradientAt(k,F);if(D===0&&G===0)return L;let j=1/Math.hypot(b,1);return[-D*b*j,j,-G*b*j]};if(!M)for(let k of P.rows){let F=T(k.blockDepth);for(let H of k.seatIndices)a[H]=F}for(let k of P.rows){let F=[];for(let j=1;j<k.pts.length;j++){let V=Math.hypot(k.pts[j].x-k.pts[j-1].x,k.pts[j].y-k.pts[j-1].y);V>1e-6&&F.push(V)}F.sort((j,V)=>j-V);let H=F.length?F[Math.floor(F.length/2)]:1/0,B=1/0,D=k.pts[Math.floor(k.pts.length/2)];if(D)for(let j of P.rows){if(j===k||j.blockId!==k.blockId)continue;let V=Ht(j.pts,D.x,D.y);V>1e-6&&V<B&&(B=V)}let G=Math.min(H,Math.max(B,H*.5));if(Number.isFinite(G)&&G>0)for(let j of k.seatIndices)s[j]=G}o.set(h,{sectionId:h,deckAt:_,normalAt:N,flat:M,bottomY:p,rowLevels:O,landingY:C})}for(let h=0;h<t.length;h++){let d=r[h],f=t[h];if(d){let y=a[h];i[h]=(y??o.get(d).deckAt(f.x,f.y))+xs;continue}let p=f.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-Qe):0;i[h]=f.kind==="booth"?b+yt+xs:b}return{bySection:o,seatOwner:r,seatDeckY:h=>i[h],seatPitchU:h=>s[h]}}function Yt(e,t,n){if(e.length!==4||n<=t)return null;let o=Ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*E;if(r<1e-6||i<1e-6)return null;let a=Math.min(.22/r,.16),s=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:a,face:c,opening:_e(o,a,1-a),openingTop:n-s}}function Pr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=Ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),a=i/r,s=_e(o,a,1-a);return{quad:o,side:a,trim:i,inner:s,panel:In(s,.15,.85),bottom:t+i,top:n-i}}function Ss(e,t,n,o){let r=Pr(e,t,n);if(!r)return;let{panel:i}=r,a=(g,M)=>({x:(g.x+M.x)/2,y:(g.y+M.y)/2}),s=a(i[0],i[1]),c=a(i[3],i[2]),l=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[u,m]=l?[i[0],i[1]]:[i[3],i[2]],h=l?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},d=Math.hypot(h.x,h.y);if(d<1e-6)return;-(m.y-u.y)*h.x+(m.x-u.x)*h.y<0&&([u,m]=[m,u]);let f=Math.min(.006,d*E*.05),p=h.x/d*f,b=h.y/d*f,y=(g,M)=>[g.x*E+p,M,g.y*E+b];return[y(u,r.bottom),y(m,r.bottom),y(u,r.top),y(m,r.top)]}var ws=it(require("polygon-clipping"),1);function lt(e,t,n,o,r,i,a,s={}){let c=ct(t),l=s.ao??ne,u=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=ge(p);if(!b||b.length!==4||!jt(c,ct(b)))return[];let y=s.portalBase??n,g=Yt(b,y,y+qe(p).heightM);if(!g)return[];let M=Math.min(o,g.openingTop);return M<=n?[]:[{poly:g.opening,height:M}]});if(!u.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),h=[m(t),...(s.holes??[]).map(m)],d=[n,...new Set(u.map(p=>p.height)),o].sort((p,b)=>p-b),f=[];try{for(let p=1;p<d.length;p++){let b=d[p-1],y=d[p];if(y-b<1e-6)continue;let g=u.filter(P=>P.height>b+1e-6).map(P=>[m(P.poly)]),M=g.length?ws.default.difference(h,...g):[h];f.push({low:b,high:y,polys:M})}}catch{return!1}for(let p of f)for(let b of p.polys){let[y,...g]=b.map(P=>P.map(([I,S])=>({x:I,y:S}))),M=P=>l.wallBottom+(l.top-l.wallBottom)*(P-n)/(o-n);ae(e,y,g,()=>p.high,p.low,i,a,{...l,top:M(p.high),wallBottom:M(p.low)})}return!0}function Ps(e,t,n,o,r,i,a){let s=o-n;if(s<=0)return;let c=s<1.5?[[n,o,1]]:[[n,n+Math.min(.9,s*.18),.82],[n+Math.min(.9,s*.18),o-.1,1],[o-.1,o,1.1]],l=u=>ne.wallBottom+(ne.top-ne.wallBottom)*(u-n)/s;for(let[u,m,h]of c){let d={...ne,top:l(m),wallBottom:l(u)},f=ie(i,h),p=ie(a,h);lt(e,t,u,m,r,f,p,{portalBase:n,ao:d})||ae(e,t,void 0,()=>m,u,f,p,d)}}function Rn(e,t,n){let o=pe(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",a=i?ao(t.points??[],t.rotation):ge(t);if(!a||a.length<2)return;let s=i?a.length-1:a.length,c=r*.5;for(let l=0;l<s;l++){let u=a[l],m=a[(l+1)%a.length],h=Math.hypot(m.x-u.x,m.y-u.y);if(h<1e-6)continue;let d=-(m.y-u.y)/h*c,f=(m.x-u.x)/h*c,p=[(u.x+d)*E,n,(u.y+f)*E],b=[(m.x+d)*E,n,(m.y+f)*E],y=[(m.x-d)*E,n,(m.y-f)*E],g=[(u.x-d)*E,n,(u.y-f)*E];e.tri(p,b,y,[0,1,0],o),e.tri(p,y,g,[0,1,0],o)}}function Is(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var Kt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function co(e,t,n,o){let[r,i,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[Kt(r,s,n),Kt(i,a,n),Kt(i,a,o),Kt(r,s,o)]}function Rs(e,t,n,o,r,i,a,s,c=!1){if(n.length!==4||r-o<.4)return!1;let l=v=>c?Math.min(v,r):v,u=Ve(n),m=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*E;if(m<.4)return!1;let h=Kt(u[0],u[1],.5),d=Kt(u[3],u[2],.5),f=Math.hypot(h.x-s.x,h.y-s.y)<=Math.hypot(d.x-s.x,d.y-s.y),p=be(a,[.92,.9,.86],.35),b=ie(i,.72),y=r-o;if(t==="restroom"){let v=Math.min(.18,y*.08);return he(e,u,r-v,o,a,i),he(e,u,r,r-v,p,p),!0}let g=o+Math.min(1.1,y),M=t==="coat"?1:Math.min(.5,.75/m),P=co(u,f,0,M);if(he(e,P,g-.05,o,b,i),he(e,P,g,g-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let v=co(u,f,Math.max(M+.2,1-.45/m),1),w=l(o+Math.max(Math.min(2.2,y*2),g-o+.6));return he(e,v,w,o,a,b),!0}let I=co(u,f,Math.max(M+.25,.55),1),S=l(o+Math.max(2.6,g-o+1.4));if(S-.14<=g)return!0;he(e,I,S-.14,o,a,i),he(e,u,S,S-.14,p,b);let x=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*E));for(let[v,w]of[[0,x],[1-x,1]])he(e,co(_e(u,v,w),f,0,Math.min(.08,.1/m)),S-.14,g,b,b);return!0}var Gd=[.12,.38,.16],Hd=[.72,.62,.45],zd=[.88,.93,.96],As=[.95,.95,.94],Ud=[.66,.29,.22],Ir={length:20.12,width:3.05},jd=.14,Xd=9.76,ut=[.93,.94,.95],lo=[.1,.11,.13],Wd=[.45,.85,1.25],Yd=1.45,Es=.012,Cs=.004,Kd=1.07,qd=.15;function $t(e,t,n,o,r,i){e.setMaterial(i),ae(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,ne)}var _s=(e,t)=>ht(e,t/E);function Ts(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<1e-9)return null;let a=-r/i*n,s=o/i*n;return[{x:e.x+a,y:e.y+s},{x:t.x+a,y:t.y+s},{x:t.x-a,y:t.y-s},{x:e.x-a,y:e.y-s}]}function $d(e,t,n,o){let r=t.map(i=>[i.x*E,n,i.y*E]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function uo(e,t,n,o,r,i){let a=n/E,s=[{x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a},{x:t.x-a,y:t.y+a}];ae(e,s,void 0,()=>r,o,i,ie(i,.85),ne)}function qt(e,t,n,o,r,i,a){let s=Ts(t,n,o/E);s&&ae(e,s,void 0,()=>i,r,a,ie(a,.85),ne)}function mo(e){let t=Ve(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},a={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,l)=>({x:n.x+(i.x*c+a.x*l)/E,y:n.y+(i.y*c+a.y*l)/E}),lengthM:o*E,widthM:r*E}}function ks(e,t,n){let o=Ma(t);if(!o.length)return;let r=1/0,i=-1/0,a=1/0,s=-1/0;for(let M of t.points??[])r=Math.min(r,M.x),i=Math.max(i,M.x),a=Math.min(a,M.y),s=Math.max(s,M.y);let c=(t.rotation??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),m=(r+i)/2,h=(a+s)/2,d=M=>c?{x:m+(M.x-m)*l-(M.y-h)*u,y:h+(M.x-m)*u+(M.y-h)*l}:M,f=Math.min(i-r,s-a)*E,p=Math.max(.04,Math.min(.3,f*.004))/E,b=0;e.setMaterial(0);for(let M of o){if(!M.fill)continue;let P=M.points.map(d);$t(e,P,null,n+Es+b*Cs,pe(M.fill)??ut,0),b++}let y=o.filter(M=>!(M.fill&&M.ink===M.fill)),g=[...new Set(y.map(M=>M.ink??Jn))];for(let M of g){let P=n+Es+b++*Cs,I=pe(M)??ut;for(let S of y){if((S.ink??Jn)!==M)continue;let x=S.points.map(d),v=S.closed?x.length:x.length-1;for(let w=0;w<v;w++){let R=Ts(x[w],x[(w+1)%x.length],p);R&&$d(e,R,P,I)}}}}function Ls(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,a=r??Gd;if(n==="oval-cricket"){let s=t.reduce((I,S)=>I+S.x,0)/t.length,c=t.reduce((I,S)=>I+S.y,0)/t.length,l=I=>t.map(S=>({x:s+(S.x-s)*I,y:c+(S.y-c)*I})),u=8;for(let I=0;I<u;I++){let S=l(1-I/u),x=I===u-1?null:l(1-(I+1)/u);$t(e,S,x,i,ie(a,I%2?1.04:.96),4)}let m=t[0];for(let I of t)Math.hypot(I.x-s,I.y-c)>Math.hypot(m.x-s,m.y-c)&&(m=I);let h=Math.hypot(m.x-s,m.y-c)||1,d=(m.x-s)/h,f=(m.y-c)/h,p=-f,b=d,y=Math.min(1,2*h*E*jd/Ir.length),g=Ir.length*y/2/E,M=Ir.width*y/2/E,P=[[-g,-M],[g,-M],[g,M],[-g,M]].map(([I,S])=>({x:s+d*I+p*S,y:c+f*I+b*S}));return $t(e,P,null,i+.004,Hd,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let s=_s(t,qd);return $t(e,s,null,i,zd,0),e.setMaterial(0),ae(e,t,[s.slice().reverse()],()=>o+Kd,o,As,ie(As,.9),ne),!0}if(n==="ring-boxing"&&t.length===4){let{at:s}=mo(t),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],l=[[.77,.19,.19],ut,[.17,.42,.69],ut];e.setMaterial(0),c.forEach((u,m)=>uo(e,u,.07,o,o+Yd,l[m]));for(let u of Wd)for(let m=0;m<4;m++)qt(e,c[m],c[(m+1)%4],.025,o+u-.025,o+u+.025,ut);return!0}if(n==="court-tennis"&&t.length===4){let{at:s}=mo(t);e.setMaterial(0),qt(e,s(0,-6.4),s(0,6.4),.015,o,o+.95,lo),qt(e,s(0,-6.4),s(0,6.4),.03,o+.95,o+1,ut);for(let c of[-1,1])uo(e,s(0,c*6.4),.05,o,o+1.07,lo);return!0}if(n==="court-basketball"&&t.length===4){let{at:s,lengthM:c}=mo(t),l=Math.min(14,c/2-.5);e.setMaterial(0);for(let u of[-1,1]){let m=s(u*(l+1.2),0),h=s(u*(l-1.2),0);uo(e,m,.12,o,o+3.4,lo),qt(e,m,h,.06,o+3.25,o+3.4,lo),qt(e,s(u*(l-1.2),-.9),s(u*(l-1.2),.9),.03,o+2.9,o+3.95,ut)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:s,lengthM:c}=mo(t),l=c*(50/120);e.setMaterial(0);for(let u of[-1,1]){for(let m of[-2.8,2.8])uo(e,s(u*l,m),.07,o,o+12,ut);qt(e,s(u*l,-2.8),s(u*l,2.8),.06,o+2.94,o+3.06,ut)}return!0}if(n==="track-athletics"){let s=_s(t,Xd);return s.length<3?!1:($t(e,t,s,i,Ud,0),$t(e,s,null,i,a,4),e.setMaterial(0),!0)}return!1}var Fs=[.19,.4,.15],Zd=.012,po=2.4,Qd=1,Jd=.75,eh=.15;function $e(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=o/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,m])=>({x:t.x+u*a-m*s,y:t.y+u*s+m*a}))}function Gs(e,t,n,o,r,i,a=!1){let s=$e(t);if(s){if(a){let c=Lt(o,r.boothTop),l=Je([...s]);ae(e,Ke(l,th/E),[l.slice().reverse()],()=>n+.03,n,c,ie(c,.8),ne);return}if(!(!t.points&&i&&oh(e,s,n,o,i))){if(!t.points&&i&&s.length===4){nh(e,s,n,o,i);return}ae(e,s,void 0,()=>n+po,n,Lt(o,r.boothTop),r.boothWall,ne)}}}var Rr=1.1,Os=[.9,.9,.88],th=.1,fo=[.87,.87,.85],Ds=.08;function Hs(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let l=n(c),u=Math.hypot(l.x-t.x,l.y-t.y);u<r&&(r=u,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:i,part:(c,l,u,m)=>{let h=a(i[0],i[1],c),d=a(i[0],i[1],l),f=a(i[3],i[2],c),p=a(i[3],i[2],l);return[a(h,f,u),a(d,p,u),a(d,p,m),a(h,f,m)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*E,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*E}}function nh(e,t,n,o,r){let{q:i,part:a}=Hs(t,r),s=o??[.35,.42,.55],c=be(s,[.78,.78,.77],.62),l=be(s,[.95,.95,.94],.45);he(e,i,n+yt,n,c,ie(c,.8)),he(e,a(.05,.95,.72,.98),n+Rr-.05,n+yt,l,ie(l,.8)),he(e,a(.03,.97,.7,1),n+Rr,n+Rr-.05,Os,ie(Os,.9))}function oh(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:a,depthM:s,widthM:c}=Hs(t,r);if(s<1||c<1)return!1;let l=o??[.35,.42,.55],u=be(l,[.78,.78,.77],.62),m=n+po,h=Ds/c,d=Ds/s;he(e,i,n+yt,n,u,ie(u,.8)),he(e,a(0,1,1-d,1),m,n+yt,fo,ie(fo,.9));for(let[b,y]of[[0,h],[1-h,1]])he(e,a(b,y,0,1-d),m,n+yt,fo,ie(fo,.9));he(e,a(h,1-h,0,Math.min(.5,.06/s)),m,m-.3,l,ie(l,.85));let f=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return he(e,a(.5-f,.5+f,.72-p,.72+p),n+Qd,n+yt,be(l,[.95,.95,.94],.7),ie(l,.75)),!0}function bo(e){if(e.shape==="round"){let u=e.radius;return u?$n(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??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,m])=>({x:r.x+u*a-m*s,y:r.y+u*s+m*a}))}function zs(e,t,n,o,r,i=!0){let a=bo(t);if(!a)return;let s=a.reduce((h,d)=>h+d.x,0)/a.length,c=a.reduce((h,d)=>h+d.y,0)/a.length,l=h=>a.map(d=>({x:s+(d.x-s)*h,y:c+(d.y-c)*h})),u=i&&o?Lt(o,r.tableTop):rh,m=n+Jd;ae(e,a,void 0,()=>m,n+ih,u,ie(u,.86),ne),ae(e,l(.12),void 0,()=>m+.12,m,Bs,ie(Bs,.8),ne)}var rh=[.93,.92,.89],Bs=[.78,.66,.42],ih=.25;function Us(e,t,n,o,r,i,a,s,c=[]){let l=ge(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){Rn(e,t,n+o+Zd);return}let m=s?s.kind==="stage":t.role==="stage",h=s?s.kind==="screen":t.role==="screen",d=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:qe(t),f=s?.baseY??n,p=s?.topY??n+o;if(m&&a){let v=1/0,w=-1/0,R=1/0,T=-1/0;for(let O of l)O.x<v&&(v=O.x),O.x>w&&(w=O.x),O.y<R&&(R=O.y),O.y>T&&(T=O.y);a.push({cx:(v+w)/2*E,cz:(R+T)/2*E,y:p,halfX:Math.max((w-v)/2*E,.5),halfZ:Math.max((T-R)/2*E,.5)})}let b=pe(t.fill),y=t.role==="wall"||t.role==="entrance"||t.role==="exit",g=y?b?ie(Ye(b,.12),.95):r.tierTop:m&&b?be(r.stageTop,ie(Ye(b,.18),.9),.9):!t.role&&b?b:Lt(b,m?r.stageTop:r.decorTop),M=h?b:null,P=y?b?ie(Ye(b,.12),.85):r.tierWall:m?b?be(r.stageWall,ie(b,.58),.82):r.stageWall:h?M?be(ie(M,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Lt(pe(t.fill),r.decorWall);if(t.role==="wall"&&!s){Ps(e,l,f,p,c,g,P),Rn(e,t,p+.012);return}if(h&&l.length===4&&p-f>.2){let v=Pr(l,f,p);if(!v)return;let{quad:w,side:R,trim:T,inner:O,panel:C}=v,A=[.12,.15,.18];for(let[_,L]of[[0,R],[1-R,1]])he(e,_e(w,_,L),p,f,A,A);he(e,O,f+T,f,A,A),he(e,O,p,p-T,A,A),he(e,C,p-T,f+T,P,P),Rn(e,t,p+.012);return}let I=b?ie(Ye(b,.15),.82):P,S=b?ie(Ye(b,.1),1.02):g;if(Is(t.role)&&!s&&Rs(e,t.role,l,f,p,I,S,i,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&l.length===4&&p-f>.3){let v=Ve(l),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*E,R=Math.min(.12,.09/Math.max(w,.001)),T=[.18,.21,.24],O=p-Math.min(.12,(p-f)*.15);for(let[C,A]of[[0,R],[1-R,1]])he(e,_e(v,C,A),O,f,T,T);he(e,v,p,O,g,T);return}if(t.role==="rail"&&l.length===4&&p>f){let v=Ve(l),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*E,R=Math.max(1,Math.min(128,Math.ceil(w/1.4))),T=Math.min(.08,.055/Math.max(.055,w)),O=[.58,.64,.66];for(let C=0;C<=R;C++){let A=C/R,_=Math.min(1-T,Math.max(0,A-T/2));he(e,_e(v,_,_+T),p,f,O,ie(O,.8))}for(let C of[.52,1]){let A=f+(p-f)*C;he(e,v,A,Math.max(f,A-.055),O,ie(O,.8))}return}if(t.role==="goal"&&l.length===4){let v=Ve(l),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*E,R=Math.min(.12,.1/Math.max(.1,w)),T=[.9,.94,.94];for(let[O,C]of[[0,R],[1-R,1]])he(e,_e(v,O,C),Math.max(f,p-.1),f,T,T);he(e,v,p,Math.max(f,p-.1),T,T);return}if(d.kind==="portal"&&l.length===4){let v=Yt(l,f,p);if(!v)return;let{quad:w,side:R,face:T,openingTop:O}=v;for(let[C,A,_]of[[0,T,1],[T,1-T,.67],[1-T,1,1]]){let L=In(w,C,A),N=ie(g,_),k=ie(P,_);for(let[F,H]of[[0,R],[1-R,1]])he(e,_e(L,F,H),O,f,N,k);he(e,L,p,O,N,k)}return}if(d.kind==="suite"&&l.length===4){let v=l.map((T,O)=>{let C=l[(O+1)%4],A=(T.x+C.x)/2,_=(T.y+C.y)/2;return Math.hypot(A-i.x,_-i.y)}),w=v.indexOf(Math.min(...v)),R=[0,1,2,3].map(T=>l[(w+T)%4]);he(e,_e(R,0,.08),p,f,g,P),he(e,_e(R,.92,1),p,f,g,P),he(e,In(R,.88,1),p,f,g,P),he(e,R,p,Math.max(f,p-.18),g,P);return}if(m&&!t.stageKind?.startsWith("pitch-")&&p-f>.12){let v=p-Math.min(.06,(p-f)*.15);he(e,l,v,f,g,P),he(e,l,p,v,g,be(g,P,.2))}else he(e,l,p,f,g,P);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let v=Ve(l),w=be(b??Fs,Fs,b?.45:0);for(let R=0;R<12;R++){let T=_e(v,R/12,(R+1)/12),O=ie(w,R%2?1.09:.91),C=T.map(A=>[A.x*E,p+.006,A.y*E]);e.tri(C[0],C[1],C[2],[0,1,0],O),e.tri(C[0],C[2],C[3],[0,1,0],O)}}t.stageKind&&t.stageKind!=="pitch-football"&&Ls(e,l,t.stageKind,p,b),m&&Tt(t.stageKind)&&ks(e,t,p),e.setMaterial(h?1:0),Rn(e,t,p+.012)}function yo(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,a=n+r/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=o/2,m=r/2;return[[-u,-m],[u,-m],[u,m],[-u,m]].map(([h,d])=>({x:i+h*c-d*l,y:a+h*l+d*c}))}function ah(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 o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return pe(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[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=pe(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>be(s,c,1/(l+1)),a[0]):null}function js(e,t,n,o){if(t.layer==="foreground")return;let r=yo(t);if(!r)return;let i=n+eh,a=Lt(ah(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=be(o.ground,a,s)),ae(e,r,void 0,()=>i,n,a,be(a,o.decorWall,.5),ne)}function Xs(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=Wa(o,r.gaTop);ae(e,t.points,t.holes,()=>n+Ns,n,i,r.gaWall,ne),lh(e,t.points,n+Ns)}var Ns=.15,ho=[.72,.74,.76],Ar=1.1,Vs=.12,Er=.05,sh=.06,ch=2.4;function lh(e,t,n){let o=Je([...t]),r=ht(o,Vs/E),i=ht(o,(Vs+Er)/E);if(r.length<3||i.length<3)return;for(let s of[n+Ar,n+Ar*.5])ae(e,r,[i.slice().reverse()],()=>s,s-Er,ho,ie(ho,.85),ne);let a=sh/2/E;for(let s=0;s<r.length;s++){let c=r[s],l=r[(s+1)%r.length],u=Math.hypot(l.x-c.x,l.y-c.y)*E,m=Math.max(1,Math.round(u/ch));for(let h=0;h<m;h++){let d=h/m,f=c.x+(l.x-c.x)*d,p=c.y+(l.y-c.y)*d,b=[{x:f-a,y:p-a},{x:f+a,y:p-a},{x:f+a,y:p+a},{x:f-a,y:p+a}];ae(e,b,void 0,()=>n+Ar-Er,n,ho,ie(ho,.8),ne)}}}var Cr=.6,Ws=3,uh=.25;function mh(e,t){if(Ne(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c||1,u=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l));n=Math.min(n,Math.hypot(e.x-(i.x+u*s),e.y-(i.y+u*c)))}return n}function Ys(e,t){let n=e.map(a=>({booth:a,ring:$e(a)})).filter(a=>!!a.ring&&a.ring.length===4&&!a.booth.points),o=n.map(({ring:a})=>({minX:Math.min(...a.map(s=>s.x)),maxX:Math.max(...a.map(s=>s.x)),minY:Math.min(...a.map(s=>s.y)),maxY:Math.max(...a.map(s=>s.y))})),r=(Ws+Cr)/E,i=new Map;return n.forEach(({booth:a,ring:s},c)=>{let l={x:s.reduce((d,f)=>d+f.x,0)/4,y:s.reduce((d,f)=>d+f.y,0)/4},u=[0,1,2,3].map(d=>{let f=s[d],p=s[(d+1)%4],b={x:(f.x+p.x)/2,y:(f.y+p.y)/2},y=b.x-l.x,g=b.y-l.y,M=Math.hypot(y,g)||1,P={x:b.x+y/M*Cr/E,y:b.y+g/M*Cr/E},I=Ws/E;return o.forEach((S,x)=>{x===c||P.x<S.minX-r||P.x>S.maxX+r||P.y<S.minY-r||P.y>S.maxY+r||(I=Math.min(I,mh(P,n[x].ring)))}),{open:I*E,toward:{x:b.x+y/M*10/E,y:b.y+g/M*10/E},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),m=Math.max(...u.map(d=>d.open)),h=u.filter(d=>d.open>=m-uh).sort((d,f)=>d.focal-f.focal)[0];i.set(a.id,h.toward)}),i}var Ks=it(require("polygon-clipping"),1);var fh=.45,dh=1500,hh=200;function qs(e,t){if(e.role!=="stage"||Tt(e.stageKind))return e;let n=ge(e);if(!n||n.length<3||Math.abs(Be(n))*E*E>dh)return e;let o=t.filter(a=>Ne(n,a.x,a.y));if(!o.length||o.length>hh)return e;let r=fh/E,i=o.map(a=>[[[a.x-r,a.y-r],[a.x+r,a.y-r],[a.x+r,a.y+r],[a.x-r,a.y+r],[a.x-r,a.y-r]]]);try{let a=Ks.default.difference([[...n.map(l=>[l.x,l.y]),[n[0].x,n[0].y]]],...i),s=null,c=0;for(let l of a){let u=l[0].slice(0,-1).map(([h,d])=>({x:h,y:d})),m=Math.abs(Be(u));m>c&&(c=m,s=u)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var ph=Math.PI/180,ye=96,bh=6,yh=60,gh=150,$s=.2,xh=.35;function vh(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ph;return n<0?n+360:n}function go(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function xo(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%o+o)%o;else if(l<0||l>=o)continue;a+=e[l],s++}r[i]=a/s}return r}function Zs(e,t){let n=e.filter(h=>h.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,a=0;for(let h of n)for(let d of h.rows){for(let f of d.pts)r+=f.x,i+=f.y,a++;if(d.pts.length>=4){let f=dr(d.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&o.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:r/a,y:i/a},c=s;if(o.length>=8){let h=go(o.map(y=>y.x)),d=go(o.map(y=>y.y)),f=0;for(let y of n)for(let g of y.rows)for(let M of g.pts){let P=Math.hypot(M.x-s.x,M.y-s.y);P>f&&(f=P)}let p=0,b=f*.2;for(let y of n)for(let g of y.rows)for(let M of g.pts)Math.hypot(M.x-h,M.y-d)<b&&p++;Math.hypot(h-s.x,d-s.y)<=f&&p/a<.01&&(c={x:h,y:d})}let l=[];for(let h of n){let d={sectionId:h.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of h.rows)for(let p of f.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min(ye-1,Math.floor(vh(c,p)/(360/ye)));d.samples.push({r:b,bin:y,levelM:f.levelM}),b<d.rMin&&(d.rMin=b),b>d.rMax&&(d.rMax=b)}d.samples.length&&l.push(d)}if(!l.length)return null;l.sort((h,d)=>h.rMin+h.rMax-(d.rMin+d.rMax));let u=[];for(let h of l){let d=!1;for(let f of u){let p=Math.min(h.rMax,f.rMax)-Math.max(h.rMin,f.rMin),b=Math.min(h.rMax-h.rMin,f.rMax-f.rMin);if(b>1e-9&&p>=xh*b){f.members.push(h),f.rMin=Math.min(f.rMin,h.rMin),f.rMax=Math.max(f.rMax,h.rMax),d=!0;break}}d||u.push({members:[h],rMin:h.rMin,rMax:h.rMax})}let m=[];for(let h of u){let d=new Array(ye).fill(null);for(let C of h.members)for(let A of C.samples){let _=d[A.bin];_||(_={samples:[]},d[A.bin]=_),_.samples.push({r:A.r,levelM:A.levelM})}let f=d.map(C=>!!C);if(!f.filter(Boolean).length)continue;let b=[],y=[];for(let C of d){if(!C)continue;let A=1/0,_=-1/0;for(let L of C.samples)L.r<A&&(A=L.r),L.r>_&&(_=L.r);b.push(A),y.push(_)}let g=go(b),M=go(y);if(!(g>=$s*M)||!(M>0))continue;let P=[...b].sort((C,A)=>C-A);if(!(P[Math.floor(P.length*.1)]>=$s*M))continue;let S=d.map(C=>{if(!C)return null;let A=[...C.samples].sort((D,G)=>D.r-G.r),_=A[0].r,L=A[A.length-1].r,N=A[0].levelM,k=-1/0;for(let D of A)D.levelM>k&&(k=D.levelM);let F=[];for(let D of A){let G={r:D.r,l:D.levelM};for(;F.length&&Math.abs(F[F.length-1].r-G.r)<1e-9;){if(F[F.length-1].l<=G.l){G.skip=!0;break}F.pop()}if(!G.skip){for(;F.length>=2;){let j=F[F.length-2],V=F[F.length-1];if((V.r-j.r)*(G.l-j.l)-(V.l-j.l)*(G.r-j.r)<=0)F.pop();else break}F.push(G)}}let H=F.map(D=>D.r),B=F.map(D=>D.l);return{inner:_,outer:L,front:N,top:k,profile:{rs:H,ls:B}}}),x=f.slice();for(let C=0;C<ye;C++){if(x[C])continue;let A=-1,_=-1,L=0;for(let z=1;z<=ye;z++){let q=(C-z+ye*2)%ye;if(x[q]){A=q;break}}for(let z=1;z<=ye;z++){let q=(C+z)%ye;if(x[q]){_=q,L=z;break}}if(A<0||_<0)continue;let N=0;for(let z=1;z<=ye;z++){let q=(C-z+ye*2)%ye;if(f[q]){N=z;break}}if(N-1+L>bh)continue;let F=S[A],H=S[_],B=N/(N+L),D=F.inner+(H.inner-F.inner)*B,G=F.outer+(H.outer-F.outer)*B,j=F.front+(H.front-F.front)*B,V=F.top+(H.top-F.top)*B;S[C]={inner:D,outer:G,front:j,top:V,profile:{rs:[D,G],ls:[j,V]}}}for(let C=0;C<ye;C++)S[C]&&(x[C]=!0);let v=360/ye,w=[],R=x.filter(Boolean).length,T=[];if(R===ye)T.push({start:0,len:ye});else{let C=0;for(;x[C];)C=(C+1)%ye;let A=-1;for(let _=0;_<=ye;_++){let L=(C+_)%ye,N=_<ye&&x[L];if(N&&A<0)A=L;else if(!N&&A>=0){let k=(L-A+ye)%ye||ye;T.push({start:A,len:k}),A=-1}}}for(let C of T){if(C.len*v<yh&&C.len<ye)continue;let A=C.len===ye,_=new Float64Array(C.len),L=new Float64Array(C.len),N=new Float64Array(C.len),k=new Float64Array(C.len),F=[];for(let z=0;z<C.len;z++){let q=S[(C.start+z)%ye];_[z]=q.inner,L[z]=q.outer,N[z]=q.front,k[z]=q.top,F.push(q.profile??{rs:[q.inner,q.outer],ls:[q.front,q.top]})}let H=xo(_,A),B=xo(L,A),D=xo(N,A),G=xo(k,A);for(let z=0;z<C.len;z++)H[z]>_[z]&&(H[z]=_[z]),B[z]<L[z]&&(B[z]=L[z]),H[z]>B[z]-1e-6&&(H[z]=Math.max(0,B[z]-1e-6)),G[z]<D[z]&&(G[z]=D[z]);let j={startBin:C.start,binCount:C.len,closed:A,innerR:H,outerR:B,frontLevelM:D,topLevelM:G,profiles:F},V=(z,q,$)=>{let re=F[z],Q=re.rs,W=re.ls;if(q<=Q[0]){W[0]>$&&(W[0]=$);return}if(q>=Q[Q.length-1]){W[W.length-1]>$&&(W[W.length-1]=$);return}for(let Y=0;Y+1<Q.length;Y++)if(q<=Q[Y+1]){W[Y]>$&&(W[Y]=$),W[Y+1]>$&&(W[Y+1]=$);return}};for(let z=0;z<C.len;z++){let q=d[(C.start+z)%ye];if(q)for(let $ of q.samples){V(z,$.r,$.levelM);let re=A?(z-1+C.len)%C.len:z-1,Q=A?(z+1)%C.len:z+1;re>=0&&V(re,$.r,$.levelM),Q<C.len&&V(Q,$.r,$.levelM)}}w.push(j)}w.reduce((C,A)=>C+A.binCount*v,0)<gh||m.push({arcs:w,sectionIds:h.members.map(C=>C.sectionId),innerRMedian:g,outerRMedian:M})}if(!m.length)return null;if(m.sort((h,d)=>h.innerRMedian-d.innerRMedian),t){let h=m[m.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*h)return null}return{centre:c,binCount:ye,binStepDeg:360/ye,rings:m}}function Qs(e,t,n,o){let r=e.binStepDeg,i=n/r-.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 m=t.profiles[u],h=m.rs,d=m.ls;if(o<=h[0])return d[0];if(o>=h[h.length-1])return d[d.length-1];for(let f=0;f+1<h.length;f++)if(o<=h[f+1]){let p=h[f+1]-h[f],b=p>1e-9?(o-h[f])/p:0;return d[f]+(d[f+1]-d[f])*b}return d[d.length-1]};return l(a)*(1-c)+l(s)*c}function _r(e,t,n,o,r,i,a,s,c,l=[],u=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let m=(p,b,y)=>{lt(e,p,b,y,l,a,s,{portalBase:u,ao:c})||ae(e,p,void 0,()=>y,b,a,s,c)},h=(p,b,y)=>({x:p.x+(b.x-p.x)*y,y:p.y+(b.y-p.y)*y}),d=o?t.length:t.length-1,f=0;for(let p=0;p<d;p++){let b=(p+1)%t.length,y=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*fe;if(y<1e-5)continue;let g=(S,x)=>[h(t[p],t[b],S),h(t[p],t[b],x),h(n[p],n[b],x),h(n[p],n[b],S)];m(g(0,1),r,r+.95),m(g(0,1),i-.22,i);let M=Math.ceil((f-.32)/6)*6,P=!1,I=!1;for(let S=M;S<f+y;S+=6){let x=Math.max(0,(S-f)/y),v=Math.min(1,(S+.32-f)/y);v<=x||(m(g(x,v),r+.95,i-.22),P||=x<1e-6,I||=v>1-1e-6)}if(!o&&(p===0&&!P||p===d-1&&!I)){let S=Math.min(1,.32/y);m(g(p===0?0:1-S,p===0?S:1),r+.95,i-.22)}f+=y}}var gt=it(require("polygon-clipping"),1),En=.65;function Tr(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],a=o[(r+1)%o.length],s=a.x-i.x,c=a.y-i.y,l=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/(s*s+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-l*s,e.y-i.y-l*c))}return n}var kr=.01;function Js(e,t,n,o,r,i,a,s=[],c=!0,l={bays:[],walls:[]}){if(o-r<=1e-5)return;let u=o-r>=3,m=u?o-En:r;e.setMaterial(5);let h=u?[]:s.filter(S=>{if(S.role!=="entrance"&&S.role!=="exit")return!1;let x=ge(S);if(!x)return!1;let v=Yt(x,r,r+qe(S).heightM);return v!==null&&v.openingTop<=o-.12});if((!h.length||!lt(e,t,m,o,h,i,a,{holes:n,portalBase:r}))&&ae(e,t,n,()=>o,m,i,a,ne,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let d=c&&l.bays.length?Mh(t,n,ht(t,An/E),l):null,f=6/E,p=.22/E,b=s.flatMap(S=>{if(S.role!=="entrance"&&S.role!=="exit")return[];let x=ge(S);return x?.length?[{minX:Math.min(...x.map(v=>v.x)),maxX:Math.max(...x.map(v=>v.x)),minY:Math.min(...x.map(v=>v.y)),maxY:Math.max(...x.map(v=>v.y))}]:[]}),y=Math.min(...t.map(S=>S.x)),g=Math.max(...t.map(S=>S.x)),M=Math.min(...t.map(S=>S.y)),P=Math.max(...t.map(S=>S.y));for(let S=y+f/2;S<g;S+=f)for(let x=M+f/2;x<P;x+=f){if(b.some(w=>S+p>=w.minX&&S-p<=w.maxX&&x+p>=w.minY&&x-p<=w.maxY))continue;let v=[{x:S-p,y:x-p},{x:S+p,y:x-p},{x:S+p,y:x+p},{x:S-p,y:x+p}];!Le({x:S,y:x},t,n)||Tr({x:S,y:x},[t,...n??[]])<p*Math.SQRT2+(c?An/E:0)||d&&Tr({x:S,y:x},d.flat())<p*Math.SQRT2+An/E||ae(e,v,void 0,()=>m,r,i,a,ne)}if(d){for(let[S,...x]of d)ae(e,S,x,()=>m,r-kr,i,a,ne);e.setMaterial(0);return}let I=ht(t,An/E);if(c&&I.length>=3){let S=s.filter(w=>{if(w.role!=="entrance"&&w.role!=="exit")return!1;let R=ge(w);return!!R&&R.some(T=>!Le(T,t,void 0)||Tr(T,[t])<=An/E)}),x=[I.slice().reverse()],v=r-kr;(!S.length||!lt(e,t,v,m,S,i,a,{holes:x,portalBase:r+kr}))&&ae(e,t,x,()=>m,v,i,a,ne)}e.setMaterial(0)}var Lr=.25,An=Lr;function Mh(e,t,n,o){if(n.length<3)return null;let r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},i=a=>{let[s,...c]=a.map(l=>[r(l)]);return gt.default.union(s,...c)};try{let a=[r(e),...(t??[]).map(r)],s=gt.default.difference(a,[r(n)]),c=gt.default.intersection(a,i(o.bays));if(!c.length)return null;let l=gt.default.difference(gt.default.intersection(a,i(o.walls)),c);return gt.default.union(gt.default.difference(s,c),l).map(m=>m.map(h=>h.slice(0,-1).map(([d,f])=>({x:d,y:f}))))}catch{return null}}var Sh=.02,wh=.25,Ph=1.2,Ih=.6,Rh=.45,Ah=2.3,Eh=Math.PI/180,ec=.005;function et(e,t,n){let o=n*Eh;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Ch(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.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)>=o&&a++;if(a>=i.length/2)return!0}return!1}var _h=24,Th=.01;function kh(e,t,n,o,r,i,a,s,c){let l=n.binCount,u=_h,m=fe,h=i+.02,d=i-Th,f=[];for(let A=0;A<l;A++){let _=(n.startBin+A+.5)*t.binStepDeg,L=new Float64Array(u+1);for(let N=0;N<=u;N++){let k=o[A]+(r[A]-o[A])*N/u;L[N]=Math.max(h,Qs(t,n,_,k)-wh)}f.push(L)}if(c){let A=0;for(let _=0;_+1<l;_++)for(let L=0;L<u;L++){let N=et(t.centre,o[_]+(r[_]-o[_])*L/u,(n.startBin+_+.5)*t.binStepDeg),k=et(t.centre,o[_+1]+(r[_+1]-o[_+1])*(L+1)/u,(n.startBin+_+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(k.x-N.x,k.y-N.y))}for(let _=0;_<l;_++){let L=(n.startBin+_+.5)*t.binStepDeg;for(let N=0;N<=u;N++){let k=et(t.centre,o[_]+(r[_]-o[_])*N/u,L),F=c(k.x,k.y,A*1.01);F!==null&&(f[_][N]=Math.min(f[_][N],Math.max(d+ec,F-ec)))}}}let p=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],b=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],y=[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],M=(A,_)=>{let L=(n.startBin+A+.5)*t.binStepDeg,N=o[A]+(r[A]-o[A])*_/u,k=et(t.centre,N,L);return[k.x*m,f[A][_],k.y*m]};{let A=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let L=!1;for(let k=0;k<l;k++)for(let F=u-1;F>=0;F--)f[k][F]>f[k][F+1]&&(f[k][F]=f[k][F+1],L=!0);let N=n.closed?l:l-1;for(let k=0;k<N;k++){let F=(k+1)%l;for(let H=0;H<=u;H++){let B=f[F][H]-f[k][H];if(Math.abs(B)>1)continue;let D=o[k]+(r[k]-o[k])*H/u,G=o[F]+(r[F]-o[F])*H/u,j=et(t.centre,D,(n.startBin+k+.5)*t.binStepDeg),V=et(t.centre,G,(n.startBin+F+.5)*t.binStepDeg),z=A*Math.hypot(V.x-j.x,V.y-j.y)*m;B>z?(f[F][H]=f[k][H]+z,L=!0):-B>z&&(f[k][H]=f[F][H]+z,L=!0)}}if(!L)break}}let P=1,I=(A,_)=>{for(let L=0;L<=u;L+=4)if(Math.abs(f[A][L]-f[_][L])>P)return!0;return Math.abs(f[A][u]-f[_][u])>P},S=Math.tan(38*Math.PI/180),x=A=>(r[A]-o[A])/u*m,v=(A,_)=>f[A][_+1]-f[A][_]>S*Math.max(1e-6,x(A)),w=(A,_)=>{let L=n.closed?(A-1+l)%l:Math.max(0,A-1),N=n.closed?(A+1)%l:Math.min(l-1,A+1);Math.abs(f[L][_]-f[A][_])>P&&(L=A),Math.abs(f[N][_]-f[A][_])>P&&(N=A);let k=Math.max(0,_-1),F=Math.min(u,_+1);k<_&&v(A,k)&&(k=_),F>_&&v(A,_)&&(F=_);let H=M(L,_),B=M(N,_),D=M(A,k),G=M(A,F),j=B[0]-H[0],V=B[1]-H[1],z=B[2]-H[2],q=G[0]-D[0],$=G[1]-D[1],re=G[2]-D[2],Q=V*re-z*$,W=z*q-j*re,Y=j*$-V*q,K=Math.hypot(Q,W,Y);return K>1e-12?(Q/=K,W/=K,Y/=K,W<0&&(Q=-Q,W=-W,Y=-Y),[Q,W,Y]):[0,1,0]},R=(A,_,L=!1)=>{let N=L&&Math.min(A[1],_[1])-i>=3,k=[A[0],N?A[1]-En:d,A[2]],F=[_[0],N?_[1]-En:d,_[2]],H=_[0]-A[0],B=_[2]-A[2],D=Math.hypot(H,B);if(!(D>1e-12))return;let G=[B/D,0,-H/D];e.tri(A,_,F,G,y,y,g),e.tri(A,F,k,G,y,g,g)},T=.05*ze,O=A=>r[A]-o[A]<T,C=n.closed?l:l-1;for(let A=0;A<C;A++){let _=(A+1)%l;if(O(A)||O(_))continue;if(I(A,_)){let B=(n.startBin+A+1)*t.binStepDeg,D=($,re)=>{let Q=(o[A]+o[_])/2,W=(r[A]+r[_])/2,Y=Q+(W-Q)*re/u,K=et(t.centre,Y,B);return[K.x*m,f[$][re],K.y*m]};for(let $=0;$<u;$++){let re=M(A,$),Q=M(A,$+1),W=D(A,$),Y=D(A,$+1),K=w(A,$),oe=w(A,$+1);e.triN(re,W,Y,K,K,oe,p),e.triN(re,Y,Q,K,oe,oe,p);let ee=M(_,$),le=M(_,$+1),J=D(_,$),ce=D(_,$+1),Oe=w(_,$),te=w(_,$+1);e.triN(J,ee,le,Oe,Oe,te,p),e.triN(J,le,ce,Oe,te,te,p);let me=D(A,$),Se=D(A,$+1),Xe=D(_,$+1),De=D(_,$),Ae=Se[0]-me[0],We=Se[2]-me[2],Ze=Math.hypot(Ae,We);if(Ze>1e-12){let Pt=[We/Ze,0,-Ae/Ze];e.tri(me,Se,Xe,Pt,y),e.tri(me,Xe,De,Pt,y)}}let G=M(A,0),j=M(_,0),V=M(_,u),z=M(A,u),q=$=>[$[0],d,$[2]];Math.min(G[1],j[1])-i<3&&(e.tri(q(G),q(V),q(j),[0,-1,0],b),e.tri(q(G),q(z),q(V),[0,-1,0],b)),R(G,j,!0),R(z,V,!0);continue}for(let B=0;B<u;B++){let D=w(A,B),G=w(_,B),j=w(_,B+1),V=w(A,B+1);if(v(A,B)||v(_,B)){let Q=(Se,Xe)=>{let De=(n.startBin+Se+.5)*t.binStepDeg,Ae=o[Se]+(r[Se]-o[Se])*(B+.5)/u,We=et(t.centre,Ae,De);return[We.x*m,Xe,We.y*m]},W=M(A,B),Y=M(_,B),K=Q(A,f[A][B]),oe=Q(_,f[_][B]);e.triN(W,Y,oe,D,G,G,p),e.triN(W,oe,K,D,G,D,p);let ee=M(_,B+1),le=M(A,B+1),J=Q(A,f[A][B+1]),ce=Q(_,f[_][B+1]);e.triN(J,ce,ee,V,j,j,p),e.triN(J,ee,le,V,j,V,p);let Oe=oe[0]-K[0],te=oe[2]-K[2],me=Math.hypot(Oe,te);if(me>1e-12){let Se=[-te/me,0,Oe/me];e.tri(K,oe,ce,Se,y),e.tri(K,ce,J,Se,y)}continue}let z=M(A,B),q=M(_,B),$=M(_,B+1),re=M(A,B+1);e.triN(z,q,$,D,G,j,p),e.triN(z,$,re,D,j,V,p)}let L=M(A,0),N=M(_,0),k=M(_,u),F=M(A,u),H=B=>[B[0],d,B[2]];Math.min(L[1],N[1])-i<3&&(e.tri(H(L),H(k),H(N),[0,-1,0],b),e.tri(H(L),H(F),H(k),[0,-1,0],b)),R(L,N,!0),R(F,k,!0)}if(!n.closed)for(let A of[0,l-1])for(let _=0;_<u;_++)R(M(A,_),M(A,_+1))}function tc(e,t,n){let{bottomY:o,colors:r,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let m of u.arcs){let h=new Float64Array(m.binCount),d=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount,y=Math.max(0,m.innerR[p]-Ue);h[p]=Math.max(y,a[b]+.001),d[p]=Math.max(h[p]+.001,m.outerR[p]+Ue)}let f=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>f&&(f=b)}f>=Ph&&kh(e,t,m,h,d,o,r,i,n.standTopNear);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount;d[p]>a[b]&&(a[b]=d[p])}}if(n.deriveShell===!1||Ch(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Ih*ze,l=Rh*ze;for(let u of s.arcs){let m=[],h=[];for(let w=0;w<u.binCount;w++){let R=(u.startBin+w+.5)*t.binStepDeg,T=u.outerR[w]+Ue+c;m.push(et(t.centre,T,R)),h.push(et(t.centre,T+l,R))}let d=-1/0;for(let w=0;w<u.binCount;w++)u.topLevelM[w]>d&&(d=u.topLevelM[w]);let f=d+Ah,p=u.closed?h:[...h,...m.slice().reverse()],b=u.closed?[m.slice().reverse()]:void 0,y=be(r.shellWall,[.66,.71,.72],.62),g=(w,R,T,O,C)=>{let A=Math.abs(O-d)<1e-6?O-Sh:O;lt(e,w,T,A,n.shapes,r.shellTop,C,{holes:R,portalBase:o,ao:i})||ae(e,w,R,()=>A,T,r.shellTop,C,i)},M=Math.max(1,Math.ceil((d-o)/4.5)),P=(d-o)/M,I=new Set,S=n.tierFrontLevels??t.rings.map(w=>{let R=w.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,O)=>T-O);return R[Math.floor(R.length/2)]});for(let w of S)Number.isFinite(w)&&w-o>=3&&w<d&&I.add(Math.max(0,Math.min(M-1,Math.floor((w-o)/P))));let x=Math.min(...S.filter(w=>Number.isFinite(w)&&w-o>=3&&w<d));for(let w=0;w<M;w++)o+(w+1)*P<=x-En&&Number.isFinite(x)&&I.add(w);for(let w=0;w<M;w++){let R=o+(d-o)*w/M,T=o+(d-o)*(w+1)/M;I.has(w)&&T-R>=3.2?(g(p,b,R,R+.45,y),_r(e,m,h,u.closed,R+.45,T-.16,r.shellTop,y,i,n.shapes,o)):g(p,b,R,T-.16,y),g(p,b,T-.16,T,ie(y,.62))}_r(e,m,h,u.closed,d,f,r.shellTop,y,i,n.shapes,o);let v=8;for(let w=1;w<h.length;w++){if(v+=Math.hypot(h[w].x-h[w-1].x,h[w].y-h[w-1].y)*fe,v<8)continue;v=0;let R=h[w],T=h[w-1],O=R.x-T.x,C=R.y-T.y,A=Math.max(1,Math.hypot(O,C)),_=O/A*.16*ze,L=C/A*.16*ze,N=Math.max(1,Math.hypot(R.x-t.centre.x,R.y-t.centre.y)),k=(R.x-t.centre.x)/N*.24*ze,F=(R.y-t.centre.y)/N*.24*ze,H=[{x:R.x-_,y:R.y-L},{x:R.x+_,y:R.y+L},{x:R.x+_+k,y:R.y+L+F},{x:R.x-_+k,y:R.y-L+F}];g(H,void 0,o,d,ie(y,1.12))}}}var Lh=2.5,nc=.65,Fh=2,Oh=.03;function Dh(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],a=Math.hypot(i.x-r.x,i.y-r.y);if(a>o){e[0]={x:r.x+(i.x-r.x)/a*o,y:r.y+(i.y-r.y)/a*o};return}o-=a,e.shift()}};n(),e.reverse(),n(),e.reverse()}function Dr(e,t,n){let o=new Map;for(let i of e){let a=o.get(i.blockId);(!a||i.depth<a.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,a]of o){if(a.y-n<Lh||a.pts.length<2)continue;let s=a.pts.map(u=>{let m=u.x-t.x,h=u.y-t.y,d=Math.max(1,Math.hypot(m,h));return{x:u.x-m/d*nc/E,y:u.y-h/d*nc/E}}),c=[],l=[s[0]];for(let u=1;u<s.length;u++){let m=s[u-1],h=s[u];Math.hypot(h.x-m.x,h.y-m.y)*E>Fh?(l.length>=2&&c.push(l),l=[h]):l.push(h)}l.length>=2&&c.push(l);for(let u of c)Dh(u,Oh/E);c.length&&r.push({blockId:i,y:a.y,runs:c})}return r}var oc=.1,Bh=1.1,Nh=.22,Fr=.95,Or=.05,rc=1.8;function ic(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let a of Dr(t,n,o)){let s=a.y;for(let c of a.runs){let l=rc;for(let u=1;u<c.length;u++){let m=c[u-1],h=c[u],d=h.x-m.x,f=h.y-m.y,p=Math.hypot(d,f);if(p<1e-5)continue;let b=y=>{let g=-f/p*y/E/2,M=d/p*y/E/2;return[{x:m.x+g,y:m.y+M},{x:h.x+g,y:h.y+M},{x:h.x-g,y:h.y-M},{x:m.x-g,y:m.y-M}]};if(ae(e,b(Nh),void 0,()=>s+oc,s-Bh,r,r,ne),ae(e,b(Or),void 0,()=>s+Fr,s+Fr-Or,i,i,ne),l+=p*E,l>=rc||u===c.length-1){l=0;let y=.028/E,g=[{x:m.x-y,y:m.y-y},{x:m.x+y,y:m.y-y},{x:m.x+y,y:m.y+y},{x:m.x-y,y:m.y+y}];ae(e,g,void 0,()=>s+Fr-Or,s+oc,i,i,ne)}}}}}var Vh=.9,Gh=1.5,Hh=.3;function ac(e,t,n){let o=[],r=[],i=Vh/E,a=Gh/E,s=Hh/E;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),m=(b,y)=>{let g=u[b],M=u[y],P=Math.hypot(g.x-M.x,g.y-M.y)||1;u[b]={x:g.x+(g.x-M.x)/P*s,y:g.y+(g.y-M.y)/P*s}};m(0,1),m(u.length-1,u.length-2);let h=u.map((b,y)=>{let g=u[Math.max(0,y-1)],M=u[Math.min(u.length-1,y+1)],P=M.x-g.x,I=M.y-g.y,S=Math.hypot(P,I)||1,x=-I/S,v=P/S;return x*(b.x-t.x)+v*(b.y-t.y)<0&&(x=-x,v=-v),{nx:x,ny:v}}),d=u.map((b,y)=>({x:b.x-h[y].nx*a,y:b.y-h[y].ny*a})),f=u.map((b,y)=>({x:b.x+h[y].nx*i,y:b.y+h[y].ny*i})),p=u.map((b,y)=>({x:b.x+h[y].nx*(i+n/E),y:b.y+h[y].ny*(i+n/E)}));o.push([...d,...f.slice().reverse()]),r.push([...f,...p.reverse()])}return{bays:o,walls:r}}function sc(e,t,n,o,r){let i=[.67,.71,.68];for(let a=0;a<t.length;a++){let s=t[a];if(!(s.pts.length<2))for(let c of[0,s.pts.length-1]){let l=s.pts[c],u=s.pts[c===0?1:c-1],m=l.x-u.x,h=l.y-u.y,d=Math.hypot(m,h);if(d<1e-5)continue;m/=d,h/=d;let f=1/0;for(let v=0;v<n.length;v++){let w=n[v],R=n[(v+1)%n.length],T=R.x-w.x,O=R.y-w.y,C=m*O-h*T;if(Math.abs(C)<1e-8)continue;let A=w.x-l.x,_=w.y-l.y,L=(A*O-_*T)/C,N=(A*h-_*m)/C;L>0&&N>=0&&N<=1&&(f=Math.min(f,L))}let p=.3/E,b=f-.04/E;if(!Number.isFinite(f)||f*E>2||b-p<.12/E)continue;let y=.27/E,g=[{x:l.x+m*p-h*y,y:l.y+h*p+m*y},{x:l.x+m*b-h*y,y:l.y+h*b+m*y},{x:l.x+m*b+h*y,y:l.y+h*b-m*y},{x:l.x+m*p+h*y,y:l.y+h*p-m*y}];if(!g.every(v=>Ne(n,v.x,v.y)))continue;let M=r?.[a]?.belowY,P=M==null?0:s.y-M,I=!!o&&P>.03&&P<=.65;if(I&&o){let v=(w,R)=>Math.hypot((w.x+R.x)/2-o.x,(w.y+R.y)/2-o.y);v(g[0],g[1])>v(g[3],g[2])&&(g=[g[3],g[2],g[1],g[0]])}let S=I?Math.ceil((P-1e-8)/.2):1,x=(v,w,R)=>({x:v.x+(w.x-v.x)*R,y:v.y+(w.y-v.y)*R});for(let v=0;v<S;v++){let w=v/S,R=(v+1)/S,T=[x(g[0],g[3],w),x(g[1],g[2],w),x(g[1],g[2],R),x(g[0],g[3],R)],O=s.y+.008-(I?P*(1-R):0);if(ae(e,T,void 0,()=>O,O-(I?P/S+.1:.16),i,[.43,.47,.46],ne),!I)continue;let C=Math.hypot(T[3].x-T[0].x,T[3].y-T[0].y)*E,A=Math.min(.04/C,.25),_=x(T[0],T[3],A),L=x(T[1],T[2],A),N=F=>[F.x*E,O+.004,F.y*E],k=[.66,.59,.39];e.tri(N(T[0]),N(T[1]),N(L),[0,1,0],k),e.tri(N(T[0]),N(L),N(_),[0,1,0],k)}}}}function cc(e,t,n,o,r,i,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let l=n.baseHeightM,u=n.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),m=Ya(o,s.tierTop);if(!r)return;let h=g=>r.deckAt(g.x,g.y),d=ls(t,a),f=d[0]??t.outline;if(r.rowLevels.length>=2){let g=ro(r.rowLevels),M=us(rs(r.rowLevels,n.focal,g),d),P=ac(Dr(r.rowLevels,n.focal,l),n.focal,Lr);for(let S of M){let x=Math.max(l,S.topY-lc);for(let v of i.subtract(S.outline,x))Js(e,v,S.holes,x,l,s.tierTop,s.tierWall,u,!c,P)}M.length||ae(e,f,t.holes,()=>r.landingY,l,m,s.tierWall,ne);let I={tread:[m[0]*ne.top,m[1]*ne.top,m[2]*ne.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let S of d.length?d:[f])as(e,r.rowLevels,n.focal,r.landingY,I,S,g);ic(e,r.rowLevels,n.focal,l),sc(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:vs,b=g=>r.normalAt(g.x,g.y),y=r.flat?r.landingY:void 0;for(let g of i.subtract(f,y))ae(e,g,t.holes,h,l,m,s.tierWall,ne,p,b)}function zh(e,t,n){let o=new Set;for(let a of e.objects)a.type==="section"&&o.add(a.id);let r=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!o.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a];if(l.kind==="booth")continue;let u=r.get(s);u||(u=new Map,r.set(s,u));let m=l.rowId||`__seat-${a}`,h=u.get(m);h||(h={pts:[],levelM:0,n:0},u.set(m,h)),h.pts.push({x:l.x,y:l.y}),h.levelM+=n.seatDeckY(a),h.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=r.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 Uh(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],a=i.x-r.x,s=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/(a*a+s*s||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*a,e.y-r.y-c*s))}return n}var lc=.02;function jh(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let u of o.outline)u.x<i&&(i=u.x),u.x>a&&(a=u.x),u.y<s&&(s=u.y),u.y>c&&(c=u.y);let l=r.landingY;for(let u of r.rowLevels)l=Math.min(l,u.y-lc);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:l,minX:i,maxX:a,minY:s,maxY:c}]});return(o,r,i)=>{let a=null;for(let s of n){if(o<s.minX-i||o>s.maxX+i||r<s.minY-i||r>s.maxY+i)continue;let c={x:o,y:r};if(!Le(c,s.outline,s.holes)&&Uh(c,s.outline)>i)continue;let l=Math.min(s.surface.deckAt(o,r),s.floorTop);(a===null||l<a)&&(a=l)}return a}}var Xh=3,Wh=.4;function uc(e,t,n,o,r,i,a=!0){let s=zh(t,n,o);if(s.length<Xh)return;let c=Zs(s,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((m,h)=>m+h.binCount,0)))/c.binCount;e.setMaterial(5),tc(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(u=>Math.min(...u.rows.map(m=>m.levelM))),colors:{bandTop:ie(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??ie(r.tierWall,1.15),shellWall:i??r.tierWall},ao:ne,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a&&l>=Wh,standTopNear:jh(t,o)}),e.setMaterial(0)}var mc=4;var Yh=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],Kh=1.2,qh=12;function fc(e){if(e.heightM!==void 0)return!1;let t=ge(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length];n+=Math.hypot(a.x-i.x,a.y-i.y)}return n*fe<qh*2?!1:2*Cn(t)/n*fe<=Kh}function Br(e){if(!e)return null;for(let[t,n]of Yh)if(t.test(e))return n;return null}var hc="auto-rows-";function pc(e){return e.id.startsWith(hc)&&!e.label}var $h=1.15,Zh=.09,bc=6,Qh=34,Jh=.35,ep=6,tp=.35,np=.75,op=12,rp=2.5,ip=40,ap=[18,24],sp=[12,16],dc=14,cp=.8,lp=.6,up=5,mp=.3,yc=.4,fp=2,dp=400,hp=2.6,pp=.8,bp=4,yp=26,gp=1.6,xp=6e3,vp=.6,Mp="#c3c7cd",Nr=300,Sp=240;function wp(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Gr([...t]),i=new Set;for(let u of o)i.add(Math.floor(Math.atan2(u.y-r.y,u.x-r.x)*180/Math.PI/10));if(i.size*10<Sp)return null;let{h:a,s,l:c}=Bi(Oi(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(u=>u!==e&&u.type==="shape"&&ge(u)?.some(m=>zr(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Pp="Estimated from the drawing; confirm with the venue.",gc=e=>{if(!e.length)return null;let t=[...e].sort((o,r)=>o-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},Gr=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Cn=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function Ip(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Hr(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function zr(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Ur(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/l)):0,m={x:i.x+s*u,y:i.y+c*u},h=Math.hypot(e.x-m.x,e.y-m.y);h<o&&(o=h,n=m)}return n}function xc(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],a=r[r.length-1],s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c);if(l<1e-6)continue;let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=Ur(u,t),h=m.x-u.x,d=m.y-u.y,f=Math.hypot(h,d);f<1e-6||(o+=Math.abs((-c*h+s*d)/(l*f))*r.length,n+=r.length)}return n?o/n:0}function Rp(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ge(r);return p?{shape:r,centre:Gr(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),a=Math.max(a,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let l=(a-i)*(c-s),u=[];for(let p of o){if(p.role)continue;let b=ge(p);if(!b)continue;let y=Cn(b);if(y*fe*fe<6||y>l)continue;let g=Math.min(...b.map(w=>w.x)),M=Math.max(...b.map(w=>w.x)),P=Math.min(...b.map(w=>w.y)),I=Math.max(...b.map(w=>w.y)),S=0;for(let w of n)w.x>g&&w.x<M&&w.y>P&&w.y<I&&zr(w,b)&&S++;if(S>n.length*.05)continue;let x=Gr(b),v=xc(t,b);v>=cp&&u.push({shape:p,centre:x,outline:b,score:v,area:y,box:[g,P,M,I]})}let m=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,h=u.filter(p=>!u.some(b=>m(p,b))),d=Math.max(0,...h.map(p=>p.score)),f=h.filter(p=>p.score>=d-.03).sort((p,b)=>b.area-p.area)[0]??null;return f?{shape:f.shape,centre:f.centre,outline:f.outline,inferred:!0}:null}function Ap(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Ur(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function vc(e){let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y);if(t.length<3)return t;let n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),o=[];for(let i of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}let r=[];for(let i=t.length-1;i>=0;i--){let a=t[i];for(;r.length>=2&&n(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}return[...o.slice(0,-1),...r.slice(0,-1)]}function Ep(e){if(!e.length||e.length>xp)return[];let t=[...Hr(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),r=gp/fe,i=t.map(s=>({minX:Math.min(...s.map(c=>c.x))-r,maxX:Math.max(...s.map(c=>c.x))+r,minY:Math.min(...s.map(c=>c.y))-r,maxY:Math.max(...s.map(c=>c.y))+r}));for(let s=0;s<t.length;s++)for(let c=s+1;c<t.length;c++){let l=i[s],u=i[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;t[s].some(h=>t[c].some(d=>Math.hypot(h.x-d.x,h.y-d.y)<=r))&&(n[o(s)]=o(c))}let a=new Map;return t.forEach((s,c)=>{let l=o(c),u=a.get(l);u?u.push(...s):a.set(l,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function Cp(e,t,n){if(!t.length)return null;let o=t.filter(v=>n.tableIds.has(v.rowId)||v.kind==="booth").length>t.length/2,r=Hr(t),i=!n.outline||xc(r,n.outline)>=lp,a=0,s=0;for(let v of r.values()){if(v.length<2)continue;let w=v[0],R=v[v.length-1],T=R.x-w.x,O=R.y-w.y,C=Math.hypot(T,O);if(C<1e-6)continue;let A={x:(w.x+R.x)/2,y:(w.y+R.y)/2},_=i?n.outline?Ur(A,n.outline):n.focal:n.middle,L=-O/C,N=T/C;L*(_.x-A.x)+N*(_.y-A.y)<0&&(L=-L,N=-N),a+=L*v.length,s+=N*v.length}let c={x:t.reduce((v,w)=>v+w.x,0)/t.length,y:t.reduce((v,w)=>v+w.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let v=i?n.focal:n.middle;a=v.x-c.x,s=v.y-c.y}let l=Math.hypot(a,s)||1,u={x:a/l,y:s/l},m=v=>-(v.x*u.x+v.y*u.y),h=v=>-v.x*u.y+v.y*u.x,d=1/0,f=-1/0,p=1/0,b=-1/0,y=1/0,g=new Map;for(let v of t){let w=m(v),R=h(v);d=Math.min(d,w),f=Math.max(f,w),p=Math.min(p,R),b=Math.max(b,R),i&&(y=Math.min(y,Ap(v,n.focal,n.outline)));let T=v.logicalRowId??v.rowId,O=g.get(T);O?O.push(w):g.set(T,[w])}i||(y=Math.max(0,d-m(n.middle)));let M=[...g.values()].map(v=>gc(v)).sort((v,w)=>v-w),P=[];if(!o)for(let v of M)P.length&&v-P[P.length-1]<tp/fe||P.push(v);let I=Ip(e),S=dt(e,{floorBaseHeightM:n.baseHeightM}),x={id:e.id,section:e,authored:I,plane:n,facing:u,facesAction:i,hull:vc(t),sample:t.filter((v,w)=>w%Math.ceil(t.length/dp)===0),frontD:d,backD:f,latMin:p,latMax:b,frontDistance:y,rowDepths:P,rowCount:P.length,level:0,height:S.height,rake:I?S.rake:0,backHeight:0};return x.backHeight=x.height+(f-d)*fe*Math.tan(x.rake*Math.PI/180),x}function _p(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*fe),i=n+$h-o,a=0,s=0;for(let l=1;l<e.length;l++){let u=Math.max(np,(e[l]-e[l-1])*fe),m=(i+Zh)*(r+u)/r;a+=m-i,s+=u,i=m,r+=u}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(bc,Math.min(Qh,c))*10)/10}function Tp(e,t){if(e.facing.x*t.facing.x+e.facing.y*t.facing.y<mp)return null;let n=-1/0,o=1/0,r=-1/0;for(let m of t.hull){n=Math.max(n,-(m.x*e.facing.x+m.y*e.facing.y));let h=-m.x*e.facing.y+m.y*e.facing.x;o=Math.min(o,h),r=Math.max(r,h)}if(Math.min(e.latMax,r)-Math.max(e.latMin,o)<yc*(e.latMax-e.latMin))return null;let a=fp/fe,s=new Map,c=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);s.set(h,Math.min(s.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.max(c.get(h)??-1/0,d))}let l=[];for(let[m,h]of s){let d=c.get(m);d!==void 0&&l.push(h-d)}let u=l.length?gc(l):e.frontD-n;return u<-1/fe?null:u}function kp(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let l=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,l),o=Math.min(o,l);let u=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,u),i=Math.max(i,u)}let a=Math.min(e.latMax,i)-Math.max(e.latMin,r),s=Math.min(e.backD,n)-Math.max(e.frontD,o);return a>yc*(e.latMax-e.latMin)&&s>1/fe}function Lp(e,t){let n=new Set;for(let o of e){let r=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(r/10))}return n.size/36}function Fp(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let a=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,a),o=Math.max(o,a)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*fe*Math.tan(t.rake*Math.PI/180)}function Op(e,t=!1,n=!1){let o=t?sp:ap,r=new Map,i=[...e].sort((l,u)=>l.plane.floorIndex-u.plane.floorIndex||l.frontDistance-u.frontDistance),a=[],s=new Map,c=l=>{if(l.plane.floorIndex===0||l.plane.baseHeightM>0)return l.plane.baseHeightM;let u=s.get(l.plane.floorIndex-1);return u===void 0?l.plane.baseHeightM:u+mc};for(let l of i){if(!l.authored){let m=c(l),h;for(let p of a){if(p.plane.floorIndex>l.plane.floorIndex)continue;if(kp(l,p)){let M=Fp(l,p)+hp;M>m&&(m=M,h=p);continue}let b=Tp(l,p);if(b==null)continue;let g=n&&!!l.plane.stageDeck&&p.level===0&&p.plane.floorIndex===l.plane.floorIndex&&Math.max(0,b)*fe<=bp?p.backHeight:p.backHeight+Jh+Math.min(ep,Math.max(0,b)*fe)*Math.tan(p.rake*Math.PI/180);g>m&&(m=g,h=p)}l.height=Math.round(Math.min(m,l.plane.baseHeightM+ip)*100)/100;let d=!h&&l.height>l.plane.baseHeightM;if(l.level=h?h.level+1:d?1:0,l.rake=_p(l.rowDepths,l.frontDistance,l.height,l.plane.focalHeightM),!l.facesAction&&l.rowCount<up)l.rake=0;else if(!h&&!d){let p=Math.max(1e-6,(l.backD-l.frontD)*fe);l.rake=Math.min(l.rake,op,Math.round(Math.atan(rp/p)*1800/Math.PI)/10)}else l.rowCount>=2&&(l.rake=Math.max(l.rake,o[Math.min(l.level,o.length)-1]));let f=(l.backD-l.frontD)*fe;if(t&&f>0&&l.height+f*Math.tan(l.rake*Math.PI/180)>l.plane.baseHeightM+dc){let p=Math.max(0,l.plane.baseHeightM+dc-l.height);l.rake=Math.max(bc,Math.round(Math.atan(p/f)*1800/Math.PI)/10)}n&&l.plane.stageDeck&&l.level>0&&(l.rake=Math.min(l.rake,yp)),l.backHeight=l.height+f*Math.tan(l.rake*Math.PI/180),r.set(l.id,h?.id)}let u=l.plane.floorIndex;s.set(u,Math.min(s.get(u)??1/0,l.height)),a.push(l)}return r}var Vr=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function vo(e,t={x:0,y:-40}){let n=Ut(e),o=new Map;for(let b of n){if(!b.sectionId)continue;let y=o.get(b.sectionId);y?y.push(b):o.set(b.sectionId,[b])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((b,y)=>({objects:b.objects,floorIndex:y,floorId:b.id,baseHeightM:b.baseHeightM??0,focal:b.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(i.flatMap(b=>b.objects.filter(y=>y.type==="table").map(y=>y.id))),s=[],c,l=new Set,u=i.map(b=>{let y=O=>!e.floors?.length||O.floorId===b.floorId,g=Ep(n.filter(O=>!O.sectionId&&O.kind!=="booth"&&!a.has(O.rowId)&&y(O))),M=[];for(let O of g){let C=Ke(Je(vc(O)),vp/fe);if(n.some(_=>!y(_)&&zr(_,C)))continue;let A=`${hc}${b.floorIndex}-${M.length}`;l.add(A),o.set(A,O),M.push({type:"section",id:A,label:"",color:Mp,outline:C})}let P=M.length?{...b,objects:[...b.objects,...M]}:b,I=new Set(P.objects.filter(O=>O.type==="section").map(O=>O.logicalSectionId??O.id)),S=[...o.entries()].filter(([O])=>I.has(O)).flatMap(([,O])=>O),x=Rp(P.objects,Hr(S),S),v=P.focal;(x||P.focal&&!Vr(P.focal,t))&&(r.confident=!0),x&&(r.stage??={id:x.shape.id,inferred:x.inferred,...P.floorId?{floorId:P.floorId}:{}},(x.inferred||Vr(P.focal,t))&&(v=x.centre,r.focalInferred=!0));let w=x&&(!x.inferred||Cn(x.outline)*fe*fe<=Nr),R=x?void 0:c,T={tableIds:a,floorIndex:P.floorIndex,floorId:P.floorId,baseHeightM:P.baseHeightM,focal:R?.focal??v,outline:x?.outline??R?.outline,focalHeightM:R?.focalHeightM??P.baseHeightM+(x&&w?qe({...x.shape,role:"stage"}).heightM:0),stageDeck:R?.stageDeck??!!(x&&w&&Cn(x.outline)*fe*fe<=Nr),middle:S.length?{x:S.reduce((O,C)=>O+C.x,0)/S.length,y:S.reduce((O,C)=>O+C.y,0)/S.length}:v};for(let O of P.objects){if(O.type!=="section")continue;let C=Cp(O,o.get(O.logicalSectionId??O.id)??[],T);C&&s.push(C)}return T.outline&&(c=T),Vr(P.focal,T.focal)||(r.focal??=[]).push({...P.floorId?{floorId:P.floorId}:{},point:{...T.focal}}),{unit:P,plane:T,stage:x,planeSeats:S}}),m=i.flatMap(b=>b.objects).map(b=>b.type==="shape"&&!b.role&&(Br(b.label)==="wall"||!Br(b.label)&&fc(b))?{...b,role:"wall"}:b),h=Wt({objects:m},n)!==null;h&&(r.indoor=!0);let d=Op(s,h,Lp(n,u[0]?.plane.focal??t)<pp),f=new Map(s.filter(b=>!b.authored).map(b=>[b.id,b])),p=u.map(({unit:b,plane:y,stage:g,planeSeats:M})=>b.objects.map(P=>{let I=P.type==="shape"&&!P.role&&P.id!==g?.shape.id?Br(P.label):null;if(P.type==="shape"&&!P.role&&P.id!==g?.shape.id&&(I==="wall"||!I&&fc(P))&&P.type==="shape"){(r.roles??=[]).push({id:P.id,...y.floorId?{floorId:y.floorId}:{},role:"wall"});let{fill:T,...O}=P;return{...O,role:"wall"}}if(I&&P.type==="shape")return(r.roles??=[]).push({id:P.id,...y.floorId?{floorId:y.floorId}:{},role:I}),{...P,role:I};let x=g?.inferred&&P.id===g.shape.id&&P.type==="shape"?wp(P,g.outline,b.objects,M):null;if(x&&P.type==="shape")return r.stage?.id===P.id&&(r.stage.field=x),{...P,role:"stage",stageKind:x};if(g?.inferred&&P.id===g.shape.id&&P.type==="shape"&&Cn(g.outline)*fe*fe<=Nr)return r.stage?.id===P.id&&(r.stage.deck=!0),{...P,role:"stage"};let v=P.type==="section"?f.get(P.id):void 0;if(!v||P.type!=="section")return P;let w=v.rowCount>=2&&v.rake>0;l.has(v.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:v.id,floorId:y.floorId,surfaceKind:w?"rakedRows":"flat",height:v.height,rake:v.rake,stackedOn:d.get(v.id)});let R={status:"inferred",source:"public-2d-topology",note:Pp};return{...P,height:v.height,rake:v.rake,surfaceKind:w?"rakedRows":"flat",physical3dProvenance:{height:R,rake:R,surfaceKind:R}}}));if(e.floors?.length){let b=e.floors.map((y,g)=>({...y,objects:p[g],focalPoint:u[g].plane.focal}));return{doc:{...e,floors:b,objects:b[0].objects,focalPoint:b[0].focalPoint},report:r}}return{doc:{...e,objects:p[0],focalPoint:u[0].plane.focal},report:r}}var Mc=/^[\p{L}\p{N}]{1,4}$/u,Dp=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Sc(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),r=n.toLocaleLowerCase("en-US");if(o.startsWith(`${r} `)){let a=e.slice(n.length).trim();if(Mc.test(a))return a}let i=Dp.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((r.startsWith(a)||a.startsWith(r))&&Mc.test(s))return s}return e}function wc(e,t,n){return n<0?t>1?e.filter(o=>o.kind==="floor"):[...e]:e.filter(o=>o.floorIndex===void 0||o.floorIndex===n)}function Pc(e,t){let n=[...e].sort((r,i)=>r.screen.y-i.screen.y),o=[];for(let r of n){let i=o.find(a=>a.some(s=>Math.abs(s.screen.x-r.screen.x)<104&&Math.abs(s.screen.y-r.screen.y)<34));i?i.push(r):o.push([r])}return o.flatMap(r=>r.length<2?r:r.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(r.length-1)/2)*104))}})))}var Bp=1.15,Np=2.75,Vp=4.5,Gp=.85,Hp=.5,zp=.26;function Ic(e,t,n){let o=Math.max(1e-6,t),r=e/o,i=n?.hasZoneLabels??!0,a=new Set(["stage"]);return r>=.75&&a.add("floor"),r>=Bp&&a.add("zone"),r<=(i?Np:Vp)&&(a.add("section"),a.add("ga")),r<=Gp&&(a.add("annotation"),a.add("booth")),r<=Hp&&a.add("row"),r<=zp&&a.add("seat"),a}function Rc(e,t,n,o,r,i=6){let a=i+t,s=o-i-t,c=i+n,l=r-i-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>l?r/2:Math.max(c,Math.min(l,e.y))}}function tt(e,t,n,o){let r=e,i=t[0],a=t[1],s=t[2],c=r[0]*i+r[4]*a+r[8]*s+r[12],l=r[1]*i+r[5]*a+r[9]*s+r[13],u=r[2]*i+r[6]*a+r[10]*s+r[14],m=r[3]*i+r[7]*a+r[11]*s+r[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let h=c/m,d=l/m,f=u/m,p=h>=-1.05&&h<=1.05&&d>=-1.05&&d<=1.05&&f<=1;return{x:(h*.5+.5)*n,y:(1-(d*.5+.5))*o,depth:f,visible:p}}function Ac(e,t,n=t){let o=[],r=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of r){let a=!1;for(let s of o)if(_n(i,s,t,n)){a=!0;break}a||o.push(i)}return o}var Up=6;function _n(e,t,n,o){let r=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Up):n;return r<a&&i<o}function Ec(e,t,n){return e.length*t*.58+(n?14:0)}var jp={row:8,seat:14};function Cc(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:jp}function _c(e,t,n,o){let r=Math.max(1,Math.min(n,o)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-o/2)/r);return t*(1+1.5*i)}function Mo(e,t,n,o,r=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=o)break;let c=!1;for(let l of r)if(_n(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(_n(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}function Tc(e,t,n,o){let r=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15];return r<=0||!(n>0)?0:n*Math.hypot(e[0],e[4],e[8])*o/(2*r)}var Xp=6,Wp=2.2,kc=.1,Yp=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),Kp=.3,qp=1.8,$p=.9,Zp=.55,Qp=6e3;function Fc(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let m of u.objects)m.type==="section"&&m.zone&&c.set(m.id,m.zone);let l=new Map;for(let u=0;u<o.length;u++){let m=o[u],h=r.seatOwner[u],d=m.zoneId??(h?c.get(h):void 0);if(!d)continue;let f=l.get(d);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(d,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+=r.seatDeckY(u)}for(let u of a){let m=l.get(u.id),h=[];for(let[d,f]of c)f===u.id&&h.push(d);if(!m||m.n===0){s.push({id:u.id,label:u.label,color:pe(u.color),sectionIds:h,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*E,1.5,(u.focalPoint??i).y*E]});continue}s.push({id:u.id,label:u.label,color:pe(u.color),sectionIds:h,seatCount:m.n,center:[(m.minX+m.maxX)/2*E,m.sumY/m.n,(m.minY+m.maxY)/2*E],radius:.5*Math.hypot((m.maxX-m.minX)*E,(m.maxY-m.minY)*E)||1,focalWorld:[(u.focalPoint??i).x*E,1.5,(u.focalPoint??i).y*E]})}}return s}function Oc(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],m=[],h=new Map;for(let d of n)for(let f of d.objects){if(f.type!=="section"||!f.zone)continue;let p=(f.displayLabel||f.label||"").trim().toLocaleLowerCase();if(!p)continue;let b=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&b===p)continue;let y=h.get(f.zone);y||h.set(f.zone,y=new Set),y.add(p)}for(let d of s)d.seatCount!==0&&(h.get(d.id)?.has(d.label.trim().toLocaleLowerCase())||l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+Xp,d.center[2]],color:t.zones?.find(f=>f.id===d.id)?.color}));{let d=new Map,f=new Map;for(let p=0;p<o.length;p++){let b=r.seatOwner[p];if(!b)continue;let y=d.get(b);y||(y={n:0,x:0,y:0,deck:0},d.set(b,y)),y.n++,y.x+=o[p].x,y.y+=o[p].y,y.deck+=r.seatDeckY(p);let g=f.get(b);g||(g={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},f.set(b,g)),g.minDeck=Math.min(g.minDeck,r.seatDeckY(p)),g.maxDeck=Math.max(g.maxDeck,r.seatDeckY(p)),o[p].x<g.minX&&(g.minX=o[p].x),o[p].x>g.maxX&&(g.maxX=o[p].x),o[p].y<g.minY&&(g.minY=o[p].y),o[p].y>g.maxY&&(g.maxY=o[p].y)}for(let p of n)for(let b of p.objects){if(b.type!=="section"||pc(b))continue;let y=d.get(b.id);if(!y||y.n===0)continue;let g=f.get(b.id),M=[y.x/y.n*E,y.deck/y.n,y.y/y.n*E],P=b.displayLabel||b.label||b.id;u.push({id:b.id,floorIndex:p.index,label:P,seatCount:y.n,center:M,radius:Math.max(1,Math.hypot(g.maxX-g.minX,g.maxY-g.minY)*.5*E),box:{min:[g.minX*E-.4,g.minDeck,g.minY*E-.4],max:[g.maxX*E+.4,g.maxDeck+1,g.maxY*E+.4]},focalWorld:[p.focal.x*E,p.baseHeightM+1.5,p.focal.y*E]});let I=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&I===P.trim().toLocaleLowerCase()||l.push({id:`section:${b.id}`,kind:"section",text:P,anchor:[M[0],M[1]+Wp,M[2]],floorIndex:p.index})}}{for(let y of n)for(let g of y.objects){if(g.type!=="gaArea")continue;let M=pn(g.points);if(!M)continue;let P=g.displayLabel||g.label||g.id;l.push({id:`ga:${g.id}`,kind:"ga",text:g.capacity>0?`${P} \xB7 ${g.capacity.toLocaleString()}`:P,anchor:[M.x*E,y.baseHeightM+qp,M.y*E],floorIndex:y.index})}let d=new Map,f=new Map;for(let y of n)for(let g of y.objects)if(g.type==="section"&&d.set(g.id,g.displayLabel||g.label||g.id),g.type==="row"){let M=g.displayLabel?.trim()||g.segmentedRow?.displayLabel?.trim();M&&f.set(g.id,M)}let p=new Map;for(let y=0;y<o.length;y++){let g=o[y],M=Math.hypot(g.x-c.x,g.y-c.y),P=p.get(g.rowId);(!P||M>P.far)&&p.set(g.rowId,{seat:g,index:y,far:M})}for(let[y,g]of p){let M=r.seatOwner[g.index]??g.seat.sectionId,P=Lc(g.seat.label,y,d.get(M??""),f.get(y));P&&l.push({id:`row:${y}`,kind:"row",text:P,anchor:[g.seat.x*E,r.seatDeckY(g.index)+$p,g.seat.y*E],floorIndex:a[g.index]})}let b=new Map;for(let y=0;y<o.length;y++){let g=o[y],M=b.get(g.rowId);M||(M={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Lc(g.label,g.rowId,d.get(r.seatOwner[y]??g.sectionId??""),f.get(g.rowId)),sectionId:r.seatOwner[y]??g.sectionId},b.set(g.rowId,M));let P=y*3,I=i.iPosition[P],S=i.iPosition[P+1],x=i.iPosition[P+2];M.n++,M.x+=I,M.y+=S,M.z+=x,M.minX=Math.min(M.minX,I),M.maxX=Math.max(M.maxX,I),M.minZ=Math.min(M.minZ,x),M.maxZ=Math.max(M.maxZ,x)}for(let[y,g]of b)m.push({id:y,label:g.label,sectionId:g.sectionId,seatCount:g.n,center:[g.x/g.n,g.y/g.n,g.z/g.n],radius:Math.max(.8,Math.hypot(g.maxX-g.minX,g.maxZ-g.minZ)*.5)});if(o.length<=Qp)for(let y=0;y<o.length;y++){let g=o[y],M=jr(g.displayLabel||g.label);M&&l.push({id:`seat:${g.id}`,kind:"seat",seatWidthM:i.iChairWidth[y]*2,text:M,anchor:[g.x*E,r.seatDeckY(y)+Zp,g.y*E],floorIndex:a[y],rowId:g.rowId})}}for(let d of n)for(let f of d.objects)if(f.type==="shape"&&f.role&&Yp.has(f.role)){let p=ge(f),b=p?pn(p):null;if(!b||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:f.role==="stage"?"stage":"annotation",text:f.label,anchor:[b.x*E,d.baseHeightM+qe(f).heightM+kc,b.y*E],color:f.fill,floorIndex:d.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*E,d.baseHeightM+kc,f.position.y*E],color:f.color,rotation:f.rotation,floorIndex:d.index})}else if(f.type==="booth"){let p=$e(f);if(!p)continue;let b=pn(p);if(!b)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[b.x*E,d.baseHeightM+po+Kp,b.y*E],floorIndex:d.index})}return{labels:l,sections:u,rows:m}}function Dc(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 jr(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Lc(e,t,n,o){if(o?.trim())return o.trim();let r=e?e.lastIndexOf("-"):-1,i=r>0?e.slice(0,r):t;return i&&Sc(i,n)}function Bc(e){let{doc:t,units:n,seats:o,surfaces:r,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 h=0;h<i.floor.length;h+=1){let d=Math.max(0,Math.min(n.length-1,Math.round(i.floor[h]))),f=h*3,p=l[d];p.minX=Math.min(p.minX,i.position[f]),p.minY=Math.min(p.minY,i.position[f+1]),p.minZ=Math.min(p.minZ,i.position[f+2]),p.maxX=Math.max(p.maxX,i.position[f]),p.maxY=Math.max(p.maxY,i.position[f+1]),p.maxZ=Math.max(p.maxZ,i.position[f+2])}let u=new Map;for(let h=0;h<n.length;h++)for(let d of n[h].objects)d.type==="section"&&u.set(d.id,h);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 h=0;h<o.length;h++){let d=r.seatOwner[h],f=(d!==null?u.get(d):void 0)??a[h];if(f===void 0)continue;let p=m[f],b=o[h];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let y=r.seatDeckY(h);p.sumX+=b.x*E,p.sumDeck+=y,p.sumZ+=b.y*E,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[h]=f}for(let h=0;h<n.length;h++){let d=m[h],f=t.floors?.[h],p=l[h],b=Math.min(d.n?d.minX*E:n[h].focal.x*E-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(d.n?d.maxX*E:n[h].focal.x*E+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(d.n?d.minY*E:n[h].focal.y*E-1,Number.isFinite(p.minZ)?p.minZ:1/0),M=Math.max(d.n?d.maxY*E:n[h].focal.y*E+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),P=Math.min(d.n?Math.min(n[h].baseHeightM,d.minDeck):n[h].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),I=Math.max(d.n?Math.max(d.maxDeck,P+.5):P+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),S=[d.n?d.sumX/d.n:(b+y)/2,d.n?d.sumDeck/d.n:(P+I)/2,d.n?d.sumZ/d.n:(g+M)/2],x=Math.max(1,.5*Math.hypot(y-b,I-P,M-g));c.push({index:h,id:f?.id??`floor-${h}`,label:f?.name??(n.length>1?`Floor ${h+1}`:"Venue"),seatCount:d.n,center:S,radius:x,box:{min:[b,P,g],max:[y,I,M]},focalWorld:[n[h].focal.x*E,n[h].baseHeightM+1.5,n[h].focal.y*E]})}}return c}function Xr(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<o&&(o=c),s>r&&(r=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=$e(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=bo(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=yo(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Uc(e,t,n,o,r,i,a){if(t.length===1){let s=n.map(h=>({x:h.x,y:h.y}));for(let h of t[0].objects)h.type==="section"?s.push(...h.outline):h.type==="shape"?s.push(...ge(h)??h.points??[]):h.type==="gaArea"?s.push(...h.points):h.type==="booth"?s.push(...$e(h)??[]):h.type==="table"?s.push(...bo(h)??[]):h.type==="decorImage"&&s.push(...yo(h)??[]);if(Gc(e,t[0],n,i)||zc(e,t[0],n,s,i))return!1;if(a&&Vc(e,t[0].baseHeightM,s,i,a))return!0;let c=Pn(s),l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2,m=c.length>=3?c.map(h=>{let d=h.x-l,f=h.y-u,p=Math.max(1,Math.hypot(d,f));return{x:h.x+d/p*80,y:h.y+f/p*80}}):gn(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return ae(e,m,void 0,()=>-.04,-.22,i.ground,i.ground,ne),!1}else{let s=t.reduce((b,y)=>y.baseHeightM<b.baseHeightM?y:b);e.setFloor(s.index);let c={...s,objects:t.flatMap(b=>b.objects)},l=n.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&l.push(...b.outline);if(Gc(e,c,n,i)||zc(e,c,n,l,i))return!1;if(a&&Vc(e,s.baseHeightM,l,i,a))return!0;let u=n.filter((b,y)=>o[y]===s.index),m=Xr([s],u),h=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),d=Math.max(28,Math.min(80,h*.04)),f=gn(m.minX-d,m.minY-d,m.maxX-m.minX+d*2,m.maxY-m.minY+d*2),p=s.baseHeightM-.03;return ae(e,f,void 0,()=>p,p-.22,i.ground,i.ground,ne),!1}}function Wr(e,t,n,o){let{cx:r,cz:i,radius:a}=n,s=1/0,c=1/0,l=1/0,u=-1/0,m=-1/0,h=-1/0,d=(b,y,g)=>{s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),m=Math.max(m,y),l=Math.min(l,g),h=Math.max(h,g)};for(let b=0;b<e.position.length;b+=3){let y=b/3;o&&y>=o[0]&&y<o[1]||d(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let y=b*3,g=t.iPosition[y],M=t.iPosition[y+1],P=t.iPosition[y+2],I=Math.max(.35,t.iMaxRadius[b]??.35);d(g-I,M,P-I),d(g+I,M+1.6,P+I)}Number.isFinite(s)||(s=r-a,u=r+a,c=0,m=a*.16,l=i-a,h=i+a);let f=[(s+u)/2,(c+m)/2,(l+h)/2],p=Math.max(1,.5*Math.hypot(u-s,m-c,h-l));return{center:f,radius:p,minY:c,maxY:m}}var Jp=4096;function jc(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Jp)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),a=0;for(let s=0;s<e.count;s+=o){let c=e.iPosition[s*3],l=e.iPosition[s*3+1],u=e.iPosition[s*3+2];i[a++]=c,i[a++]=l,i[a++]=u,i[a++]=c,i[a++]=0,i[a++]=u}for(let[s,c,l]of n)i[a++]=s,i[a++]=c,i[a++]=l;for(let s of t)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[a++]=s.cx+c*s.halfX,i[a++]=s.y,i[a++]=s.cz+l*s.halfZ;return i.subarray(0,a)}function Xc(e,t,n,o,r,i,a=[]){let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<e.count;I++){let S=I*3,x=e.iPosition[S],v=e.iPosition[S+2];x<s&&(s=x),x>l&&(l=x),v<c&&(c=v),v>u&&(u=v)}for(let[I,,S]of a)I<s&&(s=I),I>l&&(l=I),S<c&&(c=S),S>u&&(u=S);for(let I of t)s=Math.min(s,I.cx-I.halfX),l=Math.max(l,I.cx+I.halfX),c=Math.min(c,I.cz-I.halfZ),u=Math.max(u,I.cz+I.halfZ);let m=n.minX*E,h=n.maxX*E,d=n.minY*E,f=n.maxY*E,p=m,b=h,y=d,g=f;if(Number.isFinite(s)){let I=Math.max(2,.06*Math.hypot(l-s,u-c));p=Math.max(m,s-I),b=Math.min(h,l+I),y=Math.max(d,c-I),g=Math.min(f,u+I)}let M=Math.min(0,o),P=Math.max(r,i*.05);return{min:[p,M,y],max:[b,P,g]}}var Nc=12,eb=.6,tb=40;function Vc(e,t,n,o,r){let i=Pn([...n]);if(i.length<3)return!1;let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let P of i)a=Math.min(a,P.x),c=Math.max(c,P.x),s=Math.min(s,P.y),l=Math.max(l,P.y);let u=Math.hypot(c-a,l-s)*E,m=Ke(i,Nc/E,1.2),h=Math.max(tb,u*eb),d=Ke(i,(Nc+h)/E,1.2);if(m.length!==d.length)return!1;let f=be(o.ground,[.78,.76,.72],.35),p=be(o.ground,[.56,.62,.52],.3);ae(e,m,void 0,()=>t-.04,t-.22,f,f,ne);let b=t-.05,y=m.map(P=>[P.x*E,b,P.y*E]),g=d.map(P=>[P.x*E,b,P.y*E]),M=[0,1,0];for(let P=0;P<y.length;P++){let I=(P+1)%y.length;e.tri(y[P],g[I],g[P],M,p,r,r),e.tri(y[P],y[I],g[I],M,p,p,r)}return!0}function Gc(e,t,n,o){let r=Wt(t,n);if(!r)return!1;let i=t.baseHeightM,a=be(o.ground,[.62,.55,.47],.4);return ae(e,r,void 0,()=>i-.04,i-.22,a,a,ne),!0}var nb=3e3,ob=20,Hc=1.5,rb=1.2,ib=.25;function zc(e,t,n,o,r){if(!n.length||n.length>nb||o.length<3)return!1;for(let w of t.objects){if(w.type==="shape"&&Zn(w.stageKind))return!1;if(w.type==="section"){let{height:R}=dt(w,{floorBaseHeightM:t.baseHeightM});if(R-t.baseHeightM>ob)return!1}}let i=0,a=0;for(let w of o)i+=w.x,a+=w.y;i/=o.length,a/=o.length;let s=0,c=0,l=0;for(let w of o){let R=w.x-i,T=w.y-a;s+=R*R,c+=T*T,l+=R*T}let u=.5*Math.atan2(2*l,s-c),m=Math.cos(u),h=Math.sin(u),d=-h,f=m,p=1/0,b=-1/0,y=1/0,g=-1/0;for(let w of o){let R=(w.x-i)*m+(w.y-a)*h,T=(w.x-i)*d+(w.y-a)*f;p=Math.min(p,R),b=Math.max(b,R),y=Math.min(y,T),g=Math.max(g,T)}let M=w=>[[p-w,y-w],[b+w,y-w],[b+w,g+w],[p-w,g+w]].map(([R,T])=>({x:i+m*R+d*T,y:a+h*R+f*T})),P=M(Hc/E),I=M((Hc+ib)/E),S=t.baseHeightM,x=be(r.ground,[.62,.55,.47],.4),v=be(r.ground,[.86,.86,.84],.55);return ae(e,I,void 0,()=>S-.04,S-.22,x,x,ne),ae(e,I,[P.slice().reverse()],()=>S+rb,S-.04,be(v,[1,1,1],.2),v,ne),!0}function Wc(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=ka(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let m of n)for(let h of m.objects)h.type==="shape"&&i.set(h.id,{shape:h,unit:m});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(m=>{let h=m.runtimeContentImageUrl;return[m.id,typeof h=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(h)?h:void 0]})),l=[];for(let m of r.value.overlay.productionElements??[]){let h=i.get(m.objectId),d=h?ge(h.shape):null,f=m.baseElevationM??0;if(!h||!d||d.length<3||!m.id||a.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(f)||f<-10||f>100)return o();a.add(m.id),s.add(m.objectId);let p=d.map(v=>v.x*E),b=d.map(v=>v.y*E),y=h.unit.baseHeightM+f,g=Math.min(...p),M=Math.max(...p),P=Math.min(...b),I=Math.max(...b),S,x=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&x&&(S=Ss(d,y,y+m.heightM,h.unit.focal),!S))if(M-g>=I-P){let v=Math.abs(P-h.unit.focal.y*E)<=Math.abs(I-h.unit.focal.y*E)?P-.006:I+.006;S=[[g,y,v],[M,y,v],[g,y+m.heightM,v],[M,y+m.heightM,v]]}else{let v=Math.abs(g-h.unit.focal.x*E)<=Math.abs(M-h.unit.focal.x*E)?g-.006:M+.006;S=[[v,y,P],[v,y,I],[v,y+m.heightM,P],[v,y+m.heightM,I]]}l.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:h.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[g,y,P],max:[M,y+m.heightM,I]},occlusion:m.occlusion,...x?{contentImageUrl:x}:{},...S?{contentPlane:S}:{}})}let u=l.sort((m,h)=>m.id.localeCompare(h.id));return{byObjectId:new Map(u.map(m=>[m.objectId,m])),elements:u}}var Yc=[.13,.14,.17],Zt=[.4,.43,.47],ab=.18,sb=.02,cb=2.4,lb=1500,ub=240;function Kc(e,t,n,o){let r=t.stageKind??"";if(Tt(r)||r==="round"||!o.length)return;let i=ge(t);if(!i||i.length<3)return;let a={x:i.reduce((_,L)=>_+L.x,0)/i.length,y:i.reduce((_,L)=>_+L.y,0)/i.length},s=0,c=0,l=new Set;for(let _ of o)s+=_.x,c+=_.y,l.add(Math.floor(Math.atan2(_.y-a.y,_.x-a.x)*180/Math.PI/10));if(l.size*10>ub)return;let u=a.x-s/o.length,m=a.y-c/o.length,h=Math.hypot(u,m);if(h<1e-6)return;let d=u/h,f=m/h,p=-f,b=d,y=-1/0,g=1/0,M=1/0,P=-1/0;for(let _ of i){let L=(_.x-a.x)*d+(_.y-a.y)*f,N=(_.x-a.x)*p+(_.y-a.y)*b;y=Math.max(y,L),g=Math.min(g,L),M=Math.min(M,N),P=Math.max(P,N)}let I=(P-M)*E,S=(y-g)*E;if(I<3||S<1.5||I*S>lb)return;let x=ab/E,v=(_,L)=>({x:a.x+d*_+p*L,y:a.y+f*_+b*L}),w=(_,L,N,k)=>[v(_,N),v(_,k),v(L,k),v(L,N)],R=n+Math.max(3.5,Math.min(8,I*.35)),T=n+Math.min(cb,R-n-1),O=.2/E,C=g+Math.min(S*.25,1.5)/E,A=sb/E;ae(e,w(y-2*x+A,y-x-A,M+x+O,P-x-O),void 0,()=>T,n,Yc,Yc,ne);for(let[_,L]of[[M+x,M+x+O],[P-x-O,P-x]])ae(e,w(y-2*x,y-x,_,L),void 0,()=>R+.3,n,Zt,Zt,ne),ae(e,w(C+O,y-2*x,_,L),void 0,()=>R+.3,R,Zt,Zt,ne);ae(e,w(C,C+O,M+x,P-x),void 0,()=>R+.3,R,Zt,Zt,ne)}function He(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ge(e){return Array.isArray(e)?e:[]}function mb(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!He(n))continue;let o=He(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function So(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function fb(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function db(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function hb(e){let t=So(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:So(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:So(e.rotation,4),r=e.scale===void 0?[1,1,1]:So(e.scale,3);if(!n||!o||!r)return null;let[i,a,s,c]=o,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let u=i/l,m=a/l,h=s/l,d=c/l,f=u+u,p=m+m,b=h+h,y=u*f,g=u*p,M=u*b,P=m*p,I=m*b,S=h*b,x=d*f,v=d*p,w=d*b;return[(1-(P+S))*r[0],(g+w)*r[0],(M-v)*r[0],0,(g-w)*r[1],(1-(y+S))*r[1],(I+x)*r[1],0,(M+v)*r[2],(I-x)*r[2],(1-(y+P))*r[2],0,n[0],n[1],n[2],1]}function pb(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function bb(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=i*l-a*c,m=a*s-r*l,h=r*c-i*s,d=t*u+n*m+o*h;if(Math.abs(d)<1e-12)return null;let f=1/d;return[u*f,m*f,h*f,(o*c-n*l)*f,(t*l-o*s)*f,(n*s-t*c)*f,(n*a-o*i)*f,(o*r-t*a)*f,(t*i-n*r)*f]}function qc(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,a=e[6]*t+e[7]*n+e[8]*o,s=Math.hypot(r,i,a)||1;return r/=s,i/=s,a/=s,[r,i,a]}function yb(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!He(c))return null;o=c}catch{return null}else if(a===5130562&&!r)r=s;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function gb(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function xb(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function vb(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Mb(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=yb(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!He(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Ge(o.extensionsUsed).filter(P=>typeof P=="string");if(i.includes("KHR_draco_mesh_compression")||mb(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Ge(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Ge(o.images).length||Ge(o.textures).length)return{ok:!1,issue:"external_resource"};let a=Ge(o.buffers);if(a.length!==1||!He(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let s=Ge(o.accessors),c=Ge(o.bufferViews),l=Ge(o.meshes),u=Ge(o.nodes),m=Ge(o.scenes),h=typeof o.scene=="number"?o.scene:0;if(!He(m[h]))return{ok:!1,issue:"unsupported_glb"};let d=new DataView(r.buffer,r.byteOffset,r.byteLength),f=(P,I,S)=>{if(typeof P!="number"||!Number.isInteger(P)||!He(s[P]))return null;let x=s[P];if(x.type!==I||x.sparse!==void 0||x.normalized===!0||typeof x.count!="number"||!Number.isInteger(x.count)||x.count<1||typeof x.componentType!="number"||!S.includes(x.componentType)||typeof x.bufferView!="number")return null;let v=c[x.bufferView];if(!He(v)||v.buffer!==0||typeof v.byteLength!="number"||!Number.isInteger(v.byteLength)||v.byteLength<0)return null;let w=xb(x.type),R=gb(x.componentType),T=typeof v.byteStride=="number"?v.byteStride:w*R,O=typeof v.byteOffset=="number"?v.byteOffset:0,C=typeof x.byteOffset=="number"?x.byteOffset:0,A=O+C,_=C+(x.count-1)*T+w*R;if(!Number.isInteger(T)||!Number.isInteger(O)||!Number.isInteger(C)||T<w*R||O<0||C<0||O+v.byteLength>r.byteLength||_>v.byteLength)return null;let L=[];for(let N=0;N<x.count;N++){let k=[];for(let F=0;F<w;F++){let H=vb(d,A+N*T+F*R,x.componentType);if(!Number.isFinite(H))return null;k.push(H)}L.push(k)}return L},p=[],b=[],y=0,g=new Set,M=(P,I)=>{if(typeof P!="number"||!Number.isInteger(P)||!He(u[P])||g.has(P))return!1;g.add(P);let S=u[P],x=hb(S);if(!x)return!1;let v=db(I,x),w=bb(v);if(!w)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let R=l[S.mesh];if(!He(R))return!1;for(let T of Ge(R.primitives)){if(!He(T)||T.mode!==void 0&&T.mode!==4||!He(T.attributes))return!1;let O=f(T.attributes.POSITION,"VEC3",[5126]),C=T.attributes.NORMAL===void 0?null:f(T.attributes.NORMAL,"VEC3",[5126]);if(!O||T.attributes.NORMAL!==void 0&&!C)return!1;let A=O.length;if(T.indices!==void 0){let L=typeof T.indices=="number"?s[T.indices]:null;A=He(L)?L.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(y+=A/3,y>1e5))return!1;let _=T.indices===void 0?O.map((L,N)=>[N]):f(T.indices,"SCALAR",[5121,5123,5125]);if(!_||_.length%3!==0||_.length!==A)return!1;for(let L=0;L<_.length;L+=3){let N=[_[L][0],_[L+1][0],_[L+2][0]];if(N.some(H=>!Number.isInteger(H)||H<0||H>=O.length))return!1;let k=N.map(H=>pb(v,...O[H])),F=null;if(!C){let H=k[1][0]-k[0][0],B=k[1][1]-k[0][1],D=k[1][2]-k[0][2],G=k[2][0]-k[0][0],j=k[2][1]-k[0][1],V=k[2][2]-k[0][2];F=qc([1,0,0,0,1,0,0,0,1],B*V-D*j,D*G-H*V,H*j-B*G)}for(let H=0;H<3;H++)p.push(...k[H]),b.push(...C?qc(w,...C[N[H]]):F)}}}for(let R of Ge(S.children))if(!M(R,v))return!1;return g.delete(P),!0};for(let P of Ge(m[h].nodes))if(!M(P,fb()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(b)}}function $c(e){try{return Mb(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Qt(e){let{doc:t}=e,n=ya(t.theme),o=n.structure,r=cs(t,e.eventConfigurationId??t.eventConfigurationId),i=Wc(e.eventConfigurationId,e.eventConfiguration,r),a=e.seats,s=new qn,c=null;if(e.registeredShellGlb){let W=$c(e.registeredShellGlb);if(W.ok){let Y=W.position.length/3,K=new Float32Array(W.position.length),oe=n.materials.shell??o.tierWall;for(let ee=0;ee<Y;ee++){let le=W.normal[ee*3+1],J=le<-.25?.4:.62+.38*Math.max(0,le);K[ee*3]=oe[0]*J,K[ee*3+1]=oe[1]*J,K[ee*3+2]=oe[2]*J}c={position:W.position,normal:W.normal,color:K,floor:new Float32Array(Y).fill(-2),material:new Float32Array(Y),count:Y}}}let l=new Map;for(let W of r)for(let Y of W.objects)l.set(Y.id,W.index),Y.type==="section"&&l.set(Y.logicalSectionId??Y.id,W.index);let u=a.map(W=>l.get(W.sectionId??"")??l.get(W.rowId??"")??0),m=Xr(r,a),h=s.vertexCount,f=Uc(s,r,a,u,m,o,be(n.background.top,n.background.bottom,.5))?s.vertexCount:h,p=Ka(t,a),b=new Map,y=new Map;for(let W of t.categories??[])b.set(W.key,W.color),W.seatGlyph&&y.set(W.key,W.seatGlyph);let g=[],M=Ms(r,a,u),P=new Map;a.forEach((W,Y)=>{let K=M.seatDeckY(Y);Number.isFinite(K)&&P.set(W.rowId,Math.min(P.get(W.rowId)??1/0,K))});let I=new Float32Array(a.length),S=[],x=new Map((t.floors??[]).map((W,Y)=>[W.id,Y])),v=r.map(()=>[]);for(let W of a){let Y=W.floorId?x.get(W.floorId)??0:0;v[Math.min(Y,v.length-1)]?.push(W)}let w=(W,Y)=>{if(!Y||Y.length<3)return!1;let K=Math.min(...Y.map(J=>J.x)),oe=Math.max(...Y.map(J=>J.x)),ee=Math.min(...Y.map(J=>J.y)),le=Math.max(...Y.map(J=>J.y));for(let J=0;J<W;J++)for(let ce of v[J])if(!(ce.x<K||ce.x>oe||ce.y<ee||ce.y>le)&&Le(ce,Y,void 0))return!0;return!1},R=null,T=W=>r.length===1?a:a.filter((Y,K)=>u[K]===W),O=(W,Y)=>{let K=$e(W);if(!K)return!1;let oe=1/0,ee=1/0,le=-1/0,J=-1/0;for(let ce of K)oe=Math.min(oe,ce.x),le=Math.max(le,ce.x),ee=Math.min(ee,ce.y),J=Math.max(J,ce.y);return a.some((ce,Oe)=>ce.kind!=="booth"&&(r.length===1||u[Oe]===Y)&&ce.x>oe&&ce.x<le&&ce.y>ee&&ce.y<J&&Ne(K,ce.x,ce.y))},C;for(let W=0;W<r.length;W++){let Y=r[W];s.setFloor(W);let K=Wt(Y,T(W)),oe=0;if(K){let te=0;for(let me of Y.objects)if(me.type==="section")for(let Se of M.bySection.get(me.id)?.rowLevels??[])te=Math.max(te,Se.y-Y.baseHeightM);if(oe=ps(te),!C){let me=bs(K);C={centre:[me.x*E,me.y*E]}}}let ee=new io,le=[],J=Y.objects.filter(te=>te.type==="shape"&&(te.role==="entrance"||te.role==="exit")),ce=Y.objects.filter(te=>te.type==="section"&&!!te.outline&&te.outline.length>=3),Oe=Ys(Y.objects.filter(te=>te.type==="booth"),Y.focal);for(let te of Y.objects)if(te.type==="section"){let me=s.vertexCount;cc(s,te,Y,qa(te,p),M.bySection.get(te.id),ee,ce,o,W>0&&w(W,te.outline));let Se=s.vertexCount-me;Se>0&&S.push({sectionId:te.id,start:me,count:Se})}else if(te.type==="shape"){let me=i.byObjectId.get(te.id),Se=g.length,Xe=K!==null&&te.role==="wall"&&!me;s.setMaterial(Xe?hs:(me?.kind??te.role)==="screen"?1:0);let De=te.role==="stage"&&!me?qs(te,T(W)):Xe&&te.heightM===void 0?{...te,heightM:oe}:te,Ae=fs(De,le);if(Us(s,De,Y.baseHeightM+Ae.supportOffsetM,Ae.topOffsetM-Ae.supportOffsetM,o,Y.focal,g,me,J),s.setMaterial(0),te.role==="stage"&&!me&&g.length>Se&&(R??W)===W){R=W;let We=t.floors?.[W]?.id,Ze=r.length>1&&We?a.filter(Pt=>Pt.floorId===We):a;Kc(s,De,g[g.length-1].y,Ze)}}else te.type==="gaArea"?Xs(s,te,Y.baseHeightM,pe(b.get(te.categoryKey)),o):te.type==="booth"?Gs(s,te,Y.baseHeightM,pe(b.get(te.categoryKey)),o,Oe.get(te.id)??Y.focal,O(te,W)):te.type==="table"?zs(s,te,Math.max(Y.baseHeightM,P.get(te.id)??Y.baseHeightM),pe(te.fill??t.theme?.decorFill??"#232c40"),o,!!(te.fill??t.theme?.decorFill)):te.type==="decorImage"&&js(s,te,Y.baseHeightM,o);uc(s,Y,a,M,o,n.materials.shell,!c)}let A=r.length>1?{x:r.reduce((W,Y)=>W+Y.focal.x,0)/r.length,y:r.reduce((W,Y)=>W+Y.focal.y,0)/r.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},_=ma(c?[s.build(),c]:[s.build()]),L=da(a,e.initialState,M,I,b,y),N=Fc({doc:t,units:r,seats:a,surfaces:M,focal:A}),{labels:k,sections:F,rows:H}=Oc({doc:t,units:r,seats:a,surfaces:M,seatData:L,hintedSeatFloor:u,zones:N,focal:A}),B=new Map(F.map((W,Y)=>[W.id,Y]));M.seatOwner.forEach((W,Y)=>{L.iSection[Y]=W?B.get(W)??-1:-1});let D=Bc({doc:t,units:r,seats:a,surfaces:M,solids:_,hintedSeatFloor:u,seatFloor:I});Dc(k,D),L.iYaw=ki(L.iPosition,a.length,W=>a[W].rowId,W=>{let Y=r[I[W]]?.focal??A;return[Y.x*E,Y.y*E]});let G=(m.minX+m.maxX)/2*E,j=(m.minY+m.maxY)/2*E,V=.5*Math.hypot((m.maxX-m.minX)*E,(m.maxY-m.minY)*E)||10,z=Wr(_,L,{cx:G,cz:j,radius:V},[h,f]),q=Wr(_,L,{cx:G,cz:j,radius:V}),$=Sb(r),re=Xc(L,g,m,z.minY,z.maxY,V,$);return{sharedAisles:ha(r.flatMap(W=>W.objects.flatMap(Y=>{if(Y.type!=="section")return[];let K=M.bySection.get(Y.id);return K?[{sectionId:Y.id,floorIndex:W.index,rows:K.rowLevels}]:[]}))),solids:_,sectionSolidRanges:S,seats:L,seatSectionIds:M.seatOwner,bounds:{center:[(re.min[0]+re.max[0])/2,(re.min[1]+re.max[1])/2,(re.min[2]+re.max[2])/2],radius:V,groundY:0,box:re,fitPoints:jc(L,g,$)},...C?{room:C}:{},...!C&&r.some(W=>W.objects.some(Y=>Y.type==="shape"&&Zn(Y.stageKind)))?{outdoor:!0}:{},renderBounds:{center:z.center,radius:z.radius},clipBounds:{center:q.center,radius:q.radius},stateColorLUT:ga(n,Ce),theme:n,seatCount:a.length,focalWorld:[A.x*E,1.5,A.y*E],zones:N,stages:g,productionElements:i.elements,sections:F,rows:H,labels:k,floors:D}}function Sb(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?$e(o):null;for(let i of r??[])t.push([i.x*E,n.baseHeightM,i.y*E])}return t}var xt=require("ogl"),wb=.05,Pb=.6,Ib=12,Rb=1.6,Ab=1,Eb=2.5,Cb=650,Zc=24;function _b(e){let t=[],n=[],o=[],r=(m,h,d)=>{t.push(...m),n.push(...h),o.push(d)};for(let m=0;m<16;m++){let h=m/16*Math.PI*2,d=(m+1)/16*Math.PI*2,f=M=>[Math.cos(M),0,Math.sin(M)],p=[Math.cos(h)*.012,0,Math.sin(h)*.012],b=[Math.cos(d)*.012,0,Math.sin(d)*.012],y=[Math.cos(h)*.03,1,Math.sin(h)*.03],g=[Math.cos(d)*.03,1,Math.sin(d)*.03];r(p,f(h),0),r(y,f(h),0),r(g,f(d),0),r(p,f(h),0),r(g,f(d),0),r(b,f(d),0)}let c=.16,l=.24,u=.01;for(let m=0;m<48;m++){let h=m/48*Math.PI*2,d=(m+1)/48*Math.PI*2,f=[Math.cos(h)*c,u,Math.sin(h)*c],p=[Math.cos(h)*l,u,Math.sin(h)*l],b=[Math.cos(d)*l,u,Math.sin(d)*l],y=[Math.cos(d)*c,u,Math.sin(d)*c];for(let g of[f,p,b,f,b,y])r(g,[0,1,0],1)}return new xt.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var Tb=`#version 300 es
20
+ }`});async function Wu(e,t,n,o={}){let i=o.fadeMs??400,r=t?.initialBearingDeg??0,a=Math.max(-lt,Math.min(lt,t?.initialPitchDeg??0)),s=Xo,c=!1,m=new AbortController,l=()=>m.abort();o.signal?.addEventListener("abort",l,{once:!0});let u=()=>{},h=[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 N=n.camera.position,k=n.focalWorld[0]-N.x,B=n.focalWorld[1]-N.y,D=n.focalWorld[2]-N.z,H=Math.hypot(k,D);H>.001&&(r=Math.atan2(k,-D)*180/Math.PI,a=Math.max(-lt,Math.min(lt,Math.atan2(B,H)*180/Math.PI)))}let f=null;if(t){let N=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),k=Uo(t,zo(N)),B;try{let D=t.resolveUrl?await t.resolveUrl(k.initialUrl):k.initialUrl;if(!D)throw new Error("panorama_asset_unavailable");B=await Yn(D,m.signal)}catch{return o.signal?.removeEventListener("abort",l),null}try{f=zu(n.gl,B)}catch{return m.abort(),o.signal?.removeEventListener("abort",l),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),k.upgradeUrl&&(u=jo(()=>{(t.resolveUrl?t.resolveUrl(k.upgradeUrl):Promise.resolve(k.upgradeUrl)).then(H=>!H||m.signal.aborted?null:Yn(H,m.signal)).then(H=>{H&&(c||m.signal.aborted||(f?.setImage(H),n.requestRender()))}).catch(()=>{})}))}let d=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let N=n.camera.position;f?.mesh.position.set(N.x,N.y,N.z);let[k,B,D]=Gu(r,a);n.camera.lookAt([N.x+k,N.y+B,N.z+D]),n.requestRender()};b();let g=document.createElement("div"),x=document.activeElement instanceof HTMLElement?document.activeElement:null;g.setAttribute("role","dialog"),g.setAttribute("aria-modal","true"),g.setAttribute("aria-label",o.seatLabel?`View from ${o.seatLabel}`:"View from seat"),g.tabIndex=-1,Object.assign(g.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let S=document.createElement("button");if(S.type="button",S.setAttribute("aria-label","Close"),S.textContent="\u2715",Object.assign(S.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(S),o.disclosure){let N=document.createElement("div");N.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.disclosure}`,Object.assign(N.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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(N)}let I=document.createElement("div");I.textContent=Ei(o.lookAroundHint),Object.assign(I.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(I),e.appendChild(g),S.focus({preventScroll:!0});let M=!1,y=0,P=0,v=0,w=new Map,R=()=>{let[N,k]=[...w.values()];return N&&k?Math.hypot(N.x-k.x,N.y-k.y):0},C=N=>{let k=Ri(N);k!==s&&(s=k,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},O=N=>{N.target!==S&&(w.set(N.pointerId,{x:N.clientX,y:N.clientY}),M=w.size===1,y=N.clientX,P=N.clientY,w.size===2&&(v=R()),g.setPointerCapture?.(N.pointerId),g.style.cursor="grabbing")},E=N=>{if(w.has(N.pointerId)){if(w.set(N.pointerId,{x:N.clientX,y:N.clientY}),w.size>=2){let k=R();v>0&&k>0&&C(s*(v/k)),v=k,M=!1;return}M&&(r+=(N.clientX-y)*ju,a=Math.max(-lt,Math.min(lt,a+(N.clientY-P)*ju)),y=N.clientX,P=N.clientY,b())}},A=N=>{w.delete(N.pointerId),v=w.size===2?R():0;let k=w.values().next().value;M=w.size===1,k?(y=k.x,P=k.y):g.style.cursor="grab";try{g.releasePointerCapture?.(N.pointerId)}catch{}},T=N=>{N.preventDefault(),C(s+N.deltaY*.04)};g.addEventListener("pointerdown",O),g.addEventListener("pointermove",E),g.addEventListener("pointerup",A),g.addEventListener("pointercancel",A),g.addEventListener("wheel",T,{passive:!1});let L=N=>{if(!c){if(N.key==="Tab"){N.preventDefault(),S.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j.close();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")r+=N.key==="ArrowLeft"?-4:4;else if(N.key==="ArrowUp"||N.key==="ArrowDown")a=Math.max(-lt,Math.min(lt,a+(N.key==="ArrowUp"?4:-4)));else if(N.key==="+"||N.key==="="){C(s-5),N.preventDefault();return}else if(N.key==="-"){C(s+5),N.preventDefault();return}else return;N.preventDefault(),b()}};window.addEventListener("keydown",L);let V=0,F=(N,k)=>{if(!f){k?.();return}let B=N===1?0:1,D=performance.now(),H=()=>{if(c)return;let U=i<=0?1:Math.min(1,(performance.now()-D)/i);f?.setOpacity(B+(N-B)*U),n.requestRender(),U<1?V=requestAnimationFrame(H):k?.()};V=requestAnimationFrame(H)};F(1);let G=()=>{c||(c=!0,u(),m.abort(),o.signal?.removeEventListener("abort",l),cancelAnimationFrame(V),g.removeEventListener("pointerdown",O),g.removeEventListener("pointermove",E),g.removeEventListener("pointerup",A),g.removeEventListener("pointercancel",A),g.removeEventListener("wheel",T),window.removeEventListener("keydown",L),g.remove(),x?.isConnected&&x.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(h[0],h[1],h[2]),n.camera.perspective({fov:d,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},j={close(){if(c)return;let N=()=>{G(),o.onClose?.()};cancelAnimationFrame(V),F(0,N)},dispose:G};return S.addEventListener("click",()=>j.close()),j}var ju,Xu=yn(()=>{"use strict";Uu();Yo();Yo();Ai();ju=.15});var Yu={};Ki(Yu,{createOpenPanorama:()=>Ig});function Ig(e){let{container:t,model:n,opts:o,analytics:i,orbit:r,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:m,gpu:l,gl:u,isContextLost:h,isDisposed:f,flightGen:d,setPanorama:p,getLoadAbort:b,setLoadAbort:g,setPanoramaSphereVisible:x,setFrozen:S,raisePanoramaLayer:I,restorePanoramaLayer:M,getOverviewChip:y,labelOverlay:P,reducedMotion:v,removeArriveChip:w,showArriveChip:R}=e;return async(C,O,E)=>{b()?.abort();let A=new AbortController;g(A);let T=n.seats.idToIndex.get(C);if(T===void 0){r.syncFromCamera();return}let L=s.get(C)?.label??C,V=m(C,T),F=c(C);if(!F){A.abort(),b()===A&&g(null),r.syncFromCamera();return}S(!0),a.stop();let G;try{G=await F}catch{if(b()===A&&g(null),i.panoramaFailed(C,"source"),!f()&&E===d()){S(!1),r.resumeAfterFlight(V.focal),a.requestRender();let q=R(C,E,!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||E!==d()){A.abort(),b()===A&&g(null);return}w();let j=y(),N=()=>{A.abort(),b()===A&&g(null),p(null),x(!1),M(),j.style.display="",P.setVisible(!o.arriveAtSeatEye),S(!1),i.panoramaClosed(),r.resumeAfterFlight(V.focal),a.requestRender();let q=R(C,d());requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())},k=G.generated===!0,B=Vu(G);I(),x(!k),j.style.display="none";let D=v()?0:O,H=l(),U=H&&!h()?await Wu(t,k?null:G,{gl:u,scene:H.main,camera:r.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:k?V.eye:void 0,focalWorld:V.focal},{fadeMs:D,seatLabel:L,disclosure:B,disclosurePrefix:k?"Live 3D view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:N,signal:A.signal}):null;if(f()||E!==d()){A.abort(),x(!1),b()===A&&g(null),U?.dispose(),j.style.display="",M();return}if(U)r.syncFromCamera(),P.setVisible(!1),S(!1),a.requestRender(),p(U);else if(k){M(),j.style.display="",S(!1),r.resumeAfterFlight(V.focal),a.requestRender(),p(null),x(!1),i.panoramaFailed(C,"mount");let q=R(C,d(),!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus()),b()===A&&g(null);return}else x(!1),i.panoramaFallback(C),p(Hu(t,G,{fadeMs:D,seatLabel:L,disclosure:B,onClose:N,signal:A.signal,lookAroundHint:o.lookAroundHint}));i.panoramaOpened()}}var Ku=yn(()=>{"use strict";Yo();Xu()});var zg={};Ki(zg,{VENUE3D_QUALITY_REPORT_VERSION:()=>Bl,autoVenue3d:()=>ko,buildSceneModel:()=>rn,estimateVenue3D:()=>Kn,inspectVenue3DQualityEvidence:()=>Oo,mountVenue3D:()=>Gg,prepareVenue3D:()=>um,prepareVenue3DFromChart:()=>mm});module.exports=Rm(zg);function qi(e,t,n){let o=Math.floor(t.length/3),i=n.center[0],r=n.center[2];if(o>0){let c=Math.max(1,Math.floor(o/4e3)),m=0,l=0,u=0;for(let h=0;h<o;h+=c)m+=t[h*3],l+=t[h*3+2],u++;i=m/u,r=l/u}let a=e[0]-i,s=e[2]-r;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var fm=require("ogl");function Zi(e,t,n="#ffffff"){let{iPosition:o,count:i}=t.seats;if(i<2||typeof document>"u")return null;let r=1/0,a=-1/0,s=1/0,c=-1/0;for(let M=0;M<i;M++){let y=o[M*3],P=o[M*3+2];y<r&&(r=y),y>a&&(a=y),P<s&&(s=P),P>c&&(c=P)}for(let M of t.stages)r=Math.min(r,M.cx-M.halfX),a=Math.max(a,M.cx+M.halfX),s=Math.min(s,M.cz-M.halfZ),c=Math.max(c,M.cz+M.halfZ);let m=Math.min(130/Math.max(.001,a-r),86/Math.max(.001,c-s)),l=(148-(a-r)*m)/2,u=(104-(c-s)*m)/2,h=M=>l+(M-r)*m,f=M=>u+(M-s)*m,d=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),p=document.createElement("canvas");p.width=Math.round(148*d),p.height=Math.round(104*d),p.setAttribute("aria-hidden","true"),p.setAttribute("data-seat-locator","");let b=p.style;b.position="absolute",b.left="12px",b.bottom="12px",b.width="148px",b.height="104px",b.borderRadius="10px",b.background="rgba(10,14,22,.72)",b.border="1px solid rgba(255,255,255,.14)",b.boxShadow="0 4px 14px rgba(0,0,0,.35)",b.pointerEvents="none",b.zIndex="3",b.display="none",e.appendChild(p);let g=document.createElement("canvas");g.width=p.width,g.height=p.height;let x=g.getContext("2d");if(x){x.scale(d,d),x.fillStyle="rgba(214,222,234,.28)";let M=Math.max(1,Math.ceil(i/6e3));for(let y=0;y<i;y+=M)x.fillRect(h(o[y*3])-.6,f(o[y*3+2])-.6,1.2,1.2);x.fillStyle="rgba(236,240,246,.16)",x.strokeStyle="rgba(236,240,246,.55)",x.lineWidth=1;for(let y of t.stages){let P=h(y.cx-y.halfX),v=f(y.cz-y.halfZ),w=y.halfX*2*m,R=y.halfZ*2*m;x.fillRect(P,v,w,R),x.strokeRect(P+.5,v+.5,Math.max(0,w-1),Math.max(0,R-1))}}let S=p.getContext("2d"),I="";return{el:p,update(M,y){if(!M||!S||e.clientWidth>0&&e.clientWidth<560){b.display!=="none"&&(b.display="none"),I="";return}let P=h(M[0]),v=f(M[2]),w=y?Math.atan2(y[2],y[0]):0,R=`${P.toFixed(1)},${v.toFixed(1)},${w.toFixed(2)}`;if(R!==I){if(I=R,b.display="block",S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,p.width,p.height),S.drawImage(g,0,0),S.setTransform(d,0,0,d,0,0),y){let C=S.createRadialGradient(P,v,0,P,v,26);C.addColorStop(0,"rgba(255,255,255,.55)"),C.addColorStop(1,"rgba(255,255,255,0)"),S.fillStyle=C,S.beginPath(),S.moveTo(P,v),S.arc(P,v,26,w-.5,w+.5),S.closePath(),S.fill()}S.fillStyle=n,S.strokeStyle="rgba(10,14,22,.9)",S.lineWidth=1.5,S.beginPath(),S.arc(P,v,3.6,0,Math.PI*2),S.fill(),S.stroke()}},dispose(){p.remove()}}}var ve={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Em=.44,Cm=.15,Qi=.3,_m=.24;function Ji(e){return e===void 0||!Number.isFinite(e)||e<=0?_m:Math.min(Qi,Math.max(Cm,e*Em))}var xn=.21,Tm=.05,lr=.45,bt=lr+Tm,vn=.92,gn=.66,ur=1.205,ea=-.23,ta=.38,km=[{part:ve.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ve.pad,min:[-1,.36,-.95],max:[1,lr,1]},{part:ve.back,min:[-1,bt,-1],max:[1,vn,-.72]},{part:ve.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ve.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ve.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ve.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ve.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ve.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ve.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Lm=[{part:ve.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ve.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ve.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ve.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ve.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Fm=[{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 na(){let e=[],t=[],n=[],o=[],i=(k,B,D)=>{let H=n.length,[U,q,$]=k,ee=[q[0]-U[0],q[1]-U[1],q[2]-U[2]],Q=[$[0]-U[0],$[1]-U[1],$[2]-U[2]],X=ee[1]*Q[2]-ee[2]*Q[1],K=ee[2]*Q[0]-ee[0]*Q[2],Y=ee[0]*Q[1]-ee[1]*Q[0],ie=Math.hypot(X,K,Y);ie>1e-9?(X/=ie,K/=ie,Y/=ie):[X,K,Y]=B,X*B[0]+K*B[1]+Y*B[2]<0&&(X=-X,K=-K,Y=-Y);for(let te of k)e.push(...te),t.push(X,K,Y),n.push(D);o.push(H,H+1,H+2,H,H+2,H+3)},r=k=>{for(let B of Fm){let D=B.c.map(H=>H.map((U,q)=>U?k.max[q]:k.min[q]));i(D,B.n,k.part)}},a=(k,B)=>{let[D,H,U]=B?[0,1,2]:[0,2,1],q=k.min[D],$=k.max[D],ee=k.min[H],Q=k.max[H],X=($-q)*.1,K=(Q-ee)*.1,Y=B?[[q+X,ee],[$-X,ee],[$,ee+K],[$*.94,Q-(Q-ee)*.23],[$*gn,Q],[q*gn,Q],[q*.94,Q-(Q-ee)*.23],[q,ee+K]]:[[q+X,ee],[$-X,ee],[$,ee+K],[$,Q-K],[$-X,Q],[q+X,Q],[q,Q-K],[q,ee+K]],ie=(ae,J,oe)=>{let Pe=[0,0,0];return Pe[D]=ae,Pe[H]=J,Pe[U]=oe,Pe},te=[k.min[U],k.max[U]].map(ae=>Y.map(([J,oe])=>ie(J,oe,ae)));for(let ae=0;ae<Y.length;ae++){let J=(ae+1)%Y.length,oe=[0,0,0];oe[D]=(Y[ae][0]+Y[J][0])/2-(q+$)/2,oe[H]=(Y[ae][1]+Y[J][1])/2-(ee+Q)/2,i([te[0][ae],te[0][J],te[1][J],te[1][ae]],oe,k.part)}for(let ae=0;ae<2;ae++){let J=[0,0,0];J[U]=ae?1:-1;let oe=te[ae];for(let Pe=1;Pe<oe.length-1;Pe++){let re=n.length;for(let ge of[oe[0],oe[Pe],oe[Pe+1]])e.push(...ge),t.push(...J),n.push(k.part);o.push(re,re+1,re+2)}}};for(let k of km)k.part===ve.pad||k.part===ve.back?a(k,k.part===ve.back):r(k);for(let k of Lm)r(k);let s=lr,c=1.08,m=.47,l=.69,u=-.55,h=.08,f=-.48,d=.01,p=[-m,s,u],b=[m,s,u],g=[-m,s,h],x=[m,s,h],S=[-l,c,f],I=[l,c,f],M=[-l,c,d],y=[l,c,d];i([b,I,y,x],[1,0,0],ve.body),i([g,M,S,p],[-1,0,0],ve.body),i([p,b,x,g],[0,-1,0],ve.body);let P=c+.07,v=.24,w=[-v,P,f],R=[v,P,f],C=[-v,P,d],O=[v,P,d];i([M,C,w,S],[-.5,1,0],ve.body),i([C,O,R,w],[0,1,0],ve.body),i([O,y,I,R],[.5,1,0],ve.body),i([x,y,M,g],[0,0,1],ve.body),i([y,O,C,M],[0,0,1],ve.body),i([p,S,I,b],[0,0,-1],ve.body),i([S,w,R,I],[0,0,-1],ve.body);let E=10,A=8,T=[0,ur,ea],L=[.32,.115,ta],V=n.length;for(let k=0;k<=A;k++){let B=Math.PI*k/A,D=Math.cos(B),H=Math.sin(B);for(let U=0;U<=E;U++){let q=Math.PI*2*U/E,$=H*Math.cos(q),ee=H*Math.sin(q);e.push(T[0]+L[0]*$,T[1]+L[1]*D,T[2]+L[2]*ee);let Q=$/L[0],X=D/L[1],K=ee/L[2],Y=Math.hypot(Q,X,K)||1;Q/=Y,X/=Y,K/=Y,t.push(Q,X,K),n.push(ve.head)}}for(let k=0;k<A;k++)for(let B=0;B<E;B++){let D=V+k*(E+1)+B,H=D+E+1;o.push(D,H,D+1,D+1,H,H+1)}let F=new Float32Array(e),G=new Float32Array(t),j=new Float32Array(n),N=new Uint16Array(o);return{position:F,normal:G,part:j,index:N,vertexCount:n.length,indexCount:o.length}}function oa(e,t,n,o){let i=new Float32Array(t),r=m=>e[m*3],a=m=>e[m*3+2],s=0,c=(m,l)=>{let u=l-m;for(let h=m;h<l;h++){let[f,d]=o(h),p=f-r(h),b=d-a(h);if(u>=2){let g=Math.max(m,h-1),x=Math.min(l-1,h+1),S=r(x)-r(g),I=a(x)-a(g),M=Math.hypot(S,I);if(M>1e-6){let y=-I/M,P=S/M;y*p+P*b<0&&(y=-y,P=-P),p=y,b=P}}i[h]=p===0&&b===0?0:Math.atan2(p,b)}};for(let m=1;m<=t;m++)(m===t||n(m)!==n(s))&&(c(s,m),s=m);return i}var mr=78,ra=18;function ia(){let e=[],t=[],n=[],o=[],i=[],r=[{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]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,bt,-1],max:[1,vn,-.72]}])for(let c of r){let m=e.length/3,l=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-gn)/(vn-bt):0),u=Math.hypot(c.n[0],l,c.n[2]),h=[c.n[0]/u,l/u,c.n[2]/u];for(let[f,d]of c.c.entries()){let p=d.map((b,g)=>s.min[g]+b*(s.max[g]-s.min[g]));s.part===2&&(p[0]*=1-d[1]*(1-gn)),e.push(...p),t.push(...h),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][f])}i.push(m,m+1,m+2,m,m+2,m+3)}let a=e.length/3;for(let[s,c]of[[-1,-1],[1,-1],[1,1],[-1,1]])e.push(s,c,0),t.push(0,1,0),n.push(0),o.push(s,c);return i.push(a,a+1,a+2,a,a+2,a+3),i.push(...i.slice(12,18),...i.slice(60,66),...i.slice(72,78)),{position:new Float32Array(e),normal:new Float32Array(t),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(i)}}var ma=require("ogl");var Om=/^#?([\da-f]{3}|[\da-f]{6})$/i;function aa(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function Dm(e){let t=Om.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(i=>i+i).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function pe(e){let t=Dm(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function fr(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Nm(e){return .2126*fr(e[0])+.7152*fr(e[1])+.0722*fr(e[2])}function sa(e){return Nm([e[0]*255,e[1]*255,e[2]*255])}function Bm(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function be(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 qe(e,t){let n=Bm(e);return be(e,[n,n,n],t)}function ca({r:e,g:t,b:n}){let o=e/255,i=t/255,r=n/255,a=Math.max(o,i,r),s=Math.min(o,i,r),c=(a+s)/2;if(a===s)return{h:0,s:0,l:c};let m=a-s,l=c>.5?m/(2-a-s):m/(a+s),u;return a===o?u=((i-r)/m+(i<r?6:0))/6:a===i?u=((r-o)/m+2)/6:u=((o-i)/m+4)/6,{h:u,s:l,l:c}}var _e=["available","held","sold","selected","dimmed"];function Mn(e){let t=_e.indexOf(e);return t<0?0:t}var la={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function ua(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.78,o=.86;return[(t+(e[0]-t)*n)*o,(t+(e[1]-t)*n)*o,(t+(e[2]-t)*n)*o]}var dr={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]},kt={top:[.05,.06,.08],bottom:[.1,.12,.15]};function le(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Vm(){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 Jn=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 ma.Renderer({canvas:this.canvas,dpr:Vm(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[kt.top[0],kt.top[1],kt.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=o=>{o.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 Ut=require("ogl"),Te=Math.PI/180,hr=15*Te,pr=80*Te,zt=.12,fa=35,br=1.25,da=.006,Hm=4,jt=.82,Sn=1/jt,Gm=.12,zm=2;function Um(e,t){return{azimuth:0-e*da,polar:-t*da}}function ha(e,t,n){let o=Math.max(zm,Math.max(1,t)*Gm),i=n*Hm;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,i):i}}var jm=1.5;function Wm(e,t,n){let o=Math.max(1,n)*jm;if(!e)return{anchor:[t[0],t[1],t[2]],limit:o};let[i,r,a]=e.anchor,s=t[1]-r,c=Math.max(Math.abs(t[0]-i),Math.abs(t[2]-a),s>=0?s:-s*2);return{anchor:e.anchor,limit:Math.max(e.limit,c+o)}}function Xm(e,t,n,o,i,r,a,s){let c=Math.sin(n),m=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],l=[e[0]+o*m[0],e[1]+o*m[1],e[2]+o*m[2]],u=[-m[0],-m[1],-m[2]],h=[-u[2],0,u[0]],f=Math.hypot(h[0],h[2])||1;h=[h[0]/f,0,h[2]/f];let d=[h[1]*u[2]-h[2]*u[1],h[2]*u[0]-h[0]*u[2],h[0]*u[1]-h[1]*u[0]],p=Math.tan(i*Te/2),b=p*(r>0?r:1),g=[0,1,2].map(I=>u[I]+a*b*h[I]+s*p*d[I]);if(g[1]>=-1e-6)return null;let x=(e[1]-l[1])/g[1],S=Math.hypot(g[0],g[1],g[2]);return!(x>0)||x*S>o*Ym?null:[l[0]+g[0]*x,e[1],l[2]+g[2]*x]}var pa=3,Ym=4,ba=.72,Km=.6;function $m(e,t,n){return e!=="auto"?e:n!==null&&t<n*Km?"pan":"orbit"}function ya(e,t){let n=Math.sin(t),o=-n*Math.sin(e),i=-Math.cos(t),r=-n*Math.cos(e);if(Math.abs(i)>.999)return null;let a=-r,s=o,c=Math.hypot(a,s);return a/=c,s/=c,{fx:o,fy:i,fz:r,rx:a,rz:s,ux:-s*i,uy:s*o-a*r,uz:a*i}}var qm=.4;function Zm(e,t,n,o,i,r){let a=[e.center[0],e.center[1],e.center[2]],s=r(a),c=e.fitPoints,m=ya(o,i);if(!c||c.length<9||!m)return{center:a,distance:s};let{fx:l,fy:u,fz:h,rx:f,rz:d,ux:p,uy:b,uz:g}=m,x=Math.hypot(l,h),S=l/x,I=h/x,M=S*p+I*g,y=qm*Math.max(1,e.radius);for(let P=0;P<3;P++){let v=1/0,w=-1/0,R=1/0,C=-1/0;for(let V=0;V+2<c.length;V+=3){let F=c[V]-a[0],G=c[V+1]-a[1],j=c[V+2]-a[2],N=s+F*l+G*u+j*h;if(!(N>.001))continue;let k=(F*f+j*d)/(N*t),B=(F*p+G*b+j*g)/(N*n);k<v&&(v=k),k>w&&(w=k),B<R&&(R=B),B>C&&(C=B)}if(!Number.isFinite(v))break;let O=(v+w)/2*s*t,E=Math.abs(M)>.1?(R+C)/2*s*n/M:0,A=O*f+E*S,T=O*d+E*I;if(Math.hypot(a[0]+A-e.center[0],a[2]+T-e.center[2])>y){let V=a[0]-e.center[0],F=a[2]-e.center[2],G=V+A,j=F+T,N=y/Math.hypot(G,j);A=G*N-V,T=j*N-F}a=[a[0]+A,a[1],a[2]+T],s=r(a)}return{center:a,distance:s}}var eo=class{constructor(t,n,o,i){this.fovY=fa;this.target=new Ut.Vec3;this.azimuth=-30*Te;this.polar=55*Te;this.distance=10;this.azT=-30*Te;this.polT=55*Te;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;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 Ut.Vec3;this.panAnchor=new Ut.Vec3;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.camera=new Ut.Camera(t,{fov:fa,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=i,this.onPointerDown=r=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(r.pointerId)}catch{}if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size===1){let a=this.dragAction(),s=a==="orbit"?"pan":"orbit",c=r.button===2||r.button===1||r.shiftKey?s:a;this.panning=c==="pan",this.dragging=!this.panning,this.lastX=r.clientX,this.lastY=r.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance(),this.pinchAngle=this.currentPinchAngle();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=r=>{if(!this.interactionEnabled||!this.activePointers.has(r.pointerId))return;if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size>=2){let m=this.currentPinchDistance(),l=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-m)*.005),l.x,l.y),this.fireGesture()),this.pinchDist=m;let u=this.currentPinchAngle(),h=u-this.pinchAngle;h>Math.PI&&(h-=2*Math.PI),h<-Math.PI&&(h+=2*Math.PI),this.pinchAngle=u,Math.abs(h)>1e-4&&Math.abs(h)<.5&&(this.azT+=h,this.fireGesture()),this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=r.clientX-this.lastX,s=r.clientY-this.lastY;if(this.panning){this.lastX=r.clientX,this.lastY=r.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=r.clientX,this.lastY=r.clientY,(a!==0||s!==0)&&this.fireGesture();let c=Um(a,s);this.azT+=c.azimuth,this.polT=Math.max(hr,Math.min(pr,this.polT+c.polar)),this.requestRender()},this.onPointerUp=r=>{this.activePointers.delete(r.pointerId);try{this.canvas.releasePointerCapture?.(r.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=r=>{r.preventDefault()},this.onWheel=r=>{if(r.preventDefault(),!this.interactionEnabled)return;let a=r.deltaMode===1?16:r.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,r.deltaY*a/100));this.dollyAt(Math.exp(s*.22),r.clientX,r.clientY),this.fireGesture()},this.onKeyDown=r=>{if(!this.interactionEnabled)return;let a=7*Te;if(r.shiftKey&&(r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="ArrowUp"||r.key==="ArrowDown"))this.panBy(r.key==="ArrowLeft"?-32:r.key==="ArrowRight"?32:0,r.key==="ArrowUp"?-32:r.key==="ArrowDown"?32:0);else if(r.key==="ArrowLeft"||r.key==="ArrowRight")this.azT+=r.key==="ArrowLeft"?a:-a;else if(r.key==="ArrowUp"||r.key==="ArrowDown")this.polT=Math.max(hr,Math.min(pr,this.polT+(r.key==="ArrowUp"?-a:a)));else if(r.key==="+"||r.key==="=")this.dollyBy(jt);else if(r.key==="-"||r.key==="_")this.dollyBy(Sn);else return;r.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,o=0;for(let i of t)n+=i.x,o+=i.y;return{x:n/t.length,y:o/t.length}}panBy(t,n){let o=this.canvas.clientHeight||1,i=2*this.distance*Math.tan(this.fovY*Te/2)/o,r=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-r,m=Math.cos(this.polar),l=Math.sin(this.polar),u=-r*m,h=-a*m;this.targetT.x+=(-t*s+n*u)*i,this.targetT.z+=(-t*c+n*h)*i,this.targetT.y+=n*l*i,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=Wm(this.panBox,t.center,t.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,i=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(i-t,Math.min(i+t,this.targetT.z)),this.targetT.y=Math.max(o-t*.5,Math.min(o+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchAngle(){let[t,n]=[...this.activePointers.values()];return t&&n?Math.atan2(n.y-t.y,n.x-t.x):0}dragAction(){return $m(this.primaryDragMode,this.distT,this.overviewDist)}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()}dollyAt(t,n,o){let i=this.distT,r=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max(pa,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(pa,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/i);return}let s=r&&r.width>0&&r.height>0?Xm([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||r.width/r.height,(n-r.left)/r.width*2-1,1-(o-r.top)/r.height*2):null;this.dollyBy(t),s&&this.scaleTargetAbout(s,this.distT/i)}scaleTargetAbout(t,n){!Number.isFinite(n)||n===1||(this.targetT.x=t[0]+(this.targetT.x-t[0])*n,this.targetT.y=t[1]+(this.targetT.y-t[1])*n,this.targetT.z=t[2]+(this.targetT.z-t[2])*n,this.clampPan())}setZoomPointResolver(t){this.zoomPointResolver=t}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}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,o,i=!1,r){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t);let a=Math.max(1,t.radius),s=this.fovY*Te/2,c=i?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,m=Math.atan(Math.tan(s)*c);this.azT=o??-30*Te,this.polT=Math.max(15,Math.min(80,r?.polarDeg??55))*Te;let l=this.framedOn(t,s,m),u=l.distance;this.target.set(l.center[0],l.center[1],l.center[2]),this.targetT.copy(this.target),this.distT=u*Math.max(1.05,Math.min(2,r?.margin??br)),this.envelope=ha(this.envelope,a,u),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.overviewDist===null&&(this.overviewDist=this.distT),n?(this.azimuth=this.azT,this.polar=12*Te,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){if(!(t>0)||!Number.isFinite(t))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(t,1);this.distance*=o,this.distT*=o,this.overviewDist!==null&&(this.overviewDist*=o),this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:t})}glideTo(t,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(t),this.targetT.set(t.center[0],t.center[1],t.center[2]);let o=this.fovY*Te/2,i=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*Te;let r=this.framedOn(t,o,i),a=r.distance;this.targetT.set(r.center[0],r.center[1],r.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??br)),this.envelope=ha(this.envelope,Math.max(1,t.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(t,n,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let r=this.fovY*Te/2,a=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(r)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*Te;let c=this.framedOn(t,r,s);this.targetT.set(c.center[0],c.center[1],c.center[2]),this.distT=c.distance*Math.max(1.05,Math.min(2,i?.margin??br))}framedOn(t,n,o){return Zm(t,Math.tan(o),Math.tan(n),this.azT,this.polT,i=>this.fitDistance({...t,center:i},n,o,this.azT,this.polT))}fitDistance(t,n,o,i,r){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),c=t.box;if(!c)return s;let m=ya(i,r);if(!m)return s;let{fx:l,fy:u,fz:h,rx:f,rz:d,ux:p,uy:b,uz:g}=m,x=Math.tan(o),S=Math.tan(n),I=1;for(let R=0;R<8;R++){let C=(R&1?c.max[0]:c.min[0])-t.center[0],O=(R&2?c.max[1]:c.min[1])-t.center[1],E=(R&4?c.max[2]:c.min[2])-t.center[2],A=C*l+O*u+E*h,T=Math.abs(C*f+E*d),L=Math.abs(C*p+O*b+E*g);I=Math.max(I,T/x-A,L/S-A)}let M=Math.min(s,Math.max(I,a*.35)),y=t.fitPoints;if(!y||y.length<9)return M;let P=0,v=1/(x*ba),w=1/(S*ba);for(let R=0;R+2<y.length;R+=3){let C=y[R]-t.center[0],O=y[R+1]-t.center[1],E=y[R+2]-t.center[2],A=C*l+O*u+E*h,T=Math.abs(C*f+E*d),L=Math.abs(C*p+O*b+E*g);P=Math.max(P,T*v-A,L*w-A)}return Math.min(M*1.5,Math.max(M*.55,P))}updateClipping(t){let n=this.camera.position.x-t.center[0],o=this.camera.position.y-t.center[1],i=this.camera.position.z-t.center[2],r=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(r-this.distance)<=this.distance*.01,{near:s,far:c}=ef(Math.hypot(n,o,i),t.radius,a?this.distance:null);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,i=this.targetT.x-this.target.x,r=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(o)>1e-4||Math.abs(i)>s||Math.abs(r)>s||Math.abs(a)>s;return this.azimuth+=t*zt,this.polar+=n*zt,this.distance+=o*zt,this.target.x+=i*zt,this.target.y+=r*zt,this.target.z+=a*zt,c&&this.applyPosition(),c}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,i=Math.hypot(t,n,o)||1,r=Math.max(hr,Math.min(pr,Math.acos(Math.max(-1,Math.min(1,n/i)))));this.distance=this.distT=i,this.polar=this.polT=r,this.azimuth=this.azT=Math.atan2(t,o)}snapshot(){let t=this.target.clone(),n=this.targetT.clone(),{azimuth:o,azT:i,polar:r,polT:a,distance:s,distT:c}=this,m=this.camera.position.clone(),l=[...this.camera.quaternion],u=this.camera.fov;return()=>{this.target.copy(t),this.targetT.copy(n),Object.assign(this,{azimuth:o,azT:i,polar:r,polT:a,distance:s,distT:c}),this.camera.position.copy(m),this.camera.quaternion.set(l[0],l[1],l[2],l[3]),this.camera.perspective({fov:u,aspect:this.camera.aspect}),this.camera.updateMatrixWorld()}}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),o=this.target.y+this.distance*Math.cos(this.polar),i=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,o,i),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()}},Qm=.1,Jm=.25;function ef(e,t,n){let o=Math.max(1,t)*1.18,i=n==null?Jm:Math.max(.05,n*Qm),r=Math.max(i,e-o),a=Math.max(r+10,e+o);return{near:r,far:a}}var to=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 i=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+i*.1:i}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}};function ga(e){let t=!1;return n=>{n!==t&&(t=n,n?e.dataset.slReady="1":delete e.dataset.slReady)}}function xa(e,t,n){return Math.max(t,Math.min(n,e))}var Wt=2.5,tf=1.15,wn=12,Xt=22,va=6,Ma=9.5,Sa=.9,wa=2.2,yr=30,gr=4,no=8192;var ix=Xt+gr;function Pa(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Wt};let i=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-i*.4,fade:i*.55,minPixels:Wt+i*(tf-Wt)}}function Ia(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var nf=12;function Aa(e,t,n,o,i){if(!(e>0)||!(t>0)||!(n>0)||!(o>0)||!(i>0))return!1;let r=Math.tan(o/2*Math.PI/180);if(!(r>0))return!1;let a=t/(n*r)*(i/2);return Math.PI*a*a/e>=nf}var xr=[{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"}],sx=new Map(xr.map(e=>[e.key,e]));var of={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 oo(e){let t=e?.[0];return t&&of[t]||"#3b82f6"}var rf=[{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"}],cx=new Map(rf.map(e=>[e.key,e]));var af=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],lx=new Set(af);var Ea=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21},mark:{x:12,y:10,radius:6}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22},mark:{x:12,y:10,radius:4.5}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5},mark:{x:12,y:7.5,radius:5.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5},mark:{x:12,y:8,radius:5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20},mark:{x:12,y:9.25,radius:6.5}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22},mark:{x:12,y:12.25,radius:4.75}}],Ca=Ea.map(e=>e.key),sf=new Map(Ea.map(e=>[e.key,e]));function Ra(e){return typeof e=="string"&&sf.has(e)}function _a(e,t){return Ra(e)?e:Ra(t?.seatGlyph)?t.seatGlyph:"circle"}var fe=.02291666666666667,je=1/fe,cf=58,lf=cf*fe;var uf=3,Ta=0,vr=120,mf=0,ff=45,df=7,ot=1.2;function Mr(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function hf(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=df?e:uf}function yt(e,t={}){let n=Mr(t.floorBaseHeightM,Ta,vr,0),o=Math.min(vr,n+hf(e.elevation)*lf),i=e.height===void 0?o:Mr(e.height,Ta,vr,o),r=Mr(e.rake,mf,ff,0);return{height:i,rake:r}}var La=nt(require("earcut"),1),wr=nt(require("polygon-clipping"),1);var px=Math.PI/180;function Sr(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;return{x:t/o,y:n/o}}function Pn(e){return e.length?Sr(e):null}function Ve(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let i=e[n],r=e[(n+1)%o];t+=i.x*r.y-r.x*i.y}return t/2}function He(e,t,n){let o=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){let a=e[i],s=e[r];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}var _=fe,pf=.002;function bf(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),r=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(o,i,r);if(a<1e-9)return!0;let s=(o+i+r)/2;return 2*Math.sqrt(Math.max(0,s*(s-o)*(s-i)*(s-r)))/a<pf}var Lt=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){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++]=o}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 o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},ao=class{constructor(){this.pos=new Lt;this.nor=new Lt;this.col=new Lt;this.flr=new Lt;this.mat=new Lt;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,i,r,a=r,s=r){bf(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(r[0],r[1],r[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,o,i,r,a,s,c=s,m=s){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(r[0],r[1],r[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(m[0],m[1],m[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 yf(e,t,n){let o=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],m=i*c-r*s,l=r*a-o*c,u=o*s-i*a,h=Math.hypot(m,l,u)||1;return m/=h,l/=h,u/=h,[m,l,u]}function gf(e,t){let n=[...e],o=[];for(let a of e)o.push(a.x,a.y);let i=[];if(t){for(let a of t)if(!(a.length<3)){i.push(n.length);for(let s of a)n.push(s),o.push(s.x,s.y)}}let r=(0,La.default)(o,i.length?i:void 0,2);return{pts:n,tris:r}}function rt(e){return Ve(e)<0?[...e].reverse():e}var xf=3;function vf(e,t,n,o){let i=o(e),r=o(t),a=o(n),s=(f,d,p,b)=>Math.abs(o({x:(f.x+d.x)/2,y:(f.y+d.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,m=(e.y+t.y+n.y)/3,l=(i+r+a)/3,u=Math.max(s(e,t,i,r),s(t,n,r,a),s(n,e,a,i),Math.abs(o({x:c,y:m})-l)),h=(f,d,p)=>{let b=Math.abs(o({x:(f+c)/2,y:(d+m)/2})-(p+l)/2);b>u&&(u=b)};return h((e.x+t.x)/2,(e.y+t.y)/2,(i+r)/2),h((t.x+n.x)/2,(t.y+n.y)/2,(r+a)/2),h((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),u}function In(e,t,n,o,i){if(i<=0)return vf(e,t,n,o);let r={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(In(e,r,s,o,i-1),In(r,t,a,o,i-1),In(s,a,n,o,i-1),In(r,a,s,o,i-1))}function An(e,t,n,o,i,r,a,s){if(a>0){let h={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};An(e,t,h,d,i,r,a-1,s),An(e,h,n,f,i,r,a-1,s),An(e,d,f,o,i,r,a-1,s),An(e,h,f,d,i,r,a-1,s);return}let c=[t.x*_,i(t),t.y*_],m=[n.x*_,i(n),n.y*_],l=[o.x*_,i(o),o.y*_];if(s){e.triN(c,m,l,s(t),s(n),s(o),r);return}let u=yf(c,m,l);u[1]<0&&(u=[-u[0],-u[1],-u[2]]),e.tri(c,m,l,u,r)}var Mf=8;function ka(e,t,n){if(!Number.isFinite(n))return e;let o=[],i=(r,a,s,c,m)=>{if(m>0){let l={x:(r.x+a.x)/2,y:(r.y+a.y)/2},u=t(l);if(Math.abs(u-(s+c)/2)>n){i(r,l,s,u,m-1),i(l,a,u,c,m-1);return}}o.push(r)};for(let r=0;r<e.length;r++){let a=e[r],s=e[(r+1)%e.length];i(a,s,t(a),t(s),Mf)}return o}function ro(e,t){if(e.length<3)return e;let n=[];for(let i of e){let r=n[n.length-1];r&&Math.hypot(i.x-r.x,i.y-r.y)<t||n.push(i)}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 o=[];for(let i=0;i<n.length;i++){let r=o.length?o[o.length-1]:n[(i-1+n.length)%n.length],a=n[i],s=n[(i+1)%n.length],c=s.x-r.x,m=s.y-r.y,l=Math.hypot(c,m);l>t&&Math.abs((a.x-r.x)*m-(a.y-r.y)*c)/l<t||o.push(a)}return o.length>=3?o:n}var io=.001*je*.1;function ue(e,t,n,o,i,r,a,s,c=1/0,m){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ve(t))<1e-4))return;let l=ro(ka(ro(rt(t),io),o,c),io),u=n?.map(y=>ro(ka(ro(rt(y),io),o,c),io)).filter(y=>y.length>=3&&Math.abs(Ve(y))>=1e-4),{pts:h,tris:f}=gf(l,u),d=[r[0]*s.top,r[1]*s.top,r[2]*s.top],p=[r[0]*s.bottomCap,r[1]*s.bottomCap,r[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],x=0;if(Number.isFinite(c))for(;x<xf;x++){let y=0;for(let P=0;P<f.length;P+=3){let v=In(h[f[P]],h[f[P+1]],h[f[P+2]],o,x);v>y&&(y=v)}if(y<=c)break}for(let y=0;y<f.length;y+=3){let P=h[f[y]],v=h[f[y+1]],w=h[f[y+2]];An(e,P,v,w,o,d,x,m);let R=[P.x*_,i,P.y*_],C=[v.x*_,i,v.y*_],O=[w.x*_,i,w.y*_];e.tri(R,O,C,[0,-1,0],p)}let S=y=>{if(x<=0)return y;let P=1<<x,v=[];for(let w=0;w<y.length;w++){let R=y[w],C=y[(w+1)%y.length];for(let O=0;O<P;O++){let E=O/P;v.push({x:R.x+(C.x-R.x)*E,y:R.y+(C.y-R.y)*E})}}return v},I=Sr(l),M=[{ring:S(l),flip:!1}];if(u)for(let y of u)y.length>=3&&M.push({ring:S(y),flip:!0});for(let{ring:y,flip:P}of M)for(let v=0;v<y.length;v++){let w=y[v],R=y[(v+1)%y.length],C=(R.x-w.x)*_,E=(R.y-w.y)*_,A=-C,T=Math.hypot(E,A)||1;E/=T,A/=T;let L=(w.x+R.x)/2-I.x,V=(w.y+R.y)/2-I.y,F=E*L+A*V;P&&(F=-F),F<0&&(E=-E,A=-A);let G=[E,0,A],j=[w.x*_,o(w),w.y*_],N=[R.x*_,o(R),R.y*_],k=[w.x*_,i,w.y*_],B=[R.x*_,i,R.y*_];e.tri(j,N,B,G,b,b,g),e.tri(j,B,k,G,b,g,g)}}function Fa(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t*3),r=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),o.set(c.normal,s*3),i.set(c.color,s*3),r.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:o,color:i,floor:r,material:a,count:t}}function Ze(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=rt(e),i=o.length,r=[];for(let s=0;s<i;s++){let c=o[s],m=o[(s+1)%i],l=m.x-c.x,u=m.y-c.y,h=Math.hypot(l,u)||1;r.push({x:u/h,y:-l/h})}let a=[];for(let s=0;s<i;s++){let c=o[s],m=r[(s-1+i)%i],l=r[s],u=m.x+l.x,h=m.y+l.y,f=Math.hypot(u,h),d=()=>{a.push([c.x+m.x*t,c.y+m.y*t]),a.push([c.x+l.x*t,c.y+l.y*t])};if(f<1e-9){d();continue}u/=f,h/=f;let p=u*m.x+h*m.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){d();continue}a.push([c.x+u*t*b,c.y+h*t*b])}if(a.length<3)return e;try{let s=wr.default.union([[...a,a[0]]]),c=null,m=-1/0;for(let u of s){let h=Math.abs(Ve(u[0].map(([f,d])=>({x:f,y:d}))));h>m&&(m=h,c=u[0])}if(!c)return e;let l=c.map(([u,h])=>({x:u,y:h}));if(l.length>1){let u=l[0],h=l[l.length-1];Math.abs(u.x-h.x)<1e-9&&Math.abs(u.y-h.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function gt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=rt(e),i=o.length,r=[];for(let c=0;c<i;c++){let m=o[c],l=o[(c+1)%i],u=Math.hypot(l.x-m.x,l.y-m.y)||1;r.push({x:-(l.y-m.y)/u,y:(l.x-m.x)/u})}let a=[],s=[];for(let c=0;c<i;c++){let m=o[c],l=r[(c-1+i)%i],u=r[c],h=l.x+u.x,f=l.y+u.y,d=Math.hypot(h,f),p=d<1e-9?1/0:1/Math.max(h/d*l.x+f/d*l.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:m.x+l.x*t,y:m.y+l.y*t},{x:m.x+u.x*t,y:m.y+u.y*t}),s.push(c,c);continue}h/=d,f/=d,a.push({x:m.x+h*t*p,y:m.y+f*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let m=(c+1)%a.length,l=s[c],u=s[m];if(u!==(l+1)%i)continue;let h=o[l],f=o[u];if((a[m].x-a[c].x)*(f.x-h.x)+(a[m].y-a[c].y)*(f.y-h.y)<=0)return[]}try{let c=wr.default.intersection([[...a.map(d=>[d.x,d.y]),[a[0].x,a[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),m=null,l=0;for(let d of c){let p=Math.abs(Ve(d[0].map(([b,g])=>({x:b,y:g}))));p>l&&(l=p,m=d[0])}if(!m)return[];let u=m.map(([d,p])=>({x:d,y:p})),h=u[0],f=u[u.length-1];return u.length>1&&Math.abs(h.x-f.x)<1e-9&&Math.abs(h.y-f.y)<1e-9&&u.pop(),u.length>=3?rt(u):[]}catch{return[]}}function so(e,t,n,o,i=28){let r=[];for(let a=0;a<i;a++){let s=a/i*Math.PI*2;r.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return r}function Rn(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var ut=.22;function Oa(e,t){let n=_e[e];if(n!=="sold"&&n!=="held")return-1;let o=(t+1)*2654435761;return o^=o>>>15,o=Math.imul(o,2246822519),o^=o>>>13,(o>>>0)%1e5/1e5}var Sf=.42;function wf(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,i=1/0,r=-1/0,a=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<i&&(i=d.y),d.x>r&&(r=d.x),d.y>a&&(a=d.y);let s=Math.max(r-o,1e-6),c=Math.max(a-i,1e-6),m=Math.max(Math.sqrt(s*c/t),1e-6),l=Math.max(1,Math.ceil(s/m)+1),u=Math.max(1,Math.ceil(c/m)+1),h=new Map,f=(d,p)=>{let b=Math.min(l-1,Math.max(0,Math.floor((d-o)/m)));return Math.min(u-1,Math.max(0,Math.floor((p-i)/m)))*l+b};for(let d=0;d<t;d++){let p=f(e[d].x,e[d].y),b=h.get(p);b?b.push(d):h.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],b=Math.min(l-1,Math.max(0,Math.floor((p.x-o)/m))),g=Math.min(u-1,Math.max(0,Math.floor((p.y-i)/m))),x=1/0;for(let S=1;S<=4;S++){for(let I=g-S;I<=g+S;I++)if(!(I<0||I>=u))for(let M=b-S;M<=b+S;M++){if(M<0||M>=l||S>1&&Math.abs(I-g)<S&&Math.abs(M-b)<S)continue;let y=h.get(I*l+M);if(y)for(let P of y){if(P===d)continue;let v=Math.hypot(e[P].x-p.x,e[P].y-p.y);v<x&&(x=v)}}if(Number.isFinite(x)&&x<=S*m)break}n[d]=x}return n}function Pf(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ot):0}function Da(e,t,n,o,i,r){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),m=new Float32Array(a*3),l=new Float32Array(a),u=new Float32Array(a),h=new Float32Array(a),f=new Float32Array(a),d=new Float32Array(a*3),p=new Map,b=wf(e);for(let g=0;g<a;g++){let x=e[g],I=(n?.seatPitchU(g)??b[g])*_;l[g]=Number.isFinite(I)?Math.max(.06,Math.min(ut,I*Sf)):ut,u[g]=Ji(Number.isFinite(I)?I:void 0);let M=_a(x.glyph,{seatGlyph:r?.get(x.categoryKey)});h[g]=Ca.indexOf(M),f[g]=x.wheelchairSpaceType==="no-seat"?0:1,s[g*3]=x.x*_,s[g*3+1]=n?n.seatDeckY(g):Pf(x),s[g*3+2]=x.y*_,c[g]=Mn(t?t(x):"available");let y=pe(i?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(m[g*3]=y[0],m[g*3+1]=y[1],m[g*3+2]=y[2],x.accessibility?.length){let P=pe(oo(x.accessibility));P&&(d[g*3]=P[0],d[g*3+1]=P[1],d[g*3+2]=P[2])}p.set(x.id,g)}return{count:a,iPosition:s,iState:c,iCategory:m,iMaxRadius:l,iRing:d,idToIndex:p,iChairWidth:u,iGlyph:h,iPhysicalSeat:f,iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var If=64;function Pr(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Mn(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let o=[],i=n[0],r=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==r){if(s<=r+If){r=s;continue}o.push({start:i,length:r-i+1}),i=s,r=s}}return o.push({start:i,length:r-i+1}),o}var En=3,Ft=.38,Cn=.24;function Af(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],i=(n.x-t.x)*_,r=(n.y-t.y)*_,a=(o.x-t.x)*_,s=(o.y-t.y)*_,c=2*(i*s-r*a);if(Math.abs(c)<1e-7)return null;let m=i*i+r*r,l=a*a+s*s,u=(m*s-l*r)/c+t.x*_,h=(i*l-a*m)/c+t.y*_,f=Math.hypot(t.x*_-u,t.y*_-h);return f<1||f>200||!Number.isFinite(f)||e.some(d=>Math.abs(Math.hypot(d.x*_-u,d.y*_-h)-f)>.03)?null:{x:u,z:h,radius:f}}function Na(e){let t=[],n=new Map,o=(c,m)=>`${Math.floor(c/En)},${Math.floor(m/En)}`;for(let c of e)for(let m of c.rows){for(let u of m.pts){let h=u.x*_,f=u.y*_,d=o(h,f),p=n.get(d)??[];p.push({x:h,z:f,y:m.y,floor:c.floorIndex}),n.set(d,p)}if(m.patch||m.pts.length<2)continue;let l=Af(m.pts);for(let u of[0,m.pts.length-1]){let h=m.pts[u],f=m.pts[u===0?1:u-1],d=h.x-f.x,p=h.y-f.y,b=Math.hypot(d,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:m,point:h,x:h.x*_,z:h.y*_,dx:d/b,dz:p/b})}}let i=new Map;t.forEach((c,m)=>{let l=o(c.x,c.z),u=i.get(l)??[];u.push(m),i.set(l,u)});let r=(c,m)=>{let l=Math.floor(c/En),u=Math.floor(m/En);return[-1,0,1].flatMap(h=>[-1,0,1].map(f=>`${l+h},${u+f}`))},a=new Map;t.forEach((c,m)=>{let l=-1,u=1/0,h=!1;for(let f of r(c.x,c.z))for(let d of i.get(f)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let b=p.x-c.x,g=p.z-c.z,x=Math.hypot(b,g);if(x<Ft*2+.45||x>En)continue;let S=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,I=Math.min((b*c.dx+g*c.dz)/x,(-b*p.dx-g*p.dz)/x);(S?I<.8:I<.98)||!S&&(Math.abs(b*c.dz-g*c.dx)>.15||Math.abs(b*p.dz-g*p.dx)>.15)||(x<u-.02?(l=d,u=x,h=!1):Math.abs(x-u)<=.02&&(h=!0))}l>=0&&!h&&a.set(m,l)});let s=[];for(let[c,m]of a){if(c>=m||a.get(m)!==c)continue;let l=t[c],u=t[m],h=Math.hypot(u.x-l.x,u.z-l.z),f=(u.x-l.x)/h,d=(u.z-l.z)/h,p=!1;for(let g of r((l.x+u.x)/2,(l.z+u.z)/2))for(let x of n.get(g)??[]){if(x.floor!==l.floorIndex||Math.abs(x.y-l.row.y)>.75)continue;let S=(x.x-l.x)*f+(x.z-l.z)*d,I=Math.abs((x.x-l.x)*d-(x.z-l.z)*f);S>.01&&S<h-.01&&I<Cn+Ft&&(p=!0)}if(p)continue;let b=(g,x)=>({x:(l.x+f*g-d*x)/_,y:(l.z+d*g+f*x)/_});s.push({sections:[l.sectionId,u.sectionId],blocks:[l.row.blockId,u.row.blockId],floorIndex:l.floorIndex,ends:[l.point,u.point],clearWidthM:h-2*Ft,heightM:(l.row.y+u.row.y)/2,outline:[b(Ft,-Cn),b(h-Ft,-Cn),b(h-Ft,Cn),b(Ft,Cn)]})}return s}var Rf=.15,Ef=1.6;function Ba(e){return xa(e??1,Rf,Ef)}var Cf=.15,_f=.9,Tf=1.76;function Va(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function kf(){return{background:{top:[...kt.top],bottom:[...kt.bottom]},sky:Va(null),structure:dr,seatStates:{...la},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Lf(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Ha(e){let t=kf();e??={};let n=pe(e.background);if(n){t.background={top:le(n,_f),bottom:le(n,Tf)},t.sky=Va(n);let s={};for(let[m,l]of Object.entries(dr))s[m]=be(l,n,Cf);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(s.ground=le(n,.86)),t.structure=s}let o=pe(e.selectionColor)??pe(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let i=e.seatScale;typeof i=="number"&&Number.isFinite(i)&&(t.seatScale=Ba(i));let r=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,s])=>s!=null)),a={...Lf(n),...r};if(a){let s=pe(a.deck),c=pe(a.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=pe(a.seat),t.materials.shell=pe(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return t}function Ga(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var Ff=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Of=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Ot(e){return!!e&&Ff.has(e)}function co(e){return!!e&&Of.has(e)}var lo=1.1,Df={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},Nf={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var Bf=Math.PI*2;function Vf(e,t,n,o,i,r){return{x:i+e*n-t*o,y:r+e*o+t*n}}function za(e,t){let n=Math.max(0,e-t),o=[],i=20;for(let r=0;r<=i;r++){let a=-Math.PI/2+r/i*Math.PI;o.push({x:n+t*Math.cos(a),y:t*Math.sin(a)})}for(let r=0;r<=i;r++){let a=Math.PI/2+r/i*Math.PI;o.push({x:-n+t*Math.cos(a),y:t*Math.sin(a)})}return o}var Ua=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},i=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),r=i+70,a=[],s=Math.atan2(o.y-i,o.x),c=Math.atan2(o.y-i,-o.x);for(let m=0;m<=24;m++){let l=s+(c-s)*m/24;a.push({x:r*Math.cos(l),y:i+r*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:a}})();var uo="#f1f5f9";function _n(e){return Ot(e)}function xt(e,t,n,o,i=32){let r=[];for(let a=0;a<i;a++){let s=a/i*Bf;r.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return r}function mt(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function Hf(e){let{kind:t,cx:n,cy:o,width:i,height:r}=e,a=(e.rotation??0)*Math.PI/180,s=Math.cos(a),c=Math.sin(a),m=i/2,l=r/2,u=[],h=Df[t],f=p=>h?p/h.width*i:0,d=p=>h?p/h.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),u.push({points:xt(0,0,f(9.15),d(9.15)),closed:!0});for(let p of[-1,1])u.push({points:mt(p*(m-f(16.5)/2),0,f(16.5)/2,d(40.32)/2),closed:!0}),u.push({points:mt(p*(m-f(5.5)/2),0,f(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){u.push({points:[{x:p*f(7.5),y:-l},{x:p*f(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:p*(m-f(4)),y:-d(11)},{x:p*(m-f(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])u.push({points:xt(p*f(20.5),b*d(7),f(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:xt(0,0,f(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=l-d(1.22)*8;b>0&&u.push({points:za(m-f(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let x=d(1.22)*g,S=l-x;if(S<=0)break;u.push({points:za(m-f(1.22)*g,S),closed:!0})}break}case"oval-cricket":{u.push({points:xt(0,0,f(27.4),d(27.4+20.12/2),40),closed:!0}),u.push({points:mt(0,0,f(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:f(b),y:-l},{x:f(b),y:l}],closed:!1});u.push(p(0));for(let b of[-1,1]){u.push(p(b*50),p(b*28));for(let g=-35;g<35;g+=4)u.push({points:[{x:f(b*10),y:d(g)},{x:f(b*10),y:d(Math.min(35,g+2))}],closed:!1})}break}case"diamond-baseball":{let p=(L,V)=>({x:f(L),y:d(V)}),{home:b}=Ua,g=27.43,x=g/Math.SQRT2,S={x:b.x+x,y:b.y-x},I={x:b.x,y:b.y-2*x},M={x:b.x-x,y:b.y-x},y={x:b.x,y:b.y-18.44},P="#b98a59",v=Nf["diamond-baseball"],w=38.94,R=[p(b.x,b.y)],C=Math.atan2(b.y-w/Math.SQRT2-y.y,w/Math.SQRT2),O=Math.PI-C;for(let L=0;L<=16;L++){let V=C-(C+Math.PI*2-O)%(Math.PI*2)*(L/16);R.push(p(y.x+29*Math.cos(V),y.y+29*Math.sin(V)))}u.push({points:R,closed:!0,fill:P,ink:P});let E={x:b.x,y:b.y-x},A=[{x:b.x,y:b.y},S,I,M].map(L=>p(E.x+(L.x-E.x)*.84,E.y+(L.y-E.y)*.84));u.push({points:A,closed:!0,fill:v,ink:v}),u.push({points:xt(f(y.x),d(y.y),f(2.74),d(2.74),20),closed:!0,fill:P,ink:P}),u.push({points:xt(f(b.x),d(b.y),f(3.96),d(3.96),20),closed:!0,fill:P,ink:P});let T=Ua.fence;u.push({points:[p(b.x,b.y),p(T[0].x,T[0].y)],closed:!1}),u.push({points:[p(b.x,b.y),p(T[T.length-1].x,T[T.length-1].y)],closed:!1});for(let L of[S,I,M])u.push({points:mt(f(L.x),d(L.y),f(.3),d(.3)),closed:!0,fill:uo});break}case"court-basketball":{u.push({points:mt(0,0,f(14),d(7.5)),closed:!0}),u.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),u.push({points:xt(0,0,f(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,g=p*(14-5.8),x=p*(14-1.575);u.push({points:mt(f((b+g)/2),0,f(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:xt(f(g),0,f(1.8),d(1.8),24),closed:!0});let S=Math.sqrt(6.75*6.75-6.6*6.6),I=[{x:f(b),y:-d(6.6)}],M=Math.atan2(-6.6,-p*S),y=2*Math.atan2(6.6,S);for(let P=0;P<=16;P++){let v=M-p*y*(P/16);I.push({x:f(x+6.75*Math.cos(v)),y:d(6.75*Math.sin(v))})}I.push({x:f(b),y:d(6.6)}),u.push({points:I,closed:!1})}break}case"court-tennis":{u.push({points:mt(0,0,f(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])u.push({points:[{x:-f(11.885),y:p*d(4.115)},{x:f(11.885),y:p*d(4.115)}],closed:!1}),u.push({points:[{x:p*f(6.4),y:-d(4.115)},{x:p*f(6.4),y:d(4.115)}],closed:!1});u.push({points:[{x:-f(6.4),y:0},{x:f(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:mt(0,0,f(3.05),d(3.05)),closed:!0});let g=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[x,S,I]of g)u.push({points:mt(x*f(3.05),S*d(3.05),f(.3),d(.3)),closed:!0,fill:I,ink:I});break}default:return[]}return u.map(p=>({...p,points:p.points.map(b=>Vf(b.x,b.y,s,c,n,o))}))}function ja(e){if(e.role!=="stage"||!_n(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(l=>l.x),o=e.points.map(l=>l.y),i=Math.min(...n),r=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,r-i),m=Math.max(1,s-a);t={cx:i+c/2,cy:a+m/2,width:c,height:m}}return t?Hf({kind:e.stageKind,...t}):[]}function Wa(e,t){let n=1-t,o=n*n*n,i=3*n*n*t,r=3*n*t*t,a=t*t*t;return{x:o*e.start.x+i*e.control1.x+r*e.control2.x+a*e.end.x,y:o*e.start.y+i*e.control1.y+r*e.control2.y+a*e.end.y}}function Xa(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Wa(e,.5)];let o=Array.from({length:n+1},(c,m)=>Wa(e,m/n)),i=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let m=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;i[c]=i[c-1]+Math.hypot(m,l)}let r=i[i.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let m=r*c/(t-1);for(;s<i.length-1&&i[s]<m;)s+=1;let l=i[s-1],u=i[s],h=u===l?0:(m-l)/(u-l);a.push({x:o[s-1].x+(o[s].x-o[s-1].x)*h,y:o[s-1].y+(o[s].y-o[s-1].y)*h})}return a}function Ya(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let i=n.get(o.segmentedRow.groupId)??[];i.push(o),n.set(o.segmentedRow.groupId,i)}for(let[o,i]of n){let r=i.slice().sort((h,f)=>h.segmentedRow.componentIndex-f.segmentedRow.componentIndex),a=r[0]?.segmentedRow?.componentCount??0,s=r[0]?.segmentedRow;if(!s||!(a>=2&&r.length===a&&s?.boundaryBefore==="start"&&r.every((h,f)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===o&&h.segmentedRow.componentCount===a&&h.segmentedRow.componentIndex===f&&h.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(f===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===s.displayLabel)))continue;let m=r.reduce((h,f)=>h+f.seatCount,0),l=0,u=0;for(let h of r)h.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(h.id,{groupId:o,adjacencyOffset:l,displayOffset:u,displayLabel:s.displayLabel,totalSeats:m,canonical:r[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),l+=h.seatCount,u+=h.seatCount}return t}var Gf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var zf="abcdefghijklmnopqrstuvwxyz";function Uf(e,t){let n=t.length,o=e+1,i="";for(;o>0;){o-=1;let r=o%n;i=t[r]+i,o=Math.floor(o/n)}return i}function Ir(e,t=!1){let n=t?zf:Gf;return Uf(Math.max(0,Math.floor(e)-1),n)}var jf=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ka(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,i]of jf)for(;t>=o;)n+=i,t-=o;return n}function Wf(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function mo(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",i=e.seatNumbering?.step??1,r=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(r==="updown"||r==="updown-descending"){let f=Math.ceil(c/2),d=r==="updown"?t<f?n+2*t:n-1+2*(c-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${a}${d}`}let m=r==="odd"||r==="even"?2:i,l=s!=null&&Number.isFinite(s)?s-(c-1)*m:n,u=o==="center"?Wf(c)[t]:o==="rtl"?c-1-t:t,h;switch(r){case"odd":{let f=l%2===1?l:l+1;h=String(f+u*2);break}case"even":{let f=l%2===0?l:l+1;h=String(f+u*2);break}case"roman":h=Ka(l+u*i);break;case"letters-upper":h=Ir(l+u*i,!1);break;case"letters-lower":h=Ir(l+u*i,!0);break;default:h=String(l+u*i);break}return`${a}${h}`}function Xf(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function $a(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${mo(e,t)}`}function Ar(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(e.seatDisplayLabelMode==="number")return mo(e,t);if(!n)return`${e.displayLabel||e.label}-${mo(e,t)}`;let i=Xf(n),r=n.displayOffset+t;return`${n.displayLabel}-${mo(i,r)}`}function qa(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 Yt(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 o=1/0;for(let i=0;i+1<e.length;i++){let r=e[i],a=e[i+1],s=a.x-r.x,c=a.y-r.y,m=s*s+c*c,l=m>1e-12?((t-r.x)*s+(n-r.y)*c)/m:0;l<0?l=0:l>1&&(l=1);let u=t-(r.x+l*s),h=n-(r.y+l*c);if(Math.abs(u)>=o||Math.abs(h)>=o)continue;let f=Math.hypot(u,h);f<o&&(o=f)}return o}function Yf(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;t/=o,n/=o;let i=0;for(let r of e){let a=Math.hypot(r.x-t,r.y-n);a>i&&(i=a)}return{cx:t,cy:n,r:i}}function Za(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Rr(e,t){let n=1/0;for(let o of qa(e)){let i=Yt(t,o.x,o.y);i<n&&(n=i)}for(let o of qa(t)){let i=Yt(e,o.x,o.y);i<n&&(n=i)}return n}function Kf(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let l of e)n+=l.x,o+=l.y;n/=e.length,o/=e.length;let i=-1,r=e[0];for(let l of e){let u=Math.hypot(l.x-n,l.y-o);u>i&&(i=u,r=l)}let a=r.x-n,s=r.y-o,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let m=e.map((l,u)=>({p:l,i:u,t:(l.x-n)*a+(l.y-o)*s})).sort((l,u)=>l.t-u.t);return{pts:m.map(l=>l.p),seatIndices:m.map(l=>t[l.i])}}function Er(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let x of e)n+=x.x,o+=x.y;n/=t,o/=t;let i=0,r=0,a=0,s=0,c=0,m=0,l=0;for(let x of e){let S=x.x-n,I=x.y-o;i+=S*S,a+=I*I,r+=S*I,s+=S*S*S,c+=I*I*I,m+=S*I*I,l+=I*S*S}let u=i*a-r*r;if(Math.abs(u)<1e-9)return null;let h=(s+m)/2,f=(c+l)/2,d=(h*a-f*r)/u,p=(f*i-h*r)/u,b=d+n,g=p+o;return!Number.isFinite(b)||!Number.isFinite(g)?null:{cx:b,cy:g}}var $f=.15;function qf(e){if(e.length<2)return null;let t=e.map(M=>{let y=0,P=0;for(let v of M.pts)y+=v.x,P+=v.y;return{x:y/M.pts.length,y:P/M.pts.length}}),n=0,o=0;for(let M of t)n+=M.x,o+=M.y;n/=t.length,o/=t.length;let i=0,r=0,a=0;for(let M of t){let y=M.x-n,P=M.y-o;i+=y*y,r+=y*P,a+=P*P}let s=i+a,c=i*a-r*r,m=s/2+Math.sqrt(Math.max(0,s*s/4-c)),l,u;Math.abs(r)>1e-12?(l=m-a,u=r):i>=a?(l=1,u=0):(l=0,u=1);let h=Math.hypot(l,u);if(!(h>1e-12))return null;l/=h,u/=h;let f=0,d=0,p=0;for(let M of e){if(M.pts.length<2)continue;let y=M.pts[0],P=M.pts[M.pts.length-1],v=P.x-y.x,w=P.y-y.y,R=Math.hypot(v,w);if(!(R>1e-9))continue;let C=v/R,O=w/R;f+=(C*C-O*O)*R,d+=2*C*O*R,p+=R}if(p>0&&Math.hypot(f,d)>=Qf*p){let M=Math.atan2(d,f)/2,y=Math.cos(M),P=Math.sin(M);Math.abs(l*y+u*P)>Jf&&(l=-P,u=y)}let b=1/0,g=-1/0,x=[];for(let M of e){let y=1/0,P=-1/0;for(let v of M.pts){let w=v.x*l+v.y*u;w<y&&(y=w),w>P&&(P=w),w<b&&(b=w),w>g&&(g=w)}x.push(P-y)}let S=g-b;return S>1e-9?(x.sort((M,y)=>M-y),x[Math.min(x.length-1,Math.floor(x.length*.9))]/S<=Zf?{x:l,y:u}:null):null}var Zf=.35,Qf=.8,Jf=.7;function fo(e,t,n,o){let i=new Map;for(let y of n){let P=t[y],v=P.rowId||`__seat-${y}`,w=i.get(v);w||(w={pts:[],idx:[]},i.set(v,w)),w.pts.push({x:P.x,y:P.y}),w.idx.push(y)}if(!i.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[y,P]of i){let v=Kf(P.pts,P.idx),w=0;for(let R of v.pts)w+=Math.hypot(R.x-o.x,R.y-o.y);r.push({id:y,pts:v.pts,seatIndices:v.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:w/v.pts.length})}let a=r.map(y=>Yf(y.pts)),s=r.length<=256?r.length*(r.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let m=c?new Map(r.map((y,P)=>[y,P])):null,l=(y,P)=>(y>P&&([y,P]=[P,y]),y*(2*r.length-y-1)/2+(P-y-1)),u=(y,P)=>{if(!c)return Rr(r[y].pts,r[P].pts);let v=l(y,P),w=c[v];if(!Number.isNaN(w))return w;let R=Rr(r[y].pts,r[P].pts);return c[v]=R,R},h=(y,P)=>m?u(m.get(y),m.get(P)):Rr(y.pts,P.pts),f=[];for(let y=0;y<r.length;y++){let P=1/0;for(let v=0;v<r.length;v++){if(y===v||Za(a[y],a[v])>=P)continue;let w=u(y,v);w<P&&(P=w)}Number.isFinite(P)&&f.push(P)}f.sort((y,P)=>y-P);let d=f.length?f[Math.floor(f.length/2)]:1,p=Math.max(d*1.8,1e-6),b=r.map(()=>[]);for(let y=0;y<r.length;y++)for(let P=y+1;P<r.length;P++)Za(a[y],a[P])>p||u(y,P)<=p&&(b[y].push(P),b[P].push(y));let g=0;for(let y=0;y<r.length;y++){if(r[y].blockId!==-1)continue;let P=g++,v=[y];for(r[y].blockId=P;v.length;){let w=v.pop();for(let R of b[w])r[R].blockId===-1&&(r[R].blockId=P,v.push(R))}}let x=new Map;for(let y of r){let P=x.get(y.blockId)??[];P.push(y),x.set(y.blockId,P)}let S=[];for(let y of r){if(y.pts.length<4)continue;let P=Er(y.pts);P&&(!Number.isFinite(P.cx)||!Number.isFinite(P.cy)||S.push({x:P.cx,y:P.cy}))}let I=S.length>=2?(()=>{let y=S.map(w=>w.x).sort((w,R)=>w-R),P=S.map(w=>w.y).sort((w,R)=>w-R),v=Math.floor(S.length/2);return{cx:y[v],cy:P[v]}})():null;if(I){let y=O=>Math.hypot(O.x-I.cx,O.y-I.cy),P=1/0,v=-1/0,w=[];for(let O of r){let E=1/0,A=-1/0;for(let T of O.pts){let L=y(T);L<E&&(E=L),L>A&&(A=L)}w.push(A-E),E<P&&(P=E),A>v&&(v=A)}let R=v-P;w.sort((O,E)=>O-E);let C=w[Math.min(w.length-1,Math.floor(w.length*.9))];if(R>1e-9&&C/R<=$f){let O=r.map(k=>{let B=0;for(let D of k.pts)B+=y(D);return{row:k,radius:B/k.pts.length}}),E=0,A=0;for(let k of O)E+=k.radius,A+=k.row.focalDistance;E/=O.length,A/=O.length;let T=0;for(let k of O)T+=(k.radius-E)*(k.row.focalDistance-A);if(T<0)for(let k of O)k.radius=-k.radius;let V=1/0;for(let k of O)k.radius<V&&(V=k.radius);O.sort((k,B)=>k.radius-B.radius);let F=-1,G=-1/0,j=R/Math.max(1,O.length)*.5,N=[];for(let k of O)k.radius-G>j&&(F++,G=k.radius),k.row.ordinal=F,k.row.blockDepth=k.radius-V,N.push(k.row);return{sectionId:e,rows:N,blockCount:g}}}let M=[];for(let[,y]of x){let P=qf(y);if(P){let v=O=>{let E=0;for(let A of O.pts)E+=A.x*P.x+A.y*P.y;return E/O.pts.length};y.sort((O,E)=>v(O)-v(E)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let w=[],R=d*.5;for(let O of y){let E=w[w.length-1];E&&Math.abs(v(O)-v(E[0]))<R?E.push(O):w.push([O])}let C=0;for(let O=0;O<w.length;O++){if(O>0){let E=1/0;for(let A of w[O-1])for(let T of w[O])E=Math.min(E,h(A,T));C+=E}for(let E of w[O])E.ordinal=O,E.blockDepth=C,M.push(E)}}else{let v=1/0;for(let w of y)w.focalDistance<v&&(v=w.focalDistance);y.sort((w,R)=>w.focalDistance-R.focalDistance);for(let w=0;w<y.length;w++)y[w].ordinal=w,y[w].blockDepth=Math.max(0,y[w].focalDistance-v),M.push(y[w])}}return{sectionId:e,rows:M,blockCount:g}}var ed=/^\d{4}-\d{2}-\d{2}$/;function td(e){let t=Date.parse(e);return Number.isFinite(t)?ed.test(e)?t+864e5:t:null}function nd(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=td(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function od(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function rd(e){return e.status!=="draft"&&e.status!=="retracted"}function id(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function Qa(e,t={}){return!!e&&rd(e)&&od(e,t.activeConfigurationId,t.activeConfigurationVersion)&&id(e,t.activeBasisSha256)&&nd(e,t.now)}var ad=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,sd=/[\s"'<>`\\]/;function cd(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return ad.test(e);if(sd.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Ja(e){let t=e.trim();return cd(t)?t:null}var Cr="seatlayer.event-configuration/1";var Kt=100,ld=120,ud=2e5,md=1e4,fd=/^[a-f0-9]{64}$/,dd=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Tn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Dt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function hd(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function es(e){return!Array.isArray(e)||e.length>ud||!e.every(t=>Dt(t,Kt))?null:[...new Set(e)].sort()}function pd(e){return!Tn(e)||!Dt(e.chartId,Kt)||!Dt(e.version,Kt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!fd.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function _r(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function bd(e){return Tn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&_r(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function yd(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>md)return null;let n=new Set(t),o=new Set,i=new Set,r=0,a=[];for(let s of e){if(!Tn(s)||!Dt(s.id,Kt)||!Dt(s.objectId,Kt)||!n.has(s.objectId)||!dd.has(String(s.kind))||!_r(s.heightM,.05,50)||s.baseElevationM!==void 0&&!_r(s.baseElevationM,-10,100))return null;let c=bd(s.occlusion);if(!c||o.has(s.id)||i.has(s.objectId))return null;let m=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Ja(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!m||s.kind!=="screen"||++r>1))return null;o.add(s.id),i.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...m?{contentImageUrl:m}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function gd(e){let t=[];if(!Tn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Cr&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Cr}`}),Dt(e.id,Kt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Dt(e.label,ld)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),hd(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=pd(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let o=Tn(e.overlay)?e.overlay:null,i=es(o?.objectIds),r=es(o?.productionKillSeatIds),a=i?yd(o?.productionElements,i):null;return(!o||!i||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!i||!r||a===null?{issues:t}:{issues:t,value:{schema:Cr,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:i,productionKillSeatIds:r,...a!==void 0?{productionElements:a}:{}}}}}function ts(e){let t=gd(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function xd(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,o=e.width,i=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+i},{x:t,y:n+i}]}function vd(e,t,n){let o=n*Math.PI/180,i=Math.cos(o),r=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*i-s*r,y:t.y+a*r+s*i}}function ns(e){let t=xd(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>vd(c,{x:t.reduce((m,l)=>m+l.x,0)/t.length,y:t.reduce((m,l)=>m+l.y,0)/t.length},n)),i=1/0,r=1/0,a=-1/0,s=-1/0;for(let c of o)i=Math.min(i,c.x),r=Math.min(r,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(i)||a-i<1e-6||s-r<1e-6?null:{minX:i,minY:r,maxX:a,maxY:s}}var Md=5,Sd=3,wd=.92,Pd=1.9,Id=2,Ad=.6,Rd=1,Ed=.06;function Cd(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?lo:_n(e.stageKind)?Ed:Rd}function os(e){let t=1/0,n=1/0,o=-1/0,i=-1/0,r=-1/0;for(let a of as(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let m=ns(c);m&&(t=Math.min(t,m.minX),n=Math.min(n,m.minY),o=Math.max(o,m.maxX),i=Math.max(i,m.maxY),r=Math.max(r,s+Cd(c)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:o,maxY:i,deckTopM:r}}function _d(e,t,n,o){let i=1/0,r=1/0,a=-1/0,s=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(i=Math.min(i,f.x),a=Math.max(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.y));if(!Number.isFinite(i))return null;let c=i*t,m=r*t,l=Math.max(1,Math.ceil((a-i)*t/n)+1),u=Math.max(1,Math.ceil((s-r)*t/n)+1),h=new Float64Array(l*u).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let d=f.eyeHeightM-ot,p=Math.min(l-1,Math.max(0,Math.floor((f.x*t-c)/n))),g=Math.min(u-1,Math.max(0,Math.floor((f.y*t-m)/n)))*l+p,x=d+o;x>h[g]&&(h[g]=x)}return{cellM:n,minX:c,minY:m,cols:l,rows:u,top:h}}function Td(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),i=Math.floor((n-e.minY)/e.cellM);return o<0||i<0||o>=e.cols||i>=e.rows?-1/0:e.top[i*e.cols+o]}function rs(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let i=n.metresPerChartUnit??fe,r=n.cellM??Ad,a=n.chairBackM??wd,s=n.selfRowSkipM??Id,c=n.clearThreshold??.9,m=n.partialThreshold??.25,l=Math.max(1,n.columns??Md),u=Math.max(1,n.rows??Sd),h=_d(e,i,r,a);if(!h)return o;let f=(t.maxX-t.minX)*i,d=(t.maxY-t.minY)*i,p=f>=d,b=(t.minX+t.maxX)/2*i,g=(t.minY+t.maxY)/2*i,x=[];for(let I=0;I<l;I++){let M=(I+.5)/l-.5,y=p?b+M*f:b,P=p?g:g+M*d;for(let v=0;v<u;v++){let w=t.deckTopM+(u===1?0:v/(u-1)*Pd);x.push({x:y,y:P,z:w})}}let S=r/2;for(let I of e){if(!Number.isFinite(I.eyeHeightM))continue;let M=I.x*i,y=I.y*i,P=I.eyeHeightM,v=0,w=1/0;for(let C of x){let O=C.x-M,E=C.y-y,A=Math.hypot(O,E);if(!(A>s)){v++;continue}let T=O/A,L=E/A,V=0;for(let F=s;F<A;F+=S){let G=Td(h,M+T*F,y+L*F);if(!(!Number.isFinite(G)||G>=P)&&G>P+(C.z-P)*F/A){V=F;break}}V?w=Math.min(w,V):v++}let R=v/x.length;R>=c||o.set(I.id,{seatId:I.id,mark:R<m?"obstructedView":"restrictedView",visibleFraction:R,totalRays:x.length,atDistanceM:Number.isFinite(w)?w:0})}return o}function is(e,t){if(!t.size)return 0;let n=0;for(let o of e){let i=t.get(o.id);if(!i)continue;let r=o.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(o.commercial={...r,[i.mark]:!0},n++)}return n}function Tr(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var po=Math.PI/180;var kn=16;function kr(e,t,n,o){let i=n*po,r=Math.cos(i),a=Math.sin(i);return{x:o.x+e*r-t*a,y:o.y+e*a+t*r}}function ms(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:i,origin:r}=e,a=[];if(e.path)return Xa(e.path,t);if(t<=1)return t===1&&a.push({x:r.x,y:r.y}),a;if(o===0){for(let m=0;m<t;m++)a.push(kr(m*n,0,i,r));return a}let s=o/(t-1)*po,c=n/(2*Math.sin(Math.abs(s)/2));for(let m=0;m<t;m++){let l=m*s,u=c*Math.sin(l),h=-c+c*Math.cos(l);a.push(kr(u,h,i,r))}return a}function fs(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function kd(e,t){let n=fs(e);return ms(e).map((o,i)=>{let r=n.get(i),a=Tr(r),s=$a(e,i,r),c={...e.commercial,...r?.commercial};return{index:i,x:o.x+(r?.dx??0),y:o.y+(r?.dy??0),label:s,displayLabel:Ar(e,i,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(c).some(m=>m!==void 0&&m!==!1&&m!=="")?c:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function Ld(e){let t=[];for(let n of kd(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function Fd(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let i=Math.max(0,Math.round(e.seatCount));for(let r=0;r<i;r++)o[n[r%n.length]]+=1;return o}function Od(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(l=>[l.index,l])),i=(l,u,h,f)=>{let d=o.get(l),p=Tr(d),b=d?.label??`${e.label}-${l+1}`,g=e.displayLabel??e.label;return{index:l,label:b,displayLabel:d?.displayLabel??`${g}-${l+1}`,x:u+(d?.dx??0),y:h+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let l=(e.radius??40)+kn,u=e.rotation*po,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let b=0;b<n;b++){let g=u+b/n*2*Math.PI;t.push(i(b,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let f=h*po,d=(2*Math.PI-f)/2,p=u+d;for(let b=0;b<n;b++){let g=p+b/(n-1)*f;t.push(i(b,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let r=e.width??80,a=e.height??50,s=Fd(e),c=["top","bottom","left","right"],m=0;for(let l of c){let u=s[l];for(let h=0;h<u;h++){let f,d;l==="top"?(f=-r/2+(h+.5)*r/u,d=-a/2-kn):l==="bottom"?(f=-r/2+(h+.5)*r/u,d=a/2+kn):l==="left"?(f=-r/2-kn,d=-a/2+(h+.5)*a/u):(f=r/2+kn,d=-a/2+(h+.5)*a/u);let p=kr(f,d,e.rotation,e.center);t.push(i(m++,p.x,p.y,l))}}return t}function Dd(e){return Od(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Nd(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function ss(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o].x,a=t[o].y,s=t[i].x,c=t[i].y;a>e.y!=c>e.y&&e.x<(s-r)*(e.y-a)/(c-a)+r&&(n=!n)}return n}function Bd(e,t){return t.some((n,o)=>{let i=t[(o+1)%t.length],r=(e.y-n.y)*(i.x-n.x)-(e.x-n.x)*(i.y-n.y);if(Math.abs(r)>1e-7)return!1;let a=(e.x-n.x)*(i.x-n.x)+(e.y-n.y)*(i.y-n.y),s=(i.x-n.x)**2+(i.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Lr(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Oe(e,t,n){return ss(e,t)&&!Lr(n).some(o=>ss(e,o)||Bd(e,o))}function ho(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function ds(e){switch(e.type){case"row":{let t=ms(e),n=fs(e),o=0,i=0,r=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(o+=t[a].x+(s?.dx??0),i+=t[a].y+(s?.dy??0),r++)}return r?{x:o/r,y:i/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return ho(e.points);case"section":return ho(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?ho(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function cs(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Vd(e,t){if(e.type!=="gaArea"||!cs(e.points,t.outline))return!1;let n=Lr(e.holes),o=Lr(t.holes);return n.length===o.length&&n.every((i,r)=>cs(i,o[r]))}function Hd(e,t,n=e.filter(i=>i.type==="section"),o=ds(t)){let i="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(i?n.find(a=>(a.logicalSectionId??a.id)===i&&(Vd(t,a)||Oe(o,a.outline,a.holes))):void 0)??n.find(a=>Oe(o,a.outline,a.holes))}function as(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function ls(e,t,n,o,i,r,a,s,c){let m=[],l=e.filter(p=>p.type==="section"),u=Ya(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),f=p=>Qa(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:i,now:s}),d=(p,b)=>f(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=Ld(p):p.type==="table"?b=Dd(p):p.type==="booth"&&(b=Nd(p)),!b.length)continue;for(let M of b)M.viewUrl&&!h(M.viewMeta)&&(M.viewUrl=void 0,M.viewMeta=void 0);if(p.type==="row"){let M=u.get(p.id);if(M){let y=new Map((p.overrides??[]).map(P=>[P.index,P]));for(let P of b){let v=Number(P.id.slice(P.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;P.logicalRowId=M.groupId,P.logicalSeatIndex=M.adjacencyOffset+v,y.get(v)?.displayLabel||(P.displayLabel=Ar(p,v,M)),!P.viewUrl&&M.viewFromSeatUrl&&h(M.viewFromSeatMeta)&&(P.viewUrl=M.viewFromSeatUrl,P.viewMeta=M.viewFromSeatMeta);let w=y.get(v)?.confidenceEvidence;P.confidenceEvidence=d(w,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(M.confidenceEvidence,"row-representative")}}}let g=Hd(e,p,l,p.type==="row"?ho(b):ds(p)),x=g?.viewFromSeatUrl,I=(g?.zone?t?.find(M=>M.id===g.zone):void 0)?.focalPoint??n;for(let M of b){if(!M.confidenceEvidence){let y=Number(M.id.slice(M.id.lastIndexOf(":")+1)),P=(p.type==="row"||p.type==="table")&&Number.isInteger(y)?p.overrides?.find(v=>v.index===y)?.confidenceEvidence:void 0;M.confidenceEvidence=d(P,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}M.confidenceEvidence??=d(g?.confidenceEvidence,"section-representative")??(a?d(a.evidence,a.coverage):void 0),!M.viewUrl&&x&&h(g?.viewFromSeatMeta)&&(M.viewUrl=x,M.viewMeta=g?.viewFromSeatMeta),!M.viewUrl&&r&&h(r.meta)&&(M.viewUrl=r.url,M.viewMeta=r.meta),g&&(M.sectionId=g.logicalSectionId??g.id),g?.zone&&(M.zoneId=g.zone),I&&(M.focalPoint={...I})}m.push(...b)}return m}function $t(e,t={}){if(e.floors?.length){let o=[];for(let i of e.floors){let r=i.focalPoint??e.focalPoint,a=i.viewFromSeatUrl?{url:i.viewFromSeatUrl,meta:i.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=i.confidenceEvidence?{evidence:i.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=ls(i.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&us(i.objects,i.focalPoint??e.focalPoint,i.baseHeightM??0,c);for(let m of c)m.floorId=i.id;for(let m of c)o.push(m)}return o}let n=ls(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&us(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Gd(e,n,t)}function Gd(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||is(t,rs(t,os(e))),t}function us(e,t,n,o){let i=e.filter(u=>u.type==="section"),r=n>0||i.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!i.length||!r||!t){for(let u of o)u.eyeHeightM=n+ot;return}let a=new Array(o.length),s=new Map;for(let u of i)s.has(u.id)||s.set(u.id,u);let c=new Map,m=new Map;for(let u=0;u<o.length;u++){let h=o[u],d=(h.sectionId?s.get(h.sectionId)??i.find(b=>b.logicalSectionId===h.sectionId&&Oe({x:h.x,y:h.y},b.outline,b.holes)):void 0)??i.find(b=>Oe({x:h.x,y:h.y},b.outline,b.holes))??null;if(a[u]=d,!d)continue;c.has(d.id)||c.set(d.id,yt(d,{floorBaseHeightM:n}));let p=m.get(d.id);p?p.push(u):m.set(d.id,[u])}let l=new Array(o.length).fill(void 0);for(let[u,h]of m){let f=c.get(u);if(!f)continue;let d=f.rake>0?Math.tan(f.rake*Math.PI/180):0,p=fo(u,o,h,t);for(let b of p.rows){let g=b.blockDepth*fe*d,x=f.height+g;for(let S of b.seatIndices)l[S]=x}}for(let u=0;u<o.length;u++){let h=o[u],f=a[u];if(!f){h.eyeHeightM=n+ot;continue}let d=c.get(f.id);h.eyeHeightM=(l[u]??d.height)+ot}}function hs(e){let t=1/0,n=1/0,o=-1/0,i=-1/0,r=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(r=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>o&&(o=a.x),a.y>i&&(i=a.y));return r?{minX:t,minY:n,maxX:o,maxY:i}:null}function qt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function Ln(e){if(e.length<3)return e.map(r=>({...r}));let t=[...e].sort((r,a)=>r.x-a.x||r.y-a.y),n=(r,a,s)=>(a.x-r.x)*(s.y-r.y)-(a.y-r.y)*(s.x-r.x),o=r=>{let a=[];for(let s of r){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},i=[...o(t),...o([...t].reverse())];return i.length>=3?i.map(r=>({...r})):t.map(r=>({...r}))}var Fs=nt(require("polygon-clipping"),1);var ce={top:1,wallBottom:.58,bottomCap:.4};function Nt(e,t){if(!e)return t;let n=le(qe(e,.4),.62);return be(t,n,.22)}function ps(e,t){return e?be(t,le(qe(e,.25),.74),.62):t}function bs(e,t){return e?be(t,le(qe(e,.08),.9),.82):t}function ys(e,t){let n=new Map;for(let r of e.categories??[])n.set(r.key,r.color);let o=new Map;for(let r of t){if(!r.sectionId)continue;let a=o.get(r.sectionId);a||(a=new Map,o.set(r.sectionId,a)),a.set(r.categoryKey,(a.get(r.categoryKey)??0)+1)}let i=new Map;for(let[r,a]of o){let s=0,c=0,m=0,l=0;for(let[u,h]of a){let f=pe(n.get(u));f&&(s+=f[0]*h,c+=f[1]*h,m+=f[2]*h,l+=h)}l>0&&i.set(r,[s/l,c/l,m/l])}return i}function gs(e,t){return pe(e.color)??t.get(e.logicalSectionId??e.id)??null}var Nr=nt(require("polygon-clipping"),1);var Dr=nt(require("polygon-clipping"),1);var Ss=nt(require("earcut"),1);var zd=.58,xs=.01,We=ut*1.5*je,Ud=.5,jd=.6;function Wd(e,t){let n=e.length,o=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],m=c.x-s.x,l=c.y-s.y,u=Math.hypot(m,l);if(u<1e-9){o.push([0,0]);continue}m/=u,l/=u,o.push([-l,m])}let i=0;for(let a=0;a<n;a++)i+=(e[a].x-t.x)*o[a][0]+(e[a].y-t.y)*o[a][1];return i<0?o.map(([a,s])=>[-a,-s]):o}function Xd(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(a,s)=>{let c=s.x-a.x,m=s.y-a.y,l=Math.hypot(c,m)||1;return{x:c/l,y:m/l}},i=o(n[1],n[0]),r=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+i.x*t,y:n[0].y+i.y*t}),n.push({x:n[n.length-1].x+r.x*t,y:n[n.length-1].y+r.y*t}),n}var vs=Math.PI/12;function Yd(e){if(e.length<3)return[...e];let t=[...e].sort((r,a)=>r.x-a.x||r.y-a.y),n=(r,a,s)=>(a.x-r.x)*(s.y-r.y)-(a.y-r.y)*(s.x-r.x),o=r=>{let a=[];for(let s of r){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},i=[...o(t),...o([...t].reverse())];return i.length>=3?i:[...e]}function ws(e,t){if(!e.length||!(t>0))return[];let n=Yd(e),o=(s,c,m,l)=>{let u=m-c;for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;let h=Math.max(1,Math.ceil(u/vs)),f=t/Math.cos(u/h/2);for(let d=0;d<=h;d++){let p=c+u*d/h;l.push({x:s.x+Math.cos(p)*f,y:s.y+Math.sin(p)*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 m=0;for(let f of n)m=Math.max(m,Math.hypot(f.x-s,f.y-c));let l=[],u=Math.max(3,Math.ceil(Math.PI*2/vs)),h=(m+t)/Math.cos(Math.PI/u);for(let f=0;f<u;f++){let d=f/u*Math.PI*2;l.push({x:s+Math.cos(d)*h,y:c+Math.sin(d)*h})}return l}let i=n.length,r=[];for(let s=0;s<i;s++){let c=n[s],m=n[(s+1)%i];r.push(Math.atan2(-(m.x-c.x),m.y-c.y))}let a=[];for(let s=0;s<i;s++)o(n[s],r[(s+i-1)%i],r[s],a);return Es(a)}function Kd(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let i=0;i+1<e.length;i++){let r=e[i],a=e[i+1],s=a.x-r.x,c=a.y-r.y,m=s*s+c*c,l=m>1e-12?((t-r.x)*s+(n-r.y)*c)/m:0;l<0?l=0:l>1&&(l=1);let u=Math.hypot(t-(r.x+l*s),n-(r.y+l*c));u<o&&(o=u)}return o}function bo(e){let t=e.map(i=>{let r=0,a=0;for(let m of i.pts)r+=m.x,a+=m.y;let s=i.pts.length||1;r/=s,a/=s;let c=0;for(let m of i.pts){let l=Math.hypot(m.x-r,m.y-a);l>c&&(c=l)}return{cx:r,cy:a,rad:c}}),n=i=>{let r=i.length;return r<=2?[...i]:[i[Math.floor(r*.25)],i[Math.floor(r*.5)],i[Math.floor(r*.75)]]},o=[];for(let i=0;i<e.length;i++){let r=n(e[i].pts),a=[],s=1/0,c=null;for(let l of r){let u=1/0;for(let h=0;h<e.length;h++){if(h===i||Math.abs(e[h].y-e[i].y)<.001)continue;let f=t[h],d=Math.hypot(l.x-f.cx,l.y-f.cy)-f.rad;if(d>=u&&d>=s)continue;let p=Kd(e[h].pts,l.x,l.y);p<u&&(u=p),e[h].depth<e[i].depth&&p<s&&(s=p,c=e[h].y)}Number.isFinite(u)&&u>0&&a.push(u)}a.sort((l,u)=>l-u);let m=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:m,belowY:c})}return o}function Ps(e,t,n,o){let i=e[t],r=i.pts.length>=2?[...i.pts]:i.pts.length===1?(()=>{let l=i.pts[0],u=l.x-o.x,h=l.y-o.y,f=Math.hypot(u,h)||1;u/=f,h/=f;let d=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+h*d,y:l.y-u*d},{x:l.x-h*d,y:l.y+u*d}]})():[];if(r.length<2)return null;let a=0,s=0;for(let l=1;l<r.length;l++){let u=Math.hypot(r[l].x-r[l-1].x,r[l].y-r[l-1].y);u>1e-6&&(a+=u,s++)}let c=s>0?a/s:0,m=Xd(r,Math.max(c*jd,We));return{pts:m,nrm:Wd(m,o),front:Math.max(n[t].pitch*zd,We),back:Math.max(n[t].pitch*Ud,We)}}var Zt=1.5,Is=.3;function Fr(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],i=o.x-n.x,r=o.y-n.y,a=Math.hypot(i,r),s=-1,c=-1;for(let u=1;u<e.length-1;u++){let h=e[u],f=a>1e-12?Math.abs((h.x-n.x)*r-(h.y-n.y)*i)/a:Math.hypot(h.x-n.x,h.y-n.y);f>s&&(s=f,c=u)}if(s<=t||c<0)return[n,o];let m=Fr(e.slice(0,c+1),t),l=Fr(e.slice(c),t);return[...m.slice(0,-1),...l]}function As(e,t){if(e.length<4)return e;let n=Fr([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function $d(e){let t=e.map((o,i)=>{let r=e[(i+1)%e.length];return{a:o,b:r,i,minX:Math.min(o.x,r.x),maxX:Math.max(o.x,r.x),minY:Math.min(o.y,r.y),maxY:Math.max(o.y,r.y)}}).sort((o,i)=>o.minX-i.minX),n=(o,i,r)=>(i.x-o.x)*(r.y-o.y)-(i.y-o.y)*(r.x-o.x);for(let o=0;o<t.length;o++){let i=t[o];for(let r=o+1;r<t.length&&t[r].minX<=i.maxX;r++){let a=t[r];if(!(Math.abs(i.i-a.i)===1||Math.abs(i.i-a.i)===e.length-1||i.maxY<a.minY||a.maxY<i.minY)&&n(i.a,i.b,a.a)*n(i.a,i.b,a.b)<=0&&n(a.a,a.b,i.a)*n(a.a,a.b,i.b)<=0)return!0}}return!1}function Rs(e,t,n){if(e.length<2)return[];let o=n??bo(e),i=new Map;for(let a=0;a<e.length;a++){let s=i.get(e[a].blockId);s?s.push(a):i.set(e[a].blockId,[a])}let r=[];for(let[,a]of i){let s=[];for(let x of a){let S=e[x].patch;S&&S.length>=3?r.push({outline:[...S],holes:[],topY:e[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,S)=>e[x].depth-e[S].depth);let m=s.map(x=>Ps(e,x,o,t)).filter(x=>x!==null);if(!m.length)continue;let l=(x,S)=>({x:x.pts[S].x-x.nrm[S][0]*(x.front+Zt),y:x.pts[S].y-x.nrm[S][1]*(x.front+Zt)}),u=(x,S)=>({x:x.pts[S].x+x.nrm[S][0]*(x.back+Zt),y:x.pts[S].y+x.nrm[S][1]*(x.back+Zt)}),h=m[0],f=m[m.length-1],d=[];for(let x=0;x<h.pts.length;x++)d.push(l(h,x));for(let x of m)d.push(u(x,x.pts.length-1));for(let x=f.pts.length-1;x>=0;x--)d.push(u(f,x));for(let x=m.length-1;x>=0;x--)d.push(l(m[x],0));let p=Es(d),b=1/0;for(let x of s)e[x].y<b&&(b=e[x].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Ve(p))>1e-6&&m.every(x=>{let S=x.pts[Math.floor(x.pts.length/2)];return He(p,S.x,S.y)})&&!$d(p)){r.push({outline:As(p,Is),holes:[],topY:b});continue}for(let x of qd(m))r.push({outline:x,holes:[],topY:b})}return r}function qd(e){let t=[];for(let n of e){let o=[],i=[],r=n.front+Zt,a=n.back+Zt;for(let c=0;c<n.pts.length;c++){let m=n.pts[c],l=n.nrm[c];o.push([m.x-l[0]*r,m.y-l[1]*r]),i.push([m.x+l[0]*a,m.y+l[1]*a])}let s=[...o,...i.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Dr.default.union(t[0],...t.slice(1)),o=[];for(let i of n){if(!i.length||i[0].length<4)continue;let r=i[0].map(([c,m])=>({x:c,y:m})),a=r[0],s=r[r.length-1];r.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&r.pop(),r.length>=3&&o.push(As(r,Is))}return o}catch{return[]}}function Es(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.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 Or=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 o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.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 o=!0;for(let i of t)if(!He(n,i.x,i.y)){o=!1;break}if(o)return!0}return!1}};function Ms(e,t,n,o,i,r){if(o.length<3)return;if(n.containsAll(o)){let m=[0,1,0],l=o[0];for(let u=1;u+1<o.length;u++){let h=o[u],f=o[u+1];e.tri([l.x*_,i,l.y*_],[h.x*_,i,h.y*_],[f.x*_,i,f.y*_],m,r)}return}let a=o.map(m=>[m.x,m.y]);a.push(a[0]);let s;try{s=Dr.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let m of s){if(!m.length||m[0].length<4)continue;let l=m[0],u=[],h=[];for(let d=0;d<l.length-1;d++)u.push(l[d][0],l[d][1]),h.push([l[d][0],l[d][1]]);if(h.length<3)continue;let f=(0,Ss.default)(u,void 0,2);for(let d=0;d<f.length;d+=3){let p=h[f[d]],b=h[f[d+1]],g=h[f[d+2]];e.tri([p[0]*_,i,p[1]*_],[b[0]*_,i,b[1]*_],[g[0]*_,i,g[1]*_],c,r)}}}function Cs(e,t,n,o,i,r,a){if(t.length<2)return;let s=a??bo(t),c=[0,1,0],m=r&&r.length>=3?[[...r.map(f=>[f.x,f.y]),[r[0].x,r[0].y]]]:null,l=r&&r.length>=3?new Or([[...r]]):null,u=f=>{e.setMaterial(2),f(),e.setMaterial(0)},h=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let d=t[f];if(d.patch&&d.patch.length>=3){let M=[...d.patch],y=s[f].belowY??o;if(h(()=>{if(m&&l)Ms(e,m,l,M,d.y,i.tread);else{let P=M[0];for(let v=1;v+1<M.length;v++){let w=M[v],R=M[v+1];e.tri([P.x*_,d.y,P.y*_],[w.x*_,d.y,w.y*_],[R.x*_,d.y,R.y*_],c,i.tread)}}}),d.y>y+xs){let P=0,v=0;for(let w of M)P+=w.x,v+=w.y;P/=M.length,v/=M.length,u(()=>{for(let w=0;w<M.length;w++){let R=M[w],C=M[(w+1)%M.length],O=C.x-R.x,E=C.y-R.y,A=Math.hypot(O,E);if(A<1e-6)continue;let T=E/A,L=-O/A;(R.x-P)*T+(R.y-v)*L<0&&(T=-T,L=-L);let V=[T,0,L],F=[R.x*_,d.y,R.y*_],G=[C.x*_,d.y,C.y*_],j=[R.x*_,y,R.y*_],N=[C.x*_,y,C.y*_];e.tri(F,G,N,V,i.riser),e.tri(F,N,j,V,i.riser)}})}continue}let p=Ps(t,f,s,n);if(!p)continue;let{pts:b,nrm:g,front:x,back:S}=p,I=s[f].belowY??o;for(let M=0;M+1<b.length;M++){let y=b[M],P=b[M+1],v=g[M],w=g[M+1];if(Math.hypot(P.x-y.x,P.y-y.y)<1e-6||v[0]===0&&v[1]===0||w[0]===0&&w[1]===0)continue;let R=[(y.x-v[0]*x)*_,d.y,(y.y-v[1]*x)*_],C=[(P.x-w[0]*x)*_,d.y,(P.y-w[1]*x)*_],O=[(y.x+v[0]*S)*_,d.y,(y.y+v[1]*S)*_],E=[(P.x+w[0]*S)*_,d.y,(P.y+w[1]*S)*_];if(h(()=>{m&&l?Ms(e,m,l,[{x:y.x-v[0]*x,y:y.y-v[1]*x},{x:P.x-w[0]*x,y:P.y-w[1]*x},{x:P.x+w[0]*S,y:P.y+w[1]*S},{x:y.x+v[0]*S,y:y.y+v[1]*S}],d.y,i.tread):(e.tri(R,C,E,c,i.tread),e.tri(R,E,O,c,i.tread))}),d.y>I+xs){let A=[R[0],I,R[2]],T=[C[0],I,C[2]],L=[-v[0],0,-v[1]];u(()=>{e.tri(R,C,T,L,i.riser),e.tri(R,T,A,L,i.riser)})}}}}function Zd(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function _s(e,t){return e.filter(n=>n.type!=="shape"||Zd(n,t))}function Ts(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,i)=>({objects:_s(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:i})):[{objects:_s(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Qd={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ft(e){return hs(e)??Qd}function ks(e,t){let n=Ze(e.outline,We),o=ft(n),i=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&qt(o,ft(a.outline)));if(!i.length)return[n];let r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Nr.default.difference([r(n)],...i.map(c=>[r(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let m=c[0].map(([l,u])=>({x:l,y:u}));if(m.length>1){let l=m[0],u=m[m.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&m.pop()}m.length>=3&&s.push(m)}return s.length?s:[n]}catch{return[n]}}function Ls(e,t){if(!t.length)return e;let n=r=>{let a=r.map(s=>[s.x,s.y]);return a.push(a[0]),a},o=t.map(r=>[n(r)]),i=[];for(let r of e){let a;try{a=Nr.default.intersection([n(r.outline)],o.flat())}catch{i.push(r);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([m,l])=>({x:m,y:l}));if(c.length>1){let m=c[0],l=c[c.length-1];Math.abs(m.x-l.x)<1e-9&&Math.abs(m.y-l.y)<1e-9&&c.pop()}c.length>=3&&i.push({outline:c,holes:[],topY:r.topY})}}return i.length?i:e}function Jd(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var yo=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let i=ft(t),r=this.rings.filter((c,m)=>qt(i,this.boxes[m])&&Jd(n,this.levels[m])),a=[[o]];if(r.length)try{a=Fs.default.difference([o],...r).map(m=>m.map(l=>l.map(([u,h])=>[u,h])))}catch{a=[[o]]}this.rings.push([o]),this.boxes.push(i),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let m=c[0].map(([l,u])=>({x:l,y:u}));if(m.length>1){let l=m[0],u=m[m.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&m.pop()}m.length>=3&&s.push(m)}return s}};function go(e,t){if(!t)return e;let n=1/0,o=-1/0,i=1/0,r=-1/0;for(let u of e)n=Math.min(n,u.x),o=Math.max(o,u.x),i=Math.min(i,u.y),r=Math.max(r,u.y);let a=(n+o)/2,s=(i+r)/2,c=t*Math.PI/180,m=Math.cos(c),l=Math.sin(c);return e.map(u=>{let h=u.x-a,f=u.y-s;return{x:a+h*m-f*l,y:s+h*l+f*m}})}function Se(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=Rn(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,o=(e.y??0)+e.height/2;t=so(n,o,e.width/2,e.height/2)}return t?go(t,e.rotation):null}function Qe(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},o=t==="stage"&&_n(e.stageKind)?{kind:"stage",heightM:e.stageKind==="ring-boxing"?lo:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var eh=.08,th=30,nh=.015;function oh(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o],a=t[i];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function Os(e,t){let n=Se(e)??(e.points?.length?go(e.points,e.rotation):null),o=Qe(e),r=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ve(n))*fe**2>=th?nh:o.heightM;if(!n)return{topOffsetM:r,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:r,supportOffsetM:0};let a=1/0,s=1/0,c=-1/0,m=-1/0;for(let f of n)a=Math.min(a,f.x),s=Math.min(s,f.y),c=Math.max(c,f.x),m=Math.max(m,f.y);let l=r,u=0,h=1e-6*Math.max(1,c-a,m-s);for(let f of t)c>f.minX&&a<f.maxX&&m>f.minY&&s<f.maxY&&l<=f.topOffsetM+1e-6&&(l=f.topOffsetM+eh),a>=f.minX-h&&c<=f.maxX+h&&s>=f.minY-h&&m<=f.maxY+h&&(!f.poly||n.every(b=>oh(b,f.poly)||rh(b,f.poly,h)))&&(u=Math.max(u,f.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:a,minY:s,maxX:c,maxY:m,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(u,l)}}function rh(e,t,n){for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[i],a=t[o],s=a.x-r.x,c=a.y-r.y,m=s*s+c*c,l=m?Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/m)):0;if(Math.hypot(e.x-(r.x+l*s),e.y-(r.y+l*c))<=n)return!0}return!1}function vt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ge(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 Le(e,t,n){return[vt(e[0],e[1],t),vt(e[0],e[1],n),vt(e[3],e[2],n),vt(e[3],e[2],t)]}function Fn(e,t,n){return[vt(e[0],e[3],t),vt(e[1],e[2],t),vt(e[1],e[2],n),vt(e[0],e[3],n)]}function de(e,t,n,o,i,r){ue(e,t,void 0,()=>n,o,i,r,ce)}var ih=.8,ah=.6,sh=2;function Qt(e,t){if(!t.length)return null;let n=[],o=0;for(let a of e.objects){if(a.type!=="shape"||a.role!=="wall")continue;let s=Se(a)??[],c=Ds(s)/2;!(c>0)||uh(s)/c*_>sh||(n.push(...s),o+=c)}if(n.length<3)return null;let i=Ln(n);if(i.length<3||o<Ds(i)*ah)return null;let r=0;for(let a of t)mh(a,i)&&(r+=1);return r>=t.length*ih?i:null}var Ns=6,ch=5,lh=8;function Bs(e){return Math.max(lh,(Number.isFinite(e)?e:0)+ch)}function Vs(e){let t=0,n=0,o=0;for(let i=0;i<e.length;i++){let r=e[i],a=e[(i+1)%e.length],s=r.x*a.y-a.x*r.y;t+=s,n+=(r.x+a.x)*s,o+=(r.y+a.y)*s}if(Math.abs(t)<1e-9){let i=0,r=0;for(let a of e)i+=a.x,r+=a.y;return{x:i/Math.max(1,e.length),y:r/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function uh(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],i=e[(n+1)%e.length];t+=o.x*i.y-i.x*o.y}return Math.abs(t)/2}function Ds(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],i=e[(n+1)%e.length];t+=Math.hypot(i.x-o.x,i.y-o.y)}return t}function mh(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o],a=t[i];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function fh(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,i=n-e.y,r=Math.hypot(o,i);return r<1e-9?[0,0]:[o/r,i/r]}}}function dh(e,t){if(!e.length)return null;let n=0,o=0,i=0;for(let f of e)n+=f.x,o+=f.y,i+=Math.hypot(f.x-t.x,f.y-t.y);let r=e.length;n/=r,o/=r,i/=r;let a=e[0],s=-1;for(let f of e){let d=Math.hypot(f.x-n,f.y-o);d>s&&(s=d,a=f)}let c=a.x-n,m=a.y-o,l=Math.hypot(c,m);l>1e-9?(c/=l,m/=l):(c=1,m=0);let u=[...e].sort((f,d)=>(f.x-n)*c+(f.y-o)*m-((d.x-n)*c+(d.y-o)*m)),h=0;for(let f of u){let d=Math.hypot(f.x-n,f.y-o);d>h&&(h=d)}return{pts:u,cx:n,cy:o,radius:h,depth:i}}function Hs(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let i=1/0;for(let r=0;r+1<o.length;r++){let a=o[r],s=o[r+1],c=s.x-a.x,m=s.y-a.y,l=c*c+m*m,u=l>1e-12?((t-a.x)*c+(n-a.y)*m)/l:0;u<0?u=0:u>1&&(u=1);let h=Math.hypot(t-(a.x+u*c),n-(a.y+u*m));h<i&&(i=h)}return i}var xo=8;function hh(e,t,n){let o=new Array(xo).fill(1/0),i=new Array(xo).fill(-1);for(let l=0;l<e.length;l++){let u=e[l],h=Math.hypot(t-u.cx,n-u.cy)-u.radius;for(let f=0;f<xo;f++)if(h<o[f]){for(let d=xo-1;d>f;d--)o[d]=o[d-1],i[d]=i[d-1];o[f]=h,i[f]=l;break}}let r=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let l of i){if(l<0)continue;let u=Hs(e[l],t,n);for(let h=0;h<3;h++)if(u<r[h]){for(let f=2;f>h;f--)r[f]=r[f-1],a[f]=a[f-1];r[h]=u,a[h]=l;break}}if(a[0]<0)return 0;if(r[0]<1e-6)return e[a[0]].depth;let s=r[0]*2.2,c=0,m=0;for(let l=0;l<3;l++){let u=a[l];if(u<0||r[l]>s)continue;let h=1/(r[l]*r[l]);c+=h*e[u].depth,m+=h}return m>0?c/m:e[a[0]].depth}function ph(e){let t=(o,i)=>hh(e,o,i),n=(o,i)=>{let r=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(o-c.cx,i-c.cy)-c.radius>=r)continue;let m=Hs(c,o,i);m<r&&(r=m,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,i)=>{let r=(t(o+.5,i)-t(o-.5,i))/1,a=(t(o,i+.5)-t(o,i-.5))/(2*.5),s=Math.hypot(r,a);return s<1e-9?[0,0]:[r/s,a/s]}}}function Gs(e,t){let n=[];for(let o of e){let i=dh(o.points,t);i&&n.push(i)}return n.length<2?fh(t):(n.sort((o,i)=>o.depth-i.depth),ph(n))}var Mt=.06,bh=.05,Us=.05,zs=.15,Br=25;function js(e,t,n){let o=new Map,i=new Array(t.length).fill(null),r=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,m=[],l=new Set;for(let h=0;h<e.length;h+=1){let f=e[h];for(let d of f.objects){if(d.type==="table"&&l.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Ze(d.outline,We);c.set(d.id,{section:d,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),m.push({id:d.id,floorIndex:h,box:ft(p),section:d,unit:f,outline:p})}}let u=new Map;for(let h of m){let f=u.get(h.floorIndex);f?f.push(h):u.set(h.floorIndex,[h])}for(let h=0;h<t.length;h++){let f=t[h],d=n?u.get(n[h])??[]:m,p=f.sectionId?d.find(g=>g.id===f.sectionId)??d.find(g=>g.section.logicalSectionId===f.sectionId&&Oe({x:f.x,y:f.y},g.outline,g.section.holes)):void 0,b=p?[p]:d;for(let g of b){if(n&&g.floorIndex!==n[h]||!p&&(f.x<g.box.minX||f.x>g.box.maxX||f.y<g.box.minY||f.y>g.box.maxY||!Oe({x:f.x,y:f.y},g.outline,g.section.holes)))continue;i[h]=g.id;let x=c.get(g.id);x.hasSeats=!0;let S=f.focalPoint??g.unit.focal,I=Math.hypot(f.x-S.x,f.y-S.y);I<x.frontU&&(x.frontU=I),x.seatIndices.push(h);let M=f.rowId||`__seat-${h}`,y=x.rows.get(M);y?y.push({x:f.x,y:f.y}):x.rows.set(M,[{x:f.x,y:f.y}]);break}}for(let[h,f]of c){let d=yt(f.section,{floorBaseHeightM:f.unit.baseHeightM}),p=f.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,g=d.rake<=.01&&d.height<=p+.001,x=f.section.surfaceKind,S=x==="flat"?!0:x==="rakedRows"&&d.rake>.01?!1:g,I=f.hasSeats?fo(h,t,f.seatIndices,f.unit.focal):{sectionId:h,rows:[],blockCount:0},y=I.rows.length<2?Gs([...f.rows.values()].map(F=>({points:F})),f.unit.focal):null,P=1/0;if(y){if(f.hasSeats)for(let F of f.rows.values())for(let G of F){let j=y.depthAt(G.x,G.y);j<P&&(P=j)}if(!f.hasSeats||!Number.isFinite(P)){P=1/0;for(let F of f.section.outline){let G=y.depthAt(F.x,F.y);G<P&&(P=G)}}}let v=p+bh,w=Math.max(v,d.height),R=F=>{let G=Math.max(0,F-P)*fe,j=Math.min(G*b,Br);return Math.max(v,d.height+j)},C=F=>{let G=Math.max(0,F)*fe,j=Math.min(G*b,Br);return Math.max(v,d.height+j)},O=S?[]:I.rows.map(F=>({pts:F.pts,y:C(F.blockDepth),depth:F.blockDepth,blockId:F.blockId,...l.has(F.id)?{patch:ws(F.pts,We)}:{}})),E=O.length?O[0].y:w,A=O.map(F=>{let G=F.patch&&F.patch.length>=3?F.patch:F.pts,j=0,N=0;for(let D of G)j+=D.x,N+=D.y;let k=G.length||1;j/=k,N/=k;let B=0;for(let D of G){let H=Math.hypot(D.x-j,D.y-N);H>B&&(B=H)}return{cx:j,cy:N,rad:B}}),T=S?()=>w:O.length>=2?(F,G)=>{let j=1/0,N=E;for(let k=0;k<O.length;k++){let B=A[k];if(Math.hypot(F-B.cx,G-B.cy)-B.rad>=j)continue;let D=O[k].patch,H=D&&D.length>=3?He(D,F,G)?0:Yt(D,F,G):Yt(O[k].pts,F,G);H<j&&(j=H,N=O[k].y)}return N}:(F,G)=>y?R(y.depthAt(F,G)):w,L=[0,1,0],V=O.length>=2||S?()=>L:(F,G)=>{if(!y)return L;let j=y.depthAt(F,G);if(j<=P)return L;let N=(j-P)*fe;if(N*b>=Br||d.height+N*b<=v)return L;let[k,B]=y.gradientAt(F,G);if(k===0&&B===0)return L;let D=1/Math.hypot(b,1);return[-k*b*D,D,-B*b*D]};if(!S)for(let F of I.rows){let G=C(F.blockDepth);for(let j of F.seatIndices)a[j]=G}for(let F of I.rows){let G=[];for(let D=1;D<F.pts.length;D++){let H=Math.hypot(F.pts[D].x-F.pts[D-1].x,F.pts[D].y-F.pts[D-1].y);H>1e-6&&G.push(H)}G.sort((D,H)=>D-H);let j=G.length?G[Math.floor(G.length/2)]:1/0,N=1/0,k=F.pts[Math.floor(F.pts.length/2)];if(k)for(let D of I.rows){if(D===F||D.blockId!==F.blockId)continue;let H=Yt(D.pts,k.x,k.y);H>1e-6&&H<N&&(N=H)}let B=Math.min(j,Math.max(N,j*.5));if(Number.isFinite(B)&&B>0)for(let D of F.seatIndices)s[D]=B}o.set(h,{sectionId:h,deckAt:T,normalAt:V,flat:S,bottomY:p,rowLevels:O,landingY:E})}for(let h=0;h<t.length;h++){let f=i[h],d=t[h];if(f){let g=a[h];r[h]=(g??o.get(f).deckAt(d.x,d.y))+zs;continue}let p=d.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-ot):0;r[h]=d.kind==="booth"?b+Mt+zs:b}return{bySection:o,seatOwner:i,seatDeckY:h=>r[h],seatPitchU:h=>s[h]}}function Jt(e,t,n){if(e.length!==4||n<=t)return null;let o=Ge(e),i=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*_,r=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*_;if(i<1e-6||r<1e-6)return null;let a=Math.min(.22/i,.16),s=Math.min(.28,(n-t)*.13),c=Math.min(.065/r,.2);return{quad:o,side:a,face:c,opening:Le(o,a,1-a),openingTop:n-s}}function Vr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=Ge(e),i=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*_;if(i<=1e-6)return null;let r=Math.min(.14,(n-t)*.08,i*.08),a=r/i,s=Le(o,a,1-a);return{quad:o,side:a,trim:r,inner:s,panel:Fn(s,.15,.85),bottom:t+r,top:n-r}}function Ws(e,t,n,o){let i=Vr(e,t,n);if(!i)return;let{panel:r}=i,a=(x,S)=>({x:(x.x+S.x)/2,y:(x.y+S.y)/2}),s=a(r[0],r[1]),c=a(r[3],r[2]),m=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,u]=m?[r[0],r[1]]:[r[3],r[2]],h=m?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},f=Math.hypot(h.x,h.y);if(f<1e-6)return;-(u.y-l.y)*h.x+(u.x-l.x)*h.y<0&&([l,u]=[u,l]);let d=Math.min(.006,f*_*.05),p=h.x/f*d,b=h.y/f*d,g=(x,S)=>[x.x*_+p,S,x.y*_+b];return[g(l,i.bottom),g(u,i.bottom),g(l,i.top),g(u,i.top)]}var Ys=nt(require("polygon-clipping"),1);var Xs=nt(require("polygon-clipping"),1);function dt(e,t,n,o,i,r,a,s={}){let c=ft(t),m=s.ao??ce,l=i.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=Se(p);if(!b||b.length!==4||!qt(c,ft(b)))return[];let g=s.portalBase??n,x=Jt(b,g,g+Qe(p).heightM);if(!x)return[];let S=Math.min(o,x.openingTop);return S<=n?[]:[{poly:x.opening,height:S}]});if(!l.length)return!1;let u=p=>p.map(b=>[b.x,b.y]),h=[u(t),...(s.holes??[]).map(u)],f=[n,...new Set(l.map(p=>p.height)),o].sort((p,b)=>p-b),d=[];try{for(let p=1;p<f.length;p++){let b=f[p-1],g=f[p];if(g-b<1e-6)continue;let x=l.filter(I=>I.height>b+1e-6).map(I=>[u(I.poly)]),S=x.length?Xs.default.difference(h,...x):[h];d.push({low:b,high:g,polys:S})}}catch{return!1}for(let p of d)for(let b of p.polys){let[g,...x]=b.map(I=>I.map(([M,y])=>({x:M,y}))),S=I=>m.wallBottom+(m.top-m.wallBottom)*(I-n)/(o-n);ue(e,g,x,()=>p.high,p.low,r,a,{...m,top:S(p.high),wallBottom:S(p.low)})}return!0}var Hr={depthM:1.6,thicknessM:.35,minWallM:6};function Ks(e,t,n,o,i,r,a,s){let c=o-n;if(c<=0)return;let m=s&&c>=Hr.minWallM?yh(t,s):null,l=m?o-Hr.thicknessM:o,u=l-n,h=u<1.5?[[n,l,1]]:m?[[n,n+Math.min(.9,u*.18),.82],[n+Math.min(.9,u*.18),l,1]]:[[n,n+Math.min(.9,u*.18),.82],[n+Math.min(.9,u*.18),l-.1,1],[l-.1,l,1.1]],f=d=>ce.wallBottom+(ce.top-ce.wallBottom)*(d-n)/c;for(let[d,p,b]of h){let g={...ce,top:f(p),wallBottom:f(d)},x=le(r,b),S=le(a,b);dt(e,t,d,p,i,x,S,{portalBase:n,ao:g})||ue(e,t,void 0,()=>p,d,x,S,g)}for(let[d,...p]of m??[])ue(e,d,p.length?p:void 0,()=>o,l,le(r,1.12),le(a,.78),ce)}function yh(e,t){let n=Hr.depthM/_,o=e.map(a=>{let s=t.x-a.x,c=t.y-a.y,m=Math.hypot(s,c)||1;return{x:a.x+s/m*n,y:a.y+c/m*n}}),i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},r=[[i(e)],[i(o)]];for(let a=0;a<e.length;a++){let s=(a+1)%e.length;r.push([i([e[a],e[s],o[s],o[a]])])}try{let[a,...s]=r,c=Ys.default.union(a,...s);return c.length?c.map(m=>m.map(l=>l.slice(0,-1).map(([u,h])=>({x:u,y:h})))):null}catch{return null}}function On(e,t,n){let o=pe(t.stroke?.color),i=t.stroke?.width??0;if(!o||!Number.isFinite(i)||i<=0)return;let r=t.kind==="line"||t.kind==="polyline",a=r?go(t.points??[],t.rotation):Se(t);if(!a||a.length<2)return;let s=r?a.length-1:a.length,c=i*.5;for(let m=0;m<s;m++){let l=a[m],u=a[(m+1)%a.length],h=Math.hypot(u.x-l.x,u.y-l.y);if(h<1e-6)continue;let f=-(u.y-l.y)/h*c,d=(u.x-l.x)/h*c,p=[(l.x+f)*_,n,(l.y+d)*_],b=[(u.x+f)*_,n,(u.y+d)*_],g=[(u.x-f)*_,n,(u.y-d)*_],x=[(l.x-f)*_,n,(l.y-d)*_];e.tri(p,b,g,[0,1,0],o),e.tri(p,g,x,[0,1,0],o)}}function $s(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var en=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function vo(e,t,n,o){let[i,r,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[en(i,s,n),en(r,a,n),en(r,a,o),en(i,s,o)]}function qs(e,t,n,o,i,r,a,s,c=!1){if(n.length!==4||i-o<.4)return!1;let m=v=>c?Math.min(v,i):v,l=Ge(n),u=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*_;if(u<.4)return!1;let h=en(l[0],l[1],.5),f=en(l[3],l[2],.5),d=Math.hypot(h.x-s.x,h.y-s.y)<=Math.hypot(f.x-s.x,f.y-s.y),p=be(a,[.92,.9,.86],.35),b=le(r,.72),g=i-o;if(t==="restroom"){let v=Math.min(.18,g*.08);return de(e,l,i-v,o,a,r),de(e,l,i,i-v,p,p),!0}let x=o+Math.min(1.1,g),S=t==="coat"?1:Math.min(.5,.75/u),I=vo(l,d,0,S);if(de(e,I,x-.05,o,b,r),de(e,I,x,x-.05,p,p),t==="coat"||u<1.2)return!0;if(t==="bar"){let v=vo(l,d,Math.max(S+.2,1-.45/u),1),w=m(o+Math.max(Math.min(2.2,g*2),x-o+.6));return de(e,v,w,o,a,b),!0}let M=vo(l,d,Math.max(S+.25,.55),1),y=m(o+Math.max(2.6,x-o+1.4));if(y-.14<=x)return!0;de(e,M,y-.14,o,a,r),de(e,l,y,y-.14,p,b);let P=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*_));for(let[v,w]of[[0,P],[1-P,1]])de(e,vo(Le(l,v,w),d,0,Math.min(.08,.1/u)),y-.14,x,b,b);return!0}var gh=[.12,.38,.16],xh=[.72,.62,.45],vh=[.88,.93,.96],Zs=[.95,.95,.94],Mh=[.66,.29,.22],Gr={length:20.12,width:3.05},Sh=.14,wh=9.76,ht=[.93,.94,.95],Mo=[.1,.11,.13],Ph=[.45,.85,1.25],Ih=1.45,Qs=.012,Js=.004,Ah=1.07,Rh=.15;function nn(e,t,n,o,i,r){e.setMaterial(r),ue(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,i,i,ce)}var ec=(e,t)=>gt(e,t/_);function tc(e,t,n){let o=t.x-e.x,i=t.y-e.y,r=Math.hypot(o,i);if(r<1e-9)return null;let a=-i/r*n,s=o/r*n;return[{x:e.x+a,y:e.y+s},{x:t.x+a,y:t.y+s},{x:t.x-a,y:t.y-s},{x:e.x-a,y:e.y-s}]}function Eh(e,t,n,o){let i=t.map(r=>[r.x*_,n,r.y*_]);e.tri(i[0],i[1],i[2],[0,1,0],o),e.tri(i[0],i[2],i[3],[0,1,0],o)}function So(e,t,n,o,i,r){let a=n/_,s=[{x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a},{x:t.x-a,y:t.y+a}];ue(e,s,void 0,()=>i,o,r,le(r,.85),ce)}function tn(e,t,n,o,i,r,a){let s=tc(t,n,o/_);s&&ue(e,s,void 0,()=>r,i,a,le(a,.85),ce)}function wo(e){let t=Ge(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,i=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,r={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},a={x:(t[3].x-t[0].x)/i,y:(t[3].y-t[0].y)/i};return{at:(c,m)=>({x:n.x+(r.x*c+a.x*m)/_,y:n.y+(r.y*c+a.y*m)/_}),lengthM:o*_,widthM:i*_}}function nc(e,t,n){let o=ja(t);if(!o.length)return;let i=1/0,r=-1/0,a=1/0,s=-1/0;for(let S of t.points??[])i=Math.min(i,S.x),r=Math.max(r,S.x),a=Math.min(a,S.y),s=Math.max(s,S.y);let c=(t.rotation??0)*Math.PI/180,m=Math.cos(c),l=Math.sin(c),u=(i+r)/2,h=(a+s)/2,f=S=>c?{x:u+(S.x-u)*m-(S.y-h)*l,y:h+(S.x-u)*l+(S.y-h)*m}:S,d=Math.min(r-i,s-a)*_,p=Math.max(.04,Math.min(.3,d*.004))/_,b=0;e.setMaterial(0);for(let S of o){if(!S.fill)continue;let I=S.points.map(f);nn(e,I,null,n+Qs+b*Js,pe(S.fill)??ht,0),b++}let g=o.filter(S=>!(S.fill&&S.ink===S.fill)),x=[...new Set(g.map(S=>S.ink??uo))];for(let S of x){let I=n+Qs+b++*Js,M=pe(S)??ht;for(let y of g){if((y.ink??uo)!==S)continue;let P=y.points.map(f),v=y.closed?P.length:P.length-1;for(let w=0;w<v;w++){let R=tc(P[w],P[(w+1)%P.length],p);R&&Eh(e,R,I,M)}}}}function oc(e,t,n,o,i){if(t.length<3)return!1;let r=o+.006,a=i??gh;if(n==="oval-cricket"){let s=t.reduce((M,y)=>M+y.x,0)/t.length,c=t.reduce((M,y)=>M+y.y,0)/t.length,m=M=>t.map(y=>({x:s+(y.x-s)*M,y:c+(y.y-c)*M})),l=8;for(let M=0;M<l;M++){let y=m(1-M/l),P=M===l-1?null:m(1-(M+1)/l);nn(e,y,P,r,le(a,M%2?1.04:.96),4)}let u=t[0];for(let M of t)Math.hypot(M.x-s,M.y-c)>Math.hypot(u.x-s,u.y-c)&&(u=M);let h=Math.hypot(u.x-s,u.y-c)||1,f=(u.x-s)/h,d=(u.y-c)/h,p=-d,b=f,g=Math.min(1,2*h*_*Sh/Gr.length),x=Gr.length*g/2/_,S=Gr.width*g/2/_,I=[[-x,-S],[x,-S],[x,S],[-x,S]].map(([M,y])=>({x:s+f*M+p*y,y:c+d*M+b*y}));return nn(e,I,null,r+.004,xh,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let s=ec(t,Rh);return nn(e,s,null,r,vh,0),e.setMaterial(0),ue(e,t,[s.slice().reverse()],()=>o+Ah,o,Zs,le(Zs,.9),ce),!0}if(n==="ring-boxing"&&t.length===4){let{at:s}=wo(t),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],m=[[.77,.19,.19],ht,[.17,.42,.69],ht];e.setMaterial(0),c.forEach((l,u)=>So(e,l,.07,o,o+Ih,m[u]));for(let l of Ph)for(let u=0;u<4;u++)tn(e,c[u],c[(u+1)%4],.025,o+l-.025,o+l+.025,ht);return!0}if(n==="court-tennis"&&t.length===4){let{at:s}=wo(t);e.setMaterial(0),tn(e,s(0,-6.4),s(0,6.4),.015,o,o+.95,Mo),tn(e,s(0,-6.4),s(0,6.4),.03,o+.95,o+1,ht);for(let c of[-1,1])So(e,s(0,c*6.4),.05,o,o+1.07,Mo);return!0}if(n==="court-basketball"&&t.length===4){let{at:s,lengthM:c}=wo(t),m=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let u=s(l*(m+1.2),0),h=s(l*(m-1.2),0);So(e,u,.12,o,o+3.4,Mo),tn(e,u,h,.06,o+3.25,o+3.4,Mo),tn(e,s(l*(m-1.2),-.9),s(l*(m-1.2),.9),.03,o+2.9,o+3.95,ht)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:s,lengthM:c}=wo(t),m=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let u of[-2.8,2.8])So(e,s(l*m,u),.07,o,o+12,ht);tn(e,s(l*m,-2.8),s(l*m,2.8),.06,o+2.94,o+3.06,ht)}return!0}if(n==="track-athletics"){let s=ec(t,wh);return s.length<3?!1:(nn(e,t,s,r,Mh,0),nn(e,s,null,r,a,4),e.setMaterial(0),!0)}return!1}var rc=[.19,.4,.15],Ch=.012,Ao=2.4,_h=1,Th=.75,kh=.15;function Je(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:i}=e;if(!n||!o)return null;let r=(i??0)*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=n/2,m=o/2;return[[-c,-m],[c,-m],[c,m],[-c,m]].map(([l,u])=>({x:t.x+l*a-u*s,y:t.y+l*s+u*a}))}function uc(e,t,n,o,i,r,a=!1){let s=Je(t);if(s){if(a){let c=Nt(o,i.boothTop),m=rt([...s]);ue(e,Ze(m,Lh/_),[m.slice().reverse()],()=>n+.03,n,c,le(c,.8),ce);return}if(!(!t.points&&r&&Oh(e,s,n,o,r))){if(!t.points&&r&&s.length===4){Fh(e,s,n,o,r);return}ue(e,s,void 0,()=>n+Ao,n,Nt(o,i.boothTop),i.boothWall,ce)}}}var zr=1.1,ic=[.9,.9,.88],Lh=.1,Po=[.87,.87,.85],ac=.08;function mc(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,i=1/0;for(let c=0;c<4;c++){let m=n(c),l=Math.hypot(m.x-t.x,m.y-t.y);l<i&&(i=l,o=c)}let r=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,m,l)=>({x:c.x+(m.x-c.x)*l,y:c.y+(m.y-c.y)*l});return{q:r,part:(c,m,l,u)=>{let h=a(r[0],r[1],c),f=a(r[0],r[1],m),d=a(r[3],r[2],c),p=a(r[3],r[2],m);return[a(h,d,l),a(f,p,l),a(f,p,u),a(h,d,u)]},depthM:Math.hypot(r[3].x-r[0].x,r[3].y-r[0].y)*_,widthM:Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*_}}function Fh(e,t,n,o,i){let{q:r,part:a}=mc(t,i),s=o??[.35,.42,.55],c=be(s,[.78,.78,.77],.62),m=be(s,[.95,.95,.94],.45);de(e,r,n+Mt,n,c,le(c,.8)),de(e,a(.05,.95,.72,.98),n+zr-.05,n+Mt,m,le(m,.8)),de(e,a(.03,.97,.7,1),n+zr,n+zr-.05,ic,le(ic,.9))}function Oh(e,t,n,o,i){if(t.length!==4)return!1;let{q:r,part:a,depthM:s,widthM:c}=mc(t,i);if(s<1||c<1)return!1;let m=o??[.35,.42,.55],l=be(m,[.78,.78,.77],.62),u=n+Ao,h=ac/c,f=ac/s;de(e,r,n+Mt,n,l,le(l,.8)),de(e,a(0,1,1-f,1),u,n+Mt,Po,le(Po,.9));for(let[b,g]of[[0,h],[1-h,1]])de(e,a(b,g,0,1-f),u,n+Mt,Po,le(Po,.9));de(e,a(h,1-h,0,Math.min(.5,.06/s)),u,u-.3,m,le(m,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return de(e,a(.5-d,.5+d,.72-p,.72+p),n+_h,n+Mt,be(m,[.95,.95,.94],.7),le(m,.75)),!0}function Ro(e){if(e.shape==="round"){let l=e.radius;return l?so(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:o,center:i}=e;if(!t||!n)return null;let r=(o??0)*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=t/2,m=n/2;return[[-c,-m],[c,-m],[c,m],[-c,m]].map(([l,u])=>({x:i.x+l*a-u*s,y:i.y+l*s+u*a}))}function fc(e,t,n,o,i,r=!0){let a=Ro(t);if(!a)return;let s=a.reduce((h,f)=>h+f.x,0)/a.length,c=a.reduce((h,f)=>h+f.y,0)/a.length,m=h=>a.map(f=>({x:s+(f.x-s)*h,y:c+(f.y-c)*h})),l=r&&o?Nt(o,i.tableTop):Dh,u=n+Th;ue(e,a,void 0,()=>u,n+Nh,l,le(l,.86),ce),ue(e,m(.12),void 0,()=>u+.12,u,sc,le(sc,.8),ce)}var Dh=[.93,.92,.89],sc=[.78,.66,.42],Nh=.25,Dn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Bh(e,t,n){let o=e.reduce((g,x)=>g+x.x,0)/4,i=e.reduce((g,x)=>g+x.y,0)/4,r=e[3].x-e[0].x,a=e[3].y-e[0].y,s=Math.hypot(r,a)||1;r/=s,a/=s,r*(t.x-o)+a*(t.y-i)<0&&(r=-r,a=-a);let c=-a,m=r,l=Dn.armM/_,u=Dn.widthM/_,h=s/2+Dn.insideM/_,f=n?-1:1,d=o+r*(h+(n?0:l)),p=i+a*(h+(n?0:l)),b=(g,x)=>({x:d+r*g*f+c*x,y:p+a*g*f+m*x});return[b(0,0),b(-l,l),b(-l-u,l),b(-u,0),b(-l-u,-l),b(-l,-l)]}function Vh(e,t,n,o,i){let r=[.94,.95,.96];ue(e,Bh(t,o,i),void 0,()=>n+Dn.high,n+Dn.low,r,r,ce)}function dc(e,t,n,o,i,r,a,s,c=[]){let m=Se(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!m){On(e,t,n+o+Ch);return}let u=s?s.kind==="stage":t.role==="stage",h=s?s.kind==="screen":t.role==="screen",f=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Qe(t),d=s?.baseY??n,p=s?.topY??n+o;if(u&&a){let v=1/0,w=-1/0,R=1/0,C=-1/0;for(let O of m)O.x<v&&(v=O.x),O.x>w&&(w=O.x),O.y<R&&(R=O.y),O.y>C&&(C=O.y);a.push({cx:(v+w)/2*_,cz:(R+C)/2*_,y:p,halfX:Math.max((w-v)/2*_,.5),halfZ:Math.max((C-R)/2*_,.5)})}let b=pe(t.fill),g=t.role==="wall"||t.role==="entrance"||t.role==="exit",x=g?b?le(qe(b,.12),.95):i.tierTop:u&&b?be(i.stageTop,le(qe(b,.18),.9),.9):!t.role&&b?b:Nt(b,u?i.stageTop:i.decorTop),S=h?b:null,I=g?b?le(qe(b,.12),.85):i.tierWall:u?b?be(i.stageWall,le(b,.58),.82):i.stageWall:h?S?be(le(S,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Nt(pe(t.fill),i.decorWall);if(t.role==="wall"&&!s){Ks(e,m,d,p,c,x,I,r),On(e,t,p+.012);return}if(h&&m.length===4&&p-d>.2){let v=Vr(m,d,p);if(!v)return;let{quad:w,side:R,trim:C,inner:O,panel:E}=v,A=[.12,.15,.18];for(let[T,L]of[[0,R],[1-R,1]])de(e,Le(w,T,L),p,d,A,A);de(e,O,d+C,d,A,A),de(e,O,p,p-C,A,A),de(e,E,p-C,d+C,I,I),On(e,t,p+.012);return}let M=b?le(qe(b,.15),.82):I,y=b?le(qe(b,.1),1.02):x;if($s(t.role)&&!s&&qs(e,t.role,m,d,p,M,y,r,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&m.length===4&&p-d>.3){let v=Ge(m),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*_,R=Math.min(.12,.09/Math.max(w,.001)),C=[.18,.21,.24],O=p-Math.min(.12,(p-d)*.15);for(let[E,A]of[[0,R],[1-R,1]])de(e,Le(v,E,A),O,d,C,C);de(e,v,p,O,x,C);return}if(t.role==="rail"&&m.length===4&&p>d){let v=Ge(m),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*_,R=Math.max(1,Math.min(128,Math.ceil(w/1.4))),C=Math.min(.08,.055/Math.max(.055,w)),O=[.58,.64,.66];for(let E=0;E<=R;E++){let A=E/R,T=Math.min(1-C,Math.max(0,A-C/2));de(e,Le(v,T,T+C),p,d,O,le(O,.8))}for(let E of[.52,1]){let A=d+(p-d)*E;de(e,v,A,Math.max(d,A-.055),O,le(O,.8))}return}if(t.role==="goal"&&m.length===4){let v=Ge(m),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*_,R=Math.min(.12,.1/Math.max(.1,w)),C=[.9,.94,.94];for(let[O,E]of[[0,R],[1-R,1]])de(e,Le(v,O,E),Math.max(d,p-.1),d,C,C);de(e,v,p,Math.max(d,p-.1),C,C);return}if(f.kind==="portal"&&m.length===4){let v=Jt(m,d,p);if(!v)return;let{quad:w,side:R,face:C,openingTop:O}=v;for(let[E,A,T]of[[0,C,1],[C,1-C,.67],[1-C,1,1]]){let L=Fn(w,E,A),V=le(x,T),F=le(I,T);for(let[G,j]of[[0,R],[1-R,1]])de(e,Le(L,G,j),O,d,V,F);de(e,L,p,O,V,F)}(t.role==="entrance"||t.role==="exit")&&Vh(e,w,d,r,t.role==="exit");return}if(f.kind==="suite"&&m.length===4){let v=m.map((C,O)=>{let E=m[(O+1)%4],A=(C.x+E.x)/2,T=(C.y+E.y)/2;return Math.hypot(A-r.x,T-r.y)}),w=v.indexOf(Math.min(...v)),R=[0,1,2,3].map(C=>m[(w+C)%4]);de(e,Le(R,0,.08),p,d,x,I),de(e,Le(R,.92,1),p,d,x,I),de(e,Fn(R,.88,1),p,d,x,I),de(e,R,p,Math.max(d,p-.18),x,I);return}if(u&&!t.stageKind?.startsWith("pitch-")&&p-d>.12){let v=p-Math.min(.06,(p-d)*.15);de(e,m,v,d,x,I),de(e,m,p,v,x,be(x,I,.2))}else de(e,m,p,d,x,I);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&m.length===4){e.setMaterial(4);let v=Ge(m),w=be(b??rc,rc,b?.45:0);for(let R=0;R<12;R++){let C=Le(v,R/12,(R+1)/12),O=le(w,R%2?1.09:.91),E=C.map(A=>[A.x*_,p+.006,A.y*_]);e.tri(E[0],E[1],E[2],[0,1,0],O),e.tri(E[0],E[2],E[3],[0,1,0],O)}}t.stageKind&&t.stageKind!=="pitch-football"&&oc(e,m,t.stageKind,p,b),u&&Ot(t.stageKind)&&nc(e,t,p),e.setMaterial(h?1:0),On(e,t,p+.012)}function Eo(e){let{x:t,y:n,width:o,height:i}=e;if(!o||!i)return null;let r=t+o/2,a=n+i/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),m=Math.sin(s),l=o/2,u=i/2;return[[-l,-u],[l,-u],[l,u],[-l,u]].map(([h,f])=>({x:r+h*c-f*m,y:a+h*m+f*c}))}function Hh(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 o=n[1].trim();if(o==="none"||o==="transparent")return null;let i=o.match(/^url\(#([^)]+)\)$/);if(!i)return pe(o);let r=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${i[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!r)return null;let a=[];for(let s of r[1].matchAll(/stop-color="([^"]+)"/gi)){let c=pe(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,m)=>be(s,c,1/(m+1)),a[0]):null}function hc(e,t,n,o){if(t.layer==="foreground")return;let i=Eo(t);if(!i)return;let r=n+kh,a=Nt(Hh(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=be(o.ground,a,s)),ue(e,i,void 0,()=>r,n,a,be(a,o.decorWall,.5),ce)}function pc(e,t,n,o,i){if(!t.points||t.points.length<3)return;let r=ps(o,i.gaTop);ue(e,t.points,t.holes,()=>n+cc,n,r,i.gaWall,ce),Uh(e,t.points,n+cc)}var cc=.15,Io=[.72,.74,.76],Ur=1.1,lc=.12,jr=.05,Gh=.06,zh=2.4;function Uh(e,t,n){let o=rt([...t]),i=gt(o,lc/_),r=gt(o,(lc+jr)/_);if(i.length<3||r.length<3)return;for(let s of[n+Ur,n+Ur*.5])ue(e,i,[r.slice().reverse()],()=>s,s-jr,Io,le(Io,.85),ce);let a=Gh/2/_;for(let s=0;s<i.length;s++){let c=i[s],m=i[(s+1)%i.length],l=Math.hypot(m.x-c.x,m.y-c.y)*_,u=Math.max(1,Math.round(l/zh));for(let h=0;h<u;h++){let f=h/u,d=c.x+(m.x-c.x)*f,p=c.y+(m.y-c.y)*f,b=[{x:d-a,y:p-a},{x:d+a,y:p-a},{x:d+a,y:p+a},{x:d-a,y:p+a}];ue(e,b,void 0,()=>n+Ur-jr,n,Io,le(Io,.8),ce)}}}var Wr=.6,bc=3,jh=.25;function Wh(e,t){if(He(t,e.x,e.y))return 0;let n=1/0;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[i],a=t[o],s=a.x-r.x,c=a.y-r.y,m=s*s+c*c||1,l=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/m));n=Math.min(n,Math.hypot(e.x-(r.x+l*s),e.y-(r.y+l*c)))}return n}function yc(e,t){let n=e.map(a=>({booth:a,ring:Je(a)})).filter(a=>!!a.ring&&a.ring.length===4&&!a.booth.points),o=n.map(({ring:a})=>({minX:Math.min(...a.map(s=>s.x)),maxX:Math.max(...a.map(s=>s.x)),minY:Math.min(...a.map(s=>s.y)),maxY:Math.max(...a.map(s=>s.y))})),i=(bc+Wr)/_,r=new Map;return n.forEach(({booth:a,ring:s},c)=>{let m={x:s.reduce((f,d)=>f+d.x,0)/4,y:s.reduce((f,d)=>f+d.y,0)/4},l=[0,1,2,3].map(f=>{let d=s[f],p=s[(f+1)%4],b={x:(d.x+p.x)/2,y:(d.y+p.y)/2},g=b.x-m.x,x=b.y-m.y,S=Math.hypot(g,x)||1,I={x:b.x+g/S*Wr/_,y:b.y+x/S*Wr/_},M=bc/_;return o.forEach((y,P)=>{P===c||I.x<y.minX-i||I.x>y.maxX+i||I.y<y.minY-i||I.y>y.maxY+i||(M=Math.min(M,Wh(I,n[P].ring)))}),{open:M*_,toward:{x:b.x+g/S*10/_,y:b.y+x/S*10/_},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),u=Math.max(...l.map(f=>f.open)),h=l.filter(f=>f.open>=u-jh).sort((f,d)=>f.focal-d.focal)[0];r.set(a.id,h.toward)}),r}var gc=nt(require("polygon-clipping"),1);var Xh=.45,Yh=1500,Kh=200;function xc(e,t){if(e.role!=="stage"||Ot(e.stageKind))return e;let n=Se(e);if(!n||n.length<3||Math.abs(Ve(n))*_*_>Yh)return e;let o=t.filter(a=>He(n,a.x,a.y));if(!o.length||o.length>Kh)return e;let i=Xh/_,r=o.map(a=>[[[a.x-i,a.y-i],[a.x+i,a.y-i],[a.x+i,a.y+i],[a.x-i,a.y+i],[a.x-i,a.y-i]]]);try{let a=gc.default.difference([[...n.map(m=>[m.x,m.y]),[n[0].x,n[0].y]]],...r),s=null,c=0;for(let m of a){let l=m[0].slice(0,-1).map(([h,f])=>({x:h,y:f})),u=Math.abs(Ve(l));u>c&&(c=u,s=l)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var $h=Math.PI/180,Me=96,qh=6,Zh=60,Qh=150,vc=.2,Jh=.35;function ep(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/$h;return n<0?n+360:n}function Co(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function _o(e,t,n=2){let o=e.length,i=new Float64Array(o);for(let r=0;r<o;r++){let a=0,s=0;for(let c=-n;c<=n;c++){let m=r+c;if(t)m=(m%o+o)%o;else if(m<0||m>=o)continue;a+=e[m],s++}i[r]=a/s}return i}function Mc(e,t){let n=e.filter(h=>h.rows.length>=1);if(n.length<1)return null;let o=[],i=0,r=0,a=0;for(let h of n)for(let f of h.rows){for(let d of f.pts)i+=d.x,r+=d.y,a++;if(f.pts.length>=4){let d=Er(f.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!a)return null;let s={x:i/a,y:r/a},c=s;if(o.length>=8){let h=Co(o.map(g=>g.x)),f=Co(o.map(g=>g.y)),d=0;for(let g of n)for(let x of g.rows)for(let S of x.pts){let I=Math.hypot(S.x-s.x,S.y-s.y);I>d&&(d=I)}let p=0,b=d*.2;for(let g of n)for(let x of g.rows)for(let S of x.pts)Math.hypot(S.x-h,S.y-f)<b&&p++;Math.hypot(h-s.x,f-s.y)<=d&&p/a<.01&&(c={x:h,y:f})}let m=[];for(let h of n){let f={sectionId:h.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of h.rows)for(let p of d.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),g=Math.min(Me-1,Math.floor(ep(c,p)/(360/Me)));f.samples.push({r:b,bin:g,levelM:d.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&m.push(f)}if(!m.length)return null;m.sort((h,f)=>h.rMin+h.rMax-(f.rMin+f.rMax));let l=[];for(let h of m){let f=!1;for(let d of l){let p=Math.min(h.rMax,d.rMax)-Math.max(h.rMin,d.rMin),b=Math.min(h.rMax-h.rMin,d.rMax-d.rMin);if(b>1e-9&&p>=Jh*b){d.members.push(h),d.rMin=Math.min(d.rMin,h.rMin),d.rMax=Math.max(d.rMax,h.rMax),f=!0;break}}f||l.push({members:[h],rMin:h.rMin,rMax:h.rMax})}let u=[];for(let h of l){let f=new Array(Me).fill(null);for(let E of h.members)for(let A of E.samples){let T=f[A.bin];T||(T={samples:[]},f[A.bin]=T),T.samples.push({r:A.r,levelM:A.levelM})}let d=f.map(E=>!!E);if(!d.filter(Boolean).length)continue;let b=[],g=[];for(let E of f){if(!E)continue;let A=1/0,T=-1/0;for(let L of E.samples)L.r<A&&(A=L.r),L.r>T&&(T=L.r);b.push(A),g.push(T)}let x=Co(b),S=Co(g);if(!(x>=vc*S)||!(S>0))continue;let I=[...b].sort((E,A)=>E-A);if(!(I[Math.floor(I.length*.1)]>=vc*S))continue;let y=f.map(E=>{if(!E)return null;let A=[...E.samples].sort((k,B)=>k.r-B.r),T=A[0].r,L=A[A.length-1].r,V=A[0].levelM,F=-1/0;for(let k of A)k.levelM>F&&(F=k.levelM);let G=[];for(let k of A){let B={r:k.r,l:k.levelM};for(;G.length&&Math.abs(G[G.length-1].r-B.r)<1e-9;){if(G[G.length-1].l<=B.l){B.skip=!0;break}G.pop()}if(!B.skip){for(;G.length>=2;){let D=G[G.length-2],H=G[G.length-1];if((H.r-D.r)*(B.l-D.l)-(H.l-D.l)*(B.r-D.r)<=0)G.pop();else break}G.push(B)}}let j=G.map(k=>k.r),N=G.map(k=>k.l);return{inner:T,outer:L,front:V,top:F,profile:{rs:j,ls:N}}}),P=d.slice();for(let E=0;E<Me;E++){if(P[E])continue;let A=-1,T=-1,L=0;for(let U=1;U<=Me;U++){let q=(E-U+Me*2)%Me;if(P[q]){A=q;break}}for(let U=1;U<=Me;U++){let q=(E+U)%Me;if(P[q]){T=q,L=U;break}}if(A<0||T<0)continue;let V=0;for(let U=1;U<=Me;U++){let q=(E-U+Me*2)%Me;if(d[q]){V=U;break}}if(V-1+L>qh)continue;let G=y[A],j=y[T],N=V/(V+L),k=G.inner+(j.inner-G.inner)*N,B=G.outer+(j.outer-G.outer)*N,D=G.front+(j.front-G.front)*N,H=G.top+(j.top-G.top)*N;y[E]={inner:k,outer:B,front:D,top:H,profile:{rs:[k,B],ls:[D,H]}}}for(let E=0;E<Me;E++)y[E]&&(P[E]=!0);let v=360/Me,w=[],R=P.filter(Boolean).length,C=[];if(R===Me)C.push({start:0,len:Me});else{let E=0;for(;P[E];)E=(E+1)%Me;let A=-1;for(let T=0;T<=Me;T++){let L=(E+T)%Me,V=T<Me&&P[L];if(V&&A<0)A=L;else if(!V&&A>=0){let F=(L-A+Me)%Me||Me;C.push({start:A,len:F}),A=-1}}}for(let E of C){if(E.len*v<Zh&&E.len<Me)continue;let A=E.len===Me,T=new Float64Array(E.len),L=new Float64Array(E.len),V=new Float64Array(E.len),F=new Float64Array(E.len),G=[];for(let U=0;U<E.len;U++){let q=y[(E.start+U)%Me];T[U]=q.inner,L[U]=q.outer,V[U]=q.front,F[U]=q.top,G.push(q.profile??{rs:[q.inner,q.outer],ls:[q.front,q.top]})}let j=_o(T,A),N=_o(L,A),k=_o(V,A),B=_o(F,A);for(let U=0;U<E.len;U++)j[U]>T[U]&&(j[U]=T[U]),N[U]<L[U]&&(N[U]=L[U]),j[U]>N[U]-1e-6&&(j[U]=Math.max(0,N[U]-1e-6)),B[U]<k[U]&&(B[U]=k[U]);let D={startBin:E.start,binCount:E.len,closed:A,innerR:j,outerR:N,frontLevelM:k,topLevelM:B,profiles:G},H=(U,q,$)=>{let ee=G[U],Q=ee.rs,X=ee.ls;if(q<=Q[0]){X[0]>$&&(X[0]=$);return}if(q>=Q[Q.length-1]){X[X.length-1]>$&&(X[X.length-1]=$);return}for(let K=0;K+1<Q.length;K++)if(q<=Q[K+1]){X[K]>$&&(X[K]=$),X[K+1]>$&&(X[K+1]=$);return}};for(let U=0;U<E.len;U++){let q=f[(E.start+U)%Me];if(q)for(let $ of q.samples){H(U,$.r,$.levelM);let ee=A?(U-1+E.len)%E.len:U-1,Q=A?(U+1)%E.len:U+1;ee>=0&&H(ee,$.r,$.levelM),Q<E.len&&H(Q,$.r,$.levelM)}}w.push(D)}w.reduce((E,A)=>E+A.binCount*v,0)<Qh||u.push({arcs:w,sectionIds:h.members.map(E=>E.sectionId),innerRMedian:x,outerRMedian:S})}if(!u.length)return null;if(u.sort((h,f)=>h.innerRMedian-f.innerRMedian),t){let h=u[u.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*h)return null}return{centre:c,binCount:Me,binStepDeg:360/Me,rings:u}}function Sc(e,t,n,o){let i=e.binStepDeg,r=n/i-.5-t.startBin;r=(r%e.binCount+e.binCount)%e.binCount,r>t.binCount-1&&(t.closed?r=r-t.binCount<t.binCount-r?0:t.binCount-1:r=r-(t.binCount-1)<e.binCount-r?t.binCount-1:0);let a=Math.floor(r),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=r-a,m=l=>{let u=t.profiles[l],h=u.rs,f=u.ls;if(o<=h[0])return f[0];if(o>=h[h.length-1])return f[f.length-1];for(let d=0;d+1<h.length;d++)if(o<=h[d+1]){let p=h[d+1]-h[d],b=p>1e-9?(o-h[d])/p:0;return f[d]+(f[d+1]-f[d])*b}return f[f.length-1]};return m(a)*(1-c)+m(s)*c}function Xr(e,t,n,o,i,r,a,s,c,m=[],l=i){if(t.length!==n.length||t.length<2||r-i<1.5)return;let u=(p,b,g)=>{dt(e,p,b,g,m,a,s,{portalBase:l,ao:c})||ue(e,p,void 0,()=>g,b,a,s,c)},h=(p,b,g)=>({x:p.x+(b.x-p.x)*g,y:p.y+(b.y-p.y)*g}),f=o?t.length:t.length-1,d=0;for(let p=0;p<f;p++){let b=(p+1)%t.length,g=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*fe;if(g<1e-5)continue;let x=(y,P)=>[h(t[p],t[b],y),h(t[p],t[b],P),h(n[p],n[b],P),h(n[p],n[b],y)];u(x(0,1),i,i+.95),u(x(0,1),r-.22,r);let S=Math.ceil((d-.32)/6)*6,I=!1,M=!1;for(let y=S;y<d+g;y+=6){let P=Math.max(0,(y-d)/g),v=Math.min(1,(y+.32-d)/g);v<=P||(u(x(P,v),i+.95,r-.22),I||=P<1e-6,M||=v>1-1e-6)}if(!o&&(p===0&&!I||p===f-1&&!M)){let y=Math.min(1,.32/g);u(x(p===0?0:1-y,p===0?y:1),i+.95,r-.22)}d+=g}}var St=nt(require("polygon-clipping"),1),Bn=.65;function Yr(e,t){let n=1/0;for(let o of t)for(let i=0;i<o.length;i++){let r=o[i],a=o[(i+1)%o.length],s=a.x-r.x,c=a.y-r.y,m=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/(s*s+c*c||1)));n=Math.min(n,Math.hypot(e.x-r.x-m*s,e.y-r.y-m*c))}return n}var Kr=.01;function wc(e,t,n,o,i,r,a,s=[],c=!0,m={bays:[],walls:[]}){if(o-i<=1e-5)return;let l=o-i>=3,u=l?o-Bn:i;e.setMaterial(5);let h=l?[]:s.filter(y=>{if(y.role!=="entrance"&&y.role!=="exit")return!1;let P=Se(y);if(!P)return!1;let v=Jt(P,i,i+Qe(y).heightM);return v!==null&&v.openingTop<=o-.12});if((!h.length||!dt(e,t,u,o,h,r,a,{holes:n,portalBase:i}))&&ue(e,t,n,()=>o,u,r,a,ce,void 0,()=>[0,1,0]),!l){e.setMaterial(0);return}let f=c&&m.bays.length?tp(t,n,gt(t,Nn/_),m):null,d=6/_,p=.22/_,b=s.flatMap(y=>{if(y.role!=="entrance"&&y.role!=="exit")return[];let P=Se(y);return P?.length?[{minX:Math.min(...P.map(v=>v.x)),maxX:Math.max(...P.map(v=>v.x)),minY:Math.min(...P.map(v=>v.y)),maxY:Math.max(...P.map(v=>v.y))}]:[]}),g=Math.min(...t.map(y=>y.x)),x=Math.max(...t.map(y=>y.x)),S=Math.min(...t.map(y=>y.y)),I=Math.max(...t.map(y=>y.y));for(let y=g+d/2;y<x;y+=d)for(let P=S+d/2;P<I;P+=d){if(b.some(w=>y+p>=w.minX&&y-p<=w.maxX&&P+p>=w.minY&&P-p<=w.maxY))continue;let v=[{x:y-p,y:P-p},{x:y+p,y:P-p},{x:y+p,y:P+p},{x:y-p,y:P+p}];!Oe({x:y,y:P},t,n)||Yr({x:y,y:P},[t,...n??[]])<p*Math.SQRT2+(c?Nn/_:0)||f&&Yr({x:y,y:P},f.flat())<p*Math.SQRT2+Nn/_||ue(e,v,void 0,()=>u,i,r,a,ce)}if(f){for(let[y,...P]of f)ue(e,y,P,()=>u,i-Kr,r,a,ce);e.setMaterial(0);return}let M=gt(t,Nn/_);if(c&&M.length>=3){let y=s.filter(w=>{if(w.role!=="entrance"&&w.role!=="exit")return!1;let R=Se(w);return!!R&&R.some(C=>!Oe(C,t,void 0)||Yr(C,[t])<=Nn/_)}),P=[M.slice().reverse()],v=i-Kr;(!y.length||!dt(e,t,v,u,y,r,a,{holes:P,portalBase:i+Kr}))&&ue(e,t,P,()=>u,v,r,a,ce)}e.setMaterial(0)}var $r=.25,Nn=$r;function tp(e,t,n,o){if(n.length<3)return null;let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},r=a=>{let[s,...c]=a.map(m=>[i(m)]);return St.default.union(s,...c)};try{let a=[i(e),...(t??[]).map(i)],s=St.default.difference(a,[i(n)]),c=St.default.intersection(a,r(o.bays));if(!c.length)return null;let m=St.default.difference(St.default.intersection(a,r(o.walls)),c);return St.default.union(St.default.difference(s,c),m).map(u=>u.map(h=>h.slice(0,-1).map(([f,d])=>({x:f,y:d}))))}catch{return null}}var np=.02,op=.25,rp=1.2,ip=.6,ap=.45,sp=2.3,cp=Math.PI/180,Pc=.005;function it(e,t,n){let o=n*cp;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function lp(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let i of e){if(i.role!=="wall")continue;let r=i.points&&i.points.length>=2?i.points:i.x!==void 0&&i.y!==void 0&&i.width!==void 0&&i.height!==void 0?[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}]:[];if(r.length<2)continue;let a=0;for(let s of r)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=o&&a++;if(a>=r.length/2)return!0}return!1}var up=24,mp=.01;function fp(e,t,n,o,i,r,a,s,c){let m=n.binCount,l=up,u=fe,h=r+.02,f=r-mp,d=[];for(let A=0;A<m;A++){let T=(n.startBin+A+.5)*t.binStepDeg,L=new Float64Array(l+1);for(let V=0;V<=l;V++){let F=o[A]+(i[A]-o[A])*V/l;L[V]=Math.max(h,Sc(t,n,T,F)-op)}d.push(L)}if(c){let A=0;for(let T=0;T+1<m;T++)for(let L=0;L<l;L++){let V=it(t.centre,o[T]+(i[T]-o[T])*L/l,(n.startBin+T+.5)*t.binStepDeg),F=it(t.centre,o[T+1]+(i[T+1]-o[T+1])*(L+1)/l,(n.startBin+T+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(F.x-V.x,F.y-V.y))}for(let T=0;T<m;T++){let L=(n.startBin+T+.5)*t.binStepDeg;for(let V=0;V<=l;V++){let F=it(t.centre,o[T]+(i[T]-o[T])*V/l,L),G=c(F.x,F.y,A*1.01);G!==null&&(d[T][V]=Math.min(d[T][V],Math.max(f+Pc,G-Pc)))}}}let p=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],b=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],g=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],x=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],S=(A,T)=>{let L=(n.startBin+A+.5)*t.binStepDeg,V=o[A]+(i[A]-o[A])*T/l,F=it(t.centre,V,L);return[F.x*u,d[A][T],F.y*u]};{let A=Math.tan(12*Math.PI/180);for(let T=0;T<6;T++){let L=!1;for(let F=0;F<m;F++)for(let G=l-1;G>=0;G--)d[F][G]>d[F][G+1]&&(d[F][G]=d[F][G+1],L=!0);let V=n.closed?m:m-1;for(let F=0;F<V;F++){let G=(F+1)%m;for(let j=0;j<=l;j++){let N=d[G][j]-d[F][j];if(Math.abs(N)>1)continue;let k=o[F]+(i[F]-o[F])*j/l,B=o[G]+(i[G]-o[G])*j/l,D=it(t.centre,k,(n.startBin+F+.5)*t.binStepDeg),H=it(t.centre,B,(n.startBin+G+.5)*t.binStepDeg),U=A*Math.hypot(H.x-D.x,H.y-D.y)*u;N>U?(d[G][j]=d[F][j]+U,L=!0):-N>U&&(d[F][j]=d[G][j]+U,L=!0)}}if(!L)break}}let I=1,M=(A,T)=>{for(let L=0;L<=l;L+=4)if(Math.abs(d[A][L]-d[T][L])>I)return!0;return Math.abs(d[A][l]-d[T][l])>I},y=Math.tan(38*Math.PI/180),P=A=>(i[A]-o[A])/l*u,v=(A,T)=>d[A][T+1]-d[A][T]>y*Math.max(1e-6,P(A)),w=(A,T)=>{let L=n.closed?(A-1+m)%m:Math.max(0,A-1),V=n.closed?(A+1)%m:Math.min(m-1,A+1);Math.abs(d[L][T]-d[A][T])>I&&(L=A),Math.abs(d[V][T]-d[A][T])>I&&(V=A);let F=Math.max(0,T-1),G=Math.min(l,T+1);F<T&&v(A,F)&&(F=T),G>T&&v(A,T)&&(G=T);let j=S(L,T),N=S(V,T),k=S(A,F),B=S(A,G),D=N[0]-j[0],H=N[1]-j[1],U=N[2]-j[2],q=B[0]-k[0],$=B[1]-k[1],ee=B[2]-k[2],Q=H*ee-U*$,X=U*q-D*ee,K=D*$-H*q,Y=Math.hypot(Q,X,K);return Y>1e-12?(Q/=Y,X/=Y,K/=Y,X<0&&(Q=-Q,X=-X,K=-K),[Q,X,K]):[0,1,0]},R=(A,T,L=!1)=>{let V=L&&Math.min(A[1],T[1])-r>=3,F=[A[0],V?A[1]-Bn:f,A[2]],G=[T[0],V?T[1]-Bn:f,T[2]],j=T[0]-A[0],N=T[2]-A[2],k=Math.hypot(j,N);if(!(k>1e-12))return;let B=[N/k,0,-j/k];e.tri(A,T,G,B,g,g,x),e.tri(A,G,F,B,g,x,x)},C=.05*je,O=A=>i[A]-o[A]<C,E=n.closed?m:m-1;for(let A=0;A<E;A++){let T=(A+1)%m;if(O(A)||O(T))continue;if(M(A,T)){let N=(n.startBin+A+1)*t.binStepDeg,k=($,ee)=>{let Q=(o[A]+o[T])/2,X=(i[A]+i[T])/2,K=Q+(X-Q)*ee/l,Y=it(t.centre,K,N);return[Y.x*u,d[$][ee],Y.y*u]};for(let $=0;$<l;$++){let ee=S(A,$),Q=S(A,$+1),X=k(A,$),K=k(A,$+1),Y=w(A,$),ie=w(A,$+1);e.triN(ee,X,K,Y,Y,ie,p),e.triN(ee,K,Q,Y,ie,ie,p);let te=S(T,$),ae=S(T,$+1),J=k(T,$),oe=k(T,$+1),Pe=w(T,$),re=w(T,$+1);e.triN(J,te,ae,Pe,Pe,re,p),e.triN(J,ae,oe,Pe,re,re,p);let ge=k(A,$),xe=k(A,$+1),Ye=k(T,$+1),et=k(T,$),Ne=xe[0]-ge[0],Ke=xe[2]-ge[2],we=Math.hypot(Ne,Ke);if(we>1e-12){let Et=[Ke/we,0,-Ne/we];e.tri(ge,xe,Ye,Et,g),e.tri(ge,Ye,et,Et,g)}}let B=S(A,0),D=S(T,0),H=S(T,l),U=S(A,l),q=$=>[$[0],f,$[2]];Math.min(B[1],D[1])-r<3&&(e.tri(q(B),q(H),q(D),[0,-1,0],b),e.tri(q(B),q(U),q(H),[0,-1,0],b)),R(B,D,!0),R(U,H,!0);continue}for(let N=0;N<l;N++){let k=w(A,N),B=w(T,N),D=w(T,N+1),H=w(A,N+1);if(v(A,N)||v(T,N)){let Q=(xe,Ye)=>{let et=(n.startBin+xe+.5)*t.binStepDeg,Ne=o[xe]+(i[xe]-o[xe])*(N+.5)/l,Ke=it(t.centre,Ne,et);return[Ke.x*u,Ye,Ke.y*u]},X=S(A,N),K=S(T,N),Y=Q(A,d[A][N]),ie=Q(T,d[T][N]);e.triN(X,K,ie,k,B,B,p),e.triN(X,ie,Y,k,B,k,p);let te=S(T,N+1),ae=S(A,N+1),J=Q(A,d[A][N+1]),oe=Q(T,d[T][N+1]);e.triN(J,oe,te,H,D,D,p),e.triN(J,te,ae,H,D,H,p);let Pe=ie[0]-Y[0],re=ie[2]-Y[2],ge=Math.hypot(Pe,re);if(ge>1e-12){let xe=[-re/ge,0,Pe/ge];e.tri(Y,ie,oe,xe,g),e.tri(Y,oe,J,xe,g)}continue}let U=S(A,N),q=S(T,N),$=S(T,N+1),ee=S(A,N+1);e.triN(U,q,$,k,B,D,p),e.triN(U,$,ee,k,D,H,p)}let L=S(A,0),V=S(T,0),F=S(T,l),G=S(A,l),j=N=>[N[0],f,N[2]];Math.min(L[1],V[1])-r<3&&(e.tri(j(L),j(F),j(V),[0,-1,0],b),e.tri(j(L),j(G),j(F),[0,-1,0],b)),R(L,V,!0),R(G,F,!0)}if(!n.closed)for(let A of[0,m-1])for(let T=0;T<l;T++)R(S(A,T),S(A,T+1))}function Ic(e,t,n){let{bottomY:o,colors:i,ao:r}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let u of l.arcs){let h=new Float64Array(u.binCount),f=new Float64Array(u.binCount);for(let p=0;p<u.binCount;p++){let b=(u.startBin+p)%t.binCount,g=Math.max(0,u.innerR[p]-We);h[p]=Math.max(g,a[b]+.001),f[p]=Math.max(h[p]+.001,u.outerR[p]+We)}let d=0;for(let p=0;p<u.binCount;p++){let b=u.topLevelM[p]-o;b>d&&(d=b)}d>=rp&&fp(e,t,u,h,f,o,i,r,n.standTopNear);for(let p=0;p<u.binCount;p++){let b=(u.startBin+p)%t.binCount;f[p]>a[b]&&(a[b]=f[p])}}if(n.deriveShell===!1||lp(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=ip*je,m=ap*je;for(let l of s.arcs){let u=[],h=[];for(let w=0;w<l.binCount;w++){let R=(l.startBin+w+.5)*t.binStepDeg,C=l.outerR[w]+We+c;u.push(it(t.centre,C,R)),h.push(it(t.centre,C+m,R))}let f=-1/0;for(let w=0;w<l.binCount;w++)l.topLevelM[w]>f&&(f=l.topLevelM[w]);let d=f+sp,p=l.closed?h:[...h,...u.slice().reverse()],b=l.closed?[u.slice().reverse()]:void 0,g=be(i.shellWall,[.66,.71,.72],.62),x=(w,R,C,O,E)=>{let A=Math.abs(O-f)<1e-6?O-np:O;dt(e,w,C,A,n.shapes,i.shellTop,E,{holes:R,portalBase:o,ao:r})||ue(e,w,R,()=>A,C,i.shellTop,E,r)},S=Math.max(1,Math.ceil((f-o)/4.5)),I=(f-o)/S,M=new Set,y=n.tierFrontLevels??t.rings.map(w=>{let R=w.arcs.flatMap(C=>Array.from(C.frontLevelM)).filter(Number.isFinite).sort((C,O)=>C-O);return R[Math.floor(R.length/2)]});for(let w of y)Number.isFinite(w)&&w-o>=3&&w<f&&M.add(Math.max(0,Math.min(S-1,Math.floor((w-o)/I))));let P=Math.min(...y.filter(w=>Number.isFinite(w)&&w-o>=3&&w<f));for(let w=0;w<S;w++)o+(w+1)*I<=P-Bn&&Number.isFinite(P)&&M.add(w);for(let w=0;w<S;w++){let R=o+(f-o)*w/S,C=o+(f-o)*(w+1)/S;M.has(w)&&C-R>=3.2?(x(p,b,R,R+.45,g),Xr(e,u,h,l.closed,R+.45,C-.16,i.shellTop,g,r,n.shapes,o)):x(p,b,R,C-.16,g),x(p,b,C-.16,C,le(g,.62))}Xr(e,u,h,l.closed,f,d,i.shellTop,g,r,n.shapes,o);let v=8;for(let w=1;w<h.length;w++){if(v+=Math.hypot(h[w].x-h[w-1].x,h[w].y-h[w-1].y)*fe,v<8)continue;v=0;let R=h[w],C=h[w-1],O=R.x-C.x,E=R.y-C.y,A=Math.max(1,Math.hypot(O,E)),T=O/A*.16*je,L=E/A*.16*je,V=Math.max(1,Math.hypot(R.x-t.centre.x,R.y-t.centre.y)),F=(R.x-t.centre.x)/V*.24*je,G=(R.y-t.centre.y)/V*.24*je,j=[{x:R.x-T,y:R.y-L},{x:R.x+T,y:R.y+L},{x:R.x+T+F,y:R.y+L+G},{x:R.x-T+F,y:R.y-L+G}];x(j,void 0,o,f,le(g,1.12))}}}var dp=2.5,Ac=.65,hp=2,pp=.03;function bp(e,t){let n=()=>{let o=t;for(;e.length>2;){let i=e[0],r=e[1],a=Math.hypot(r.x-i.x,r.y-i.y);if(a>o){e[0]={x:i.x+(r.x-i.x)/a*o,y:i.y+(r.y-i.y)/a*o};return}o-=a,e.shift()}};n(),e.reverse(),n(),e.reverse()}function Qr(e,t,n){let o=new Map;for(let r of e){let a=o.get(r.blockId);(!a||r.depth<a.depth)&&o.set(r.blockId,r)}let i=[];for(let[r,a]of o){if(a.y-n<dp||a.pts.length<2)continue;let s=a.pts.map(l=>{let u=l.x-t.x,h=l.y-t.y,f=Math.max(1,Math.hypot(u,h));return{x:l.x-u/f*Ac/_,y:l.y-h/f*Ac/_}}),c=[],m=[s[0]];for(let l=1;l<s.length;l++){let u=s[l-1],h=s[l];Math.hypot(h.x-u.x,h.y-u.y)*_>hp?(m.length>=2&&c.push(m),m=[h]):m.push(h)}m.length>=2&&c.push(m);for(let l of c)bp(l,pp/_);c.length&&i.push({blockId:r,y:a.y,runs:c})}return i}var Rc=.1,yp=1.1,gp=.22,qr=.95,Zr=.05,Ec=1.8;function Cc(e,t,n,o){let i=[.72,.72,.69],r=[.48,.55,.57];for(let a of Qr(t,n,o)){let s=a.y;for(let c of a.runs){let m=Ec;for(let l=1;l<c.length;l++){let u=c[l-1],h=c[l],f=h.x-u.x,d=h.y-u.y,p=Math.hypot(f,d);if(p<1e-5)continue;let b=g=>{let x=-d/p*g/_/2,S=f/p*g/_/2;return[{x:u.x+x,y:u.y+S},{x:h.x+x,y:h.y+S},{x:h.x-x,y:h.y-S},{x:u.x-x,y:u.y-S}]};if(ue(e,b(gp),void 0,()=>s+Rc,s-yp,i,i,ce),ue(e,b(Zr),void 0,()=>s+qr,s+qr-Zr,r,r,ce),m+=p*_,m>=Ec||l===c.length-1){m=0;let g=.028/_,x=[{x:u.x-g,y:u.y-g},{x:u.x+g,y:u.y-g},{x:u.x+g,y:u.y+g},{x:u.x-g,y:u.y+g}];ue(e,x,void 0,()=>s+qr-Zr,s+Rc,r,r,ce)}}}}}var xp=.9,vp=1.5,Mp=.3;function _c(e,t,n){let o=[],i=[],r=xp/_,a=vp/_,s=Mp/_;for(let c of e)for(let m of c.runs){if(m.length<2)continue;let l=m.slice(),u=(b,g)=>{let x=l[b],S=l[g],I=Math.hypot(x.x-S.x,x.y-S.y)||1;l[b]={x:x.x+(x.x-S.x)/I*s,y:x.y+(x.y-S.y)/I*s}};u(0,1),u(l.length-1,l.length-2);let h=l.map((b,g)=>{let x=l[Math.max(0,g-1)],S=l[Math.min(l.length-1,g+1)],I=S.x-x.x,M=S.y-x.y,y=Math.hypot(I,M)||1,P=-M/y,v=I/y;return P*(b.x-t.x)+v*(b.y-t.y)<0&&(P=-P,v=-v),{nx:P,ny:v}}),f=l.map((b,g)=>({x:b.x-h[g].nx*a,y:b.y-h[g].ny*a})),d=l.map((b,g)=>({x:b.x+h[g].nx*r,y:b.y+h[g].ny*r})),p=l.map((b,g)=>({x:b.x+h[g].nx*(r+n/_),y:b.y+h[g].ny*(r+n/_)}));o.push([...f,...d.slice().reverse()]),i.push([...d,...p.reverse()])}return{bays:o,walls:i}}var Jr=.88,To=.27,Sp=1.2,wp=.01;function Tc(e,t,n,o,i){let r=[.67,.71,.68],a=[r[0]*Jr,r[1]*Jr,r[2]*Jr],s=c=>!!i&&i.some((m,l)=>l!==c&&m?.belowY!=null&&Math.abs(m.belowY-t[c].y)<1e-6&&t[l].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let m=t[c];if(!(m.pts.length<2))for(let l of[0,m.pts.length-1]){let u=m.pts[l],h=m.pts[l===0?1:l-1],f=u.x-h.x,d=u.y-h.y,p=Math.hypot(f,d);if(p<1e-5)continue;f/=p,d/=p;let b=1/0;for(let T=0;T<n.length;T++){let L=n[T],V=n[(T+1)%n.length],F=V.x-L.x,G=V.y-L.y,j=f*G-d*F;if(Math.abs(j)<1e-8)continue;let N=L.x-u.x,k=L.y-u.y,B=(N*G-k*F)/j,D=(N*d-k*f)/j;B>0&&D>=0&&D<=1&&(b=Math.min(b,B))}let g=.3/_,x=b-.04/_;if(!Number.isFinite(b)||b*_>2||x-g<.12/_)continue;let S=!!o&&s(c),I=i?.[c]?.pitch,M=S&&I&&Number.isFinite(I)?Math.min(Sp/_,Math.max(To/_,I-To/_-wp/_)):To/_,y=-d,P=f;o&&y*(o.x-u.x)+P*(o.y-u.y)<0&&(y=-y,P=-P);let v=To/_,w=[{x:u.x+f*g+y*v,y:u.y+d*g+P*v},{x:u.x+f*x+y*v,y:u.y+d*x+P*v},{x:u.x+f*x-y*M,y:u.y+d*x-P*M},{x:u.x+f*g-y*M,y:u.y+d*g-P*M}];if(!w.every(T=>He(n,T.x,T.y)))continue;let R=i?.[c]?.belowY,C=R==null?0:m.y-R,O=!!o&&C>.03&&C<=.65;if(O&&o){let T=(L,V)=>Math.hypot((L.x+V.x)/2-o.x,(L.y+V.y)/2-o.y);T(w[0],w[1])>T(w[3],w[2])&&(w=[w[3],w[2],w[1],w[0]])}let E=O?Math.ceil((C-1e-8)/.2):1,A=(T,L,V)=>({x:T.x+(L.x-T.x)*V,y:T.y+(L.y-T.y)*V});for(let T=0;T<E;T++){let L=T/E,V=(T+1)/E,F=[A(w[0],w[3],L),A(w[1],w[2],L),A(w[1],w[2],V),A(w[0],w[3],V)],G=m.y+.008-(O?C*(1-V):0);ue(e,F,void 0,()=>G,G-(O?C/E+.1:.16),r,a,ce)}}}}function kc(e,t,n,o,i,r,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,l=n.objects.filter(x=>x.type==="shape"&&(x.role==="entrance"||x.role==="exit")),u=bs(o,s.tierTop);if(!i)return;let h=x=>i.deckAt(x.x,x.y),f=ks(t,a),d=f[0]??t.outline;if(i.rowLevels.length>=2){let x=bo(i.rowLevels),S=Ls(Rs(i.rowLevels,n.focal,x),f),I=_c(Qr(i.rowLevels,n.focal,m),n.focal,$r);for(let y of S){let P=Math.max(m,y.topY-Lc);for(let v of r.subtract(y.outline,P))wc(e,v,y.holes,P,m,s.tierTop,s.tierWall,l,!c,I)}S.length||ue(e,d,t.holes,()=>i.landingY,m,u,s.tierWall,ce);let M={tread:[u[0]*ce.top,u[1]*ce.top,u[2]*ce.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let y of f.length?f:[d])Cs(e,i.rowLevels,n.focal,i.landingY,M,y,x);Cc(e,i.rowLevels,n.focal,m),Tc(e,i.rowLevels,t.outline,n.focal,x);return}let p=i.flat?1/0:Us,b=x=>i.normalAt(x.x,x.y),g=i.flat?i.landingY:void 0;for(let x of r.subtract(d,g))ue(e,x,t.holes,h,m,u,s.tierWall,ce,p,b)}function Pp(e,t,n){let o=new Set;for(let a of e.objects)a.type==="section"&&o.add(a.id);let i=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!o.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let m=t[a];if(m.kind==="booth")continue;let l=i.get(s);l||(l=new Map,i.set(s,l));let u=m.rowId||`__seat-${a}`,h=l.get(u);h||(h={pts:[],levelM:0,n:0},l.set(u,h)),h.pts.push({x:m.x,y:m.y}),h.levelM+=n.seatDeckY(a),h.n++}let r=[];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 m=s.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));m.length>=2&&r.push({sectionId:a.id,rows:m});continue}let c=i.get(a.id);c&&r.push({sectionId:a.id,rows:[...c.values()].map(m=>({pts:m.pts,levelM:m.levelM/m.n}))})}return r}function Ip(e,t){let n=1/0;for(let o=0;o<t.length;o++){let i=t[o],r=t[(o+1)%t.length],a=r.x-i.x,s=r.y-i.y,c=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*s)/(a*a+s*s||1)));n=Math.min(n,Math.hypot(e.x-i.x-c*a,e.y-i.y-c*s))}return n}var Lc=.02;function Ap(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let i=t.bySection.get(o.id);if(!i)return[];let r=1/0,a=-1/0,s=1/0,c=-1/0;for(let l of o.outline)l.x<r&&(r=l.x),l.x>a&&(a=l.x),l.y<s&&(s=l.y),l.y>c&&(c=l.y);let m=i.landingY;for(let l of i.rowLevels)m=Math.min(m,l.y-Lc);return[{outline:o.outline,holes:o.holes,surface:i,floorTop:m,minX:r,maxX:a,minY:s,maxY:c}]});return(o,i,r)=>{let a=null;for(let s of n){if(o<s.minX-r||o>s.maxX+r||i<s.minY-r||i>s.maxY+r)continue;let c={x:o,y:i};if(!Oe(c,s.outline,s.holes)&&Ip(c,s.outline)>r)continue;let m=Math.min(s.surface.deckAt(o,i),s.floorTop);(a===null||m<a)&&(a=m)}return a}}var Rp=3,Ep=.4;function Fc(e,t,n,o,i,r,a=!0){let s=Pp(t,n,o);if(s.length<Rp)return;let c=Mc(s,t.focal);if(!c)return;let m=Math.max(0,...c.rings.map(l=>l.arcs.reduce((u,h)=>u+h.binCount,0)))/c.binCount;e.setMaterial(5),Ic(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(l=>Math.min(...l.rows.map(u=>u.levelM))),colors:{bandTop:le(i.tierTop,.8),bandWall:i.tierWall,shellTop:r??le(i.tierWall,1.15),shellWall:r??i.tierWall},ao:ce,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a&&m>=Ep,standTopNear:Ap(t,o)}),e.setMaterial(0)}var Oc=4;var Cp=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],_p=1.2,Tp=12;function Dc(e){if(e.heightM!==void 0)return!1;let t=Se(e);if(!t||t.length<3)return!1;let n=0;for(let i=0;i<t.length;i++){let r=t[i],a=t[(i+1)%t.length];n+=Math.hypot(a.x-r.x,a.y-r.y)}return n*fe<Tp*2?!1:2*Vn(t)/n*fe<=_p}function ei(e){if(!e)return null;for(let[t,n]of Cp)if(t.test(e))return n;return null}var Bc="auto-rows-";function Vc(e){return e.id.startsWith(Bc)&&!e.label}var kp=1.15,Lp=.09,Hc=6,Fp=34,Op=.35,Dp=6,Np=.35,Bp=.75,Vp=12,Hp=2.5,Gp=40,zp=[18,24],Up=[12,16],Nc=14,jp=.8,Wp=.6,Xp=5,Yp=.3,Gc=.4,zc=2,Kp=400,$p=2.6,qp=.8,Zp=4,Qp=26,Jp=.7,eb=.5,tb=.985,nb=1.5,ob=2.2,rb=3,ib=25,ab=.985,sb=2,cb=6,lb=3,ub=.1,mb=1.5,fb=1.6,db=6e3,hb=.6,pb="#c3c7cd",ti=300,bb=240;function yb(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let i=oi([...t]),r=new Set;for(let l of o)r.add(Math.floor(Math.atan2(l.y-i.y,l.x-i.x)*180/Math.PI/10));if(r.size*10<bb)return null;let{h:a,s,l:c}=ca(aa(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&Se(l)?.some(u=>ai(u,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var gb="Estimated from the drawing; confirm with the venue.",ri=e=>{if(!e.length)return null;let t=[...e].sort((o,i)=>o-i),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},oi=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Vn=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],i=e[(n+1)%e.length];t+=o.x*i.y-i.x*o.y}return Math.abs(t)/2};function xb(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function ii(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function ai(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o],a=t[i];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function si(e,t){let n=t[0],o=1/0;for(let i=0;i<t.length;i++){let r=t[i],a=t[(i+1)%t.length],s=a.x-r.x,c=a.y-r.y,m=s*s+c*c,l=m>0?Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/m)):0,u={x:r.x+s*l,y:r.y+c*l},h=Math.hypot(e.x-u.x,e.y-u.y);h<o&&(o=h,n=u)}return n}function Uc(e,t){let n=0,o=0;for(let i of e.values()){if(i.length<3)continue;let r=i[0],a=i[i.length-1],s=a.x-r.x,c=a.y-r.y,m=Math.hypot(s,c);if(m<1e-6)continue;let l={x:(r.x+a.x)/2,y:(r.y+a.y)/2},u=si(l,t),h=u.x-l.x,f=u.y-l.y,d=Math.hypot(h,f);d<1e-6||(o+=Math.abs((-c*h+s*f)/(m*d))*i.length,n+=i.length)}return n?o/n:0}function vb(e,t,n){let o=e.filter(p=>p.type==="shape"),i=o.find(p=>p.role==="stage");if(i){let p=Se(i);return p?{shape:i,centre:oi(p),outline:p,inferred:!1}:null}if(!n.length)return null;let r=1/0,a=-1/0,s=1/0,c=-1/0;for(let p of n)r=Math.min(r,p.x),a=Math.max(a,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let m=(a-r)*(c-s),l=[];for(let p of o){if(p.role)continue;let b=Se(p);if(!b)continue;let g=Vn(b);if(g*fe*fe<6||g>m)continue;let x=Math.min(...b.map(w=>w.x)),S=Math.max(...b.map(w=>w.x)),I=Math.min(...b.map(w=>w.y)),M=Math.max(...b.map(w=>w.y)),y=0;for(let w of n)w.x>x&&w.x<S&&w.y>I&&w.y<M&&ai(w,b)&&y++;if(y>n.length*.05)continue;let P=oi(b),v=Uc(t,b);v>=jp&&l.push({shape:p,centre:P,outline:b,score:v,area:g,box:[x,I,S,M]})}let u=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,h=l.filter(p=>!l.some(b=>u(p,b))),f=Math.max(0,...h.map(p=>p.score)),d=h.filter(p=>p.score>=f-.03).sort((p,b)=>b.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Mb(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=si(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function jc(e){let t=[...e].sort((r,a)=>r.x-a.x||r.y-a.y);if(t.length<3)return t;let n=(r,a,s)=>(a.x-r.x)*(s.y-r.y)-(a.y-r.y)*(s.x-r.x),o=[];for(let r of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],r)<=0;)o.pop();o.push(r)}let i=[];for(let r=t.length-1;r>=0;r--){let a=t[r];for(;i.length>=2&&n(i[i.length-2],i[i.length-1],a)<=0;)i.pop();i.push(a)}return[...o.slice(0,-1),...i.slice(0,-1)]}function Sb(e){if(!e.length||e.length>db)return[];let t=[...ii(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),i=fb/fe,r=t.map(s=>({minX:Math.min(...s.map(c=>c.x))-i,maxX:Math.max(...s.map(c=>c.x))+i,minY:Math.min(...s.map(c=>c.y))-i,maxY:Math.max(...s.map(c=>c.y))+i}));for(let s=0;s<t.length;s++)for(let c=s+1;c<t.length;c++){let m=r[s],l=r[c];if(m.maxX<l.minX||l.maxX<m.minX||m.maxY<l.minY||l.maxY<m.minY)continue;t[s].some(h=>t[c].some(f=>Math.hypot(h.x-f.x,h.y-f.y)<=i))&&(n[o(s)]=o(c))}let a=new Map;return t.forEach((s,c)=>{let m=o(c),l=a.get(m);l?l.push(...s):a.set(m,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function wb(e,t,n){if(!t.length)return null;let o=t.filter(v=>n.tableIds.has(v.rowId)||v.kind==="booth").length>t.length/2,i=ii(t),r=!n.outline||Uc(i,n.outline)>=Wp,a=0,s=0;for(let v of i.values()){if(v.length<2)continue;let w=v[0],R=v[v.length-1],C=R.x-w.x,O=R.y-w.y,E=Math.hypot(C,O);if(E<1e-6)continue;let A={x:(w.x+R.x)/2,y:(w.y+R.y)/2},T=r?n.outline?si(A,n.outline):n.focal:n.middle,L=-O/E,V=C/E;L*(T.x-A.x)+V*(T.y-A.y)<0&&(L=-L,V=-V),a+=L*v.length,s+=V*v.length}let c={x:t.reduce((v,w)=>v+w.x,0)/t.length,y:t.reduce((v,w)=>v+w.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let v=r?n.focal:n.middle;a=v.x-c.x,s=v.y-c.y}let m=Math.hypot(a,s)||1,l={x:a/m,y:s/m},u=v=>-(v.x*l.x+v.y*l.y),h=v=>-v.x*l.y+v.y*l.x,f=1/0,d=-1/0,p=1/0,b=-1/0,g=1/0,x=new Map;for(let v of t){let w=u(v),R=h(v);f=Math.min(f,w),d=Math.max(d,w),p=Math.min(p,R),b=Math.max(b,R),r&&(g=Math.min(g,Mb(v,n.focal,n.outline)));let C=v.logicalRowId??v.rowId,O=x.get(C);O?O.push(w):x.set(C,[w])}r||(g=Math.max(0,f-u(n.middle)));let S=[...x.values()].map(v=>ri(v)).sort((v,w)=>v-w),I=[];if(!o)for(let v of S)I.length&&v-I[I.length-1]<Np/fe||I.push(v);let M=xb(e),y=yt(e,{floorBaseHeightM:n.baseHeightM}),P={id:e.id,section:e,authored:M,plane:n,facing:l,facesAction:r,hull:jc(t),sample:t.filter((v,w)=>w%Math.ceil(t.length/Kp)===0),frontD:f,backD:d,latMin:p,latMax:b,frontDistance:g,rowDepths:I,rowCount:I.length,level:0,height:y.height,rake:M?y.rake:0,backHeight:0};return P.backHeight=P.height+(d-f)*fe*Math.tan(P.rake*Math.PI/180),P}function Pb(e,t,n,o){if(e.length<2)return 0;let i=Math.max(1,t*fe),r=n+kp-o,a=0,s=0;for(let m=1;m<e.length;m++){let l=Math.max(Bp,(e[m]-e[m-1])*fe),u=(r+Lp)*(i+l)/i;a+=u-r,s+=l,r=u,i+=l}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(Hc,Math.min(Fp,c))*10)/10}function Ib(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<Yp)return null;let o=-1/0,i=1/0,r=-1/0;for(let h of t.hull){o=Math.max(o,-(h.x*e.facing.x+h.y*e.facing.y));let f=-h.x*e.facing.y+h.y*e.facing.x;i=Math.min(i,f),r=Math.max(r,f)}if(Math.min(e.latMax,r)-Math.max(e.latMin,i)<(n?1e-6:Gc*(e.latMax-e.latMin)))return null;let s=zc/fe,c=new Map,m=new Map;for(let h of e.sample){let f=Math.floor((-h.x*e.facing.y+h.y*e.facing.x)/s),d=-(h.x*e.facing.x+h.y*e.facing.y);c.set(f,Math.min(c.get(f)??1/0,d))}for(let h of t.sample){let f=Math.floor((-h.x*e.facing.y+h.y*e.facing.x)/s),d=-(h.x*e.facing.x+h.y*e.facing.y);m.set(f,Math.max(m.get(f)??-1/0,d))}let l=[];for(let[h,f]of c){let d=m.get(h);d!==void 0&&l.push(f-d)}let u=l.length?ri(l):e.frontD-o;return u<-1/fe?null:u}function Ab(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,i=1/0,r=-1/0;for(let c of t.hull){let m=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,m),o=Math.min(o,m);let l=-c.x*e.facing.y+c.y*e.facing.x;i=Math.min(i,l),r=Math.max(r,l)}let a=Math.min(e.latMax,r)-Math.max(e.latMin,i),s=Math.min(e.backD,n)-Math.max(e.frontD,o);return a>Gc*(e.latMax-e.latMin)&&s>1/fe}function Rb(e,t){let n=new Set;for(let o of e){let i=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(i/10))}return n.size/36}function Eb(e,t){let n=1/0,o=-1/0;for(let r of t.hull){let a=-(r.x*e.facing.x+r.y*e.facing.y);n=Math.min(n,a),o=Math.max(o,a)}let i=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+i*fe*Math.tan(t.rake*Math.PI/180)}function Cb(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=zc/fe,i=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),r={left:new Map,right:new Map};for(let s of t)if(!(s===e||s.plane.floorIndex!==e.plane.floorIndex)&&!(s.facing.x*e.facing.x+s.facing.y*e.facing.y>=tb))for(let c of s.sample){let m=-(c.x*e.facing.x+c.y*e.facing.y);if(m<e.frontD||m>e.backD)continue;let l=-c.x*e.facing.y+c.y*e.facing.x,u=l<e.latMin?"left":l>e.latMax?"right":null;if(!u)return!1;let h=Math.min(i-1,Math.floor((m-e.frontD)/o)),f=u==="left"?e.latMin-l:l-e.latMax;f<(r[u].get(h)?.gap??1/0)&&r[u].set(h,{gap:f,other:s})}let a=s=>{let c=s==="left"?e.latMin:e.latMax,m=0;for(let[l,{other:u}]of r[s]){if((u.facing.x*n.x+u.facing.y*n.y)*(s==="left"?1:-1)<Jp)continue;let f=e.frontD+(l+.5)*o,d={x:-f*e.facing.x+c*n.x,y:-f*e.facing.y+c*n.y},p=-(d.x*u.facing.x+d.y*u.facing.y),b=-d.x*u.facing.y+d.y*u.facing.x;p<u.frontD&&b>=u.latMin&&b<=u.latMax&&m++}return m/i>=eb};return a("left")&&a("right")}function _b(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<ab)return!1;let n=1/0,o=-1/0,i=1/0;for(let s of t.hull){let c=-s.x*e.facing.y+s.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),i=Math.min(i,-(s.x*e.facing.x+s.y*e.facing.y))}let r=(e.frontD-i)*fe;if(r<-sb||r>cb)return!1;let a=Math.max(n-e.latMax,e.latMin-o);return a*fe<=lb&&a*fe>=-ub}function Tb(e,t=!1,n=!1,o){let i=t?Up:zp,r=new Set(n?[]:e.filter(p=>!p.authored&&Cb(p,e))),a=[...e].sort((p,b)=>p.plane.floorIndex-b.plane.floorIndex||Number(r.has(b))-Number(r.has(p))||p.frontDistance-b.frontDistance);for(let p of r)o?.add(p.id);let s=(p,b,g)=>{let x=new Map,S=[],I=new Map,M=y=>{if(y.plane.floorIndex===0||y.plane.baseHeightM>0)return y.plane.baseHeightM;let P=I.get(y.plane.floorIndex-1);return P===void 0?y.plane.baseHeightM:P+Oc};for(let y of a){if(r.has(y))y.height=M(y),y.level=0,y.rake=0,y.backHeight=y.height,x.set(y.id,void 0);else if(!y.authored){let v=M(y),w;for(let A of S){if(A.plane.floorIndex>y.plane.floorIndex)continue;if(Ab(y,A)){let F=Eb(y,A)+$p;F>v&&(v=F,w=A);continue}let T=Ib(y,A,r.has(A));if(T==null)continue;let L=n&&!!y.plane.stageDeck&&A.level===0&&A.plane.floorIndex===y.plane.floorIndex&&Math.max(0,T)*fe<=Zp,V=r.has(A)?A.height+nb:L?A.backHeight:A.backHeight+Op+Math.min(Dp,Math.max(0,T)*fe)*Math.tan(A.rake*Math.PI/180);V>v&&(v=V,w=A)}let R=p.get(y);R&&R.height>v+.01?(v=R.height,w=void 0):R=void 0,y.height=Math.round(Math.min(v,y.plane.baseHeightM+Gp)*100)/100;let C=!w&&!R&&y.height>y.plane.baseHeightM;if(y.level=w?w.level+1:R?R.level:C?1:0,y.rake=Pb(y.rowDepths,y.frontDistance,y.height,y.plane.focalHeightM),!y.facesAction&&y.rowCount<Xp)y.rake=0;else if(y.level===0){let A=Math.max(1e-6,(y.backD-y.frontD)*fe);y.rake=Math.min(y.rake,Vp,Math.round(Math.atan(Hp/A)*1800/Math.PI)/10)}else y.rowCount>=2&&(y.rake=Math.max(y.rake,i[Math.min(y.level,i.length)-1]));let O=(y.backD-y.frontD)*fe,E=w&&r.has(w)||R&&g?.has(R.id);if(b!==void 0&&E&&y.rowCount>=2&&(y.rake=b),t&&O>0&&y.height+O*Math.tan(y.rake*Math.PI/180)>y.plane.baseHeightM+Nc){let A=Math.max(0,y.plane.baseHeightM+Nc-y.height);y.rake=Math.max(Hc,Math.round(Math.atan(A/O)*1800/Math.PI)/10)}n&&y.plane.stageDeck&&y.level>0&&(y.rake=Math.min(y.rake,Qp)),y.backHeight=y.height+O*Math.tan(y.rake*Math.PI/180),x.set(y.id,w?.id??(R?x.get(R.id):void 0))}let P=y.plane.floorIndex;I.set(P,Math.min(I.get(P)??1/0,y.height)),S.push(y)}return x},c=s(new Map),m=new Map,l=p=>m.get(p)?.height??p.height;for(let p=!0,b=0;p&&b<e.length;b++){p=!1;for(let g of e)if(!(g.authored||r.has(g)))for(let x of e){let S=m.get(x)??x;x===g||S.height-S.plane.baseHeightM<mb||S.height<=l(g)+.01||_b(g,x)&&(m.set(g,S),p=!0)}}let u=new Map(e.map(p=>[p.id,p])),h=e.filter(p=>!p.authored&&p.rowCount>=2&&r.has(u.get(c.get(p.id)??""))),f=h.length?ri(h.map(p=>p.rake)):void 0;if(!m.size&&f===void 0)return c;let d=new Map([...new Set(m.values())].map(p=>[p,{...p}]));return s(new Map([...m].map(([p,b])=>[p,d.get(b)])),f,new Set(h.map(p=>p.id)))}var ni=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function ko(e,t={x:0,y:-40}){let n=$t(e),o=new Map;for(let g of n){if(!g.sectionId)continue;let x=o.get(g.sectionId);x?x.push(g):o.set(g.sectionId,[g])}let i={focalInferred:!1,confident:!1,sections:[]},r=e.floors?.length?e.floors.map((g,x)=>({objects:g.objects,floorIndex:x,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(r.flatMap(g=>g.objects.filter(x=>x.type==="table").map(x=>x.id))),s=[],c,m=new Set,l=r.map(g=>{let x=E=>!e.floors?.length||E.floorId===g.floorId,S=Sb(n.filter(E=>!E.sectionId&&E.kind!=="booth"&&!a.has(E.rowId)&&x(E))),I=[];for(let E of S){let A=Ze(rt(jc(E)),hb/fe);if(n.some(L=>!x(L)&&ai(L,A)))continue;let T=`${Bc}${g.floorIndex}-${I.length}`;m.add(T),o.set(T,E),I.push({type:"section",id:T,label:"",color:pb,outline:A})}let M=I.length?{...g,objects:[...g.objects,...I]}:g,y=new Set(M.objects.filter(E=>E.type==="section").map(E=>E.logicalSectionId??E.id)),P=[...o.entries()].filter(([E])=>y.has(E)).flatMap(([,E])=>E),v=vb(M.objects,ii(P),P),w=M.focal;(v||M.focal&&!ni(M.focal,t))&&(i.confident=!0),v&&(i.stage??={id:v.shape.id,inferred:v.inferred,...M.floorId?{floorId:M.floorId}:{}},(v.inferred||ni(M.focal,t))&&(w=v.centre,i.focalInferred=!0));let R=v&&(!v.inferred||Vn(v.outline)*fe*fe<=ti),C=v?void 0:c,O={tableIds:a,floorIndex:M.floorIndex,floorId:M.floorId,baseHeightM:M.baseHeightM,focal:C?.focal??w,outline:v?.outline??C?.outline,focalHeightM:C?.focalHeightM??M.baseHeightM+(v&&R?Qe({...v.shape,role:"stage"}).heightM:0),stageDeck:C?.stageDeck??!!(v&&R&&Vn(v.outline)*fe*fe<=ti),middle:P.length?{x:P.reduce((E,A)=>E+A.x,0)/P.length,y:P.reduce((E,A)=>E+A.y,0)/P.length}:w};for(let E of M.objects){if(E.type!=="section")continue;let A=wb(E,o.get(E.logicalSectionId??E.id)??[],O);A&&s.push(A)}return O.outline&&(c=O),ni(M.focal,O.focal)||(i.focal??=[]).push({...M.floorId?{floorId:M.floorId}:{},point:{...O.focal}}),{unit:M,plane:O,stage:v,planeSeats:P}}),u=r.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(ei(g.label)==="wall"||!ei(g.label)&&Dc(g))?{...g,role:"wall"}:g),h=Qt({objects:u},n)!==null;h&&(i.indoor=!0);let f=new Set,d=Tb(s,h,Rb(n,l[0]?.plane.focal??t)<qp,f),p=new Map(s.filter(g=>!g.authored).map(g=>[g.id,g])),b=l.map(({unit:g,plane:x,stage:S,planeSeats:I})=>g.objects.map(M=>{let y=M.type==="shape"&&!M.role&&M.id!==S?.shape.id?ei(M.label):null;if(M.type==="shape"&&!M.role&&M.id!==S?.shape.id&&(y==="wall"||!y&&Dc(M))&&M.type==="shape"){(i.roles??=[]).push({id:M.id,...x.floorId?{floorId:x.floorId}:{},role:"wall"});let{fill:A,...T}=M;return{...T,role:"wall"}}if(y&&M.type==="shape")return(i.roles??=[]).push({id:M.id,...x.floorId?{floorId:x.floorId}:{},role:y}),{...M,role:y};let v=S?.inferred&&M.id===S.shape.id&&M.type==="shape"?yb(M,S.outline,g.objects,I):null;if(v&&M.type==="shape")return i.stage?.id===M.id&&(i.stage.field=v),{...M,role:"stage",stageKind:v};let w=M.type==="shape"&&M.id===S?.shape.id&&M.heightM===void 0&&!M.stageKind&&s.some(A=>A.plane===x&&(f.has(A.id)||A.level===0&&A.facesAction&&A.rake<=rb&&(A.frontDistance+A.backD-A.frontD)*fe>=ib)),R=w?{heightM:ob}:{};if(S?.inferred&&M.id===S.shape.id&&M.type==="shape"&&Vn(S.outline)*fe*fe<=ti)return i.stage?.id===M.id&&(i.stage.deck=!0),{...M,role:"stage",...R};if(w&&M.type==="shape"&&M.role==="stage")return{...M,...R};let C=M.type==="section"?p.get(M.id):void 0;if(!C||M.type!=="section")return M;let O=C.rowCount>=2&&C.rake>0;m.has(C.id)?i.looseRowBlocks=(i.looseRowBlocks??0)+1:i.sections.push({id:C.id,floorId:x.floorId,surfaceKind:O?"rakedRows":"flat",height:C.height,rake:C.rake,stackedOn:d.get(C.id)});let E={status:"inferred",source:"public-2d-topology",note:gb};return{...M,height:C.height,rake:C.rake,surfaceKind:O?"rakedRows":"flat",physical3dProvenance:{height:E,rake:E,surfaceKind:E}}}));if(e.floors?.length){let g=e.floors.map((x,S)=>({...x,objects:b[S],focalPoint:l[S].plane.focal}));return{doc:{...e,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:i}}return{doc:{...e,objects:b[0],focalPoint:l[0].plane.focal},report:i}}var Wc=/^[\p{L}\p{N}]{1,4}$/u,kb=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Xc(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),i=n.toLocaleLowerCase("en-US");if(o.startsWith(`${i} `)){let a=e.slice(n.length).trim();if(Wc.test(a))return a}let r=kb.exec(e);if(r){let a=r[1].toLocaleLowerCase("en-US"),s=r[2].trim();if((i.startsWith(a)||a.startsWith(i))&&Wc.test(s))return s}return e}var Lb=new Map(xr.map(e=>[e.key,e.label]));function Fb(e){return`picker.access.${e}`}function Yc(e){let t=[],n=e.wheelchairSpaceType;for(let r of e.accessibility??[]){if(r==="wheelchair"&&n)continue;let a=Lb.get(r);a&&t.push({key:`access:${r}`,icon:r,titleKey:Fb(r),titleFallback:a,tone:"access"})}n==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):n==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"});let o=e.commercial;o?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),o?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),o?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let i=o?.note?.trim();if(i){let r=t.find(a=>a.tone==="warn"||a.tone==="premium");r?r.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}return t}function Kc(e,t,n){return n<0?t>1?e.filter(o=>o.kind==="floor"):[...e]:e.filter(o=>o.floorIndex===void 0||o.floorIndex===n)}function $c(e,t){let n=[...e].sort((i,r)=>i.screen.y-r.screen.y),o=[];for(let i of n){let r=o.find(a=>a.some(s=>Math.abs(s.screen.x-i.screen.x)<104&&Math.abs(s.screen.y-i.screen.y)<34));r?r.push(i):o.push([i])}return o.flatMap(i=>i.length<2?i:i.map((r,a)=>({...r,screen:{...r.screen,x:Math.max(54,Math.min(t-54,r.screen.x+(a-(i.length-1)/2)*104))}})))}var Ob=1.15,Db=2.75,Nb=4.5,Bb=.85,Vb=.5,Hb=.26;function qc(e,t,n){let o=Math.max(1e-6,t),i=e/o,r=n?.hasZoneLabels??!0,a=new Set(["stage","gate"]);return i>=.75&&a.add("floor"),i>=Ob&&a.add("zone"),i<=(r?Db:Nb)&&(a.add("section"),a.add("ga")),i<=Bb&&(a.add("annotation"),a.add("booth")),i<=Vb&&a.add("row"),i<=Hb&&a.add("seat"),a}function Zc(e,t,n,o,i,r=6){let a=r+t,s=o-r-t,c=r+n,m=i-r-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>m?i/2:Math.max(c,Math.min(m,e.y))}}function at(e,t,n,o){let i=e,r=t[0],a=t[1],s=t[2],c=i[0]*r+i[4]*a+i[8]*s+i[12],m=i[1]*r+i[5]*a+i[9]*s+i[13],l=i[2]*r+i[6]*a+i[10]*s+i[14],u=i[3]*r+i[7]*a+i[11]*s+i[15];if(!(u>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let h=c/u,f=m/u,d=l/u,p=h>=-1.05&&h<=1.05&&f>=-1.05&&f<=1.05&&d<=1;return{x:(h*.5+.5)*n,y:(1-(f*.5+.5))*o,depth:d,visible:p}}function Qc(e,t,n=t){let o=[],i=[...e].sort((r,a)=>r.screen.depth-a.screen.depth);for(let r of i){let a=!1;for(let s of o)if(Hn(r,s,t,n)){a=!0;break}a||o.push(r)}return o}var Gb=6;function Hn(e,t,n,o){let i=Math.abs(e.screen.x-t.screen.x),r=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Gb):n;return i<a&&r<o}function Jc(e,t,n){return e.length*t*.58+(n?14:0)}var zb={row:8,seat:14};function el(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:zb}function tl(e,t,n,o){let i=Math.max(1,Math.min(n,o)*.5),r=Math.min(2,Math.hypot(e.x-n/2,e.y-o/2)/i);return t*(1+1.5*r)}function Gn(e,t,n,o,i=[]){let r=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of r){if(a.length>=o)break;let c=!1;for(let m of i)if(Hn(s,m,t,n)){c=!0;break}if(!c){for(let m of a)if(Hn(s,m,t,n)){c=!0;break}}c||a.push(s)}return a}function ci(e,t,n,o){let i=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15];return i<=0||!(n>0)?0:n*Math.hypot(e[0],e[4],e[8])*o/(2*i)}var Ub=6,jb=2.2,nl=.1,Wb=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),Xb=.3,Yb=1.8,Kb=.9,$b=.55,qb=1,ol=4e3,Zb=6,rl="#d8a425",Qb="#e8c15a",li="#1c1608";function il(e){let t=Jb(e);if(!t)return null;let n=Yc(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Jb(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:oo(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:rl,ink:li}:n?.restrictedView?{icon:"restrictedView",color:rl,ink:li}:n?.premium?{icon:"premium",color:Qb,ink:li}:null}function ey(e,t){if(!e)return;let n,o=0;for(let[r,a]of e)a>o&&(o=a,n=r);let i=t.categories?.find(r=>r.key===n)?.color;return i&&/^#[0-9a-f]{6}$/i.test(i)?i:void 0}var ty=6e3;function sl(e){let{doc:t,units:n,seats:o,surfaces:i,focal:r}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let l of n)for(let u of l.objects)u.type==="section"&&u.zone&&c.set(u.id,u.zone);let m=new Map;for(let l=0;l<o.length;l++){let u=o[l],h=i.seatOwner[l],f=u.zoneId??(h?c.get(h):void 0);if(!f)continue;let d=m.get(f);d||(d={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},m.set(f,d)),d.n++,u.x<d.minX&&(d.minX=u.x),u.y<d.minY&&(d.minY=u.y),u.x>d.maxX&&(d.maxX=u.x),u.y>d.maxY&&(d.maxY=u.y),d.sumY+=i.seatDeckY(l)}for(let l of a){let u=m.get(l.id),h=[];for(let[f,d]of c)d===l.id&&h.push(f);if(!u||u.n===0){s.push({id:l.id,label:l.label,color:pe(l.color),sectionIds:h,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??r).x*_,1.5,(l.focalPoint??r).y*_]});continue}s.push({id:l.id,label:l.label,color:pe(l.color),sectionIds:h,seatCount:u.n,center:[(u.minX+u.maxX)/2*_,u.sumY/u.n,(u.minY+u.maxY)/2*_],radius:.5*Math.hypot((u.maxX-u.minX)*_,(u.maxY-u.minY)*_)||1,focalWorld:[(l.focalPoint??r).x*_,1.5,(l.focalPoint??r).y*_]})}}return s}function cl(e){let{doc:t,units:n,seats:o,surfaces:i,seatData:r,hintedSeatFloor:a,zones:s,focal:c}=e,m=[],l=[],u=[],h=new Map;for(let f of n)for(let d of f.objects){if(d.type!=="section"||!d.zone)continue;let p=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!p)continue;let b=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&b===p)continue;let g=h.get(d.zone);g||h.set(d.zone,g=new Set),g.add(p)}for(let f of s)f.seatCount!==0&&(h.get(f.id)?.has(f.label.trim().toLocaleLowerCase())||m.push({id:`zone:${f.id}`,kind:"zone",text:f.label,anchor:[f.center[0],f.center[1]+Ub,f.center[2]],color:t.zones?.find(d=>d.id===f.id)?.color}));{let f=new Map,d=new Map,p=new Map,b=new Map;for(let g=0;g<o.length;g++){let x=i.seatOwner[g];if(!x)continue;let S=f.get(x);S||(S={n:0,x:0,y:0,deck:0},f.set(x,S)),S.n++,S.x+=o[g].x,S.y+=o[g].y,S.deck+=i.seatDeckY(g);let I=o[g].categoryKey;if(I){let y=d.get(x);y||(y=new Map,d.set(x,y)),y.set(I,(y.get(I)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let y=p.get(x);y?y.push(g):p.set(x,[g])}let M=b.get(x);M||(M={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},b.set(x,M)),M.minDeck=Math.min(M.minDeck,i.seatDeckY(g)),M.maxDeck=Math.max(M.maxDeck,i.seatDeckY(g)),o[g].x<M.minX&&(M.minX=o[g].x),o[g].x>M.maxX&&(M.maxX=o[g].x),o[g].y<M.minY&&(M.minY=o[g].y),o[g].y>M.maxY&&(M.maxY=o[g].y)}for(let g of n)for(let x of g.objects){if(x.type!=="section"||Vc(x))continue;let S=f.get(x.id);if(!S||S.n===0)continue;let I=b.get(x.id),M=[S.x/S.n*_,S.deck/S.n,S.y/S.n*_],y=x.displayLabel||x.label||x.id;l.push({id:x.id,floorIndex:g.index,label:y,seatCount:S.n,center:M,radius:Math.max(1,Math.hypot(I.maxX-I.minX,I.maxY-I.minY)*.5*_),box:{min:[I.minX*_-.4,I.minDeck,I.minY*_-.4],max:[I.maxX*_+.4,I.maxDeck+1,I.maxY*_+.4]},focalWorld:[g.focal.x*_,g.baseHeightM+1.5,g.focal.y*_]});let P=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&P===y.trim().toLocaleLowerCase())){let v=ey(d.get(x.id),t),w=p.get(x.id);m.push({id:`section:${x.id}`,kind:"section",text:y,anchor:[M[0],M[1]+jb,M[2]],floorIndex:g.index,...v?{tint:v}:{},...w?{wheelchairSeats:w}:{}})}}}{for(let M of n)for(let y of M.objects){if(y.type!=="gaArea")continue;let P=Pn(y.points);if(!P)continue;let v=y.displayLabel||y.label||y.id;m.push({id:`ga:${y.id}`,kind:"ga",text:y.capacity>0?`${v} \xB7 ${y.capacity.toLocaleString()}`:v,anchor:[P.x*_,M.baseHeightM+Yb,P.y*_],floorIndex:M.index})}let f=new Map,d=new Map;for(let M of n)for(let y of M.objects)if(y.type==="section"&&f.set(y.id,y.displayLabel||y.label||y.id),y.type==="row"){let P=y.displayLabel?.trim()||y.segmentedRow?.displayLabel?.trim();P&&d.set(y.id,P)}let p=new Map;for(let M=0;M<o.length;M++){let y=o[M],P=Math.hypot(y.x-c.x,y.y-c.y),v=p.get(y.rowId);(!v||P>v.far)&&p.set(y.rowId,{seat:y,index:M,far:P})}for(let[M,y]of p){let P=i.seatOwner[y.index]??y.seat.sectionId,v=al(y.seat.label,M,f.get(P??""),d.get(M));v&&m.push({id:`row:${M}`,kind:"row",text:v,anchor:[y.seat.x*_,i.seatDeckY(y.index)+Kb,y.seat.y*_],floorIndex:a[y.index]})}let b=new Map;for(let M=0;M<o.length;M++){let y=o[M],P=b.get(y.rowId);P||(P={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:al(y.label,y.rowId,f.get(i.seatOwner[M]??y.sectionId??""),d.get(y.rowId)),sectionId:i.seatOwner[M]??y.sectionId},b.set(y.rowId,P));let v=M*3,w=r.iPosition[v],R=r.iPosition[v+1],C=r.iPosition[v+2];P.n++,P.x+=w,P.y+=R,P.z+=C,P.minX=Math.min(P.minX,w),P.maxX=Math.max(P.maxX,w),P.minZ=Math.min(P.minZ,C),P.maxZ=Math.max(P.maxZ,C)}for(let[M,y]of b)u.push({id:M,label:y.label,sectionId:y.sectionId,seatCount:y.n,center:[y.x/y.n,y.y/y.n,y.z/y.n],radius:Math.max(.8,Math.hypot(y.maxX-y.minX,y.maxZ-y.minZ)*.5)});let g=0,x=(M,y)=>{g++,m.push({id:`access:${o[M].id}`,kind:"access",text:y.name,icon:y.icon,color:y.color,...y.ink?{ink:y.ink}:{},seatWidthM:r.iChairWidth[M]*2,anchor:[o[M].x*_,i.seatDeckY(M)+qb,o[M].y*_],floorIndex:a[M],rowId:o[M].rowId})},S=null,I=()=>{if(S){let M=il(o[S.seats[0]]),y=S.seats.length,P=Math.max(1,Math.round(y/Zb));for(let v=0;v<P&&g<ol;v++)x(S.seats[Math.min(y-1,Math.floor((v+.5)*y/P))],M)}S=null};for(let M=0;M<o.length&&g<ol;M++){let y=il(o[M]);if(y&&o[M].accessibility?.length){I(),x(M,y);continue}if(!y){I();continue}S&&S.rowId===o[M].rowId&&S.icon===y.icon?S.seats.push(M):(I(),S={rowId:o[M].rowId,icon:y.icon,seats:[M]})}if(I(),o.length<=ty)for(let M=0;M<o.length;M++){let y=o[M],P=ui(y.displayLabel||y.label);P&&m.push({id:`seat:${y.id}`,kind:"seat",seatWidthM:r.iChairWidth[M]*2,text:P,anchor:[y.x*_,i.seatDeckY(M)+$b,y.y*_],floorIndex:a[M],rowId:y.rowId})}}for(let f of n)for(let d of f.objects)if(d.type==="shape"&&d.role&&Wb.has(d.role)){let p=Se(d),b=p?Pn(p):null;if(!b||!d.label)continue;m.push({id:`architecture:${d.id}`,kind:d.role==="stage"?"stage":d.role==="entrance"||d.role==="exit"?"gate":"annotation",text:d.label,...d.role==="entrance"||d.role==="exit"?{icon:d.role}:{},anchor:[b.x*_,f.baseHeightM+Qe(d).heightM+nl,b.y*_],color:d.fill,floorIndex:f.index})}else if(d.type==="text"){if(!d.text)continue;m.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*_,f.baseHeightM+nl,d.position.y*_],color:d.color,rotation:d.rotation,floorIndex:f.index})}else if(d.type==="booth"){let p=Je(d);if(!p)continue;let b=Pn(p);if(!b)continue;m.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[b.x*_,f.baseHeightM+Ao+Xb,b.y*_],floorIndex:f.index})}return{labels:m,sections:l,rows:u}}function ll(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 ui(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function al(e,t,n,o){if(o?.trim())return o.trim();let i=e?e.lastIndexOf("-"):-1,r=i>0?e.slice(0,i):t;return r&&Xc(r,n)}function ul(e){let{doc:t,units:n,seats:o,surfaces:i,solids:r,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let m=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let h=0;h<r.floor.length;h+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(r.floor[h]))),d=h*3,p=m[f];p.minX=Math.min(p.minX,r.position[d]),p.minY=Math.min(p.minY,r.position[d+1]),p.minZ=Math.min(p.minZ,r.position[d+2]),p.maxX=Math.max(p.maxX,r.position[d]),p.maxY=Math.max(p.maxY,r.position[d+1]),p.maxZ=Math.max(p.maxZ,r.position[d+2])}let l=new Map;for(let h=0;h<n.length;h++)for(let f of n[h].objects)f.type==="section"&&l.set(f.id,h);let u=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let h=0;h<o.length;h++){let f=i.seatOwner[h],d=(f!==null?l.get(f):void 0)??a[h];if(d===void 0)continue;let p=u[d],b=o[h];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let g=i.seatDeckY(h);p.sumX+=b.x*_,p.sumDeck+=g,p.sumZ+=b.y*_,p.minDeck=Math.min(p.minDeck,g),p.maxDeck=Math.max(p.maxDeck,g+1.6),s[h]=d}for(let h=0;h<n.length;h++){let f=u[h],d=t.floors?.[h],p=m[h],b=Math.min(f.n?f.minX*_:n[h].focal.x*_-1,Number.isFinite(p.minX)?p.minX:1/0),g=Math.max(f.n?f.maxX*_:n[h].focal.x*_+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(f.n?f.minY*_:n[h].focal.y*_-1,Number.isFinite(p.minZ)?p.minZ:1/0),S=Math.max(f.n?f.maxY*_:n[h].focal.y*_+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),I=Math.min(f.n?Math.min(n[h].baseHeightM,f.minDeck):n[h].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),M=Math.max(f.n?Math.max(f.maxDeck,I+.5):I+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),y=[f.n?f.sumX/f.n:(b+g)/2,f.n?f.sumDeck/f.n:(I+M)/2,f.n?f.sumZ/f.n:(x+S)/2],P=Math.max(1,.5*Math.hypot(g-b,M-I,S-x));c.push({index:h,id:d?.id??`floor-${h}`,label:d?.name??(n.length>1?`Floor ${h+1}`:"Venue"),seatCount:f.n,center:y,radius:P,box:{min:[b,I,x],max:[g,M,S]},focalWorld:[n[h].focal.x*_,n[h].baseHeightM+1.5,n[h].focal.y*_]})}}return c}function mi(e,t){let n=1/0,o=1/0,i=-1/0,r=-1/0,a=(s,c)=>{s<n&&(n=s),c<o&&(o=c),s>i&&(i=s),c>r&&(r=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 m of c.outline)a(m.x,m.y);else if(c.type==="shape"&&c.points)for(let m of c.points)a(m.x,m.y);else if(c.type==="gaArea")for(let m of c.points)a(m.x,m.y);else if(c.type==="booth"){let m=Je(c);if(m)for(let l of m)a(l.x,l.y)}else if(c.type==="table"){let m=Ro(c);if(m)for(let l of m)a(l.x,l.y)}else if(c.type==="decorImage"){let m=Eo(c);if(m)for(let l of m)a(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,i=100,r=100),{minX:n,minY:o,maxX:i,maxY:r}}function bl(e,t,n,o,i,r,a){if(t.length===1){let s=n.map(h=>({x:h.x,y:h.y}));for(let h of t[0].objects)h.type==="section"?s.push(...h.outline):h.type==="shape"?s.push(...Se(h)??h.points??[]):h.type==="gaArea"?s.push(...h.points):h.type==="booth"?s.push(...Je(h)??[]):h.type==="table"?s.push(...Ro(h)??[]):h.type==="decorImage"&&s.push(...Eo(h)??[]);if(dl(e,t[0],n,r)||pl(e,t[0],n,s,r))return!1;if(a&&fl(e,t[0].baseHeightM,s,r,a))return!0;let c=Ln(s),m=(i.minX+i.maxX)/2,l=(i.minY+i.maxY)/2,u=c.length>=3?c.map(h=>{let f=h.x-m,d=h.y-l,p=Math.max(1,Math.hypot(f,d));return{x:h.x+f/p*80,y:h.y+d/p*80}}):Rn(i.minX-28,i.minY-28,i.maxX-i.minX+56,i.maxY-i.minY+56);return ue(e,u,void 0,()=>-.04,-.22,r.ground,r.ground,ce),!1}else{let s=t.reduce((b,g)=>g.baseHeightM<b.baseHeightM?g:b);e.setFloor(s.index);let c={...s,objects:t.flatMap(b=>b.objects)},m=n.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&m.push(...b.outline);if(dl(e,c,n,r)||pl(e,c,n,m,r))return!1;if(a&&fl(e,s.baseHeightM,m,r,a))return!0;let l=n.filter((b,g)=>o[g]===s.index),u=mi([s],l),h=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),f=Math.max(28,Math.min(80,h*.04)),d=Rn(u.minX-f,u.minY-f,u.maxX-u.minX+f*2,u.maxY-u.minY+f*2),p=s.baseHeightM-.03;return ue(e,d,void 0,()=>p,p-.22,r.ground,r.ground,ce),!1}}function fi(e,t,n,o){let{cx:i,cz:r,radius:a}=n,s=1/0,c=1/0,m=1/0,l=-1/0,u=-1/0,h=-1/0,f=(b,g,x)=>{s=Math.min(s,b),l=Math.max(l,b),c=Math.min(c,g),u=Math.max(u,g),m=Math.min(m,x),h=Math.max(h,x)};for(let b=0;b<e.position.length;b+=3){let g=b/3;o&&g>=o[0]&&g<o[1]||f(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let g=b*3,x=t.iPosition[g],S=t.iPosition[g+1],I=t.iPosition[g+2],M=Math.max(.35,t.iMaxRadius[b]??.35);f(x-M,S,I-M),f(x+M,S+1.6,I+M)}Number.isFinite(s)||(s=i-a,l=i+a,c=0,u=a*.16,m=r-a,h=r+a);let d=[(s+l)/2,(c+u)/2,(m+h)/2],p=Math.max(1,.5*Math.hypot(l-s,u-c,h-m));return{center:d,radius:p,minY:c,maxY:u}}var ny=4096;function yl(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/ny)),i=Math.ceil(e.count/o),r=new Float32Array((i*2+t.length*4+n.length)*3),a=0;for(let s=0;s<e.count;s+=o){let c=e.iPosition[s*3],m=e.iPosition[s*3+1],l=e.iPosition[s*3+2];r[a++]=c,r[a++]=m,r[a++]=l,r[a++]=c,r[a++]=0,r[a++]=l}for(let[s,c,m]of n)r[a++]=s,r[a++]=c,r[a++]=m;for(let s of t)for(let[c,m]of[[-1,-1],[1,-1],[1,1],[-1,1]])r[a++]=s.cx+c*s.halfX,r[a++]=s.y,r[a++]=s.cz+m*s.halfZ;return r.subarray(0,a)}function gl(e,t,n,o,i,r,a=[]){let s=1/0,c=1/0,m=-1/0,l=-1/0;for(let M=0;M<e.count;M++){let y=M*3,P=e.iPosition[y],v=e.iPosition[y+2];P<s&&(s=P),P>m&&(m=P),v<c&&(c=v),v>l&&(l=v)}for(let[M,,y]of a)M<s&&(s=M),M>m&&(m=M),y<c&&(c=y),y>l&&(l=y);for(let M of t)s=Math.min(s,M.cx-M.halfX),m=Math.max(m,M.cx+M.halfX),c=Math.min(c,M.cz-M.halfZ),l=Math.max(l,M.cz+M.halfZ);let u=n.minX*_,h=n.maxX*_,f=n.minY*_,d=n.maxY*_,p=u,b=h,g=f,x=d;if(Number.isFinite(s)){let M=Math.max(2,.06*Math.hypot(m-s,l-c));p=Math.max(u,s-M),b=Math.min(h,m+M),g=Math.max(f,c-M),x=Math.min(d,l+M)}let S=Math.min(0,o),I=Math.max(i,r*.05);return{min:[p,S,g],max:[b,I,x]}}var ml=12,oy=.6,ry=40;function fl(e,t,n,o,i){let r=Ln([...n]);if(r.length<3)return!1;let a=1/0,s=1/0,c=-1/0,m=-1/0;for(let I of r)a=Math.min(a,I.x),c=Math.max(c,I.x),s=Math.min(s,I.y),m=Math.max(m,I.y);let l=Math.hypot(c-a,m-s)*_,u=Ze(r,ml/_,1.2),h=Math.max(ry,l*oy),f=Ze(r,(ml+h)/_,1.2);if(u.length!==f.length)return!1;let d=be(o.ground,[.78,.76,.72],.35),p=be(o.ground,[.56,.62,.52],.3);ue(e,u,void 0,()=>t-.04,t-.22,d,d,ce);let b=t-.05,g=u.map(I=>[I.x*_,b,I.y*_]),x=f.map(I=>[I.x*_,b,I.y*_]),S=[0,1,0];for(let I=0;I<g.length;I++){let M=(I+1)%g.length;e.tri(g[I],x[M],x[I],S,p,i,i),e.tri(g[I],g[M],x[M],S,p,p,i)}return!0}function dl(e,t,n,o){let i=Qt(t,n);if(!i)return!1;let r=t.baseHeightM,a=be(o.ground,[.62,.55,.47],.4);return ue(e,i,void 0,()=>r-.04,r-.22,a,a,ce),!0}var iy=3e3,ay=20,hl=1.5,sy=1.2,cy=.25;function pl(e,t,n,o,i){if(!n.length||n.length>iy||o.length<3)return!1;for(let w of t.objects){if(w.type==="shape"&&co(w.stageKind))return!1;if(w.type==="section"){let{height:R}=yt(w,{floorBaseHeightM:t.baseHeightM});if(R-t.baseHeightM>ay)return!1}}let r=0,a=0;for(let w of o)r+=w.x,a+=w.y;r/=o.length,a/=o.length;let s=0,c=0,m=0;for(let w of o){let R=w.x-r,C=w.y-a;s+=R*R,c+=C*C,m+=R*C}let l=.5*Math.atan2(2*m,s-c),u=Math.cos(l),h=Math.sin(l),f=-h,d=u,p=1/0,b=-1/0,g=1/0,x=-1/0;for(let w of o){let R=(w.x-r)*u+(w.y-a)*h,C=(w.x-r)*f+(w.y-a)*d;p=Math.min(p,R),b=Math.max(b,R),g=Math.min(g,C),x=Math.max(x,C)}let S=w=>[[p-w,g-w],[b+w,g-w],[b+w,x+w],[p-w,x+w]].map(([R,C])=>({x:r+u*R+f*C,y:a+h*R+d*C})),I=S(hl/_),M=S((hl+cy)/_),y=t.baseHeightM,P=be(i.ground,[.62,.55,.47],.4),v=be(i.ground,[.86,.86,.84],.55);return ue(e,M,void 0,()=>y-.04,y-.22,P,P,ce),ue(e,M,[I.slice().reverse()],()=>y+sy,y-.04,be(v,[1,1,1],.2),v,ce),!0}function xl(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let i=ts(t);if(!i.ok||i.value.id!==e)return o();let r=new Map;for(let u of n)for(let h of u.objects)h.type==="shape"&&r.set(h.id,{shape:h,unit:u});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(u=>{let h=u.runtimeContentImageUrl;return[u.id,typeof h=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(h)?h:void 0]})),m=[];for(let u of i.value.overlay.productionElements??[]){let h=r.get(u.objectId),f=h?Se(h.shape):null,d=u.baseElevationM??0;if(!h||!f||f.length<3||!u.id||a.has(u.id)||s.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();a.add(u.id),s.add(u.objectId);let p=f.map(v=>v.x*_),b=f.map(v=>v.y*_),g=h.unit.baseHeightM+d,x=Math.min(...p),S=Math.max(...p),I=Math.min(...b),M=Math.max(...b),y,P=c.get(u.id)??u.contentImageUrl;if(u.kind==="screen"&&P&&(y=Ws(f,g,g+u.heightM,h.unit.focal),!y))if(S-x>=M-I){let v=Math.abs(I-h.unit.focal.y*_)<=Math.abs(M-h.unit.focal.y*_)?I-.006:M+.006;y=[[x,g,v],[S,g,v],[x,g+u.heightM,v],[S,g+u.heightM,v]]}else{let v=Math.abs(x-h.unit.focal.x*_)<=Math.abs(S-h.unit.focal.x*_)?x-.006:S+.006;y=[[v,g,I],[v,g,M],[v,g+u.heightM,I],[v,g+u.heightM,M]]}m.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:h.unit.index,baseY:g,topY:g+u.heightM,bounds:{min:[x,g,I],max:[S,g+u.heightM,M]},occlusion:u.occlusion,...P?{contentImageUrl:P}:{},...y?{contentPlane:y}:{}})}let l=m.sort((u,h)=>u.id.localeCompare(h.id));return{byObjectId:new Map(l.map(u=>[u.objectId,u])),elements:l}}var vl=[.13,.14,.17],on=[.4,.43,.47],ly=.18,uy=.02,my=2.4,fy=1500,dy=240,hy=.25;function Ml(e,t,n,o){let i=t.stageKind??"";if(Ot(i)||i==="round"||!o.length)return;let r=Se(t);if(!r||r.length<3)return;let a={x:r.reduce((L,V)=>L+V.x,0)/r.length,y:r.reduce((L,V)=>L+V.y,0)/r.length},s=0,c=0,m=new Set;for(let L of o)s+=L.x,c+=L.y,m.add(Math.floor(Math.atan2(L.y-a.y,L.x-a.x)*180/Math.PI/10));let l=a.x-s/o.length,u=a.y-c/o.length,h=Math.hypot(l,u);if(h<1e-6)return;let f=o.reduce((L,V)=>L+Math.hypot(V.x-a.x,V.y-a.y),0)/o.length;if(m.size*10>dy&&h<hy*f)return;let d=l/h,p=u/h,b=-p,g=d,x=-1/0,S=1/0,I=1/0,M=-1/0;for(let L of r){let V=(L.x-a.x)*d+(L.y-a.y)*p,F=(L.x-a.x)*b+(L.y-a.y)*g;x=Math.max(x,V),S=Math.min(S,V),I=Math.min(I,F),M=Math.max(M,F)}let y=(M-I)*_,P=(x-S)*_;if(y<3||P<1.5||y*P>fy)return;let v=ly/_,w=(L,V)=>({x:a.x+d*L+b*V,y:a.y+p*L+g*V}),R=(L,V,F,G)=>[w(L,F),w(L,G),w(V,G),w(V,F)],C=n+Math.max(3.5,Math.min(8,y*.35)),O=n+Math.min(my,C-n-1),E=.2/_,A=S+Math.min(P*.25,1.5)/_,T=uy/_;ue(e,R(x-2*v+T,x-v-T,I+v+E,M-v-E),void 0,()=>O,n,vl,vl,ce);for(let[L,V]of[[I+v,I+v+E],[M-v-E,M-v]])ue(e,R(x-2*v,x-v,L,V),void 0,()=>C+.3,n,on,on,ce),ue(e,R(A+E,x-2*v,L,V),void 0,()=>C+.3,C,on,on,ce);ue(e,R(A,A+E,I+v,M-v),void 0,()=>C+.3,C,on,on,ce)}function Ue(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ze(e){return Array.isArray(e)?e:[]}function py(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!Ue(n))continue;let o=Ue(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function Lo(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function by(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function yy(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let i=0;i<4;i++)for(let r=0;r<4;r++)n[o*4+i]+=e[r*4+i]*t[o*4+r];return n}function gy(e){let t=Lo(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Lo(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Lo(e.rotation,4),i=e.scale===void 0?[1,1,1]:Lo(e.scale,3);if(!n||!o||!i)return null;let[r,a,s,c]=o,m=Math.hypot(r,a,s,c);if(!(m>1e-8))return null;let l=r/m,u=a/m,h=s/m,f=c/m,d=l+l,p=u+u,b=h+h,g=l*d,x=l*p,S=l*b,I=u*p,M=u*b,y=h*b,P=f*d,v=f*p,w=f*b;return[(1-(I+y))*i[0],(x+w)*i[0],(S-v)*i[0],0,(x-w)*i[1],(1-(g+y))*i[1],(M+P)*i[1],0,(S+v)*i[2],(M-P)*i[2],(1-(g+I))*i[2],0,n[0],n[1],n[2],1]}function xy(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function vy(e){let t=e[0],n=e[4],o=e[8],i=e[1],r=e[5],a=e[9],s=e[2],c=e[6],m=e[10],l=r*m-a*c,u=a*s-i*m,h=i*c-r*s,f=t*l+n*u+o*h;if(Math.abs(f)<1e-12)return null;let d=1/f;return[l*d,u*d,h*d,(o*c-n*m)*d,(t*m-o*s)*d,(n*s-t*c)*d,(n*a-o*r)*d,(o*i-t*a)*d,(t*r-n*i)*d]}function Sl(e,t,n,o){let i=e[0]*t+e[1]*n+e[2]*o,r=e[3]*t+e[4]*n+e[5]*o,a=e[6]*t+e[7]*n+e[8]*o,s=Math.hypot(i,r,a)||1;return i/=s,r/=s,a/=s,[i,r,a]}function My(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,i=null;for(;n+8<=e.byteLength;){let r=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,r%4!==0||n+r>e.byteLength)return null;let s=e.subarray(n,n+r);if(a===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Ue(c))return null;o=c}catch{return null}else if(a===5130562&&!i)i=s;else return null;n+=r}return n===e.byteLength&&o&&i?{json:o,bin:i}:null}function Sy(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function wy(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Py(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Iy(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=My(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:i}=n;if(!Ue(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let r=ze(o.extensionsUsed).filter(I=>typeof I=="string");if(r.includes("KHR_draco_mesh_compression")||py(o))return{ok:!1,issue:"draco_not_allowed"};if(r.length||ze(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(ze(o.images).length||ze(o.textures).length)return{ok:!1,issue:"external_resource"};let a=ze(o.buffers);if(a.length!==1||!Ue(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>i.byteLength)return{ok:!1,issue:"external_resource"};let s=ze(o.accessors),c=ze(o.bufferViews),m=ze(o.meshes),l=ze(o.nodes),u=ze(o.scenes),h=typeof o.scene=="number"?o.scene:0;if(!Ue(u[h]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(i.buffer,i.byteOffset,i.byteLength),d=(I,M,y)=>{if(typeof I!="number"||!Number.isInteger(I)||!Ue(s[I]))return null;let P=s[I];if(P.type!==M||P.sparse!==void 0||P.normalized===!0||typeof P.count!="number"||!Number.isInteger(P.count)||P.count<1||typeof P.componentType!="number"||!y.includes(P.componentType)||typeof P.bufferView!="number")return null;let v=c[P.bufferView];if(!Ue(v)||v.buffer!==0||typeof v.byteLength!="number"||!Number.isInteger(v.byteLength)||v.byteLength<0)return null;let w=wy(P.type),R=Sy(P.componentType),C=typeof v.byteStride=="number"?v.byteStride:w*R,O=typeof v.byteOffset=="number"?v.byteOffset:0,E=typeof P.byteOffset=="number"?P.byteOffset:0,A=O+E,T=E+(P.count-1)*C+w*R;if(!Number.isInteger(C)||!Number.isInteger(O)||!Number.isInteger(E)||C<w*R||O<0||E<0||O+v.byteLength>i.byteLength||T>v.byteLength)return null;let L=[];for(let V=0;V<P.count;V++){let F=[];for(let G=0;G<w;G++){let j=Py(f,A+V*C+G*R,P.componentType);if(!Number.isFinite(j))return null;F.push(j)}L.push(F)}return L},p=[],b=[],g=0,x=new Set,S=(I,M)=>{if(typeof I!="number"||!Number.isInteger(I)||!Ue(l[I])||x.has(I))return!1;x.add(I);let y=l[I],P=gy(y);if(!P)return!1;let v=yy(M,P),w=vy(v);if(!w)return!1;if(y.mesh!==void 0){if(typeof y.mesh!="number")return!1;let R=m[y.mesh];if(!Ue(R))return!1;for(let C of ze(R.primitives)){if(!Ue(C)||C.mode!==void 0&&C.mode!==4||!Ue(C.attributes))return!1;let O=d(C.attributes.POSITION,"VEC3",[5126]),E=C.attributes.NORMAL===void 0?null:d(C.attributes.NORMAL,"VEC3",[5126]);if(!O||C.attributes.NORMAL!==void 0&&!E)return!1;let A=O.length;if(C.indices!==void 0){let L=typeof C.indices=="number"?s[C.indices]:null;A=Ue(L)?L.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(g+=A/3,g>1e5))return!1;let T=C.indices===void 0?O.map((L,V)=>[V]):d(C.indices,"SCALAR",[5121,5123,5125]);if(!T||T.length%3!==0||T.length!==A)return!1;for(let L=0;L<T.length;L+=3){let V=[T[L][0],T[L+1][0],T[L+2][0]];if(V.some(j=>!Number.isInteger(j)||j<0||j>=O.length))return!1;let F=V.map(j=>xy(v,...O[j])),G=null;if(!E){let j=F[1][0]-F[0][0],N=F[1][1]-F[0][1],k=F[1][2]-F[0][2],B=F[2][0]-F[0][0],D=F[2][1]-F[0][1],H=F[2][2]-F[0][2];G=Sl([1,0,0,0,1,0,0,0,1],N*H-k*D,k*B-j*H,j*D-N*B)}for(let j=0;j<3;j++)p.push(...F[j]),b.push(...E?Sl(w,...E[V[j]]):G)}}}for(let R of ze(y.children))if(!S(R,v))return!1;return x.delete(I),!0};for(let I of ze(u[h].nodes))if(!S(I,by()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||p.length!==g*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(p),normal:new Float32Array(b)}}function wl(e){try{return Iy(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function rn(e){let{doc:t}=e,n=Ha(t.theme),o=n.structure,i=Ts(t,e.eventConfigurationId??t.eventConfigurationId),r=xl(e.eventConfigurationId,e.eventConfiguration,i),a=e.seats,s=new ao,c=null;if(e.registeredShellGlb){let X=wl(e.registeredShellGlb);if(X.ok){let K=X.position.length/3,Y=new Float32Array(X.position.length),ie=n.materials.shell??o.tierWall;for(let te=0;te<K;te++){let ae=X.normal[te*3+1],J=ae<-.25?.4:.62+.38*Math.max(0,ae);Y[te*3]=ie[0]*J,Y[te*3+1]=ie[1]*J,Y[te*3+2]=ie[2]*J}c={position:X.position,normal:X.normal,color:Y,floor:new Float32Array(K).fill(-2),material:new Float32Array(K),count:K}}}let m=new Map;for(let X of i)for(let K of X.objects)m.set(K.id,X.index),K.type==="section"&&m.set(K.logicalSectionId??K.id,X.index);let l=a.map(X=>m.get(X.sectionId??"")??m.get(X.rowId??"")??0),u=mi(i,a),h=s.vertexCount,d=bl(s,i,a,l,u,o,be(n.background.top,n.background.bottom,.5))?s.vertexCount:h,p=ys(t,a),b=new Map,g=new Map;for(let X of t.categories??[])b.set(X.key,X.color),X.seatGlyph&&g.set(X.key,X.seatGlyph);let x=[],S=js(i,a,l),I=new Map;a.forEach((X,K)=>{let Y=S.seatDeckY(K);Number.isFinite(Y)&&I.set(X.rowId,Math.min(I.get(X.rowId)??1/0,Y))});let M=new Float32Array(a.length),y=[],P=new Map((t.floors??[]).map((X,K)=>[X.id,K])),v=i.map(()=>[]);for(let X of a){let K=X.floorId?P.get(X.floorId)??0:0;v[Math.min(K,v.length-1)]?.push(X)}let w=(X,K)=>{if(!K||K.length<3)return!1;let Y=Math.min(...K.map(J=>J.x)),ie=Math.max(...K.map(J=>J.x)),te=Math.min(...K.map(J=>J.y)),ae=Math.max(...K.map(J=>J.y));for(let J=0;J<X;J++)for(let oe of v[J])if(!(oe.x<Y||oe.x>ie||oe.y<te||oe.y>ae)&&Oe(oe,K,void 0))return!0;return!1},R=null,C=X=>i.length===1?a:a.filter((K,Y)=>l[Y]===X),O=(X,K)=>{let Y=Je(X);if(!Y)return!1;let ie=1/0,te=1/0,ae=-1/0,J=-1/0;for(let oe of Y)ie=Math.min(ie,oe.x),ae=Math.max(ae,oe.x),te=Math.min(te,oe.y),J=Math.max(J,oe.y);return a.some((oe,Pe)=>oe.kind!=="booth"&&(i.length===1||l[Pe]===K)&&oe.x>ie&&oe.x<ae&&oe.y>te&&oe.y<J&&He(Y,oe.x,oe.y))},E;for(let X=0;X<i.length;X++){let K=i[X];s.setFloor(X);let Y=Qt(K,C(X)),ie=0;if(Y){let re=0;for(let ge of K.objects)if(ge.type==="section")for(let xe of S.bySection.get(ge.id)?.rowLevels??[])re=Math.max(re,xe.y-K.baseHeightM);if(ie=Bs(re),!E){let ge=Vs(Y);E={centre:[ge.x*_,ge.y*_]}}}let te=new yo,ae=[],J=K.objects.filter(re=>re.type==="shape"&&(re.role==="entrance"||re.role==="exit")),oe=K.objects.filter(re=>re.type==="section"&&!!re.outline&&re.outline.length>=3),Pe=yc(K.objects.filter(re=>re.type==="booth"),K.focal);for(let re of K.objects)if(re.type==="section"){let ge=s.vertexCount;kc(s,re,K,gs(re,p),S.bySection.get(re.id),te,oe,o,X>0&&w(X,re.outline));let xe=s.vertexCount-ge;xe>0&&y.push({sectionId:re.id,start:ge,count:xe})}else if(re.type==="shape"){let ge=r.byObjectId.get(re.id),xe=x.length,Ye=Y!==null&&re.role==="wall"&&!ge;s.setMaterial(Ye?Ns:(ge?.kind??re.role)==="screen"?1:0);let et=re.role==="stage"&&!ge?xc(re,C(X)):Ye&&re.heightM===void 0?{...re,heightM:ie}:re,Ne=Os(et,ae);if(dc(s,et,K.baseHeightM+Ne.supportOffsetM,Ne.topOffsetM-Ne.supportOffsetM,o,K.focal,x,ge,J),s.setMaterial(0),re.role==="stage"&&!ge&&x.length>xe&&(R??X)===X){R=X;let Ke=t.floors?.[X]?.id,we=i.length>1&&Ke?a.filter(Et=>Et.floorId===Ke):a;Ml(s,et,x[x.length-1].y,we)}}else re.type==="gaArea"?pc(s,re,K.baseHeightM,pe(b.get(re.categoryKey)),o):re.type==="booth"?uc(s,re,K.baseHeightM,pe(b.get(re.categoryKey)),o,Pe.get(re.id)??K.focal,O(re,X)):re.type==="table"?fc(s,re,Math.max(K.baseHeightM,I.get(re.id)??K.baseHeightM),pe(re.fill??t.theme?.decorFill??"#232c40"),o,!!(re.fill??t.theme?.decorFill)):re.type==="decorImage"&&hc(s,re,K.baseHeightM,o);Fc(s,K,a,S,o,n.materials.shell,!c)}let A=i.length>1?{x:i.reduce((X,K)=>X+K.focal.x,0)/i.length,y:i.reduce((X,K)=>X+K.focal.y,0)/i.length}:t.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},T=Fa(c?[s.build(),c]:[s.build()]),L=Da(a,e.initialState,S,M,b,g),V=sl({doc:t,units:i,seats:a,surfaces:S,focal:A}),{labels:F,sections:G,rows:j}=cl({doc:t,units:i,seats:a,surfaces:S,seatData:L,hintedSeatFloor:l,zones:V,focal:A}),N=new Map(G.map((X,K)=>[X.id,K]));S.seatOwner.forEach((X,K)=>{L.iSection[K]=X?N.get(X)??-1:-1});let k=ul({doc:t,units:i,seats:a,surfaces:S,solids:T,hintedSeatFloor:l,seatFloor:M});ll(F,k),L.iYaw=oa(L.iPosition,a.length,X=>a[X].rowId,X=>{let K=i[M[X]]?.focal??A;return[K.x*_,K.y*_]});let B=(u.minX+u.maxX)/2*_,D=(u.minY+u.maxY)/2*_,H=.5*Math.hypot((u.maxX-u.minX)*_,(u.maxY-u.minY)*_)||10,U=fi(T,L,{cx:B,cz:D,radius:H},[h,d]),q=fi(T,L,{cx:B,cz:D,radius:H}),$=Ay(i),ee=gl(L,x,u,U.minY,U.maxY,H,$);return{sharedAisles:Na(i.flatMap(X=>X.objects.flatMap(K=>{if(K.type!=="section")return[];let Y=S.bySection.get(K.id);return Y?[{sectionId:K.id,floorIndex:X.index,rows:Y.rowLevels}]:[]}))),solids:T,sectionSolidRanges:y,seats:L,seatSectionIds:S.seatOwner,bounds:{center:[(ee.min[0]+ee.max[0])/2,(ee.min[1]+ee.max[1])/2,(ee.min[2]+ee.max[2])/2],radius:H,groundY:0,box:ee,fitPoints:yl(L,x,$)},...E?{room:E}:{},...!E&&i.some(X=>X.objects.some(K=>K.type==="shape"&&co(K.stageKind)))?{outdoor:!0}:{},renderBounds:{center:U.center,radius:U.radius},clipBounds:{center:q.center,radius:q.radius},stateColorLUT:Ga(n,_e),theme:n,seatCount:a.length,focalWorld:[A.x*_,1.5,A.y*_],zones:V,stages:x,productionElements:r.elements,sections:G,rows:j,labels:F,floors:k}}function Ay(e){let t=[];for(let n of e)for(let o of n.objects){let i=o.type==="gaArea"?o.points:o.type==="booth"?Je(o):null;for(let r of i??[])t.push([r.x*_,n.baseHeightM,r.y*_])}return t}var wt=require("ogl"),Ry=.05,Ey=1.1,Cy=12,_y=1.6,Ty=1,ky=2.5,Ly=650,Il=[[-.15,0,0,.15,.13,.42],[-.13,-.45,.36,.13,.02,.47]],Al={centre:[0,0,-.05],hipRadius:.15,shoulderRadius:.2,height:.56,sides:8,depth:.62},di={centre:[0,.74,-.04],radii:[.1,.12,.11]},an={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40},Fy=90,c2={height:di.centre[1]+di.radii[1],radius:Math.max(Al.shoulderRadius,...Il.map(e=>Math.max(Math.abs(e[0]),Math.abs(e[3]))))};function Oy(e,t){if(t)return 0;let n=(e-an.fadeInFromM)/(an.fullByM-an.fadeInFromM);return Math.max(0,Math.min(1,n))}function Dy(e,t){return!t&&e<Fy}var Pl=24;function Ny(e){let t=[],n=[],o=[],i=(u,h,f)=>{t.push(...u),n.push(...h),o.push(f)};for(let u=0;u<16;u++){let h=u/16*Math.PI*2,f=(u+1)/16*Math.PI*2,d=S=>[Math.cos(S),0,Math.sin(S)],p=[Math.cos(h)*.012,0,Math.sin(h)*.012],b=[Math.cos(f)*.012,0,Math.sin(f)*.012],g=[Math.cos(h)*.03,1,Math.sin(h)*.03],x=[Math.cos(f)*.03,1,Math.sin(f)*.03];i(p,d(h),0),i(g,d(h),0),i(x,d(f),0),i(p,d(h),0),i(x,d(f),0),i(b,d(f),0)}let c=.16,m=.24,l=.01;for(let u=0;u<48;u++){let h=u/48*Math.PI*2,f=(u+1)/48*Math.PI*2,d=[Math.cos(h)*c,l,Math.sin(h)*c],p=[Math.cos(h)*m,l,Math.sin(h)*m],b=[Math.cos(f)*m,l,Math.sin(f)*m],g=[Math.cos(f)*c,l,Math.sin(f)*c];for(let x of[d,p,b,d,b,g])i(x,[0,1,0],1)}for(let[u,h,f,d,p,b]of Il){let g=[[[0,0,1],[[u,h,b],[d,h,b],[d,p,b],[u,p,b]]],[[0,0,-1],[[d,h,f],[u,h,f],[u,p,f],[d,p,f]]],[[1,0,0],[[d,h,b],[d,h,f],[d,p,f],[d,p,b]]],[[-1,0,0],[[u,h,f],[u,h,b],[u,p,b],[u,p,f]]],[[0,1,0],[[u,p,b],[d,p,b],[d,p,f],[u,p,f]]],[[0,-1,0],[[u,h,f],[d,h,f],[d,h,b],[u,h,b]]]];for(let[x,[S,I,M,y]]of g)for(let P of[S,I,M,S,M,y])i(P,x,2)}{let{centre:u,hipRadius:h,shoulderRadius:f,height:d,sides:p,depth:b}=Al,g=(x,S,I)=>{let M=x/p*Math.PI*2+Math.PI/p;return[u[0]+Math.cos(M)*S,u[1]+I,u[2]+Math.sin(M)*S*b]};for(let x=0;x<p;x++){let S=g(x,h,0),I=g(x+1,h,0),M=g(x+1,f,d),y=g(x,f,d),P=[I[0]-S[0],I[1]-S[1],I[2]-S[2]],v=[y[0]-S[0],y[1]-S[1],y[2]-S[2]],w=[P[1]*v[2]-P[2]*v[1],P[2]*v[0]-P[0]*v[2],P[0]*v[1]-P[1]*v[0]],R=Math.hypot(...w)||1;w=[w[0]/R,w[1]/R,w[2]/R],w[0]*(S[0]-u[0])+w[2]*(S[2]-u[2])<0&&(w=[-w[0],-w[1],-w[2]]);for(let C of[S,I,M,S,M,y])i(C,w,2);i([u[0],u[1]+d,u[2]],[0,1,0],2),i(y,[0,1,0],2),i(M,[0,1,0],2)}}{let{centre:u,radii:h}=di,f=8,d=(p,b)=>{let g=p/16*Math.PI*2,x=b/f*Math.PI,S=[Math.sin(x)*Math.cos(g),Math.cos(x),Math.sin(x)*Math.sin(g)];return[[u[0]+S[0]*h[0],u[1]+S[1]*h[1],u[2]+S[2]*h[2]],S]};for(let p=0;p<16;p++)for(let b=0;b<f;b++){let g=d(p,b),x=d(p+1,b),S=d(p+1,b+1),I=d(p,b+1);for(let[M,y]of[g,x,S,g,S,I])i(M,y,2)}}for(let u=0;u<32;u++){let h=u/32*Math.PI*2,f=(u+1)/32*Math.PI*2,d=an.baseRadius,p=an.topRadius,b=[Math.cos(h)*d,0,Math.sin(h)*d],g=[Math.cos(f)*d,0,Math.sin(f)*d],x=[Math.cos(h)*p,1,Math.sin(h)*p],S=[Math.cos(f)*p,1,Math.sin(f)*p],I=[Math.cos(h),0,Math.sin(h)],M=[Math.cos(f),0,Math.sin(f)];i(b,I,3),i(x,I,3),i(S,M,3),i(b,I,3),i(S,M,3),i(g,M,3)}return new wt.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var By=`#version 300 es
21
21
  precision highp float;
22
22
  in vec3 position; in vec3 normal; in float part;
23
23
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
24
- uniform vec3 uSeat; uniform float uHeight; uniform float uLift; uniform float uRingScale;
25
- out vec3 vNormal; out float vPart;
24
+ uniform vec3 uSeat; uniform float uHeight; uniform float uLift; uniform float uRingScale; uniform float uFigure;
25
+ uniform float uYaw; uniform float uBeamHeight; uniform float uBeam;
26
+ out vec3 vNormal; out float vPart; out float vAlong;
26
27
  void main() {
27
- vNormal = normalize(normalMatrix * normal);
28
28
  vPart = part;
29
+ vAlong = position.y;
30
+ if (part > 1.5) {
31
+ // The figure turns to face the show; the beam is round and needs no turn.
32
+ float c = cos(uYaw), s = sin(uYaw);
33
+ vec3 local = part > 2.5
34
+ ? vec3(position.x, position.y * uBeamHeight, position.z) * uHeight / 1.1
35
+ : vec3(c * position.x + s * position.z, position.y, -s * position.x + c * position.z);
36
+ vec3 turned = part > 2.5 ? normal : vec3(c * normal.x + s * normal.z, normal.y, -s * normal.x + c * normal.z);
37
+ vNormal = normalize(normalMatrix * turned);
38
+ // Both settle in as the pin lands, and vanish together when not shown.
39
+ float shown = part > 2.5 ? step(0.001, uBeam) : uFigure;
40
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(uSeat + local * shown * (1.0 - uLift * 0.5), 1.0);
41
+ return;
42
+ }
43
+ vNormal = normalize(normalMatrix * normal);
29
44
  // The stem rises out of the ring as the pin lands (uLift runs 1 \u2192 0).
30
45
  float grow = part > 0.5 ? 1.0 : 1.0 - uLift;
31
46
  // The ring is the seat's own size, not the stem's: grown with the stem it
@@ -33,27 +48,43 @@ void main() {
33
48
  float scale = part > 0.5 ? uRingScale : uHeight;
34
49
  vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
35
50
  gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
36
- }`,kb=`#version 300 es
51
+ }`,Vy=`#version 300 es
37
52
  precision highp float;
38
- in vec3 vNormal; in float vPart;
39
- uniform vec3 uColor; uniform float uRingAlpha;
53
+ in vec3 vNormal; in float vPart; in float vAlong;
54
+ uniform vec3 uColor; uniform float uRingAlpha; uniform vec3 uFigureColor; uniform float uBeam;
40
55
  out vec4 fragColor;
41
56
  void main() {
57
+ if (vPart > 2.5) {
58
+ // The follow-spot: brightest on the seat, gone well above the head.
59
+ float fade = pow(1.0 - clamp(vAlong, 0.0, 1.0), 2.2);
60
+ fragColor = vec4(mix(vec3(1.0), uFigureColor, 0.45), 0.3 * fade * uBeam);
61
+ return;
62
+ }
63
+ if (vPart > 1.5) {
64
+ // The buyer in the event's selection colour, lit like the stem with a
65
+ // bright rim, so they read as someone rather than one more spectator.
66
+ vec3 n = normalize(vNormal);
67
+ float key = max(dot(n, normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
68
+ float rim = pow(1.0 - abs(n.z), 2.5);
69
+ vec3 c = uFigureColor * (0.42 + 0.55 * key) + vec3(0.28) * rim;
70
+ fragColor = vec4(c, 1.0);
71
+ return;
72
+ }
42
73
  if (vPart > 0.5) { fragColor = vec4(uColor, uRingAlpha); return; }
43
74
  // View-space light from the upper left: a lit, round stem reads as an
44
75
  // object standing in the venue rather than a line drawn on the screen.
45
76
  float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
46
77
  vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
47
78
  fragColor = vec4(c, 1.0);
48
- }`;function Lb(e){if(e>=1)return 1;if(e<.72){let n=e/.72;return 1-(1-n)*(1-n)}let t=(e-.72)/.28;return 1-.08*Math.sin(t*Math.PI)}function Yr(e){return Math.max(Pb,Math.min(Ib,e*wb))}function Qc(e,t){let n=new xt.Transform,o=_b(e),r=new Map,i=(a,s)=>{let c=new xt.Program(e,{vertex:Tb,fragment:kb,uniforms:{uSeat:{value:a},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uColor:{value:t},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),l=new xt.Mesh(e,{geometry:o,program:c});return l.frustumCulled=!1,l.setParent(n),{mesh:l,program:c,seat:a,start:s}};return{root:n,setSeats(a,s,c){let l=new Set(a.slice(0,Zc).map(u=>u.id));for(let[u,m]of r)l.has(u)||(m.mesh.setParent(null),r.delete(u));for(let u of a.slice(0,Zc))r.has(u.id)||r.set(u.id,i(u.position,c?s:-1/0))},update(a,s,c,l=!1){let u=!1;for(let m of r.values()){let h=s[0]-m.seat[0],d=s[1]-m.seat[1],f=s[2]-m.seat[2],p=Math.hypot(h,d,f);m.mesh.visible=!c&&p>(l?Ab:Eb);let b=Yr(p),y=Math.max(0,Math.min(1,(a-m.start)/Cb));y<1&&(u=!0),m.program.uniforms.uHeight.value=b,m.program.uniforms.uRingScale.value=Math.min(b,Rb),m.program.uniforms.uLift.value=l?1:1-Lb(y),m.program.uniforms.uRingAlpha.value=.55+.4*(y<1?Math.sin(y*Math.PI):0)}return u},dispose(){for(let a of r.values())a.mesh.setParent(null);r.clear(),o.remove()}}}var Tn="#ffffff",Jc="#0b1220",kn=6,Fb=80,el=14,tl=88,nl=20,ol={floor:{size:14,weight:"700",opacity:.98},stage:{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:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Ob=640,Db=.8,Bb=11,Nb="3px 7px",Vb="2px 5px",rl="rgba(10,14,22,.62)",Gb="#f4f7fb",il=5,al=2,Hb=6,Ln=new Set(["row","seat"]),sl={stage:6,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Jt={row:{x:66,y:20},seat:{x:52,y:22}},qr=pe,Kr=e=>Di(e);function $r(e,t){let n=Kr(e),o=Kr(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function Zr(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(r=>Number(n[r])/255*o+t[r-1]*(1-o))}function zb(e,t=[.04,.06,.1],n=!0){let o=Kr(t)<.42,r=o?"#f4f7fb":"#0b1220",i=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Zr(i,t):t,s=qr(e),c=n?7:4.5,l=s&&$r(s,a)>=c?e:r;return o?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}function Ub(e,t=[.04,.06,.1]){let n=Zr(rl,t),o=qr(e);return{ink:o&&$r(o,n)>=4.5?e:Gb,backing:rl}}var jb='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',wo=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||jb,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;let n=new Set(t.map(o=>o.id));for(let[o,r]of this.nodes)n.has(o)||(r.remove(),this.nodes.delete(o))}setForcedDense(t){this.forcedDense=t}setSeatNumberRow(t){return t===this.seatNumberRow?!1:(this.seatNumberRow=t,!0)}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=ol[t].size;return!this.narrowStage||Ln.has(t)?n:Math.max(Bb,n*Db)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let r=this.nodes.get(o.id),i=r?.getBoundingClientRect(),a=!!(n&&r&&r.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:r&&Number.parseFloat(r.style.fontSize)||0,contrast:r?Number(r.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,o,r,i,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<Ob;let s=Ic(r,i,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let x of this.labels){if(!s.has(x.kind)&&!(x.kind==="seat"&&this.selectedSeatLabelIds.has(x.id)))continue;let v=x.kind==="seat"&&a&&this.selectedSeatLabelIds.has(x.id)?x.pinBase:void 0,w=v&&a?[v[0],v[1]+Yr(Math.hypot(v[0]-a[0],v[1]-a[1],v[2]-a[2])),v[2]]:x.anchor,R=tt(t,w,n,o);if(!R.visible)continue;let T=Ln.has(x.kind),O=this.sizeFor(x.kind),C=Ec(x.text,O,!T)+(T?il*2:0);if(x.kind==="seat"&&x.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(x.id)&&Tc(t,x.anchor,x.seatWidthM,n)<Math.max(22,C))continue;let A=Rc(R,C/2,O/2+(T?al:4),n,o),_=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;c.push({label:x,screen:A,focus:_c(A,_,n,o),halfWidth:C/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let l=Pc(c.filter(x=>x.label.kind==="floor"),n),u=[...c.filter(x=>!Ln.has(x.label.kind)&&x.label.kind!=="floor"),...l],m=Cc(n),h=c.filter(x=>x.label.kind==="seat"&&this.selectedSeatLabelIds.has(x.label.id)),d=Mo(h,Jt.seat.x,Jt.seat.y,m.seat);this.placePinHeads(h.filter(x=>x.label.pinBase&&!d.includes(x)).map(x=>x.screen));let f=Ac(u,tl,nl).filter(x=>!d.some(v=>_n(x,v,tl,nl))),p=Mo(c.filter(x=>x.label.kind==="row"),Jt.row.x,Jt.row.y,m.row,[...f,...d]),b=this.seatNumberRow!==void 0,y=Mo(c.filter(x=>x.label.kind==="seat"&&!this.selectedSeatLabelIds.has(x.label.id)&&(!b||this.seatNumberRow!==null&&x.label.rowId===this.seatNumberRow)),Jt.seat.x,Jt.seat.y,b?Fb:m.seat-d.length,[...f,...d,...p]),g=[...f,...p,...d,...y],M=new Set(g.map(x=>x.label.id));for(let{label:x,screen:v}of g){let R=this.nodeFor(x).style;R.display="";let T=!!x.pinBase&&this.selectedSeatLabelIds.has(x.id);R.transform=T?`translate(-50%, -100%) translate(${v.x.toFixed(1)}px, ${(v.y-kn).toFixed(1)}px)`:`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let I=g.filter(({label:x})=>!Ln.has(x.kind)).sort((x,v)=>sl[v.label.kind]-sl[x.label.kind]||x.screen.depth-v.screen.depth||x.focus-v.focus).flatMap(({label:x})=>{let v=this.nodes.get(x.id);return v&&v.style.display!=="none"?[{node:v,box:v.getBoundingClientRect()}]:[]}),S=[];for(let{node:x,box:v}of I)S.some(R=>v.left<R.right+3&&v.right+3>R.left&&v.top<R.bottom+3&&v.bottom+3>R.top)?x.style.display="none":S.push(v);for(let[x,v]of this.nodes)M.has(x)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}let o=this.selectedSeatLabelIds.has(t.id),r=this.nodeAppearance.get(n);if(r&&r.text===t.text&&r.kind===t.kind&&r.color===t.color&&r.selected===o&&r.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:t.text,kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),n.textContent=t.text,o){let p=document.createElement("span"),b=p.style;b.position="absolute",b.left="50%",b.bottom=`-${kn}px`,b.transform="translateX(-50%)",b.borderLeft=`${kn}px solid transparent`,b.borderRight=`${kn}px solid transparent`,b.borderTop=`${kn}px solid ${Tn}`,n.appendChild(p)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let i=ol[t.kind],a=n.style;a.fontSize=`${this.sizeFor(t.kind)}px`,a.fontWeight=o?"800":i.weight,a.opacity=o?"1":String(i.opacity);let s=Ln.has(t.kind),c=!s,l=zb(t.color??this.opts.ink,this.opts.backgroundRgb,!0),u=s?Ub(t.color??this.opts.ink,this.opts.backgroundRgb):l;a.color=o?Jc:u.ink,a.background=o?Tn:u.backing,a.border=o?`1px solid ${Tn}`:c?`1px solid ${l.border}`:"",a.borderRadius=o||c?"999px":`${Hb}px`;let m=this.narrowStage?Vb:Nb;a.padding=o||c?m:`${al}px ${il}px`,a.lineHeight=s?"1.1":"",a.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":c?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",a.textShadow=o||c?"none":"0 1px 1px rgba(0,0,0,0.4)",a.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],d=qr(o?Jc:u.ink)??[1,1,1],f=Zr(o?Tn:u.backing,h);return n.dataset.qualityContrast=$r(d,f).toFixed(3),a.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",n}placePinHeads(t){for(;this.pinHeads.length<t.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${el}px`,o.height=`${el}px`,o.borderRadius="50%",o.background=Tn,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let r=t[o];n.style.display=r?"":"none",r&&(n.style.transform=`translate(-50%, -100%) translate(${r.x.toFixed(1)}px, ${r.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var ll=1;var Xb=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function Wb(e){return e.every(t=>Number.isFinite(t))}function Yb(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 cl(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Ft(e){return Math.round(e*1e4)/1e4}function Kb(e){if(e)return{box:{x:Ft(e.box.x),y:Ft(e.box.y),width:Ft(e.box.width),height:Ft(e.box.height)},horizontalFillRatio:Ft(e.horizontalFillRatio),verticalFillRatio:Ft(e.verticalFillRatio),visibleAreaRatio:Ft(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function nt(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Po(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Xb.has(s.kind)),o=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,r=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)Yb(n[s].screenBox,n[c].screenBox)&&r.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=[nt("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),nt("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),nt("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),nt("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}`}]),nt("camera-invalid","The capture camera must have a finite physical pose",Wb(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),nt("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}]),nt("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),nt("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}))),nt("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}))),nt("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",r)].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:Kb(e.framing)},metrics:{minimumHierarchyFontPx:cl(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:cl(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function ul(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var Ie=require("ogl");var vt=require("ogl");var Io=`
79
+ }`;function Hy(e){if(e>=1)return 1;if(e<.72){let n=e/.72;return 1-(1-n)*(1-n)}let t=(e-.72)/.28;return 1-.08*Math.sin(t*Math.PI)}function hi(e){return Math.max(Ey,Math.min(Cy,e*Ry))}function Gy(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=t>=.25?0:Math.min(.45,(.25-t)*2.2);return e.map(o=>o+(1-o)*n)}function Rl(e,t,n=[.24,.74,1]){n=Gy(n);let o=new wt.Transform,i=Ny(e),r=new Map,a=(s,c,m)=>{let l=new wt.Program(e,{vertex:By,fragment:Vy,uniforms:{uSeat:{value:s},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uFigure:{value:1},uYaw:{value:m},uBeamHeight:{value:an.height},uBeam:{value:0},uFigureColor:{value:n},uColor:{value:t},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),u=new wt.Mesh(e,{geometry:i,program:l});return u.frustumCulled=!1,u.setParent(o),{mesh:u,program:l,seat:s,start:c}};return{root:o,setSeats(s,c,m){let l=new Set(s.slice(0,Pl).map(u=>u.id));for(let[u,h]of r)l.has(u)||(h.mesh.setParent(null),r.delete(u));for(let u of s.slice(0,Pl))r.has(u.id)||r.set(u.id,a(u.position,m?c:-1/0,u.facing??0))},update(s,c,m,l=!1){let u=!1;for(let h of r.values()){let f=c[0]-h.seat[0],d=c[1]-h.seat[1],p=c[2]-h.seat[2],b=Math.hypot(f,d,p);h.mesh.visible=!m&&b>(l?Ty:ky);let g=hi(b),x=Math.max(0,Math.min(1,(s-h.start)/Ly));x<1&&(u=!0),h.program.uniforms.uHeight.value=g,h.program.uniforms.uRingScale.value=Math.min(g,_y),h.program.uniforms.uLift.value=l?1:1-Hy(x),h.program.uniforms.uFigure.value=Dy(b,l)?1:0,h.program.uniforms.uBeam.value=Oy(b,l),h.program.uniforms.uRingAlpha.value=.55+.4*(x<1?Math.sin(x*Math.PI):0)}return u},dispose(){for(let s of r.values())s.mesh.setParent(null);r.clear(),i.remove()}}}var zy={wheelchair:'<circle cx="10.6" cy="3.7" r="1.7" /><path d="M8.9 6.3v4.3a1.3 1.3 0 0 0 1.3 1.3h3.4l1.9 4.5h1.9" /><circle cx="9.7" cy="13.3" r="4.7" />',companion:'<circle cx="6" cy="6" r="2" /><circle cx="14" cy="6" r="2" /><path d="M2.5 16v-3.5A3.5 3.5 0 0 1 6 9a3.5 3.5 0 0 1 3.5 3.5V16M10.5 16v-3.5A3.5 3.5 0 0 1 14 9a3.5 3.5 0 0 1 3.5 3.5V16" />',"semi-ambulatory":'<circle cx="8" cy="4" r="1.7" /><path d="m8 6 2 4 3 2M10 10l-2 3-1 4M10 10l2 7M14 7l2 10" />',"designated-aisle":'<path d="M3.5 5.5v7h8.5V10H6.5M5 12.5V17M11 12.5V17" /><path d="M13.5 6.5H19M16.5 4l2.5 2.5L16.5 9" />',"step-free":'<circle cx="5.5" cy="5" r="1.7" /><path d="M5.5 7v4l3 2M2.5 16.5H8l7-7h3M8 16.5h10" />',hearing:'<path d="M7 16c-1-1.2-1.5-2.4-1.5-3.8V9a5 5 0 1 1 10 0c0 2.2-1.2 3.2-2.6 4-1.2.7-1.7 1.4-1.7 2.4A2.6 2.6 0 0 1 8.6 18" />',cart:'<path d="M8 6.5A4 4 0 1 0 8 13M17 6.5a4 4 0 1 0 0 6.5" />',"sign-language":'<path d="M6 16V8.5a1 1 0 0 1 2 0v3M8 11V5.5a1 1 0 0 1 2 0V11M10 11V4.5a1 1 0 0 1 2 0V11M12 11V6a1 1 0 0 1 2 0v6l1-1.5a1.2 1.2 0 0 1 2 1.3L14 17H9.5A3.5 3.5 0 0 1 6 13.5" />',"low-vision":'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><circle cx="10" cy="10" r="2.5" /><path d="m15 4 .5-1.5M17 5l1.5-.8" />',"sensory-friendly":'<path d="M4 11v-1a6 6 0 0 1 12 0v1M4 11h2.5v5H5a1 1 0 0 1-1-1v-4ZM16 11h-2.5v5H15a1 1 0 0 0 1-1v-4Z" /><path d="M8.5 11.5c.8.7 2.2.7 3 0M9 14c.6.4 1.4.4 2 0" />',"plus-size":'<path d="M5 9V6.5A2.5 2.5 0 0 1 7.5 4h5A2.5 2.5 0 0 1 15 6.5V9M3.5 8.5v5h13v-5M6 13.5V17M14 13.5V17" />',"lift-armrest":'<path d="M5 10V6.5A2.5 2.5 0 0 1 7.5 4h4A2.5 2.5 0 0 1 14 6.5V10M4 9v4h11V9M6 13v4M13 13v4" /><path d="M17 11V4M15 6l2-2 2 2" />',obstructedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="m4 17 12-14" />',restrictedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="M10 7.5v3.5M10 13.5h.01" />',premium:'<path d="m10 2.5 2.2 4.6 5 .7-3.6 3.5.9 5-4.5-2.4-4.5 2.4.9-5-3.6-3.5 5-.7Z" />',note:'<circle cx="10" cy="10" r="7.5" /><path d="M10 9.2v4.6M10 6.3h.01" />'};function Uy(e){return zy[e]??""}function pi(e,t={}){let n=Uy(e);if(!n)return"";let o=t.size??18,i=20;return`<svg viewBox="0 0 ${i} ${i}" width="${o}" height="${o}" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"`+(t.className?` class="${t.className}"`:"")+` aria-hidden="true" focusable="false">${n}</svg>`}var zn="#ffffff",El="#0b1220",Un=6,jy=80,Cl=14,_l=88,Tl=20,kl={floor:{size:14,weight:"700",opacity:.98},stage:{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},gate:{size:12,weight:"700",opacity:.98},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1},access:{size:12,weight:"700",opacity:1}},Wy=640,Xy=.8,Yy=11,Ky="3px 7px",$y="2px 5px",Ll="rgba(10,14,22,.62)",qy="#f4f7fb",Fl=5,Ol=2,Zy=6,jn=new Set(["row","seat","access"]),Dl={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},sn={row:{x:66,y:20},seat:{x:52,y:22}},Bt=pe,bi=e=>sa(e);function Vt(e,t){let n=bi(e),o=bi(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function Qy(e){let t=Bt(e);if(!t)return null;let n=r=>`#${r.map(a=>Math.round(Math.max(0,Math.min(1,a))*255).toString(16).padStart(2,"0")).join("")}`,o=t.map(r=>r+(1-r)*.78),i=t.map(r=>r*.62);for(let r=0;r<12&&Vt(i,o)<4.5;r++)i=i.map(a=>a*.8);return{fill:n(o),ink:n(i),border:n(t.map(r=>r+(1-r)*.35)),contrast:Vt(i,o)}}var Jy=30;function yi(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(i=>Number(n[i])/255*o+t[i-1]*(1-o))}function e0(e,t=[.04,.06,.1],n=!0){let o=bi(t)<.42,i=o?"#f4f7fb":"#0b1220",r=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?yi(r,t):t,s=Bt(e),c=n?7:4.5,m=s&&Vt(s,a)>=c?e:i;return o?{ink:m,backing:r,border:"rgba(210,222,245,.24)"}:{ink:m,backing:r,border:"rgba(11,18,32,.22)"}}function t0(e,t=[.04,.06,.1]){let n=yi(Ll,t),o=Bt(e);return{ink:o&&Vt(o,n)>=4.5?e:qy,backing:Ll}}var n0=.8,cn=20,o0=14,r0=60,i0='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Fo=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.wheelchairFree=new Map;this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||i0,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;let n=new Set(t.map(o=>o.id));for(let[o,i]of this.nodes)n.has(o)||(i.remove(),this.nodes.delete(o))}setForcedDense(t){this.forcedDense=t}setOverviewDistance(t){this.overviewDistance=t>0?t:null}setSeatNumberRow(t){return t===this.seatNumberRow?!1:(this.seatNumberRow=t,!0)}setSeatNumberSeat(t){let n=t?`seat:${t}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setWheelchairFree(t){let n=t.size!==this.wheelchairFree.size;if(!n){for(let[o,i]of t)if(this.wheelchairFree.get(o)!==i){n=!0;break}}return n&&(this.wheelchairFree=new Map(t)),n}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=kl[t].size;return!this.narrowStage||jn.has(t)?n:Math.max(Yy,n*Xy)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let i=this.nodes.get(o.id),r=i?.getBoundingClientRect(),a=!!(n&&i&&i.style.display!=="none"&&r&&r.width>0&&r.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:i&&Number.parseFloat(i.style.fontSize)||0,contrast:i?Number(i.dataset.qualityContrast??0):0,...a&&r?{screenBox:{x:r.x-t.x,y:r.y-t.y,width:r.width,height:r.height}}:{}}})}update(t,n,o,i,r,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<Wy;let s=qc(i,r,{hasZoneLabels:this.labels.some(v=>v.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&i>this.overviewDistance*n0&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(v=>v.kind==="section")&&s.delete("zone");let c=[];for(let v of this.labels){if(!s.has(v.kind)&&!(v.kind==="seat"&&this.selectedSeatLabelIds.has(v.id)))continue;let w=v.kind==="seat"&&a&&this.selectedSeatLabelIds.has(v.id)?v.pinBase:void 0,R=w&&a?[w[0],w[1]+hi(Math.hypot(w[0]-a[0],w[1]-a[1],w[2]-a[2])),w[2]]:v.anchor,C=at(t,R,n,o);if(!C.visible)continue;let O=jn.has(v.kind),E=this.sizeFor(v.kind),A=v.kind==="access"?cn:Jc(v.text,E,!O)+(O?Fl*2:0)+((this.wheelchairFree.get(v.id)??0)>0?Jy:0);if(v.kind==="access"&&v.seatWidthM!==void 0&&ci(t,v.anchor,v.seatWidthM,n)<o0||v.kind==="seat"&&v.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(v.id)&&ci(t,v.anchor,v.seatWidthM,n)<Math.max(22,A))continue;let T=Zc(C,A/2,E/2+(O?Ol:4),n,o),L=a?Math.hypot(v.anchor[0]-a[0],v.anchor[1]-a[1],v.anchor[2]-a[2]):1;c.push({label:v,screen:T,focus:tl(T,L,n,o),halfWidth:A/2,...this.selectedSeatLabelIds.has(v.id)?{priority:1}:{}})}let m=$c(c.filter(v=>v.label.kind==="floor"),n),l=[...c.filter(v=>!jn.has(v.label.kind)&&v.label.kind!=="floor"),...m],u=el(n),h=c.filter(v=>v.label.kind==="seat"&&this.selectedSeatLabelIds.has(v.label.id)),f=Gn(h,sn.seat.x,sn.seat.y,u.seat);this.placePinHeads(h.filter(v=>v.label.pinBase&&!f.includes(v)).map(v=>v.screen));let d=Qc(l,_l,Tl).filter(v=>!f.some(w=>Hn(v,w,_l,Tl))),p=Gn(c.filter(v=>v.label.kind==="access"),cn,cn,r0,[...d,...f]),b=Gn(c.filter(v=>v.label.kind==="row"),sn.row.x,sn.row.y,u.row,[...d,...f,...p]),g=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,x=Gn(c.filter(v=>v.label.kind==="seat"&&!this.selectedSeatLabelIds.has(v.label.id)&&(this.seatNumberSeat!==null?v.label.id===this.seatNumberSeat:!g||this.seatNumberRow!==null&&v.label.rowId===this.seatNumberRow)),sn.seat.x,sn.seat.y,g?jy:u.seat-f.length,[...d,...f,...p,...b]),S=[...d,...p,...b,...f,...x],I=new Set(S.map(v=>v.label.id));for(let{label:v,screen:w}of S){let C=this.nodeFor(v).style;C.display=v.kind==="access"?"flex":v.kind==="gate"?"inline-flex":"";let O=!!v.pinBase&&this.selectedSeatLabelIds.has(v.id);C.transform=O?`translate(-50%, -100%) translate(${w.x.toFixed(1)}px, ${(w.y-Un).toFixed(1)}px)`:`translate(-50%, -50%) translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px)`}let y=S.filter(({label:v})=>!jn.has(v.kind)).sort((v,w)=>Dl[w.label.kind]-Dl[v.label.kind]||v.screen.depth-w.screen.depth||v.focus-w.focus).flatMap(({label:v})=>{let w=this.nodes.get(v.id);return w&&w.style.display!=="none"?[{node:w,box:w.getBoundingClientRect()}]:[]}),P=[];for(let{node:v,box:w}of y)P.some(C=>w.left<C.right+3&&w.right+3>C.left&&w.top<C.bottom+3&&w.bottom+3>C.top)?v.style.display="none":P.push(w);for(let[v,w]of this.nodes)I.has(v)||(w.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let g=n.style;g.position="absolute",g.left="0",g.top="0",g.whiteSpace="nowrap",g.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}let o=this.selectedSeatLabelIds.has(t.id),i=this.nodeAppearance.get(n),r=this.wheelchairFree.get(t.id)??0,a=t.text+(t.icon??"")+(t.tint??"")+(r>0?`|${r}`:"");if(i&&i.text===a&&i.kind===t.kind&&i.color===t.color&&i.selected===o&&i.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:a,kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),t.kind==="access")return this.paintAccessChip(n,t);if(n.textContent=t.text,o){let g=document.createElement("span"),x=g.style;x.position="absolute",x.left="50%",x.bottom=`-${Un}px`,x.transform="translateX(-50%)",x.borderLeft=`${Un}px solid transparent`,x.borderRight=`${Un}px solid transparent`,x.borderTop=`${Un}px solid ${zn}`,n.appendChild(g)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let s=kl[t.kind],c=n.style;c.fontSize=`${this.sizeFor(t.kind)}px`,c.fontWeight=o?"800":s.weight,c.opacity=o?"1":String(s.opacity);let m=jn.has(t.kind),l=!m,u=e0(t.color??this.opts.ink,this.opts.backgroundRgb,!0),h=m?t0(t.color??this.opts.ink,this.opts.backgroundRgb):u;c.color=o?El:h.ink,c.background=o?zn:h.backing,c.border=o?`1px solid ${zn}`:l?`1px solid ${u.border}`:"",c.borderRadius=o||l?"999px":`${Zy}px`;let f=this.narrowStage?$y:Ky;c.padding=o||l?f:`${Ol}px ${Fl}px`,c.lineHeight=m?"1.1":"",c.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":l?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",c.textShadow=o||l?"none":"0 1px 1px rgba(0,0,0,0.4)",c.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let d=this.opts.backgroundRgb??[.04,.06,.1],p=Bt(o?El:h.ink)??[1,1,1],b=yi(o?zn:h.backing,d);return n.dataset.qualityContrast=Vt(p,b).toFixed(3),c.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",t.kind==="section"&&this.dressSectionTag(n,t,r),t.kind==="gate"&&this.dressGateTag(n,t),n}dressGateTag(t,n){let o=t.style;o.background="#0f172a",o.color="#ffffff",o.border="1px solid rgba(255,255,255,0.28)",o.textTransform="uppercase",o.letterSpacing="0.06em",o.display="inline-flex",o.alignItems="center",o.gap="5px";let i=document.createElement("span");i.setAttribute("aria-hidden","true"),i.setAttribute("data-gate-arrow",n.icon==="exit"?"out":"in"),i.innerHTML=n.icon==="exit"?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.5H2v9h3"/><path d="M5.5 6h5M8.5 3.5 11 6 8.5 8.5"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.5h3v9H7"/><path d="M1 6h5.5M4 3.5 6.5 6 4 8.5"/></svg>',t.prepend(i),t.dataset.qualityContrast=Vt([1,1,1],Bt("#0f172a")).toFixed(3)}dressSectionTag(t,n,o){let i=n.tint?Qy(n.tint):null,r=t.style;if(i&&(r.background=i.fill,r.color=i.ink,r.border=`1px solid ${i.border}`,t.dataset.qualityContrast=i.contrast.toFixed(3)),o<=0)return;let a=document.createElement("span");a.setAttribute("data-wheelchair-free",String(o)),a.setAttribute("aria-label",`${o} wheelchair ${o===1?"place":"places"} free`),a.innerHTML=`${pi("wheelchair",{size:11})}<span>${o}</span>`;let s=a.style;s.display="inline-flex",s.alignItems="center",s.gap="2px",s.marginLeft="6px",s.padding="1px 5px",s.borderRadius="999px",s.background="#2563eb",s.color="#ffffff",s.fontSize="0.85em",s.lineHeight="1.2",s.verticalAlign="middle",t.appendChild(a)}paintAccessChip(t,n){t.setAttribute("data-label-kind","access"),t.setAttribute("data-access-type",n.icon??""),t.innerHTML=n.icon?pi(n.icon,{size:cn-6}):"",t.setAttribute("role","img"),t.setAttribute("aria-label",n.text);let o=t.style;return o.width=`${cn}px`,o.height=`${cn}px`,o.alignItems="center",o.justifyContent="center",o.borderRadius="50%",o.background=n.color??"#3b82f6",o.color=n.ink??"#ffffff",o.border="1.5px solid #ffffff",o.boxShadow="0 2px 6px rgba(0,0,0,.35)",o.padding="0",o.lineHeight="0",o.boxSizing="border-box",t.dataset.qualityContrast=Vt(Bt(n.ink??"#ffffff")??[1,1,1],Bt(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),t}placePinHeads(t){for(;this.pinHeads.length<t.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${Cl}px`,o.height=`${Cl}px`,o.borderRadius="50%",o.background=zn,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let i=t[o];n.style.display=i?"":"none",i&&(n.style.transform=`translate(-50%, -100%) translate(${i.x.toFixed(1)}px, ${i.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var Bl=1;var a0=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function s0(e){return e.every(t=>Number.isFinite(t))}function c0(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 Nl(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Ht(e){return Math.round(e*1e4)/1e4}function l0(e){if(e)return{box:{x:Ht(e.box.x),y:Ht(e.box.y),width:Ht(e.box.width),height:Ht(e.box.height)},horizontalFillRatio:Ht(e.horizontalFillRatio),verticalFillRatio:Ht(e.verticalFillRatio),visibleAreaRatio:Ht(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function st(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Oo(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>a0.has(s.kind)),o=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,i=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)c0(n[s].screenBox,n[c].screenBox)&&i.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let r=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[st("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),st("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),st("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),st("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}`}]),st("camera-invalid","The capture camera must have a finite physical pose",s0(r)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),st("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}]),st("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),st("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}))),st("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}))),st("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",i)].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:m})=>({id:s,kind:c,text:m})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:l0(e.framing)},metrics:{minimumHierarchyFontPx:Nl(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Nl(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function Vl(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var Ce=require("ogl");var Pt=require("ogl");var Do=`
49
80
  float chairWeight(float depth) {
50
81
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
51
- }`,ml=`
82
+ }`,Hl=`
52
83
  float occupantWeight(float depth) {
53
- float nearWeight = smoothstep(${Qi.toFixed(1)}, ${Ji.toFixed(1)}, depth);
54
- float farWeight = 1.0 - smoothstep(${$i.toFixed(1)}, ${Zi.toFixed(1)}, depth);
84
+ float nearWeight = smoothstep(${Sa.toFixed(1)}, ${wa.toFixed(1)}, depth);
85
+ float farWeight = 1.0 - smoothstep(${va.toFixed(1)}, ${Ma.toFixed(1)}, depth);
55
86
  return nearWeight * farWeight;
56
- }`,Qr=`
87
+ }`,gi=`
57
88
  float glyphEq(float glyph, float expected) {
58
89
  return 1.0 - step(0.25, abs(glyph - expected));
59
90
  }
@@ -102,7 +133,20 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
102
133
  p.y += 0.16;
103
134
  }
104
135
  return p;
105
- }`,qb=`#version 300 es
136
+ }`,u0=1.5,ln=`
137
+ uniform vec4 uSeeThrough; // xyz = the seats looked at, w = cone radius there; 0 = off
138
+ bool seeThroughCut(vec3 p, vec3 eye) {
139
+ if (uSeeThrough.w <= 0.0) return false;
140
+ vec3 axis = uSeeThrough.xyz - eye;
141
+ float len = length(axis);
142
+ if (len < 1.0) return false;
143
+ vec3 dir = axis / len;
144
+ float t = dot(p - eye, dir);
145
+ if (t <= 0.0 || t > len - ${u0.toFixed(2)}) return false;
146
+ vec3 onLine = eye + dir * t;
147
+ if (p.y < onLine.y - 0.25) return false;
148
+ return length(p - onLine) < uSeeThrough.w * t / len;
149
+ }`,m0=`#version 300 es
106
150
  precision highp float;
107
151
  in vec3 position;
108
152
  in vec3 normal;
@@ -140,13 +184,13 @@ void main() {
140
184
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
141
185
  vColor = color;
142
186
  gl_Position = projectionMatrix * mv;
143
- }`,fl=`
187
+ }`,Gl=`
144
188
  bool roomWallHidden(float material, vec3 normalWorld, vec3 posWorld, vec3 eye, vec2 roomCentre) {
145
189
  if (abs(material - 6.0) > 0.5) return false;
146
190
  vec3 n = normalize(normalWorld);
147
191
  if (abs(n.y) > 0.5) return true;
148
192
  return dot(n.xz, eye.xz - posWorld.xz) * dot(n.xz, roomCentre - posWorld.xz) <= 0.0;
149
- }`,$b=`#version 300 es
193
+ }`,f0=`#version 300 es
150
194
  precision highp float;
151
195
  in vec3 vColor;
152
196
  in vec3 vNormalWorld;
@@ -166,7 +210,8 @@ uniform mat4 uShadowMatrix;
166
210
  uniform vec3 cameraPosition;
167
211
  uniform vec2 uRoomCentre;
168
212
  out vec4 fragColor;
169
- ${fl}
213
+ ${Gl}
214
+ ${ln}
170
215
  // Stable world-space variation; no textures or per-frame random grain.
171
216
  float turfHash(vec2 p) {
172
217
  vec3 q = fract(vec3(p.xyx) * 0.1031);
@@ -206,6 +251,7 @@ float architecturalLight(vec3 normal) {
206
251
  void main() {
207
252
  if (vDim > 0.5) discard;
208
253
  if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
254
+ if (seeThroughCut(vPosWorld, cameraPosition)) discard;
209
255
  // Row treads (material 3) and risers (material 2) are chart truth: the
210
256
  // stepped deck IS the stand, at every distance. What must not survive at
211
257
  // whole-venue scale is the risers' darker shade \u2014 hundreds of sub-pixel dark
@@ -259,7 +305,10 @@ void main() {
259
305
  // More sun, less flat ambient: at 0.40-0.68 ambient against a 0.46 key every
260
306
  // face read at nearly one value and venues looked flat beside a lit reference
261
307
  // (3D Digital Venue comparison, 2026-09-24). Lit and turned faces now part.
262
- vec3 base = vColorRung * (0.34 + 0.26 * hemi) * mix(0.72, 1.0, visibility) + vColorRung * key * 0.60 + vColorRung * fill * 0.10;
308
+ // The fill keeps the turned faces from going charcoal: at 0.10 a wall facing
309
+ // away from the sun kept about half its colour, and the walls under every
310
+ // tier and box read as dark blocks (owner, 2026-09-24).
311
+ vec3 base = vColorRung * (0.34 + 0.26 * hemi) * mix(0.72, 1.0, visibility) + vColorRung * key * 0.60 + vColorRung * fill * 0.26;
263
312
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
264
313
  // Material 1 is a powered display and keeps its authored emission treatment.
265
314
  // Every architectural material uses the venue roughness token; 0.78 maps to
@@ -293,8 +342,8 @@ void main() {
293
342
  + vec3(0.20, 0.10, 0.34) * focalHalo;
294
343
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
295
344
  fragColor = vec4(base, 1.0);
296
- }`,dl=`
297
- ${Qr}
345
+ }`,zl=`
346
+ ${gi}
298
347
  vec4 seatSurface(vec3 source, float radius) {
299
348
  vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
300
349
  if (iPhysicalSeat < 0.5) {
@@ -308,12 +357,12 @@ vec4 seatSurface(vec3 source, float radius) {
308
357
  if (surface < 0.5) return origin;
309
358
  vec3 p = glyphChairPosition(source, surface, iGlyph);
310
359
  p.xz *= iChairWidth;
311
- if (surface > 1.5) p.z -= max(p.y - ${ft.toFixed(2)}, 0.0) * ${un.toFixed(2)} * glyphBackRake(iGlyph);
360
+ if (surface > 1.5) p.z -= max(p.y - ${bt.toFixed(2)}, 0.0) * ${xn.toFixed(2)} * glyphBackRake(iGlyph);
312
361
  float c = cos(iYaw), s = sin(iYaw);
313
362
  vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
314
363
  return modelViewMatrix * vec4(iOffset + rotated, 1.0);
315
364
  }
316
- `,Zb=`#version 300 es
365
+ `,d0=`#version 300 es
317
366
  precision highp float;
318
367
  in float surface;
319
368
  in float iYaw;
@@ -352,9 +401,12 @@ out float vSectionFade;
352
401
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
353
402
  out float vPhysicalSeat;
354
403
  out float vPixelRadius;
355
- ${Io}
356
- ${dl}
404
+ uniform vec3 cameraPosition;
405
+ ${Do}
406
+ ${zl}
407
+ ${ln}
357
408
  void main() {
409
+ if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
358
410
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
359
411
  float depth = max(-mv.z, 0.001);
360
412
  // Hand the seat over to the chair mesh as it comes into range. Derived from
@@ -374,7 +426,7 @@ void main() {
374
426
  mv = seatSurface(position, r);
375
427
  // Match the shell's non-uniform width/depth scale before its back rake.
376
428
  vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
377
- if (surface > 1.5) n.y += n.z * ${un.toFixed(2)} * glyphBackRake(iGlyph);
429
+ if (surface > 1.5) n.y += n.z * ${xn.toFixed(2)} * glyphBackRake(iGlyph);
378
430
  n = normalize(n);
379
431
  vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
380
432
  vSeatHeight = position.y;
@@ -386,13 +438,13 @@ void main() {
386
438
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
387
439
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
388
440
  gl_Position = projectionMatrix * mv;
389
- }`,hl=`
441
+ }`,Ul=`
390
442
  float seatSilhouette(vec2 uv, float physical) {
391
443
  // Solid furniture owns its silhouette in geometry. Only empty bays need
392
444
  // a fragment mask; cutting physical faces would open holes in the volume.
393
445
  return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
394
446
  }
395
- `,Qb=`#version 300 es
447
+ `,h0=`#version 300 es
396
448
  precision highp float;
397
449
  in vec3 vSeatNormal;
398
450
  in float vSeatHeight;
@@ -412,7 +464,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
412
464
  uniform vec3 uFadeColor;
413
465
  uniform float uRoughness;
414
466
  out vec4 fragColor;
415
- ${hl}
467
+ ${Ul}
416
468
  void main() {
417
469
  if (vDim > 0.5) discard;
418
470
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
@@ -477,7 +529,7 @@ void main() {
477
529
  c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
478
530
  }
479
531
  fragColor = vec4(c, alpha);
480
- }`,Jb=`#version 300 es
532
+ }`,p0=`#version 300 es
481
533
  precision highp float;
482
534
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
483
535
  in vec3 normal;
@@ -513,10 +565,13 @@ out float vSectionFade;
513
565
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
514
566
  out vec3 vOccupantTint;
515
567
  out float vTaken; // 1 = sold or held: not for sale
516
- ${Io}
517
- ${ml}
518
- ${Qr}
568
+ ${Do}
569
+ ${Hl}
570
+ ${gi}
571
+ uniform vec3 cameraPosition;
572
+ ${ln}
519
573
  void main() {
574
+ if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
520
575
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
521
576
  float viewDepth = -anchor.z;
522
577
  float depth = max(viewDepth, 0.001);
@@ -601,7 +656,7 @@ void main() {
601
656
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
602
657
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
603
658
  gl_Position = projectionMatrix * mv;
604
- }`,ey=`#version 300 es
659
+ }`,b0=`#version 300 es
605
660
  precision highp float;
606
661
  in vec3 vColor;
607
662
  in vec3 vNormalWorld;
@@ -632,6 +687,17 @@ void main() {
632
687
  float fill = max(dot(N, fillDir), 0.0);
633
688
  vec3 tint = vColor;
634
689
  if (vOccupant > 0.5) tint = vOccupantTint;
690
+ // The crowd in taken seats is one crisp, dark tone, not the seat's muted
691
+ // grey: on a light venue that grey went pale, and the people read as soft
692
+ // grey blobs (owner, 2026-09-25: "not crisp"). Dark silhouettes with the rim
693
+ // below read as an audience at every distance; the head is a step lighter so
694
+ // it separates from the shoulders.
695
+ if (vOccupant > 0.5 && vTaken > 0.5) {
696
+ // A little per-person variety (the clothing hash), so a full stand reads
697
+ // as people and not as one moulded block.
698
+ float vary = dot(vOccupantTint, vec3(0.33)) - 0.3;
699
+ tint = (vPart > 10.5 ? vec3(0.31, 0.32, 0.36) : vec3(0.19, 0.22, 0.27)) + vary * 0.12;
700
+ }
635
701
  // The accommodation ring, kept legible once the dot (which drew it) is gone:
636
702
  // an accessible seat's support is painted in the ring colour, so the marker
637
703
  // survives to close range instead of vanishing exactly when the buyer arrives.
@@ -668,7 +734,7 @@ void main() {
668
734
  // toward the venue. Their own clothing and the chair's category tint made a
669
735
  // taken seat look like any other at a glance (owner report, 2026-09-23);
670
736
  // now only the seats a buyer can take wear full colour.
671
- if (vTaken > 0.5) {
737
+ if (vTaken > 0.5 && vOccupant < 0.5) {
672
738
  float takenLum = dot(base, vec3(0.299, 0.587, 0.114));
673
739
  base = mix(vec3(takenLum), uFadeColor, 0.35) * 0.92;
674
740
  }
@@ -679,14 +745,14 @@ void main() {
679
745
  base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
680
746
  }
681
747
  fragColor = vec4(base, 1.0);
682
- }`,ty=`#version 300 es
748
+ }`,y0=`#version 300 es
683
749
  precision highp float;
684
750
  in vec2 position;
685
751
  out vec2 vUv;
686
752
  void main() {
687
753
  vUv = position * 0.5 + 0.5;
688
754
  gl_Position = vec4(position, 0.999, 1.0);
689
- }`,ny=`#version 300 es
755
+ }`,g0=`#version 300 es
690
756
  precision highp float;
691
757
  in vec2 vUv;
692
758
  uniform vec3 uTop;
@@ -717,7 +783,7 @@ void main() {
717
783
  col = mix(col, sky, smoothstep(-0.22, 0.03, up));
718
784
  }
719
785
  fragColor = vec4(col, 1.0);
720
- }`,oy=`#version 300 es
786
+ }`,x0=`#version 300 es
721
787
  precision highp float;
722
788
  in float surface;
723
789
  in float iYaw;
@@ -745,9 +811,12 @@ out float vPhysicalSeat;
745
811
  out float vDotWeight;
746
812
  out float vHidden;
747
813
  flat out vec3 vPick;
748
- ${Io}
749
- ${dl}
814
+ uniform vec3 cameraPosition;
815
+ ${Do}
816
+ ${zl}
817
+ ${ln}
750
818
  void main() {
819
+ if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
751
820
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
752
821
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
753
822
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
@@ -760,7 +829,7 @@ void main() {
760
829
  vPhysicalSeat = iPhysicalSeat;
761
830
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
762
831
  gl_Position = projectionMatrix * mv;
763
- }`,ry=`#version 300 es
832
+ }`,v0=`#version 300 es
764
833
  precision highp float;
765
834
  in vec2 vUv;
766
835
  in float vPhysicalSeat;
@@ -768,7 +837,7 @@ in float vDotWeight;
768
837
  in float vHidden;
769
838
  flat in vec3 vPick;
770
839
  out vec4 fragColor;
771
- ${hl}
840
+ ${Ul}
772
841
  void main() {
773
842
  if (vHidden > 0.5) discard;
774
843
  if (vDotWeight <= 0.99) discard;
@@ -776,7 +845,7 @@ void main() {
776
845
  float d = seatSilhouette(vUv, vPhysicalSeat);
777
846
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
778
847
  fragColor = vec4(vPick, 1.0);
779
- }`,iy=`#version 300 es
848
+ }`,M0=`#version 300 es
780
849
  precision highp float;
781
850
  in vec3 position;
782
851
  in float part;
@@ -798,10 +867,13 @@ uniform float uFocusFloor;
798
867
  flat out vec3 vPick;
799
868
  out float vChairWeight;
800
869
  out float vHidden;
801
- ${Io}
802
- ${ml}
803
- ${Qr}
870
+ uniform vec3 cameraPosition;
871
+ ${Do}
872
+ ${Hl}
873
+ ${gi}
874
+ ${ln}
804
875
  void main() {
876
+ if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
805
877
  int id = int(iPickIndex + 0.5); // already global index + 1
806
878
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
807
879
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
@@ -834,7 +906,7 @@ void main() {
834
906
  float c = cos(iYaw), s = sin(iYaw);
835
907
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
836
908
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
837
- }`,ay=`#version 300 es
909
+ }`,S0=`#version 300 es
838
910
  precision highp float;
839
911
  flat in vec3 vPick;
840
912
  in float vHidden;
@@ -844,7 +916,7 @@ void main() {
844
916
  if (vHidden > 0.5) discard;
845
917
  if (vChairWeight < 0.01) discard;
846
918
  fragColor = vec4(vPick, 1.0);
847
- }`,sy=`#version 300 es
919
+ }`,w0=`#version 300 es
848
920
  precision highp float;
849
921
  in vec3 position;
850
922
  in vec3 normal;
@@ -864,7 +936,7 @@ void main() {
864
936
  vNormalWorld = mat3(modelMatrix) * normal;
865
937
  vPosWorld = (modelMatrix * vec4(position, 1.0)).xyz;
866
938
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
867
- }`,cy=`#version 300 es
939
+ }`,P0=`#version 300 es
868
940
  precision highp float;
869
941
  in float vHidden;
870
942
  in float vMaterial;
@@ -873,12 +945,14 @@ in vec3 vPosWorld;
873
945
  uniform vec3 cameraPosition;
874
946
  uniform vec2 uRoomCentre;
875
947
  out vec4 fragColor;
876
- ${fl}
948
+ ${Gl}
949
+ ${ln}
877
950
  void main() {
878
951
  if (vHidden > 0.5) discard;
879
952
  if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
953
+ if (seeThroughCut(vPosWorld, cameraPosition)) discard;
880
954
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
881
- }`;function pl(e){return new vt.Program(e,{vertex:oy,fragment:ry,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:at},uSeatScale:{value:1},uMinPixels:{value:Vt},uPixelToWorld:{value:.002},uChairFull:{value:hn},uChairNone:{value:Gt},uFocusFloor:{value:-1}}})}function bl(e){return new vt.Program(e,{vertex:iy,fragment:ay,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:hn},uChairNone:{value:Gt},uBackRake:{value:un},uBackBase:{value:ft},uFocusFloor:{value:-1}}})}function yl(e){return new vt.Program(e,{vertex:sy,fragment:cy,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function gl(e,t=.78,n=[.63,.66,.65]){return new vt.Program(e,{vertex:qb,fragment:$b,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:t},uRoomCentre:{value:new Float32Array([0,0])}}})}function xl(e){return new vt.Program(e,{vertex:Zb,fragment:Qb,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:at},uSeatScale:{value:1},uMinPixels:{value:Vt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:hn},uChairNone:{value:Gt}}})}function vl(e,t=.78){return new vt.Program(e,{vertex:Jb,fragment:ey,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:hn},uChairNone:{value:Gt},uBackRake:{value:un},uBackBase:{value:ft},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function Ml(e,t,n,o){return new vt.Program(e,{vertex:ty,fragment:ny,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)},uSky:{value:o?1:0},uZenith:{value:new Float32Array(o?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(o?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)}}})}var je=require("ogl");function Sl(e,t,n){let r=Math.max(3,n.radius*1.04),[i,a,s]=n.center,c=new je.Camera(e,{left:-r,right:r,bottom:-r,top:r,near:.1,far:r*6});c.position.set(i-r*1.44,a+r*2.34,s+r*1.2),c.lookAt([i,a,s]);let l=new je.RenderTarget(e,{width:1024,height:1024,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),u=new je.Program(e,{cullFace:!1,vertex:`#version 300 es
955
+ }`;function jl(e){return new Pt.Program(e,{vertex:x0,fragment:v0,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:ut},uSeatScale:{value:1},uMinPixels:{value:Wt},uPixelToWorld:{value:.002},uChairFull:{value:wn},uChairNone:{value:Xt},uFocusFloor:{value:-1}}})}function Wl(e){return new Pt.Program(e,{vertex:M0,fragment:S0,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:wn},uChairNone:{value:Xt},uBackRake:{value:xn},uBackBase:{value:bt},uFocusFloor:{value:-1}}})}function Xl(e){return new Pt.Program(e,{vertex:w0,fragment:P0,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function Yl(e,t=.78,n=[.63,.66,.65]){return new Pt.Program(e,{vertex:m0,fragment:f0,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:t},uRoomCentre:{value:new Float32Array([0,0])}}})}function Kl(e){return new Pt.Program(e,{vertex:d0,fragment:h0,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:ut},uSeatScale:{value:1},uMinPixels:{value:Wt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:wn},uChairNone:{value:Xt}}})}function $l(e,t=.78){return new Pt.Program(e,{vertex:p0,fragment:b0,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:wn},uChairNone:{value:Xt},uBackRake:{value:xn},uBackBase:{value:bt},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function ql(e,t,n,o){return new Pt.Program(e,{vertex:y0,fragment:g0,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)},uSky:{value:o?1:0},uZenith:{value:new Float32Array(o?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(o?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)}}})}var Xe=require("ogl");function Zl(e,t,n){let i=Math.max(3,n.radius*1.04),[r,a,s]=n.center,c=new Xe.Camera(e,{left:-i,right:i,bottom:-i,top:i,near:.1,far:i*6});c.position.set(r-i*1.44,a+i*2.34,s+i*1.2),c.lookAt([r,a,s]);let m=new Xe.RenderTarget(e,{width:1024,height:1024,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),l=new Xe.Program(e,{cullFace:!1,vertex:`#version 300 es
882
956
  in vec3 position;
883
957
  in float materialIndex;
884
958
  uniform mat4 modelViewMatrix;
@@ -891,7 +965,7 @@ void main() {
891
965
  void main() {
892
966
  if (abs(vMaterial - 6.0) < 0.5) discard;
893
967
  fragColor = vec4(1.0);
894
- }`}),m=new je.Transform,h=new je.Mesh(e,{geometry:t,program:u});h.frustumCulled=!1,h.setParent(m);let d=e.getParameter(e.COLOR_CLEAR_VALUE),f=e.isEnabled(e.DITHER);try{e.disable(e.DITHER),e.clearColor(1,1,1,1),e.renderer.render({scene:m,camera:c,target:l})}finally{f&&e.enable(e.DITHER),e.clearColor(d[0],d[1],d[2],d[3]),u.remove()}let p=new je.Mat4().multiply(c.projectionMatrix,c.viewMatrix);return{texture:l.depthTexture,matrix:p,dispose(){for(let b of l.textures)e.deleteTexture(b.texture);e.deleteTexture(l.depthTexture.texture),e.deleteFramebuffer(l.buffer),l.depthBuffer&&e.deleteRenderbuffer(l.depthBuffer)}}}var ly=.65,uy=new Set(["dimmed","sold"]),my=new Set(["dimmed","sold","held"]);function wl(e,t,n){let o=new Set,r=!1,i=Ce.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?my:uy;for(let c of e){let l=t.get(c.sectionId);if(!l||!l.length){o.add(c.sectionId);continue}let u=!1;for(let m of l){let h=Ce[n[m]]??"available";if(!s.has(h)){u=!0;break}}u?o.add(c.sectionId):r=!0}return{lit:o,anyUnlit:r}}function Pl(e,t,n,o,r,i){let a=[];for(let s of e){let c=r===null||r.has(s.sectionId);if(o.get(s.sectionId)===c)continue;o.set(s.sectionId,c);let l=(s.start+s.count)*3;for(let u=s.start*3;u<l;u++)t[u]=c?n[u]:n[u]+(i[u%3]-n[u])*ly;a.push(s)}return a}var Il=Ce.indexOf("selected");function fy(e,t){return[0,1,2].map(n=>e[n]*.15+.75+t[n]*.1)}function Rl(e,t,n,o,r,i){for(let a=n;a<n+o;a++){let s=i&&t[a]===0,c=i&&t[a]===Il?fy([i[a*3],i[a*3+1],i[a*3+2]],r[Il]??r[0]):s?null:r[t[a]]??r[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 dy=new Float32Array([-1,-1,3,-1,-1,3]);function Al(e,t){let n=new Ie.Transform,o=new Ie.Transform,r=new Ie.Geometry(e,{position:{size:2,data:dy}}),i=Ml(e,t.theme.background.top,t.theme.background.bottom,t.outdoor?t.theme.sky:null),a=new Ie.Mesh(e,{geometry:r,program:i});a.frustumCulled=!1,a.setParent(o);let s=new Ie.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=Sl(e,s,t.renderBounds),l=gl(e,t.theme.materials.roughness,t.theme.structure.tierTop);l.uniforms.tVenueShadow={value:c.texture},l.uniforms.uShadowMatrix={value:c.matrix},t.room&&l.uniforms.uRoomCentre.value.set(t.room.centre);let u=new Ie.Mesh(e,{geometry:s,program:l});u.frustumCulled=!1,u.setParent(n);let m=xl(e),h=new Float32Array(t.seats.count*3),d=Ce.map(K=>t.theme.seatStates[K]),f=t.seats.iCategory.slice();for(let K=0;K<t.seats.count;K++){if(t.seats.iPhysicalSeat[K]<.5)continue;let oe=t.theme.materials.seat??Vi([f[K*3],f[K*3+1],f[K*3+2]]);f.set(oe,K*3)}Rl(h,t.seats.iState,0,t.seats.count,d,f);let p=Fi(),b=new Uint8Array(t.seats.count),y=new Ie.Geometry(e,{position:{size:3,data:p.position},normal:{size:3,data:p.normal},uv:{size:2,data:p.uv},index:{size:1,data:p.index},surface:{size:1,data:p.surface},iYaw:{size:1,data:t.seats.iYaw,instanced:1},iChairWidth:{size:1,data:t.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:t.seats.iGlyph,instanced:1},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:h,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:b,type:e.UNSIGNED_BYTE,usage:e.DYNAMIC_DRAW,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},iSection:{size:1,data:t.seats.iSection,instanced:1}}),g=new Ie.Mesh(e,{geometry:y,program:m});g.frustumCulled=!1,t.seats.count>0&&g.setParent(n);let M=y.attributes.iColor,P=t.solids.color.slice(),I=t.theme.structure.ground,S=new Map(t.sectionSolidRanges.map(K=>[K.sectionId,!0])),x=Ti(),v=vl(e,t.theme.materials.roughness),w=Wn,R=new Float32Array(w*3),T=new Float32Array(w*3),O=new Float32Array(w),C=new Float32Array(w),A=new Float32Array(w),_=new Float32Array(w*3),L=new Float32Array(w),N=new Float32Array(w),k=new Float32Array(w),F=new Float32Array(w),H=new Float32Array(w),B=new Ie.Geometry(e,{position:{size:3,data:x.position},normal:{size:3,data:x.normal},part:{size:1,data:x.part},index:{data:x.index},iOffset:{size:3,data:R,instanced:1},iColor:{size:3,data:T,instanced:1},iRadius:{size:1,data:O,instanced:1},iYaw:{size:1,data:C,instanced:1},iGlyph:{size:1,data:A,instanced:1},iRing:{size:3,data:_,instanced:1},iFloor:{size:1,data:L,instanced:1},iSection:{size:1,data:N,instanced:1},iPhysicalSeat:{size:1,data:k,instanced:1},iSeed:{size:1,data:H,instanced:1},iPickIndex:{size:1,data:F,instanced:1}}),D=new Ie.Mesh(e,{geometry:B,program:v});D.frustumCulled=!1;let G=0,j=!1,V=!1,z=null,q=null,$=null,re=new Int32Array(0),Q=()=>{let K=t.seats;for(let oe=0;oe<G;oe++){let ee=re[oe];H[oe]=fa(K.iState[ee],ee),T[oe*3]=h[ee*3],T[oe*3+1]=h[ee*3+1],T[oe*3+2]=h[ee*3+2]}B.attributes.iColor.needsUpdate=!0,B.attributes.iSeed.needsUpdate=!0},W={main:n,background:o,backgroundProgram:i,seatProgram:m,solidProgram:l,chairProgram:v,seatGeometry:y,chairGeometry:B,solidGeometry:s,drawCalls:3,setNearSeats(K,oe){let ee=Math.min(oe,w,K.length);if(ul(b,K,ee),y.attributes.iHasChair.needsUpdate=!0,re=K,G=ee,ee===0){D.parent&&D.setParent(null),B.instancedCount=0,W.drawCalls=3+(j?1:0);return}let le=t.seats;for(let J=0;J<ee;J++){let ce=K[J];R[J*3]=le.iPosition[ce*3],R[J*3+1]=le.iPosition[ce*3+1],R[J*3+2]=le.iPosition[ce*3+2],O[J]=le.iChairWidth[ce],C[J]=le.iYaw[ce],A[J]=le.iGlyph[ce],_[J*3]=le.iRing[ce*3],_[J*3+1]=le.iRing[ce*3+1],_[J*3+2]=le.iRing[ce*3+2],L[J]=le.iFloor[ce],N[J]=le.iSection[ce],k[J]=le.iPhysicalSeat[ce],F[J]=ce+1}Q(),B.attributes.iOffset.needsUpdate=!0,B.attributes.iRadius.needsUpdate=!0,B.attributes.iYaw.needsUpdate=!0,B.attributes.iGlyph.needsUpdate=!0,B.attributes.iRing.needsUpdate=!0,B.attributes.iFloor.needsUpdate=!0,B.attributes.iSection.needsUpdate=!0,B.attributes.iPhysicalSeat.needsUpdate=!0,B.attributes.iSeed.needsUpdate=!0,B.attributes.iPickIndex.needsUpdate=!0,B.instancedCount=ee,D.parent||D.setParent(n),W.drawCalls=4+(j?1:0)},nearSeatCount(){return G},setSectionShellLit(K){l.uniforms.uSectionFilter.value=K===null?0:1;let oe=Pl(t.sectionSolidRanges,t.solids.color,P,S,K,I);if(!oe.length)return;let ee=s.attributes.color,le=ee.buffer;if(!le){ee.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,le);for(let J of oe){let ce=t.solids.color.subarray(J.start*3,(J.start+J.count)*3);e.bufferSubData(e.ARRAY_BUFFER,J.start*3*Float32Array.BYTES_PER_ELEMENT,ce)}},uploadSeatStateRuns(K){if(!K.length)return;G&&Q();for(let ee of K)Rl(h,t.seats.iState,ee.start,ee.length,d,f);let oe=M.buffer;if(!oe){M.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,oe);for(let ee of K){let le=h.subarray(ee.start*3,(ee.start+ee.length)*3);e.bufferSubData(e.ARRAY_BUFFER,ee.start*3*Float32Array.BYTES_PER_ELEMENT,le)}},dispose(){V=!0,c.dispose(),r.remove(),i.remove(),s.remove(),l.remove(),y.remove(),m.remove(),B.remove(),v.remove(),z?.remove(),q?.remove(),$?.texture&&e.deleteTexture($.texture)}},Y=t.productionElements.find(K=>K.contentImageUrl&&K.contentPlane);if(Y?.contentImageUrl&&Y.contentPlane?.length===4&&typeof Image<"u"){let K=new Image;K.crossOrigin="anonymous",K.onload=()=>{if(V)return;let oe=Y.contentPlane;z=new Ie.Geometry(e,{position:{size:3,data:new Float32Array(oe.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(Y.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),$=new Ie.Texture(e,{image:K,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),q=new Ie.Program(e,{vertex:`#version 300 es
968
+ }`}),u=new Xe.Transform,h=new Xe.Mesh(e,{geometry:t,program:l});h.frustumCulled=!1,h.setParent(u);let f=e.getParameter(e.COLOR_CLEAR_VALUE),d=e.isEnabled(e.DITHER);try{e.disable(e.DITHER),e.clearColor(1,1,1,1),e.renderer.render({scene:u,camera:c,target:m})}finally{d&&e.enable(e.DITHER),e.clearColor(f[0],f[1],f[2],f[3]),l.remove()}let p=new Xe.Mat4().multiply(c.projectionMatrix,c.viewMatrix);return{texture:m.depthTexture,matrix:p,dispose(){for(let b of m.textures)e.deleteTexture(b.texture);e.deleteTexture(m.depthTexture.texture),e.deleteFramebuffer(m.buffer),m.depthBuffer&&e.deleteRenderbuffer(m.depthBuffer)}}}var I0=.65,A0=new Set(["dimmed","sold"]),R0=new Set(["dimmed","sold","held"]);function Ql(e,t,n){let o=new Set,i=!1,r=_e.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===r){a=!0;break}let s=a?R0:A0;for(let c of e){let m=t.get(c.sectionId);if(!m||!m.length){o.add(c.sectionId);continue}let l=!1;for(let u of m){let h=_e[n[u]]??"available";if(!s.has(h)){l=!0;break}}l?o.add(c.sectionId):i=!0}return{lit:o,anyUnlit:i}}function Jl(e,t,n,o,i,r){let a=[];for(let s of e){let c=i===null||i.has(s.sectionId);if(o.get(s.sectionId)===c)continue;o.set(s.sectionId,c);let m=(s.start+s.count)*3;for(let l=s.start*3;l<m;l++)t[l]=c?n[l]:n[l]+(r[l%3]-n[l])*I0;a.push(s)}return a}var eu=_e.indexOf("selected");function E0(e,t){return[0,1,2].map(n=>e[n]*.15+.75+t[n]*.1)}function tu(e,t,n,o,i,r){for(let a=n;a<n+o;a++){let s=r&&t[a]===0,c=r&&t[a]===eu?E0([r[a*3],r[a*3+1],r[a*3+2]],i[eu]??i[0]):s?null:i[t[a]]??i[0];e[a*3]=c?c[0]:r[a*3],e[a*3+1]=c?c[1]:r[a*3+1],e[a*3+2]=c?c[2]:r[a*3+2]}}var C0=new Float32Array([-1,-1,3,-1,-1,3]);function nu(e,t){let n=new Ce.Transform,o=new Ce.Transform,i=new Ce.Geometry(e,{position:{size:2,data:C0}}),r=ql(e,t.theme.background.top,t.theme.background.bottom,t.outdoor?t.theme.sky:null),a=new Ce.Mesh(e,{geometry:i,program:r});a.frustumCulled=!1,a.setParent(o);let s=new Ce.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=Zl(e,s,t.renderBounds),m=Yl(e,t.theme.materials.roughness,t.theme.structure.tierTop);m.uniforms.tVenueShadow={value:c.texture},m.uniforms.uShadowMatrix={value:c.matrix},t.room&&m.uniforms.uRoomCentre.value.set(t.room.centre);let l=new Ce.Mesh(e,{geometry:s,program:m});l.frustumCulled=!1,l.setParent(n);let u=Kl(e),h=new Float32Array(t.seats.count*3),f=_e.map(Y=>t.theme.seatStates[Y]),d=t.seats.iCategory.slice();for(let Y=0;Y<t.seats.count;Y++){if(t.seats.iPhysicalSeat[Y]<.5)continue;let ie=t.theme.materials.seat??ua([d[Y*3],d[Y*3+1],d[Y*3+2]]);d.set(ie,Y*3)}tu(h,t.seats.iState,0,t.seats.count,f,d);let p=ia(),b=new Uint8Array(t.seats.count),g=new Ce.Geometry(e,{position:{size:3,data:p.position},normal:{size:3,data:p.normal},uv:{size:2,data:p.uv},index:{size:1,data:p.index},surface:{size:1,data:p.surface},iYaw:{size:1,data:t.seats.iYaw,instanced:1},iChairWidth:{size:1,data:t.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:t.seats.iGlyph,instanced:1},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:h,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:b,type:e.UNSIGNED_BYTE,usage:e.DYNAMIC_DRAW,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},iSection:{size:1,data:t.seats.iSection,instanced:1}}),x=new Ce.Mesh(e,{geometry:g,program:u});x.frustumCulled=!1,t.seats.count>0&&x.setParent(n);let S=g.attributes.iColor,I=t.solids.color.slice(),M=t.theme.structure.ground,y=new Map(t.sectionSolidRanges.map(Y=>[Y.sectionId,!0])),P=na(),v=$l(e,t.theme.materials.roughness),w=no,R=new Float32Array(w*3),C=new Float32Array(w*3),O=new Float32Array(w),E=new Float32Array(w),A=new Float32Array(w),T=new Float32Array(w*3),L=new Float32Array(w),V=new Float32Array(w),F=new Float32Array(w),G=new Float32Array(w),j=new Float32Array(w),N=new Ce.Geometry(e,{position:{size:3,data:P.position},normal:{size:3,data:P.normal},part:{size:1,data:P.part},index:{data:P.index},iOffset:{size:3,data:R,instanced:1},iColor:{size:3,data:C,instanced:1},iRadius:{size:1,data:O,instanced:1},iYaw:{size:1,data:E,instanced:1},iGlyph:{size:1,data:A,instanced:1},iRing:{size:3,data:T,instanced:1},iFloor:{size:1,data:L,instanced:1},iSection:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:F,instanced:1},iSeed:{size:1,data:j,instanced:1},iPickIndex:{size:1,data:G,instanced:1}}),k=new Ce.Mesh(e,{geometry:N,program:v});k.frustumCulled=!1;let B=0,D=!1,H=!1,U=null,q=null,$=null,ee=new Int32Array(0),Q=()=>{let Y=t.seats;for(let ie=0;ie<B;ie++){let te=ee[ie];j[ie]=Oa(Y.iState[te],te),C[ie*3]=h[te*3],C[ie*3+1]=h[te*3+1],C[ie*3+2]=h[te*3+2]}N.attributes.iColor.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0},X={main:n,background:o,backgroundProgram:r,seatProgram:u,solidProgram:m,chairProgram:v,seatGeometry:g,chairGeometry:N,solidGeometry:s,drawCalls:3,setNearSeats(Y,ie){let te=Math.min(ie,w,Y.length);if(Vl(b,Y,te),g.attributes.iHasChair.needsUpdate=!0,ee=Y,B=te,te===0){k.parent&&k.setParent(null),N.instancedCount=0,X.drawCalls=3+(D?1:0);return}let ae=t.seats;for(let J=0;J<te;J++){let oe=Y[J];R[J*3]=ae.iPosition[oe*3],R[J*3+1]=ae.iPosition[oe*3+1],R[J*3+2]=ae.iPosition[oe*3+2],O[J]=ae.iChairWidth[oe],E[J]=ae.iYaw[oe],A[J]=ae.iGlyph[oe],T[J*3]=ae.iRing[oe*3],T[J*3+1]=ae.iRing[oe*3+1],T[J*3+2]=ae.iRing[oe*3+2],L[J]=ae.iFloor[oe],V[J]=ae.iSection[oe],F[J]=ae.iPhysicalSeat[oe],G[J]=oe+1}Q(),N.attributes.iOffset.needsUpdate=!0,N.attributes.iRadius.needsUpdate=!0,N.attributes.iYaw.needsUpdate=!0,N.attributes.iGlyph.needsUpdate=!0,N.attributes.iRing.needsUpdate=!0,N.attributes.iFloor.needsUpdate=!0,N.attributes.iSection.needsUpdate=!0,N.attributes.iPhysicalSeat.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0,N.attributes.iPickIndex.needsUpdate=!0,N.instancedCount=te,k.parent||k.setParent(n),X.drawCalls=4+(D?1:0)},nearSeatCount(){return B},setSectionShellLit(Y){m.uniforms.uSectionFilter.value=Y===null?0:1;let ie=Jl(t.sectionSolidRanges,t.solids.color,I,y,Y,M);if(!ie.length)return;let te=s.attributes.color,ae=te.buffer;if(!ae){te.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,ae);for(let J of ie){let oe=t.solids.color.subarray(J.start*3,(J.start+J.count)*3);e.bufferSubData(e.ARRAY_BUFFER,J.start*3*Float32Array.BYTES_PER_ELEMENT,oe)}},uploadSeatStateRuns(Y){if(!Y.length)return;B&&Q();for(let te of Y)tu(h,t.seats.iState,te.start,te.length,f,d);let ie=S.buffer;if(!ie){S.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,ie);for(let te of Y){let ae=h.subarray(te.start*3,(te.start+te.length)*3);e.bufferSubData(e.ARRAY_BUFFER,te.start*3*Float32Array.BYTES_PER_ELEMENT,ae)}},dispose(){H=!0,c.dispose(),i.remove(),r.remove(),s.remove(),m.remove(),g.remove(),u.remove(),N.remove(),v.remove(),U?.remove(),q?.remove(),$?.texture&&e.deleteTexture($.texture)}},K=t.productionElements.find(Y=>Y.contentImageUrl&&Y.contentPlane);if(K?.contentImageUrl&&K.contentPlane?.length===4&&typeof Image<"u"){let Y=new Image;Y.crossOrigin="anonymous",Y.onload=()=>{if(H)return;let ie=K.contentPlane;U=new Ce.Geometry(e,{position:{size:3,data:new Float32Array(ie.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(K.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),$=new Ce.Texture(e,{image:Y,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),q=new Ce.Program(e,{vertex:`#version 300 es
895
969
  precision highp float;
896
970
  in vec3 position; in vec2 uv; in float floorIndex;
897
971
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -899,4 +973,4 @@ void main() {
899
973
  void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
900
974
  precision highp float;
901
975
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
902
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:$},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let ee=new Ie.Mesh(e,{geometry:z,program:q});ee.frustumCulled=!1,ee.setParent(n),W.screenProgram=q,j=!0,W.drawCalls=3+(G?1:0)+1},K.src=Y.contentImageUrl}return W}var ot=require("ogl");function hy(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function El(e,t,n,o,r,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,m=hy(e[u],e[u+1],e[u+2]);if(m<0||m>=i)continue;let h=l-o,d=c-r,f=h*h+d*d;f<s&&(s=f,a=m)}return a}function Cl(e,t,n,o,r,i){let a=e-n.left,s=t-n.top,c=Math.round(a*o),l=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(r-1,c)),y:Math.max(0,Math.min(i-1,l))}}var py=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Ro=class{constructor(t,n,o,r,i){this.seatScene=new ot.Transform;this.chairScene=new ot.Transform;this.solidScene=new ot.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=pl(this.gl),this.chairProg=bl(this.gl),this.depthProg=yl(this.gl);let a=new ot.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ot.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ot.Mesh(this.gl,{geometry:r,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRoomCentre(t){this.depthProg.uniforms.uRoomCentre.value.set(t??[0,0])}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let o of py)this.seatProg.uniforms[o].value=t.uniforms[o].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 ot.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,o,r){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-r),u=Math.max(0,o-r),m=Math.max(1,Math.min(s,n+r+1)-l),h=Math.max(1,Math.min(c,o+r+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,m,h);let[d,f,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(d,f,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(m*h*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,m,h,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),El(b,m,h,n-l,o-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function _l(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,fn(o.state)):n.push(o);return n}function Tl(e,t,n){let o=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&o.add(a);let r=new Map(e),i=[];for(let[a,s]of e)o.has(a)||(i.push({seatId:a,state:Ce[s]??"available"}),r.delete(a));for(let a of o){if(r.has(a))continue;let s=n(a);s!==void 0&&(r.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:r}}var Mt=require("ogl");function by(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function kl(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function yy(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ll(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 Jr(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function ei(e,t){return Math.max(0,Math.min(1,e+t))}function Fl(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let o=Math.max(0,Math.min(1,t)),r=n-1,i=Math.floor(o*r);i>=r&&(i=r-1);let a=o*r-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],m=a*a,h=m*a,d=[0,0,0];for(let f=0;f<3;f++)d[f]=.5*(2*c[f]+(-s[f]+l[f])*a+(2*s[f]-5*c[f]+4*l[f]-u[f])*m+(-s[f]+3*c[f]-3*l[f]+u[f])*h);return d}function ti(e,t,n,o,r){let i=Ll(by(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=kl(kl(t,yy(i,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=Ll(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,r),u=[o[0]+c[0]*l*1.3,o[1]+l*.75,o[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function ni(e,t,n=35,o=28){let r=Jr(t),i=Fl(e,r),a=Jr(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(o-n)*a,eased:r}}function Nl(e,t,n){let o=e.position.clone(),r=new Mt.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Mt.Vec3(n[0],n[1],n[2]));let i=new Mt.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(r),i}var Ao=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Mt.Quat;this.endQuat=new Mt.Quat;this.outQuat=new Mt.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,o,r=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=r,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:o,fov:r,eased:i}=ni(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,ei(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=r,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 Vl=$o,gy=.12,xy=.25,vy=1.5;function Gl(e,t,n=0,o,r){let i=[t.x*E,n+vy,t.y*E],a=r?[r[0],r[1],r[2]]:i,s=e[1],c=Number.isFinite(s)?s+Vl:Number.isFinite(o)?n+o:n+Vl,l=i[0]-e[0],u=i[2]-e[2],m=Math.hypot(l,u),h=m>.001?Math.min(gy,m*xy):0,d=m>.001?l/m:0,f=m>.001?u/m:0;return{eye:[e[0]+d*h,c,e[2]+f*h],focal:a}}var St=Math.PI/180,My=45,oi=80,Eo=70,Sy=1,wy=.99;function Py(e,t){if(!(e<Sy))return oi;if(!(Number.isFinite(t)&&t>0))return Eo;let n=2*Math.atan(t/(2*Co*wy)/Math.max(.05,e))/St;return Math.max(Eo,Math.min(oi,n))}var Iy=.25,Co=1,Ry=.25,Ay=12*St,Ey=.2,Cy=1.5,Hl=.8,zl=6,Kl=1.9,_y=2/3,Ty=.12,ky=.9,Ly=1.2,Fy=2,ql=.05,Oy=6;function $l(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+Hl,t[1]),t[2]+6]};let o=1/0,r=-1/0,i=1/0,a=-1/0,s=n;for(let f of e)o=Math.min(o,f.cx-f.halfX),r=Math.max(r,f.cx+f.halfX),i=Math.min(i,f.cz-f.halfZ),a=Math.max(a,f.cz+f.halfZ),s=Math.max(s,f.y);let c=r-o,l=a-i,u=Math.max(c,Math.min(l,zl))/2,m=Math.max(l,Math.min(c,zl))/2,h=(o+r)/2,d=(i+a)/2;return{min:[h-u,n,d-m],max:[h+u,Math.max(n+Hl,s),d+m]}}function Dy(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Kl,e.max[2]]}}function ri(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Cy,t+Ey,t+Kl*_y),(e.min[2]+e.max[2])/2]}function Zl(e,t){let n=e[0]-t[0],o=e[2]-t[2],r=Math.hypot(n,o);return r<.001?{x:0,z:1}:{x:n/r,z:o/r}}function Ul(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=1/0,m=-1/0;for(let h=0;h<8;h++){let d=(h&1?n.max[0]:n.min[0])-e[0],f=(h&2?n.max[1]:n.min[1])-e[1],p=(h&4?n.max[2]:n.min[2])-e[2],b=Math.max(ql,d*o+f*r+p*i),y=(d*s+p*c)/b;y<u&&(u=y),y>m&&(m=y)}return m-u}function jl(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=-c*r,m=c*o-s*i,h=s*r,d=1/0,f=-1/0;for(let p=0;p<8;p++){let b=(p&1?n.max[0]:n.min[0])-e[0],y=(p&2?n.max[1]:n.min[1])-e[1],g=(p&4?n.max[2]:n.min[2])-e[2],M=Math.max(ql,b*o+y*r+g*i),P=(b*u+y*m+g*h)/M;P<d&&(d=P),P>f&&(f=P)}return f-d}function _o(e,t){return Math.tan(e*St/2)*Math.max(.05,t)}function Xl(e,t,n){let o=Py(n,e),r=c=>Math.max(My,Math.min(o,c)),i=c=>2*Math.atan(c)/St,a=Number.isFinite(e)&&e>0?r(i(e/(2*Iy)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,r(i(t/(2*Ty))));return e/(2*_o(s,n))>Co?a:s}function Ql(e,t,n,o={}){let r=ri(t),i=[e[0],e[1],e[2]],a=0,s=0,c=f=>{if(!(f>0))return;let p=Zl(i,r);i[0]+=p.x*f,i[2]+=p.z*f,s+=f},l=o.preserveEye?0:t.max[1]+Ry-i[1];l>0&&(i[1]+=l,a=l,c(l/Math.tan(Ay)));let u=Dy(t),m=Ul(i,r,t),h=Xl(m,jl(i,r,u),n),d=m/(2*_o(h,n));for(let f=0;!o.preserveEye&&f<Oy&&d>Co;f++){let p=Math.max(1,Math.hypot(i[0]-r[0],i[2]-r[2])),b=Number.isFinite(d)?d/Co:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=Ul(i,r,t),h=Xl(m,jl(i,r,u),n),d=m/(2*_o(h,n))}return{eye:i,focal:r,fov:h,raisedM:a,pulledBackM:s,stageFrameWidth:d}}function By(e,t,n){let o=Math.tan(t*St/2),r=_o(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,r)))}var Ny=.7,Wl=.5,Vy=.8;function Yl(e,t,n){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],r=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],i=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(r[0],r[1],r[2])||1;return Math.acos(Math.max(-1,Math.min(1,i/a)))/St}function Gy(e,t,n){let o=l=>{let u=Math.hypot(l[0],l[1],l[2])||1;return[l[0]/u,l[1]/u,l[2]/u]},r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=Math.hypot(r[0],r[1],r[2]),a=o(r),s=o([n[0]-e[0],n[1]-e[1],n[2]-e[2]]),c=o([0,1,2].map(l=>a[l]*(1-Wl)+s[l]*Wl));return[e[0]+c[0]*i,e[1]+c[1]*i,e[2]+c[2]*i]}function Jl(e,t){let{aspect:n,venue:o}=t,r=e.focal,i=Zl(e.eye,r),a=p=>(p[0]-r[0])*i.x+(p[2]-r[2])*i.z,s=[{name:"seat",eye:e.eye,focal:r,fov:e.fov}],c=Fy*(t.rowDepthM??ky),l=[e.eye[0]+i.x*c,e.eye[1]+Ly,e.eye[2]+i.z*c],u=[e.eye[0],e.eye[1]-Ny,e.eye[2]],m=Gy(l,r,u);s.push({name:"row",eye:l,focal:m,fov:Math.min(oi,Math.max(e.fov,2*Math.max(Yl(l,m,u),Yl(l,m,r))/Vy))});let h=(p,b,y,g)=>{let M=By(y,e.fov,n)*1.08,P=M*Math.sin(g*St),I=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,S=Math.max(P,I-b[1]),x=M*Math.cos(g*St);return{name:p,eye:[b[0]+i.x*x,b[1]+S,b[2]+i.z*x],focal:b,fov:e.fov}};t.section&&t.section.radius>0&&s.push(h("section",t.section.center,t.section.radius,35)),s.push(h("venue",o.center,Math.max(1,o.radius),40));let d=[],f=-1/0;for(let p of s){let b=a(p.eye);d.length&&b<=f+.5||(d.push(p),f=b)}return d}var ou=require("ogl"),On=Math.PI/180,ii=320,eu=70*On,Hy=32*On,zy=24*On,tu=.0026,Uy=.22,jy=.006,Xy=180,Wy=900,Yy=1100,Ky=4,Fe=(e,t,n)=>Math.max(t,Math.min(n,e)),nu=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function ru(e){let{canvas:t,camera:n}=e,o=[],r=!1,i=0,a=0,s=0,c=0,l=0,u=0,m=ii,h=null,d=()=>{h&&(clearTimeout(h),h=null)},f=!1,p=[0,0],b=0,y=!1,g=null,M=null,P=new Map,I=!1,S=0,x=0,v=0,w=0,R=()=>r&&o.length?o[Fe(Math.round(i),0,o.length-1)].name:null,T=()=>{let D=R();D!==g&&(g=D,e.onStopChange?.(D))},O=()=>{if(!r||!o.length)return;let D=o[Fe(Math.floor(i),0,o.length-1)],G=o[Fe(Math.ceil(i),0,o.length-1)],j=Fe(i-Math.floor(i),0,1),V=(J,ce)=>J+(ce-J)*j,z=[V(D.eye[0],G.eye[0]),V(D.eye[1],G.eye[1]),V(D.eye[2],G.eye[2])],q=[V(D.focal[0],G.focal[0]),V(D.focal[1],G.focal[1]),V(D.focal[2],G.focal[2])],$=q[0]-z[0],re=q[1]-z[1],Q=q[2]-z[2],W=Math.hypot($,re,Q)||1,Y=Math.atan2($,Q),K=Math.asin(Fe(re/W,-1,1)),oe=Y+a,ee=Fe(K+s,-80*On,80*On),le=Math.cos(ee)*W;$=Math.sin(oe)*le,re=Math.sin(ee)*W,Q=Math.cos(oe)*le,n.position.set(z[0],z[1],z[2]),n.fov=V(D.fov,G.fov),n.updateProjectionMatrix(),n.lookAt(new ou.Vec3(z[0]+$,z[1]+re,z[2]+Q)),e.onApplied?.()},C=()=>{if(!r||!o.length)return;let D=Fe(Math.round(i),0,o.length-1);if(e.reducedMotion()){f=!1,i=D,O(),T(),e.requestRender();return}if(Math.abs(D-i)<.001){f=!1,T();return}c=i,l=D,u=performance.now(),m=ii,f=!0,e.requestRender()},A=D=>{!r||o.length<2||(d(),f=!1,i=Fe(i+D,0,o.length-1),O(),T(),e.requestRender())},_=(D,G)=>{r&&(d(),f=!1,y=!1,a=Fe(a-D*tu,-eu,eu),s=Fe(s-G*tu,-zy,Hy),O(),e.requestRender())},L=D=>{r&&(P.set(D.pointerId,{x:D.clientX,y:D.clientY}),P.size===1?(I=!0,w=0,S=D.clientX,x=D.clientY):P.size===2&&(I=!1,v=N()))},N=()=>{let D=[...P.values()];return D.length<2?0:Math.hypot(D[0].x-D[1].x,D[0].y-D[1].y)},k=D=>{if(!r||!P.has(D.pointerId))return;if(P.set(D.pointerId,{x:D.clientX,y:D.clientY}),P.size>=2){let V=N();v>0&&A((v-V)*jy),v=V;return}if(!I)return;let G=D.clientX-S,j=D.clientY-x;S=D.clientX,x=D.clientY,w+=Math.abs(G)+Math.abs(j),!(w<=Ky)&&_(G,j)},F=D=>{P.delete(D.pointerId)&&(P.size<2&&(v=0),P.size===0&&(I=!1,C()))},H=D=>{if(!r)return;D.preventDefault();let G=D.deltaMode===1?16:D.deltaMode===2?100:1,j=Fe(D.deltaY*G/100,-2,2);A(j*Uy),M&&clearTimeout(M),M=setTimeout(()=>{M=null,C()},Xy)},B=()=>{d(),r&&(r=!1,f=!1,y=!1,o=[],P.clear(),I=!1,M&&(clearTimeout(M),M=null),g!==null&&(g=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",L),t.addEventListener("pointermove",k),t.addEventListener("pointerup",F),t.addEventListener("pointercancel",F),t.addEventListener("wheel",H,{passive:!1}),{get active(){return r},enter(D,G=0){if(D.length<2){B();return}d(),o=D,r=!0,i=e.reducedMotion()?0:Fe(G,0,D.length-1),i>0&&(h=setTimeout(()=>{h=null,r&&(c=i,l=0,u=performance.now(),m=Yy,f=!0,e.requestRender())},Wy)),a=0,s=0,f=!1,y=!1,g=null,O(),T(),e.requestRender()},exit:B,recentre(){return r?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(y=!1,a=0,s=0,O(),e.requestRender(),!0):(p=[a,s],b=performance.now(),y=!0,e.requestRender(),!0):!1},update(D){if(!r)return!1;let G=!1;if(y){let j=Fe((D-b)/ii,0,1),V=1-nu(j);a=p[0]*V,s=p[1]*V,j>=1?(y=!1,a=0,s=0):G=!0}if(f){let j=Fe((D-u)/m,0,1);i=c+(l-c)*nu(j),j>=1?(f=!1,i=l,T()):G=!0}return O(),G},currentStop:R,dispose(){B(),t.removeEventListener("pointerdown",L),t.removeEventListener("pointermove",k),t.removeEventListener("pointerup",F),t.removeEventListener("pointercancel",F),t.removeEventListener("wheel",H)}}}function iu(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var li=null;function gu(){return li??=Promise.resolve().then(()=>(yu(),bu)).catch(e=>{throw li=null,e}),li}var xu=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Bo=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,o,r){this.emit("3d_opened",{seats:t,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...r===void 0?{}:{prepSource:r}})}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=xu(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(xu()-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 vu(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Mu(e){let{container:t,model:n,opts:o,expandedSeatById:r,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{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,h,d=!1)=>{if(l(),e.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 p=o.chrome?.caption!==!1,b=o.chrome?.seatStepper!==!1;if(!p&&!b)return null;let y=r.get(m),g=y?.sectionId?n.sections.find(R=>R.id===y.sectionId):void 0,M=y?.label??m;f.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${M}`);let P=document.createElement("span");P.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",g?.label,M].filter(Boolean).join(" \xB7 "),Object.assign(P.style,{maxWidth:"min(70vw, 560px)",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&&f.appendChild(P);let I=document.createElement("div");Object.assign(I.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(I);let S=y?.rowId?i.get(y.rowId):void 0,x=S?.indexOf(m)??-1,v=x>=0?[S?.[x-1],S?.[x+1]]:[void 0,void 0],w=(R,T,O,C=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=R,A.setAttribute("aria-label",T),Object.assign(A.style,{minHeight:"44px",padding:C?"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"}),C||(A.style.minWidth="44px"),C&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",O),I.appendChild(A)};if(b&&v[0]){let R=r.get(v[0])?.label??v[0];w("\u2039",`View previous seat ${R}`,()=>{e.flyToSeat(v[0])})}if(b&&o.getSeatView){let R=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";w(d?`\u21BB Retry ${R}`:`\u25C9 ${R}`,`${d?"Retry":R} from seat ${M}`,()=>{if(e.isDisposed()||h!==e.flightGen()){l();return}l(),e.openPanorama(m,400,h)},!0)}if(b&&v[1]){let R=r.get(v[1])?.label??v[1];w("\u203A",`View next seat ${R}`,()=>{e.flyToSeat(v[1])})}return!I.childElementCount&&!p?null:(t.appendChild(f),s=f,c(),f)},remove:l,layout:c}}var l0={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Su(e){let{container:t,orbit:n,isNarrow:o}=e,r={...l0,...e.labels??{}},i=(M,P)=>{M.setAttribute("aria-label",P),M.title=P},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D view controls"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",i(u,r.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",i(m,r.move);let h=document.createElement("button");h.type="button",h.textContent="\u2212",i(h,r.zoomOut);let d=document.createElement("button");d.type="button",d.textContent="+",i(d,r.zoomIn);for(let M of[u,m,h,d])M.className="sl-3d-icon-control",Object.assign(M.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"});c.append(u,m),l.append(d,h);let f=M=>{n.setPrimaryDragMode(M);let P=M==="orbit";u.setAttribute("aria-pressed",String(P)),m.setAttribute("aria-pressed",String(!P)),u.style.background=P?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=P?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=P?`${r.rotate} \xB7 ${r.move} with Shift`:`${r.move} \xB7 ${r.rotate} with Shift`};u.addEventListener("click",()=>f("orbit")),m.addEventListener("click",()=>f("pan"));let p=()=>{let{atMin:M,atMax:P}=n.dollyLimitState();d.disabled!==M&&(d.disabled=M),h.disabled!==P&&(h.disabled=P)};h.addEventListener("click",()=>{n.zoomBy(dn),p()}),d.addEventListener("click",()=>{n.zoomBy(Nt),p()}),a.append(c,l),f("orbit"),t.appendChild(a);let b=e.enabled!==!1,y=()=>{let M=o();a.style.display=s||!b?"none":"flex",a.style.right=M?"12px":"14px",a.style.bottom=M?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=M?"none":"flex",d.style.display=M?"none":"",h.style.display=M?"none":""};return y(),{element:a,utilityControls:l,setNavigationMode:f,syncZoomLimits:p,setSeatViewLocked:M=>{s=M,n.setInteractionEnabled(!M),y()},seatViewLocked:()=>s,layout:y}}var u0=12;function m0(e,t){if(!e)return!1;let n=e.x-t[0],o=e.y-t[1],r=e.z-t[2];return Math.hypot(n,o,r)>u0}var f0=.5,d0=12;function h0(e,t,n){return!(e>0)||!(n>0)?0:f0*n/(2*e*Math.tan(t*Math.PI/360))}function wu(e){let{glctx:t,orbit:n,model:o,seats:r,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:m,cancelFlight:h,focusSectionCamera:d,setSelection:f,ensureSeatView:p}=e,b=0,y=0,g=0,M=-1,P=!1,I=!1,S=O=>{e.seatViewLocked()||M===-1&&(M=O.pointerId,b=O.clientX,y=O.clientY,g=performance.now(),P=!1,I=a.active,a.active&&(s.cinematicCancelled(),h(),i.onViewTargetChange?.(null)))},x=O=>{O.pointerId===M&&Math.hypot(O.clientX-b,O.clientY-y)>u&&(P=!0)},v=(O,C,A,_,L)=>{let N=t.canvas.getBoundingClientRect(),k=t.canvas.clientWidth||N.width||1,F=t.canvas.clientHeight||N.height||1,H=O-N.left,B=C-N.top,D=_*_,G=-1,j=D,V=1/0;for(let z of r){if(A&&z.sectionId!==A)continue;let q=o.seats.idToIndex.get(z.id);if(q===void 0)continue;if(L){let K=Math.round(o.seats.iState[q]??0);if(K!==0&&K!==3)continue}let $=q*3,re=tt(n.camera.projectionViewMatrix,[o.seats.iPosition[$],o.seats.iPosition[$+1]+.55,o.seats.iPosition[$+2]],k,F);if(!re.visible)continue;let Q=re.x-H,W=re.y-B,Y=Q*Q+W*W;(Y<j||Math.abs(Y-j)<1&&re.depth<V)&&(G=q,j=Y,V=re.depth)}return G},w=(O,C)=>{let A=e.gpu(),_=e.pick();if(!A||!_)return-1;_.syncFromSeatProgram(A.seatProgram);let L=t.canvas.getBoundingClientRect(),N=t.renderer.dpr,{x:k,y:F}=Cl(O,C,L,N,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),H=Math.max(2,Math.round(8*N));return _.pick(n.camera,k,F,H)},R=O=>{let C=n.camera?.position;if(!C)return!1;let A=O*3,_=Math.hypot(C.x-o.seats.iPosition[A],C.y-o.seats.iPosition[A+1],C.z-o.seats.iPosition[A+2]),L=t.canvas.clientHeight||t.canvas.getBoundingClientRect().height;return h0(_,n.fovY,L)>=d0};return{onDown:S,onMove:x,onUp:O=>{if(O.pointerId!==M)return;let C=!P&&performance.now()-g<m;if(M=-1,I){I=!1;return}let A=e.gpu(),_=e.pick();if(!C||!A||!_)return;let L=w(O.clientX,O.clientY),N=L>=0&&R(L),k=!1;if(e.focusedSectionId()&&L>=0){let B=c[L],D=B?l.get(B):void 0;if(D&&D!==e.focusedSectionId()&&d(D,{keepCamera:N})){if(!N)return;k=!0}}if(e.focusedSectionId()&&L<0&&(L=v(O.clientX,O.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&L<0){let B=v(O.clientX,O.clientY,null,72,!1),D=B>=0?c[B]:void 0,G=D?l.get(D):void 0;if(G&&G!==e.focusedSectionId()&&d(G))return}if(!e.focusedSectionId()){L<0&&(L=v(O.clientX,O.clientY,null,42,!1));let B=L>=0?c[L]:void 0,D=B?l.get(B):void 0;if(D&&d(D,{keepCamera:N})){if(!N)return;k=!0}}if(L<0||L>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let F=c[L],H=Ce[Math.round(o.seats.iState[L]??0)]??"available";if(H!=="available"&&H!=="selected"){i.onSeatInspect?.(F,H);return}if(e.selection().has(F)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(F);return}if(f([F]),p(F),s.seatPicked(F,l.get(F)),i.onSeatPick?.(F),e.focusedSectionId()&&!k){let B=L*3,D=[o.seats.iPosition[B],o.seats.iPosition[B+1],o.seats.iPosition[B+2]];m0(n.camera?.position,D)&&e.focusSeatCamera(F)}}}}var No=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,o=1/0,r=-1/0,i=-1/0;for(let d=0;d<this.count;d++){let f=t[d*3],p=t[d*3+2];f<n&&(n=f),f>r&&(r=f),p<o&&(o=p),p>i&&(i=p)}let a=Math.max(r-n,.001),s=Math.max(i-o,.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=o;let c=this.cols*this.rows,l=new Int32Array(c+1),u=d=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[d*3+2]-o)/this.cell)))*this.cols+f};for(let d=0;d<this.count;d++)l[u(d)+1]++;for(let d=0;d<c;d++)l[d+1]+=l[d];let m=new Int32Array(this.count),h=l.slice(0,c);for(let d=0;d<this.count;d++)m[h[u(d)]++]=d;this.cellStart=l,this.cellItems=m}gather(t,n,o,r,i){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let c=r.length,l=o*o,u=Math.floor((t-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),h=Math.ceil(o/this.cell)+1,d=this.iPosition,f=0;for(let p=0;p<=h&&f<c;p++){let b=m-p,y=m+p,g=u-p,M=u+p;for(let P=b;P<=y&&f<c;P++){if(P<0||P>=this.rows)continue;let I=P===b||P===y;for(let S=g;S<=M&&f<c;S++){if(!I&&S!==g&&S!==M){S=M-1;continue}if(S<0||S>=this.cols)continue;let x=P*this.cols+S;for(let v=a[x],w=a[x+1];v<w&&f<c;v++){let R=s[v],T=d[R*3]-t,O=d[R*3+2]-n,C=i===void 0?0:d[R*3+1]-i;T*T+C*C+O*O<=l&&(r[f++]=R)}}}}return f}};var Vo=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Wn);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new No(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,o=this.ctx.gpu();if(!o)return;if(!t){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let r=this.ctx.orbit().camera.position;if(Math.hypot(r.x-this.lastGatherX,r.y-this.lastGatherY,r.z-this.lastGatherZ)<rr)return;if(this.lastGatherX=r.x,this.lastGatherY=r.y,this.lastGatherZ=r.z,Math.hypot(r.x-n.bounds.center[0],r.y-n.bounds.center[1],r.z-n.bounds.center[2])-n.bounds.radius>or){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(r.x,r.z,or,this.nearBuf,r.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(t,n,o){let r=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?r:i),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?r:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function Pu(e){let t=Math.max(5,e.radius),n=e.focalWorld[0]-e.center[0],o=e.focalWorld[2]-e.center[2],r=Math.hypot(n,o);if(r<t*.12)return{center:e.center,radius:t,polarDeg:48};let i=Math.min(r*.25,t*.2);return{center:[e.center[0]+n/r*i,e.center[1],e.center[2]+o/r*i],radius:t+i,polarDeg:50}}var Go=require("ogl");function Iu(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function Eu(e){let{container:t,model:n,opts:o,orbit:r,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,m=0,h=-1,d=(x,v,w=28)=>{r.camera.position.set(x[0],x[1],x[2]),r.camera.lookAt(new Go.Vec3(v[0],v[1],v[2])),r.camera.fov=w,r.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.replaceChildren(Iu());let p=o.navLabels?.fitView??"Show whole venue";f.setAttribute("aria-label",p),f.title=p,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 b=()=>{f.firstElementChild||f.replaceChildren(Iu())};b();let y=x=>{h=x;let v=e.gpu();v&&(v.seatProgram.uniforms.uFocusFloor.value=x,v.solidProgram.uniforms.uFocusFloor.value=x,v.chairProgram.uniforms.uFocusFloor.value=x),e.showSectionSeatLabels(null)},g=()=>{if(e.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let x=h>=0?n.floors[h]:null;if(e.setNearFieldDetailEnabled(!!x),e.setSeatViewLocked(!1),M(),e.removeArriveChip(),e.setNavigationMode("orbit"),x){let v=x.focalWorld[0]-x.center[0],w=x.focalWorld[2]-x.center[2],R=Math.hypot(v,w)>x.radius*.12?Math.atan2(v,w):l,T={center:x.center,radius:x.radius,box:x.box},O={polarDeg:58,margin:1.12};e.reducedMotion()?r.frame(T,!1,R,!1,O):r.frameSoft(T,R,!1,O)}else e.reducedMotion()?r.frame(n.bounds,!1,l,o.portraitOverviewCrop===!0,u):r.frameSoft(n.bounds,l,o.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},M=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),r.resumeAfterFlight(n.focalWorld))},P=x=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let v=n.seats.idToIndex.get(x);if(v===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(x),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let w=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(w),e.setSeatViewLocked(!1);let R=++m;w?e.showArriveChip(x,R):e.removeArriveChip();let{eye:T,focal:O}=e.resolvedSeatViewPose(x,v),C=o.arriveAtSeatEye?e.seatViewArrival(x,v):null,A=C&&C.stops.length>1&&C.stops[1].name==="row"?C.stops[1]:null,_=C?C.focal:O,L=[r.camera.position.x,r.camera.position.y,r.camera.position.z],N=ti(L,C?.eye??T,_,n.bounds.center,n.bounds.radius),k=A?A.eye:C?C.eye:o.arriveAtSeatEye?T:N.finalPos,F=C?C.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Eo:65:28,H=[N.waypoints[0],N.waypoints[1],k];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),d(k,_,F),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||r.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),C&&e.enterSeatView(C.stops),e.showArriveChip(x,R),Promise.resolve();let B=new Go.Quat().copy(r.camera.quaternion),D=Nl(r.camera,k,_);s.requestRender();let G=w?700:2500;return i.start(H,B,D,G,F).then(()=>{e.isDisposed()||R!==m||(e.setSeatStepping(!1),a.cinematicPlayed(G),r.resumeAfterFlight(_),e.setSeatViewLocked(o.arriveAtSeatEye===!0),C&&e.enterSeatView(C.stops,A?1:0),s.requestRender(),e.showArriveChip(x,R))})},I=(x,v)=>{let w=n.sections.find(R=>R.id===x);if(!w||w.seatCount===0)return!1;if(e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&h!==w.floorIndex&&y(w.floorIndex),e.setNavigationMode("pan"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(x),!v?.keepCamera){let R=Pu(w),T={polarDeg:R.polarDeg,margin:1.12};e.reducedMotion()?r.frame({center:R.center,radius:R.radius},!1,r.currentAzimuth,!1,T):r.glideTo({center:R.center,radius:R.radius},T)}return o.onSectionFocusChange?.(x),s.requestRender(),!0},S=x=>{if(e.isDisposed()||!e.gpu())return!1;let v=n.seats.idToIndex.get(x);if(v===void 0)return!1;let w=v*3,R=[n.seats.iPosition[w],n.seats.iPosition[w+1]+.55,n.seats.iPosition[w+2]];return e.reducedMotion()?r.frame({center:R,radius:Ru},!1,void 0,!1,Au):r.frameSoft({center:R,radius:Ru},void 0,!1,Au),s.requestRender(),!0};return f.addEventListener("click",g),{overviewChip:f,layoutOverviewChip:b,flightGen:()=>m,focusedFloor:()=>h,applyFloorFocus:y,placeCameraFinal:d,cancelFlight:M,focusOverview:g,flyToSeat:P,focusSectionCamera:I,focusSeatCamera:S}}var Ru=4.5,Au={polarDeg:48,margin:1.25};function Bn(e,t){let{doc:n,report:o}=vo(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(d=>[d.id,d.role])),l=d=>d.map(f=>f.type==="shape"&&c.has(f.id)?{...f,role:c.get(f.id)}:f),u=e.floors?.map(d=>({...d,objects:l(d.objects)})),m=new Float64Array(t.length).fill(Number.NaN),h=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((d,f)=>{d.eyeHeightM!==void 0&&(m[f]=d.eyeHeightM),d.focalPoint&&(h[f*2]=d.focalPoint.x,h[f*2+1]=d.focalPoint.y)}),{doc:{...e,objects:u?.[0]?.objects??l(e.objects),...u?{floors:u}:{}},report:o,eyeHeightM:m,focal:h}}let i=new Map(Ut(n).map(c=>[c.id,c])),a=new Float64Array(t.length).fill(Number.NaN),s=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,l)=>{let u=i.get(c.id)??c;u.eyeHeightM!==void 0&&(a[l]=u.eyeHeightM),u.focalPoint&&(s[l*2]=u.focalPoint.x,s[l*2+1]=u.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function ui(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],a=t.focal[o*2+1],s={...n};return Number.isNaN(r)?delete s.eyeHeightM:s.eyeHeightM=r,Number.isNaN(i)?delete s.focalPoint:s.focalPoint={x:i,y:a},s})}function Cu(e){let t=e.estimate===!1?null:Bn(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:ui(e.seats,t)},estimate:t}:{input:e}}function mi(e,t,n,o,r,i,a,s,c=.5){let l=-1,u=s*s,m=1/0;for(let h=0;h<t;h++){let d=h*3,f=tt(n,[e[d],e[d+1]+c,e[d+2]],o,r);if(!f.visible)continue;let p=f.x-i,b=f.y-a,y=p*p+b*b;(y<u-4||y<u+4&&f.depth<m)&&(l=h,u=Math.min(u,y),m=f.depth)}return l}var b0={};function _u(e){let t=performance.now(),{input:n,estimate:o}=Cu(e);return{model:Qt(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function p0(e){let t=Ut(e.doc);return{..._u({...e,seats:t}),seats:t}}function Tu(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let o;try{o=new Worker(new URL("./scene/scene.worker.js",b0.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(r=>{let i=!1,a=l=>{i||(i=!0,clearTimeout(c),o.terminate(),r(l))},s=()=>a(t()),c=window.setTimeout(s,15e3);o.onerror=s,o.onmessage=l=>{let u=n(l.data);u?a(u):s()},o.postMessage(e)})}function ku(e){return Tu(e,()=>_u(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function Lu(e){return Tu(e,()=>p0(e),({model:t,buildMs:n,seats:o,estimate:r})=>o?{model:t,buildMs:n,seats:o,source:"worker",...r?{estimate:r}:{}}:null)}var y0=40,g0=48,x0=Math.PI/180,v0=6,M0=500;function S0(e,t,n={}){let o=performance.now(),r=t.prepared?t.prepared.estimate:t.estimate===!1?null:Bn(t.doc,t.seats);r&&(t={...t,doc:r.doc,seats:ui(t.seats,r)});let i=t.prepared?.model??Qt(t),a=new Bo(n.onAnalytics),s=new Array(i.seats.count);for(let[U,X]of i.seats.idToIndex)s[X]=U;let c=new Map(t.seats.map(U=>[U.id,U])),l=new Map;for(let U of t.seats){if(!U.rowId)continue;let X=l.get(U.rowId);X?X.push(U.id):l.set(U.rowId,[U.id])}let u=new Map;t.seats.forEach((U,X)=>{u.set(U.id,i.seatSectionIds?.[X]??U.sectionId)});let m=new Map;for(let[U,X]of i.seats.idToIndex){let Z=u.get(U);if(!Z)continue;let se=m.get(Z);se?se.push(X):m.set(Z,[X])}let h=()=>{if(!f||!i.sectionSolidRanges.length)return;let{lit:U,anyUnlit:X}=wl(i.sectionSolidRanges,m,i.seats.iState);f.setSectionShellLit(X?U:null)},d=t.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(X=>X.objects)??t.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),f=null,p=null,b=null,y=!1,g=!1,M=!1,P=new Map,I=null,S=null,x=null,v=new Map,w=null,R=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},T=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,C=()=>O?Te.focusedFloor():-1,A=()=>{f=Al(k.gl,i),p?.dispose(),p=Qc(k.gl,[1,1,1]),fi(!1),h(),oe(),b=new Ro(k.renderer,f.seatGeometry,f.chairGeometry,f.solidGeometry,i.seats.count),k.setClearColor(i.theme.background.top),b.setRestoreClear(i.theme.background.top),b.setRoomCentre(i.room?.centre),f.seatProgram.uniforms.uSeatRadius.value=at*i.theme.seatScale,f.seatProgram.uniforms.uFocusFloor.value=C(),f.solidProgram.uniforms.uFocusFloor.value=C(),f.chairProgram.uniforms.uFocusFloor.value=C(),f.screenProgram&&(f.screenProgram.uniforms.uFocusFloor.value=C()),L.forceRegather()},_=!1,L=new Vo({model:i,orbit:()=>F,gpu:()=>f}),N=U=>L.setDetailEnabled(U),k=new Un(e,{onContextLost:()=>{M||a.contextLost(),y=!0,me.stop(),f=null,b=null},onContextRestored:()=>{A(),y=!1,M||a.contextRestored(),me.requestRender()}}),F=new jn(k.gl,k.canvas,()=>me.requestRender(),()=>a.orbitEngaged());F.setAspect(k.aspect);let H=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),B=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(H&&i.stages.length===0))return Ii(i.focalWorld,i.seats.iPosition,i.bounds)})(),D=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="shape"&&U.stageKind?.startsWith("pitch-")),G=i.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:D?36:48,margin:1.05},j=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F.frame(i.bounds,!j&&n.skipInitialOverviewAnimation!==!0,B,n.portraitOverviewCrop===!0,G);let V=new Ao(F.camera),z=vu(e),q=Ri(e,i),$=new wo(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:i.theme.background.top}),re=i.labels,Q=()=>wc(re,i.floors.length,C());$.setLabels(Q());let W=null,Y=()=>[...P.keys()].flatMap(U=>{let X=i.seats.idToIndex.get(U),Z=X===void 0?void 0:t.seats[X];if(X===void 0||Z?.id!==U)return[];let se=X*3;return[{id:`seat:${U}`,kind:"seat",seatWidthM:i.seats.iChairWidth[X]*2,text:Z.displayLabel||Z.label,anchor:[i.seats.iPosition[se],i.seats.iPosition[se+1]+1.05,i.seats.iPosition[se+2]],pinBase:Xe(se)}]}),K=-1,oe=()=>{f&&(K=W?i.sections.findIndex(U=>U.id===W):-1,f.seatProgram.uniforms.uFocusSection.value=K,f.chairProgram.uniforms.uFocusSection.value=K)},ee=U=>{if(W=U,oe(),$.setForcedDense(!!U),!U){let ue=Y(),ke=new Set(ue.map(we=>we.id));$.setLabels([...Q().filter(we=>!ke.has(we.id)),...ue]);return}let X=t.seats.filter(ue=>u.get(ue.id)===U),Z=new Set(X.map(ue=>ue.id)),se=new Set(X.map(ue=>ue.rowId)),de=new Set(P.keys()),ve=new Set(X.filter(ue=>de.has(ue.id)).map(ue=>ue.id)),xe=Q().filter(ue=>ue.kind!=="row"&&ue.kind!=="seat"||(ue.kind==="row"?se.has(ue.id.slice(4)):Z.has(ue.id.slice(5))));if(i.seatCount<=6e3&&ve.size===0){$.setLabels(xe);return}let Ee=X,Rt=new Set(Ee.map(ue=>`seat:${ue.id}`)),At=Ee.flatMap(ue=>{let ke=i.seats.idToIndex.get(ue.id);if(ke===void 0)return[];let we=ke*3;return[{id:`seat:${ue.id}`,kind:"seat",seatWidthM:i.seats.iChairWidth[ke]*2,rowId:ue.rowId,text:de.has(ue.id)?ue.displayLabel||ue.label:jr(ue.displayLabel||ue.label),anchor:[i.seats.iPosition[we],i.seats.iPosition[we+1]+(de.has(ue.id)?1.05:.55),i.seats.iPosition[we+2]],...de.has(ue.id)?{pinBase:Xe(we)}:{}}]});$.setLabels([...xe.filter(ue=>!Rt.has(ue.id)),...At])};A();let le=null,J=null,ce=new Fu.Mat4,Oe=U=>{if(y||!f||g)return!1;let X=iu({flying:V.active,panoramaMounted:I!==null,seatViewActive:le?.active===!0}),Z=X==="orbit"?K:-1;f.seatProgram.uniforms.uFocusSection.value=Z,f.chairProgram.uniforms.uFocusSection.value=Z;let se=X==="cinematic"?V.update(performance.now()):X==="seatView"?le.update(performance.now()):X==="orbit"?F.update():!1;J?.syncZoomLimits();let de=C()>=0?i.floors[C()]:null,ve=de?.radius??i.bounds.radius,xe=ea(F.currentDistance,ve),Ee=_?{center:[F.camera.position.x,F.camera.position.y,F.camera.position.z],radius:520}:i.clipBounds??i.renderBounds;F.updateClipping(Ee);let Rt=de?.center??i.renderBounds.center,At=de?.radius??i.renderBounds.radius,ue=(Pe,Ko)=>Math.hypot(F.camera.position.x-Pe[0],F.camera.position.y-Pe[1],F.camera.position.z-Pe[2])<=Ko*(L.detailVisible?1.8:1.55),ke=ue(Rt,At);if(!ke&&W){let Pe=i.sections.find(Ko=>Ko.id===W);Pe&&(ke=ue(Pe.center,Math.max(12,Pe.radius*2)))}L.detailVisible=ke;let we=f.seatProgram.uniforms;we.uSeatScale.value=xe.scale,we.uSeatFade.value=xe.fade;let Vn=!!de&&ta(de.seatCount,k.canvas.clientWidth||1,k.canvas.clientHeight||1),Gn=na(i.seats.count,ve,F.currentDistance,F.camera.fov,k.canvas.clientHeight||1),rn=L.detailVisible||Vn||Gn?1:0,an=L.detailVisible||C()>=0||i.floors.length>1?1:0;L.ease(U,rn,an),we.uSeatDetail.value=L.seatDetailMix;let Hn=rn===0&&L.seatDetailMix<.01;f.seatGeometry.setDrawRange(Hn?Zo:0,Hn?Li:Zo),f.solidProgram.uniforms.uStructureDetail.value=L.structureDetailMix,we.uMinPixels.value=xe.minPixels,we.uPixelToWorld.value=2*Math.tan(F.camera.fov*x0/2)/Math.max(1,k.pixelHeight),L.update(L.detailVisible),i.outdoor&&(ce.copy(F.camera.projectionViewMatrix).inverse(),f.backgroundProgram.uniforms.uInvViewProj.value.set(ce)),k.renderer.render({scene:f.background,clear:!0}),k.renderer.render({scene:f.main,camera:F.camera,clear:!1});let sn=p?p.update(performance.now(),[F.camera.position.x,F.camera.position.y,F.camera.position.z],I!==null,X==="seatView"):!1;if(p&&k.renderer.render({scene:p.root,camera:F.camera,clear:!1}),q){let Pe=F.camera.worldMatrix;q.update(X==="seatView"?[F.camera.position.x,F.camera.position.y,F.camera.position.z]:null,[-Pe[8],-Pe[9],-Pe[10]])}$.update(F.camera.projectionViewMatrix,k.canvas.clientWidth||1,k.canvas.clientHeight||1,F.currentDistance,ve,[F.camera.position.x,F.camera.position.y,F.camera.position.z]);let Ot=se||sn||L.seatDetailMix!==rn||L.structureDetailMix!==an;return te(!Ot),Ot},te=Ki(e),me=new Xn(Oe),Se=typeof ResizeObserver<"u"?new ResizeObserver(()=>Yo.resize()):null;Se?.observe(e),F.setZoomPointResolver((U,X)=>{let Z=k.canvas.getBoundingClientRect(),se=k.canvas.clientWidth||Z.width,de=k.canvas.clientHeight||Z.height;if(!(se>0)||!(de>0))return null;F.camera.updateMatrixWorld();let ve=mi(i.seats.iPosition,i.seats.count,F.camera.projectionViewMatrix,se,de,U-Z.left,X-Z.top,y0);if(ve<0)return null;let xe=ve*3;return[i.seats.iPosition[xe],i.seats.iPosition[xe+1]+.5,i.seats.iPosition[xe+2]]});function Xe(U){return[i.seats.iPosition[U],i.seats.iPosition[U+1]+.5,i.seats.iPosition[U+2]]}$.setSeatNumberRow(null);let De=null,Ae=0,We=()=>{Ae=0;let U=null;if(De&&!le?.active&&!V.active){let X=k.canvas.getBoundingClientRect(),Z=k.canvas.clientWidth||X.width,se=k.canvas.clientHeight||X.height;if(Z>0&&se>0){let de=mi(i.seats.iPosition,i.seats.count,F.camera.projectionViewMatrix,Z,se,De.x-X.left,De.y-X.top,g0);U=de>=0?t.seats[de]?.rowId??null:null}}$.setSeatNumberRow(U)&&me.requestRender()},Ze=U=>{De={x:U.clientX,y:U.clientY},Ae||(Ae=requestAnimationFrame(We))},Pt=U=>{U.pointerType==="mouse"&&(De=null,Ae||(Ae=requestAnimationFrame(We)))};k.canvas.addEventListener("pointermove",Ze),k.canvas.addEventListener("pointerdown",Ze),k.canvas.addEventListener("pointerleave",Pt);function fi(U){if(!p)return;let X=[];for(let Z of P.keys()){let se=i.seats.idToIndex.get(Z);if(se===void 0)continue;let de=se*3;X.push({id:Z,position:Xe(de)})}p.setSeats(X,performance.now(),U)}let di=U=>{let X=de=>{let ve=i.seats.idToIndex.get(de);return ve===void 0?void 0:i.seats.iState[ve]},{updates:Z,next:se}=Tl(P,U,X);if(P=se,$.setSelectedSeatIds(P.keys()),fi(!tn()),me.requestRender(),ee(W),Z.length){let de=lr(i.seats,Z);f&&f.uploadSeatStateRuns(de),h(),me.requestRender()}},tn=()=>w!==null?w:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ou=8,hi=U=>{if(!n.getSeatView)return null;let X=v.get(U);if(!X)for(X=Promise.resolve(n.getSeatView(U)),v.set(U,X),X.catch(()=>{v.get(U)===X&&v.delete(U)});v.size>Ou;){let Z=v.keys().next().value;if(Z===void 0)break;v.delete(Z)}return X},pi=$l(i.stages,i.focalWorld,i.bounds.groundY??0),Du=ri(pi),Ho=(U,X)=>{let Z=c.get(U),se=Math.max(0,Math.round(i.seats.iFloor[X]??0)),de=t.doc.floors?.[se],ve=i.floors[se],xe=de?.focalPoint??t.doc.focalPoint,Ee=ve?{x:ve.focalWorld[0]/E,y:ve.focalWorld[2]/E}:xe,Rt=Z?.focalPoint?{x:Z.focalPoint.x+Ee.x-xe.x,y:Z.focalPoint.y+Ee.y-xe.y}:Ee,At=[i.seats.iPosition[X*3],i.seats.iPosition[X*3+1],i.seats.iPosition[X*3+2]];return Gl(At,Rt,de?.baseHeightM??0,Z?.eyeHeightM,Du)},bi=()=>(e.clientWidth||k.canvas.clientWidth)<=520,zo=null,yi=null,Bu=async(U,X,Z)=>{if(!n.getSeatView||M||Z!==Te.flightGen())return;let se;try{se=await gu()}catch{if(a.panoramaFailed(U,"mount"),!M&&Z===Te.flightGen()){let de=jo(U,Z,!0);requestAnimationFrame(()=>de?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||Z!==Te.flightGen()||!zo))return yi??=se.createOpenPanorama(zo),yi(U,X,Z)},Uo=Mu({container:e,model:i,opts:n,expandedSeatById:c,seatIdsByRow:l,isNarrow:bi,isDisposed:()=>M,flightGen:()=>Te.flightGen(),flyToSeat:U=>Mi(U),openPanorama:(U,X,Z)=>Bu(U,X,Z)}),jo=Uo.show,Xo=Uo.remove,Nu=Uo.layout,It=Su({container:e,orbit:F,isNarrow:bi,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});J=It;let Vu=It.element,nn=It.setNavigationMode,Gu=It.layout,Hu=It.utilityControls,on=null,gi=!1,Nn=U=>{It.setSeatViewLocked(U),U||le?.exit()};le=ru({canvas:k.canvas,camera:F.camera,requestRender:()=>me.requestRender(),reducedMotion:tn,onStopChange:U=>{let X=U??(gi?"seat":null);on=X;try{n.onSeatViewStopChange?.(X)}catch{}},onApplied:()=>{M||F.syncFromCamera()}});let xi=i.sections.reduce((U,X)=>X.seatCount>0&&X.box?Math.max(U,X.box.max[1]):U,-1/0),zu=(U,X)=>{let{eye:Z}=Ho(U,X),se=(e.clientWidth||k.canvas.clientWidth||1)/Math.max(1,e.clientHeight||k.canvas.clientHeight||1),de=Ql(Z,pi,se,{preserveEye:!0});if(n.seatViewStops===!1)return{...de,stops:[]};let ve=u.get(U),xe=ve?i.sections.find(Ee=>Ee.id===ve):void 0;return{...de,stops:Jl(de,{aspect:se,seatingTopY:Number.isFinite(xi)?xi:i.bounds.box.max[1],section:xe&&xe.seatCount>0?{center:xe.center,radius:xe.radius}:null,venue:{center:i.bounds.center,radius:i.bounds.radius}})}},Te=Eu({container:e,model:i,opts:n,orbit:F,cinematic:V,analytics:a,loop:me,labelOverlay:$,stageAzimuth:B,overviewFraming:G,gpu:()=>f,isDisposed:()=>M,panorama:()=>I,setPanorama:U=>{I=U},setPanoramaSphereVisible:U=>{_=U},panoramaLoadAbort:()=>S,setPanoramaLoadAbort:U=>{S=U},setFrozen:U=>{g=U},restorePanoramaLayer:T,reducedMotion:tn,resolvedSeatViewPose:Ho,showSectionSeatLabels:ee,setNearFieldDetailEnabled:N,setSeatViewLocked:Nn,setNavigationMode:nn,showArriveChip:jo,removeArriveChip:Xo,inSeatView:()=>on!==null,setSeatStepping:U=>{gi=U},seatViewArrival:(U,X)=>n.arriveAtSeatEye?zu(U,X):null,enterSeatView:(U,X)=>le?.enter(U,X)});O=!0;let Wo=Te.overviewChip,Uu=Te.layoutOverviewChip,ju=Te.applyFloorFocus,Xu=Te.focusOverview,vi=Te.cancelFlight,Mi=Te.flyToSeat,Si=Te.focusSectionCamera;Hu.appendChild(Wo),zo={container:e,model:i,opts:n,analytics:a,orbit:F,loop:me,seatsById:c,ensureSeatView:hi,resolvedSeatViewPose:Ho,gpu:()=>f,gl:k.gl,isContextLost:()=>y,isDisposed:()=>M,flightGen:()=>Te.flightGen(),setPanorama:U=>{I=U},getLoadAbort:()=>S,setLoadAbort:U=>{S=U},setPanoramaSphereVisible:U=>{_=U,U&&le?.exit()},setFrozen:U=>{g=U},raisePanoramaLayer:R,restorePanoramaLayer:T,getOverviewChip:()=>Wo,labelOverlay:$,reducedMotion:tn,removeArriveChip:Xo,showArriveChip:jo};let mt=wu({glctx:k,orbit:F,model:i,seats:t.seats,opts:n,cinematic:V,analytics:a,seatIdByIndex:s,sectionIdBySeatId:u,tapSlop:v0,tapMs:M0,gpu:()=>f,pick:()=>b,seatViewLocked:()=>It.seatViewLocked(),focusedSectionId:()=>W,selection:()=>P,cancelFlight:vi,focusSectionCamera:Si,focusSeatCamera:Te.focusSeatCamera,setSelection:di,ensureSeatView:hi});k.canvas.addEventListener("pointerdown",mt.onDown),k.canvas.addEventListener("pointermove",mt.onMove),k.canvas.addEventListener("pointerup",mt.onUp),k.canvas.addEventListener("pointercancel",mt.onUp),me.requestRender();let Yo={setAvailability(U){let X=_l(P,U),Z=lr(i.seats,X);Z.length&&f&&f.uploadSeatStateRuns(Z),h(),me.requestRender()},setSelection:di,setNavigationMode:nn,zoomIn(){F.zoomBy(Nt),me.requestRender()},zoomOut(){F.zoomBy(dn),me.requestRender()},flyToSeat:Mi,focusOverview:Xu,seatViewStop:()=>on,recentreSeatView:()=>le?.recentre()??!1,resize(){let{width:U,height:X}=k.resize();F.setAspect(U/Math.max(1,X)),Nu(),Gu(),Uu(),me.requestRender()},stats(){return{...me.stats(),drawCalls:f?f.drawCalls:0,fallbackTriangles:f?f.seatGeometry.drawRange.count/3*i.seats.count:0,seatCount:i.seatCount}},captureImage(U=1280){if(y||!f||typeof document>"u")return null;Oe(0);let X=k.canvas,Z=Math.min(1,U/Math.max(X.width,X.height,1)),se=document.createElement("canvas");se.width=Math.max(1,Math.round(X.width*Z)),se.height=Math.max(1,Math.round(X.height*Z));let de=se.getContext("2d");return de?(de.drawImage(X,0,0,se.width,se.height),se.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let U=me.stats(),X=k.canvas.clientWidth||1,Z=k.canvas.clientHeight||1,se=i.bounds.center,de=tt(F.camera.projectionViewMatrix,[se[0],i.bounds.box.min[1],se[2]],X,Z),ve=tt(F.camera.projectionViewMatrix,[se[0],i.bounds.box.max[1],se[2]],X,Z),xe=i.bounds.box,Ee=[xe.min[0],xe.max[0]].flatMap(ue=>[xe.min[1],xe.max[1]].flatMap(ke=>[xe.min[2],xe.max[2]].map(we=>tt(F.camera.projectionViewMatrix,[ue,ke,we],X,Z)))).filter(ue=>Number.isFinite(ue.x)&&Number.isFinite(ue.y)&&Number.isFinite(ue.depth)),Rt=Ee.length?(()=>{let ue=Math.min(...Ee.map(Pe=>Pe.x)),ke=Math.max(...Ee.map(Pe=>Pe.x)),we=Math.min(...Ee.map(Pe=>Pe.y)),Vn=Math.max(...Ee.map(Pe=>Pe.y)),Gn=Math.max(0,ue),rn=Math.min(X,ke),an=Math.max(0,we),Hn=Math.min(Z,Vn),sn=Math.max(0,rn-Gn),Ot=Math.max(0,Hn-an);return{box:{x:Gn,y:an,width:sn,height:Ot},horizontalFillRatio:sn/X,verticalFillRatio:Ot/Z,visibleAreaRatio:sn*Ot/(X*Z),clippedEdges:[...we<0?["top"]:[],...ke>X?["right"]:[],...Vn>Z?["bottom"]:[],...ue<0?["left"]:[]]}})():void 0,At=String(k.gl.getParameter(k.gl.VERSION)??"");return{viewport:{width:X,height:Z},context:{webgl2:/webgl\s*2/i.test(At),lost:y},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[F.camera.position.x,F.camera.position.y,F.camera.position.z],distance:F.currentDistance,verticalFovDeg:F.fovY},scene:{seatCount:i.seatCount,floorCount:i.floors.length,zoneCount:i.zones.length,sectionCount:i.sections.length,authoredRelief:d,renderedVerticalSpanM:Math.max(0,i.bounds.box.max[1]-i.bounds.box.min[1]),projectedReliefPx:de.visible&&ve.visible?Math.abs(de.y-ve.y):0},labels:$.qualityEvidence(),framing:Rt,...on?{seatView:{fovDeg:F.camera.fov,stop:on}}:{}}},getQualityReport(){return Po(Yo.getQualityEvidence())},loseContextForTest(){k.simulateContextLossCycle()},floors(){return i.floors},focusFloor(U){if(U!==null&&!i.floors.some(Z=>Z.index===U))return!1;let X=U??-1;if(N(U!==null),Nn(!1),ju(X),nn("orbit"),U===null)V.cancel(),tn()?F.frame(i.bounds,!1,B,n.portraitOverviewCrop===!0,G):F.frameSoft(i.bounds,B,n.portraitOverviewCrop===!0,G);else{let Z=i.floors[U];if(Z.seatCount>0){V.cancel();let se=Z.focalWorld[0]-Z.center[0],de=Z.focalWorld[2]-Z.center[2],ve=Math.hypot(se,de)>Z.radius*.12?Math.atan2(se,de):B;F.frame({center:Z.center,radius:Z.radius,box:Z.box},!1,ve,!1,{polarDeg:58,margin:1.12})}}return me.requestRender(),!0},zones(){return i.zones},focusZone(U){let X=i.zones.find(ve=>ve.id===U);if(!X||X.seatCount===0)return!1;N(!1),Nn(!1),V.cancel(),nn("orbit"),ee(null),n.onSectionFocusChange?.(null);let Z=X.focalWorld[0]-X.center[0],se=X.focalWorld[2]-X.center[2],de=Math.hypot(Z,se)>X.radius*.12?Math.atan2(Z,se):void 0;return F.frame({center:X.center,radius:X.radius*1.25},!1,de),me.requestRender(),!0},sections(){return i.sections},focusSection(U){return Si(U)},rows(U){return U?i.rows.filter(X=>X.sectionId===U):i.rows},seatsInRow(U){return t.seats.filter(X=>X.rowId===U).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(U){let X=i.rows.find(Z=>Z.id===U);return!X||X.seatCount===0?!1:(N(!0),Nn(!1),V.cancel(),nn("pan"),X.sectionId&&(ee(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),F.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),me.requestRender(),!0)},setReducedMotionForTest(U){w=U},dispose(){M=!0,q?.dispose(),te(!1),Xo(),Wo.remove(),Vu.remove(),vi(),le?.dispose(),me.stop(),$.dispose(),Se?.disconnect(),I&&(I.dispose(),I=null),T(),z(),k.canvas.removeEventListener("pointerdown",mt.onDown),k.canvas.removeEventListener("pointermove",mt.onMove),k.canvas.removeEventListener("pointerup",mt.onUp),k.canvas.removeEventListener("pointercancel",mt.onUp),k.canvas.removeEventListener("pointermove",Ze),k.canvas.removeEventListener("pointerdown",Ze),k.canvas.removeEventListener("pointerleave",Pt),Ae&&cancelAnimationFrame(Ae),F.dispose(),b&&b.dispose(),f&&f.dispose(),f=null,p?.dispose(),p=null,b=null,k.dispose()}};return a.opened(i.seatCount,d,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),Yo}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
976
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:$},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let te=new Ce.Mesh(e,{geometry:U,program:q});te.frustumCulled=!1,te.setParent(n),X.screenProgram=q,D=!0,X.drawCalls=3+(B?1:0)+1},Y.src=K.contentImageUrl}return X}var ct=require("ogl");function _0(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function ou(e,t,n,o,i,r){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let m=0;m<t;m++){let l=(c*t+m)*4,u=_0(e[l],e[l+1],e[l+2]);if(u<0||u>=r)continue;let h=m-o,f=c-i,d=h*h+f*f;d<s&&(s=d,a=u)}return a}function ru(e,t,n,o,i,r){let a=e-n.left,s=t-n.top,c=Math.round(a*o),m=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(i-1,c)),y:Math.max(0,Math.min(r-1,m))}}var T0=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],No=class{constructor(t,n,o,i,r){this.seatScene=new ct.Transform;this.chairScene=new ct.Transform;this.solidScene=new ct.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=r,this.seatProg=jl(this.gl),this.chairProg=Wl(this.gl),this.depthProg=Xl(this.gl);let a=new ct.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ct.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ct.Mesh(this.gl,{geometry:i,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRoomCentre(t){this.depthProg.uniforms.uRoomCentre.value.set(t??[0,0])}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let i of T0)this.seatProg.uniforms[i].value=t.uniforms[i].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;let o=t.uniforms.uSeeThrough?.value;if(o)for(let i of[this.seatProg,this.chairProg,this.depthProg])i.uniforms.uSeeThrough.value=o}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 ct.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,o,i){let r=this.gl,a=this.ensureTarget(),s=r.drawingBufferWidth,c=r.drawingBufferHeight,m=Math.max(0,n-i),l=Math.max(0,o-i),u=Math.max(1,Math.min(s,n+i+1)-m),h=Math.max(1,Math.min(c,o+i+1)-l);r.enable(r.SCISSOR_TEST),r.scissor(m,l,u,h);let[f,d,p]=this.restoreClear;r.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}),r.clearColor(f,d,p,1),r.disable(r.SCISSOR_TEST);let b=new Uint8Array(u*h*4);return this.renderer.bindFramebuffer(a),r.readPixels(m,l,u,h,r.RGBA,r.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),ou(b,u,h,n-m,o-l,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function iu(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,Mn(o.state)):n.push(o);return n}function au(e,t,n){let o=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&o.add(a);let i=new Map(e),r=[];for(let[a,s]of e)o.has(a)||(r.push({seatId:a,state:_e[s]??"available"}),i.delete(a));for(let a of o){if(i.has(a))continue;let s=n(a);s!==void 0&&(i.set(a,s),r.push({seatId:a,state:"selected"}))}return{updates:r,next:i}}var It=require("ogl");function k0(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function su(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function L0(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function cu(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 xi(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function vi(e,t){return Math.max(0,Math.min(1,e+t))}function lu(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let o=Math.max(0,Math.min(1,t)),i=n-1,r=Math.floor(o*i);r>=i&&(r=i-1);let a=o*i-r,s=e[Math.max(0,r-1)],c=e[r],m=e[r+1],l=e[Math.min(n-1,r+2)],u=a*a,h=u*a,f=[0,0,0];for(let d=0;d<3;d++)f[d]=.5*(2*c[d]+(-s[d]+m[d])*a+(2*s[d]-5*c[d]+4*m[d]-l[d])*u+(-s[d]+3*c[d]-3*m[d]+l[d])*h);return f}function Mi(e,t,n,o,i){let r=cu(k0(t,n));r[0]===0&&r[1]===0&&r[2]===0&&(r=[0,0,1]);let a=su(su(t,L0(r,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=cu(s);c[0]===0&&c[2]===0&&(c=[r[0],0,r[2]]);let m=Math.max(1,i),l=[o[0]+c[0]*m*1.3,o[1]+m*.75,o[2]+c[2]*m*1.3];return{waypoints:[e,l,a],finalPos:a}}function Si(e,t,n=35,o=28){let i=xi(t),r=lu(e,i),a=xi(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:r,fov:n+(o-n)*a,eased:i}}function du(e,t,n){let o=e.position.clone(),i=new It.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new It.Vec3(n[0],n[1],n[2]));let r=new It.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(i),r}var Bo=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new It.Quat;this.endQuat=new It.Quat;this.outQuat=new It.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,o,i=2500,r=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=i,this.endFov=r,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:o,fov:i,eased:r}=Si(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,vi(r,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=i,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 hu=ur,F0=.12,O0=1.6,pu=.12;function bu(e,t,n){let o=e[t*3],i=e[t*3+1],r=e[t*3+2],a=n[0]-o,s=n[2]-r,c=Math.hypot(a,s);if(!(c>.001))return null;let m=a/c,l=s/c,u=1/0,h=null;for(let f=0;f*3<e.length;f++){if(f===t)continue;let d=e[f*3]-o,p=e[f*3+2]-r,b=d*m+p*l;b<.3||b>1.6||Math.abs(d*l-p*m)>.6||b<u&&(u=b,h=i-e[f*3+1])}return h}var D0=.25,N0=1.5;function yu(e,t,n=0,o,i,r=!1){let a=[t.x*_,n+N0,t.y*_],s=i?[i[0],i[1],i[2]]:a,c=e[1],m=Number.isFinite(c)?c+(r?O0:hu):Number.isFinite(o)?n+o:n+hu,l=a[0]-e[0],u=a[2]-e[2],h=Math.hypot(l,u),f=h>.001?Math.min(F0,h*D0):0,d=h>.001?l/h:0,p=h>.001?u/h:0;return{eye:[e[0]+d*f,m,e[2]+p*f],focal:s}}var At=Math.PI/180,B0=45,wi=80,Vo=70,V0=1,H0=.99;function G0(e,t){if(!(e<V0))return wi;if(!(Number.isFinite(t)&&t>0))return Vo;let n=2*Math.atan(t/(2*Ho*H0)/Math.max(.05,e))/At;return Math.max(Vo,Math.min(wi,n))}var z0=.25,Ho=1,U0=.25,j0=12*At,W0=.2,X0=1.5,gu=.8,xu=6,Iu=1.9,Y0=2/3,K0=.12,$0=.9,q0=1.2,Z0=2,Au=.05,Q0=6;function Ru(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+gu,t[1]),t[2]+6]};let o=1/0,i=-1/0,r=1/0,a=-1/0,s=n;for(let d of e)o=Math.min(o,d.cx-d.halfX),i=Math.max(i,d.cx+d.halfX),r=Math.min(r,d.cz-d.halfZ),a=Math.max(a,d.cz+d.halfZ),s=Math.max(s,d.y);let c=i-o,m=a-r,l=Math.max(c,Math.min(m,xu))/2,u=Math.max(m,Math.min(c,xu))/2,h=(o+i)/2,f=(r+a)/2;return{min:[h-l,n,f-u],max:[h+l,Math.max(n+gu,s),f+u]}}function J0(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Iu,e.max[2]]}}function Pi(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+X0,t+W0,t+Iu*Y0),(e.min[2]+e.max[2])/2]}function Eu(e,t){let n=e[0]-t[0],o=e[2]-t[2],i=Math.hypot(n,o);return i<.001?{x:0,z:1}:{x:n/i,z:o/i}}function vu(e,t,n){let o=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2],a=Math.hypot(o,i,r)||1;o/=a,i/=a,r/=a;let s=-r,c=o,m=Math.hypot(s,c);if(m<1e-6)return 1/0;s/=m,c/=m;let l=1/0,u=-1/0;for(let h=0;h<8;h++){let f=(h&1?n.max[0]:n.min[0])-e[0],d=(h&2?n.max[1]:n.min[1])-e[1],p=(h&4?n.max[2]:n.min[2])-e[2],b=Math.max(Au,f*o+d*i+p*r),g=(f*s+p*c)/b;g<l&&(l=g),g>u&&(u=g)}return u-l}function Mu(e,t,n){let o=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2],a=Math.hypot(o,i,r)||1;o/=a,i/=a,r/=a;let s=-r,c=o,m=Math.hypot(s,c);if(m<1e-6)return 1/0;s/=m,c/=m;let l=-c*i,u=c*o-s*r,h=s*i,f=1/0,d=-1/0;for(let p=0;p<8;p++){let b=(p&1?n.max[0]:n.min[0])-e[0],g=(p&2?n.max[1]:n.min[1])-e[1],x=(p&4?n.max[2]:n.min[2])-e[2],S=Math.max(Au,b*o+g*i+x*r),I=(b*l+g*u+x*h)/S;I<f&&(f=I),I>d&&(d=I)}return d-f}function Go(e,t){return Math.tan(e*At/2)*Math.max(.05,t)}function Su(e,t,n){let o=G0(n,e),i=c=>Math.max(B0,Math.min(o,c)),r=c=>2*Math.atan(c)/At,a=Number.isFinite(e)&&e>0?i(r(e/(2*z0)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,i(r(t/(2*K0))));return e/(2*Go(s,n))>Ho?a:s}function Cu(e,t,n,o={}){let i=Pi(t),r=[e[0],e[1],e[2]],a=0,s=0,c=d=>{if(!(d>0))return;let p=Eu(r,i);r[0]+=p.x*d,r[2]+=p.z*d,s+=d},m=o.preserveEye?0:t.max[1]+U0-r[1];m>0&&(r[1]+=m,a=m,c(m/Math.tan(j0)));let l=J0(t),u=vu(r,i,t),h=Su(u,Mu(r,i,l),n),f=u/(2*Go(h,n));for(let d=0;!o.preserveEye&&d<Q0&&f>Ho;d++){let p=Math.max(1,Math.hypot(r[0]-i[0],r[2]-i[2])),b=Number.isFinite(f)?f/Ho:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),u=vu(r,i,t),h=Su(u,Mu(r,i,l),n),f=u/(2*Go(h,n))}return{eye:r,focal:i,fov:h,raisedM:a,pulledBackM:s,stageFrameWidth:f}}function eg(e,t,n){let o=Math.tan(t*At/2),i=Go(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,i)))}var tg=.7,wu=.5,ng=.8;function Pu(e,t,n){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],r=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(i[0],i[1],i[2])||1;return Math.acos(Math.max(-1,Math.min(1,r/a)))/At}function og(e,t,n){let o=m=>{let l=Math.hypot(m[0],m[1],m[2])||1;return[m[0]/l,m[1]/l,m[2]/l]},i=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],r=Math.hypot(i[0],i[1],i[2]),a=o(i),s=o([n[0]-e[0],n[1]-e[1],n[2]-e[2]]),c=o([0,1,2].map(m=>a[m]*(1-wu)+s[m]*wu));return[e[0]+c[0]*r,e[1]+c[1]*r,e[2]+c[2]*r]}function _u(e,t){let{aspect:n,venue:o}=t,i=e.focal,r=Eu(e.eye,i),a=p=>(p[0]-i[0])*r.x+(p[2]-i[2])*r.z,s=[{name:"seat",eye:e.eye,focal:i,fov:e.fov}],c=Z0*(t.rowDepthM??$0),m=[e.eye[0]+r.x*c,e.eye[1]+q0,e.eye[2]+r.z*c],l=[e.eye[0],e.eye[1]-tg,e.eye[2]],u=og(m,i,l);s.push({name:"row",eye:m,focal:u,fov:Math.min(wi,Math.max(e.fov,2*Math.max(Pu(m,u,l),Pu(m,u,i))/ng))});let h=(p,b,g,x)=>{let S=eg(g,e.fov,n)*1.08,I=S*Math.sin(x*At),M=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,y=Math.max(I,M-b[1]),P=S*Math.cos(x*At);return{name:p,eye:[b[0]+r.x*P,b[1]+y,b[2]+r.z*P],focal:b,fov:e.fov}};t.section&&t.section.radius>0&&s.push(h("section",t.section.center,t.section.radius,35)),s.push(h("venue",o.center,Math.max(1,o.radius),40));let f=[],d=-1/0;for(let p of s){let b=a(p.eye);f.length&&b<=d+.5||(f.push(p),d=b)}return f}var Fu=require("ogl"),Xn=Math.PI/180,Ii=320,Tu=70*Xn,rg=32*Xn,ig=24*Xn,ku=.0026,ag=.22,sg=.006,cg=180,lg=900,ug=1100,mg=4,De=(e,t,n)=>Math.max(t,Math.min(n,e)),Lu=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Ou(e){let{canvas:t,camera:n}=e,o=[],i=!1,r=0,a=0,s=0,c=0,m=0,l=0,u=Ii,h=null,f=()=>{h&&(clearTimeout(h),h=null)},d=!1,p=[0,0],b=0,g=!1,x=null,S=null,I=new Map,M=!1,y=0,P=0,v=0,w=0,R=()=>i&&o.length?o[De(Math.round(r),0,o.length-1)].name:null,C=()=>{let k=R();k!==x&&(x=k,e.onStopChange?.(k))},O=()=>{if(!i||!o.length)return;let k=o[De(Math.floor(r),0,o.length-1)],B=o[De(Math.ceil(r),0,o.length-1)],D=De(r-Math.floor(r),0,1),H=(J,oe)=>J+(oe-J)*D,U=[H(k.eye[0],B.eye[0]),H(k.eye[1],B.eye[1]),H(k.eye[2],B.eye[2])],q=[H(k.focal[0],B.focal[0]),H(k.focal[1],B.focal[1]),H(k.focal[2],B.focal[2])],$=q[0]-U[0],ee=q[1]-U[1],Q=q[2]-U[2],X=Math.hypot($,ee,Q)||1,K=Math.atan2($,Q),Y=Math.asin(De(ee/X,-1,1)),ie=K+a,te=De(Y+s,-80*Xn,80*Xn),ae=Math.cos(te)*X;$=Math.sin(ie)*ae,ee=Math.sin(te)*X,Q=Math.cos(ie)*ae,n.position.set(U[0],U[1],U[2]),n.fov=H(k.fov,B.fov),n.updateProjectionMatrix(),n.lookAt(new Fu.Vec3(U[0]+$,U[1]+ee,U[2]+Q)),e.onApplied?.()},E=()=>{if(!i||!o.length)return;let k=De(Math.round(r),0,o.length-1);if(e.reducedMotion()){d=!1,r=k,O(),C(),e.requestRender();return}if(Math.abs(k-r)<.001){d=!1,C();return}c=r,m=k,l=performance.now(),u=Ii,d=!0,e.requestRender()},A=k=>{!i||o.length<2||(f(),d=!1,r=De(r+k,0,o.length-1),O(),C(),e.requestRender())},T=(k,B)=>{i&&(f(),d=!1,g=!1,a=De(a-k*ku,-Tu,Tu),s=De(s-B*ku,-ig,rg),O(),e.requestRender())},L=k=>{i&&(I.set(k.pointerId,{x:k.clientX,y:k.clientY}),I.size===1?(M=!0,w=0,y=k.clientX,P=k.clientY):I.size===2&&(M=!1,v=V()))},V=()=>{let k=[...I.values()];return k.length<2?0:Math.hypot(k[0].x-k[1].x,k[0].y-k[1].y)},F=k=>{if(!i||!I.has(k.pointerId))return;if(I.set(k.pointerId,{x:k.clientX,y:k.clientY}),I.size>=2){let H=V();v>0&&A((v-H)*sg),v=H;return}if(!M)return;let B=k.clientX-y,D=k.clientY-P;y=k.clientX,P=k.clientY,w+=Math.abs(B)+Math.abs(D),!(w<=mg)&&T(B,D)},G=k=>{I.delete(k.pointerId)&&(I.size<2&&(v=0),I.size===0&&(M=!1,E()))},j=k=>{if(!i)return;k.preventDefault();let B=k.deltaMode===1?16:k.deltaMode===2?100:1,D=De(k.deltaY*B/100,-2,2);A(D*ag),S&&clearTimeout(S),S=setTimeout(()=>{S=null,E()},cg)},N=()=>{f(),i&&(i=!1,d=!1,g=!1,o=[],I.clear(),M=!1,S&&(clearTimeout(S),S=null),x!==null&&(x=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",L),t.addEventListener("pointermove",F),t.addEventListener("pointerup",G),t.addEventListener("pointercancel",G),t.addEventListener("wheel",j,{passive:!1}),{get active(){return i},enter(k,B=0){if(k.length<2){N();return}f(),o=k,i=!0,r=e.reducedMotion()?0:De(B,0,k.length-1),r>0&&(h=setTimeout(()=>{h=null,i&&(c=r,m=0,l=performance.now(),u=ug,d=!0,e.requestRender())},lg)),a=0,s=0,d=!1,g=!1,x=null,O(),C(),e.requestRender()},exit:N,recentre(){return i?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(g=!1,a=0,s=0,O(),e.requestRender(),!0):(p=[a,s],b=performance.now(),g=!0,e.requestRender(),!0):!1},update(k){if(!i)return!1;let B=!1;if(g){let D=De((k-b)/Ii,0,1),H=1-Lu(D);a=p[0]*H,s=p[1]*H,D>=1?(g=!1,a=0,s=0):B=!0}if(d){let D=De((k-l)/u,0,1);r=c+(m-c)*Lu(D),D>=1?(d=!1,r=m,C()):B=!0}return O(),B},currentStop:R,dispose(){N(),t.removeEventListener("pointerdown",L),t.removeEventListener("pointermove",F),t.removeEventListener("pointerup",G),t.removeEventListener("pointercancel",G),t.removeEventListener("wheel",j)}}}function Du(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Ci=null;function $u(){return Ci??=Promise.resolve().then(()=>(Ku(),Yu)).catch(e=>{throw Ci=null,e}),Ci}var qu=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Ko=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,o,i){this.emit("3d_opened",{seats:t,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...i===void 0?{}:{prepSource:i}})}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=qu(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(qu()-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 Zu(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Qu(e){let{container:t,model:n,opts:o,expandedSeatById:i,seatIdsByRow:r,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let u=a();Object.assign(s.style,u?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},m=()=>{s?.remove(),s=null};return{show:(u,h,f=!1)=>{if(m(),e.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.chrome?.caption!==!1,b=o.chrome?.seatStepper!==!1;if(!p&&!b)return null;let g=i.get(u),x=g?.sectionId?n.sections.find(R=>R.id===g.sectionId):void 0,S=g?.label??u;d.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${S}`);let I=document.createElement("span");I.textContent=o.seatViewCaption?.(u)??["Live 3D seat view",x?.label,S].filter(Boolean).join(" \xB7 "),Object.assign(I.style,{maxWidth:"min(70vw, 560px)",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&&d.appendChild(I);let M=document.createElement("div");Object.assign(M.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(M);let y=g?.rowId?r.get(g.rowId):void 0,P=y?.indexOf(u)??-1,v=P>=0?[y?.[P-1],y?.[P+1]]:[void 0,void 0],w=(R,C,O,E=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=R,A.setAttribute("aria-label",C),Object.assign(A.style,{minHeight:"44px",padding:E?"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"}),E||(A.style.minWidth="44px"),E&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",O),M.appendChild(A)};if(b&&v[0]){let R=i.get(v[0])?.label??v[0];w("\u2039",`View previous seat ${R}`,()=>{e.flyToSeat(v[0])})}if(b&&o.getSeatView){let R=o.seatViewActionLabel?.(u)??"Open 360\xB0 panorama";w(f?`\u21BB Retry ${R}`:`\u25C9 ${R}`,`${f?"Retry":R} from seat ${S}`,()=>{if(e.isDisposed()||h!==e.flightGen()){m();return}m(),e.openPanorama(u,400,h)},!0)}if(b&&v[1]){let R=i.get(v[1])?.label??v[1];w("\u203A",`View next seat ${R}`,()=>{e.flyToSeat(v[1])})}return!M.childElementCount&&!p?null:(t.appendChild(d),s=d,c(),d)},remove:m,layout:c}}var Ag={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Ju(e){let{container:t,orbit:n,isNarrow:o}=e,i={...Ag,...e.labels??{}},r=(M,y)=>{M.setAttribute("aria-label",y),M.title=y},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let m=document.createElement("div");m.setAttribute("role","group"),m.setAttribute("aria-label","3D view controls"),Object.assign(m.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",r(l,i.rotate);let u=document.createElement("button");u.type="button",u.textContent="\u2725",r(u,i.move);let h=document.createElement("button");h.type="button",h.textContent="\u2212",r(h,i.zoomOut);let f=document.createElement("button");f.type="button",f.textContent="+",r(f,i.zoomIn);for(let M of[l,u,h,f])M.className="sl-3d-icon-control",Object.assign(M.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"});c.append(l,u),m.append(f,h);let d=null,p=()=>{let M=n.dragAction();if(M===d)return;d=M;let y=M==="orbit";l.setAttribute("aria-pressed",String(y)),u.setAttribute("aria-pressed",String(!y)),l.style.background=y?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",u.style.background=y?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=y?`${i.rotate} \xB7 ${i.move} with Shift`:`${i.move} \xB7 ${i.rotate} with Shift`},b=M=>{n.setPrimaryDragMode(M),p()};l.addEventListener("click",()=>b("orbit")),u.addEventListener("click",()=>b("pan"));let g=()=>{let{atMin:M,atMax:y}=n.dollyLimitState();f.disabled!==M&&(f.disabled=M),h.disabled!==y&&(h.disabled=y)};h.addEventListener("click",()=>{n.zoomBy(Sn),g()}),f.addEventListener("click",()=>{n.zoomBy(jt),g()}),a.append(c,m),b("auto"),t.appendChild(a);let x=e.enabled!==!1,S=()=>{let M=o();a.style.display=s||!x?"none":"flex",a.style.right=M?"12px":"14px",a.style.bottom=M?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=M?"none":"flex",f.style.display=M?"none":"",h.style.display=M?"none":""};return S(),{element:a,utilityControls:m,setNavigationMode:b,syncNavigationMode:p,syncZoomLimits:g,setSeatViewLocked:M=>{s=M,n.setInteractionEnabled(!M),S()},seatViewLocked:()=>s,layout:S}}var Rg=.5,em=12,tm=20,Eg=28;function Cg(e,t,n){return!(e>0)||!(n>0)?0:Rg*n/(2*e*Math.tan(t*Math.PI/360))}function nm(e){let{glctx:t,orbit:n,model:o,seats:i,opts:r,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:m,tapSlop:l,tapMs:u,cancelFlight:h,focusSectionCamera:f,setSelection:d,ensureSeatView:p}=e,b=0,g=0,x=0,S=-1,I=!1,M=!1,y=E=>{e.seatViewLocked()||S===-1&&(S=E.pointerId,b=E.clientX,g=E.clientY,x=performance.now(),I=!1,M=a.active,a.active&&(s.cinematicCancelled(),h(),r.onViewTargetChange?.(null)))},P=E=>{E.pointerId===S&&Math.hypot(E.clientX-b,E.clientY-g)>l&&(I=!0)},v=(E,A,T,L,V)=>{let F=t.canvas.getBoundingClientRect(),G=t.canvas.clientWidth||F.width||1,j=t.canvas.clientHeight||F.height||1,N=E-F.left,k=A-F.top,B=L*L,D=-1,H=B,U=1/0;for(let q of i){if(T&&q.sectionId!==T)continue;let $=o.seats.idToIndex.get(q.id);if($===void 0)continue;if(V){let ie=Math.round(o.seats.iState[$]??0);if(ie!==0&&ie!==3)continue}let ee=$*3,Q=at(n.camera.projectionViewMatrix,[o.seats.iPosition[ee],o.seats.iPosition[ee+1]+.55,o.seats.iPosition[ee+2]],G,j);if(!Q.visible)continue;let X=Q.x-N,K=Q.y-k,Y=X*X+K*K;(Y<H||Math.abs(Y-H)<1&&Q.depth<U)&&(D=$,H=Y,U=Q.depth)}return D},w=(E,A)=>{let T=e.gpu(),L=e.pick();if(!T||!L)return-1;L.syncFromSeatProgram(T.seatProgram);let V=t.canvas.getBoundingClientRect(),F=t.renderer.dpr,{x:G,y:j}=ru(E,A,V,F,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),N=Math.max(2,Math.round(8*F));return L.pick(n.camera,G,j,N)},R=()=>t.canvas.clientHeight||t.canvas.getBoundingClientRect().height,C=(E,A=em)=>{let T=n.camera?.position;if(!T)return!1;let L=E*3,V=Math.hypot(T.x-o.seats.iPosition[L],T.y-o.seats.iPosition[L+1],T.z-o.seats.iPosition[L+2]);return Cg(V,n.fovY,R())>=A};return{onDown:y,onMove:P,onUp:E=>{if(E.pointerId!==S)return;let A=!I&&performance.now()-x<u;if(S=-1,M){M=!1;return}let T=e.gpu(),L=e.pick();if(!A||!T||!L)return;let V=w(E.clientX,E.clientY),F=E.pointerType==="touch"||E.pointerType==="pen",G=F?tm:em,j=V>=0&&C(V,G),N=!1;if(e.focusedSectionId()&&V>=0){let D=c[V],H=D?m.get(D):void 0;if(H&&H!==e.focusedSectionId()&&f(H,{keepCamera:j})){if(!j)return;N=!0}}if(e.focusedSectionId()&&V<0&&(V=v(E.clientX,E.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&V<0){let D=v(E.clientX,E.clientY,null,72,!1),H=D>=0?c[D]:void 0,U=H?m.get(H):void 0;if(U&&U!==e.focusedSectionId()&&f(U))return}if(!e.focusedSectionId()){V<0&&(V=v(E.clientX,E.clientY,null,42,!1));let D=V>=0?c[V]:void 0,H=D?m.get(D):void 0;if(H&&f(H,{keepCamera:j})){if(!j)return;N=!0}}if(V<0||V>=c.length){e.selection().size&&(d([]),r.onViewTargetChange?.(null));return}let k=c[V];if(F&&e.focusedSectionId()&&!N&&!C(V,tm)){e.focusSeatCamera(k,{seatPx:Eg,viewportHeightPx:R()});return}let B=_e[Math.round(o.seats.iState[V]??0)]??"available";if(B!=="available"&&B!=="selected"){r.onSeatInspect?.(k,B);return}if(e.selection().has(k)&&e.selection().size===1){d([]),r.onViewTargetChange?.(null),r.onSeatPick?.(k);return}d([k]),p(k),s.seatPicked(k,m.get(k)),r.onSeatPick?.(k)}}}var $o=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,o=1/0,i=-1/0,r=-1/0;for(let f=0;f<this.count;f++){let d=t[f*3],p=t[f*3+2];d<n&&(n=d),d>i&&(i=d),p<o&&(o=p),p>r&&(r=p)}let a=Math.max(i-n,.001),s=Math.max(r-o,.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=o;let c=this.cols*this.rows,m=new Int32Array(c+1),l=f=>{let d=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]-o)/this.cell)))*this.cols+d};for(let f=0;f<this.count;f++)m[l(f)+1]++;for(let f=0;f<c;f++)m[f+1]+=m[f];let u=new Int32Array(this.count),h=m.slice(0,c);for(let f=0;f<this.count;f++)u[h[l(f)]++]=f;this.cellStart=m,this.cellItems=u}gather(t,n,o,i,r){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let c=i.length,m=o*o,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),h=Math.ceil(o/this.cell)+1,f=this.iPosition,d=0;for(let p=0;p<=h&&d<c;p++){let b=u-p,g=u+p,x=l-p,S=l+p;for(let I=b;I<=g&&d<c;I++){if(I<0||I>=this.rows)continue;let M=I===b||I===g;for(let y=x;y<=S&&d<c;y++){if(!M&&y!==x&&y!==S){y=S-1;continue}if(y<0||y>=this.cols)continue;let P=I*this.cols+y;for(let v=a[P],w=a[P+1];v<w&&d<c;v++){let R=s[v],C=f[R*3]-t,O=f[R*3+2]-n,E=r===void 0?0:f[R*3+1]-r;C*C+E*E+O*O<=m&&(i[d++]=R)}}}}return d}};var qo=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(no);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new $o(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,o=this.ctx.gpu();if(!o)return;if(!t){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let i=this.ctx.orbit().camera.position;if(Math.hypot(i.x-this.lastGatherX,i.y-this.lastGatherY,i.z-this.lastGatherZ)<gr)return;if(this.lastGatherX=i.x,this.lastGatherY=i.y,this.lastGatherZ=i.z,Math.hypot(i.x-n.bounds.center[0],i.y-n.bounds.center[1],i.z-n.bounds.center[2])-n.bounds.radius>yr){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(i.x,i.z,yr,this.nearBuf,i.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(t,n,o){let i=1-Math.exp(-t*9),r=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?i:r),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?i:r),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function om(e){let t=Math.max(5,e.radius),n=e.focalWorld[0]-e.center[0],o=e.focalWorld[2]-e.center[2],i=Math.hypot(n,o);if(i<t*.12)return{center:e.center,radius:t,polarDeg:48};let r=Math.min(i*.25,t*.2);return{center:[e.center[0]+n/i*r,e.center[1],e.center[2]+o/i*r],radius:t+r,polarDeg:50}}var Zo=require("ogl");function rm(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function im(e){let{container:t,model:n,opts:o,orbit:i,cinematic:r,analytics:a,loop:s,labelOverlay:c,stageAzimuth:m,overviewFraming:l}=e,u=0,h=-1,f=(R,C,O=28)=>{i.camera.position.set(R[0],R[1],R[2]),i.camera.lookAt(new Zo.Vec3(C[0],C[1],C[2])),i.camera.fov=O,i.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(rm());let p=o.navLabels?.fitView??"Show whole venue";d.setAttribute("aria-label",p),d.title=p,Object.assign(d.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let b=()=>{d.firstElementChild||d.replaceChildren(rm())};b();let g=R=>{h=R;let C=e.gpu();C&&(C.seatProgram.uniforms.uFocusFloor.value=R,C.solidProgram.uniforms.uFocusFloor.value=R,C.chairProgram.uniforms.uFocusFloor.value=R),e.showSectionSeatLabels(null)},x=null,S=!1,I=()=>{if(x=null,S=!1,e.setSeeThrough?.(null),e.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),d.style.display="",c.setVisible(!0),e.setFrozen(!1);let R=h>=0?n.floors[h]:null;if(e.setNearFieldDetailEnabled(!!R),e.setSeatViewLocked(!1),M(),e.removeArriveChip(),e.setNavigationMode("auto"),R){let C=R.focalWorld[0]-R.center[0],O=R.focalWorld[2]-R.center[2],E=Math.hypot(C,O)>R.radius*.12?Math.atan2(C,O):m,A={center:R.center,radius:R.radius,box:R.box},T={polarDeg:58,margin:1.12};e.reducedMotion()?i.frame(A,!1,E,!1,T):i.frameSoft(A,E,!1,T)}else e.reducedMotion()?i.frame(n.bounds,!1,m,o.portraitOverviewCrop===!0,l):i.frameSoft(n.bounds,m,o.portraitOverviewCrop===!0,l);c.setOverviewDistance(i.targetDistance),e.showSectionSeatLabels(null),s.requestRender()},M=()=>{u++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),r.active&&(r.cancel(),i.resumeAfterFlight(n.focalWorld))},y=R=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let C=n.seats.idToIndex.get(R);if(C===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(R),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),d.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let O=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(O),e.setSeatViewLocked(!1);let E=++u;O?e.showArriveChip(R,E):e.removeArriveChip();let{eye:A,focal:T}=e.resolvedSeatViewPose(R,C),L=o.arriveAtSeatEye?e.seatViewArrival(R,C):null,V=L&&L.stops.length>1&&L.stops[1].name==="row"?L.stops[1]:null,F=L?L.focal:T,G=[i.camera.position.x,i.camera.position.y,i.camera.position.z],j=Mi(G,L?.eye??A,F,n.bounds.center,n.bounds.radius),N=V?V.eye:L?L.eye:o.arriveAtSeatEye?A:j.finalPos,k=L?L.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Vo:65:28,B=[j.waypoints[0],j.waypoints[1],N];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),f(N,F,k),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||i.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),L&&e.enterSeatView(L.stops),e.showArriveChip(R,E),Promise.resolve();let D=new Zo.Quat().copy(i.camera.quaternion),H=du(i.camera,N,F);s.requestRender();let U=O?700:2500;return r.start(B,D,H,U,k).then(()=>{e.isDisposed()||E!==u||(e.setSeatStepping(!1),a.cinematicPlayed(U),i.resumeAfterFlight(F),e.setSeatViewLocked(o.arriveAtSeatEye===!0),L&&e.enterSeatView(L.stops,V?1:0),s.requestRender(),e.showArriveChip(R,E))})},P=(R,C)=>{let O=n.sections.find(E=>E.id===R);if(!O||O.seatCount===0)return!1;if(x=R,S=!1,e.setSeeThrough?.(null),e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),r.cancel(),e.removeArriveChip(),n.floors.length>1&&h!==O.floorIndex&&g(O.floorIndex),e.setNavigationMode("auto"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(R),!C?.keepCamera){let E=om(O),A={polarDeg:E.polarDeg,margin:1.12};e.reducedMotion()?i.frame({center:E.center,radius:E.radius},!1,i.currentAzimuth,!1,A):i.glideTo({center:E.center,radius:E.radius},A)}return o.onSectionFocusChange?.(R),s.requestRender(),!0},v=(R,C)=>{if(e.isDisposed()||!e.gpu())return!1;let O=n.seats.idToIndex.get(R);if(O===void 0)return!1;let E=O*3,A=[n.seats.iPosition[E],n.seats.iPosition[E+1]+.55,n.seats.iPosition[E+2]],T=C?_g(C,i.fovY,i.camera.aspect||1):am;return S=!0,e.setSeeThrough?.(A),e.reducedMotion()?i.frame({center:A,radius:T},!1,void 0,!1,_i):i.frameSoft({center:A,radius:T},void 0,!1,_i),s.requestRender(),!0},w=()=>{if(e.isNarrow?.()&&S&&x&&P(x)){s.requestRender();return}I()};return d.addEventListener("click",w),{overviewChip:d,layoutOverviewChip:b,flightGen:()=>u,focusedFloor:()=>h,applyFloorFocus:g,placeCameraFinal:f,cancelFlight:M,focusOverview:I,flyToSeat:y,focusSectionCamera:P,focusSeatCamera:v}}var am=4.5;function _g(e,t,n){let o=Math.tan(t*Math.PI/360),i=o*Math.max(.001,n),a=Tg*e.viewportHeightPx/(2*Math.max(1,e.seatPx)*o)*Math.min(o,i)/_i.margin;return Math.max(kg,Math.min(am,a))}var Tg=.5,kg=1.5,_i={polarDeg:48,margin:1.25};function Kn(e,t){let{doc:n,report:o}=ko(e),i=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!i&&!o.roles?.length)return null;if(!i){let c=new Map(o.roles.map(f=>[f.id,f.role])),m=f=>f.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),l=e.floors?.map(f=>({...f,objects:m(f.objects)})),u=new Float64Array(t.length).fill(Number.NaN),h=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((f,d)=>{f.eyeHeightM!==void 0&&(u[d]=f.eyeHeightM),f.focalPoint&&(h[d*2]=f.focalPoint.x,h[d*2+1]=f.focalPoint.y)}),{doc:{...e,objects:l?.[0]?.objects??m(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:u,focal:h}}let r=new Map($t(n).map(c=>[c.id,c])),a=new Float64Array(t.length).fill(Number.NaN),s=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,m)=>{let l=r.get(c.id)??c;l.eyeHeightM!==void 0&&(a[m]=l.eyeHeightM),l.focalPoint&&(s[m*2]=l.focalPoint.x,s[m*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function Ti(e,t){return e.map((n,o)=>{let i=t.eyeHeightM[o],r=t.focal[o*2],a=t.focal[o*2+1],s={...n};return Number.isNaN(i)?delete s.eyeHeightM:s.eyeHeightM=i,Number.isNaN(r)?delete s.focalPoint:s.focalPoint={x:r,y:a},s})}function sm(e){let t=e.estimate===!1?null:Kn(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Ti(e.seats,t)},estimate:t}:{input:e}}function ki(e,t,n,o,i,r,a,s,c=.5){let m=-1,l=s*s,u=1/0;for(let h=0;h<t;h++){let f=h*3,d=at(n,[e[f],e[f+1]+c,e[f+2]],o,i);if(!d.visible)continue;let p=d.x-r,b=d.y-a,g=p*p+b*b;(g<l-4||g<l+4&&d.depth<u)&&(m=h,l=Math.min(l,g),u=d.depth)}return m}var Fg={};function cm(e){let t=performance.now(),{input:n,estimate:o}=sm(e);return{model:rn(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function Lg(e){let t=$t(e.doc);return{...cm({...e,seats:t}),seats:t}}function lm(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let o;try{o=new Worker(new URL("./scene/scene.worker.js",Fg.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(i=>{let r=!1,a=m=>{r||(r=!0,clearTimeout(c),o.terminate(),i(m))},s=()=>a(t()),c=window.setTimeout(s,15e3);o.onerror=s,o.onmessage=m=>{let l=n(m.data);l?a(l):s()},o.postMessage(e)})}function um(e){return lm(e,()=>cm(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function mm(e){return lm(e,()=>Lg(e),({model:t,buildMs:n,seats:o,estimate:i})=>o?{model:t,buildMs:n,seats:o,source:"worker",...i?{estimate:i}:{}}:null)}var Og=40,Dg=48,Ng=Math.PI/180,Bg=6,Vg=500,Hg=6;function Gg(e,t,n={}){let o=performance.now(),i=t.prepared?t.prepared.estimate:t.estimate===!1?null:Kn(t.doc,t.seats);i&&(t={...t,doc:i.doc,seats:Ti(t.seats,i)});let r=t.prepared?.model??rn(t),a=new Ko(n.onAnalytics),s=new Array(r.seats.count);for(let[z,W]of r.seats.idToIndex)s[W]=z;let c=new Map(t.seats.map(z=>[z.id,z])),m=new Map;for(let z of t.seats){if(!z.rowId)continue;let W=m.get(z.rowId);W?W.push(z.id):m.set(z.rowId,[z.id])}let l=new Map,u=[0,0,0,0];function h(){if(b)for(let z of[b.seatProgram,b.solidProgram,b.chairProgram])z.uniforms.uSeeThrough.value=u}t.seats.forEach((z,W)=>{l.set(z.id,r.seatSectionIds?.[W]??z.sectionId)});let f=new Map;for(let[z,W]of r.seats.idToIndex){let Z=l.get(z);if(!Z)continue;let se=f.get(Z);se?se.push(W):f.set(Z,[W])}let d=()=>{if(!b||!r.sectionSolidRanges.length)return;let{lit:z,anyUnlit:W}=Ql(r.sectionSolidRanges,f,r.seats.iState);b.setSectionShellLit(W?z:null)},p=t.doc.floors?.some(W=>(W.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(W=>W.objects)??t.doc.objects).some(W=>W.type==="section"&&((W.height??0)>0||(W.rake??0)>0)),b=null,g=null,x=null,S=!1,I=!1,M=!1,y=new Map,P=null,v=null,w=null,R=new Map,C=null,O=()=>{w===null&&(w=e.style.zIndex,e.style.zIndex="20")},E=()=>{w!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=w),w=null)},A=!1,T=()=>A?Fe.focusedFloor():-1,L=()=>{b=nu(B.gl,r),g?.dispose(),g=Rl(B.gl,[1,1,1],r.theme.seatStates.selected),Di(!1),d(),re(),x=new No(B.renderer,b.seatGeometry,b.chairGeometry,b.solidGeometry,r.seats.count),B.setClearColor(r.theme.background.top),x.setRestoreClear(r.theme.background.top),x.setRoomCentre(r.room?.centre),b.seatProgram.uniforms.uSeatRadius.value=ut*r.theme.seatScale,b.seatProgram.uniforms.uFocusFloor.value=T(),b.solidProgram.uniforms.uFocusFloor.value=T(),b.chairProgram.uniforms.uFocusFloor.value=T(),b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=T()),h(),F.forceRegather()},V=!1,F=new qo({model:r,orbit:()=>D,gpu:()=>b}),G=!1,j=new Map,N=24,k=z=>F.setDetailEnabled(z),B=new Jn(e,{onContextLost:()=>{M||a.contextLost(),S=!0,we.stop(),b=null,x=null},onContextRestored:()=>{L(),S=!1,M||a.contextRestored(),we.requestRender()}}),D=new eo(B.gl,B.canvas,()=>we.requestRender(),()=>a.orbitEngaged());D.setAspect(B.aspect);let H=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="section"&&z.physical3dProvenance?.surfaceKind?.status==="inferred"),U=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(H&&r.stages.length===0))return qi(r.focalWorld,r.seats.iPosition,r.bounds)})(),q=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="shape"&&z.stageKind?.startsWith("pitch-")),$=r.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:q?36:48,margin:1.05},ee=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;D.frame(r.bounds,!ee&&n.skipInitialOverviewAnimation!==!0,U,n.portraitOverviewCrop===!0,$);let Q=new Bo(D.camera),X=Zu(e),K=Zi(e,r),Y=new Fo(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:r.theme.background.top}),ie=r.labels,te=()=>Kc(ie,r.floors.length,T());Y.setLabels(te()),Y.setOverviewDistance(D.targetDistance);let ae=()=>{let z=new Map,W=_e.indexOf("available");for(let Z of ie){if(!Z.wheelchairSeats)continue;let se=0;for(let me of Z.wheelchairSeats)r.seats.iState[me]===W&&se++;se>0&&z.set(Z.id,se)}return Y.setWheelchairFree(z)};ae();let J=null,oe=()=>[...y.keys()].flatMap(z=>{let W=r.seats.idToIndex.get(z),Z=W===void 0?void 0:t.seats[W];if(W===void 0||Z?.id!==z)return[];let se=W*3;return[{id:`seat:${z}`,kind:"seat",seatWidthM:r.seats.iChairWidth[W]*2,text:Z.displayLabel||Z.label,anchor:[r.seats.iPosition[se],r.seats.iPosition[se+1]+1.05,r.seats.iPosition[se+2]],pinBase:Qo(se)}]}),Pe=-1,re=()=>{b&&(Pe=J?r.sections.findIndex(z=>z.id===J):-1,b.seatProgram.uniforms.uFocusSection.value=Pe,b.chairProgram.uniforms.uFocusSection.value=Pe)},ge=z=>{if(J=z,re(),Y.setForcedDense(!!z),!z){let ne=oe(),Re=new Set(ne.map(Ae=>Ae.id));Y.setLabels([...te().filter(Ae=>!Re.has(Ae.id)),...ne]);return}let W=t.seats.filter(ne=>l.get(ne.id)===z),Z=new Set(W.map(ne=>ne.id)),se=new Set(W.map(ne=>ne.rowId)),me=new Set(y.keys()),he=new Set(W.filter(ne=>me.has(ne.id)).map(ne=>ne.id)),ye=te().filter(ne=>ne.kind!=="row"&&ne.kind!=="seat"&&ne.kind!=="access"||ne.kind==="access"&&Z.has(ne.id.slice(7))||(ne.kind==="row"?se.has(ne.id.slice(4)):Z.has(ne.id.slice(5))));if(r.seatCount<=6e3&&he.size===0){Y.setLabels(ye);return}let Ie=W,ke=new Set(Ie.map(ne=>`seat:${ne.id}`)),Be=Ie.flatMap(ne=>{let Re=r.seats.idToIndex.get(ne.id);if(Re===void 0)return[];let Ae=Re*3;return[{id:`seat:${ne.id}`,kind:"seat",seatWidthM:r.seats.iChairWidth[Re]*2,rowId:ne.rowId,text:me.has(ne.id)?ne.displayLabel||ne.label:ui(ne.displayLabel||ne.label),anchor:[r.seats.iPosition[Ae],r.seats.iPosition[Ae+1]+(me.has(ne.id)?1.05:.55),r.seats.iPosition[Ae+2]],...me.has(ne.id)?{pinBase:Qo(Ae)}:{}}]});Y.setLabels([...ye.filter(ne=>!ke.has(ne.id)),...Be])};L();let xe=null,Ye=null,et=new fm.Mat4,Ne=z=>{if(S||!b||I)return!1;let W=Du({flying:Q.active,panoramaMounted:P!==null,seatViewActive:xe?.active===!0}),Z=W==="orbit"?Pe:-1;b.seatProgram.uniforms.uFocusSection.value=Z,b.chairProgram.uniforms.uFocusSection.value=Z;let se=G?!1:W==="cinematic"?Q.update(performance.now()):W==="seatView"?xe.update(performance.now()):W==="orbit"?D.update():!1;Ye?.syncZoomLimits(),Ye?.syncNavigationMode();let me=T()>=0?r.floors[T()]:null,he=me?.radius??r.bounds.radius,ye=Pa(D.currentDistance,he),Ie=V?{center:[D.camera.position.x,D.camera.position.y,D.camera.position.z],radius:520}:r.clipBounds??r.renderBounds;D.updateClipping(Ie);let ke=me?.center??r.renderBounds.center,Be=me?.radius??r.renderBounds.radius,ne=(Ee,cr)=>Math.hypot(D.camera.position.x-Ee[0],D.camera.position.y-Ee[1],D.camera.position.z-Ee[2])<=cr*(F.detailVisible?1.8:1.55),Re=ne(ke,Be);if(!Re&&J){let Ee=r.sections.find(cr=>cr.id===J);Ee&&(Re=ne(Ee.center,Math.max(12,Ee.radius*2)))}F.detailVisible=Re;let Ae=b.seatProgram.uniforms;Ae.uSeatScale.value=ye.scale,Ae.uSeatFade.value=ye.fade;let $e=!!me&&Ia(me.seatCount,B.canvas.clientWidth||1,B.canvas.clientHeight||1),Tt=Aa(r.seats.count,he,D.currentDistance,D.camera.fov,B.canvas.clientHeight||1),hn=F.detailVisible||$e||Tt?1:0,pn=F.detailVisible||T()>=0||r.floors.length>1?1:0;F.ease(z,hn,pn),Ae.uSeatDetail.value=F.seatDetailMix;let Zn=hn===0&&F.seatDetailMix<.01;b.seatGeometry.setDrawRange(Zn?mr:0,Zn?ra:mr),b.solidProgram.uniforms.uStructureDetail.value=F.structureDetailMix,Ae.uMinPixels.value=ye.minPixels,Ae.uPixelToWorld.value=2*Math.tan(D.camera.fov*Ng/2)/Math.max(1,B.pixelHeight),F.update(F.detailVisible),r.outdoor&&(et.copy(D.camera.projectionViewMatrix).inverse(),b.backgroundProgram.uniforms.uInvViewProj.value.set(et)),B.renderer.render({scene:b.background,clear:!0}),B.renderer.render({scene:b.main,camera:D.camera,clear:!1});let bn=g?g.update(performance.now(),[D.camera.position.x,D.camera.position.y,D.camera.position.z],P!==null,W==="seatView"):!1;if(g&&B.renderer.render({scene:g.root,camera:D.camera,clear:!1}),K){let Ee=D.camera.worldMatrix;K.update(W==="seatView"?[D.camera.position.x,D.camera.position.y,D.camera.position.z]:null,[-Ee[8],-Ee[9],-Ee[10]])}Y.update(D.camera.projectionViewMatrix,B.canvas.clientWidth||1,B.canvas.clientHeight||1,D.currentDistance,he,[D.camera.position.x,D.camera.position.y,D.camera.position.z]);let Gt=se||bn||F.seatDetailMix!==hn||F.structureDetailMix!==pn;return Ke(!Gt),Gt},Ke=ga(e),we=new to(Ne),Et=typeof ResizeObserver<"u"?new ResizeObserver(()=>sr.resize()):null;Et?.observe(e),D.setZoomPointResolver((z,W)=>{let Z=B.canvas.getBoundingClientRect(),se=B.canvas.clientWidth||Z.width,me=B.canvas.clientHeight||Z.height;if(!(se>0)||!(me>0))return null;D.camera.updateMatrixWorld();let he=ki(r.seats.iPosition,r.seats.count,D.camera.projectionViewMatrix,se,me,z-Z.left,W-Z.top,Og);if(he<0)return null;let ye=he*3;return[r.seats.iPosition[ye],r.seats.iPosition[ye+1]+.5,r.seats.iPosition[ye+2]]});function Qo(z){return[r.seats.iPosition[z],r.seats.iPosition[z+1]+.5,r.seats.iPosition[z+2]]}Y.setSeatNumberRow(null);let tt=null,Ct=0,Jo=null,Li=()=>{Ct=0;let z=null,W=null;if(tt&&!xe?.active&&!Q.active){let me=B.canvas.getBoundingClientRect(),he=B.canvas.clientWidth||me.width,ye=B.canvas.clientHeight||me.height;if(he>0&&ye>0){let Ie=ki(r.seats.iPosition,r.seats.count,D.camera.projectionViewMatrix,he,ye,tt.x-me.left,tt.y-me.top,Dg);z=Ie>=0?t.seats[Ie]?.rowId??null:null;let ke=Ie>=0?t.seats[Ie]?.id??null:null;if(W=ke,tt.mouse&&!tt.pressing&&!!J&&!!ke&&l.get(ke)===J){let ne=e.getBoundingClientRect();Jo=ke,n.onSeatHover?.(ke,{x:tt.x-ne.left,y:tt.y-ne.top})}else Fi()}}else Fi();let Z=tt?.mouse?W:null,se=Y.setSeatNumberSeat(Z);(Y.setSeatNumberRow(z)||se)&&we.requestRender()};function Fi(){Jo!==null&&(Jo=null,n.onSeatHover?.(null,null))}let $n=z=>{tt={x:z.clientX,y:z.clientY,mouse:z.pointerType==="mouse",pressing:z.type==="pointerdown"},Ct||(Ct=requestAnimationFrame(Li))},Oi=z=>{z.pointerType==="mouse"&&(tt=null,Ct||(Ct=requestAnimationFrame(Li)))};B.canvas.addEventListener("pointermove",$n),B.canvas.addEventListener("pointerdown",$n),B.canvas.addEventListener("pointerleave",Oi);function Di(z){if(!g)return;let W=[];for(let Z of y.keys()){let se=r.seats.idToIndex.get(Z);if(se===void 0)continue;let me=se*3,he=Qo(me),ye=Math.atan2(r.focalWorld[0]-he[0],r.focalWorld[2]-he[2]);W.push({id:Z,position:he,facing:ye})}g.setSeats(W,performance.now(),z)}let Ni=z=>{let W=me=>{let he=r.seats.idToIndex.get(me);return he===void 0?void 0:r.seats.iState[he]},{updates:Z,next:se}=au(y,z,W);if(y=se,Y.setSelectedSeatIds(y.keys()),Di(!mn()),we.requestRender(),ge(J),Z.length){let me=Pr(r.seats,Z);b&&b.uploadSeatStateRuns(me),d(),we.requestRender()}},mn=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,dm=8,Bi=z=>{if(!n.getSeatView)return null;let W=R.get(z);if(!W)for(W=Promise.resolve(n.getSeatView(z)),R.set(z,W),W.catch(()=>{R.get(z)===W&&R.delete(z)});R.size>dm;){let Z=R.keys().next().value;if(Z===void 0)break;R.delete(Z)}return W},Vi=Ru(r.stages,r.focalWorld,r.bounds.groundY??0),Hi=Pi(Vi),er=(z,W)=>{let Z=c.get(z),se=Math.max(0,Math.round(r.seats.iFloor[W]??0)),me=t.doc.floors?.[se],he=r.floors[se],ye=me?.focalPoint??t.doc.focalPoint,Ie=he?{x:he.focalWorld[0]/_,y:he.focalWorld[2]/_}:ye,ke=Z?.focalPoint?{x:Z.focalPoint.x+Ie.x-ye.x,y:Z.focalPoint.y+Ie.y-ye.y}:Ie,Be=[r.seats.iPosition[W*3],r.seats.iPosition[W*3+1],r.seats.iPosition[W*3+2]],ne=bu(r.seats.iPosition,W,Hi),Re=ne!==null&&Math.abs(ne)<pu;return yu(Be,ke,me?.baseHeightM??0,Z?.eyeHeightM,Hi,Re)},tr=()=>(e.clientWidth||B.canvas.clientWidth)<=520,nr=null,Gi=null,hm=async(z,W,Z)=>{if(!n.getSeatView||M||Z!==Fe.flightGen())return;let se;try{se=await $u()}catch{if(a.panoramaFailed(z,"mount"),!M&&Z===Fe.flightGen()){let me=rr(z,Z,!0);requestAnimationFrame(()=>me?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||Z!==Fe.flightGen()||!nr))return Gi??=se.createOpenPanorama(nr),Gi(z,W,Z)},or=Qu({container:e,model:r,opts:n,expandedSeatById:c,seatIdsByRow:m,isNarrow:tr,isDisposed:()=>M,flightGen:()=>Fe.flightGen(),flyToSeat:z=>Xi(z),openPanorama:(z,W,Z)=>hm(z,W,Z)}),rr=or.show,ir=or.remove,pm=or.layout,_t=Ju({container:e,orbit:D,isNarrow:tr,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});Ye=_t;let bm=_t.element,fn=_t.setNavigationMode,ym=_t.layout,gm=_t.utilityControls,dn=null,zi=!1,qn=z=>{_t.setSeatViewLocked(z),z||xe?.exit()};xe=Ou({canvas:B.canvas,camera:D.camera,requestRender:()=>we.requestRender(),reducedMotion:mn,onStopChange:z=>{let W=z??(zi?"seat":null);dn=W;try{n.onSeatViewStopChange?.(W)}catch{}},onApplied:()=>{M||D.syncFromCamera()}});let Ui=r.sections.reduce((z,W)=>W.seatCount>0&&W.box?Math.max(z,W.box.max[1]):z,-1/0),ji=(z,W)=>{let{eye:Z}=er(z,W),se=(e.clientWidth||B.canvas.clientWidth||1)/Math.max(1,e.clientHeight||B.canvas.clientHeight||1),me=Cu(Z,Vi,se,{preserveEye:!0});if(n.seatViewStops===!1)return{...me,stops:[]};let he=l.get(z),ye=he?r.sections.find(Ie=>Ie.id===he):void 0;return{...me,stops:_u(me,{aspect:se,seatingTopY:Number.isFinite(Ui)?Ui:r.bounds.box.max[1],section:ye&&ye.seatCount>0?{center:ye.center,radius:ye.radius}:null,venue:{center:r.bounds.center,radius:r.bounds.radius}})}},Fe=im({isNarrow:tr,setSeeThrough:z=>{u=z?[z[0],z[1],z[2],Hg]:[0,0,0,0],h(),we.requestRender()},container:e,model:r,opts:n,orbit:D,cinematic:Q,analytics:a,loop:we,labelOverlay:Y,stageAzimuth:U,overviewFraming:$,gpu:()=>b,isDisposed:()=>M,panorama:()=>P,setPanorama:z=>{P=z},setPanoramaSphereVisible:z=>{V=z},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:z=>{v=z},setFrozen:z=>{I=z},restorePanoramaLayer:E,reducedMotion:mn,resolvedSeatViewPose:er,showSectionSeatLabels:ge,setNearFieldDetailEnabled:k,setSeatViewLocked:qn,setNavigationMode:fn,showArriveChip:rr,removeArriveChip:ir,inSeatView:()=>dn!==null,setSeatStepping:z=>{zi=z},seatViewArrival:(z,W)=>n.arriveAtSeatEye?ji(z,W):null,enterSeatView:(z,W)=>xe?.enter(z,W)});A=!0;let ar=Fe.overviewChip,xm=Fe.layoutOverviewChip,vm=Fe.applyFloorFocus,Mm=Fe.focusOverview,Wi=Fe.cancelFlight,Xi=Fe.flyToSeat,Yi=Fe.focusSectionCamera;gm.appendChild(ar),nr={container:e,model:r,opts:n,analytics:a,orbit:D,loop:we,seatsById:c,ensureSeatView:Bi,resolvedSeatViewPose:er,gpu:()=>b,gl:B.gl,isContextLost:()=>S,isDisposed:()=>M,flightGen:()=>Fe.flightGen(),setPanorama:z=>{P=z},getLoadAbort:()=>v,setLoadAbort:z=>{v=z},setPanoramaSphereVisible:z=>{V=z,z&&xe?.exit()},setFrozen:z=>{I=z},raisePanoramaLayer:O,restorePanoramaLayer:E,getOverviewChip:()=>ar,labelOverlay:Y,reducedMotion:mn,removeArriveChip:ir,showArriveChip:rr};let pt=nm({glctx:B,orbit:D,model:r,seats:t.seats,opts:n,cinematic:Q,analytics:a,seatIdByIndex:s,sectionIdBySeatId:l,tapSlop:Bg,tapMs:Vg,gpu:()=>b,pick:()=>x,seatViewLocked:()=>_t.seatViewLocked(),focusedSectionId:()=>J,selection:()=>y,cancelFlight:Wi,focusSectionCamera:Yi,focusSeatCamera:Fe.focusSeatCamera,setSelection:Ni,ensureSeatView:Bi});B.canvas.addEventListener("pointerdown",pt.onDown),B.canvas.addEventListener("pointermove",pt.onMove),B.canvas.addEventListener("pointerup",pt.onUp),B.canvas.addEventListener("pointercancel",pt.onUp),we.requestRender();let sr={setAvailability(z){let W=iu(y,z),Z=Pr(r.seats,W);Z.length&&b&&b.uploadSeatStateRuns(Z),d(),Z.length&&ae(),we.requestRender()},setSelection:Ni,setNavigationMode:fn,zoomIn(){D.zoomBy(jt),we.requestRender()},zoomOut(){D.zoomBy(Sn),we.requestRender()},flyToSeat:Xi,focusOverview:Mm,seatViewStop:()=>dn,recentreSeatView:()=>xe?.recentre()??!1,resize(){let{width:z,height:W}=B.resize();D.setAspect(z/Math.max(1,W)),pm(),ym(),xm(),we.requestRender()},stats(){return{...we.stats(),drawCalls:b?b.drawCalls:0,fallbackTriangles:b?b.seatGeometry.drawRange.count/3*r.seats.count:0,seatCount:r.seatCount}},captureImage(z=1280){if(S||!b||typeof document>"u")return null;Ne(0);let W=B.canvas,Z=Math.min(1,z/Math.max(W.width,W.height,1)),se=document.createElement("canvas");se.width=Math.max(1,Math.round(W.width*Z)),se.height=Math.max(1,Math.round(W.height*Z));let me=se.getContext("2d");return me?(me.drawImage(W,0,0,se.width,se.height),se.toDataURL("image/jpeg",.82)):null},captureSeatView(z,W=480){if(S||!b||I||typeof document>"u"||Q.active||P!==null||xe?.active)return null;let Z=j.get(z);if(Z)return Z;let se=r.seats.idToIndex.get(z);if(se===void 0)return null;let{eye:me,focal:he,fov:ye}=ji(z,se),Ie=D.snapshot(),ke=[F.seatDetailMix,F.structureDetailMix],Be=null;try{G=!0,D.camera.position.set(me[0],me[1],me[2]),D.camera.perspective({fov:ye,aspect:D.camera.aspect}),D.camera.lookAt(he),D.camera.updateMatrixWorld(),D.syncFromCamera(),F.seatDetailMix=1,F.structureDetailMix=1,F.forceRegather(),Ne(0);let ne=B.canvas,Re=Math.min(ne.width,Math.round(ne.height*16/9)),Ae=Math.round(Re*9/16),$e=document.createElement("canvas");$e.width=Math.max(1,Math.round(W)),$e.height=Math.max(1,Math.round(W*9/16));let Tt=$e.getContext("2d");Tt&&(Tt.drawImage(ne,(ne.width-Re)/2,(ne.height-Ae)/2,Re,Ae,0,0,$e.width,$e.height),Be=$e.toDataURL("image/jpeg",.8))}finally{G=!1,Ie(),F.seatDetailMix=ke[0],F.structureDetailMix=ke[1],F.forceRegather(),Ne(0)}if(Be)for(j.set(z,Be);j.size>N;)j.delete(j.keys().next().value);return Be},getQualityEvidence(){let z=we.stats(),W=B.canvas.clientWidth||1,Z=B.canvas.clientHeight||1,se=r.bounds.center,me=at(D.camera.projectionViewMatrix,[se[0],r.bounds.box.min[1],se[2]],W,Z),he=at(D.camera.projectionViewMatrix,[se[0],r.bounds.box.max[1],se[2]],W,Z),ye=r.bounds.box,Ie=[ye.min[0],ye.max[0]].flatMap(ne=>[ye.min[1],ye.max[1]].flatMap(Re=>[ye.min[2],ye.max[2]].map(Ae=>at(D.camera.projectionViewMatrix,[ne,Re,Ae],W,Z)))).filter(ne=>Number.isFinite(ne.x)&&Number.isFinite(ne.y)&&Number.isFinite(ne.depth)),ke=Ie.length?(()=>{let ne=Math.min(...Ie.map(Ee=>Ee.x)),Re=Math.max(...Ie.map(Ee=>Ee.x)),Ae=Math.min(...Ie.map(Ee=>Ee.y)),$e=Math.max(...Ie.map(Ee=>Ee.y)),Tt=Math.max(0,ne),hn=Math.min(W,Re),pn=Math.max(0,Ae),Zn=Math.min(Z,$e),bn=Math.max(0,hn-Tt),Gt=Math.max(0,Zn-pn);return{box:{x:Tt,y:pn,width:bn,height:Gt},horizontalFillRatio:bn/W,verticalFillRatio:Gt/Z,visibleAreaRatio:bn*Gt/(W*Z),clippedEdges:[...Ae<0?["top"]:[],...Re>W?["right"]:[],...$e>Z?["bottom"]:[],...ne<0?["left"]:[]]}})():void 0,Be=String(B.gl.getParameter(B.gl.VERSION)??"");return{viewport:{width:W,height:Z},context:{webgl2:/webgl\s*2/i.test(Be),lost:S},frame:{rendered:z.rendered,idle:z.idle},camera:{position:[D.camera.position.x,D.camera.position.y,D.camera.position.z],distance:D.currentDistance,verticalFovDeg:D.fovY},scene:{seatCount:r.seatCount,floorCount:r.floors.length,zoneCount:r.zones.length,sectionCount:r.sections.length,authoredRelief:p,renderedVerticalSpanM:Math.max(0,r.bounds.box.max[1]-r.bounds.box.min[1]),projectedReliefPx:me.visible&&he.visible?Math.abs(me.y-he.y):0},labels:Y.qualityEvidence(),framing:ke,...dn?{seatView:{fovDeg:D.camera.fov,stop:dn}}:{}}},getQualityReport(){return Oo(sr.getQualityEvidence())},loseContextForTest(){B.simulateContextLossCycle()},floors(){return r.floors},focusFloor(z){if(z!==null&&!r.floors.some(Z=>Z.index===z))return!1;let W=z??-1;if(k(z!==null),qn(!1),vm(W),fn("orbit"),z===null)Q.cancel(),mn()?D.frame(r.bounds,!1,U,n.portraitOverviewCrop===!0,$):D.frameSoft(r.bounds,U,n.portraitOverviewCrop===!0,$),Y.setOverviewDistance(D.targetDistance);else{let Z=r.floors[z];if(Z.seatCount>0){Q.cancel();let se=Z.focalWorld[0]-Z.center[0],me=Z.focalWorld[2]-Z.center[2],he=Math.hypot(se,me)>Z.radius*.12?Math.atan2(se,me):U;D.frame({center:Z.center,radius:Z.radius,box:Z.box},!1,he,!1,{polarDeg:58,margin:1.12}),Y.setOverviewDistance(D.targetDistance)}}return we.requestRender(),!0},zones(){return r.zones},focusZone(z){let W=r.zones.find(he=>he.id===z);if(!W||W.seatCount===0)return!1;k(!1),qn(!1),Q.cancel(),fn("orbit"),ge(null),n.onSectionFocusChange?.(null);let Z=W.focalWorld[0]-W.center[0],se=W.focalWorld[2]-W.center[2],me=Math.hypot(Z,se)>W.radius*.12?Math.atan2(Z,se):void 0;return D.frame({center:W.center,radius:W.radius*1.25},!1,me),we.requestRender(),!0},sections(){return r.sections},focusSection(z){return Yi(z)},rows(z){return z?r.rows.filter(W=>W.sectionId===z):r.rows},seatsInRow(z){return t.seats.filter(W=>W.rowId===z).map(W=>({id:W.id,label:W.displayLabel||W.label}))},focusRow(z){let W=r.rows.find(Z=>Z.id===z);return!W||W.seatCount===0?!1:(k(!0),qn(!1),Q.cancel(),fn("pan"),W.sectionId&&(ge(W.sectionId),n.onSectionFocusChange?.(W.sectionId)),D.frame({center:W.center,radius:Math.max(2.5,W.radius*.65)}),we.requestRender(),!0)},setReducedMotionForTest(z){C=z},dispose(){M=!0,K?.dispose(),Ke(!1),ir(),ar.remove(),bm.remove(),Wi(),xe?.dispose(),we.stop(),Y.dispose(),Et?.disconnect(),P&&(P.dispose(),P=null),E(),X(),B.canvas.removeEventListener("pointerdown",pt.onDown),B.canvas.removeEventListener("pointermove",pt.onMove),B.canvas.removeEventListener("pointerup",pt.onUp),B.canvas.removeEventListener("pointercancel",pt.onUp),B.canvas.removeEventListener("pointermove",$n),B.canvas.removeEventListener("pointerdown",$n),B.canvas.removeEventListener("pointerleave",Oi),Ct&&cancelAnimationFrame(Ct),D.dispose(),x&&x.dispose(),b&&b.dispose(),b=null,g?.dispose(),g=null,x=null,B.dispose()}};return a.opened(r.seatCount,p,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),sr}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});