@seatlayer/core 0.97.0 → 0.98.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.
@@ -1,4 +1,4 @@
1
- "use strict";var Xl=Object.create;var Ln=Object.defineProperty;var Wl=Object.getOwnPropertyDescriptor;var Yl=Object.getOwnPropertyNames;var Kl=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty;var on=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Kr=(e,t)=>{for(var n in t)Ln(e,n,{get:t[n],enumerable:!0})},qr=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Yl(t))!ql.call(e,r)&&r!==n&&Ln(e,r,{get:()=>t[r],enumerable:!(o=Wl(t,r))||o.enumerable});return e};var lt=(e,t,n)=>(n=e!=null?Xl(Kl(e)):{},qr(t||!e||!e.__esModule?Ln(n,"default",{value:e,enumerable:!0}):n,e)),$l=e=>qr(Ln({},"__esModule",{value:!0}),e);function Zp(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Qp(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Mo(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Qp(t?.deviceMemory)}}function So(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,u)=>c.width*c.height-u.width*u.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||Zp(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 cl(){return new DOMException("Panorama image load aborted","AbortError")}function Rn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(cl());return}let r=new Image;r.crossOrigin="anonymous";let i=!1,a=()=>{r.onload=null,r.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?o(u):n(r))},c=()=>{r.src="",s(cl())};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 wo(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 Nr=on(()=>{"use strict"});function ul(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":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 Vr(e){return Math.max(Jp,Math.min(eb,e))}function tb(e,t,n){let o=(.5+e/360)*n;return t/2-o}function nb(e,t=Io){return e*(180/t)}function ll(e,t,n){return(e-t)/2+Po(n,t)}function Po(e,t){let n=Qe/180*t;return Math.max(-n,Math.min(n,e))}function ob(){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 Gr(e){return e||(ob()?"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 ml(e,t,n={}){let o=n.fadeMs??400,r=t.initialBearingDeg??0,i=So(t,Mo()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=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("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(l);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 G=document.createElement("div");G.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(G.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(G)}let h=document.createElement("div");h.textContent=Gr(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=Io,g=()=>{let G=c.clientHeight||1,H=c.clientWidth||1,K=I.naturalWidth||H*2,Q=I.naturalHeight||G,Y=d>0?(H/2-p)/d:0,W=f>0?b/f:0;f=nb(G,y),d=f*(K/Q),l.style.backgroundSize=`${d}px ${f}px`,x?p=H/2-Y*d:(p=tb(r,H,d),b=Po((t.initialPitchDeg??0)/180*f,f),x=!0),b=Po(W*f,f),l.style.backgroundPosition=`${p}px ${ll(G,f,b)}px`},x=!1,w=()=>{let G=c.clientHeight||1;b=Po(b,f),l.style.backgroundPosition=`${p}px ${ll(G,f,b)}px`},I=new Image;I.onload=g,I.src=i.initialUrl;let v=()=>{};i.upgradeUrl&&(v=wo(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(H=>!H||a.signal.aborted?null:Rn(H,a.signal).then(K=>({full:K,url:H}))).then(H=>{H&&(k||a.signal.aborted||(I=H.full,l.style.backgroundImage=`url("${H.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let P=!1,S=0,M=0,C=0,T=new Map,N=()=>{let[G,H]=[...T.values()];return G&&H?Math.hypot(G.x-H.x,G.y-H.y):0},D=G=>{let H=Vr(G);H!==y&&(y=H,g())},R=G=>{T.set(G.pointerId,{x:G.clientX,y:G.clientY}),P=T.size===1,S=G.clientX,M=G.clientY,T.size===2&&(C=N()),l.style.cursor="grabbing";try{l.setPointerCapture?.(G.pointerId)}catch{}},A=G=>{if(T.has(G.pointerId)){if(T.set(G.pointerId,{x:G.clientX,y:G.clientY}),T.size>=2){let H=N();C>0&&H>0&&D(y*(C/H)),C=H,P=!1;return}P&&(p+=G.clientX-S,b+=G.clientY-M,S=G.clientX,M=G.clientY,w())}},L=G=>{T.delete(G.pointerId),C=T.size===2?N():0;let H=T.values().next().value;P=T.size===1,H?(S=H.x,M=H.y):l.style.cursor="grab";try{l.releasePointerCapture?.(G.pointerId)}catch{}},O=G=>{G.preventDefault(),D(y+G.deltaY*.04)};l.addEventListener("pointerdown",R),l.addEventListener("pointermove",A),l.addEventListener("pointerup",L),l.addEventListener("pointercancel",L),l.addEventListener("wheel",O,{passive:!1});let _=!1,k=!1,V=0,F=()=>{l.removeEventListener("pointerdown",R),l.removeEventListener("pointermove",A),l.removeEventListener("pointerup",L),l.removeEventListener("pointercancel",L),l.removeEventListener("wheel",O),window.removeEventListener("keydown",U)},B=()=>{v(),a.abort(),n.signal?.removeEventListener("abort",s),V&&(window.clearTimeout(V),V=0),F(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},z=()=>{if(_)return;_=!0,c.style.opacity="0";let G=()=>{V=0,!k&&(B(),n.onClose?.())};V=window.setTimeout(G,o)},U=G=>{if(G.key==="Tab"){G.preventDefault(),m.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),z();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")p+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(f/180);else if(G.key==="+"||G.key==="="){D(y-5),G.preventDefault();return}else if(G.key==="-"){D(y+5),G.preventDefault();return}else return;G.preventDefault(),w()};return window.addEventListener("keydown",U),m.addEventListener("click",z),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:z,dispose(){_=!0,k=!0,B()}}}var Io,Jp,eb,Qe,Co=on(()=>{"use strict";Nr();Io=70,Jp=35,eb=90;Qe=35});function sb(e=rb,t=ib,n=ab){let o=e+1,r=t+1,i=o*r,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let l=0;l<r;l++){let m=l/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=l*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),u=0;for(let l=0;l<t;l++)for(let m=0;m<e;m++){let h=l*o+m,d=h+o;c[u++]=h,c[u++]=d,c[u++]=h+1,c[u++]=h+1,c[u++]=d,c[u++]=d+1}return{position:a,uv:s,index:c}}function fl(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 dl(e,t){let{position:n,uv:o,index:r}=sb(),i=new xt.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:r}}),a=new xt.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new xt.Program(e,{vertex:cb,fragment:lb,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new xt.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var xt,rb,ib,ab,cb,lb,hl=on(()=>{"use strict";xt=require("ogl"),rb=64,ib=32,ab=500;cb=`#version 300 es
1
+ "use strict";var vu=Object.create;var Bn=Object.defineProperty;var Mu=Object.getOwnPropertyDescriptor;var Su=Object.getOwnPropertyNames;var wu=Object.getPrototypeOf,Pu=Object.prototype.hasOwnProperty;var rn=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var ui=(e,t)=>{for(var n in t)Bn(e,n,{get:t[n],enumerable:!0})},mi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Su(t))!Pu.call(e,r)&&r!==n&&Bn(e,r,{get:()=>t[r],enumerable:!(o=Mu(t,r))||o.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?vu(wu(e)):{},mi(t||!e||!e.__esModule?Bn(n,"default",{value:e,enumerable:!0}):n,e)),Iu=e=>mi(Bn({},"__esModule",{value:!0}),e);function Jb(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function ey(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Ao(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:ey(t?.deviceMemory)}}function Co(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,u)=>c.width*c.height-u.width*u.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||Jb(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 Dl(){return new DOMException("Panorama image load aborted","AbortError")}function Tn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(Dl());return}let r=new Image;r.crossOrigin="anonymous";let i=!1,a=()=>{r.onload=null,r.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?o(u):n(r))},c=()=>{r.src="",s(Dl())};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 Eo(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 qr=rn(()=>{"use strict"});function Bl(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":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 $r(e){return Math.max(ty,Math.min(ny,e))}function oy(e,t,n){let o=(.5+e/360)*n;return t/2-o}function ry(e,t=To){return e*(180/t)}function Ol(e,t,n){return(e-t)/2+_o(n,t)}function _o(e,t){let n=et/180*t;return Math.max(-n,Math.min(n,e))}function iy(){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 Zr(e){return e||(iy()?"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 Nl(e,t,n={}){let o=n.fadeMs??400,r=t.initialBearingDeg??0,i=Co(t,Ao()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=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("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(l);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 N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.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)"}),c.appendChild(N)}let h=document.createElement("div");h.textContent=Zr(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=To,g=()=>{let N=c.clientHeight||1,z=c.clientWidth||1,K=R.naturalWidth||z*2,J=R.naturalHeight||N,Y=d>0?(z/2-p)/d:0,W=f>0?b/f:0;f=ry(N,y),d=f*(K/J),l.style.backgroundSize=`${d}px ${f}px`,M?p=z/2-Y*d:(p=oy(r,z,d),b=_o((t.initialPitchDeg??0)/180*f,f),M=!0),b=_o(W*f,f),l.style.backgroundPosition=`${p}px ${Ol(N,f,b)}px`},M=!1,v=()=>{let N=c.clientHeight||1;b=_o(b,f),l.style.backgroundPosition=`${p}px ${Ol(N,f,b)}px`},R=new Image;R.onload=g,R.src=i.initialUrl;let P=()=>{};i.upgradeUrl&&(P=Eo(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(z=>!z||a.signal.aborted?null:Tn(z,a.signal).then(K=>({full:K,url:z}))).then(z=>{z&&(k||a.signal.aborted||(R=z.full,l.style.backgroundImage=`url("${z.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let x=!1,S=0,w=0,I=0,L=new Map,O=()=>{let[N,z]=[...L.values()];return N&&z?Math.hypot(N.x-z.x,N.y-z.y):0},D=N=>{let z=$r(N);z!==y&&(y=z,g())},A=N=>{L.set(N.pointerId,{x:N.clientX,y:N.clientY}),x=L.size===1,S=N.clientX,w=N.clientY,L.size===2&&(I=O()),l.style.cursor="grabbing";try{l.setPointerCapture?.(N.pointerId)}catch{}},E=N=>{if(L.has(N.pointerId)){if(L.set(N.pointerId,{x:N.clientX,y:N.clientY}),L.size>=2){let z=O();I>0&&z>0&&D(y*(I/z)),I=z,x=!1;return}x&&(p+=N.clientX-S,b+=N.clientY-w,S=N.clientX,w=N.clientY,v())}},T=N=>{L.delete(N.pointerId),I=L.size===2?O():0;let z=L.values().next().value;x=L.size===1,z?(S=z.x,w=z.y):l.style.cursor="grab";try{l.releasePointerCapture?.(N.pointerId)}catch{}},V=N=>{N.preventDefault(),D(y+N.deltaY*.04)};l.addEventListener("pointerdown",A),l.addEventListener("pointermove",E),l.addEventListener("pointerup",T),l.addEventListener("pointercancel",T),l.addEventListener("wheel",V,{passive:!1});let _=!1,k=!1,H=0,B=()=>{l.removeEventListener("pointerdown",A),l.removeEventListener("pointermove",E),l.removeEventListener("pointerup",T),l.removeEventListener("pointercancel",T),l.removeEventListener("wheel",V),window.removeEventListener("keydown",j)},F=()=>{P(),a.abort(),n.signal?.removeEventListener("abort",s),H&&(window.clearTimeout(H),H=0),B(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},G=()=>{if(_)return;_=!0,c.style.opacity="0";let N=()=>{H=0,!k&&(F(),n.onClose?.())};H=window.setTimeout(N,o)},j=N=>{if(N.key==="Tab"){N.preventDefault(),m.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),G();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")p+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")b+=(N.key==="ArrowUp"?4:-4)*(f/180);else if(N.key==="+"||N.key==="="){D(y-5),N.preventDefault();return}else if(N.key==="-"){D(y+5),N.preventDefault();return}else return;N.preventDefault(),v()};return window.addEventListener("keydown",j),m.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){_=!0,k=!0,F()}}}var To,ty,ny,et,ko=rn(()=>{"use strict";qr();To=70,ty=35,ny=90;et=35});function ly(e=ay,t=sy,n=cy){let o=e+1,r=t+1,i=o*r,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let l=0;l<r;l++){let m=l/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=l*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),u=0;for(let l=0;l<t;l++)for(let m=0;m<e;m++){let h=l*o+m,d=h+o;c[u++]=h,c[u++]=d,c[u++]=h+1,c[u++]=h+1,c[u++]=d,c[u++]=d+1}return{position:a,uv:s,index:c}}function Vl(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 Gl(e,t){let{position:n,uv:o,index:r}=ly(),i=new St.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:r}}),a=new St.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new St.Program(e,{vertex:uy,fragment:my,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new St.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var St,ay,sy,cy,uy,my,Hl=rn(()=>{"use strict";St=require("ogl"),ay=64,sy=32,cy=500;uy=`#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
- }`,lb=`#version 300 es
11
+ }`,my=`#version 300 es
12
12
  precision highp float;
13
13
  in vec2 vUv;
14
14
  uniform sampler2D uPano;
@@ -17,15 +17,43 @@ out vec4 fragColor;
17
17
  void main() {
18
18
  vec3 rgb = texture(uPano, vUv).rgb;
19
19
  fragColor = vec4(rgb, uOpacity);
20
- }`});async function bl(e,t,n,o={}){let r=o.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Qe,Math.min(Qe,t?.initialPitchDeg??0)),s=Io,c=!1,u=new AbortController,l=()=>u.abort();o.signal?.addEventListener("abort",l,{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 F=n.camera.position,B=n.focalWorld[0]-F.x,z=n.focalWorld[1]-F.y,U=n.focalWorld[2]-F.z,G=Math.hypot(B,U);G>.001&&(i=Math.atan2(B,-U)*180/Math.PI,a=Math.max(-Qe,Math.min(Qe,Math.atan2(z,G)*180/Math.PI)))}let d=null;if(t){let F=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),B=So(t,Mo(F)),z;try{let U=t.resolveUrl?await t.resolveUrl(B.initialUrl):B.initialUrl;if(!U)throw new Error("panorama_asset_unavailable");z=await Rn(U,u.signal)}catch{return o.signal?.removeEventListener("abort",l),null}try{d=dl(n.gl,z)}catch{return u.abort(),o.signal?.removeEventListener("abort",l),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),B.upgradeUrl&&(m=wo(()=>{(t.resolveUrl?t.resolveUrl(B.upgradeUrl):Promise.resolve(B.upgradeUrl)).then(G=>!G||u.signal.aborted?null:Rn(G,u.signal)).then(G=>{G&&(c||u.signal.aborted||(d?.setImage(G),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 F=n.camera.position;d?.mesh.position.set(F.x,F.y,F.z);let[B,z,U]=fl(i,a);n.camera.lookAt([F.x+B,F.y+z,F.z+U]),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 x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(x),o.disclosure){let F=document.createElement("div");F.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.disclosure}`,Object.assign(F.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(F)}let w=document.createElement("div");w.textContent=Gr(o.lookAroundHint),Object.assign(w.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(w),e.appendChild(y),x.focus({preventScroll:!0});let I=!1,v=0,P=0,S=0,M=new Map,C=()=>{let[F,B]=[...M.values()];return F&&B?Math.hypot(F.x-B.x,F.y-B.y):0},T=F=>{let B=Vr(F);B!==s&&(s=B,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},N=F=>{F.target!==x&&(M.set(F.pointerId,{x:F.clientX,y:F.clientY}),I=M.size===1,v=F.clientX,P=F.clientY,M.size===2&&(S=C()),y.setPointerCapture?.(F.pointerId),y.style.cursor="grabbing")},D=F=>{if(M.has(F.pointerId)){if(M.set(F.pointerId,{x:F.clientX,y:F.clientY}),M.size>=2){let B=C();S>0&&B>0&&T(s*(S/B)),S=B,I=!1;return}I&&(i+=(F.clientX-v)*pl,a=Math.max(-Qe,Math.min(Qe,a+(F.clientY-P)*pl)),v=F.clientX,P=F.clientY,b())}},R=F=>{M.delete(F.pointerId),S=M.size===2?C():0;let B=M.values().next().value;I=M.size===1,B?(v=B.x,P=B.y):y.style.cursor="grab";try{y.releasePointerCapture?.(F.pointerId)}catch{}},A=F=>{F.preventDefault(),T(s+F.deltaY*.04)};y.addEventListener("pointerdown",N),y.addEventListener("pointermove",D),y.addEventListener("pointerup",R),y.addEventListener("pointercancel",R),y.addEventListener("wheel",A,{passive:!1});let L=F=>{if(!c){if(F.key==="Tab"){F.preventDefault(),x.focus({preventScroll:!0});return}if(F.key==="Escape"){F.stopPropagation(),V.close();return}if(F.key==="ArrowLeft"||F.key==="ArrowRight")i+=F.key==="ArrowLeft"?-4:4;else if(F.key==="ArrowUp"||F.key==="ArrowDown")a=Math.max(-Qe,Math.min(Qe,a+(F.key==="ArrowUp"?4:-4)));else if(F.key==="+"||F.key==="="){T(s-5),F.preventDefault();return}else if(F.key==="-"){T(s+5),F.preventDefault();return}else return;F.preventDefault(),b()}};window.addEventListener("keydown",L);let O=0,_=(F,B)=>{if(!d){B?.();return}let z=F===1?0:1,U=performance.now(),G=()=>{if(c)return;let H=r<=0?1:Math.min(1,(performance.now()-U)/r);d?.setOpacity(z+(F-z)*H),n.requestRender(),H<1?O=requestAnimationFrame(G):B?.()};O=requestAnimationFrame(G)};_(1);let k=()=>{c||(c=!0,m(),u.abort(),o.signal?.removeEventListener("abort",l),cancelAnimationFrame(O),y.removeEventListener("pointerdown",N),y.removeEventListener("pointermove",D),y.removeEventListener("pointerup",R),y.removeEventListener("pointercancel",R),y.removeEventListener("wheel",A),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())},V={close(){if(c)return;let F=()=>{k(),o.onClose?.()};cancelAnimationFrame(O),_(0,F)},dispose:k};return x.addEventListener("click",()=>V.close()),V}var pl,yl=on(()=>{"use strict";hl();Co();Co();Nr();pl=.15});var gl={};Kr(gl,{createOpenPanorama:()=>ub});function ub(e){let{container:t,model:n,opts:o,analytics:r,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:l,gl:m,isContextLost:h,isDisposed:d,flightGen:f,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:w,restorePanoramaLayer:I,getOverviewChip:v,labelOverlay:P,reducedMotion:S,removeArriveChip:M,showArriveChip:C}=e;return async(T,N,D)=>{b()?.abort();let R=new AbortController;y(R);let A=n.seats.idToIndex.get(T);if(A===void 0){i.syncFromCamera();return}let L=s.get(T)?.label??T,O=u(T,A),_=c(T);if(!_){R.abort(),b()===R&&y(null),i.syncFromCamera();return}x(!0),a.stop();let k;try{k=await _}catch{if(b()===R&&y(null),r.panoramaFailed(T,"source"),!d()&&D===f()){x(!1),i.resumeAfterFlight(O.focal),a.requestRender();let K=C(T,D,!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||D!==f()){R.abort(),b()===R&&y(null);return}M();let V=v(),F=()=>{R.abort(),b()===R&&y(null),p(null),g(!1),I(),V.style.display="",P.setVisible(!o.arriveAtSeatEye),x(!1),r.panoramaClosed(),i.resumeAfterFlight(O.focal),a.requestRender();let K=C(T,f());requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())},B=k.generated===!0,z=ul(k);w(),g(!B),V.style.display="none";let U=S()?0:N,G=l(),H=G&&!h()?await bl(t,B?null:k,{gl:m,scene:G.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:B?O.eye:void 0,focalWorld:O.focal},{fadeMs:U,seatLabel:L,disclosure:z,disclosurePrefix:B?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:F,signal:R.signal}):null;if(d()||D!==f()){R.abort(),g(!1),b()===R&&y(null),H?.dispose(),V.style.display="",I();return}if(H)i.syncFromCamera(),P.setVisible(!1),x(!1),a.requestRender(),p(H);else if(B){I(),V.style.display="",x(!1),i.resumeAfterFlight(O.focal),a.requestRender(),p(null),g(!1),r.panoramaFailed(T,"mount");let K=C(T,f(),!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus()),b()===R&&y(null);return}else g(!1),r.panoramaFallback(T),p(ml(t,k,{fadeMs:U,seatLabel:L,disclosure:z,onClose:F,signal:R.signal,lookAroundHint:o.lookAroundHint}));r.panoramaOpened()}}var xl=on(()=>{"use strict";Co();yl()});var vb={};Kr(vb,{VENUE3D_QUALITY_REPORT_VERSION:()=>dc,autoVenue3d:()=>lo,buildSceneModel:()=>Kt,estimateVenue3D:()=>An,inspectVenue3DQualityEvidence:()=>ho,mountVenue3D:()=>xb,prepareVenue3D:()=>Fl,prepareVenue3DFromChart:()=>Dl});module.exports=$l(vb);function $r(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)),u=0,l=0,m=0;for(let h=0;h<o;h+=c)u+=t[h*3],l+=t[h*3+2],m++;r=u/m,i=l/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 ye={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Zl=.44,Ql=.15,Zr=.3,Jl=.24;function Qr(e){return e===void 0||!Number.isFinite(e)||e<=0?Jl:Math.min(Zr,Math.max(Ql,e*Zl))}var an=.21,eu=.05,Oo=.45,ut=Oo+eu,sn=.92,rn=.66,Bo=1.205,Jr=-.23,ei=.38,tu=[{part:ye.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ye.pad,min:[-1,.36,-.95],max:[1,Oo,1]},{part:ye.back,min:[-1,ut,-1],max:[1,sn,-.72]},{part:ye.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ye.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ye.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ye.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ye.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ye.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ye.leg,min:[.62,0,.48],max:[.82,.37,.7]}],nu=[{part:ye.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ye.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ye.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ye.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ye.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ou=[{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,O,_)=>{let k=n.length,[V,F,B]=L,z=[F[0]-V[0],F[1]-V[1],F[2]-V[2]],U=[B[0]-V[0],B[1]-V[1],B[2]-V[2]],G=z[1]*U[2]-z[2]*U[1],H=z[2]*U[0]-z[0]*U[2],K=z[0]*U[1]-z[1]*U[0],Q=Math.hypot(G,H,K);Q>1e-9?(G/=Q,H/=Q,K/=Q):[G,H,K]=O,G*O[0]+H*O[1]+K*O[2]<0&&(G=-G,H=-H,K=-K);for(let Y of L)e.push(...Y),t.push(G,H,K),n.push(_);o.push(k,k+1,k+2,k,k+2,k+3)},i=L=>{for(let O of ou){let _=O.c.map(k=>k.map((V,F)=>V?L.max[F]:L.min[F]));r(_,O.n,L.part)}},a=(L,O)=>{let[_,k,V]=O?[0,1,2]:[0,2,1],F=L.min[_],B=L.max[_],z=L.min[k],U=L.max[k],G=(B-F)*.1,H=(U-z)*.1,K=O?[[F+G,z],[B-G,z],[B,z+H],[B*.94,U-(U-z)*.23],[B*rn,U],[F*rn,U],[F*.94,U-(U-z)*.23],[F,z+H]]:[[F+G,z],[B-G,z],[B,z+H],[B,U-H],[B-G,U],[F+G,U],[F,U-H],[F,z+H]],Q=(W,Z,ee)=>{let q=[0,0,0];return q[_]=W,q[k]=Z,q[V]=ee,q},Y=[L.min[V],L.max[V]].map(W=>K.map(([Z,ee])=>Q(Z,ee,W)));for(let W=0;W<K.length;W++){let Z=(W+1)%K.length,ee=[0,0,0];ee[_]=(K[W][0]+K[Z][0])/2-(F+B)/2,ee[k]=(K[W][1]+K[Z][1])/2-(z+U)/2,r([Y[0][W],Y[0][Z],Y[1][Z],Y[1][W]],ee,L.part)}for(let W=0;W<2;W++){let Z=[0,0,0];Z[V]=W?1:-1;let ee=Y[W];for(let q=1;q<ee.length-1;q++){let oe=n.length;for(let te of[ee[0],ee[q],ee[q+1]])e.push(...te),t.push(...Z),n.push(L.part);o.push(oe,oe+1,oe+2)}}};for(let L of tu)L.part===ye.pad||L.part===ye.back?a(L,L.part===ye.back):i(L);for(let L of nu)i(L);let s=Oo,c=1.08,u=.47,l=.69,m=-.55,h=.08,d=-.48,f=.01,p=[-u,s,m],b=[u,s,m],y=[-u,s,h],g=[u,s,h],x=[-l,c,d],w=[l,c,d],I=[-l,c,f],v=[l,c,f];r([b,w,v,g],[1,0,0],ye.body),r([y,I,x,p],[-1,0,0],ye.body),r([I,v,w,x],[0,1,0],ye.body),r([p,b,g,y],[0,-1,0],ye.body),r([g,v,I,y],[0,0,1],ye.body),r([p,x,w,b],[0,0,-1],ye.body);let P=10,S=8,M=[0,Bo,Jr],C=[.42,.115,ei],T=n.length;for(let L=0;L<=S;L++){let O=Math.PI*L/S,_=Math.cos(O),k=Math.sin(O);for(let V=0;V<=P;V++){let F=Math.PI*2*V/P,B=k*Math.cos(F),z=k*Math.sin(F);e.push(M[0]+C[0]*B,M[1]+C[1]*_,M[2]+C[2]*z);let U=B/C[0],G=_/C[1],H=z/C[2],K=Math.hypot(U,G,H)||1;U/=K,G/=K,H/=K,t.push(U,G,H),n.push(ye.head)}}for(let L=0;L<S;L++)for(let O=0;O<P;O++){let _=T+L*(P+1)+O,k=_+P+1;o.push(_,k,_+1,_+1,k,k+1)}let N=new Float32Array(e),D=new Float32Array(t),R=new Float32Array(n),A=new Uint16Array(o);return{position:N,normal:D,part:R,index:A,vertexCount:n.length,indexCount:o.length}}function ni(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,l)=>{let m=l-u;for(let h=u;h<l;h++){let[d,f]=o(h),p=d-i(h),b=f-a(h);if(m>=2){let y=Math.max(u,h-1),g=Math.min(l-1,h+1),x=i(g)-i(y),w=a(g)-a(y),I=Math.hypot(x,w);if(I>1e-6){let v=-w/I,P=x/I;v*p+P*b<0&&(v=-v,P=-P),p=v,b=P}}r[h]=p===0&&b===0?0:Math.atan2(p,b)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return r}var No=78,oi=18;function ri(){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,ut,-1],max:[1,sn,-.72]}])for(let c of i){let u=e.length/3,l=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-rn)/(sn-ut):0),m=Math.hypot(c.n[0],l,c.n[2]),h=[c.n[0]/m,l/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-rn)),e.push(...p),t.push(...h),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][d])}r.push(u,u+1,u+2,u,u+2,u+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 ui=require("ogl");var ru=/^#?([\da-f]{3}|[\da-f]{6})$/i;function ii(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 iu(e){let t=ru.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 me(e){let t=iu(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Vo(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function au(e){return .2126*Vo(e[0])+.7152*Vo(e[1])+.0722*Vo(e[2])}function ai(e){return au([e[0]*255,e[1]*255,e[2]*255])}function su(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function de(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 Xe(e,t){let n=su(e);return de(e,[n,n,n],t)}function si({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 u=a-s,l=c>.5?u/(2-a-s):u/(a+s),m;return a===o?m=((r-i)/u+(r<i?6:0))/6:a===r?m=((i-o)/u+2)/6:m=((o-r)/u+4)/6,{h:m,s:l,l:c}}var Ae=["available","held","sold","selected","dimmed"];function cn(e){let t=Ae.indexOf(e);return t<0?0:t}var ci={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function li(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 Go={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]},It={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 cu(){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 Fn=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 ui.Renderer({canvas:this.canvas,dpr:cu(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[It.top[0],It.top[1],It.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 Ft=require("ogl"),Ee=Math.PI/180,Ho=15*Ee,zo=80*Ee,Lt=.12,mi=35,fi=1.25,di=.006,lu=4,Dt=.82,ln=1/Dt,uu=.12,mu=2;function fu(e,t){return{azimuth:e*di,polar:-t*di}}function du(e,t,n){let o=Math.max(mu,Math.max(1,t)*uu),r=n*lu;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,r):r}}var hu=1.5;function pu(e,t,n){let o=Math.max(1,n)*hu;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)}}var Dn=class{constructor(t,n,o,r){this.fovY=mi;this.target=new Ft.Vec3;this.azimuth=-30*Ee;this.polar=55*Ee;this.distance=10;this.azT=-30*Ee;this.polT=55*Ee;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 Ft.Vec3;this.panAnchor=new Ft.Vec3;this.panLimit=0;this.panBox=null;this.primaryDragMode="orbit";this.camera=new Ft.Camera(t,{fov:mi,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.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=fu(a,s);this.azT+=c.azimuth,this.polT=Math.max(Ho,Math.min(zo,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.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*Ee;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(Ho,Math.min(zo,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(Dt);else if(i.key==="-"||i.key==="_")this.dollyBy(ln);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*Ee/2)/o,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),l=Math.sin(this.polar),m=-i*u,h=-a*u;this.targetT.x+=(-t*s+n*m)*r,this.targetT.z+=(-t*c+n*h)*r,this.targetT.y+=n*l*r,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=pu(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()}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*Ee/2,c=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=o??-30*Ee,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*Ee;let l=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,i?.margin??fi)),this.envelope=du(this.envelope,a,l),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*Ee,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})}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*Ee/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))*Ee;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,r?.margin??fi))}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 u=Math.sin(i),l=-u*Math.sin(r),m=-Math.cos(i),h=-u*Math.cos(r);if(Math.abs(m)>.999)return s;let d=-h,f=l,p=Math.hypot(d,f);d/=p,f/=p;let b=-f*m,y=f*l-d*h,g=d*m,x=Math.tan(o),w=Math.tan(n),I=1;for(let v=0;v<8;v++){let P=(v&1?c.max[0]:c.min[0])-t.center[0],S=(v&2?c.max[1]:c.min[1])-t.center[1],M=(v&4?c.max[2]:c.min[2])-t.center[2],C=P*l+S*m+M*h,T=Math.abs(P*d+M*f),N=Math.abs(P*b+S*y+M*g);I=Math.max(I,T/x-C,N/w-C)}return Math.min(s,Math.max(I,a*.35))}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}=gu(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*Lt,this.polar+=n*Lt,this.distance+=o*Lt,this.target.x+=r*Lt,this.target.y+=i*Lt,this.target.z+=a*Lt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,r=Math.hypot(t,n,o)||1,i=Math.max(Ho,Math.min(zo,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()}},bu=.1,yu=.25;function gu(e,t,n){let o=Math.max(1,t)*1.18,r=n==null?yu:Math.max(.05,n*bu),i=Math.max(r,e-o),a=Math.max(i+10,e+o);return{near:i,far:a}}var On=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 hi(e,t,n){return Math.max(t,Math.min(n,e))}var Ot=2.5,xu=1.15,un=12,Bt=22,pi=6,bi=9.5,yi=.9,gi=2.2,Uo=30,jo=4,Bn=8192;var Fb=Bt+jo;function xi(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Ot};let r=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-r*.4,fade:r*.55,minPixels:Ot+r*(xu-Ot)}}function vi(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function Mi(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>=64}var vu=[{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"}],Ob=new Map(vu.map(e=>[e.key,e]));var Mu={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 Si(e){let t=e?.[0];return t&&Mu[t]||"#3b82f6"}var Su=[{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"}],Bb=new Map(Su.map(e=>[e.key,e]));var wu=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Nb=new Set(wu);var Pi=[{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}}],Ii=Pi.map(e=>e.key),Pu=new Map(Pi.map(e=>[e.key,e]));function wi(e){return typeof e=="string"&&Pu.has(e)}function Ci(e,t){return wi(e)?e:wi(t?.seatGlyph)?t.seatGlyph:"circle"}var le=.02291666666666667,Ve=1/le,Iu=58,Cu=Iu*le;var Ru=3,Ri=0,Xo=120,Au=0,Eu=45,_u=7,We=1.2;function Wo(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Tu(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=_u?e:Ru}function mt(e,t={}){let n=Wo(t.floorBaseHeightM,Ri,Xo,0),o=Math.min(Xo,n+Tu(e.elevation)*Cu),r=e.height===void 0?o:Wo(e.height,Ri,Xo,o),i=Wo(e.rake,Au,Eu,0);return{height:r,rake:i}}var Ei=lt(require("earcut"),1),Ko=lt(require("polygon-clipping"),1);var jb=Math.PI/180;function Yo(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 mn(e){return e.length?Yo(e):null}function Le(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 Fe(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=le,ku=.002;function Lu(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<ku}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)}},Gn=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){Lu(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,u=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(u[0],u[1],u[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 Fu(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],u=r*c-i*s,l=i*a-o*c,m=o*s-r*a,h=Math.hypot(u,l,m)||1;return u/=h,l/=h,m/=h,[u,l,m]}function Du(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,Ei.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Ye(e){return Le(e)<0?[...e].reverse():e}var Ou=3;function Bu(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,u=(e.y+t.y+n.y)/3,l=(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:u})-l)),h=(d,f,p)=>{let b=Math.abs(o({x:(d+c)/2,y:(f+u)/2})-(p+l)/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 fn(e,t,n,o,r){if(r<=0)return Bu(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(fn(e,i,s,o,r-1),fn(i,t,a,o,r-1),fn(s,a,n,o,r-1),fn(i,a,s,o,r-1))}function dn(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};dn(e,t,h,f,r,i,a-1,s),dn(e,h,n,d,r,i,a-1,s),dn(e,f,d,o,r,i,a-1,s),dn(e,h,d,f,r,i,a-1,s);return}let c=[t.x*E,r(t),t.y*E],u=[n.x*E,r(n),n.y*E],l=[o.x*E,r(o),o.y*E];if(s){e.triN(c,u,l,s(t),s(n),s(o),i);return}let m=Fu(c,u,l);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,u,l,m,i)}var Nu=8;function Ai(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,a,s,c,u)=>{if(u>0){let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=t(l);if(Math.abs(m-(s+c)/2)>n){r(i,l,s,m,u-1),r(l,a,m,c,u-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),Nu)}return o}function Nn(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,u=s.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/l<t||o.push(a)}return o.length>=3?o:n}var Vn=.001*Ve*.1;function ae(e,t,n,o,r,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Le(t))<1e-4))return;let l=Nn(Ai(Nn(Ye(t),Vn),o,c),Vn),m=n?.map(v=>Nn(Ai(Nn(Ye(v),Vn),o,c),Vn)).filter(v=>v.length>=3&&Math.abs(Le(v))>=1e-4),{pts:h,tris:d}=Du(l,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<Ou;g++){let v=0;for(let P=0;P<d.length;P+=3){let S=fn(h[d[P]],h[d[P+1]],h[d[P+2]],o,g);S>v&&(v=S)}if(v<=c)break}for(let v=0;v<d.length;v+=3){let P=h[d[v]],S=h[d[v+1]],M=h[d[v+2]];dn(e,P,S,M,o,f,g,u);let C=[P.x*E,r,P.y*E],T=[S.x*E,r,S.y*E],N=[M.x*E,r,M.y*E];e.tri(C,N,T,[0,-1,0],p)}let x=v=>{if(g<=0)return v;let P=1<<g,S=[];for(let M=0;M<v.length;M++){let C=v[M],T=v[(M+1)%v.length];for(let N=0;N<P;N++){let D=N/P;S.push({x:C.x+(T.x-C.x)*D,y:C.y+(T.y-C.y)*D})}}return S},w=Yo(l),I=[{ring:x(l),flip:!1}];if(m)for(let v of m)v.length>=3&&I.push({ring:x(v),flip:!0});for(let{ring:v,flip:P}of I)for(let S=0;S<v.length;S++){let M=v[S],C=v[(S+1)%v.length],T=(C.x-M.x)*E,D=(C.y-M.y)*E,R=-T,A=Math.hypot(D,R)||1;D/=A,R/=A;let L=(M.x+C.x)/2-w.x,O=(M.y+C.y)/2-w.y,_=D*L+R*O;P&&(_=-_),_<0&&(D=-D,R=-R);let k=[D,0,R],V=[M.x*E,o(M),M.y*E],F=[C.x*E,o(C),C.y*E],B=[M.x*E,r,M.y*E],z=[C.x*E,r,C.y*E];e.tri(V,F,z,k,b,b,y),e.tri(V,z,B,k,b,y,y)}}function _i(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 Ue(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Ye(e),r=o.length,i=[];for(let s=0;s<r;s++){let c=o[s],u=o[(s+1)%r],l=u.x-c.x,m=u.y-c.y,h=Math.hypot(l,m)||1;i.push({x:m/h,y:-l/h})}let a=[];for(let s=0;s<r;s++){let c=o[s],u=i[(s-1+r)%r],l=i[s],m=u.x+l.x,h=u.y+l.y,d=Math.hypot(m,h),f=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+l.x*t,c.y+l.y*t])};if(d<1e-9){f();continue}m/=d,h/=d;let p=m*u.x+h*u.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=Ko.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let m of s){let h=Math.abs(Le(m[0].map(([d,f])=>({x:d,y:f}))));h>u&&(u=h,c=m[0])}if(!c)return e;let l=c.map(([m,h])=>({x:m,y:h}));if(l.length>1){let m=l[0],h=l[l.length-1];Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Rt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=Ye(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],m=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/m,y:(l.x-u.x)/m})}let a=[],s=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],m=i[c],h=l.x+m.x,d=l.y+m.y,f=Math.hypot(h,d),p=f<1e-9?1/0:1/Math.max(h/f*l.x+d/f*l.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+m.x*t,y:u.y+m.y*t}),s.push(c,c);continue}h/=f,d/=f,a.push({x:u.x+h*t*p,y:u.y+d*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let u=(c+1)%a.length,l=s[c],m=s[u];if(m!==(l+1)%r)continue;let h=o[l],d=o[m];if((a[u].x-a[c].x)*(d.x-h.x)+(a[u].y-a[c].y)*(d.y-h.y)<=0)return[]}try{let c=Ko.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]]]),u=null,l=0;for(let f of c){let p=Math.abs(Le(f[0].map(([b,y])=>({x:b,y}))));p>l&&(l=p,u=f[0])}if(!u)return[];let m=u.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?Ye(m):[]}catch{return[]}}function Hn(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 hn(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 et=.22;function Ti(e,t){let n=Ae[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 Vu=.42;function Gu(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),u=Math.max(Math.sqrt(s*c/t),1e-6),l=Math.max(1,Math.ceil(s/u)+1),m=Math.max(1,Math.ceil(c/u)+1),h=new Map,d=(f,p)=>{let b=Math.min(l-1,Math.max(0,Math.floor((f-o)/u)));return Math.min(m-1,Math.max(0,Math.floor((p-r)/u)))*l+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(l-1,Math.max(0,Math.floor((p.x-o)/u))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-r)/u))),g=1/0;for(let x=1;x<=4;x++){for(let w=y-x;w<=y+x;w++)if(!(w<0||w>=m))for(let I=b-x;I<=b+x;I++){if(I<0||I>=l||x>1&&Math.abs(w-y)<x&&Math.abs(I-b)<x)continue;let v=h.get(w*l+I);if(v)for(let P of v){if(P===f)continue;let S=Math.hypot(e[P].x-p.x,e[P].y-p.y);S<g&&(g=S)}}if(Number.isFinite(g)&&g<=x*u)break}n[f]=g}return n}function Hu(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-We):0}function ki(e,t,n,o,r,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),l=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a*3),p=new Map,b=Gu(e);for(let y=0;y<a;y++){let g=e[y],w=(n?.seatPitchU(y)??b[y])*E;l[y]=Number.isFinite(w)?Math.max(.06,Math.min(et,w*Vu)):et,m[y]=Qr(Number.isFinite(w)?w:void 0);let I=Ci(g.glyph,{seatGlyph:i?.get(g.categoryKey)});h[y]=Ii.indexOf(I),d[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*E,s[y*3+1]=n?n.seatDeckY(y):Hu(g),s[y*3+2]=g.y*E,c[y]=cn(t?t(g):"available");let v=me(r?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=v[0],u[y*3+1]=v[1],u[y*3+2]=v[2],g.accessibility?.length){let P=me(Si(g.accessibility));P&&(f[y*3]=P[0],f[y*3+1]=P[1],f[y*3+2]=P[2])}p.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:l,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 zu=64;function qo(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=cn(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+zu){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 pn=3,At=.38,bn=.24;function Uu(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 u=r*r+i*i,l=a*a+s*s,m=(u*s-l*i)/c+t.x*E,h=(r*l-a*u)/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 Li(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/pn)},${Math.floor(u/pn)}`;for(let c of e)for(let u of c.rows){for(let m of u.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:u.y,floor:c.floorIndex}),n.set(f,p)}if(u.patch||u.pts.length<2)continue;let l=Uu(u.pts);for(let m of[0,u.pts.length-1]){let h=u.pts[m],d=u.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:l,row:u,point:h,x:h.x*E,z:h.y*E,dx:f/b,dz:p/b})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),m=r.get(l)??[];m.push(u),r.set(l,m)});let i=(c,u)=>{let l=Math.floor(c/pn),m=Math.floor(u/pn);return[-1,0,1].flatMap(h=>[-1,0,1].map(d=>`${l+h},${m+d}`))},a=new Map;t.forEach((c,u)=>{let l=-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<At*2+.45||g>pn)continue;let x=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,w=Math.min((b*c.dx+y*c.dz)/g,(-b*p.dx-y*p.dz)/g);(x?w<.8:w<.98)||!x&&(Math.abs(b*c.dz-y*c.dx)>.15||Math.abs(b*p.dz-y*p.dx)>.15)||(g<m-.02?(l=f,m=g,h=!1):Math.abs(g-m)<=.02&&(h=!0))}l>=0&&!h&&a.set(u,l)});let s=[];for(let[c,u]of a){if(c>=u||a.get(u)!==c)continue;let l=t[c],m=t[u],h=Math.hypot(m.x-l.x,m.z-l.z),d=(m.x-l.x)/h,f=(m.z-l.z)/h,p=!1;for(let y of i((l.x+m.x)/2,(l.z+m.z)/2))for(let g of n.get(y)??[]){if(g.floor!==l.floorIndex||Math.abs(g.y-l.row.y)>.75)continue;let x=(g.x-l.x)*d+(g.z-l.z)*f,w=Math.abs((g.x-l.x)*f-(g.z-l.z)*d);x>.01&&x<h-.01&&w<bn+At&&(p=!0)}if(p)continue;let b=(y,g)=>({x:(l.x+d*y-f*g)/E,y:(l.z+f*y+d*g)/E});s.push({sections:[l.sectionId,m.sectionId],blocks:[l.row.blockId,m.row.blockId],floorIndex:l.floorIndex,ends:[l.point,m.point],clearWidthM:h-2*At,heightM:(l.row.y+m.row.y)/2,outline:[b(At,-bn),b(h-At,-bn),b(h-At,bn),b(At,bn)]})}return s}var ju=.15,Xu=1.6;function Fi(e){return hi(e??1,ju,Xu)}var Wu=.15,Yu=.9,Ku=1.76;function qu(){return{background:{top:[...It.top],bottom:[...It.bottom]},structure:Go,seatStates:{...ci},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function $u(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 Di(e){let t=qu();e??={};let n=me(e.background);if(n){t.background={top:ie(n,Yu),bottom:ie(n,Ku)};let s={};for(let[u,l]of Object.entries(Go))s[u]=de(l,n,Wu);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(s.ground=ie(n,.86)),t.structure=s}let o=me(e.selectionColor)??me(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Fi(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,s])=>s!=null)),a={...$u(n),...i};if(a){let s=me(a.deck),c=me(a.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=me(a.seat),t.materials.shell=me(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return t}function Oi(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function Bi(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 Ni(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[Bi(e,.5)];let o=Array.from({length:n+1},(c,u)=>Bi(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}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 u=i*c/(t-1);for(;s<r.length-1&&r[s]<u;)s+=1;let l=r[s-1],m=r[s],h=m===l?0:(u-l)/(m-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 Vi(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 u=i.reduce((h,d)=>h+d.seatCount,0),l=0,m=0;for(let h of i)h.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(h.id,{groupId:o,adjacencyOffset:l,displayOffset:m,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),l+=h.seatCount,m+=h.seatCount}return t}var Zu="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Qu="abcdefghijklmnopqrstuvwxyz";function Ju(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 $o(e,t=!1){let n=t?Qu:Zu;return Ju(Math.max(0,Math.floor(e)-1),n)}var em=[[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 Gi(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of em)for(;t>=o;)n+=r,t-=o;return n}function tm(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 zn(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 u=i==="odd"||i==="even"?2:r,l=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,m=o==="center"?tm(c)[t]:o==="rtl"?c-1-t:t,h;switch(i){case"odd":{let d=l%2===1?l:l+1;h=String(d+m*2);break}case"even":{let d=l%2===0?l:l+1;h=String(d+m*2);break}case"roman":h=Gi(l+m*r);break;case"letters-upper":h=$o(l+m*r,!1);break;case"letters-lower":h=$o(l+m*r,!0);break;default:h=String(l+m*r);break}return`${a}${h}`}function nm(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Hi(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${zn(e,t)}`}function Zo(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(e.seatDisplayLabelMode==="number")return zn(e,t);if(!n)return`${e.displayLabel||e.label}-${zn(e,t)}`;let r=nm(n),i=n.displayOffset+t;return`${n.displayLabel}-${zn(r,i)}`}function zi(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 Nt(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,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let m=t-(i.x+l*s),h=n-(i.y+l*c);if(Math.abs(m)>=o||Math.abs(h)>=o)continue;let d=Math.hypot(m,h);d<o&&(o=d)}return o}function om(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 Ui(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Qo(e,t){let n=1/0;for(let o of zi(e)){let r=Nt(t,o.x,o.y);r<n&&(n=r)}for(let o of zi(t)){let r=Nt(e,o.x,o.y);r<n&&(n=r)}return n}function rm(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 r=-1,i=e[0];for(let l of e){let m=Math.hypot(l.x-n,l.y-o);m>r&&(r=m,i=l)}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 u=e.map((l,m)=>({p:l,i:m,t:(l.x-n)*a+(l.y-o)*s})).sort((l,m)=>l.t-m.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function Jo(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,u=0,l=0;for(let g of e){let x=g.x-n,w=g.y-o;r+=x*x,a+=w*w,i+=x*w,s+=x*x*x,c+=w*w*w,u+=x*w*w,l+=w*x*x}let m=r*a-i*i;if(Math.abs(m)<1e-9)return null;let h=(s+u)/2,d=(c+l)/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 im=.15;function am(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,w=0;for(let I of g.pts)x+=I.x,w+=I.y;return{x:x/g.pts.length,y:w/g.pts.length}}),n=0,o=0;for(let g of t)n+=g.x,o+=g.y;n/=t.length,o/=t.length;let r=0,i=0,a=0;for(let g of t){let x=g.x-n,w=g.y-o;r+=x*x,i+=x*w,a+=w*w}let s=r+a,c=r*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),l,m;Math.abs(i)>1e-12?(l=u-a,m=i):r>=a?(l=1,m=0):(l=0,m=1);let h=Math.hypot(l,m);if(!(h>1e-12))return null;l/=h,m/=h;let d=1/0,f=-1/0,p=[];for(let g of e){let x=1/0,w=-1/0;for(let I of g.pts){let v=I.x*l+I.y*m;v<x&&(x=v),v>w&&(w=v),v<d&&(d=v),v>f&&(f=v)}p.push(w-x)}let b=f-d;return b>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/b<=sm?{x:l,y:m}:null):null}var sm=.35;function Un(e,t,n,o){let r=new Map;for(let v of n){let P=t[v],S=P.rowId||`__seat-${v}`,M=r.get(S);M||(M={pts:[],idx:[]},r.set(S,M)),M.pts.push({x:P.x,y:P.y}),M.idx.push(v)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[v,P]of r){let S=rm(P.pts,P.idx),M=0;for(let C of S.pts)M+=Math.hypot(C.x-o.x,C.y-o.y);i.push({id:v,pts:S.pts,seatIndices:S.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/S.pts.length})}let a=i.map(v=>om(v.pts)),s=i.length<=256?i.length*(i.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let u=c?new Map(i.map((v,P)=>[v,P])):null,l=(v,P)=>(v>P&&([v,P]=[P,v]),v*(2*i.length-v-1)/2+(P-v-1)),m=(v,P)=>{if(!c)return Qo(i[v].pts,i[P].pts);let S=l(v,P),M=c[S];if(!Number.isNaN(M))return M;let C=Qo(i[v].pts,i[P].pts);return c[S]=C,C},h=(v,P)=>u?m(u.get(v),u.get(P)):Qo(v.pts,P.pts),d=[];for(let v=0;v<i.length;v++){let P=1/0;for(let S=0;S<i.length;S++){if(v===S||Ui(a[v],a[S])>=P)continue;let M=m(v,S);M<P&&(P=M)}Number.isFinite(P)&&d.push(P)}d.sort((v,P)=>v-P);let f=d.length?d[Math.floor(d.length/2)]:1,p=Math.max(f*1.8,1e-6),b=i.map(()=>[]);for(let v=0;v<i.length;v++)for(let P=v+1;P<i.length;P++)Ui(a[v],a[P])>p||m(v,P)<=p&&(b[v].push(P),b[P].push(v));let y=0;for(let v=0;v<i.length;v++){if(i[v].blockId!==-1)continue;let P=y++,S=[v];for(i[v].blockId=P;S.length;){let M=S.pop();for(let C of b[M])i[C].blockId===-1&&(i[C].blockId=P,S.push(C))}}let g=new Map;for(let v of i){let P=g.get(v.blockId)??[];P.push(v),g.set(v.blockId,P)}let x=[];for(let v of i){if(v.pts.length<4)continue;let P=Jo(v.pts);P&&(!Number.isFinite(P.cx)||!Number.isFinite(P.cy)||x.push({x:P.cx,y:P.cy}))}let w=x.length>=2?(()=>{let v=x.map(M=>M.x).sort((M,C)=>M-C),P=x.map(M=>M.y).sort((M,C)=>M-C),S=Math.floor(x.length/2);return{cx:v[S],cy:P[S]}})():null;if(w){let v=N=>Math.hypot(N.x-w.cx,N.y-w.cy),P=1/0,S=-1/0,M=[];for(let N of i){let D=1/0,R=-1/0;for(let A of N.pts){let L=v(A);L<D&&(D=L),L>R&&(R=L)}M.push(R-D),D<P&&(P=D),R>S&&(S=R)}let C=S-P;M.sort((N,D)=>N-D);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(C>1e-9&&T/C<=im){let N=i.map(B=>{let z=0;for(let U of B.pts)z+=v(U);return{row:B,radius:z/B.pts.length}}),D=0,R=0;for(let B of N)D+=B.radius,R+=B.row.focalDistance;D/=N.length,R/=N.length;let A=0;for(let B of N)A+=(B.radius-D)*(B.row.focalDistance-R);if(A<0)for(let B of N)B.radius=-B.radius;let O=1/0;for(let B of N)B.radius<O&&(O=B.radius);N.sort((B,z)=>B.radius-z.radius);let _=-1,k=-1/0,V=C/Math.max(1,N.length)*.5,F=[];for(let B of N)B.radius-k>V&&(_++,k=B.radius),B.row.ordinal=_,B.row.blockDepth=B.radius-O,F.push(B.row);return{sectionId:e,rows:F,blockCount:y}}}let I=[];for(let[,v]of g){let P=am(v);if(P){let S=C=>{let T=0;for(let N of C.pts)T+=N.x*P.x+N.y*P.y;return T/C.pts.length};v.sort((C,T)=>S(C)-S(T)),v.length>=2&&v[0].focalDistance>v[v.length-1].focalDistance&&v.reverse();let M=0;for(let C=0;C<v.length;C++)C>0&&(M+=h(v[C-1],v[C])),v[C].ordinal=C,v[C].blockDepth=M,I.push(v[C])}else{let S=1/0;for(let M of v)M.focalDistance<S&&(S=M.focalDistance);v.sort((M,C)=>M.focalDistance-C.focalDistance);for(let M=0;M<v.length;M++)v[M].ordinal=M,v[M].blockDepth=Math.max(0,v[M].focalDistance-S),I.push(v[M])}}return{sectionId:e,rows:I,blockCount:y}}var cm=/^\d{4}-\d{2}-\d{2}$/;function lm(e){let t=Date.parse(e);return Number.isFinite(t)?cm.test(e)?t+864e5:t:null}function um(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=lm(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function mm(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function fm(e){return e.status!=="draft"&&e.status!=="retracted"}function dm(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 ji(e,t={}){return!!e&&fm(e)&&mm(e,t.activeConfigurationId,t.activeConfigurationVersion)&&dm(e,t.activeBasisSha256)&&um(e,t.now)}var hm=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),pm=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Et(e){return!!e&&hm.has(e)}function Yi(e){return!!e&&pm.has(e)}var jn=1.1,bm={"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}},ym={"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 gm=Math.PI*2;function xm(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function Xi(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 Wi=(()=>{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 u=0;u<=24;u++){let l=s+(c-s)*u/24;a.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:a}})();var Xn="#f1f5f9";function yn(e){return Et(e)}function ft(e,t,n,o,r=32){let i=[];for(let a=0;a<r;a++){let s=a/r*gm;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function tt(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 vm(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),u=r/2,l=i/2,m=[],h=bm[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:-l},{x:0,y:l}],closed:!1}),m.push({points:ft(0,0,d(9.15),f(9.15)),closed:!0});for(let p of[-1,1])m.push({points:tt(p*(u-d(16.5)/2),0,d(16.5)/2,f(40.32)/2),closed:!0}),m.push({points:tt(p*(u-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:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*d(7.5),y:-l},{x:p*d(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(u-d(4)),y:-f(11)},{x:p*(u-d(4)),y:f(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:ft(p*d(20.5),b*f(7),d(4.5),f(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:ft(0,0,d(4.5),f(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=l-f(1.22)*8;b>0&&m.push({points:Xi(u-d(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let y=1;y<8;y++){let g=f(1.22)*y,x=l-g;if(x<=0)break;m.push({points:Xi(u-d(1.22)*y,x),closed:!0})}break}case"oval-cricket":{m.push({points:ft(0,0,d(27.4),f(27.4+20.12/2),40),closed:!0}),m.push({points:tt(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:-l},{x:d(b),y:l}],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,O)=>({x:d(L),y:f(O)}),{home:b}=Wi,y=27.43,g=y/Math.SQRT2,x={x:b.x+g,y:b.y-g},w={x:b.x,y:b.y-2*g},I={x:b.x-g,y:b.y-g},v={x:b.x,y:b.y-18.44},P="#b98a59",S=ym["diamond-baseball"],M=38.94,C=[p(b.x,b.y)],T=Math.atan2(b.y-M/Math.SQRT2-v.y,M/Math.SQRT2),N=Math.PI-T;for(let L=0;L<=16;L++){let O=T-(T+Math.PI*2-N)%(Math.PI*2)*(L/16);C.push(p(v.x+29*Math.cos(O),v.y+29*Math.sin(O)))}m.push({points:C,closed:!0,fill:P,ink:P});let D={x:b.x,y:b.y-g},R=[{x:b.x,y:b.y},x,w,I].map(L=>p(D.x+(L.x-D.x)*.84,D.y+(L.y-D.y)*.84));m.push({points:R,closed:!0,fill:S,ink:S}),m.push({points:ft(d(v.x),f(v.y),d(2.74),f(2.74),20),closed:!0,fill:P,ink:P}),m.push({points:ft(d(b.x),f(b.y),d(3.96),f(3.96),20),closed:!0,fill:P,ink:P});let A=Wi.fence;m.push({points:[p(b.x,b.y),p(A[0].x,A[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(A[A.length-1].x,A[A.length-1].y)],closed:!1});for(let L of[x,w,I])m.push({points:tt(d(L.x),f(L.y),d(.3),f(.3)),closed:!0,fill:Xn});break}case"court-basketball":{m.push({points:tt(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:ft(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:tt(d((b+y)/2),0,d(2.9),f(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:ft(d(y),0,d(1.8),f(1.8),24),closed:!0});let x=Math.sqrt(6.75*6.75-6.6*6.6),w=[{x:d(b),y:-f(6.6)}],I=Math.atan2(-6.6,-p*x),v=2*Math.atan2(6.6,x);for(let P=0;P<=16;P++){let S=I-p*v*(P/16);w.push({x:d(g+6.75*Math.cos(S)),y:f(6.75*Math.sin(S))})}w.push({x:d(b),y:f(6.6)}),m.push({points:w,closed:!1})}break}case"court-tennis":{m.push({points:tt(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:tt(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,x,w]of y)m.push({points:tt(g*d(3.05),x*f(3.05),d(.3),f(.3)),closed:!0,fill:w,ink:w});break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>xm(b.x,b.y,s,c,n,o))}))}function Ki(e){if(e.role!=="stage"||!yn(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),r=Math.min(...n),i=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,s-a);t={cx:r+c/2,cy:a+u/2,width:c,height:u}}return t?vm({kind:e.stageKind,...t}):[]}var Mm=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Sm=/[\s"'<>`\\]/;function wm(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Mm.test(e);if(Sm.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function qi(e){let t=e.trim();return wm(t)?t:null}var er="seatlayer.event-configuration/1";var Vt=100,Pm=120,Im=2e5,Cm=1e4,Rm=/^[a-f0-9]{64}$/,Am=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function gn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function _t(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Em(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function $i(e){return!Array.isArray(e)||e.length>Im||!e.every(t=>_t(t,Vt))?null:[...new Set(e)].sort()}function _m(e){return!gn(e)||!_t(e.chartId,Vt)||!_t(e.version,Vt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Rm.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function tr(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Tm(e){return gn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&tr(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function km(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Cm)return null;let n=new Set(t),o=new Set,r=new Set,i=0,a=[];for(let s of e){if(!gn(s)||!_t(s.id,Vt)||!_t(s.objectId,Vt)||!n.has(s.objectId)||!Am.has(String(s.kind))||!tr(s.heightM,.05,50)||s.baseElevationM!==void 0&&!tr(s.baseElevationM,-10,100))return null;let c=Tm(s.occlusion);if(!c||o.has(s.id)||r.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?qi(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||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,...u?{contentImageUrl:u}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function Lm(e){let t=[];if(!gn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==er&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${er}`}),_t(e.id,Vt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),_t(e.label,Pm)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Em(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=_m(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=gn(e.overlay)?e.overlay:null,r=$i(o?.objectIds),i=$i(o?.productionKillSeatIds),a=r?km(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:er,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Zi(e){let t=Lm(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Fm(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 Dm(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 Qi(e){let t=Fm(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Dm(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.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 Om=5,Bm=3,Nm=.92,Vm=1.9,Gm=2,Hm=.6,zm=1,Um=.06;function jm(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?jn:yn(e.stageKind)?Um:zm}function Ji(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let a of na(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Qi(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,s+jm(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function Xm(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,u=i*t,l=Math.max(1,Math.ceil((a-r)*t/n)+1),m=Math.max(1,Math.ceil((s-i)*t/n)+1),h=new Float64Array(l*m).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let f=d.eyeHeightM-We,p=Math.min(l-1,Math.max(0,Math.floor((d.x*t-c)/n))),y=Math.min(m-1,Math.max(0,Math.floor((d.y*t-u)/n)))*l+p,g=f+o;g>h[y]&&(h[y]=g)}return{cellM:n,minX:c,minY:u,cols:l,rows:m,top:h}}function Wm(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 ea(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??le,i=n.cellM??Hm,a=n.chairBackM??Nm,s=n.selfRowSkipM??Gm,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??Om),m=Math.max(1,n.rows??Bm),h=Xm(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 w=0;w<l;w++){let I=(w+.5)/l-.5,v=p?b+I*d:b,P=p?y:y+I*f;for(let S=0;S<m;S++){let M=t.deckTopM+(m===1?0:S/(m-1)*Vm);g.push({x:v,y:P,z:M})}}let x=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let I=w.x*r,v=w.y*r,P=w.eyeHeightM,S=0,M=1/0;for(let T of g){let N=T.x-I,D=T.y-v,R=Math.hypot(N,D);if(!(R>s)){S++;continue}let A=N/R,L=D/R,O=0;for(let _=s;_<R;_+=x){let k=Wm(h,I+A*_,v+L*_);if(!(!Number.isFinite(k)||k>=P)&&k>P+(T.z-P)*_/R){O=_;break}}O?M=Math.min(M,O):S++}let C=S/g.length;C>=c||o.set(w.id,{seatId:w.id,mark:C<u?"obstructedView":"restrictedView",visibleFraction:C,totalRays:g.length,atDistanceM:Number.isFinite(M)?M:0})}return o}function ta(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 nr(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Yn=Math.PI/180;var xn=16;function or(e,t,n,o){let r=n*Yn,i=Math.cos(r),a=Math.sin(r);return{x:o.x+e*i-t*a,y:o.y+e*a+t*i}}function sa(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,a=[];if(e.path)return Ni(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(o===0){for(let u=0;u<t;u++)a.push(or(u*n,0,r,i));return a}let s=o/(t-1)*Yn,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let l=u*s,m=c*Math.sin(l),h=-c+c*Math.cos(l);a.push(or(m,h,r,i))}return a}function ca(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Ym(e,t){let n=ca(e);return sa(e).map((o,r)=>{let i=n.get(r),a=nr(i),s=Hi(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:Zo(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(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Km(e){let t=[];for(let n of Ym(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 qm(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 $m(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])),r=(l,m,h,d)=>{let f=o.get(l),p=nr(f),b=f?.label??`${e.label}-${l+1}`,y=e.displayLabel??e.label;return{index:l,label:b,displayLabel:f?.displayLabel??`${y}-${l+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 l=(e.radius??40)+xn,m=e.rotation*Yn,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+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let d=h*Yn,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+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=qm(e),c=["top","bottom","left","right"],u=0;for(let l of c){let m=s[l];for(let h=0;h<m;h++){let d,f;l==="top"?(d=-i/2+(h+.5)*i/m,f=-a/2-xn):l==="bottom"?(d=-i/2+(h+.5)*i/m,f=a/2+xn):l==="left"?(d=-i/2-xn,f=-a/2+(h+.5)*a/m):(d=i/2+xn,f=-a/2+(h+.5)*a/m);let p=or(d,f,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function Zm(e){return $m(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 Qm(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 oa(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 Jm(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 rr(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function _e(e,t,n){return oa(e,t)&&!rr(n).some(o=>oa(e,o)||Jm(e,o))}function Wn(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 la(e){switch(e.type){case"row":{let t=sa(e),n=ca(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 Wn(e.points);case"section":return Wn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Wn(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 ra(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function ef(e,t){if(e.type!=="gaArea"||!ra(e.points,t.outline))return!1;let n=rr(e.holes),o=rr(t.holes);return n.length===o.length&&n.every((r,i)=>ra(r,o[i]))}function tf(e,t,n=e.filter(r=>r.type==="section"),o=la(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(ef(t,a)||_e(o,a.outline,a.holes))):void 0)??n.find(a=>_e(o,a.outline,a.holes))}function na(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 ia(e,t,n,o,r,i,a,s,c){let u=[],l=e.filter(p=>p.type==="section"),m=Vi(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),d=p=>ji(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=Km(p):p.type==="table"?b=Zm(p):p.type==="booth"&&(b=Qm(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 v=new Map((p.overrides??[]).map(P=>[P.index,P]));for(let P of b){let S=Number(P.id.slice(P.id.lastIndexOf(":")+1));if(!Number.isInteger(S))continue;P.logicalRowId=I.groupId,P.logicalSeatIndex=I.adjacencyOffset+S,v.get(S)?.displayLabel||(P.displayLabel=Zo(p,S,I)),!P.viewUrl&&I.viewFromSeatUrl&&h(I.viewFromSeatMeta)&&(P.viewUrl=I.viewFromSeatUrl,P.viewMeta=I.viewFromSeatMeta);let M=v.get(S)?.confidenceEvidence;P.confidenceEvidence=f(M,"exact-seat")??f(p.confidenceEvidence,"row-representative")??f(I.confidenceEvidence,"row-representative")}}}let y=tf(e,p,l,p.type==="row"?Wn(b):la(p)),g=y?.viewFromSeatUrl,w=(y?.zone?t?.find(I=>I.id===y.zone):void 0)?.focalPoint??n;for(let I of b){if(!I.confidenceEvidence){let v=Number(I.id.slice(I.id.lastIndexOf(":")+1)),P=(p.type==="row"||p.type==="table")&&Number.isInteger(v)?p.overrides?.find(S=>S.index===v)?.confidenceEvidence:void 0;I.confidenceEvidence=f(P,"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),w&&(I.focalPoint={...w})}u.push(...b)}return u}function Gt(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=ia(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&aa(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=ia(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&&aa(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),nf(e,n,t)}function nf(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||ta(t,ea(t,Ji(e))),t}function aa(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+We;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,u=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&&_e({x:h.x,y:h.y},b.outline,b.holes)):void 0)??r.find(b=>_e({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,mt(f,{floorBaseHeightM:n}));let p=u.get(f.id);p?p.push(m):u.set(f.id,[m])}let l=new Array(o.length).fill(void 0);for(let[m,h]of u){let d=c.get(m);if(!d)continue;let f=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=Un(m,o,h,t);for(let b of p.rows){let y=b.blockDepth*le*f,g=d.height+y;for(let x of b.seatIndices)l[x]=g}}for(let m=0;m<o.length;m++){let h=o[m],d=a[m];if(!d){h.eyeHeightM=n+We;continue}let f=c.get(d.id);h.eyeHeightM=(l[m]??f.height)+We}}function of(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 rf(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,u=a.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let m=[...e].sort((d,f)=>(d.x-n)*c+(d.y-o)*u-((f.x-n)*c+(f.y-o)*u)),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 ua(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,u=s.y-a.y,l=c*c+u*u,m=l>1e-12?((t-a.x)*c+(n-a.y)*u)/l:0;m<0?m=0:m>1&&(m=1);let h=Math.hypot(t-(a.x+m*c),n-(a.y+m*u));h<r&&(r=h)}return r}var Kn=8;function af(e,t,n){let o=new Array(Kn).fill(1/0),r=new Array(Kn).fill(-1);for(let l=0;l<e.length;l++){let m=e[l],h=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let d=0;d<Kn;d++)if(h<o[d]){for(let f=Kn-1;f>d;f--)o[f]=o[f-1],r[f]=r[f-1];o[d]=h,r[d]=l;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let m=ua(e[l],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]=l;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,u=0;for(let l=0;l<3;l++){let m=a[l];if(m<0||i[l]>s)continue;let h=1/(i[l]*i[l]);c+=h*e[m].depth,u+=h}return u>0?c/u:e[a[0]].depth}function sf(e){let t=(o,r)=>af(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 u=ua(c,o,r);u<i&&(i=u,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 ma(e,t){let n=[];for(let o of e){let r=rf(o.points,t);r&&n.push(r)}return n.length<2?of(t):(n.sort((o,r)=>o.depth-r.depth),sf(n))}var sr=lt(require("polygon-clipping"),1);var pa=lt(require("earcut"),1);var cf=.58,fa=.01,Ge=et*1.5*Ve,lf=.5,uf=.6;function mf(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)],u=c.x-s.x,l=c.y-s.y,m=Math.hypot(u,l);if(m<1e-9){o.push([0,0]);continue}u/=m,l/=m,o.push([-l,u])}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 ff(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},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 da=Math.PI/12;function df(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 ba(e,t){if(!e.length||!(t>0))return[];let n=df(e),o=(s,c,u,l)=>{let m=u-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/da)),d=t/Math.cos(m/h/2);for(let f=0;f<=h;f++){let p=c+m*f/h;l.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 u=0;for(let d of n)u=Math.max(u,Math.hypot(d.x-s,d.y-c));let l=[],m=Math.max(3,Math.ceil(Math.PI*2/da)),h=(u+t)/Math.cos(Math.PI/m);for(let d=0;d<m;d++){let f=d/m*Math.PI*2;l.push({x:s+Math.cos(f)*h,y:c+Math.sin(f)*h})}return l}let r=n.length,i=[];for(let s=0;s<r;s++){let c=n[s],u=n[(s+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<r;s++)o(n[s],i[(s+r-1)%r],i[s],a);return Ma(a)}function hf(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,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let m=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));m<o&&(o=m)}return o}function qn(e){let t=e.map(r=>{let i=0,a=0;for(let u of r.pts)i+=u.x,a+=u.y;let s=r.pts.length||1;i/=s,a/=s;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-a);l>c&&(c=l)}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 l 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(l.x-d.cx,l.y-d.cy)-d.rad;if(f>=m&&f>=s)continue;let p=hf(e[h].pts,l.x,l.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((l,m)=>l-m);let u=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function ya(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],m=l.x-o.x,h=l.y-o.y,d=Math.hypot(m,h)||1;m/=d,h/=d;let f=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+h*f,y:l.y-m*f},{x:l.x-h*f,y:l.y+m*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let l=1;l<i.length;l++){let m=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,u=ff(i,Math.max(c*uf,Ge));return{pts:u,nrm:mf(u,o),front:Math.max(n[t].pitch*cf,Ge),back:Math.max(n[t].pitch*lf,Ge)}}var Ht=1.5,ga=.3;function ir(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 u=ir(e.slice(0,c+1),t),l=ir(e.slice(c),t);return[...u.slice(0,-1),...l]}function xa(e,t){if(e.length<4)return e;let n=ir([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function pf(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 va(e,t,n){if(e.length<2)return[];let o=n??qn(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 x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let u=s.map(g=>ya(e,g,o,t)).filter(g=>g!==null);if(!u.length)continue;let l=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+Ht),y:g.pts[x].y-g.nrm[x][1]*(g.front+Ht)}),m=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+Ht),y:g.pts[x].y+g.nrm[x][1]*(g.back+Ht)}),h=u[0],d=u[u.length-1],f=[];for(let g=0;g<h.pts.length;g++)f.push(l(h,g));for(let g of u)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=u.length-1;g>=0;g--)f.push(l(u[g],0));let p=Ma(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(Le(p))>1e-6&&u.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Fe(p,x.x,x.y)})&&!pf(p)){i.push({outline:xa(p,ga),holes:[],topY:b});continue}for(let g of bf(u))i.push({outline:g,holes:[],topY:b})}return i}function bf(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Ht,a=n.back+Ht;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*a,u.y+l[1]*a])}let s=[...o,...r.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=sr.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,u])=>({x:c,y:u})),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(xa(i,ga))}return o}catch{return[]}}function Ma(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 ar=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(!Fe(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function ha(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let m=1;m+1<o.length;m++){let h=o[m],d=o[m+1];e.tri([l.x*E,r,l.y*E],[h.x*E,r,h.y*E],[d.x*E,r,d.y*E],u,i)}return}let a=o.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=sr.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let l=u[0],m=[],h=[];for(let f=0;f<l.length-1;f++)m.push(l[f][0],l[f][1]),h.push([l[f][0],l[f][1]]);if(h.length<3)continue;let d=(0,pa.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 Sa(e,t,n,o,r,i,a){if(t.length<2)return;let s=a??qn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new ar([[...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],v=s[d].belowY??o;if(h(()=>{if(u&&l)ha(e,u,l,I,f.y,r.tread);else{let P=I[0];for(let S=1;S+1<I.length;S++){let M=I[S],C=I[S+1];e.tri([P.x*E,f.y,P.y*E],[M.x*E,f.y,M.y*E],[C.x*E,f.y,C.y*E],c,r.tread)}}}),f.y>v+fa){let P=0,S=0;for(let M of I)P+=M.x,S+=M.y;P/=I.length,S/=I.length,m(()=>{for(let M=0;M<I.length;M++){let C=I[M],T=I[(M+1)%I.length],N=T.x-C.x,D=T.y-C.y,R=Math.hypot(N,D);if(R<1e-6)continue;let A=D/R,L=-N/R;(C.x-P)*A+(C.y-S)*L<0&&(A=-A,L=-L);let O=[A,0,L],_=[C.x*E,f.y,C.y*E],k=[T.x*E,f.y,T.y*E],V=[C.x*E,v,C.y*E],F=[T.x*E,v,T.y*E];e.tri(_,k,F,O,r.riser),e.tri(_,F,V,O,r.riser)}})}continue}let p=ya(t,d,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:x}=p,w=s[d].belowY??o;for(let I=0;I+1<b.length;I++){let v=b[I],P=b[I+1],S=y[I],M=y[I+1];if(Math.hypot(P.x-v.x,P.y-v.y)<1e-6||S[0]===0&&S[1]===0||M[0]===0&&M[1]===0)continue;let C=[(v.x-S[0]*g)*E,f.y,(v.y-S[1]*g)*E],T=[(P.x-M[0]*g)*E,f.y,(P.y-M[1]*g)*E],N=[(v.x+S[0]*x)*E,f.y,(v.y+S[1]*x)*E],D=[(P.x+M[0]*x)*E,f.y,(P.y+M[1]*x)*E];if(h(()=>{u&&l?ha(e,u,l,[{x:v.x-S[0]*g,y:v.y-S[1]*g},{x:P.x-M[0]*g,y:P.y-M[1]*g},{x:P.x+M[0]*x,y:P.y+M[1]*x},{x:v.x+S[0]*x,y:v.y+S[1]*x}],f.y,r.tread):(e.tri(C,T,D,c,r.tread),e.tri(C,D,N,c,r.tread))}),f.y>w+fa){let R=[C[0],w,C[2]],A=[T[0],w,T[2]],L=[-S[0],0,-S[1]];m(()=>{e.tri(C,T,A,L,r.riser),e.tri(C,A,R,L,r.riser)})}}}}function wa(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 zt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var cr=lt(require("polygon-clipping"),1);function yf(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Pa(e,t){return e.filter(n=>n.type!=="shape"||yf(n,t))}function Ia(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Pa(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Pa(e.objects,t),focal:n,baseHeightM:0,index:0}]}var gf={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function nt(e){return wa(e)??gf}function Ca(e,t){let n=Ue(e.outline,Ge),o=nt(n),r=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&zt(o,nt(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=cr.default.difference([i(n)],...r.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function Ra(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=cr.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(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}var dt=.06,xf=.05,Ea=.05,Aa=.15,lr=25;function _a(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,u=[],l=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"&&l.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=Ue(f.outline,Ge);c.set(f.id,{section:f,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:f.id,floorIndex:h,box:nt(p),section:f,unit:d,outline:p})}}let m=new Map;for(let h of u){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])??[]:u,p=d.sectionId?f.find(y=>y.id===d.sectionId)??f.find(y=>y.section.logicalSectionId===d.sectionId&&_e({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||!_e({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 x=d.focalPoint??y.unit.focal,w=Math.hypot(d.x-x.x,d.y-x.y);w<g.frontU&&(g.frontU=w),g.seatIndices.push(h);let I=d.rowId||`__seat-${h}`,v=g.rows.get(I);v?v.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=mt(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,x=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:y,w=d.hasSeats?Un(h,t,d.seatIndices,d.unit.focal):{sectionId:h,rows:[],blockCount:0},v=w.rows.length<2?ma([...d.rows.values()].map(_=>({points:_})),d.unit.focal):null,P=1/0;if(v){if(d.hasSeats)for(let _ of d.rows.values())for(let k of _){let V=v.depthAt(k.x,k.y);V<P&&(P=V)}if(!d.hasSeats||!Number.isFinite(P)){P=1/0;for(let _ of d.section.outline){let k=v.depthAt(_.x,_.y);k<P&&(P=k)}}}let S=p+xf,M=Math.max(S,f.height),C=_=>{let k=Math.max(0,_-P)*le,V=Math.min(k*b,lr);return Math.max(S,f.height+V)},T=_=>{let k=Math.max(0,_)*le,V=Math.min(k*b,lr);return Math.max(S,f.height+V)},N=x?[]:w.rows.map(_=>({pts:_.pts,y:T(_.blockDepth),depth:_.blockDepth,blockId:_.blockId,...l.has(_.id)?{patch:ba(_.pts,Ge)}:{}})),D=N.length?N[0].y:M,R=N.map(_=>{let k=_.patch&&_.patch.length>=3?_.patch:_.pts,V=0,F=0;for(let U of k)V+=U.x,F+=U.y;let B=k.length||1;V/=B,F/=B;let z=0;for(let U of k){let G=Math.hypot(U.x-V,U.y-F);G>z&&(z=G)}return{cx:V,cy:F,rad:z}}),A=x?()=>M:N.length>=2?(_,k)=>{let V=1/0,F=D;for(let B=0;B<N.length;B++){let z=R[B];if(Math.hypot(_-z.cx,k-z.cy)-z.rad>=V)continue;let U=N[B].patch,G=U&&U.length>=3?Fe(U,_,k)?0:Nt(U,_,k):Nt(N[B].pts,_,k);G<V&&(V=G,F=N[B].y)}return F}:(_,k)=>v?C(v.depthAt(_,k)):M,L=[0,1,0],O=N.length>=2||x?()=>L:(_,k)=>{if(!v)return L;let V=v.depthAt(_,k);if(V<=P)return L;let F=(V-P)*le;if(F*b>=lr||f.height+F*b<=S)return L;let[B,z]=v.gradientAt(_,k);if(B===0&&z===0)return L;let U=1/Math.hypot(b,1);return[-B*b*U,U,-z*b*U]};if(!x)for(let _ of w.rows){let k=T(_.blockDepth);for(let V of _.seatIndices)a[V]=k}for(let _ of w.rows){let k=[];for(let U=1;U<_.pts.length;U++){let G=Math.hypot(_.pts[U].x-_.pts[U-1].x,_.pts[U].y-_.pts[U-1].y);G>1e-6&&k.push(G)}k.sort((U,G)=>U-G);let V=k.length?k[Math.floor(k.length/2)]:1/0,F=1/0,B=_.pts[Math.floor(_.pts.length/2)];if(B)for(let U of w.rows){if(U===_||U.blockId!==_.blockId)continue;let G=Nt(U.pts,B.x,B.y);G>1e-6&&G<F&&(F=G)}let z=Math.min(V,Math.max(F,V*.5));if(Number.isFinite(z)&&z>0)for(let U of _.seatIndices)s[U]=z}o.set(h,{sectionId:h,deckAt:A,normalAt:O,flat:x,bottomY:p,rowLevels:N,landingY:D})}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))+Aa;continue}let p=f.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-We):0;i[h]=f.kind==="booth"?b+dt+Aa:b}return{bySection:o,seatOwner:r,seatDeckY:h=>i[h],seatPitchU:h=>s[h]}}var re={top:1,wallBottom:.58,bottomCap:.4};function ht(e,t){if(!e)return t;let n=ie(Xe(e,.4),.62);return de(t,n,.22)}function Ta(e,t){return e?de(t,ie(Xe(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,u=0,l=0;for(let[m,h]of a){let d=me(n.get(m));d&&(s+=d[0]*h,c+=d[1]*h,u+=d[2]*h,l+=h)}l>0&&r.set(i,[s/l,c/l,u/l])}return r}function La(e,t){return me(e.color)??t.get(e.logicalSectionId??e.id)??null}var Fa=lt(require("polygon-clipping"),1);function vf(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var $n=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=nt(t),i=this.rings.filter((c,u)=>zt(r,this.boxes[u])&&vf(n,this.levels[u])),a=[[o]];if(i.length)try{a=Fa.default.difference([o],...i).map(u=>u.map(l=>l.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 u=c[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function Zn(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,u=Math.cos(c),l=Math.sin(c);return e.map(m=>{let h=m.x-a,d=m.y-s;return{x:a+h*u-d*l,y:s+h*l+d*u}})}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=hn(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=Hn(n,o,e.width/2,e.height/2)}return t?Zn(t,e.rotation):null}function je(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"&&yn(e.stageKind)?{kind:"stage",heightM:e.stageKind==="ring-boxing"?jn:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var Mf=.08,Sf=30,wf=.015;function Pf(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 Da(e,t){let n=ge(e)??(e.points?.length?Zn(e.points,e.rotation):null),o=je(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Le(n))*le**2>=Sf?wf: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,u=-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),u=Math.max(u,d.y);let l=i,m=0,h=1e-6*Math.max(1,c-a,u-s);for(let d of t)c>d.minX&&a<d.maxX&&u>d.minY&&s<d.maxY&&l<=d.topOffsetM+1e-6&&(l=d.topOffsetM+Mf),a>=d.minX-h&&c<=d.maxX+h&&s>=d.minY-h&&u<=d.maxY+h&&(!d.poly||n.every(b=>Pf(b,d.poly)||If(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:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(m,l)}}function If(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,u=s*s+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*s),e.y-(i.y+l*c))<=n)return!0}return!1}function pt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function De(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 Ie(e,t,n){return[pt(e[0],e[1],t),pt(e[0],e[1],n),pt(e[3],e[2],n),pt(e[3],e[2],t)]}function vn(e,t,n){return[pt(e[0],e[3],t),pt(e[1],e[2],t),pt(e[1],e[2],n),pt(e[0],e[3],n)]}function ue(e,t,n,o,r,i){ae(e,t,void 0,()=>n,o,r,i,re)}function Ut(e,t,n){if(e.length!==4||n<=t)return null;let o=De(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:Ie(o,a,1-a),openingTop:n-s}}function ur(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=De(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=Ie(o,a,1-a);return{quad:o,side:a,trim:i,inner:s,panel:vn(s,.15,.85),bottom:t+i,top:n-i}}function Oa(e,t,n,o){let r=ur(e,t,n);if(!r)return;let{panel:i}=r,a=(g,x)=>({x:(g.x+x.x)/2,y:(g.y+x.y)/2}),s=a(i[0],i[1]),c=a(i[3],i[2]),u=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,m]=u?[i[0],i[1]]:[i[3],i[2]],h=u?{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-l.y)*h.x+(m.x-l.x)*h.y<0&&([l,m]=[m,l]);let f=Math.min(.006,d*E*.05),p=h.x/d*f,b=h.y/d*f,y=(g,x)=>[g.x*E+p,x,g.y*E+b];return[y(l,r.bottom),y(m,r.bottom),y(l,r.top),y(m,r.top)]}var Ba=lt(require("polygon-clipping"),1);function ot(e,t,n,o,r,i,a,s={}){let c=nt(t),u=s.ao??re,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=ge(p);if(!b||b.length!==4||!zt(c,nt(b)))return[];let y=s.portalBase??n,g=Ut(b,y,y+je(p).heightM);if(!g)return[];let x=Math.min(o,g.openingTop);return x<=n?[]:[{poly:g.opening,height:x}]});if(!l.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),h=[m(t),...(s.holes??[]).map(m)],d=[n,...new Set(l.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=l.filter(w=>w.height>b+1e-6).map(w=>[m(w.poly)]),x=g.length?Ba.default.difference(h,...g):[h];f.push({low:b,high:y,polys:x})}}catch{return!1}for(let p of f)for(let b of p.polys){let[y,...g]=b.map(w=>w.map(([I,v])=>({x:I,y:v}))),x=w=>u.wallBottom+(u.top-u.wallBottom)*(w-n)/(o-n);ae(e,y,g,()=>p.high,p.low,i,a,{...u,top:x(p.high),wallBottom:x(p.low)})}return!0}function Na(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]],u=l=>re.wallBottom+(re.top-re.wallBottom)*(l-n)/s;for(let[l,m,h]of c){let d={...re,top:u(m),wallBottom:u(l)},f=ie(i,h),p=ie(a,h);ot(e,t,l,m,r,f,p,{portalBase:n,ao:d})||ae(e,t,void 0,()=>m,l,f,p,d)}}function Mn(e,t,n){let o=me(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?Zn(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 u=0;u<s;u++){let l=a[u],m=a[(u+1)%a.length],h=Math.hypot(m.x-l.x,m.y-l.y);if(h<1e-6)continue;let d=-(m.y-l.y)/h*c,f=(m.x-l.x)/h*c,p=[(l.x+d)*E,n,(l.y+f)*E],b=[(m.x+d)*E,n,(m.y+f)*E],y=[(m.x-d)*E,n,(m.y-f)*E],g=[(l.x-d)*E,n,(l.y-f)*E];e.tri(p,b,y,[0,1,0],o),e.tri(p,y,g,[0,1,0],o)}}function Va(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var jt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function Qn(e,t,n,o){let[r,i,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[jt(r,s,n),jt(i,a,n),jt(i,a,o),jt(r,s,o)]}function Ga(e,t,n,o,r,i,a,s,c=!1){if(n.length!==4||r-o<.4)return!1;let u=S=>c?Math.min(S,r):S,l=De(n),m=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*E;if(m<.4)return!1;let h=jt(l[0],l[1],.5),d=jt(l[3],l[2],.5),f=Math.hypot(h.x-s.x,h.y-s.y)<=Math.hypot(d.x-s.x,d.y-s.y),p=de(a,[.92,.9,.86],.35),b=ie(i,.72),y=r-o;if(t==="restroom"){let S=Math.min(.18,y*.08);return ue(e,l,r-S,o,a,i),ue(e,l,r,r-S,p,p),!0}let g=o+Math.min(1.1,y),x=t==="coat"?1:Math.min(.5,.75/m),w=Qn(l,f,0,x);if(ue(e,w,g-.05,o,b,i),ue(e,w,g,g-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let S=Qn(l,f,Math.max(x+.2,1-.45/m),1),M=u(o+Math.max(Math.min(2.2,y*2),g-o+.6));return ue(e,S,M,o,a,b),!0}let I=Qn(l,f,Math.max(x+.25,.55),1),v=u(o+Math.max(2.6,g-o+1.4));if(v-.14<=g)return!0;ue(e,I,v-.14,o,a,i),ue(e,l,v,v-.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)*E));for(let[S,M]of[[0,P],[1-P,1]])ue(e,Qn(Ie(l,S,M),f,0,Math.min(.08,.1/m)),v-.14,g,b,b);return!0}var Cf=[.12,.38,.16],Rf=[.72,.62,.45],Af=[.88,.93,.96],Ha=[.95,.95,.94],Ef=[.66,.29,.22],mr={length:20.12,width:3.05},_f=.14,Tf=9.76,rt=[.93,.94,.95],Jn=[.1,.11,.13],kf=[.45,.85,1.25],Lf=1.45,za=.012,Ua=.004,Ff=1.07,Df=.15;function Wt(e,t,n,o,r,i){e.setMaterial(i),ae(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,re)}var ja=(e,t)=>Rt(e,t/E);function Xa(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 Of(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 eo(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),re)}function Xt(e,t,n,o,r,i,a){let s=Xa(t,n,o/E);s&&ae(e,s,void 0,()=>i,r,a,ie(a,.85),re)}function to(e){let t=De(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,u)=>({x:n.x+(i.x*c+a.x*u)/E,y:n.y+(i.y*c+a.y*u)/E}),lengthM:o*E,widthM:r*E}}function Wa(e,t,n){let o=Ki(t);if(!o.length)return;let r=1/0,i=-1/0,a=1/0,s=-1/0;for(let x of t.points??[])r=Math.min(r,x.x),i=Math.max(i,x.x),a=Math.min(a,x.y),s=Math.max(s,x.y);let c=(t.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),m=(r+i)/2,h=(a+s)/2,d=x=>c?{x:m+(x.x-m)*u-(x.y-h)*l,y:h+(x.x-m)*l+(x.y-h)*u}:x,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 x of o){if(!x.fill)continue;let w=x.points.map(d);Wt(e,w,null,n+za+b*Ua,me(x.fill)??rt,0),b++}let y=o.filter(x=>!(x.fill&&x.ink===x.fill)),g=[...new Set(y.map(x=>x.ink??Xn))];for(let x of g){let w=n+za+b++*Ua,I=me(x)??rt;for(let v of y){if((v.ink??Xn)!==x)continue;let P=v.points.map(d),S=v.closed?P.length:P.length-1;for(let M=0;M<S;M++){let C=Xa(P[M],P[(M+1)%P.length],p);C&&Of(e,C,w,I)}}}}function Ya(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,a=r??Cf;if(n==="oval-cricket"){let s=t.reduce((I,v)=>I+v.x,0)/t.length,c=t.reduce((I,v)=>I+v.y,0)/t.length,u=I=>t.map(v=>({x:s+(v.x-s)*I,y:c+(v.y-c)*I})),l=8;for(let I=0;I<l;I++){let v=u(1-I/l),P=I===l-1?null:u(1-(I+1)/l);Wt(e,v,P,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*_f/mr.length),g=mr.length*y/2/E,x=mr.width*y/2/E,w=[[-g,-x],[g,-x],[g,x],[-g,x]].map(([I,v])=>({x:s+d*I+p*v,y:c+f*I+b*v}));return Wt(e,w,null,i+.004,Rf,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let s=ja(t,Df);return Wt(e,s,null,i,Af,0),e.setMaterial(0),ae(e,t,[s.slice().reverse()],()=>o+Ff,o,Ha,ie(Ha,.9),re),!0}if(n==="ring-boxing"&&t.length===4){let{at:s}=to(t),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],u=[[.77,.19,.19],rt,[.17,.42,.69],rt];e.setMaterial(0),c.forEach((l,m)=>eo(e,l,.07,o,o+Lf,u[m]));for(let l of kf)for(let m=0;m<4;m++)Xt(e,c[m],c[(m+1)%4],.025,o+l-.025,o+l+.025,rt);return!0}if(n==="court-tennis"&&t.length===4){let{at:s}=to(t);e.setMaterial(0),Xt(e,s(0,-6.4),s(0,6.4),.015,o,o+.95,Jn),Xt(e,s(0,-6.4),s(0,6.4),.03,o+.95,o+1,rt);for(let c of[-1,1])eo(e,s(0,c*6.4),.05,o,o+1.07,Jn);return!0}if(n==="court-basketball"&&t.length===4){let{at:s,lengthM:c}=to(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let m=s(l*(u+1.2),0),h=s(l*(u-1.2),0);eo(e,m,.12,o,o+3.4,Jn),Xt(e,m,h,.06,o+3.25,o+3.4,Jn),Xt(e,s(l*(u-1.2),-.9),s(l*(u-1.2),.9),.03,o+2.9,o+3.95,rt)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:s,lengthM:c}=to(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let m of[-2.8,2.8])eo(e,s(l*u,m),.07,o,o+12,rt);Xt(e,s(l*u,-2.8),s(l*u,2.8),.06,o+2.94,o+3.06,rt)}return!0}if(n==="track-athletics"){let s=ja(t,Tf);return s.length<3?!1:(Wt(e,t,s,i,Ef,0),Wt(e,s,null,i,a,4),e.setMaterial(0),!0)}return!1}var Bf=.012,ro=2.4,Nf=1,Vf=.75,Gf=.15;function Ke(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,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,m])=>({x:t.x+l*a-m*s,y:t.y+l*s+m*a}))}function Ja(e,t,n,o,r,i,a=!1){let s=Ke(t);if(s){if(a){let c=ht(o,r.boothTop),u=Ye([...s]);ae(e,Ue(u,Hf/E),[u.slice().reverse()],()=>n+.03,n,c,ie(c,.8),re);return}if(!(!t.points&&i&&Uf(e,s,n,o,i))){if(!t.points&&i&&s.length===4){zf(e,s,n,o,i);return}ae(e,s,void 0,()=>n+ro,n,ht(o,r.boothTop),r.boothWall,re)}}}var fr=1.1,Ka=[.9,.9,.88],Hf=.1,no=[.87,.87,.85],qa=.08;function es(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 u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,m)=>{let h=a(i[0],i[1],c),d=a(i[0],i[1],u),f=a(i[3],i[2],c),p=a(i[3],i[2],u);return[a(h,f,l),a(d,p,l),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 zf(e,t,n,o,r){let{q:i,part:a}=es(t,r),s=o??[.35,.42,.55],c=de(s,[.78,.78,.77],.62),u=de(s,[.95,.95,.94],.45);ue(e,i,n+dt,n,c,ie(c,.8)),ue(e,a(.05,.95,.72,.98),n+fr-.05,n+dt,u,ie(u,.8)),ue(e,a(.03,.97,.7,1),n+fr,n+fr-.05,Ka,ie(Ka,.9))}function Uf(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:a,depthM:s,widthM:c}=es(t,r);if(s<1||c<1)return!1;let u=o??[.35,.42,.55],l=de(u,[.78,.78,.77],.62),m=n+ro,h=qa/c,d=qa/s;ue(e,i,n+dt,n,l,ie(l,.8)),ue(e,a(0,1,1-d,1),m,n+dt,no,ie(no,.9));for(let[b,y]of[[0,h],[1-h,1]])ue(e,a(b,y,0,1-d),m,n+dt,no,ie(no,.9));ue(e,a(h,1-h,0,Math.min(.5,.06/s)),m,m-.3,u,ie(u,.85));let f=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return ue(e,a(.5-f,.5+f,.72-p,.72+p),n+Nf,n+dt,de(u,[.95,.95,.94],.7),ie(u,.75)),!0}function io(e){if(e.shape==="round"){let l=e.radius;return l?Hn(e.center.x,e.center.y,l,l,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,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,m])=>({x:r.x+l*a-m*s,y:r.y+l*s+m*a}))}function ts(e,t,n,o,r,i=!0){let a=io(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,u=h=>a.map(d=>({x:s+(d.x-s)*h,y:c+(d.y-c)*h})),l=i&&o?ht(o,r.tableTop):jf,m=n+Vf;ae(e,a,void 0,()=>m,n+Xf,l,ie(l,.86),re),ae(e,u(.12),void 0,()=>m+.12,m,$a,ie($a,.8),re)}var jf=[.93,.92,.89],$a=[.78,.66,.42],Xf=.25;function ns(e,t,n,o,r,i,a,s,c=[]){let u=ge(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){Mn(e,t,n+o+Bf);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}:je(t),f=s?.baseY??n,p=s?.topY??n+o;if(m&&a){let S=1/0,M=-1/0,C=1/0,T=-1/0;for(let N of u)N.x<S&&(S=N.x),N.x>M&&(M=N.x),N.y<C&&(C=N.y),N.y>T&&(T=N.y);a.push({cx:(S+M)/2*E,cz:(C+T)/2*E,y:p,halfX:Math.max((M-S)/2*E,.5),halfZ:Math.max((T-C)/2*E,.5)})}let b=me(t.fill),y=t.role==="wall"||t.role==="entrance"||t.role==="exit",g=y?b?ie(Xe(b,.12),.95):r.tierTop:m&&b?de(r.stageTop,ie(Xe(b,.18),.9),.9):!t.role&&b?b:ht(b,m?r.stageTop:r.decorTop),x=h?b:null,w=y?b?ie(Xe(b,.12),.85):r.tierWall:m?b?de(r.stageWall,ie(b,.58),.82):r.stageWall:h?x?de(ie(x,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ht(me(t.fill),r.decorWall);if(t.role==="wall"&&!s){Na(e,u,f,p,c,g,w),Mn(e,t,p+.012);return}if(h&&u.length===4&&p-f>.2){let S=ur(u,f,p);if(!S)return;let{quad:M,side:C,trim:T,inner:N,panel:D}=S,R=[.12,.15,.18];for(let[A,L]of[[0,C],[1-C,1]])ue(e,Ie(M,A,L),p,f,R,R);ue(e,N,f+T,f,R,R),ue(e,N,p,p-T,R,R),ue(e,D,p-T,f+T,w,w),Mn(e,t,p+.012);return}let I=b?ie(Xe(b,.15),.82):w,v=b?ie(Xe(b,.1),1.02):g;if(Va(t.role)&&!s&&Ga(e,t.role,u,f,p,I,v,i,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&u.length===4&&p-f>.3){let S=De(u),M=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*E,C=Math.min(.12,.09/Math.max(M,.001)),T=[.18,.21,.24],N=p-Math.min(.12,(p-f)*.15);for(let[D,R]of[[0,C],[1-C,1]])ue(e,Ie(S,D,R),N,f,T,T);ue(e,S,p,N,g,T);return}if(t.role==="rail"&&u.length===4&&p>f){let S=De(u),M=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*E,C=Math.max(1,Math.min(128,Math.ceil(M/1.4))),T=Math.min(.08,.055/Math.max(.055,M)),N=[.58,.64,.66];for(let D=0;D<=C;D++){let R=D/C,A=Math.min(1-T,Math.max(0,R-T/2));ue(e,Ie(S,A,A+T),p,f,N,ie(N,.8))}for(let D of[.52,1]){let R=f+(p-f)*D;ue(e,S,R,Math.max(f,R-.055),N,ie(N,.8))}return}if(t.role==="goal"&&u.length===4){let S=De(u),M=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*E,C=Math.min(.12,.1/Math.max(.1,M)),T=[.9,.94,.94];for(let[N,D]of[[0,C],[1-C,1]])ue(e,Ie(S,N,D),Math.max(f,p-.1),f,T,T);ue(e,S,p,Math.max(f,p-.1),T,T);return}if(d.kind==="portal"&&u.length===4){let S=Ut(u,f,p);if(!S)return;let{quad:M,side:C,face:T,openingTop:N}=S;for(let[D,R,A]of[[0,T,1],[T,1-T,.67],[1-T,1,1]]){let L=vn(M,D,R),O=ie(g,A),_=ie(w,A);for(let[k,V]of[[0,C],[1-C,1]])ue(e,Ie(L,k,V),N,f,O,_);ue(e,L,p,N,O,_)}return}if(d.kind==="suite"&&u.length===4){let S=u.map((T,N)=>{let D=u[(N+1)%4],R=(T.x+D.x)/2,A=(T.y+D.y)/2;return Math.hypot(R-i.x,A-i.y)}),M=S.indexOf(Math.min(...S)),C=[0,1,2,3].map(T=>u[(M+T)%4]);ue(e,Ie(C,0,.08),p,f,g,w),ue(e,Ie(C,.92,1),p,f,g,w),ue(e,vn(C,.88,1),p,f,g,w),ue(e,C,p,Math.max(f,p-.18),g,w);return}if(m&&!t.stageKind?.startsWith("pitch-")&&p-f>.12){let S=p-Math.min(.06,(p-f)*.15);ue(e,u,S,f,g,w),ue(e,u,p,S,g,de(g,w,.2))}else ue(e,u,p,f,g,w);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let S=De(u);for(let M=0;M<12;M++){let C=Ie(S,M/12,(M+1)/12),T=ie(b??[.12,.38,.16],M%2?1.035:.965),N=C.map(D=>[D.x*E,p+.006,D.y*E]);e.tri(N[0],N[1],N[2],[0,1,0],T),e.tri(N[0],N[2],N[3],[0,1,0],T)}}t.stageKind&&t.stageKind!=="pitch-football"&&Ya(e,u,t.stageKind,p,b),m&&Et(t.stageKind)&&Wa(e,t,p),e.setMaterial(h?1:0),Mn(e,t,p+.012)}function ao(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),u=Math.sin(s),l=o/2,m=r/2;return[[-l,-m],[l,-m],[l,m],[-l,m]].map(([h,d])=>({x:i+h*c-d*u,y:a+h*u+d*c}))}function Wf(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 me(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=me(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>de(s,c,1/(u+1)),a[0]):null}function os(e,t,n,o){if(t.layer==="foreground")return;let r=ao(t);if(!r)return;let i=n+Gf,a=ht(Wf(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=de(o.ground,a,s)),ae(e,r,void 0,()=>i,n,a,de(a,o.decorWall,.5),re)}function rs(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=ht(o,r.gaTop);ae(e,t.points,t.holes,()=>n+Za,n,i,r.gaWall,re),qf(e,t.points,n+Za)}var Za=.15,oo=[.72,.74,.76],dr=1.1,Qa=.12,hr=.05,Yf=.06,Kf=2.4;function qf(e,t,n){let o=Ye([...t]),r=Rt(o,Qa/E),i=Rt(o,(Qa+hr)/E);if(r.length<3||i.length<3)return;for(let s of[n+dr,n+dr*.5])ae(e,r,[i.slice().reverse()],()=>s,s-hr,oo,ie(oo,.85),re);let a=Yf/2/E;for(let s=0;s<r.length;s++){let c=r[s],u=r[(s+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*E,m=Math.max(1,Math.round(l/Kf));for(let h=0;h<m;h++){let d=h/m,f=c.x+(u.x-c.x)*d,p=c.y+(u.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+dr-hr,n,oo,ie(oo,.8),re)}}}var pr=.6,is=3,$f=.25;function Zf(e,t){if(Fe(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,u=s*s+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*s),e.y-(i.y+l*c)))}return n}function as(e,t){let n=e.map(a=>({booth:a,ring:Ke(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=(is+pr)/E,i=new Map;return n.forEach(({booth:a,ring:s},c)=>{let u={x:s.reduce((d,f)=>d+f.x,0)/4,y:s.reduce((d,f)=>d+f.y,0)/4},l=[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-u.x,g=b.y-u.y,x=Math.hypot(y,g)||1,w={x:b.x+y/x*pr/E,y:b.y+g/x*pr/E},I=is/E;return o.forEach((v,P)=>{P===c||w.x<v.minX-r||w.x>v.maxX+r||w.y<v.minY-r||w.y>v.maxY+r||(I=Math.min(I,Zf(w,n[P].ring)))}),{open:I*E,toward:{x:b.x+y/x*10/E,y:b.y+g/x*10/E},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),m=Math.max(...l.map(d=>d.open)),h=l.filter(d=>d.open>=m-$f).sort((d,f)=>d.focal-f.focal)[0];i.set(a.id,h.toward)}),i}var ss=lt(require("polygon-clipping"),1);var Qf=.45,Jf=1500,ed=200;function cs(e,t){if(e.role!=="stage"||Et(e.stageKind))return e;let n=ge(e);if(!n||n.length<3||Math.abs(Le(n))*E*E>Jf)return e;let o=t.filter(a=>Fe(n,a.x,a.y));if(!o.length||o.length>ed)return e;let r=Qf/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=ss.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),s=null,c=0;for(let u of a){let l=u[0].slice(0,-1).map(([h,d])=>({x:h,y:d})),m=Math.abs(Le(l));m>c&&(c=m,s=l)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var td=Math.PI/180,pe=96,nd=6,od=60,rd=150,ls=.2,id=.35;function ad(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/td;return n<0?n+360:n}function so(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function co(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 u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;a+=e[u],s++}r[i]=a/s}return r}function us(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=Jo(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=so(o.map(y=>y.x)),d=so(o.map(y=>y.y)),f=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let w=Math.hypot(x.x-s.x,x.y-s.y);w>f&&(f=w)}let p=0,b=f*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-h,x.y-d)<b&&p++;Math.hypot(h-s.x,d-s.y)<=f&&p/a<.01&&(c={x:h,y:d})}let u=[];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(pe-1,Math.floor(ad(c,p)/(360/pe)));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&&u.push(d)}if(!u.length)return null;u.sort((h,d)=>h.rMin+h.rMax-(d.rMin+d.rMax));let l=[];for(let h of u){let d=!1;for(let f of l){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>=id*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||l.push({members:[h],rMin:h.rMin,rMax:h.rMax})}let m=[];for(let h of l){let d=new Array(pe).fill(null);for(let D of h.members)for(let R of D.samples){let A=d[R.bin];A||(A={samples:[]},d[R.bin]=A),A.samples.push({r:R.r,levelM:R.levelM})}let f=d.map(D=>!!D);if(!f.filter(Boolean).length)continue;let b=[],y=[];for(let D of d){if(!D)continue;let R=1/0,A=-1/0;for(let L of D.samples)L.r<R&&(R=L.r),L.r>A&&(A=L.r);b.push(R),y.push(A)}let g=so(b),x=so(y);if(!(g>=ls*x)||!(x>0))continue;let w=[...b].sort((D,R)=>D-R);if(!(w[Math.floor(w.length*.1)]>=ls*x))continue;let v=d.map(D=>{if(!D)return null;let R=[...D.samples].sort((B,z)=>B.r-z.r),A=R[0].r,L=R[R.length-1].r,O=R[0].levelM,_=-1/0;for(let B of R)B.levelM>_&&(_=B.levelM);let k=[];for(let B of R){let z={r:B.r,l:B.levelM};for(;k.length&&Math.abs(k[k.length-1].r-z.r)<1e-9;){if(k[k.length-1].l<=z.l){z.skip=!0;break}k.pop()}if(!z.skip){for(;k.length>=2;){let U=k[k.length-2],G=k[k.length-1];if((G.r-U.r)*(z.l-U.l)-(G.l-U.l)*(z.r-U.r)<=0)k.pop();else break}k.push(z)}}let V=k.map(B=>B.r),F=k.map(B=>B.l);return{inner:A,outer:L,front:O,top:_,profile:{rs:V,ls:F}}}),P=f.slice();for(let D=0;D<pe;D++){if(P[D])continue;let R=-1,A=-1,L=0;for(let H=1;H<=pe;H++){let K=(D-H+pe*2)%pe;if(P[K]){R=K;break}}for(let H=1;H<=pe;H++){let K=(D+H)%pe;if(P[K]){A=K,L=H;break}}if(R<0||A<0)continue;let O=0;for(let H=1;H<=pe;H++){let K=(D-H+pe*2)%pe;if(f[K]){O=H;break}}if(O-1+L>nd)continue;let k=v[R],V=v[A],F=O/(O+L),B=k.inner+(V.inner-k.inner)*F,z=k.outer+(V.outer-k.outer)*F,U=k.front+(V.front-k.front)*F,G=k.top+(V.top-k.top)*F;v[D]={inner:B,outer:z,front:U,top:G,profile:{rs:[B,z],ls:[U,G]}}}for(let D=0;D<pe;D++)v[D]&&(P[D]=!0);let S=360/pe,M=[],C=P.filter(Boolean).length,T=[];if(C===pe)T.push({start:0,len:pe});else{let D=0;for(;P[D];)D=(D+1)%pe;let R=-1;for(let A=0;A<=pe;A++){let L=(D+A)%pe,O=A<pe&&P[L];if(O&&R<0)R=L;else if(!O&&R>=0){let _=(L-R+pe)%pe||pe;T.push({start:R,len:_}),R=-1}}}for(let D of T){if(D.len*S<od&&D.len<pe)continue;let R=D.len===pe,A=new Float64Array(D.len),L=new Float64Array(D.len),O=new Float64Array(D.len),_=new Float64Array(D.len),k=[];for(let H=0;H<D.len;H++){let K=v[(D.start+H)%pe];A[H]=K.inner,L[H]=K.outer,O[H]=K.front,_[H]=K.top,k.push(K.profile??{rs:[K.inner,K.outer],ls:[K.front,K.top]})}let V=co(A,R),F=co(L,R),B=co(O,R),z=co(_,R);for(let H=0;H<D.len;H++)V[H]>A[H]&&(V[H]=A[H]),F[H]<L[H]&&(F[H]=L[H]),V[H]>F[H]-1e-6&&(V[H]=Math.max(0,F[H]-1e-6)),z[H]<B[H]&&(z[H]=B[H]);let U={startBin:D.start,binCount:D.len,closed:R,innerR:V,outerR:F,frontLevelM:B,topLevelM:z,profiles:k},G=(H,K,Q)=>{let Y=k[H],W=Y.rs,Z=Y.ls;if(K<=W[0]){Z[0]>Q&&(Z[0]=Q);return}if(K>=W[W.length-1]){Z[Z.length-1]>Q&&(Z[Z.length-1]=Q);return}for(let ee=0;ee+1<W.length;ee++)if(K<=W[ee+1]){Z[ee]>Q&&(Z[ee]=Q),Z[ee+1]>Q&&(Z[ee+1]=Q);return}};for(let H=0;H<D.len;H++){let K=d[(D.start+H)%pe];if(K)for(let Q of K.samples){G(H,Q.r,Q.levelM);let Y=R?(H-1+D.len)%D.len:H-1,W=R?(H+1)%D.len:H+1;Y>=0&&G(Y,Q.r,Q.levelM),W<D.len&&G(W,Q.r,Q.levelM)}}M.push(U)}M.reduce((D,R)=>D+R.binCount*S,0)<rd||m.push({arcs:M,sectionIds:h.members.map(D=>D.sectionId),innerRMedian:g,outerRMedian:x})}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:pe,binStepDeg:360/pe,rings:m}}function ms(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,u=l=>{let m=t.profiles[l],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 u(a)*(1-c)+u(s)*c}function br(e,t,n,o,r,i,a,s,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let m=(p,b,y)=>{ot(e,p,b,y,u,a,s,{portalBase:l,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)*le;if(y<1e-5)continue;let g=(v,P)=>[h(t[p],t[b],v),h(t[p],t[b],P),h(n[p],n[b],P),h(n[p],n[b],v)];m(g(0,1),r,r+.95),m(g(0,1),i-.22,i);let x=Math.ceil((f-.32)/6)*6,w=!1,I=!1;for(let v=x;v<f+y;v+=6){let P=Math.max(0,(v-f)/y),S=Math.min(1,(v+.32-f)/y);S<=P||(m(g(P,S),r+.95,i-.22),w||=P<1e-6,I||=S>1-1e-6)}if(!o&&(p===0&&!w||p===d-1&&!I)){let v=Math.min(1,.32/y);m(g(p===0?0:1-v,p===0?v:1),r+.95,i-.22)}f+=y}}var Sn=.65;function fs(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,u=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-u*s,e.y-i.y-u*c))}return n}var ds=.01;function hs(e,t,n,o,r,i,a,s=[],c=!0){if(o-r<=1e-5)return;let u=o-r>=3,l=u?o-Sn:r;e.setMaterial(5);let m=u?[]:s.filter(w=>{if(w.role!=="entrance"&&w.role!=="exit")return!1;let I=ge(w);if(!I)return!1;let v=Ut(I,r,r+je(w).heightM);return v!==null&&v.openingTop<=o-.12});if((!m.length||!ot(e,t,l,o,m,i,a,{holes:n,portalBase:r}))&&ae(e,t,n,()=>o,l,i,a,re,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let h=6/E,d=.22/E,f=s.flatMap(w=>{if(w.role!=="entrance"&&w.role!=="exit")return[];let I=ge(w);return I?.length?[{minX:Math.min(...I.map(v=>v.x)),maxX:Math.max(...I.map(v=>v.x)),minY:Math.min(...I.map(v=>v.y)),maxY:Math.max(...I.map(v=>v.y))}]:[]}),p=Math.min(...t.map(w=>w.x)),b=Math.max(...t.map(w=>w.x)),y=Math.min(...t.map(w=>w.y)),g=Math.max(...t.map(w=>w.y));for(let w=p+h/2;w<b;w+=h)for(let I=y+h/2;I<g;I+=h){if(f.some(P=>w+d>=P.minX&&w-d<=P.maxX&&I+d>=P.minY&&I-d<=P.maxY))continue;let v=[{x:w-d,y:I-d},{x:w+d,y:I-d},{x:w+d,y:I+d},{x:w-d,y:I+d}];!_e({x:w,y:I},t,n)||fs({x:w,y:I},[t,...n??[]])<d*Math.SQRT2+(c?yr/E:0)||ae(e,v,void 0,()=>l,r,i,a,re)}let x=Rt(t,yr/E);if(c&&x.length>=3){let w=s.filter(P=>{if(P.role!=="entrance"&&P.role!=="exit")return!1;let S=ge(P);return!!S&&S.some(M=>!_e(M,t,void 0)||fs(M,[t])<=yr/E)}),I=[x.slice().reverse()],v=r-ds;(!w.length||!ot(e,t,v,l,w,i,a,{holes:I,portalBase:r+ds}))&&ae(e,t,I,()=>l,v,i,a,re)}e.setMaterial(0)}var yr=.25;var sd=.02,cd=.25,ld=1.2,ud=.6,md=.45,fd=2.3,dd=Math.PI/180,ps=.005;function qe(e,t,n){let o=n*dd;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function hd(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 pd=24,bd=.01;function yd(e,t,n,o,r,i,a,s,c){let u=n.binCount,l=pd,m=le,h=i+.02,d=i-bd,f=[];for(let R=0;R<u;R++){let A=(n.startBin+R+.5)*t.binStepDeg,L=new Float64Array(l+1);for(let O=0;O<=l;O++){let _=o[R]+(r[R]-o[R])*O/l;L[O]=Math.max(h,ms(t,n,A,_)-cd)}f.push(L)}if(c){let R=0;for(let A=0;A+1<u;A++)for(let L=0;L<l;L++){let O=qe(t.centre,o[A]+(r[A]-o[A])*L/l,(n.startBin+A+.5)*t.binStepDeg),_=qe(t.centre,o[A+1]+(r[A+1]-o[A+1])*(L+1)/l,(n.startBin+A+1.5)*t.binStepDeg);R=Math.max(R,Math.hypot(_.x-O.x,_.y-O.y))}for(let A=0;A<u;A++){let L=(n.startBin+A+.5)*t.binStepDeg;for(let O=0;O<=l;O++){let _=qe(t.centre,o[A]+(r[A]-o[A])*O/l,L),k=c(_.x,_.y,R*1.01);k!==null&&(f[A][O]=Math.min(f[A][O],Math.max(d+ps,k-ps)))}}}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],x=(R,A)=>{let L=(n.startBin+R+.5)*t.binStepDeg,O=o[R]+(r[R]-o[R])*A/l,_=qe(t.centre,O,L);return[_.x*m,f[R][A],_.y*m]};{let R=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let L=!1;for(let _=0;_<u;_++)for(let k=l-1;k>=0;k--)f[_][k]>f[_][k+1]&&(f[_][k]=f[_][k+1],L=!0);let O=n.closed?u:u-1;for(let _=0;_<O;_++){let k=(_+1)%u;for(let V=0;V<=l;V++){let F=f[k][V]-f[_][V];if(Math.abs(F)>1)continue;let B=o[_]+(r[_]-o[_])*V/l,z=o[k]+(r[k]-o[k])*V/l,U=qe(t.centre,B,(n.startBin+_+.5)*t.binStepDeg),G=qe(t.centre,z,(n.startBin+k+.5)*t.binStepDeg),H=R*Math.hypot(G.x-U.x,G.y-U.y)*m;F>H?(f[k][V]=f[_][V]+H,L=!0):-F>H&&(f[_][V]=f[k][V]+H,L=!0)}}if(!L)break}}let w=1,I=(R,A)=>{for(let L=0;L<=l;L+=4)if(Math.abs(f[R][L]-f[A][L])>w)return!0;return Math.abs(f[R][l]-f[A][l])>w},v=Math.tan(38*Math.PI/180),P=R=>(r[R]-o[R])/l*m,S=(R,A)=>f[R][A+1]-f[R][A]>v*Math.max(1e-6,P(R)),M=(R,A)=>{let L=n.closed?(R-1+u)%u:Math.max(0,R-1),O=n.closed?(R+1)%u:Math.min(u-1,R+1);Math.abs(f[L][A]-f[R][A])>w&&(L=R),Math.abs(f[O][A]-f[R][A])>w&&(O=R);let _=Math.max(0,A-1),k=Math.min(l,A+1);_<A&&S(R,_)&&(_=A),k>A&&S(R,A)&&(k=A);let V=x(L,A),F=x(O,A),B=x(R,_),z=x(R,k),U=F[0]-V[0],G=F[1]-V[1],H=F[2]-V[2],K=z[0]-B[0],Q=z[1]-B[1],Y=z[2]-B[2],W=G*Y-H*Q,Z=H*K-U*Y,ee=U*Q-G*K,q=Math.hypot(W,Z,ee);return q>1e-12?(W/=q,Z/=q,ee/=q,Z<0&&(W=-W,Z=-Z,ee=-ee),[W,Z,ee]):[0,1,0]},C=(R,A,L=!1)=>{let O=L&&Math.min(R[1],A[1])-i>=3,_=[R[0],O?R[1]-Sn:d,R[2]],k=[A[0],O?A[1]-Sn:d,A[2]],V=A[0]-R[0],F=A[2]-R[2],B=Math.hypot(V,F);if(!(B>1e-12))return;let z=[F/B,0,-V/B];e.tri(R,A,k,z,y,y,g),e.tri(R,k,_,z,y,g,g)},T=.05*Ve,N=R=>r[R]-o[R]<T,D=n.closed?u:u-1;for(let R=0;R<D;R++){let A=(R+1)%u;if(N(R)||N(A))continue;if(I(R,A)){let F=(n.startBin+R+1)*t.binStepDeg,B=(Q,Y)=>{let W=(o[R]+o[A])/2,Z=(r[R]+r[A])/2,ee=W+(Z-W)*Y/l,q=qe(t.centre,ee,F);return[q.x*m,f[Q][Y],q.y*m]};for(let Q=0;Q<l;Q++){let Y=x(R,Q),W=x(R,Q+1),Z=B(R,Q),ee=B(R,Q+1),q=M(R,Q),oe=M(R,Q+1);e.triN(Y,Z,ee,q,q,oe,p),e.triN(Y,ee,W,q,oe,oe,p);let te=x(A,Q),$=x(A,Q+1),ne=B(A,Q),he=B(A,Q+1),Te=M(A,Q),Pe=M(A,Q+1);e.triN(ne,te,$,Te,Te,Pe,p),e.triN(ne,$,he,Te,Pe,Pe,p);let ke=B(R,Q),Se=B(R,Q+1),Je=B(A,Q+1),Zt=B(A,Q),it=Se[0]-ke[0],at=Se[2]-ke[2],vt=Math.hypot(it,at);if(vt>1e-12){let Qt=[at/vt,0,-it/vt];e.tri(ke,Se,Je,Qt,y),e.tri(ke,Je,Zt,Qt,y)}}let z=x(R,0),U=x(A,0),G=x(A,l),H=x(R,l),K=Q=>[Q[0],d,Q[2]];Math.min(z[1],U[1])-i<3&&(e.tri(K(z),K(G),K(U),[0,-1,0],b),e.tri(K(z),K(H),K(G),[0,-1,0],b)),C(z,U,!0),C(H,G,!0);continue}for(let F=0;F<l;F++){let B=M(R,F),z=M(A,F),U=M(A,F+1),G=M(R,F+1);if(S(R,F)||S(A,F)){let W=(Se,Je)=>{let Zt=(n.startBin+Se+.5)*t.binStepDeg,it=o[Se]+(r[Se]-o[Se])*(F+.5)/l,at=qe(t.centre,it,Zt);return[at.x*m,Je,at.y*m]},Z=x(R,F),ee=x(A,F),q=W(R,f[R][F]),oe=W(A,f[A][F]);e.triN(Z,ee,oe,B,z,z,p),e.triN(Z,oe,q,B,z,B,p);let te=x(A,F+1),$=x(R,F+1),ne=W(R,f[R][F+1]),he=W(A,f[A][F+1]);e.triN(ne,he,te,G,U,U,p),e.triN(ne,te,$,G,U,G,p);let Te=oe[0]-q[0],Pe=oe[2]-q[2],ke=Math.hypot(Te,Pe);if(ke>1e-12){let Se=[-Pe/ke,0,Te/ke];e.tri(q,oe,he,Se,y),e.tri(q,he,ne,Se,y)}continue}let H=x(R,F),K=x(A,F),Q=x(A,F+1),Y=x(R,F+1);e.triN(H,K,Q,B,z,U,p),e.triN(H,Q,Y,B,U,G,p)}let L=x(R,0),O=x(A,0),_=x(A,l),k=x(R,l),V=F=>[F[0],d,F[2]];Math.min(L[1],O[1])-i<3&&(e.tri(V(L),V(_),V(O),[0,-1,0],b),e.tri(V(L),V(k),V(_),[0,-1,0],b)),C(L,O,!0),C(k,_,!0)}if(!n.closed)for(let R of[0,u-1])for(let A=0;A<l;A++)C(x(R,A),x(R,A+1))}function bs(e,t,n){let{bottomY:o,colors:r,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let m of l.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]-Ge);h[p]=Math.max(y,a[b]+.001),d[p]=Math.max(h[p]+.001,m.outerR[p]+Ge)}let f=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>f&&(f=b)}f>=ld&&yd(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||hd(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=ud*Ve,u=md*Ve;for(let l of s.arcs){let m=[],h=[];for(let M=0;M<l.binCount;M++){let C=(l.startBin+M+.5)*t.binStepDeg,T=l.outerR[M]+Ge+c;m.push(qe(t.centre,T,C)),h.push(qe(t.centre,T+u,C))}let d=-1/0;for(let M=0;M<l.binCount;M++)l.topLevelM[M]>d&&(d=l.topLevelM[M]);let f=d+fd,p=l.closed?h:[...h,...m.slice().reverse()],b=l.closed?[m.slice().reverse()]:void 0,y=de(r.shellWall,[.66,.71,.72],.62),g=(M,C,T,N,D)=>{let R=Math.abs(N-d)<1e-6?N-sd:N;ot(e,M,T,R,n.shapes,r.shellTop,D,{holes:C,portalBase:o,ao:i})||ae(e,M,C,()=>R,T,r.shellTop,D,i)},x=Math.max(1,Math.ceil((d-o)/4.5)),w=(d-o)/x,I=new Set,v=n.tierFrontLevels??t.rings.map(M=>{let C=M.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,N)=>T-N);return C[Math.floor(C.length/2)]});for(let M of v)Number.isFinite(M)&&M-o>=3&&M<d&&I.add(Math.max(0,Math.min(x-1,Math.floor((M-o)/w))));let P=Math.min(...v.filter(M=>Number.isFinite(M)&&M-o>=3&&M<d));for(let M=0;M<x;M++)o+(M+1)*w<=P-Sn&&Number.isFinite(P)&&I.add(M);for(let M=0;M<x;M++){let C=o+(d-o)*M/x,T=o+(d-o)*(M+1)/x;I.has(M)&&T-C>=3.2?(g(p,b,C,C+.45,y),br(e,m,h,l.closed,C+.45,T-.16,r.shellTop,y,i,n.shapes,o)):g(p,b,C,T-.16,y),g(p,b,T-.16,T,ie(y,.62))}br(e,m,h,l.closed,d,f,r.shellTop,y,i,n.shapes,o);let S=8;for(let M=1;M<h.length;M++){if(S+=Math.hypot(h[M].x-h[M-1].x,h[M].y-h[M-1].y)*le,S<8)continue;S=0;let C=h[M],T=h[M-1],N=C.x-T.x,D=C.y-T.y,R=Math.max(1,Math.hypot(N,D)),A=N/R*.16*Ve,L=D/R*.16*Ve,O=Math.max(1,Math.hypot(C.x-t.centre.x,C.y-t.centre.y)),_=(C.x-t.centre.x)/O*.24*Ve,k=(C.y-t.centre.y)/O*.24*Ve,V=[{x:C.x-A,y:C.y-L},{x:C.x+A,y:C.y+L},{x:C.x+A+_,y:C.y+L+k},{x:C.x-A+_,y:C.y-L+k}];g(V,void 0,o,d,ie(y,1.12))}}}function ys(e,t,n,o){let r=new Map;for(let s of t){let c=r.get(s.blockId);(!c||s.depth<c.depth)&&r.set(s.blockId,s)}let i=[.68,.72,.72],a=[.48,.55,.57];for(let s of r.values()){if(s.y-o<2.5||s.pts.length<2)continue;let c=s.pts.map(l=>{let m=l.x-n.x,h=l.y-n.y,d=Math.max(1,Math.hypot(m,h));return{x:l.x-m/d*.65/E,y:l.y-h/d*.65/E}}),u=2;for(let l=1;l<c.length;l++){let m=c[l-1],h=c[l],d=h.x-m.x,f=h.y-m.y,p=Math.hypot(d,f);if(p<1e-5||p*E>2)continue;let b=y=>{let g=-f/p*y/E/2,x=d/p*y/E/2;return[{x:m.x+g,y:m.y+x},{x:h.x+g,y:h.y+x},{x:h.x-g,y:h.y-x},{x:m.x-g,y:m.y-x}]};ae(e,b(.22),void 0,()=>s.y-.06,s.y-.56,i,i,re);for(let y of[.5,.95])ae(e,b(.045),void 0,()=>s.y+y,s.y+y-.045,a,a,re);if(u+=p*E,u>=1.8||l===c.length-1){u=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.y+.95-.045,s.y-.06,a,a,re)}}}}function gs(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 u=s.pts[c],l=s.pts[c===0?1:c-1],m=u.x-l.x,h=u.y-l.y,d=Math.hypot(m,h);if(d<1e-5)continue;m/=d,h/=d;let f=1/0;for(let S=0;S<n.length;S++){let M=n[S],C=n[(S+1)%n.length],T=C.x-M.x,N=C.y-M.y,D=m*N-h*T;if(Math.abs(D)<1e-8)continue;let R=M.x-u.x,A=M.y-u.y,L=(R*N-A*T)/D,O=(R*h-A*m)/D;L>0&&O>=0&&O<=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:u.x+m*p-h*y,y:u.y+h*p+m*y},{x:u.x+m*b-h*y,y:u.y+h*b+m*y},{x:u.x+m*b+h*y,y:u.y+h*b-m*y},{x:u.x+m*p+h*y,y:u.y+h*p-m*y}];if(!g.every(S=>Fe(n,S.x,S.y)))continue;let x=r?.[a]?.belowY,w=x==null?0:s.y-x,I=!!o&&w>.03&&w<=.65;if(I&&o){let S=(M,C)=>Math.hypot((M.x+C.x)/2-o.x,(M.y+C.y)/2-o.y);S(g[0],g[1])>S(g[3],g[2])&&(g=[g[3],g[2],g[1],g[0]])}let v=I?Math.ceil((w-1e-8)/.2):1,P=(S,M,C)=>({x:S.x+(M.x-S.x)*C,y:S.y+(M.y-S.y)*C});for(let S=0;S<v;S++){let M=S/v,C=(S+1)/v,T=[P(g[0],g[3],M),P(g[1],g[2],M),P(g[1],g[2],C),P(g[0],g[3],C)],N=s.y+.008-(I?w*(1-C):0);if(ae(e,T,void 0,()=>N,N-(I?w/v+.1:.16),i,[.43,.47,.46],re),!I)continue;let D=Math.hypot(T[3].x-T[0].x,T[3].y-T[0].y)*E,R=Math.min(.04/D,.25),A=P(T[0],T[3],R),L=P(T[1],T[2],R),O=k=>[k.x*E,N+.004,k.y*E],_=[.66,.59,.39];e.tri(O(T[0]),O(T[1]),O(L),[0,1,0],_),e.tri(O(T[0]),O(L),O(A),[0,1,0],_)}}}}function xs(e,t,n,o,r,i,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),m=Ta(o,s.tierTop);if(!r)return;let h=g=>r.deckAt(g.x,g.y),d=Ca(t,a),f=d[0]??t.outline;if(r.rowLevels.length>=2){let g=qn(r.rowLevels),x=Ra(va(r.rowLevels,n.focal,g),d);for(let I of x){let v=Math.max(u,I.topY-vs);for(let P of i.subtract(I.outline,v))hs(e,P,I.holes,v,u,s.tierTop,s.tierWall,l,!c)}x.length||ae(e,f,t.holes,()=>r.landingY,u,m,s.tierWall,re);let w={tread:[m[0]*re.top,m[1]*re.top,m[2]*re.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let I of d.length?d:[f])Sa(e,r.rowLevels,n.focal,r.landingY,w,I,g);ys(e,r.rowLevels,n.focal,u),gs(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:Ea,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,u,m,s.tierWall,re,p,b)}function gd(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 u=t[a];if(u.kind==="booth")continue;let l=r.get(s);l||(l=new Map,r.set(s,l));let m=u.rowId||`__seat-${a}`,h=l.get(m);h||(h={pts:[],levelM:0,n:0},l.set(m,h)),h.pts.push({x:u.x,y:u.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 u=s.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=r.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function xd(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 vs=.02;function vd(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 l of o.outline)l.x<i&&(i=l.x),l.x>a&&(a=l.x),l.y<s&&(s=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-vs);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,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(!_e(c,s.outline,s.holes)&&xd(c,s.outline)>i)continue;let u=Math.min(s.surface.deckAt(o,r),s.floorTop);(a===null||u<a)&&(a=u)}return a}}var Md=3,Sd=.4;function Ms(e,t,n,o,r,i,a=!0){let s=gd(t,n,o);if(s.length<Md)return;let c=us(s,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((m,h)=>m+h.binCount,0)))/c.binCount;e.setMaterial(5),bs(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(l=>Math.min(...l.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:re,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a&&u>=Sd,standTopNear:vd(t,o)}),e.setMaterial(0)}var Ss=4;var wd=[[/\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"]];function Pd(e){if(!e)return null;for(let[t,n]of wd)if(t.test(e))return n;return null}var Is="auto-rows-";function Cs(e){return e.id.startsWith(Is)&&!e.label}var Id=1.15,Cd=.09,Rd=6,Ad=34,Ed=.35,_d=6,Td=.35,kd=.75,Ld=12,Fd=2.5,Dd=40,ws=[18,24],Od=.8,Bd=.6,Nd=5,Vd=.3,Rs=.4,Gd=2,Hd=400,zd=2.6,Ud=1.6,jd=6e3,Xd=.6,Wd="#c3c7cd",Ps=300,Yd=240;function Kd(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=xr([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Yd)return null;let{h:a,s,l:c}=si(ii(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&ge(l)?.some(m=>Sr(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var qd="Estimated from the drawing; confirm with the venue.",As=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},xr=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),vr=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 $d(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Mr(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 Sr(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 wr(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,u=s*s+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u)):0,m={x:i.x+s*l,y:i.y+c*l},h=Math.hypot(e.x-m.x,e.y-m.y);h<o&&(o=h,n=m)}return n}function Es(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,u=Math.hypot(s,c);if(u<1e-6)continue;let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=wr(l,t),h=m.x-l.x,d=m.y-l.y,f=Math.hypot(h,d);f<1e-6||(o+=Math.abs((-c*h+s*d)/(u*f))*r.length,n+=r.length)}return n?o/n:0}function Zd(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:xr(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 u=(a-i)*(c-s),l=[];for(let p of o){if(p.role)continue;let b=ge(p);if(!b)continue;let y=vr(b);if(y*le*le<6||y>u)continue;let g=Math.min(...b.map(M=>M.x)),x=Math.max(...b.map(M=>M.x)),w=Math.min(...b.map(M=>M.y)),I=Math.max(...b.map(M=>M.y)),v=0;for(let M of n)M.x>g&&M.x<x&&M.y>w&&M.y<I&&Sr(M,b)&&v++;if(v>n.length*.05)continue;let P=xr(b),S=Es(t,b);S>=Od&&l.push({shape:p,centre:P,outline:b,score:S,area:y,box:[g,w,x,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=l.filter(p=>!l.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 Qd(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=wr(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function _s(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 Jd(e){if(!e.length||e.length>jd)return[];let t=[...Mr(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),r=Ud/le,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 u=i[s],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.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 u=o(c),l=a.get(u);l?l.push(...s):a.set(u,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function eh(e,t,n){if(!t.length)return null;let o=t.filter(S=>n.tableIds.has(S.rowId)||S.kind==="booth").length>t.length/2,r=Mr(t),i=!n.outline||Es(r,n.outline)>=Bd,a=0,s=0;for(let S of r.values()){if(S.length<2)continue;let M=S[0],C=S[S.length-1],T=C.x-M.x,N=C.y-M.y,D=Math.hypot(T,N);if(D<1e-6)continue;let R={x:(M.x+C.x)/2,y:(M.y+C.y)/2},A=i?n.outline?wr(R,n.outline):n.focal:n.middle,L=-N/D,O=T/D;L*(A.x-R.x)+O*(A.y-R.y)<0&&(L=-L,O=-O),a+=L*S.length,s+=O*S.length}let c={x:t.reduce((S,M)=>S+M.x,0)/t.length,y:t.reduce((S,M)=>S+M.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let S=i?n.focal:n.middle;a=S.x-c.x,s=S.y-c.y}let u=Math.hypot(a,s)||1,l={x:a/u,y:s/u},m=S=>-(S.x*l.x+S.y*l.y),h=S=>-S.x*l.y+S.y*l.x,d=1/0,f=-1/0,p=1/0,b=-1/0,y=1/0,g=new Map;for(let S of t){let M=m(S),C=h(S);d=Math.min(d,M),f=Math.max(f,M),p=Math.min(p,C),b=Math.max(b,C),i&&(y=Math.min(y,Qd(S,n.focal,n.outline)));let T=S.logicalRowId??S.rowId,N=g.get(T);N?N.push(M):g.set(T,[M])}i||(y=Math.max(0,d-m(n.middle)));let x=[...g.values()].map(S=>As(S)).sort((S,M)=>S-M),w=[];if(!o)for(let S of x)w.length&&S-w[w.length-1]<Td/le||w.push(S);let I=$d(e),v=mt(e,{floorBaseHeightM:n.baseHeightM}),P={id:e.id,section:e,authored:I,plane:n,facing:l,facesAction:i,hull:_s(t),sample:t.filter((S,M)=>M%Math.ceil(t.length/Hd)===0),frontD:d,backD:f,latMin:p,latMax:b,frontDistance:y,rowDepths:w,rowCount:w.length,level:0,height:v.height,rake:I?v.rake:0,backHeight:0};return P.backHeight=P.height+(f-d)*le*Math.tan(P.rake*Math.PI/180),P}function th(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*le),i=n+Id-o,a=0,s=0;for(let u=1;u<e.length;u++){let l=Math.max(kd,(e[u]-e[u-1])*le),m=(i+Cd)*(r+l)/r;a+=m-i,s+=l,i=m,r+=l}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(Rd,Math.min(Ad,c))*10)/10}function nh(e,t){if(e.facing.x*t.facing.x+e.facing.y*t.facing.y<Vd)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)<Rs*(e.latMax-e.latMin))return null;let a=Gd/le,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 u=[];for(let[m,h]of s){let d=c.get(m);d!==void 0&&u.push(h-d)}let l=u.length?As(u):e.frontD-n;return l<-1/le?null:l}function oh(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 u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}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>Rs*(e.latMax-e.latMin)&&s>1/le}function rh(e){let t=new Map,n=[...e].sort((a,s)=>a.plane.floorIndex-s.plane.floorIndex||a.frontDistance-s.frontDistance),o=[],r=new Map,i=a=>{if(a.plane.floorIndex===0||a.plane.baseHeightM>0)return a.plane.baseHeightM;let s=r.get(a.plane.floorIndex-1);return s===void 0?a.plane.baseHeightM:s+Ss};for(let a of n){if(!a.authored){let c=i(a),u;for(let m of o){if(m.plane.floorIndex>a.plane.floorIndex)continue;if(oh(a,m)){let f=m.backHeight+zd;f>c&&(c=f,u=m);continue}let h=nh(a,m);if(h==null)continue;let d=m.backHeight+Ed+Math.min(_d,Math.max(0,h)*le)*Math.tan(m.rake*Math.PI/180);d>c&&(c=d,u=m)}a.height=Math.round(Math.min(c,a.plane.baseHeightM+Dd)*100)/100;let l=!u&&a.height>a.plane.baseHeightM;if(a.level=u?u.level+1:l?1:0,a.rake=th(a.rowDepths,a.frontDistance,a.height,a.plane.focalHeightM),!a.facesAction&&a.rowCount<Nd)a.rake=0;else if(!u&&!l){let m=Math.max(1e-6,(a.backD-a.frontD)*le);a.rake=Math.min(a.rake,Ld,Math.round(Math.atan(Fd/m)*1800/Math.PI)/10)}else a.rowCount>=2&&(a.rake=Math.max(a.rake,ws[Math.min(a.level,ws.length)-1]));a.backHeight=a.height+(a.backD-a.frontD)*le*Math.tan(a.rake*Math.PI/180),t.set(a.id,u?.id)}let s=a.plane.floorIndex;r.set(s,Math.min(r.get(s)??1/0,a.height)),o.push(a)}return t}var gr=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function lo(e,t={x:0,y:-40}){let n=Gt(e),o=new Map;for(let f of n){if(!f.sectionId)continue;let p=o.get(f.sectionId);p?p.push(f):o.set(f.sectionId,[f])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((f,p)=>({objects:f.objects,floorIndex:p,floorId:f.id,baseHeightM:f.baseHeightM??0,focal:f.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(i.flatMap(f=>f.objects.filter(p=>p.type==="table").map(p=>p.id))),s=[],c,u=new Set,l=i.map(f=>{let p=C=>!e.floors?.length||C.floorId===f.floorId,b=Jd(n.filter(C=>!C.sectionId&&C.kind!=="booth"&&!a.has(C.rowId)&&p(C))),y=[];for(let C of b){let T=Ue(Ye(_s(C)),Xd/le);if(n.some(D=>!p(D)&&Sr(D,T)))continue;let N=`${Is}${f.floorIndex}-${y.length}`;u.add(N),o.set(N,C),y.push({type:"section",id:N,label:"",color:Wd,outline:T})}let g=y.length?{...f,objects:[...f.objects,...y]}:f,x=new Set(g.objects.filter(C=>C.type==="section").map(C=>C.logicalSectionId??C.id)),w=[...o.entries()].filter(([C])=>x.has(C)).flatMap(([,C])=>C),I=Zd(g.objects,Mr(w),w),v=g.focal;(I||g.focal&&!gr(g.focal,t))&&(r.confident=!0),I&&(r.stage??={id:I.shape.id,inferred:I.inferred,...g.floorId?{floorId:g.floorId}:{}},(I.inferred||gr(g.focal,t))&&(v=I.centre,r.focalInferred=!0));let P=I&&(!I.inferred||vr(I.outline)*le*le<=Ps),S=I?void 0:c,M={tableIds:a,floorIndex:g.floorIndex,floorId:g.floorId,baseHeightM:g.baseHeightM,focal:S?.focal??v,outline:I?.outline??S?.outline,focalHeightM:S?.focalHeightM??g.baseHeightM+(I&&P?je({...I.shape,role:"stage"}).heightM:0),middle:w.length?{x:w.reduce((C,T)=>C+T.x,0)/w.length,y:w.reduce((C,T)=>C+T.y,0)/w.length}:v};for(let C of g.objects){if(C.type!=="section")continue;let T=eh(C,o.get(C.logicalSectionId??C.id)??[],M);T&&s.push(T)}return M.outline&&(c=M),gr(g.focal,M.focal)||(r.focal??=[]).push({...g.floorId?{floorId:g.floorId}:{},point:{...M.focal}}),{unit:g,plane:M,stage:I,planeSeats:w}}),m=rh(s),h=new Map(s.filter(f=>!f.authored).map(f=>[f.id,f])),d=l.map(({unit:f,plane:p,stage:b,planeSeats:y})=>f.objects.map(g=>{let x=g.type==="shape"&&!g.role&&g.id!==b?.shape.id?Pd(g.label):null;if(x&&g.type==="shape")return(r.roles??=[]).push({id:g.id,...p.floorId?{floorId:p.floorId}:{},role:x}),{...g,role:x};let w=b?.inferred&&g.id===b.shape.id&&g.type==="shape"?Kd(g,b.outline,f.objects,y):null;if(w&&g.type==="shape")return r.stage?.id===g.id&&(r.stage.field=w),{...g,role:"stage",stageKind:w};if(b?.inferred&&g.id===b.shape.id&&g.type==="shape"&&vr(b.outline)*le*le<=Ps)return r.stage?.id===g.id&&(r.stage.deck=!0),{...g,role:"stage"};let I=g.type==="section"?h.get(g.id):void 0;if(!I||g.type!=="section")return g;let v=I.rowCount>=2&&I.rake>0;u.has(I.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:I.id,floorId:p.floorId,surfaceKind:v?"rakedRows":"flat",height:I.height,rake:I.rake,stackedOn:m.get(I.id)});let P={status:"inferred",source:"public-2d-topology",note:qd};return{...g,height:I.height,rake:I.rake,surfaceKind:v?"rakedRows":"flat",physical3dProvenance:{height:P,rake:P,surfaceKind:P}}}));if(e.floors?.length){let f=e.floors.map((p,b)=>({...p,objects:d[b],focalPoint:l[b].plane.focal}));return{doc:{...e,floors:f,objects:f[0].objects,focalPoint:f[0].focalPoint},report:r}}return{doc:{...e,objects:d[0],focalPoint:l[0].plane.focal},report:r}}var Ts=/^[\p{L}\p{N}]{1,4}$/u,ih=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function ks(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(Ts.test(a))return a}let i=ih.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((r.startsWith(a)||a.startsWith(r))&&Ts.test(s))return s}return e}function Ls(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 Fs(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 ah=1.15,sh=2.75,ch=4.5,lh=.85,uh=.5,mh=.26;function Ds(e,t,n){let o=Math.max(1e-6,t),r=e/o,i=n?.hasZoneLabels??!0,a=new Set;return r>=.75&&a.add("floor"),r>=ah&&a.add("zone"),r<=(i?sh:ch)&&(a.add("section"),a.add("ga")),r<=lh&&(a.add("annotation"),a.add("booth")),r<=uh&&a.add("row"),r<=mh&&a.add("seat"),a}function Os(e,t,n,o,r,i=6){let a=i+t,s=o-i-t,c=i+n,u=r-i-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>u?r/2:Math.max(c,Math.min(u,e.y))}}function bt(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],u=r[1]*i+r[5]*a+r[9]*s+r[13],l=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=u/m,f=l/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 Bs(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(wn(i,s,t,n)){a=!0;break}a||o.push(i)}return o}var fh=6;function wn(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+fh):n;return r<a&&i<o}function Ns(e,t,n){return e.length*t*.58+(n?14:0)}var dh={row:8,seat:14};function Vs(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:dh}function Gs(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 uo(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 u of r)if(wn(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(wn(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}function Hs(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 hh=6,ph=2.2,zs=.1,bh=.3,yh=1.8,gh=.9,xh=.55,vh=6e3;function js(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 l of n)for(let m of l.objects)m.type==="section"&&m.zone&&c.set(m.id,m.zone);let u=new Map;for(let l=0;l<o.length;l++){let m=o[l],h=r.seatOwner[l],d=m.zoneId??(h?c.get(h):void 0);if(!d)continue;let f=u.get(d);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.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(l)}for(let l of a){let m=u.get(l.id),h=[];for(let[d,f]of c)f===l.id&&h.push(d);if(!m||m.n===0){s.push({id:l.id,label:l.label,color:me(l.color),sectionIds:h,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*E,1.5,(l.focalPoint??i).y*E]});continue}s.push({id:l.id,label:l.label,color:me(l.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:[(l.focalPoint??i).x*E,1.5,(l.focalPoint??i).y*E]})}}return s}function Xs(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],l=[],m=[];for(let h of s)h.seatCount!==0&&u.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[h.center[0],h.center[1]+hh,h.center[2]],color:t.zones?.find(d=>d.id===h.id)?.color});{let h=new Map,d=new Map;for(let f=0;f<o.length;f++){let p=r.seatOwner[f];if(!p)continue;let b=h.get(p);b||(b={n:0,x:0,y:0,deck:0},h.set(p,b)),b.n++,b.x+=o[f].x,b.y+=o[f].y,b.deck+=r.seatDeckY(f);let y=d.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},d.set(p,y)),y.minDeck=Math.min(y.minDeck,r.seatDeckY(f)),y.maxDeck=Math.max(y.maxDeck,r.seatDeckY(f)),o[f].x<y.minX&&(y.minX=o[f].x),o[f].x>y.maxX&&(y.maxX=o[f].x),o[f].y<y.minY&&(y.minY=o[f].y),o[f].y>y.maxY&&(y.maxY=o[f].y)}for(let f of n)for(let p of f.objects){if(p.type!=="section"||Cs(p))continue;let b=h.get(p.id);if(!b||b.n===0)continue;let y=d.get(p.id),g=[b.x/b.n*E,b.deck/b.n,b.y/b.n*E],x=p.displayLabel||p.label||p.id;l.push({id:p.id,floorIndex:f.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*E),box:{min:[y.minX*E-.4,y.minDeck,y.minY*E-.4],max:[y.maxX*E+.4,y.maxDeck+1,y.maxY*E+.4]},focalWorld:[f.focal.x*E,f.baseHeightM+1.5,f.focal.y*E]});let w=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===x.trim().toLocaleLowerCase()||u.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+ph,g[2]],floorIndex:f.index})}}{for(let b of n)for(let y of b.objects){if(y.type!=="gaArea")continue;let g=mn(y.points);if(!g)continue;let x=y.displayLabel||y.label||y.id;u.push({id:`ga:${y.id}`,kind:"ga",text:y.capacity>0?`${x} \xB7 ${y.capacity.toLocaleString()}`:x,anchor:[g.x*E,b.baseHeightM+yh,g.y*E],floorIndex:b.index})}let h=new Map,d=new Map;for(let b of n)for(let y of b.objects)if(y.type==="section"&&h.set(y.id,y.displayLabel||y.label||y.id),y.type==="row"){let g=y.displayLabel?.trim()||y.segmentedRow?.displayLabel?.trim();g&&d.set(y.id,g)}let f=new Map;for(let b=0;b<o.length;b++){let y=o[b],g=Math.hypot(y.x-c.x,y.y-c.y),x=f.get(y.rowId);(!x||g>x.far)&&f.set(y.rowId,{seat:y,index:b,far:g})}for(let[b,y]of f){let g=r.seatOwner[y.index]??y.seat.sectionId,x=Us(y.seat.label,b,h.get(g??""),d.get(b));x&&u.push({id:`row:${b}`,kind:"row",text:x,anchor:[y.seat.x*E,r.seatDeckY(y.index)+gh,y.seat.y*E],floorIndex:a[y.index]})}let p=new Map;for(let b=0;b<o.length;b++){let y=o[b],g=p.get(y.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Us(y.label,y.rowId,h.get(r.seatOwner[b]??y.sectionId??""),d.get(y.rowId)),sectionId:r.seatOwner[b]??y.sectionId},p.set(y.rowId,g));let x=b*3,w=i.iPosition[x],I=i.iPosition[x+1],v=i.iPosition[x+2];g.n++,g.x+=w,g.y+=I,g.z+=v,g.minX=Math.min(g.minX,w),g.maxX=Math.max(g.maxX,w),g.minZ=Math.min(g.minZ,v),g.maxZ=Math.max(g.maxZ,v)}for(let[b,y]of p)m.push({id:b,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)});if(o.length<=vh)for(let b=0;b<o.length;b++){let y=o[b],g=Pr(y.displayLabel||y.label);g&&u.push({id:`seat:${y.id}`,kind:"seat",seatWidthM:i.iChairWidth[b]*2,text:g,anchor:[y.x*E,r.seatDeckY(b)+xh,y.y*E],floorIndex:a[b]})}}for(let h of n)for(let d of h.objects)if(d.type==="shape"&&d.role&&["entrance","exit","screen","suite","obstruction"].includes(d.role)){let f=ge(d),p=f?mn(f):null;if(!p||!d.label)continue;u.push({id:`architecture:${d.id}`,kind:"annotation",text:d.label,anchor:[p.x*E,h.baseHeightM+je(d).heightM+zs,p.y*E],color:d.fill,floorIndex:h.index})}else if(d.type==="text"){if(!d.text)continue;u.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*E,h.baseHeightM+zs,d.position.y*E],color:d.color,rotation:d.rotation,floorIndex:h.index})}else if(d.type==="booth"){let f=Ke(d);if(!f)continue;let p=mn(f);if(!p)continue;u.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[p.x*E,h.baseHeightM+ro+bh,p.y*E],floorIndex:h.index})}return{labels:u,sections:l,rows:m}}function Ws(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 Pr(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Us(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&&ks(i,n)}function Ys(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=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=u[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 l=new Map;for(let h=0;h<n.length;h++)for(let d of n[h].objects)d.type==="section"&&l.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?l.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=u[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),x=Math.max(d.n?d.maxY*E:n[h].focal.y*E+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=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,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),v=[d.n?d.sumX/d.n:(b+y)/2,d.n?d.sumDeck/d.n:(w+I)/2,d.n?d.sumZ/d.n:(g+x)/2],P=Math.max(1,.5*Math.hypot(y-b,I-w,x-g));c.push({index:h,id:f?.id??`floor-${h}`,label:f?.name??(n.length>1?`Floor ${h+1}`:"Venue"),seatCount:d.n,center:v,radius:P,box:{min:[b,w,g],max:[y,I,x]},focalWorld:[n[h].focal.x*E,n[h].baseHeightM+1.5,n[h].focal.y*E]})}}return c}function Ir(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}))}function Cr(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 u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=Ke(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="table"){let u=io(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="decorImage"){let u=ao(c);if(u)for(let l of u)a(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Qs(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(...Ke(h)??[]):h.type==="table"?s.push(...io(h)??[]):h.type==="decorImage"&&s.push(...ao(h)??[]);if(Zs(e,t[0],n,s,i))return!1;if(a&&qs(e,t[0].baseHeightM,s,i,a))return!0;let c=Ir(s),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,m=c.length>=3?c.map(h=>{let d=h.x-u,f=h.y-l,p=Math.max(1,Math.hypot(d,f));return{x:h.x+d/p*80,y:h.y+f/p*80}}):hn(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,re),!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)},u=n.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&u.push(...b.outline);if(Zs(e,c,n,u,i))return!1;if(a&&qs(e,s.baseHeightM,u,i,a))return!0;let l=n.filter((b,y)=>o[y]===s.index),m=Cr([s],l),h=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),d=Math.max(28,Math.min(80,h*.04)),f=hn(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,re),!1}}function Rr(e,t,n,o){let{cx:r,cz:i,radius:a}=n,s=1/0,c=1/0,u=1/0,l=-1/0,m=-1/0,h=-1/0,d=(b,y,g)=>{s=Math.min(s,b),l=Math.max(l,b),c=Math.min(c,y),m=Math.max(m,y),u=Math.min(u,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],x=t.iPosition[y+1],w=t.iPosition[y+2],I=Math.max(.35,t.iMaxRadius[b]??.35);d(g-I,x,w-I),d(g+I,x+1.6,w+I)}Number.isFinite(s)||(s=r-a,l=r+a,c=0,m=a*.16,u=i-a,h=i+a);let f=[(s+l)/2,(c+m)/2,(u+h)/2],p=Math.max(1,.5*Math.hypot(l-s,m-c,h-u));return{center:f,radius:p,minY:c,maxY:m}}function Js(e,t,n,o,r,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let w=0;w<e.count;w++){let I=w*3,v=e.iPosition[I],P=e.iPosition[I+2];v<a&&(a=v),v>c&&(c=v),P<s&&(s=P),P>u&&(u=P)}for(let w of t)a=Math.min(a,w.cx-w.halfX),c=Math.max(c,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),u=Math.max(u,w.cz+w.halfZ);let l=n.minX*E,m=n.maxX*E,h=n.minY*E,d=n.maxY*E,f=l,p=m,b=h,y=d;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(c-a,u-s));f=Math.max(l,a-w),p=Math.min(m,c+w),b=Math.max(h,s-w),y=Math.min(d,u+w)}let g=Math.min(0,o),x=Math.max(r,i*.05);return{min:[f,g,b],max:[p,x,y]}}var Ks=12,Mh=.6,Sh=40;function qs(e,t,n,o,r){let i=Ir([...n]);if(i.length<3)return!1;let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let w of i)a=Math.min(a,w.x),c=Math.max(c,w.x),s=Math.min(s,w.y),u=Math.max(u,w.y);let l=Math.hypot(c-a,u-s)*E,m=Ue(i,Ks/E,1.2),h=Math.max(Sh,l*Mh),d=Ue(i,(Ks+h)/E,1.2);if(m.length!==d.length)return!1;let f=de(o.ground,[.78,.76,.72],.35),p=de(o.ground,[.56,.62,.52],.3);ae(e,m,void 0,()=>t-.04,t-.22,f,f,re);let b=t-.05,y=m.map(w=>[w.x*E,b,w.y*E]),g=d.map(w=>[w.x*E,b,w.y*E]),x=[0,1,0];for(let w=0;w<y.length;w++){let I=(w+1)%y.length;e.tri(y[w],g[I],g[w],x,p,r,r),e.tri(y[w],y[I],g[I],x,p,p,r)}return!0}var wh=3e3,Ph=20,$s=1.5,Ih=1.2,Ch=.25;function Zs(e,t,n,o,r){if(!n.length||n.length>wh||o.length<3)return!1;for(let M of t.objects){if(M.type==="shape"&&Yi(M.stageKind))return!1;if(M.type==="section"){let{height:C}=mt(M,{floorBaseHeightM:t.baseHeightM});if(C-t.baseHeightM>Ph)return!1}}let i=0,a=0;for(let M of o)i+=M.x,a+=M.y;i/=o.length,a/=o.length;let s=0,c=0,u=0;for(let M of o){let C=M.x-i,T=M.y-a;s+=C*C,c+=T*T,u+=C*T}let l=.5*Math.atan2(2*u,s-c),m=Math.cos(l),h=Math.sin(l),d=-h,f=m,p=1/0,b=-1/0,y=1/0,g=-1/0;for(let M of o){let C=(M.x-i)*m+(M.y-a)*h,T=(M.x-i)*d+(M.y-a)*f;p=Math.min(p,C),b=Math.max(b,C),y=Math.min(y,T),g=Math.max(g,T)}let x=M=>[[p-M,y-M],[b+M,y-M],[b+M,g+M],[p-M,g+M]].map(([C,T])=>({x:i+m*C+d*T,y:a+h*C+f*T})),w=x($s/E),I=x(($s+Ch)/E),v=t.baseHeightM,P=de(r.ground,[.62,.55,.47],.4),S=de(r.ground,[.86,.86,.84],.55);return ae(e,I,void 0,()=>v-.04,v-.22,P,P,re),ae(e,I,[w.slice().reverse()],()=>v+Ih,v-.04,de(S,[1,1,1],.2),S,re),!0}function ec(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Zi(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]})),u=[];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(S=>S.x*E),b=d.map(S=>S.y*E),y=h.unit.baseHeightM+f,g=Math.min(...p),x=Math.max(...p),w=Math.min(...b),I=Math.max(...b),v,P=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&P&&(v=Oa(d,y,y+m.heightM,h.unit.focal),!v))if(x-g>=I-w){let S=Math.abs(w-h.unit.focal.y*E)<=Math.abs(I-h.unit.focal.y*E)?w-.006:I+.006;v=[[g,y,S],[x,y,S],[g,y+m.heightM,S],[x,y+m.heightM,S]]}else{let S=Math.abs(g-h.unit.focal.x*E)<=Math.abs(x-h.unit.focal.x*E)?g-.006:x+.006;v=[[S,y,w],[S,y,I],[S,y+m.heightM,w],[S,y+m.heightM,I]]}u.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:h.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[g,y,w],max:[x,y+m.heightM,I]},occlusion:m.occlusion,...P?{contentImageUrl:P}:{},...v?{contentPlane:v}:{}})}let l=u.sort((m,h)=>m.id.localeCompare(h.id));return{byObjectId:new Map(l.map(m=>[m.objectId,m])),elements:l}}var tc=[.13,.14,.17],Yt=[.4,.43,.47],Rh=.18,Ah=.02,Eh=2.4,_h=1500,Th=240;function nc(e,t,n,o){let r=t.stageKind??"";if(Et(r)||r==="round"||!o.length)return;let i=ge(t);if(!i||i.length<3)return;let a={x:i.reduce((A,L)=>A+L.x,0)/i.length,y:i.reduce((A,L)=>A+L.y,0)/i.length},s=0,c=0,u=new Set;for(let A of o)s+=A.x,c+=A.y,u.add(Math.floor(Math.atan2(A.y-a.y,A.x-a.x)*180/Math.PI/10));if(u.size*10>Th)return;let l=a.x-s/o.length,m=a.y-c/o.length,h=Math.hypot(l,m);if(h<1e-6)return;let d=l/h,f=m/h,p=-f,b=d,y=-1/0,g=1/0,x=1/0,w=-1/0;for(let A of i){let L=(A.x-a.x)*d+(A.y-a.y)*f,O=(A.x-a.x)*p+(A.y-a.y)*b;y=Math.max(y,L),g=Math.min(g,L),x=Math.min(x,O),w=Math.max(w,O)}let I=(w-x)*E,v=(y-g)*E;if(I<3||v<1.5||I*v>_h)return;let P=Rh/E,S=(A,L)=>({x:a.x+d*A+p*L,y:a.y+f*A+b*L}),M=(A,L,O,_)=>[S(A,O),S(A,_),S(L,_),S(L,O)],C=n+Math.max(3.5,Math.min(8,I*.35)),T=n+Math.min(Eh,C-n-1),N=.2/E,D=g+Math.min(v*.25,1.5)/E,R=Ah/E;ae(e,M(y-2*P+R,y-P-R,x+P+N,w-P-N),void 0,()=>T,n,tc,tc,re);for(let[A,L]of[[x+P,x+P+N],[w-P-N,w-P]])ae(e,M(y-2*P,y-P,A,L),void 0,()=>C+.3,n,Yt,Yt,re),ae(e,M(D+N,y-2*P,A,L),void 0,()=>C+.3,C,Yt,Yt,re);ae(e,M(D,D+N,x+P,w-P),void 0,()=>C+.3,C,Yt,Yt,re)}function Be(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Oe(e){return Array.isArray(e)?e:[]}function kh(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!Be(n))continue;let o=Be(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 mo(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Lh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Fh(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 Dh(e){let t=mo(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:mo(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:mo(e.rotation,4),r=e.scale===void 0?[1,1,1]:mo(e.scale,3);if(!n||!o||!r)return null;let[i,a,s,c]=o,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let l=i/u,m=a/u,h=s/u,d=c/u,f=l+l,p=m+m,b=h+h,y=l*f,g=l*p,x=l*b,w=m*p,I=m*b,v=h*b,P=d*f,S=d*p,M=d*b;return[(1-(w+v))*r[0],(g+M)*r[0],(x-S)*r[0],0,(g-M)*r[1],(1-(y+v))*r[1],(I+P)*r[1],0,(x+S)*r[2],(I-P)*r[2],(1-(y+w))*r[2],0,n[0],n[1],n[2],1]}function Oh(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 Bh(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],u=e[10],l=i*u-a*c,m=a*s-r*u,h=r*c-i*s,d=t*l+n*m+o*h;if(Math.abs(d)<1e-12)return null;let f=1/d;return[l*f,m*f,h*f,(o*c-n*u)*f,(t*u-o*s)*f,(n*s-t*c)*f,(n*a-o*i)*f,(o*r-t*a)*f,(t*i-n*r)*f]}function oc(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 Nh(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(!Be(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 Vh(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Gh(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Hh(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 zh(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Nh(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!Be(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Oe(o.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||kh(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Oe(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Oe(o.images).length||Oe(o.textures).length)return{ok:!1,issue:"external_resource"};let a=Oe(o.buffers);if(a.length!==1||!Be(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=Oe(o.accessors),c=Oe(o.bufferViews),u=Oe(o.meshes),l=Oe(o.nodes),m=Oe(o.scenes),h=typeof o.scene=="number"?o.scene:0;if(!Be(m[h]))return{ok:!1,issue:"unsupported_glb"};let d=new DataView(r.buffer,r.byteOffset,r.byteLength),f=(w,I,v)=>{if(typeof w!="number"||!Number.isInteger(w)||!Be(s[w]))return null;let P=s[w];if(P.type!==I||P.sparse!==void 0||P.normalized===!0||typeof P.count!="number"||!Number.isInteger(P.count)||P.count<1||typeof P.componentType!="number"||!v.includes(P.componentType)||typeof P.bufferView!="number")return null;let S=c[P.bufferView];if(!Be(S)||S.buffer!==0||typeof S.byteLength!="number"||!Number.isInteger(S.byteLength)||S.byteLength<0)return null;let M=Gh(P.type),C=Vh(P.componentType),T=typeof S.byteStride=="number"?S.byteStride:M*C,N=typeof S.byteOffset=="number"?S.byteOffset:0,D=typeof P.byteOffset=="number"?P.byteOffset:0,R=N+D,A=D+(P.count-1)*T+M*C;if(!Number.isInteger(T)||!Number.isInteger(N)||!Number.isInteger(D)||T<M*C||N<0||D<0||N+S.byteLength>r.byteLength||A>S.byteLength)return null;let L=[];for(let O=0;O<P.count;O++){let _=[];for(let k=0;k<M;k++){let V=Hh(d,R+O*T+k*C,P.componentType);if(!Number.isFinite(V))return null;_.push(V)}L.push(_)}return L},p=[],b=[],y=0,g=new Set,x=(w,I)=>{if(typeof w!="number"||!Number.isInteger(w)||!Be(l[w])||g.has(w))return!1;g.add(w);let v=l[w],P=Dh(v);if(!P)return!1;let S=Fh(I,P),M=Bh(S);if(!M)return!1;if(v.mesh!==void 0){if(typeof v.mesh!="number")return!1;let C=u[v.mesh];if(!Be(C))return!1;for(let T of Oe(C.primitives)){if(!Be(T)||T.mode!==void 0&&T.mode!==4||!Be(T.attributes))return!1;let N=f(T.attributes.POSITION,"VEC3",[5126]),D=T.attributes.NORMAL===void 0?null:f(T.attributes.NORMAL,"VEC3",[5126]);if(!N||T.attributes.NORMAL!==void 0&&!D)return!1;let R=N.length;if(T.indices!==void 0){let L=typeof T.indices=="number"?s[T.indices]:null;R=Be(L)?L.count:void 0}if(typeof R!="number"||!Number.isInteger(R)||R%3!==0||(y+=R/3,y>1e5))return!1;let A=T.indices===void 0?N.map((L,O)=>[O]):f(T.indices,"SCALAR",[5121,5123,5125]);if(!A||A.length%3!==0||A.length!==R)return!1;for(let L=0;L<A.length;L+=3){let O=[A[L][0],A[L+1][0],A[L+2][0]];if(O.some(V=>!Number.isInteger(V)||V<0||V>=N.length))return!1;let _=O.map(V=>Oh(S,...N[V])),k=null;if(!D){let V=_[1][0]-_[0][0],F=_[1][1]-_[0][1],B=_[1][2]-_[0][2],z=_[2][0]-_[0][0],U=_[2][1]-_[0][1],G=_[2][2]-_[0][2];k=oc([1,0,0,0,1,0,0,0,1],F*G-B*U,B*z-V*G,V*U-F*z)}for(let V=0;V<3;V++)p.push(..._[V]),b.push(...D?oc(M,...D[O[V]]):k)}}}for(let C of Oe(v.children))if(!x(C,S))return!1;return g.delete(w),!0};for(let w of Oe(m[h].nodes))if(!x(w,Lh()))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 rc(e){try{return zh(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Kt(e){let{doc:t}=e,n=Di(t.theme),o=n.structure,r=Ia(t,e.eventConfigurationId??t.eventConfigurationId),i=ec(e.eventConfigurationId,e.eventConfiguration,r),a=e.seats,s=new Gn,c=null;if(e.registeredShellGlb){let Y=rc(e.registeredShellGlb);if(Y.ok){let W=Y.position.length/3,Z=new Float32Array(Y.position.length),ee=n.materials.shell??o.tierWall;for(let q=0;q<W;q++){let oe=Y.normal[q*3+1],te=oe<-.25?.4:.62+.38*Math.max(0,oe);Z[q*3]=ee[0]*te,Z[q*3+1]=ee[1]*te,Z[q*3+2]=ee[2]*te}c={position:Y.position,normal:Y.normal,color:Z,floor:new Float32Array(W).fill(-2),material:new Float32Array(W),count:W}}}let u=new Map;for(let Y of r)for(let W of Y.objects)u.set(W.id,Y.index),W.type==="section"&&u.set(W.logicalSectionId??W.id,Y.index);let l=a.map(Y=>u.get(Y.sectionId??"")??u.get(Y.rowId??"")??0),m=Cr(r,a),h=s.vertexCount,f=Qs(s,r,a,l,m,o,de(n.background.top,n.background.bottom,.5))?s.vertexCount:h,p=ka(t,a),b=new Map,y=new Map;for(let Y of t.categories??[])b.set(Y.key,Y.color),Y.seatGlyph&&y.set(Y.key,Y.seatGlyph);let g=[],x=_a(r,a,l),w=new Map;a.forEach((Y,W)=>{let Z=x.seatDeckY(W);Number.isFinite(Z)&&w.set(Y.rowId,Math.min(w.get(Y.rowId)??1/0,Z))});let I=new Float32Array(a.length),v=[],P=new Map((t.floors??[]).map((Y,W)=>[Y.id,W])),S=r.map(()=>[]);for(let Y of a){let W=Y.floorId?P.get(Y.floorId)??0:0;S[Math.min(W,S.length-1)]?.push(Y)}let M=(Y,W)=>{if(!W||W.length<3)return!1;let Z=Math.min(...W.map(te=>te.x)),ee=Math.max(...W.map(te=>te.x)),q=Math.min(...W.map(te=>te.y)),oe=Math.max(...W.map(te=>te.y));for(let te=0;te<Y;te++)for(let $ of S[te])if(!($.x<Z||$.x>ee||$.y<q||$.y>oe)&&_e($,W,void 0))return!0;return!1},C=null,T=Y=>r.length===1?a:a.filter((W,Z)=>l[Z]===Y),N=(Y,W)=>{let Z=Ke(Y);if(!Z)return!1;let ee=1/0,q=1/0,oe=-1/0,te=-1/0;for(let $ of Z)ee=Math.min(ee,$.x),oe=Math.max(oe,$.x),q=Math.min(q,$.y),te=Math.max(te,$.y);return a.some(($,ne)=>$.kind!=="booth"&&(r.length===1||l[ne]===W)&&$.x>ee&&$.x<oe&&$.y>q&&$.y<te&&Fe(Z,$.x,$.y))};for(let Y=0;Y<r.length;Y++){let W=r[Y];s.setFloor(Y);let Z=new $n,ee=[],q=W.objects.filter($=>$.type==="shape"&&($.role==="entrance"||$.role==="exit")),oe=W.objects.filter($=>$.type==="section"&&!!$.outline&&$.outline.length>=3),te=as(W.objects.filter($=>$.type==="booth"),W.focal);for(let $ of W.objects)if($.type==="section"){let ne=s.vertexCount;xs(s,$,W,La($,p),x.bySection.get($.id),Z,oe,o,Y>0&&M(Y,$.outline));let he=s.vertexCount-ne;he>0&&v.push({sectionId:$.id,start:ne,count:he})}else if($.type==="shape"){let ne=i.byObjectId.get($.id),he=g.length;s.setMaterial((ne?.kind??$.role)==="screen"?1:0);let Te=$.role==="stage"&&!ne?cs($,T(Y)):$,Pe=Da(Te,ee);if(ns(s,Te,W.baseHeightM+Pe.supportOffsetM,Pe.topOffsetM-Pe.supportOffsetM,o,W.focal,g,ne,q),s.setMaterial(0),$.role==="stage"&&!ne&&g.length>he&&(C??Y)===Y){C=Y;let ke=t.floors?.[Y]?.id,Se=r.length>1&&ke?a.filter(Je=>Je.floorId===ke):a;nc(s,Te,g[g.length-1].y,Se)}}else $.type==="gaArea"?rs(s,$,W.baseHeightM,me(b.get($.categoryKey)),o):$.type==="booth"?Ja(s,$,W.baseHeightM,me(b.get($.categoryKey)),o,te.get($.id)??W.focal,N($,Y)):$.type==="table"?ts(s,$,Math.max(W.baseHeightM,w.get($.id)??W.baseHeightM),me($.fill??t.theme?.decorFill??"#232c40"),o,!!($.fill??t.theme?.decorFill)):$.type==="decorImage"&&os(s,$,W.baseHeightM,o);Ms(s,W,a,x,o,n.materials.shell,!c)}let D=r.length>1?{x:r.reduce((Y,W)=>Y+W.focal.x,0)/r.length,y:r.reduce((Y,W)=>Y+W.focal.y,0)/r.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},R=_i(c?[s.build(),c]:[s.build()]),A=ki(a,e.initialState,x,I,b,y),L=js({doc:t,units:r,seats:a,surfaces:x,focal:D}),{labels:O,sections:_,rows:k}=Xs({doc:t,units:r,seats:a,surfaces:x,seatData:A,hintedSeatFloor:l,zones:L,focal:D}),V=new Map(_.map((Y,W)=>[Y.id,W]));x.seatOwner.forEach((Y,W)=>{A.iSection[W]=Y?V.get(Y)??-1:-1});let F=Ys({doc:t,units:r,seats:a,surfaces:x,solids:R,hintedSeatFloor:l,seatFloor:I});Ws(O,F),A.iYaw=ni(A.iPosition,a.length,Y=>a[Y].rowId,Y=>{let W=r[I[Y]]?.focal??D;return[W.x*E,W.y*E]});let B=(m.minX+m.maxX)/2*E,z=(m.minY+m.maxY)/2*E,U=.5*Math.hypot((m.maxX-m.minX)*E,(m.maxY-m.minY)*E)||10,G=Rr(R,A,{cx:B,cz:z,radius:U},[h,f]),H=Rr(R,A,{cx:B,cz:z,radius:U}),K=Js(A,g,m,G.minY,G.maxY,U);return{sharedAisles:Li(r.flatMap(Y=>Y.objects.flatMap(W=>{if(W.type!=="section")return[];let Z=x.bySection.get(W.id);return Z?[{sectionId:W.id,floorIndex:Y.index,rows:Z.rowLevels}]:[]}))),solids:R,sectionSolidRanges:v,seats:A,seatSectionIds:x.seatOwner,bounds:{center:[(K.min[0]+K.max[0])/2,(K.min[1]+K.max[1])/2,(K.min[2]+K.max[2])/2],radius:U,groundY:0,box:K},renderBounds:{center:G.center,radius:G.radius},clipBounds:{center:H.center,radius:H.radius},stateColorLUT:Oi(n,Ae),theme:n,seatCount:a.length,focalWorld:[D.x*E,1.5,D.y*E],zones:L,stages:g,productionElements:i.elements,sections:_,rows:k,labels:O,floors:F}}var ic=88,ac=20,sc={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Uh=640,jh=.8,Xh=11,Wh="3px 7px",Yh="2px 5px",cc="rgba(10,14,22,.62)",Kh="#f4f7fb",lc=5,uc=2,qh=6,Pn=new Set(["row","seat"]),mc={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},qt={row:{x:66,y:20},seat:{x:52,y:22}},Er=me,Ar=e=>ai(e);function _r(e,t){let n=Ar(e),o=Ar(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function Tr(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 $h(e,t=[.04,.06,.1],n=!0){let o=Ar(t)<.42,r=o?"#f4f7fb":"#0b1220",i=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Tr(i,t):t,s=Er(e),c=n?7:4.5,u=s&&_r(s,a)>=c?e:r;return o?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Zh(e,t=[.04,.06,.1]){let n=Tr(cc,t),o=Er(e);return{ink:o&&_r(o,n)>=4.5?e:Kh,backing:cc}}var Qh='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',fo=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.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||Qh,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}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=sc[t].size;return!this.narrowStage||Pn.has(t)?n:Math.max(Xh,n*jh)}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<Uh;let s=Ds(r,i,{hasZoneLabels:this.labels.some(I=>I.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let I of this.labels){if(!s.has(I.kind)&&!(I.kind==="seat"&&this.selectedSeatLabelIds.has(I.id)))continue;let v=bt(t,I.anchor,n,o);if(!v.visible)continue;let P=Pn.has(I.kind),S=this.sizeFor(I.kind),M=Ns(I.text,S,!P)+(P?lc*2:0);if(I.kind==="seat"&&I.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(I.id)&&Hs(t,I.anchor,I.seatWidthM,n)<Math.max(22,M))continue;let C=Os(v,M/2,S/2+(P?uc:4),n,o),T=a?Math.hypot(I.anchor[0]-a[0],I.anchor[1]-a[1],I.anchor[2]-a[2]):1;c.push({label:I,screen:C,focus:Gs(C,T,n,o),halfWidth:M/2,...this.selectedSeatLabelIds.has(I.id)?{priority:1}:{}})}let u=Fs(c.filter(I=>I.label.kind==="floor"),n),l=[...c.filter(I=>!Pn.has(I.label.kind)&&I.label.kind!=="floor"),...u],m=Vs(n),h=uo(c.filter(I=>I.label.kind==="seat"&&this.selectedSeatLabelIds.has(I.label.id)),qt.seat.x,qt.seat.y,m.seat),d=Bs(l,ic,ac).filter(I=>!h.some(v=>wn(I,v,ic,ac))),f=uo(c.filter(I=>I.label.kind==="row"),qt.row.x,qt.row.y,m.row,[...d,...h]),p=uo(c.filter(I=>I.label.kind==="seat"&&!this.selectedSeatLabelIds.has(I.label.id)),qt.seat.x,qt.seat.y,m.seat-h.length,[...d,...h,...f]),b=[...d,...f,...h,...p],y=new Set(b.map(I=>I.label.id));for(let{label:I,screen:v}of b){let S=this.nodeFor(I).style;S.display="",S.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let x=b.filter(({label:I})=>!Pn.has(I.kind)).sort((I,v)=>mc[v.label.kind]-mc[I.label.kind]||I.screen.depth-v.screen.depth||I.focus-v.focus).flatMap(({label:I})=>{let v=this.nodes.get(I.id);return v&&v.style.display!=="none"?[{node:v,box:v.getBoundingClientRect()}]:[]}),w=[];for(let{node:I,box:v}of x)w.some(S=>v.left<S.right+3&&v.right+3>S.left&&v.top<S.bottom+3&&v.bottom+3>S.top)?I.style.display="none":w.push(v);for(let[I,v]of this.nodes)y.has(I)||(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.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(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;this.nodeAppearance.set(n,{text:t.text,kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),n.textContent=t.text,n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let i=sc[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=Pn.has(t.kind),c=!s,u=$h(t.color??this.opts.ink,this.opts.backgroundRgb,!0),l=s?Zh(t.color??this.opts.ink,this.opts.backgroundRgb):u;a.color=o?"#ecf8ff":l.ink,a.background=o?"rgba(10,28,45,.9)":l.backing,a.border=o?"1px solid rgba(89,199,255,.92)":c?`1px solid ${u.border}`:"",a.borderRadius=o||c?"999px":`${qh}px`;let m=this.narrowStage?Yh:Wh;a.padding=o||c?m:`${uc}px ${lc}px`,a.lineHeight=s?"1.1":"",a.boxShadow=o?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":c?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",a.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],d=Er(o?"#ecf8ff":l.ink)??[1,1,1],f=Tr(o?"rgba(10,28,45,.9)":l.backing,h);return n.dataset.qualityContrast=_r(d,f).toFixed(3),a.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",n}dispose(){this.root.remove(),this.nodes.clear()}};var dc=1;var Jh=new Set(["floor","zone","section","ga","booth","annotation"]);function ep(e){return e.every(t=>Number.isFinite(t))}function tp(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 fc(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Tt(e){return Math.round(e*1e4)/1e4}function np(e){if(e)return{box:{x:Tt(e.box.x),y:Tt(e.box.y),width:Tt(e.box.width),height:Tt(e.box.height)},horizontalFillRatio:Tt(e.horizontalFillRatio),verticalFillRatio:Tt(e.verticalFillRatio),visibleAreaRatio:Tt(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function $e(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function ho(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Jh.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)tp(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=[$e("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),$e("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),$e("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),$e("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}`}]),$e("camera-invalid","The capture camera must have a finite physical pose",ep(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),$e("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}]),$e("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`}]),$e("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}))),$e("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}))),$e("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:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:np(e.framing)},metrics:{minimumHierarchyFontPx:fc(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:fc(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function hc(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var ve=require("ogl");var yt=require("ogl");var po=`
20
+ }`});async function Ul(e,t,n,o={}){let r=o.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-et,Math.min(et,t?.initialPitchDeg??0)),s=To,c=!1,u=new AbortController,l=()=>u.abort();o.signal?.addEventListener("abort",l,{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,F=n.focalWorld[0]-B.x,G=n.focalWorld[1]-B.y,j=n.focalWorld[2]-B.z,N=Math.hypot(F,j);N>.001&&(i=Math.atan2(F,-j)*180/Math.PI,a=Math.max(-et,Math.min(et,Math.atan2(G,N)*180/Math.PI)))}let d=null;if(t){let B=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=Co(t,Ao(B)),G;try{let j=t.resolveUrl?await t.resolveUrl(F.initialUrl):F.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");G=await Tn(j,u.signal)}catch{return o.signal?.removeEventListener("abort",l),null}try{d=Gl(n.gl,G)}catch{return u.abort(),o.signal?.removeEventListener("abort",l),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),F.upgradeUrl&&(m=Eo(()=>{(t.resolveUrl?t.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(N=>!N||u.signal.aborted?null:Tn(N,u.signal)).then(N=>{N&&(c||u.signal.aborted||(d?.setImage(N),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[F,G,j]=Vl(i,a);n.camera.lookAt([B.x+F,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 v=document.createElement("div");v.textContent=Zr(o.lookAroundHint),Object.assign(v.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(v),e.appendChild(y),M.focus({preventScroll:!0});let R=!1,P=0,x=0,S=0,w=new Map,I=()=>{let[B,F]=[...w.values()];return B&&F?Math.hypot(B.x-F.x,B.y-F.y):0},L=B=>{let F=$r(B);F!==s&&(s=F,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}),R=w.size===1,P=B.clientX,x=B.clientY,w.size===2&&(S=I()),y.setPointerCapture?.(B.pointerId),y.style.cursor="grabbing")},D=B=>{if(w.has(B.pointerId)){if(w.set(B.pointerId,{x:B.clientX,y:B.clientY}),w.size>=2){let F=I();S>0&&F>0&&L(s*(S/F)),S=F,R=!1;return}R&&(i+=(B.clientX-P)*zl,a=Math.max(-et,Math.min(et,a+(B.clientY-x)*zl)),P=B.clientX,x=B.clientY,b())}},A=B=>{w.delete(B.pointerId),S=w.size===2?I():0;let F=w.values().next().value;R=w.size===1,F?(P=F.x,x=F.y):y.style.cursor="grab";try{y.releasePointerCapture?.(B.pointerId)}catch{}},E=B=>{B.preventDefault(),L(s+B.deltaY*.04)};y.addEventListener("pointerdown",O),y.addEventListener("pointermove",D),y.addEventListener("pointerup",A),y.addEventListener("pointercancel",A),y.addEventListener("wheel",E,{passive:!1});let T=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(-et,Math.min(et,a+(B.key==="ArrowUp"?4:-4)));else if(B.key==="+"||B.key==="="){L(s-5),B.preventDefault();return}else if(B.key==="-"){L(s+5),B.preventDefault();return}else return;B.preventDefault(),b()}};window.addEventListener("keydown",T);let V=0,_=(B,F)=>{if(!d){F?.();return}let G=B===1?0:1,j=performance.now(),N=()=>{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?V=requestAnimationFrame(N):F?.()};V=requestAnimationFrame(N)};_(1);let k=()=>{c||(c=!0,m(),u.abort(),o.signal?.removeEventListener("abort",l),cancelAnimationFrame(V),y.removeEventListener("pointerdown",O),y.removeEventListener("pointermove",D),y.removeEventListener("pointerup",A),y.removeEventListener("pointercancel",A),y.removeEventListener("wheel",E),window.removeEventListener("keydown",T),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=()=>{k(),o.onClose?.()};cancelAnimationFrame(V),_(0,B)},dispose:k};return M.addEventListener("click",()=>H.close()),H}var zl,jl=rn(()=>{"use strict";Hl();ko();ko();qr();zl=.15});var Xl={};ui(Xl,{createOpenPanorama:()=>fy});function fy(e){let{container:t,model:n,opts:o,analytics:r,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:l,gl:m,isContextLost:h,isDisposed:d,flightGen:f,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:M,raisePanoramaLayer:v,restorePanoramaLayer:R,getOverviewChip:P,labelOverlay:x,reducedMotion:S,removeArriveChip:w,showArriveChip:I}=e;return async(L,O,D)=>{b()?.abort();let A=new AbortController;y(A);let E=n.seats.idToIndex.get(L);if(E===void 0){i.syncFromCamera();return}let T=s.get(L)?.label??L,V=u(L,E),_=c(L);if(!_){A.abort(),b()===A&&y(null),i.syncFromCamera();return}M(!0),a.stop();let k;try{k=await _}catch{if(b()===A&&y(null),r.panoramaFailed(L,"source"),!d()&&D===f()){M(!1),i.resumeAfterFlight(V.focal),a.requestRender();let K=I(L,D,!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||D!==f()){A.abort(),b()===A&&y(null);return}w();let H=P(),B=()=>{A.abort(),b()===A&&y(null),p(null),g(!1),R(),H.style.display="",x.setVisible(!o.arriveAtSeatEye),M(!1),r.panoramaClosed(),i.resumeAfterFlight(V.focal),a.requestRender();let K=I(L,f());requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())},F=k.generated===!0,G=Bl(k);v(),g(!F),H.style.display="none";let j=S()?0:O,N=l(),z=N&&!h()?await Ul(t,F?null:k,{gl:m,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:F?V.eye:void 0,focalWorld:V.focal},{fadeMs:j,seatLabel:T,disclosure:G,disclosurePrefix:F?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:B,signal:A.signal}):null;if(d()||D!==f()){A.abort(),g(!1),b()===A&&y(null),z?.dispose(),H.style.display="",R();return}if(z)i.syncFromCamera(),x.setVisible(!1),M(!1),a.requestRender(),p(z);else if(F){R(),H.style.display="",M(!1),i.resumeAfterFlight(V.focal),a.requestRender(),p(null),g(!1),r.panoramaFailed(L,"mount");let K=I(L,f(),!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus()),b()===A&&y(null);return}else g(!1),r.panoramaFallback(L),p(Nl(t,k,{fadeMs:j,seatLabel:T,disclosure:G,onClose:B,signal:A.signal,lookAroundHint:o.lookAroundHint}));r.panoramaOpened()}}var Wl=rn(()=>{"use strict";ko();jl()});var Ay={};ui(Ay,{VENUE3D_QUALITY_REPORT_VERSION:()=>Vc,autoVenue3d:()=>bo,buildSceneModel:()=>$t,estimateVenue3D:()=>kn,inspectVenue3DQualityEvidence:()=>vo,mountVenue3D:()=>Ry,prepareVenue3D:()=>su,prepareVenue3DFromChart:()=>cu});module.exports=Iu(Ay);function fi(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)),u=0,l=0,m=0;for(let h=0;h<o;h+=c)u+=t[h*3],l+=t[h*3+2],m++;r=u/m,i=l/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 xe={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ru=.44,Au=.15,di=.3,Cu=.24;function hi(e){return e===void 0||!Number.isFinite(e)||e<=0?Cu:Math.min(di,Math.max(Au,e*Ru))}var sn=.21,Eu=.05,jo=.45,ft=jo+Eu,cn=.92,an=.66,Xo=1.205,pi=-.23,bi=.38,_u=[{part:xe.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:xe.pad,min:[-1,.36,-.95],max:[1,jo,1]},{part:xe.back,min:[-1,ft,-1],max:[1,cn,-.72]},{part:xe.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:xe.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:xe.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:xe.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:xe.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:xe.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:xe.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Tu=[{part:xe.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:xe.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:xe.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:xe.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:xe.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ku=[{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 yi(){let e=[],t=[],n=[],o=[],r=(T,V,_)=>{let k=n.length,[H,B,F]=T,G=[B[0]-H[0],B[1]-H[1],B[2]-H[2]],j=[F[0]-H[0],F[1]-H[1],F[2]-H[2]],N=G[1]*j[2]-G[2]*j[1],z=G[2]*j[0]-G[0]*j[2],K=G[0]*j[1]-G[1]*j[0],J=Math.hypot(N,z,K);J>1e-9?(N/=J,z/=J,K/=J):[N,z,K]=V,N*V[0]+z*V[1]+K*V[2]<0&&(N=-N,z=-z,K=-K);for(let Y of T)e.push(...Y),t.push(N,z,K),n.push(_);o.push(k,k+1,k+2,k,k+2,k+3)},i=T=>{for(let V of ku){let _=V.c.map(k=>k.map((H,B)=>H?T.max[B]:T.min[B]));r(_,V.n,T.part)}},a=(T,V)=>{let[_,k,H]=V?[0,1,2]:[0,2,1],B=T.min[_],F=T.max[_],G=T.min[k],j=T.max[k],N=(F-B)*.1,z=(j-G)*.1,K=V?[[B+N,G],[F-N,G],[F,G+z],[F*.94,j-(j-G)*.23],[F*an,j],[B*an,j],[B*.94,j-(j-G)*.23],[B,G+z]]:[[B+N,G],[F-N,G],[F,G+z],[F,j-z],[F-N,j],[B+N,j],[B,j-z],[B,G+z]],J=(W,Q,te)=>{let $=[0,0,0];return $[_]=W,$[k]=Q,$[H]=te,$},Y=[T.min[H],T.max[H]].map(W=>K.map(([Q,te])=>J(Q,te,W)));for(let W=0;W<K.length;W++){let Q=(W+1)%K.length,te=[0,0,0];te[_]=(K[W][0]+K[Q][0])/2-(B+F)/2,te[k]=(K[W][1]+K[Q][1])/2-(G+j)/2,r([Y[0][W],Y[0][Q],Y[1][Q],Y[1][W]],te,T.part)}for(let W=0;W<2;W++){let Q=[0,0,0];Q[H]=W?1:-1;let te=Y[W];for(let $=1;$<te.length-1;$++){let ne=n.length;for(let ee of[te[0],te[$],te[$+1]])e.push(...ee),t.push(...Q),n.push(T.part);o.push(ne,ne+1,ne+2)}}};for(let T of _u)T.part===xe.pad||T.part===xe.back?a(T,T.part===xe.back):i(T);for(let T of Tu)i(T);let s=jo,c=1.08,u=.47,l=.69,m=-.55,h=.08,d=-.48,f=.01,p=[-u,s,m],b=[u,s,m],y=[-u,s,h],g=[u,s,h],M=[-l,c,d],v=[l,c,d],R=[-l,c,f],P=[l,c,f];r([b,v,P,g],[1,0,0],xe.body),r([y,R,M,p],[-1,0,0],xe.body),r([R,P,v,M],[0,1,0],xe.body),r([p,b,g,y],[0,-1,0],xe.body),r([g,P,R,y],[0,0,1],xe.body),r([p,M,v,b],[0,0,-1],xe.body);let x=10,S=8,w=[0,Xo,pi],I=[.42,.115,bi],L=n.length;for(let T=0;T<=S;T++){let V=Math.PI*T/S,_=Math.cos(V),k=Math.sin(V);for(let H=0;H<=x;H++){let B=Math.PI*2*H/x,F=k*Math.cos(B),G=k*Math.sin(B);e.push(w[0]+I[0]*F,w[1]+I[1]*_,w[2]+I[2]*G);let j=F/I[0],N=_/I[1],z=G/I[2],K=Math.hypot(j,N,z)||1;j/=K,N/=K,z/=K,t.push(j,N,z),n.push(xe.head)}}for(let T=0;T<S;T++)for(let V=0;V<x;V++){let _=L+T*(x+1)+V,k=_+x+1;o.push(_,k,_+1,_+1,k,k+1)}let O=new Float32Array(e),D=new Float32Array(t),A=new Float32Array(n),E=new Uint16Array(o);return{position:O,normal:D,part:A,index:E,vertexCount:n.length,indexCount:o.length}}function gi(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,l)=>{let m=l-u;for(let h=u;h<l;h++){let[d,f]=o(h),p=d-i(h),b=f-a(h);if(m>=2){let y=Math.max(u,h-1),g=Math.min(l-1,h+1),M=i(g)-i(y),v=a(g)-a(y),R=Math.hypot(M,v);if(R>1e-6){let P=-v/R,x=M/R;P*p+x*b<0&&(P=-P,x=-x),p=P,b=x}}r[h]=p===0&&b===0?0:Math.atan2(p,b)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return r}var Wo=78,xi=18;function vi(){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,cn,-.72]}])for(let c of i){let u=e.length/3,l=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-an)/(cn-ft):0),m=Math.hypot(c.n[0],l,c.n[2]),h=[c.n[0]/m,l/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-an)),e.push(...p),t.push(...h),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][d])}r.push(u,u+1,u+2,u,u+2,u+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 Ri=require("ogl");var Lu=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Mi(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 Fu(e){let t=Lu.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 de(e){let t=Fu(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Yo(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Du(e){return .2126*Yo(e[0])+.7152*Yo(e[1])+.0722*Yo(e[2])}function Si(e){return Du([e[0]*255,e[1]*255,e[2]*255])}function Ou(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function he(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 We(e,t){let n=Ou(e);return he(e,[n,n,n],t)}function wi({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 u=a-s,l=c>.5?u/(2-a-s):u/(a+s),m;return a===o?m=((r-i)/u+(r<i?6:0))/6:a===r?m=((i-o)/u+2)/6:m=((o-r)/u+4)/6,{h:m,s:l,l:c}}var Re=["available","held","sold","selected","dimmed"];function ln(e){let t=Re.indexOf(e);return t<0?0:t}var Pi={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Ii(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 Ko={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]},At={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ae(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Bu(){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 Nn=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 Ri.Renderer({canvas:this.canvas,dpr:Bu(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[At.top[0],At.top[1],At.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 Ot=require("ogl"),Pe=Math.PI/180,qo=15*Pe,$o=80*Pe,Dt=.12,Ai=35,Zo=1.25,Ci=.006,Nu=4,Bt=.82,un=1/Bt,Vu=.12,Gu=2;function Hu(e,t){return{azimuth:e*Ci,polar:-t*Ci}}function zu(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 Ei(e,t,n){let o=Math.max(Gu,Math.max(1,t)*Vu),r=n*Nu;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,r):r}}var Uu=1.5;function ju(e,t,n){let o=Math.max(1,n)*Uu;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 _i(e,t,n,o,r,i,a,s){let c=Math.sin(n),u=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],l=[e[0]+o*u[0],e[1]+o*u[1],e[2]+o*u[2]],m=[-u[0],-u[1],-u[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*Pe/2),b=p*(i>0?i:1),y=[0,1,2].map(v=>m[v]+a*b*h[v]+s*p*f[v]);if(y[1]>=-1e-6)return null;let g=(e[1]-l[1])/y[1],M=Math.hypot(y[0],y[1],y[2]);return!(g>0)||g*M>o*Xu?null:[l[0]+y[0]*g,e[1],l[2]+y[2]*g]}var Ti=3,Xu=4,Vn=class{constructor(t,n,o,r){this.fovY=Ai;this.target=new Ot.Vec3;this.azimuth=-30*Pe;this.polar=55*Pe;this.distance=10;this.azT=-30*Pe;this.polT=55*Pe;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 Ot.Vec3;this.panAnchor=new Ot.Vec3;this.panLimit=0;this.panBox=null;this.grabSign=1;this.zoomPointResolver=null;this.primaryDragMode="orbit";this.camera=new Ot.Camera(t,{fov:Ai,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 u=this.currentPinchDistance(),l=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-u)*.005),l.x,l.y),this.fireGesture()),this.pinchDist=u,this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=Hu(a,s);this.azT+=c.azimuth*this.grabSign,this.polT=Math.max(qo,Math.min($o,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*Pe;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(qo,Math.min($o,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(Bt);else if(i.key==="-"||i.key==="_")this.dollyBy(un);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*Pe/2)/o,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),l=Math.sin(this.polar),m=-i*u,h=-a*u;this.targetT.x+=(-t*s+n*m)*r,this.targetT.z+=(-t*c+n*h)*r,this.targetT.y+=n*l*r,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=ju(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(Ti,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(Ti,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/r);return}let s=i&&i.width>0&&i.height>0?_i([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?_i([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 zu([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*Pe/2,c=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=o??-30*Pe,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*Pe;let l=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,i?.margin??Zo)),this.envelope=Ei(this.envelope,a,l),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*Pe,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*Pe/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))*Pe;let i=this.fitDistance(t,o,r,this.azT,this.polT);this.distT=i*Math.max(1.05,Math.min(2,n?.margin??Zo)),this.envelope=Ei(this.envelope,Math.max(1,t.radius),i),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*Pe/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))*Pe;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,r?.margin??Zo))}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 u=Math.sin(i),l=-u*Math.sin(r),m=-Math.cos(i),h=-u*Math.cos(r);if(Math.abs(m)>.999)return s;let d=-h,f=l,p=Math.hypot(d,f);d/=p,f/=p;let b=-f*m,y=f*l-d*h,g=d*m,M=Math.tan(o),v=Math.tan(n),R=1;for(let P=0;P<8;P++){let x=(P&1?c.max[0]:c.min[0])-t.center[0],S=(P&2?c.max[1]:c.min[1])-t.center[1],w=(P&4?c.max[2]:c.min[2])-t.center[2],I=x*l+S*m+w*h,L=Math.abs(x*d+w*f),O=Math.abs(x*b+S*y+w*g);R=Math.max(R,L/M-I,O/v-I)}return Math.min(s,Math.max(R,a*.35))}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}=Ku(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(qo,Math.min($o,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()}},Wu=.1,Yu=.25;function Ku(e,t,n){let o=Math.max(1,t)*1.18,r=n==null?Yu:Math.max(.05,n*Wu),i=Math.max(r,e-o),a=Math.max(i+10,e+o);return{near:i,far:a}}var Gn=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,t,n){return Math.max(t,Math.min(n,e))}var Nt=2.5,qu=1.15,mn=12,Vt=22,Li=6,Fi=9.5,Di=.9,Oi=2.2,Qo=30,Jo=4,Hn=8192;var zy=Vt+Jo;function Bi(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Nt};let r=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-r*.4,fade:r*.55,minPixels:Nt+r*(qu-Nt)}}function Ni(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var $u=12;function Vi(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>=$u}var Zu=[{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"}],jy=new Map(Zu.map(e=>[e.key,e]));var Qu={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 Gi(e){let t=e?.[0];return t&&Qu[t]||"#3b82f6"}var Ju=[{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"}],Xy=new Map(Ju.map(e=>[e.key,e]));var em=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Wy=new Set(em);var zi=[{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}}],Ui=zi.map(e=>e.key),tm=new Map(zi.map(e=>[e.key,e]));function Hi(e){return typeof e=="string"&&tm.has(e)}function ji(e,t){return Hi(e)?e:Hi(t?.seatGlyph)?t.seatGlyph:"circle"}var me=.02291666666666667,Ve=1/me,nm=58,om=nm*me;var rm=3,Xi=0,er=120,im=0,am=45,sm=7,Ye=1.2;function tr(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function cm(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=sm?e:rm}function dt(e,t={}){let n=tr(t.floorBaseHeightM,Xi,er,0),o=Math.min(er,n+cm(e.elevation)*om),r=e.height===void 0?o:tr(e.height,Xi,er,o),i=tr(e.rake,im,am,0);return{height:r,rake:i}}var Yi=mt(require("earcut"),1),or=mt(require("polygon-clipping"),1);var Qy=Math.PI/180;function nr(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 fn(e){return e.length?nr(e):null}function Fe(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 De(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 C=me,lm=.002;function um(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<lm}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)}},jn=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){um(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,u=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(u[0],u[1],u[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 mm(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],u=r*c-i*s,l=i*a-o*c,m=o*s-r*a,h=Math.hypot(u,l,m)||1;return u/=h,l/=h,m/=h,[u,l,m]}function fm(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,Yi.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Ke(e){return Fe(e)<0?[...e].reverse():e}var dm=3;function hm(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,u=(e.y+t.y+n.y)/3,l=(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:u})-l)),h=(d,f,p)=>{let b=Math.abs(o({x:(d+c)/2,y:(f+u)/2})-(p+l)/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 dn(e,t,n,o,r){if(r<=0)return hm(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(dn(e,i,s,o,r-1),dn(i,t,a,o,r-1),dn(s,a,n,o,r-1),dn(i,a,s,o,r-1))}function hn(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};hn(e,t,h,f,r,i,a-1,s),hn(e,h,n,d,r,i,a-1,s),hn(e,f,d,o,r,i,a-1,s),hn(e,h,d,f,r,i,a-1,s);return}let c=[t.x*C,r(t),t.y*C],u=[n.x*C,r(n),n.y*C],l=[o.x*C,r(o),o.y*C];if(s){e.triN(c,u,l,s(t),s(n),s(o),i);return}let m=mm(c,u,l);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,u,l,m,i)}var pm=8;function Wi(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,a,s,c,u)=>{if(u>0){let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=t(l);if(Math.abs(m-(s+c)/2)>n){r(i,l,s,m,u-1),r(l,a,m,c,u-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),pm)}return o}function zn(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,u=s.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/l<t||o.push(a)}return o.length>=3?o:n}var Un=.001*Ve*.1;function se(e,t,n,o,r,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Fe(t))<1e-4))return;let l=zn(Wi(zn(Ke(t),Un),o,c),Un),m=n?.map(P=>zn(Wi(zn(Ke(P),Un),o,c),Un)).filter(P=>P.length>=3&&Math.abs(Fe(P))>=1e-4),{pts:h,tris:d}=fm(l,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<dm;g++){let P=0;for(let x=0;x<d.length;x+=3){let S=dn(h[d[x]],h[d[x+1]],h[d[x+2]],o,g);S>P&&(P=S)}if(P<=c)break}for(let P=0;P<d.length;P+=3){let x=h[d[P]],S=h[d[P+1]],w=h[d[P+2]];hn(e,x,S,w,o,f,g,u);let I=[x.x*C,r,x.y*C],L=[S.x*C,r,S.y*C],O=[w.x*C,r,w.y*C];e.tri(I,O,L,[0,-1,0],p)}let M=P=>{if(g<=0)return P;let x=1<<g,S=[];for(let w=0;w<P.length;w++){let I=P[w],L=P[(w+1)%P.length];for(let O=0;O<x;O++){let D=O/x;S.push({x:I.x+(L.x-I.x)*D,y:I.y+(L.y-I.y)*D})}}return S},v=nr(l),R=[{ring:M(l),flip:!1}];if(m)for(let P of m)P.length>=3&&R.push({ring:M(P),flip:!0});for(let{ring:P,flip:x}of R)for(let S=0;S<P.length;S++){let w=P[S],I=P[(S+1)%P.length],L=(I.x-w.x)*C,D=(I.y-w.y)*C,A=-L,E=Math.hypot(D,A)||1;D/=E,A/=E;let T=(w.x+I.x)/2-v.x,V=(w.y+I.y)/2-v.y,_=D*T+A*V;x&&(_=-_),_<0&&(D=-D,A=-A);let k=[D,0,A],H=[w.x*C,o(w),w.y*C],B=[I.x*C,o(I),I.y*C],F=[w.x*C,r,w.y*C],G=[I.x*C,r,I.y*C];e.tri(H,B,G,k,b,b,y),e.tri(H,G,F,k,b,y,y)}}function Ki(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 je(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Ke(e),r=o.length,i=[];for(let s=0;s<r;s++){let c=o[s],u=o[(s+1)%r],l=u.x-c.x,m=u.y-c.y,h=Math.hypot(l,m)||1;i.push({x:m/h,y:-l/h})}let a=[];for(let s=0;s<r;s++){let c=o[s],u=i[(s-1+r)%r],l=i[s],m=u.x+l.x,h=u.y+l.y,d=Math.hypot(m,h),f=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+l.x*t,c.y+l.y*t])};if(d<1e-9){f();continue}m/=d,h/=d;let p=m*u.x+h*u.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=or.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let m of s){let h=Math.abs(Fe(m[0].map(([d,f])=>({x:d,y:f}))));h>u&&(u=h,c=m[0])}if(!c)return e;let l=c.map(([m,h])=>({x:m,y:h}));if(l.length>1){let m=l[0],h=l[l.length-1];Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Et(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=Ke(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],m=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/m,y:(l.x-u.x)/m})}let a=[],s=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],m=i[c],h=l.x+m.x,d=l.y+m.y,f=Math.hypot(h,d),p=f<1e-9?1/0:1/Math.max(h/f*l.x+d/f*l.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+m.x*t,y:u.y+m.y*t}),s.push(c,c);continue}h/=f,d/=f,a.push({x:u.x+h*t*p,y:u.y+d*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let u=(c+1)%a.length,l=s[c],m=s[u];if(m!==(l+1)%r)continue;let h=o[l],d=o[m];if((a[u].x-a[c].x)*(d.x-h.x)+(a[u].y-a[c].y)*(d.y-h.y)<=0)return[]}try{let c=or.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]]]),u=null,l=0;for(let f of c){let p=Math.abs(Fe(f[0].map(([b,y])=>({x:b,y}))));p>l&&(l=p,u=f[0])}if(!u)return[];let m=u.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?Ke(m):[]}catch{return[]}}function Xn(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 pn(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 nt=.22;function qi(e,t){let n=Re[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 bm=.42;function ym(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),u=Math.max(Math.sqrt(s*c/t),1e-6),l=Math.max(1,Math.ceil(s/u)+1),m=Math.max(1,Math.ceil(c/u)+1),h=new Map,d=(f,p)=>{let b=Math.min(l-1,Math.max(0,Math.floor((f-o)/u)));return Math.min(m-1,Math.max(0,Math.floor((p-r)/u)))*l+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(l-1,Math.max(0,Math.floor((p.x-o)/u))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-r)/u))),g=1/0;for(let M=1;M<=4;M++){for(let v=y-M;v<=y+M;v++)if(!(v<0||v>=m))for(let R=b-M;R<=b+M;R++){if(R<0||R>=l||M>1&&Math.abs(v-y)<M&&Math.abs(R-b)<M)continue;let P=h.get(v*l+R);if(P)for(let x of P){if(x===f)continue;let S=Math.hypot(e[x].x-p.x,e[x].y-p.y);S<g&&(g=S)}}if(Number.isFinite(g)&&g<=M*u)break}n[f]=g}return n}function gm(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ye):0}function $i(e,t,n,o,r,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),l=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a*3),p=new Map,b=ym(e);for(let y=0;y<a;y++){let g=e[y],v=(n?.seatPitchU(y)??b[y])*C;l[y]=Number.isFinite(v)?Math.max(.06,Math.min(nt,v*bm)):nt,m[y]=hi(Number.isFinite(v)?v:void 0);let R=ji(g.glyph,{seatGlyph:i?.get(g.categoryKey)});h[y]=Ui.indexOf(R),d[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*C,s[y*3+1]=n?n.seatDeckY(y):gm(g),s[y*3+2]=g.y*C,c[y]=ln(t?t(g):"available");let P=de(r?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=P[0],u[y*3+1]=P[1],u[y*3+2]=P[2],g.accessibility?.length){let x=de(Gi(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:u,iMaxRadius:l,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 xm=64;function rr(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=ln(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+xm){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 bn=3,_t=.38,yn=.24;function vm(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)*C,i=(n.y-t.y)*C,a=(o.x-t.x)*C,s=(o.y-t.y)*C,c=2*(r*s-i*a);if(Math.abs(c)<1e-7)return null;let u=r*r+i*i,l=a*a+s*s,m=(u*s-l*i)/c+t.x*C,h=(r*l-a*u)/c+t.y*C,d=Math.hypot(t.x*C-m,t.y*C-h);return d<1||d>200||!Number.isFinite(d)||e.some(f=>Math.abs(Math.hypot(f.x*C-m,f.y*C-h)-d)>.03)?null:{x:m,z:h,radius:d}}function Zi(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/bn)},${Math.floor(u/bn)}`;for(let c of e)for(let u of c.rows){for(let m of u.pts){let h=m.x*C,d=m.y*C,f=o(h,d),p=n.get(f)??[];p.push({x:h,z:d,y:u.y,floor:c.floorIndex}),n.set(f,p)}if(u.patch||u.pts.length<2)continue;let l=vm(u.pts);for(let m of[0,u.pts.length-1]){let h=u.pts[m],d=u.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:l,row:u,point:h,x:h.x*C,z:h.y*C,dx:f/b,dz:p/b})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),m=r.get(l)??[];m.push(u),r.set(l,m)});let i=(c,u)=>{let l=Math.floor(c/bn),m=Math.floor(u/bn);return[-1,0,1].flatMap(h=>[-1,0,1].map(d=>`${l+h},${m+d}`))},a=new Map;t.forEach((c,u)=>{let l=-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>bn)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,v=Math.min((b*c.dx+y*c.dz)/g,(-b*p.dx-y*p.dz)/g);(M?v<.8:v<.98)||!M&&(Math.abs(b*c.dz-y*c.dx)>.15||Math.abs(b*p.dz-y*p.dx)>.15)||(g<m-.02?(l=f,m=g,h=!1):Math.abs(g-m)<=.02&&(h=!0))}l>=0&&!h&&a.set(u,l)});let s=[];for(let[c,u]of a){if(c>=u||a.get(u)!==c)continue;let l=t[c],m=t[u],h=Math.hypot(m.x-l.x,m.z-l.z),d=(m.x-l.x)/h,f=(m.z-l.z)/h,p=!1;for(let y of i((l.x+m.x)/2,(l.z+m.z)/2))for(let g of n.get(y)??[]){if(g.floor!==l.floorIndex||Math.abs(g.y-l.row.y)>.75)continue;let M=(g.x-l.x)*d+(g.z-l.z)*f,v=Math.abs((g.x-l.x)*f-(g.z-l.z)*d);M>.01&&M<h-.01&&v<yn+_t&&(p=!0)}if(p)continue;let b=(y,g)=>({x:(l.x+d*y-f*g)/C,y:(l.z+f*y+d*g)/C});s.push({sections:[l.sectionId,m.sectionId],blocks:[l.row.blockId,m.row.blockId],floorIndex:l.floorIndex,ends:[l.point,m.point],clearWidthM:h-2*_t,heightM:(l.row.y+m.row.y)/2,outline:[b(_t,-yn),b(h-_t,-yn),b(h-_t,yn),b(_t,yn)]})}return s}var Mm=.15,Sm=1.6;function Qi(e){return ki(e??1,Mm,Sm)}var wm=.15,Pm=.9,Im=1.76;function Rm(){return{background:{top:[...At.top],bottom:[...At.bottom]},structure:Ko,seatStates:{...Pi},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Am(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 Ji(e){let t=Rm();e??={};let n=de(e.background);if(n){t.background={top:ae(n,Pm),bottom:ae(n,Im)};let s={};for(let[u,l]of Object.entries(Ko))s[u]=he(l,n,wm);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(s.ground=ae(n,.86)),t.structure=s}let o=de(e.selectionColor)??de(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Qi(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,s])=>s!=null)),a={...Am(n),...i};if(a){let s=de(a.deck),c=de(a.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=de(a.seat),t.materials.shell=de(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return t}function ea(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function ta(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 na(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[ta(e,.5)];let o=Array.from({length:n+1},(c,u)=>ta(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}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 u=i*c/(t-1);for(;s<r.length-1&&r[s]<u;)s+=1;let l=r[s-1],m=r[s],h=m===l?0:(u-l)/(m-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 oa(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 u=i.reduce((h,d)=>h+d.seatCount,0),l=0,m=0;for(let h of i)h.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(h.id,{groupId:o,adjacencyOffset:l,displayOffset:m,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),l+=h.seatCount,m+=h.seatCount}return t}var Cm="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Em="abcdefghijklmnopqrstuvwxyz";function _m(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 ir(e,t=!1){let n=t?Em:Cm;return _m(Math.max(0,Math.floor(e)-1),n)}var Tm=[[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 ra(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of Tm)for(;t>=o;)n+=r,t-=o;return n}function km(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 Wn(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 u=i==="odd"||i==="even"?2:r,l=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,m=o==="center"?km(c)[t]:o==="rtl"?c-1-t:t,h;switch(i){case"odd":{let d=l%2===1?l:l+1;h=String(d+m*2);break}case"even":{let d=l%2===0?l:l+1;h=String(d+m*2);break}case"roman":h=ra(l+m*r);break;case"letters-upper":h=ir(l+m*r,!1);break;case"letters-lower":h=ir(l+m*r,!0);break;default:h=String(l+m*r);break}return`${a}${h}`}function Lm(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function ia(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${Wn(e,t)}`}function ar(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(e.seatDisplayLabelMode==="number")return Wn(e,t);if(!n)return`${e.displayLabel||e.label}-${Wn(e,t)}`;let r=Lm(n),i=n.displayOffset+t;return`${n.displayLabel}-${Wn(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 Gt(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,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let m=t-(i.x+l*s),h=n-(i.y+l*c);if(Math.abs(m)>=o||Math.abs(h)>=o)continue;let d=Math.hypot(m,h);d<o&&(o=d)}return o}function Fm(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 sa(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function sr(e,t){let n=1/0;for(let o of aa(e)){let r=Gt(t,o.x,o.y);r<n&&(n=r)}for(let o of aa(t)){let r=Gt(e,o.x,o.y);r<n&&(n=r)}return n}function Dm(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 r=-1,i=e[0];for(let l of e){let m=Math.hypot(l.x-n,l.y-o);m>r&&(r=m,i=l)}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 u=e.map((l,m)=>({p:l,i:m,t:(l.x-n)*a+(l.y-o)*s})).sort((l,m)=>l.t-m.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function cr(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,u=0,l=0;for(let g of e){let M=g.x-n,v=g.y-o;r+=M*M,a+=v*v,i+=M*v,s+=M*M*M,c+=v*v*v,u+=M*v*v,l+=v*M*M}let m=r*a-i*i;if(Math.abs(m)<1e-9)return null;let h=(s+u)/2,d=(c+l)/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 Om=.15;function Bm(e){if(e.length<2)return null;let t=e.map(g=>{let M=0,v=0;for(let R of g.pts)M+=R.x,v+=R.y;return{x:M/g.pts.length,y:v/g.pts.length}}),n=0,o=0;for(let g of t)n+=g.x,o+=g.y;n/=t.length,o/=t.length;let r=0,i=0,a=0;for(let g of t){let M=g.x-n,v=g.y-o;r+=M*M,i+=M*v,a+=v*v}let s=r+a,c=r*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),l,m;Math.abs(i)>1e-12?(l=u-a,m=i):r>=a?(l=1,m=0):(l=0,m=1);let h=Math.hypot(l,m);if(!(h>1e-12))return null;l/=h,m/=h;let d=1/0,f=-1/0,p=[];for(let g of e){let M=1/0,v=-1/0;for(let R of g.pts){let P=R.x*l+R.y*m;P<M&&(M=P),P>v&&(v=P),P<d&&(d=P),P>f&&(f=P)}p.push(v-M)}let b=f-d;return b>1e-9?(p.sort((g,M)=>g-M),p[Math.min(p.length-1,Math.floor(p.length*.9))]/b<=Nm?{x:l,y:m}:null):null}var Nm=.35;function Yn(e,t,n,o){let r=new Map;for(let P of n){let x=t[P],S=x.rowId||`__seat-${P}`,w=r.get(S);w||(w={pts:[],idx:[]},r.set(S,w)),w.pts.push({x:x.x,y:x.y}),w.idx.push(P)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[P,x]of r){let S=Dm(x.pts,x.idx),w=0;for(let I of S.pts)w+=Math.hypot(I.x-o.x,I.y-o.y);i.push({id:P,pts:S.pts,seatIndices:S.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:w/S.pts.length})}let a=i.map(P=>Fm(P.pts)),s=i.length<=256?i.length*(i.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let u=c?new Map(i.map((P,x)=>[P,x])):null,l=(P,x)=>(P>x&&([P,x]=[x,P]),P*(2*i.length-P-1)/2+(x-P-1)),m=(P,x)=>{if(!c)return sr(i[P].pts,i[x].pts);let S=l(P,x),w=c[S];if(!Number.isNaN(w))return w;let I=sr(i[P].pts,i[x].pts);return c[S]=I,I},h=(P,x)=>u?m(u.get(P),u.get(x)):sr(P.pts,x.pts),d=[];for(let P=0;P<i.length;P++){let x=1/0;for(let S=0;S<i.length;S++){if(P===S||sa(a[P],a[S])>=x)continue;let w=m(P,S);w<x&&(x=w)}Number.isFinite(x)&&d.push(x)}d.sort((P,x)=>P-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 P=0;P<i.length;P++)for(let x=P+1;x<i.length;x++)sa(a[P],a[x])>p||m(P,x)<=p&&(b[P].push(x),b[x].push(P));let y=0;for(let P=0;P<i.length;P++){if(i[P].blockId!==-1)continue;let x=y++,S=[P];for(i[P].blockId=x;S.length;){let w=S.pop();for(let I of b[w])i[I].blockId===-1&&(i[I].blockId=x,S.push(I))}}let g=new Map;for(let P of i){let x=g.get(P.blockId)??[];x.push(P),g.set(P.blockId,x)}let M=[];for(let P of i){if(P.pts.length<4)continue;let x=cr(P.pts);x&&(!Number.isFinite(x.cx)||!Number.isFinite(x.cy)||M.push({x:x.cx,y:x.cy}))}let v=M.length>=2?(()=>{let P=M.map(w=>w.x).sort((w,I)=>w-I),x=M.map(w=>w.y).sort((w,I)=>w-I),S=Math.floor(M.length/2);return{cx:P[S],cy:x[S]}})():null;if(v){let P=O=>Math.hypot(O.x-v.cx,O.y-v.cy),x=1/0,S=-1/0,w=[];for(let O of i){let D=1/0,A=-1/0;for(let E of O.pts){let T=P(E);T<D&&(D=T),T>A&&(A=T)}w.push(A-D),D<x&&(x=D),A>S&&(S=A)}let I=S-x;w.sort((O,D)=>O-D);let L=w[Math.min(w.length-1,Math.floor(w.length*.9))];if(I>1e-9&&L/I<=Om){let O=i.map(F=>{let G=0;for(let j of F.pts)G+=P(j);return{row:F,radius:G/F.pts.length}}),D=0,A=0;for(let F of O)D+=F.radius,A+=F.row.focalDistance;D/=O.length,A/=O.length;let E=0;for(let F of O)E+=(F.radius-D)*(F.row.focalDistance-A);if(E<0)for(let F of O)F.radius=-F.radius;let V=1/0;for(let F of O)F.radius<V&&(V=F.radius);O.sort((F,G)=>F.radius-G.radius);let _=-1,k=-1/0,H=I/Math.max(1,O.length)*.5,B=[];for(let F of O)F.radius-k>H&&(_++,k=F.radius),F.row.ordinal=_,F.row.blockDepth=F.radius-V,B.push(F.row);return{sectionId:e,rows:B,blockCount:y}}}let R=[];for(let[,P]of g){let x=Bm(P);if(x){let S=I=>{let L=0;for(let O of I.pts)L+=O.x*x.x+O.y*x.y;return L/I.pts.length};P.sort((I,L)=>S(I)-S(L)),P.length>=2&&P[0].focalDistance>P[P.length-1].focalDistance&&P.reverse();let w=0;for(let I=0;I<P.length;I++)I>0&&(w+=h(P[I-1],P[I])),P[I].ordinal=I,P[I].blockDepth=w,R.push(P[I])}else{let S=1/0;for(let w of P)w.focalDistance<S&&(S=w.focalDistance);P.sort((w,I)=>w.focalDistance-I.focalDistance);for(let w=0;w<P.length;w++)P[w].ordinal=w,P[w].blockDepth=Math.max(0,P[w].focalDistance-S),R.push(P[w])}}return{sectionId:e,rows:R,blockCount:y}}var Vm=/^\d{4}-\d{2}-\d{2}$/;function Gm(e){let t=Date.parse(e);return Number.isFinite(t)?Vm.test(e)?t+864e5:t:null}function Hm(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=Gm(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function zm(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Um(e){return e.status!=="draft"&&e.status!=="retracted"}function jm(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&&Um(e)&&zm(e,t.activeConfigurationId,t.activeConfigurationVersion)&&jm(e,t.activeBasisSha256)&&Hm(e,t.now)}var Xm=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Wm=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Tt(e){return!!e&&Xm.has(e)}function ma(e){return!!e&&Wm.has(e)}var Kn=1.1,Ym={"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}},Km={"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 qm=Math.PI*2;function $m(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function la(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 ua=(()=>{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 u=0;u<=24;u++){let l=s+(c-s)*u/24;a.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:a}})();var qn="#f1f5f9";function gn(e){return Tt(e)}function ht(e,t,n,o,r=32){let i=[];for(let a=0;a<r;a++){let s=a/r*qm;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function ot(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 Zm(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),u=r/2,l=i/2,m=[],h=Ym[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:-l},{x:0,y:l}],closed:!1}),m.push({points:ht(0,0,d(9.15),f(9.15)),closed:!0});for(let p of[-1,1])m.push({points:ot(p*(u-d(16.5)/2),0,d(16.5)/2,f(40.32)/2),closed:!0}),m.push({points:ot(p*(u-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:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*d(7.5),y:-l},{x:p*d(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(u-d(4)),y:-f(11)},{x:p*(u-d(4)),y:f(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:ht(p*d(20.5),b*f(7),d(4.5),f(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:ht(0,0,d(4.5),f(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=l-f(1.22)*8;b>0&&m.push({points:la(u-d(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let y=1;y<8;y++){let g=f(1.22)*y,M=l-g;if(M<=0)break;m.push({points:la(u-d(1.22)*y,M),closed:!0})}break}case"oval-cricket":{m.push({points:ht(0,0,d(27.4),f(27.4+20.12/2),40),closed:!0}),m.push({points:ot(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:-l},{x:d(b),y:l}],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=(T,V)=>({x:d(T),y:f(V)}),{home:b}=ua,y=27.43,g=y/Math.SQRT2,M={x:b.x+g,y:b.y-g},v={x:b.x,y:b.y-2*g},R={x:b.x-g,y:b.y-g},P={x:b.x,y:b.y-18.44},x="#b98a59",S=Km["diamond-baseball"],w=38.94,I=[p(b.x,b.y)],L=Math.atan2(b.y-w/Math.SQRT2-P.y,w/Math.SQRT2),O=Math.PI-L;for(let T=0;T<=16;T++){let V=L-(L+Math.PI*2-O)%(Math.PI*2)*(T/16);I.push(p(P.x+29*Math.cos(V),P.y+29*Math.sin(V)))}m.push({points:I,closed:!0,fill:x,ink:x});let D={x:b.x,y:b.y-g},A=[{x:b.x,y:b.y},M,v,R].map(T=>p(D.x+(T.x-D.x)*.84,D.y+(T.y-D.y)*.84));m.push({points:A,closed:!0,fill:S,ink:S}),m.push({points:ht(d(P.x),f(P.y),d(2.74),f(2.74),20),closed:!0,fill:x,ink:x}),m.push({points:ht(d(b.x),f(b.y),d(3.96),f(3.96),20),closed:!0,fill:x,ink:x});let E=ua.fence;m.push({points:[p(b.x,b.y),p(E[0].x,E[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(E[E.length-1].x,E[E.length-1].y)],closed:!1});for(let T of[M,v,R])m.push({points:ot(d(T.x),f(T.y),d(.3),f(.3)),closed:!0,fill:qn});break}case"court-basketball":{m.push({points:ot(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:ht(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:ot(d((b+y)/2),0,d(2.9),f(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:ht(d(y),0,d(1.8),f(1.8),24),closed:!0});let M=Math.sqrt(6.75*6.75-6.6*6.6),v=[{x:d(b),y:-f(6.6)}],R=Math.atan2(-6.6,-p*M),P=2*Math.atan2(6.6,M);for(let x=0;x<=16;x++){let S=R-p*P*(x/16);v.push({x:d(g+6.75*Math.cos(S)),y:f(6.75*Math.sin(S))})}v.push({x:d(b),y:f(6.6)}),m.push({points:v,closed:!1})}break}case"court-tennis":{m.push({points:ot(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:ot(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,v]of y)m.push({points:ot(g*d(3.05),M*f(3.05),d(.3),f(.3)),closed:!0,fill:v,ink:v});break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>$m(b.x,b.y,s,c,n,o))}))}function fa(e){if(e.role!=="stage"||!gn(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),r=Math.min(...n),i=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,s-a);t={cx:r+c/2,cy:a+u/2,width:c,height:u}}return t?Zm({kind:e.stageKind,...t}):[]}var Qm=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Jm=/[\s"'<>`\\]/;function ef(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Qm.test(e);if(Jm.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function da(e){let t=e.trim();return ef(t)?t:null}var lr="seatlayer.event-configuration/1";var Ht=100,tf=120,nf=2e5,of=1e4,rf=/^[a-f0-9]{64}$/,af=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function xn(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 sf(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ha(e){return!Array.isArray(e)||e.length>nf||!e.every(t=>kt(t,Ht))?null:[...new Set(e)].sort()}function cf(e){return!xn(e)||!kt(e.chartId,Ht)||!kt(e.version,Ht)||e.sha256!==void 0&&(typeof e.sha256!="string"||!rf.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ur(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function lf(e){return xn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ur(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function uf(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>of)return null;let n=new Set(t),o=new Set,r=new Set,i=0,a=[];for(let s of e){if(!xn(s)||!kt(s.id,Ht)||!kt(s.objectId,Ht)||!n.has(s.objectId)||!af.has(String(s.kind))||!ur(s.heightM,.05,50)||s.baseElevationM!==void 0&&!ur(s.baseElevationM,-10,100))return null;let c=lf(s.occlusion);if(!c||o.has(s.id)||r.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?da(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||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,...u?{contentImageUrl:u}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function mf(e){let t=[];if(!xn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==lr&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${lr}`}),kt(e.id,Ht)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),kt(e.label,tf)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),sf(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=cf(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=xn(e.overlay)?e.overlay:null,r=ha(o?.objectIds),i=ha(o?.productionKillSeatIds),a=r?uf(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:lr,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function pa(e){let t=mf(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function ff(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 df(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 ba(e){let t=ff(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>df(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.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 hf=5,pf=3,bf=.92,yf=1.9,gf=2,xf=.6,vf=1,Mf=.06;function Sf(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?Kn:gn(e.stageKind)?Mf:vf}function ya(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let a of va(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=ba(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,s+Sf(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function wf(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,u=i*t,l=Math.max(1,Math.ceil((a-r)*t/n)+1),m=Math.max(1,Math.ceil((s-i)*t/n)+1),h=new Float64Array(l*m).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let f=d.eyeHeightM-Ye,p=Math.min(l-1,Math.max(0,Math.floor((d.x*t-c)/n))),y=Math.min(m-1,Math.max(0,Math.floor((d.y*t-u)/n)))*l+p,g=f+o;g>h[y]&&(h[y]=g)}return{cellM:n,minX:c,minY:u,cols:l,rows:m,top:h}}function Pf(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 ga(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??me,i=n.cellM??xf,a=n.chairBackM??bf,s=n.selfRowSkipM??gf,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??hf),m=Math.max(1,n.rows??pf),h=wf(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 v=0;v<l;v++){let R=(v+.5)/l-.5,P=p?b+R*d:b,x=p?y:y+R*f;for(let S=0;S<m;S++){let w=t.deckTopM+(m===1?0:S/(m-1)*yf);g.push({x:P,y:x,z:w})}}let M=i/2;for(let v of e){if(!Number.isFinite(v.eyeHeightM))continue;let R=v.x*r,P=v.y*r,x=v.eyeHeightM,S=0,w=1/0;for(let L of g){let O=L.x-R,D=L.y-P,A=Math.hypot(O,D);if(!(A>s)){S++;continue}let E=O/A,T=D/A,V=0;for(let _=s;_<A;_+=M){let k=Pf(h,R+E*_,P+T*_);if(!(!Number.isFinite(k)||k>=x)&&k>x+(L.z-x)*_/A){V=_;break}}V?w=Math.min(w,V):S++}let I=S/g.length;I>=c||o.set(v.id,{seatId:v.id,mark:I<u?"obstructedView":"restrictedView",visibleFraction:I,totalRays:g.length,atDistanceM:Number.isFinite(w)?w:0})}return o}function xa(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 mr(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Zn=Math.PI/180;var vn=16;function fr(e,t,n,o){let r=n*Zn,i=Math.cos(r),a=Math.sin(r);return{x:o.x+e*i-t*a,y:o.y+e*a+t*i}}function Ia(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,a=[];if(e.path)return na(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(o===0){for(let u=0;u<t;u++)a.push(fr(u*n,0,r,i));return a}let s=o/(t-1)*Zn,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let l=u*s,m=c*Math.sin(l),h=-c+c*Math.cos(l);a.push(fr(m,h,r,i))}return a}function Ra(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function If(e,t){let n=Ra(e);return Ia(e).map((o,r)=>{let i=n.get(r),a=mr(i),s=ia(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:ar(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(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Rf(e){let t=[];for(let n of If(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 Af(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 Cf(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])),r=(l,m,h,d)=>{let f=o.get(l),p=mr(f),b=f?.label??`${e.label}-${l+1}`,y=e.displayLabel??e.label;return{index:l,label:b,displayLabel:f?.displayLabel??`${y}-${l+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 l=(e.radius??40)+vn,m=e.rotation*Zn,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+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let d=h*Zn,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+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=Af(e),c=["top","bottom","left","right"],u=0;for(let l of c){let m=s[l];for(let h=0;h<m;h++){let d,f;l==="top"?(d=-i/2+(h+.5)*i/m,f=-a/2-vn):l==="bottom"?(d=-i/2+(h+.5)*i/m,f=a/2+vn):l==="left"?(d=-i/2-vn,f=-a/2+(h+.5)*a/m):(d=i/2+vn,f=-a/2+(h+.5)*a/m);let p=fr(d,f,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function Ef(e){return Cf(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 _f(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 Ma(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 Tf(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 dr(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Te(e,t,n){return Ma(e,t)&&!dr(n).some(o=>Ma(e,o)||Tf(e,o))}function $n(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 Aa(e){switch(e.type){case"row":{let t=Ia(e),n=Ra(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 $n(e.points);case"section":return $n(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?$n(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 Sa(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function kf(e,t){if(e.type!=="gaArea"||!Sa(e.points,t.outline))return!1;let n=dr(e.holes),o=dr(t.holes);return n.length===o.length&&n.every((r,i)=>Sa(r,o[i]))}function Lf(e,t,n=e.filter(r=>r.type==="section"),o=Aa(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(kf(t,a)||Te(o,a.outline,a.holes))):void 0)??n.find(a=>Te(o,a.outline,a.holes))}function va(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 wa(e,t,n,o,r,i,a,s,c){let u=[],l=e.filter(p=>p.type==="section"),m=oa(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=Rf(p):p.type==="table"?b=Ef(p):p.type==="booth"&&(b=_f(p)),!b.length)continue;for(let R of b)R.viewUrl&&!h(R.viewMeta)&&(R.viewUrl=void 0,R.viewMeta=void 0);if(p.type==="row"){let R=m.get(p.id);if(R){let P=new Map((p.overrides??[]).map(x=>[x.index,x]));for(let x of b){let S=Number(x.id.slice(x.id.lastIndexOf(":")+1));if(!Number.isInteger(S))continue;x.logicalRowId=R.groupId,x.logicalSeatIndex=R.adjacencyOffset+S,P.get(S)?.displayLabel||(x.displayLabel=ar(p,S,R)),!x.viewUrl&&R.viewFromSeatUrl&&h(R.viewFromSeatMeta)&&(x.viewUrl=R.viewFromSeatUrl,x.viewMeta=R.viewFromSeatMeta);let w=P.get(S)?.confidenceEvidence;x.confidenceEvidence=f(w,"exact-seat")??f(p.confidenceEvidence,"row-representative")??f(R.confidenceEvidence,"row-representative")}}}let y=Lf(e,p,l,p.type==="row"?$n(b):Aa(p)),g=y?.viewFromSeatUrl,v=(y?.zone?t?.find(R=>R.id===y.zone):void 0)?.focalPoint??n;for(let R of b){if(!R.confidenceEvidence){let P=Number(R.id.slice(R.id.lastIndexOf(":")+1)),x=(p.type==="row"||p.type==="table")&&Number.isInteger(P)?p.overrides?.find(S=>S.index===P)?.confidenceEvidence:void 0;R.confidenceEvidence=f(x,"exact-seat")??(p.type==="row"?f(p.confidenceEvidence,"row-representative"):void 0)}R.confidenceEvidence??=f(y?.confidenceEvidence,"section-representative")??(a?f(a.evidence,a.coverage):void 0),!R.viewUrl&&g&&h(y?.viewFromSeatMeta)&&(R.viewUrl=g,R.viewMeta=y?.viewFromSeatMeta),!R.viewUrl&&i&&h(i.meta)&&(R.viewUrl=i.url,R.viewMeta=i.meta),y&&(R.sectionId=y.logicalSectionId??y.id),y?.zone&&(R.zoneId=y.zone),v&&(R.focalPoint={...v})}u.push(...b)}return u}function zt(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=wa(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Pa(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=wa(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&&Pa(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Ff(e,n,t)}function Ff(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||xa(t,ga(t,ya(e))),t}function Pa(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+Ye;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,u=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&&Te({x:h.x,y:h.y},b.outline,b.holes)):void 0)??r.find(b=>Te({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=u.get(f.id);p?p.push(m):u.set(f.id,[m])}let l=new Array(o.length).fill(void 0);for(let[m,h]of u){let d=c.get(m);if(!d)continue;let f=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=Yn(m,o,h,t);for(let b of p.rows){let y=b.blockDepth*me*f,g=d.height+y;for(let M of b.seatIndices)l[M]=g}}for(let m=0;m<o.length;m++){let h=o[m],d=a[m];if(!d){h.eyeHeightM=n+Ye;continue}let f=c.get(d.id);h.eyeHeightM=(l[m]??f.height)+Ye}}function Df(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 Of(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,u=a.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let m=[...e].sort((d,f)=>(d.x-n)*c+(d.y-o)*u-((f.x-n)*c+(f.y-o)*u)),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 Ca(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,u=s.y-a.y,l=c*c+u*u,m=l>1e-12?((t-a.x)*c+(n-a.y)*u)/l:0;m<0?m=0:m>1&&(m=1);let h=Math.hypot(t-(a.x+m*c),n-(a.y+m*u));h<r&&(r=h)}return r}var Qn=8;function Bf(e,t,n){let o=new Array(Qn).fill(1/0),r=new Array(Qn).fill(-1);for(let l=0;l<e.length;l++){let m=e[l],h=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let d=0;d<Qn;d++)if(h<o[d]){for(let f=Qn-1;f>d;f--)o[f]=o[f-1],r[f]=r[f-1];o[d]=h,r[d]=l;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let m=Ca(e[l],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]=l;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,u=0;for(let l=0;l<3;l++){let m=a[l];if(m<0||i[l]>s)continue;let h=1/(i[l]*i[l]);c+=h*e[m].depth,u+=h}return u>0?c/u:e[a[0]].depth}function Nf(e){let t=(o,r)=>Bf(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 u=Ca(c,o,r);u<i&&(i=u,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 Ea(e,t){let n=[];for(let o of e){let r=Of(o.points,t);r&&n.push(r)}return n.length<2?Df(t):(n.sort((o,r)=>o.depth-r.depth),Nf(n))}var br=mt(require("polygon-clipping"),1);var La=mt(require("earcut"),1);var Vf=.58,_a=.01,Ge=nt*1.5*Ve,Gf=.5,Hf=.6;function zf(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)],u=c.x-s.x,l=c.y-s.y,m=Math.hypot(u,l);if(m<1e-9){o.push([0,0]);continue}u/=m,l/=m,o.push([-l,u])}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 Uf(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},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 Ta=Math.PI/12;function jf(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 Fa(e,t){if(!e.length||!(t>0))return[];let n=jf(e),o=(s,c,u,l)=>{let m=u-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/Ta)),d=t/Math.cos(m/h/2);for(let f=0;f<=h;f++){let p=c+m*f/h;l.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 u=0;for(let d of n)u=Math.max(u,Math.hypot(d.x-s,d.y-c));let l=[],m=Math.max(3,Math.ceil(Math.PI*2/Ta)),h=(u+t)/Math.cos(Math.PI/m);for(let d=0;d<m;d++){let f=d/m*Math.PI*2;l.push({x:s+Math.cos(f)*h,y:c+Math.sin(f)*h})}return l}let r=n.length,i=[];for(let s=0;s<r;s++){let c=n[s],u=n[(s+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<r;s++)o(n[s],i[(s+r-1)%r],i[s],a);return Va(a)}function Xf(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,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let m=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));m<o&&(o=m)}return o}function Jn(e){let t=e.map(r=>{let i=0,a=0;for(let u of r.pts)i+=u.x,a+=u.y;let s=r.pts.length||1;i/=s,a/=s;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-a);l>c&&(c=l)}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 l 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(l.x-d.cx,l.y-d.cy)-d.rad;if(f>=m&&f>=s)continue;let p=Xf(e[h].pts,l.x,l.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((l,m)=>l-m);let u=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function Da(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],m=l.x-o.x,h=l.y-o.y,d=Math.hypot(m,h)||1;m/=d,h/=d;let f=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+h*f,y:l.y-m*f},{x:l.x-h*f,y:l.y+m*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let l=1;l<i.length;l++){let m=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,u=Uf(i,Math.max(c*Hf,Ge));return{pts:u,nrm:zf(u,o),front:Math.max(n[t].pitch*Vf,Ge),back:Math.max(n[t].pitch*Gf,Ge)}}var Ut=1.5,Oa=.3;function hr(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 u=hr(e.slice(0,c+1),t),l=hr(e.slice(c),t);return[...u.slice(0,-1),...l]}function Ba(e,t){if(e.length<4)return e;let n=hr([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Wf(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 Na(e,t,n){if(e.length<2)return[];let o=n??Jn(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 u=s.map(g=>Da(e,g,o,t)).filter(g=>g!==null);if(!u.length)continue;let l=(g,M)=>({x:g.pts[M].x-g.nrm[M][0]*(g.front+Ut),y:g.pts[M].y-g.nrm[M][1]*(g.front+Ut)}),m=(g,M)=>({x:g.pts[M].x+g.nrm[M][0]*(g.back+Ut),y:g.pts[M].y+g.nrm[M][1]*(g.back+Ut)}),h=u[0],d=u[u.length-1],f=[];for(let g=0;g<h.pts.length;g++)f.push(l(h,g));for(let g of u)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=u.length-1;g>=0;g--)f.push(l(u[g],0));let p=Va(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(Fe(p))>1e-6&&u.every(g=>{let M=g.pts[Math.floor(g.pts.length/2)];return De(p,M.x,M.y)})&&!Wf(p)){i.push({outline:Ba(p,Oa),holes:[],topY:b});continue}for(let g of Yf(u))i.push({outline:g,holes:[],topY:b})}return i}function Yf(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Ut,a=n.back+Ut;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*a,u.y+l[1]*a])}let s=[...o,...r.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=br.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,u])=>({x:c,y:u})),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(Ba(i,Oa))}return o}catch{return[]}}function Va(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 pr=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(!De(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function ka(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let m=1;m+1<o.length;m++){let h=o[m],d=o[m+1];e.tri([l.x*C,r,l.y*C],[h.x*C,r,h.y*C],[d.x*C,r,d.y*C],u,i)}return}let a=o.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=br.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let l=u[0],m=[],h=[];for(let f=0;f<l.length-1;f++)m.push(l[f][0],l[f][1]),h.push([l[f][0],l[f][1]]);if(h.length<3)continue;let d=(0,La.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]*C,r,p[1]*C],[b[0]*C,r,b[1]*C],[y[0]*C,r,y[1]*C],c,i)}}}function Ga(e,t,n,o,r,i,a){if(t.length<2)return;let s=a??Jn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new pr([[...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 R=[...f.patch],P=s[d].belowY??o;if(h(()=>{if(u&&l)ka(e,u,l,R,f.y,r.tread);else{let x=R[0];for(let S=1;S+1<R.length;S++){let w=R[S],I=R[S+1];e.tri([x.x*C,f.y,x.y*C],[w.x*C,f.y,w.y*C],[I.x*C,f.y,I.y*C],c,r.tread)}}}),f.y>P+_a){let x=0,S=0;for(let w of R)x+=w.x,S+=w.y;x/=R.length,S/=R.length,m(()=>{for(let w=0;w<R.length;w++){let I=R[w],L=R[(w+1)%R.length],O=L.x-I.x,D=L.y-I.y,A=Math.hypot(O,D);if(A<1e-6)continue;let E=D/A,T=-O/A;(I.x-x)*E+(I.y-S)*T<0&&(E=-E,T=-T);let V=[E,0,T],_=[I.x*C,f.y,I.y*C],k=[L.x*C,f.y,L.y*C],H=[I.x*C,P,I.y*C],B=[L.x*C,P,L.y*C];e.tri(_,k,B,V,r.riser),e.tri(_,B,H,V,r.riser)}})}continue}let p=Da(t,d,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:M}=p,v=s[d].belowY??o;for(let R=0;R+1<b.length;R++){let P=b[R],x=b[R+1],S=y[R],w=y[R+1];if(Math.hypot(x.x-P.x,x.y-P.y)<1e-6||S[0]===0&&S[1]===0||w[0]===0&&w[1]===0)continue;let I=[(P.x-S[0]*g)*C,f.y,(P.y-S[1]*g)*C],L=[(x.x-w[0]*g)*C,f.y,(x.y-w[1]*g)*C],O=[(P.x+S[0]*M)*C,f.y,(P.y+S[1]*M)*C],D=[(x.x+w[0]*M)*C,f.y,(x.y+w[1]*M)*C];if(h(()=>{u&&l?ka(e,u,l,[{x:P.x-S[0]*g,y:P.y-S[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:P.x+S[0]*M,y:P.y+S[1]*M}],f.y,r.tread):(e.tri(I,L,D,c,r.tread),e.tri(I,D,O,c,r.tread))}),f.y>v+_a){let A=[I[0],v,I[2]],E=[L[0],v,L[2]],T=[-S[0],0,-S[1]];m(()=>{e.tri(I,L,E,T,r.riser),e.tri(I,E,A,T,r.riser)})}}}}function Ha(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}var yr=mt(require("polygon-clipping"),1);function Kf(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function za(e,t){return e.filter(n=>n.type!=="shape"||Kf(n,t))}function Ua(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:za(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:za(e.objects,t),focal:n,baseHeightM:0,index:0}]}var qf={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function rt(e){return Ha(e)??qf}function ja(e,t){let n=je(e.outline,Ge),o=rt(n),r=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(o,rt(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=yr.default.difference([i(n)],...r.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function Xa(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=yr.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(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}var pt=.06,$f=.05,Ya=.05,Wa=.15,gr=25;function Ka(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,u=[],l=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"&&l.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=je(f.outline,Ge);c.set(f.id,{section:f,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:f.id,floorIndex:h,box:rt(p),section:f,unit:d,outline:p})}}let m=new Map;for(let h of u){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])??[]:u,p=d.sectionId?f.find(y=>y.id===d.sectionId)??f.find(y=>y.section.logicalSectionId===d.sectionId&&Te({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||!Te({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,v=Math.hypot(d.x-M.x,d.y-M.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(h);let R=d.rowId||`__seat-${h}`,P=g.rows.get(R);P?P.push({x:d.x,y:d.y}):g.rows.set(R,[{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,v=d.hasSeats?Yn(h,t,d.seatIndices,d.unit.focal):{sectionId:h,rows:[],blockCount:0},P=v.rows.length<2?Ea([...d.rows.values()].map(_=>({points:_})),d.unit.focal):null,x=1/0;if(P){if(d.hasSeats)for(let _ of d.rows.values())for(let k of _){let H=P.depthAt(k.x,k.y);H<x&&(x=H)}if(!d.hasSeats||!Number.isFinite(x)){x=1/0;for(let _ of d.section.outline){let k=P.depthAt(_.x,_.y);k<x&&(x=k)}}}let S=p+$f,w=Math.max(S,f.height),I=_=>{let k=Math.max(0,_-x)*me,H=Math.min(k*b,gr);return Math.max(S,f.height+H)},L=_=>{let k=Math.max(0,_)*me,H=Math.min(k*b,gr);return Math.max(S,f.height+H)},O=M?[]:v.rows.map(_=>({pts:_.pts,y:L(_.blockDepth),depth:_.blockDepth,blockId:_.blockId,...l.has(_.id)?{patch:Fa(_.pts,Ge)}:{}})),D=O.length?O[0].y:w,A=O.map(_=>{let k=_.patch&&_.patch.length>=3?_.patch:_.pts,H=0,B=0;for(let j of k)H+=j.x,B+=j.y;let F=k.length||1;H/=F,B/=F;let G=0;for(let j of k){let N=Math.hypot(j.x-H,j.y-B);N>G&&(G=N)}return{cx:H,cy:B,rad:G}}),E=M?()=>w:O.length>=2?(_,k)=>{let H=1/0,B=D;for(let F=0;F<O.length;F++){let G=A[F];if(Math.hypot(_-G.cx,k-G.cy)-G.rad>=H)continue;let j=O[F].patch,N=j&&j.length>=3?De(j,_,k)?0:Gt(j,_,k):Gt(O[F].pts,_,k);N<H&&(H=N,B=O[F].y)}return B}:(_,k)=>P?I(P.depthAt(_,k)):w,T=[0,1,0],V=O.length>=2||M?()=>T:(_,k)=>{if(!P)return T;let H=P.depthAt(_,k);if(H<=x)return T;let B=(H-x)*me;if(B*b>=gr||f.height+B*b<=S)return T;let[F,G]=P.gradientAt(_,k);if(F===0&&G===0)return T;let j=1/Math.hypot(b,1);return[-F*b*j,j,-G*b*j]};if(!M)for(let _ of v.rows){let k=L(_.blockDepth);for(let H of _.seatIndices)a[H]=k}for(let _ of v.rows){let k=[];for(let j=1;j<_.pts.length;j++){let N=Math.hypot(_.pts[j].x-_.pts[j-1].x,_.pts[j].y-_.pts[j-1].y);N>1e-6&&k.push(N)}k.sort((j,N)=>j-N);let H=k.length?k[Math.floor(k.length/2)]:1/0,B=1/0,F=_.pts[Math.floor(_.pts.length/2)];if(F)for(let j of v.rows){if(j===_||j.blockId!==_.blockId)continue;let N=Gt(j.pts,F.x,F.y);N>1e-6&&N<B&&(B=N)}let G=Math.min(H,Math.max(B,H*.5));if(Number.isFinite(G)&&G>0)for(let j of _.seatIndices)s[j]=G}o.set(h,{sectionId:h,deckAt:E,normalAt:V,flat:M,bottomY:p,rowLevels:O,landingY:D})}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))+Wa;continue}let p=f.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-Ye):0;i[h]=f.kind==="booth"?b+pt+Wa:b}return{bySection:o,seatOwner:r,seatDeckY:h=>i[h],seatPitchU:h=>s[h]}}var oe={top:1,wallBottom:.58,bottomCap:.4};function bt(e,t){if(!e)return t;let n=ae(We(e,.4),.62);return he(t,n,.22)}function qa(e,t){return e?he(t,ae(We(e,.08),.9),.82):t}function $a(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,u=0,l=0;for(let[m,h]of a){let d=de(n.get(m));d&&(s+=d[0]*h,c+=d[1]*h,u+=d[2]*h,l+=h)}l>0&&r.set(i,[s/l,c/l,u/l])}return r}function Za(e,t){return de(e.color)??t.get(e.logicalSectionId??e.id)??null}var Qa=mt(require("polygon-clipping"),1);function Zf(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var eo=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=rt(t),i=this.rings.filter((c,u)=>jt(r,this.boxes[u])&&Zf(n,this.levels[u])),a=[[o]];if(i.length)try{a=Qa.default.difference([o],...i).map(u=>u.map(l=>l.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 u=c[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function to(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,u=Math.cos(c),l=Math.sin(c);return e.map(m=>{let h=m.x-a,d=m.y-s;return{x:a+h*u-d*l,y:s+h*l+d*u}})}function be(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=pn(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=Xn(n,o,e.width/2,e.height/2)}return t?to(t,e.rotation):null}function Xe(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"&&gn(e.stageKind)?{kind:"stage",heightM:e.stageKind==="ring-boxing"?Kn:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var Qf=.08,Jf=30,ed=.015;function td(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 Ja(e,t){let n=be(e)??(e.points?.length?to(e.points,e.rotation):null),o=Xe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Fe(n))*me**2>=Jf?ed: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,u=-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),u=Math.max(u,d.y);let l=i,m=0,h=1e-6*Math.max(1,c-a,u-s);for(let d of t)c>d.minX&&a<d.maxX&&u>d.minY&&s<d.maxY&&l<=d.topOffsetM+1e-6&&(l=d.topOffsetM+Qf),a>=d.minX-h&&c<=d.maxX+h&&s>=d.minY-h&&u<=d.maxY+h&&(!d.poly||n.every(b=>td(b,d.poly)||nd(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:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(m,l)}}function nd(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,u=s*s+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*s),e.y-(i.y+l*c))<=n)return!0}return!1}function yt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Oe(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 Ae(e,t,n){return[yt(e[0],e[1],t),yt(e[0],e[1],n),yt(e[3],e[2],n),yt(e[3],e[2],t)]}function Mn(e,t,n){return[yt(e[0],e[3],t),yt(e[1],e[2],t),yt(e[1],e[2],n),yt(e[0],e[3],n)]}function fe(e,t,n,o,r,i){se(e,t,void 0,()=>n,o,r,i,oe)}function Xt(e,t,n){if(e.length!==4||n<=t)return null;let o=Oe(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*C,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*C;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:Ae(o,a,1-a),openingTop:n-s}}function xr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=Oe(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*C;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),a=i/r,s=Ae(o,a,1-a);return{quad:o,side:a,trim:i,inner:s,panel:Mn(s,.15,.85),bottom:t+i,top:n-i}}function es(e,t,n,o){let r=xr(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]),u=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,m]=u?[i[0],i[1]]:[i[3],i[2]],h=u?{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-l.y)*h.x+(m.x-l.x)*h.y<0&&([l,m]=[m,l]);let f=Math.min(.006,d*C*.05),p=h.x/d*f,b=h.y/d*f,y=(g,M)=>[g.x*C+p,M,g.y*C+b];return[y(l,r.bottom),y(m,r.bottom),y(l,r.top),y(m,r.top)]}var ts=mt(require("polygon-clipping"),1);function it(e,t,n,o,r,i,a,s={}){let c=rt(t),u=s.ao??oe,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=be(p);if(!b||b.length!==4||!jt(c,rt(b)))return[];let y=s.portalBase??n,g=Xt(b,y,y+Xe(p).heightM);if(!g)return[];let M=Math.min(o,g.openingTop);return M<=n?[]:[{poly:g.opening,height:M}]});if(!l.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),h=[m(t),...(s.holes??[]).map(m)],d=[n,...new Set(l.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=l.filter(v=>v.height>b+1e-6).map(v=>[m(v.poly)]),M=g.length?ts.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(v=>v.map(([R,P])=>({x:R,y:P}))),M=v=>u.wallBottom+(u.top-u.wallBottom)*(v-n)/(o-n);se(e,y,g,()=>p.high,p.low,i,a,{...u,top:M(p.high),wallBottom:M(p.low)})}return!0}function ns(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]],u=l=>oe.wallBottom+(oe.top-oe.wallBottom)*(l-n)/s;for(let[l,m,h]of c){let d={...oe,top:u(m),wallBottom:u(l)},f=ae(i,h),p=ae(a,h);it(e,t,l,m,r,f,p,{portalBase:n,ao:d})||se(e,t,void 0,()=>m,l,f,p,d)}}function Sn(e,t,n){let o=de(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?to(t.points??[],t.rotation):be(t);if(!a||a.length<2)return;let s=i?a.length-1:a.length,c=r*.5;for(let u=0;u<s;u++){let l=a[u],m=a[(u+1)%a.length],h=Math.hypot(m.x-l.x,m.y-l.y);if(h<1e-6)continue;let d=-(m.y-l.y)/h*c,f=(m.x-l.x)/h*c,p=[(l.x+d)*C,n,(l.y+f)*C],b=[(m.x+d)*C,n,(m.y+f)*C],y=[(m.x-d)*C,n,(m.y-f)*C],g=[(l.x-d)*C,n,(l.y-f)*C];e.tri(p,b,y,[0,1,0],o),e.tri(p,y,g,[0,1,0],o)}}function os(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var Wt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function no(e,t,n,o){let[r,i,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[Wt(r,s,n),Wt(i,a,n),Wt(i,a,o),Wt(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 u=S=>c?Math.min(S,r):S,l=Oe(n),m=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*C;if(m<.4)return!1;let h=Wt(l[0],l[1],.5),d=Wt(l[3],l[2],.5),f=Math.hypot(h.x-s.x,h.y-s.y)<=Math.hypot(d.x-s.x,d.y-s.y),p=he(a,[.92,.9,.86],.35),b=ae(i,.72),y=r-o;if(t==="restroom"){let S=Math.min(.18,y*.08);return fe(e,l,r-S,o,a,i),fe(e,l,r,r-S,p,p),!0}let g=o+Math.min(1.1,y),M=t==="coat"?1:Math.min(.5,.75/m),v=no(l,f,0,M);if(fe(e,v,g-.05,o,b,i),fe(e,v,g,g-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let S=no(l,f,Math.max(M+.2,1-.45/m),1),w=u(o+Math.max(Math.min(2.2,y*2),g-o+.6));return fe(e,S,w,o,a,b),!0}let R=no(l,f,Math.max(M+.25,.55),1),P=u(o+Math.max(2.6,g-o+1.4));if(P-.14<=g)return!0;fe(e,R,P-.14,o,a,i),fe(e,l,P,P-.14,p,b);let x=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*C));for(let[S,w]of[[0,x],[1-x,1]])fe(e,no(Ae(l,S,w),f,0,Math.min(.08,.1/m)),P-.14,g,b,b);return!0}var od=[.12,.38,.16],rd=[.72,.62,.45],id=[.88,.93,.96],is=[.95,.95,.94],ad=[.66,.29,.22],vr={length:20.12,width:3.05},sd=.14,cd=9.76,at=[.93,.94,.95],oo=[.1,.11,.13],ld=[.45,.85,1.25],ud=1.45,as=.012,ss=.004,md=1.07,fd=.15;function Kt(e,t,n,o,r,i){e.setMaterial(i),se(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,oe)}var cs=(e,t)=>Et(e,t/C);function ls(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 dd(e,t,n,o){let r=t.map(i=>[i.x*C,n,i.y*C]);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 ro(e,t,n,o,r,i){let a=n/C,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}];se(e,s,void 0,()=>r,o,i,ae(i,.85),oe)}function Yt(e,t,n,o,r,i,a){let s=ls(t,n,o/C);s&&se(e,s,void 0,()=>i,r,a,ae(a,.85),oe)}function io(e){let t=Oe(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,u)=>({x:n.x+(i.x*c+a.x*u)/C,y:n.y+(i.y*c+a.y*u)/C}),lengthM:o*C,widthM:r*C}}function us(e,t,n){let o=fa(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,u=Math.cos(c),l=Math.sin(c),m=(r+i)/2,h=(a+s)/2,d=M=>c?{x:m+(M.x-m)*u-(M.y-h)*l,y:h+(M.x-m)*l+(M.y-h)*u}:M,f=Math.min(i-r,s-a)*C,p=Math.max(.04,Math.min(.3,f*.004))/C,b=0;e.setMaterial(0);for(let M of o){if(!M.fill)continue;let v=M.points.map(d);Kt(e,v,null,n+as+b*ss,de(M.fill)??at,0),b++}let y=o.filter(M=>!(M.fill&&M.ink===M.fill)),g=[...new Set(y.map(M=>M.ink??qn))];for(let M of g){let v=n+as+b++*ss,R=de(M)??at;for(let P of y){if((P.ink??qn)!==M)continue;let x=P.points.map(d),S=P.closed?x.length:x.length-1;for(let w=0;w<S;w++){let I=ls(x[w],x[(w+1)%x.length],p);I&&dd(e,I,v,R)}}}}function ms(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,a=r??od;if(n==="oval-cricket"){let s=t.reduce((R,P)=>R+P.x,0)/t.length,c=t.reduce((R,P)=>R+P.y,0)/t.length,u=R=>t.map(P=>({x:s+(P.x-s)*R,y:c+(P.y-c)*R})),l=8;for(let R=0;R<l;R++){let P=u(1-R/l),x=R===l-1?null:u(1-(R+1)/l);Kt(e,P,x,i,ae(a,R%2?1.04:.96),4)}let m=t[0];for(let R of t)Math.hypot(R.x-s,R.y-c)>Math.hypot(m.x-s,m.y-c)&&(m=R);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*C*sd/vr.length),g=vr.length*y/2/C,M=vr.width*y/2/C,v=[[-g,-M],[g,-M],[g,M],[-g,M]].map(([R,P])=>({x:s+d*R+p*P,y:c+f*R+b*P}));return Kt(e,v,null,i+.004,rd,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let s=cs(t,fd);return Kt(e,s,null,i,id,0),e.setMaterial(0),se(e,t,[s.slice().reverse()],()=>o+md,o,is,ae(is,.9),oe),!0}if(n==="ring-boxing"&&t.length===4){let{at:s}=io(t),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],u=[[.77,.19,.19],at,[.17,.42,.69],at];e.setMaterial(0),c.forEach((l,m)=>ro(e,l,.07,o,o+ud,u[m]));for(let l of ld)for(let m=0;m<4;m++)Yt(e,c[m],c[(m+1)%4],.025,o+l-.025,o+l+.025,at);return!0}if(n==="court-tennis"&&t.length===4){let{at:s}=io(t);e.setMaterial(0),Yt(e,s(0,-6.4),s(0,6.4),.015,o,o+.95,oo),Yt(e,s(0,-6.4),s(0,6.4),.03,o+.95,o+1,at);for(let c of[-1,1])ro(e,s(0,c*6.4),.05,o,o+1.07,oo);return!0}if(n==="court-basketball"&&t.length===4){let{at:s,lengthM:c}=io(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let m=s(l*(u+1.2),0),h=s(l*(u-1.2),0);ro(e,m,.12,o,o+3.4,oo),Yt(e,m,h,.06,o+3.25,o+3.4,oo),Yt(e,s(l*(u-1.2),-.9),s(l*(u-1.2),.9),.03,o+2.9,o+3.95,at)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:s,lengthM:c}=io(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let m of[-2.8,2.8])ro(e,s(l*u,m),.07,o,o+12,at);Yt(e,s(l*u,-2.8),s(l*u,2.8),.06,o+2.94,o+3.06,at)}return!0}if(n==="track-athletics"){let s=cs(t,cd);return s.length<3?!1:(Kt(e,t,s,i,ad,0),Kt(e,s,null,i,a,4),e.setMaterial(0),!0)}return!1}var hd=.012,co=2.4,pd=1,bd=.75,yd=.15;function qe(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,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,m])=>({x:t.x+l*a-m*s,y:t.y+l*s+m*a}))}function ys(e,t,n,o,r,i,a=!1){let s=qe(t);if(s){if(a){let c=bt(o,r.boothTop),u=Ke([...s]);se(e,je(u,gd/C),[u.slice().reverse()],()=>n+.03,n,c,ae(c,.8),oe);return}if(!(!t.points&&i&&vd(e,s,n,o,i))){if(!t.points&&i&&s.length===4){xd(e,s,n,o,i);return}se(e,s,void 0,()=>n+co,n,bt(o,r.boothTop),r.boothWall,oe)}}}var Mr=1.1,fs=[.9,.9,.88],gd=.1,ao=[.87,.87,.85],ds=.08;function gs(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 u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,m)=>{let h=a(i[0],i[1],c),d=a(i[0],i[1],u),f=a(i[3],i[2],c),p=a(i[3],i[2],u);return[a(h,f,l),a(d,p,l),a(d,p,m),a(h,f,m)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*C,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*C}}function xd(e,t,n,o,r){let{q:i,part:a}=gs(t,r),s=o??[.35,.42,.55],c=he(s,[.78,.78,.77],.62),u=he(s,[.95,.95,.94],.45);fe(e,i,n+pt,n,c,ae(c,.8)),fe(e,a(.05,.95,.72,.98),n+Mr-.05,n+pt,u,ae(u,.8)),fe(e,a(.03,.97,.7,1),n+Mr,n+Mr-.05,fs,ae(fs,.9))}function vd(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:a,depthM:s,widthM:c}=gs(t,r);if(s<1||c<1)return!1;let u=o??[.35,.42,.55],l=he(u,[.78,.78,.77],.62),m=n+co,h=ds/c,d=ds/s;fe(e,i,n+pt,n,l,ae(l,.8)),fe(e,a(0,1,1-d,1),m,n+pt,ao,ae(ao,.9));for(let[b,y]of[[0,h],[1-h,1]])fe(e,a(b,y,0,1-d),m,n+pt,ao,ae(ao,.9));fe(e,a(h,1-h,0,Math.min(.5,.06/s)),m,m-.3,u,ae(u,.85));let f=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return fe(e,a(.5-f,.5+f,.72-p,.72+p),n+pd,n+pt,he(u,[.95,.95,.94],.7),ae(u,.75)),!0}function lo(e){if(e.shape==="round"){let l=e.radius;return l?Xn(e.center.x,e.center.y,l,l,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,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,m])=>({x:r.x+l*a-m*s,y:r.y+l*s+m*a}))}function xs(e,t,n,o,r,i=!0){let a=lo(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,u=h=>a.map(d=>({x:s+(d.x-s)*h,y:c+(d.y-c)*h})),l=i&&o?bt(o,r.tableTop):Md,m=n+bd;se(e,a,void 0,()=>m,n+Sd,l,ae(l,.86),oe),se(e,u(.12),void 0,()=>m+.12,m,hs,ae(hs,.8),oe)}var Md=[.93,.92,.89],hs=[.78,.66,.42],Sd=.25;function vs(e,t,n,o,r,i,a,s,c=[]){let u=be(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){Sn(e,t,n+o+hd);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}:Xe(t),f=s?.baseY??n,p=s?.topY??n+o;if(m&&a){let S=1/0,w=-1/0,I=1/0,L=-1/0;for(let O of u)O.x<S&&(S=O.x),O.x>w&&(w=O.x),O.y<I&&(I=O.y),O.y>L&&(L=O.y);a.push({cx:(S+w)/2*C,cz:(I+L)/2*C,y:p,halfX:Math.max((w-S)/2*C,.5),halfZ:Math.max((L-I)/2*C,.5)})}let b=de(t.fill),y=t.role==="wall"||t.role==="entrance"||t.role==="exit",g=y?b?ae(We(b,.12),.95):r.tierTop:m&&b?he(r.stageTop,ae(We(b,.18),.9),.9):!t.role&&b?b:bt(b,m?r.stageTop:r.decorTop),M=h?b:null,v=y?b?ae(We(b,.12),.85):r.tierWall:m?b?he(r.stageWall,ae(b,.58),.82):r.stageWall:h?M?he(ae(M,1.42),[.24,.46,.82],.08):[.24,.46,.82]:bt(de(t.fill),r.decorWall);if(t.role==="wall"&&!s){ns(e,u,f,p,c,g,v),Sn(e,t,p+.012);return}if(h&&u.length===4&&p-f>.2){let S=xr(u,f,p);if(!S)return;let{quad:w,side:I,trim:L,inner:O,panel:D}=S,A=[.12,.15,.18];for(let[E,T]of[[0,I],[1-I,1]])fe(e,Ae(w,E,T),p,f,A,A);fe(e,O,f+L,f,A,A),fe(e,O,p,p-L,A,A),fe(e,D,p-L,f+L,v,v),Sn(e,t,p+.012);return}let R=b?ae(We(b,.15),.82):v,P=b?ae(We(b,.1),1.02):g;if(os(t.role)&&!s&&rs(e,t.role,u,f,p,R,P,i,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&u.length===4&&p-f>.3){let S=Oe(u),w=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*C,I=Math.min(.12,.09/Math.max(w,.001)),L=[.18,.21,.24],O=p-Math.min(.12,(p-f)*.15);for(let[D,A]of[[0,I],[1-I,1]])fe(e,Ae(S,D,A),O,f,L,L);fe(e,S,p,O,g,L);return}if(t.role==="rail"&&u.length===4&&p>f){let S=Oe(u),w=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*C,I=Math.max(1,Math.min(128,Math.ceil(w/1.4))),L=Math.min(.08,.055/Math.max(.055,w)),O=[.58,.64,.66];for(let D=0;D<=I;D++){let A=D/I,E=Math.min(1-L,Math.max(0,A-L/2));fe(e,Ae(S,E,E+L),p,f,O,ae(O,.8))}for(let D of[.52,1]){let A=f+(p-f)*D;fe(e,S,A,Math.max(f,A-.055),O,ae(O,.8))}return}if(t.role==="goal"&&u.length===4){let S=Oe(u),w=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*C,I=Math.min(.12,.1/Math.max(.1,w)),L=[.9,.94,.94];for(let[O,D]of[[0,I],[1-I,1]])fe(e,Ae(S,O,D),Math.max(f,p-.1),f,L,L);fe(e,S,p,Math.max(f,p-.1),L,L);return}if(d.kind==="portal"&&u.length===4){let S=Xt(u,f,p);if(!S)return;let{quad:w,side:I,face:L,openingTop:O}=S;for(let[D,A,E]of[[0,L,1],[L,1-L,.67],[1-L,1,1]]){let T=Mn(w,D,A),V=ae(g,E),_=ae(v,E);for(let[k,H]of[[0,I],[1-I,1]])fe(e,Ae(T,k,H),O,f,V,_);fe(e,T,p,O,V,_)}return}if(d.kind==="suite"&&u.length===4){let S=u.map((L,O)=>{let D=u[(O+1)%4],A=(L.x+D.x)/2,E=(L.y+D.y)/2;return Math.hypot(A-i.x,E-i.y)}),w=S.indexOf(Math.min(...S)),I=[0,1,2,3].map(L=>u[(w+L)%4]);fe(e,Ae(I,0,.08),p,f,g,v),fe(e,Ae(I,.92,1),p,f,g,v),fe(e,Mn(I,.88,1),p,f,g,v),fe(e,I,p,Math.max(f,p-.18),g,v);return}if(m&&!t.stageKind?.startsWith("pitch-")&&p-f>.12){let S=p-Math.min(.06,(p-f)*.15);fe(e,u,S,f,g,v),fe(e,u,p,S,g,he(g,v,.2))}else fe(e,u,p,f,g,v);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let S=Oe(u);for(let w=0;w<12;w++){let I=Ae(S,w/12,(w+1)/12),L=ae(b??[.12,.38,.16],w%2?1.035:.965),O=I.map(D=>[D.x*C,p+.006,D.y*C]);e.tri(O[0],O[1],O[2],[0,1,0],L),e.tri(O[0],O[2],O[3],[0,1,0],L)}}t.stageKind&&t.stageKind!=="pitch-football"&&ms(e,u,t.stageKind,p,b),m&&Tt(t.stageKind)&&us(e,t,p),e.setMaterial(h?1:0),Sn(e,t,p+.012)}function uo(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),u=Math.sin(s),l=o/2,m=r/2;return[[-l,-m],[l,-m],[l,m],[-l,m]].map(([h,d])=>({x:i+h*c-d*u,y:a+h*u+d*c}))}function wd(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 de(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=de(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>he(s,c,1/(u+1)),a[0]):null}function Ms(e,t,n,o){if(t.layer==="foreground")return;let r=uo(t);if(!r)return;let i=n+yd,a=bt(wd(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(o.ground,a,s)),se(e,r,void 0,()=>i,n,a,he(a,o.decorWall,.5),oe)}function Ss(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=bt(o,r.gaTop);se(e,t.points,t.holes,()=>n+ps,n,i,r.gaWall,oe),Rd(e,t.points,n+ps)}var ps=.15,so=[.72,.74,.76],Sr=1.1,bs=.12,wr=.05,Pd=.06,Id=2.4;function Rd(e,t,n){let o=Ke([...t]),r=Et(o,bs/C),i=Et(o,(bs+wr)/C);if(r.length<3||i.length<3)return;for(let s of[n+Sr,n+Sr*.5])se(e,r,[i.slice().reverse()],()=>s,s-wr,so,ae(so,.85),oe);let a=Pd/2/C;for(let s=0;s<r.length;s++){let c=r[s],u=r[(s+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*C,m=Math.max(1,Math.round(l/Id));for(let h=0;h<m;h++){let d=h/m,f=c.x+(u.x-c.x)*d,p=c.y+(u.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}];se(e,b,void 0,()=>n+Sr-wr,n,so,ae(so,.8),oe)}}}var Pr=.6,ws=3,Ad=.25;function Cd(e,t){if(De(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,u=s*s+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*s),e.y-(i.y+l*c)))}return n}function Ps(e,t){let n=e.map(a=>({booth:a,ring:qe(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+Pr)/C,i=new Map;return n.forEach(({booth:a,ring:s},c)=>{let u={x:s.reduce((d,f)=>d+f.x,0)/4,y:s.reduce((d,f)=>d+f.y,0)/4},l=[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-u.x,g=b.y-u.y,M=Math.hypot(y,g)||1,v={x:b.x+y/M*Pr/C,y:b.y+g/M*Pr/C},R=ws/C;return o.forEach((P,x)=>{x===c||v.x<P.minX-r||v.x>P.maxX+r||v.y<P.minY-r||v.y>P.maxY+r||(R=Math.min(R,Cd(v,n[x].ring)))}),{open:R*C,toward:{x:b.x+y/M*10/C,y:b.y+g/M*10/C},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),m=Math.max(...l.map(d=>d.open)),h=l.filter(d=>d.open>=m-Ad).sort((d,f)=>d.focal-f.focal)[0];i.set(a.id,h.toward)}),i}var Is=mt(require("polygon-clipping"),1);var Ed=.45,_d=1500,Td=200;function Rs(e,t){if(e.role!=="stage"||Tt(e.stageKind))return e;let n=be(e);if(!n||n.length<3||Math.abs(Fe(n))*C*C>_d)return e;let o=t.filter(a=>De(n,a.x,a.y));if(!o.length||o.length>Td)return e;let r=Ed/C,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=Is.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),s=null,c=0;for(let u of a){let l=u[0].slice(0,-1).map(([h,d])=>({x:h,y:d})),m=Math.abs(Fe(l));m>c&&(c=m,s=l)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var kd=Math.PI/180,pe=96,Ld=6,Fd=60,Dd=150,As=.2,Od=.35;function Bd(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/kd;return n<0?n+360:n}function mo(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function fo(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 u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;a+=e[u],s++}r[i]=a/s}return r}function Cs(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=cr(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=mo(o.map(y=>y.x)),d=mo(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 v=Math.hypot(M.x-s.x,M.y-s.y);v>f&&(f=v)}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 u=[];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(pe-1,Math.floor(Bd(c,p)/(360/pe)));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&&u.push(d)}if(!u.length)return null;u.sort((h,d)=>h.rMin+h.rMax-(d.rMin+d.rMax));let l=[];for(let h of u){let d=!1;for(let f of l){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>=Od*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||l.push({members:[h],rMin:h.rMin,rMax:h.rMax})}let m=[];for(let h of l){let d=new Array(pe).fill(null);for(let D of h.members)for(let A of D.samples){let E=d[A.bin];E||(E={samples:[]},d[A.bin]=E),E.samples.push({r:A.r,levelM:A.levelM})}let f=d.map(D=>!!D);if(!f.filter(Boolean).length)continue;let b=[],y=[];for(let D of d){if(!D)continue;let A=1/0,E=-1/0;for(let T of D.samples)T.r<A&&(A=T.r),T.r>E&&(E=T.r);b.push(A),y.push(E)}let g=mo(b),M=mo(y);if(!(g>=As*M)||!(M>0))continue;let v=[...b].sort((D,A)=>D-A);if(!(v[Math.floor(v.length*.1)]>=As*M))continue;let P=d.map(D=>{if(!D)return null;let A=[...D.samples].sort((F,G)=>F.r-G.r),E=A[0].r,T=A[A.length-1].r,V=A[0].levelM,_=-1/0;for(let F of A)F.levelM>_&&(_=F.levelM);let k=[];for(let F of A){let G={r:F.r,l:F.levelM};for(;k.length&&Math.abs(k[k.length-1].r-G.r)<1e-9;){if(k[k.length-1].l<=G.l){G.skip=!0;break}k.pop()}if(!G.skip){for(;k.length>=2;){let j=k[k.length-2],N=k[k.length-1];if((N.r-j.r)*(G.l-j.l)-(N.l-j.l)*(G.r-j.r)<=0)k.pop();else break}k.push(G)}}let H=k.map(F=>F.r),B=k.map(F=>F.l);return{inner:E,outer:T,front:V,top:_,profile:{rs:H,ls:B}}}),x=f.slice();for(let D=0;D<pe;D++){if(x[D])continue;let A=-1,E=-1,T=0;for(let z=1;z<=pe;z++){let K=(D-z+pe*2)%pe;if(x[K]){A=K;break}}for(let z=1;z<=pe;z++){let K=(D+z)%pe;if(x[K]){E=K,T=z;break}}if(A<0||E<0)continue;let V=0;for(let z=1;z<=pe;z++){let K=(D-z+pe*2)%pe;if(f[K]){V=z;break}}if(V-1+T>Ld)continue;let k=P[A],H=P[E],B=V/(V+T),F=k.inner+(H.inner-k.inner)*B,G=k.outer+(H.outer-k.outer)*B,j=k.front+(H.front-k.front)*B,N=k.top+(H.top-k.top)*B;P[D]={inner:F,outer:G,front:j,top:N,profile:{rs:[F,G],ls:[j,N]}}}for(let D=0;D<pe;D++)P[D]&&(x[D]=!0);let S=360/pe,w=[],I=x.filter(Boolean).length,L=[];if(I===pe)L.push({start:0,len:pe});else{let D=0;for(;x[D];)D=(D+1)%pe;let A=-1;for(let E=0;E<=pe;E++){let T=(D+E)%pe,V=E<pe&&x[T];if(V&&A<0)A=T;else if(!V&&A>=0){let _=(T-A+pe)%pe||pe;L.push({start:A,len:_}),A=-1}}}for(let D of L){if(D.len*S<Fd&&D.len<pe)continue;let A=D.len===pe,E=new Float64Array(D.len),T=new Float64Array(D.len),V=new Float64Array(D.len),_=new Float64Array(D.len),k=[];for(let z=0;z<D.len;z++){let K=P[(D.start+z)%pe];E[z]=K.inner,T[z]=K.outer,V[z]=K.front,_[z]=K.top,k.push(K.profile??{rs:[K.inner,K.outer],ls:[K.front,K.top]})}let H=fo(E,A),B=fo(T,A),F=fo(V,A),G=fo(_,A);for(let z=0;z<D.len;z++)H[z]>E[z]&&(H[z]=E[z]),B[z]<T[z]&&(B[z]=T[z]),H[z]>B[z]-1e-6&&(H[z]=Math.max(0,B[z]-1e-6)),G[z]<F[z]&&(G[z]=F[z]);let j={startBin:D.start,binCount:D.len,closed:A,innerR:H,outerR:B,frontLevelM:F,topLevelM:G,profiles:k},N=(z,K,J)=>{let Y=k[z],W=Y.rs,Q=Y.ls;if(K<=W[0]){Q[0]>J&&(Q[0]=J);return}if(K>=W[W.length-1]){Q[Q.length-1]>J&&(Q[Q.length-1]=J);return}for(let te=0;te+1<W.length;te++)if(K<=W[te+1]){Q[te]>J&&(Q[te]=J),Q[te+1]>J&&(Q[te+1]=J);return}};for(let z=0;z<D.len;z++){let K=d[(D.start+z)%pe];if(K)for(let J of K.samples){N(z,J.r,J.levelM);let Y=A?(z-1+D.len)%D.len:z-1,W=A?(z+1)%D.len:z+1;Y>=0&&N(Y,J.r,J.levelM),W<D.len&&N(W,J.r,J.levelM)}}w.push(j)}w.reduce((D,A)=>D+A.binCount*S,0)<Dd||m.push({arcs:w,sectionIds:h.members.map(D=>D.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:pe,binStepDeg:360/pe,rings:m}}function Es(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,u=l=>{let m=t.profiles[l],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 u(a)*(1-c)+u(s)*c}function Ir(e,t,n,o,r,i,a,s,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let m=(p,b,y)=>{it(e,p,b,y,u,a,s,{portalBase:l,ao:c})||se(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)*me;if(y<1e-5)continue;let g=(P,x)=>[h(t[p],t[b],P),h(t[p],t[b],x),h(n[p],n[b],x),h(n[p],n[b],P)];m(g(0,1),r,r+.95),m(g(0,1),i-.22,i);let M=Math.ceil((f-.32)/6)*6,v=!1,R=!1;for(let P=M;P<f+y;P+=6){let x=Math.max(0,(P-f)/y),S=Math.min(1,(P+.32-f)/y);S<=x||(m(g(x,S),r+.95,i-.22),v||=x<1e-6,R||=S>1-1e-6)}if(!o&&(p===0&&!v||p===d-1&&!R)){let P=Math.min(1,.32/y);m(g(p===0?0:1-P,p===0?P:1),r+.95,i-.22)}f+=y}}var wn=.65;function _s(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,u=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-u*s,e.y-i.y-u*c))}return n}var Ts=.01;function ks(e,t,n,o,r,i,a,s=[],c=!0){if(o-r<=1e-5)return;let u=o-r>=3,l=u?o-wn:r;e.setMaterial(5);let m=u?[]:s.filter(v=>{if(v.role!=="entrance"&&v.role!=="exit")return!1;let R=be(v);if(!R)return!1;let P=Xt(R,r,r+Xe(v).heightM);return P!==null&&P.openingTop<=o-.12});if((!m.length||!it(e,t,l,o,m,i,a,{holes:n,portalBase:r}))&&se(e,t,n,()=>o,l,i,a,oe,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let h=6/C,d=.22/C,f=s.flatMap(v=>{if(v.role!=="entrance"&&v.role!=="exit")return[];let R=be(v);return R?.length?[{minX:Math.min(...R.map(P=>P.x)),maxX:Math.max(...R.map(P=>P.x)),minY:Math.min(...R.map(P=>P.y)),maxY:Math.max(...R.map(P=>P.y))}]:[]}),p=Math.min(...t.map(v=>v.x)),b=Math.max(...t.map(v=>v.x)),y=Math.min(...t.map(v=>v.y)),g=Math.max(...t.map(v=>v.y));for(let v=p+h/2;v<b;v+=h)for(let R=y+h/2;R<g;R+=h){if(f.some(x=>v+d>=x.minX&&v-d<=x.maxX&&R+d>=x.minY&&R-d<=x.maxY))continue;let P=[{x:v-d,y:R-d},{x:v+d,y:R-d},{x:v+d,y:R+d},{x:v-d,y:R+d}];!Te({x:v,y:R},t,n)||_s({x:v,y:R},[t,...n??[]])<d*Math.SQRT2+(c?Rr/C:0)||se(e,P,void 0,()=>l,r,i,a,oe)}let M=Et(t,Rr/C);if(c&&M.length>=3){let v=s.filter(x=>{if(x.role!=="entrance"&&x.role!=="exit")return!1;let S=be(x);return!!S&&S.some(w=>!Te(w,t,void 0)||_s(w,[t])<=Rr/C)}),R=[M.slice().reverse()],P=r-Ts;(!v.length||!it(e,t,P,l,v,i,a,{holes:R,portalBase:r+Ts}))&&se(e,t,R,()=>l,P,i,a,oe)}e.setMaterial(0)}var Rr=.25;var Nd=.02,Vd=.25,Gd=1.2,Hd=.6,zd=.45,Ud=2.3,jd=Math.PI/180,Ls=.005;function $e(e,t,n){let o=n*jd;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Xd(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 Wd=24,Yd=.01;function Kd(e,t,n,o,r,i,a,s,c){let u=n.binCount,l=Wd,m=me,h=i+.02,d=i-Yd,f=[];for(let A=0;A<u;A++){let E=(n.startBin+A+.5)*t.binStepDeg,T=new Float64Array(l+1);for(let V=0;V<=l;V++){let _=o[A]+(r[A]-o[A])*V/l;T[V]=Math.max(h,Es(t,n,E,_)-Vd)}f.push(T)}if(c){let A=0;for(let E=0;E+1<u;E++)for(let T=0;T<l;T++){let V=$e(t.centre,o[E]+(r[E]-o[E])*T/l,(n.startBin+E+.5)*t.binStepDeg),_=$e(t.centre,o[E+1]+(r[E+1]-o[E+1])*(T+1)/l,(n.startBin+E+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(_.x-V.x,_.y-V.y))}for(let E=0;E<u;E++){let T=(n.startBin+E+.5)*t.binStepDeg;for(let V=0;V<=l;V++){let _=$e(t.centre,o[E]+(r[E]-o[E])*V/l,T),k=c(_.x,_.y,A*1.01);k!==null&&(f[E][V]=Math.min(f[E][V],Math.max(d+Ls,k-Ls)))}}}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,E)=>{let T=(n.startBin+A+.5)*t.binStepDeg,V=o[A]+(r[A]-o[A])*E/l,_=$e(t.centre,V,T);return[_.x*m,f[A][E],_.y*m]};{let A=Math.tan(12*Math.PI/180);for(let E=0;E<6;E++){let T=!1;for(let _=0;_<u;_++)for(let k=l-1;k>=0;k--)f[_][k]>f[_][k+1]&&(f[_][k]=f[_][k+1],T=!0);let V=n.closed?u:u-1;for(let _=0;_<V;_++){let k=(_+1)%u;for(let H=0;H<=l;H++){let B=f[k][H]-f[_][H];if(Math.abs(B)>1)continue;let F=o[_]+(r[_]-o[_])*H/l,G=o[k]+(r[k]-o[k])*H/l,j=$e(t.centre,F,(n.startBin+_+.5)*t.binStepDeg),N=$e(t.centre,G,(n.startBin+k+.5)*t.binStepDeg),z=A*Math.hypot(N.x-j.x,N.y-j.y)*m;B>z?(f[k][H]=f[_][H]+z,T=!0):-B>z&&(f[_][H]=f[k][H]+z,T=!0)}}if(!T)break}}let v=1,R=(A,E)=>{for(let T=0;T<=l;T+=4)if(Math.abs(f[A][T]-f[E][T])>v)return!0;return Math.abs(f[A][l]-f[E][l])>v},P=Math.tan(38*Math.PI/180),x=A=>(r[A]-o[A])/l*m,S=(A,E)=>f[A][E+1]-f[A][E]>P*Math.max(1e-6,x(A)),w=(A,E)=>{let T=n.closed?(A-1+u)%u:Math.max(0,A-1),V=n.closed?(A+1)%u:Math.min(u-1,A+1);Math.abs(f[T][E]-f[A][E])>v&&(T=A),Math.abs(f[V][E]-f[A][E])>v&&(V=A);let _=Math.max(0,E-1),k=Math.min(l,E+1);_<E&&S(A,_)&&(_=E),k>E&&S(A,E)&&(k=E);let H=M(T,E),B=M(V,E),F=M(A,_),G=M(A,k),j=B[0]-H[0],N=B[1]-H[1],z=B[2]-H[2],K=G[0]-F[0],J=G[1]-F[1],Y=G[2]-F[2],W=N*Y-z*J,Q=z*K-j*Y,te=j*J-N*K,$=Math.hypot(W,Q,te);return $>1e-12?(W/=$,Q/=$,te/=$,Q<0&&(W=-W,Q=-Q,te=-te),[W,Q,te]):[0,1,0]},I=(A,E,T=!1)=>{let V=T&&Math.min(A[1],E[1])-i>=3,_=[A[0],V?A[1]-wn:d,A[2]],k=[E[0],V?E[1]-wn:d,E[2]],H=E[0]-A[0],B=E[2]-A[2],F=Math.hypot(H,B);if(!(F>1e-12))return;let G=[B/F,0,-H/F];e.tri(A,E,k,G,y,y,g),e.tri(A,k,_,G,y,g,g)},L=.05*Ve,O=A=>r[A]-o[A]<L,D=n.closed?u:u-1;for(let A=0;A<D;A++){let E=(A+1)%u;if(O(A)||O(E))continue;if(R(A,E)){let B=(n.startBin+A+1)*t.binStepDeg,F=(J,Y)=>{let W=(o[A]+o[E])/2,Q=(r[A]+r[E])/2,te=W+(Q-W)*Y/l,$=$e(t.centre,te,B);return[$.x*m,f[J][Y],$.y*m]};for(let J=0;J<l;J++){let Y=M(A,J),W=M(A,J+1),Q=F(A,J),te=F(A,J+1),$=w(A,J),ne=w(A,J+1);e.triN(Y,Q,te,$,$,ne,p),e.triN(Y,te,W,$,ne,ne,p);let ee=M(E,J),q=M(E,J+1),le=F(E,J),re=F(E,J+1),Le=w(E,J),Ce=w(E,J+1);e.triN(le,ee,q,Le,Le,Ce,p),e.triN(le,q,re,Le,Ce,Ce,p);let we=F(A,J),ve=F(A,J+1),tt=F(E,J+1),st=F(E,J),wt=ve[0]-we[0],ct=ve[2]-we[2],Ft=Math.hypot(wt,ct);if(Ft>1e-12){let lt=[ct/Ft,0,-wt/Ft];e.tri(we,ve,tt,lt,y),e.tri(we,tt,st,lt,y)}}let G=M(A,0),j=M(E,0),N=M(E,l),z=M(A,l),K=J=>[J[0],d,J[2]];Math.min(G[1],j[1])-i<3&&(e.tri(K(G),K(N),K(j),[0,-1,0],b),e.tri(K(G),K(z),K(N),[0,-1,0],b)),I(G,j,!0),I(z,N,!0);continue}for(let B=0;B<l;B++){let F=w(A,B),G=w(E,B),j=w(E,B+1),N=w(A,B+1);if(S(A,B)||S(E,B)){let W=(ve,tt)=>{let st=(n.startBin+ve+.5)*t.binStepDeg,wt=o[ve]+(r[ve]-o[ve])*(B+.5)/l,ct=$e(t.centre,wt,st);return[ct.x*m,tt,ct.y*m]},Q=M(A,B),te=M(E,B),$=W(A,f[A][B]),ne=W(E,f[E][B]);e.triN(Q,te,ne,F,G,G,p),e.triN(Q,ne,$,F,G,F,p);let ee=M(E,B+1),q=M(A,B+1),le=W(A,f[A][B+1]),re=W(E,f[E][B+1]);e.triN(le,re,ee,N,j,j,p),e.triN(le,ee,q,N,j,N,p);let Le=ne[0]-$[0],Ce=ne[2]-$[2],we=Math.hypot(Le,Ce);if(we>1e-12){let ve=[-Ce/we,0,Le/we];e.tri($,ne,re,ve,y),e.tri($,re,le,ve,y)}continue}let z=M(A,B),K=M(E,B),J=M(E,B+1),Y=M(A,B+1);e.triN(z,K,J,F,G,j,p),e.triN(z,J,Y,F,j,N,p)}let T=M(A,0),V=M(E,0),_=M(E,l),k=M(A,l),H=B=>[B[0],d,B[2]];Math.min(T[1],V[1])-i<3&&(e.tri(H(T),H(_),H(V),[0,-1,0],b),e.tri(H(T),H(k),H(_),[0,-1,0],b)),I(T,V,!0),I(k,_,!0)}if(!n.closed)for(let A of[0,u-1])for(let E=0;E<l;E++)I(M(A,E),M(A,E+1))}function Fs(e,t,n){let{bottomY:o,colors:r,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let m of l.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]-Ge);h[p]=Math.max(y,a[b]+.001),d[p]=Math.max(h[p]+.001,m.outerR[p]+Ge)}let f=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>f&&(f=b)}f>=Gd&&Kd(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||Xd(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Hd*Ve,u=zd*Ve;for(let l of s.arcs){let m=[],h=[];for(let w=0;w<l.binCount;w++){let I=(l.startBin+w+.5)*t.binStepDeg,L=l.outerR[w]+Ge+c;m.push($e(t.centre,L,I)),h.push($e(t.centre,L+u,I))}let d=-1/0;for(let w=0;w<l.binCount;w++)l.topLevelM[w]>d&&(d=l.topLevelM[w]);let f=d+Ud,p=l.closed?h:[...h,...m.slice().reverse()],b=l.closed?[m.slice().reverse()]:void 0,y=he(r.shellWall,[.66,.71,.72],.62),g=(w,I,L,O,D)=>{let A=Math.abs(O-d)<1e-6?O-Nd:O;it(e,w,L,A,n.shapes,r.shellTop,D,{holes:I,portalBase:o,ao:i})||se(e,w,I,()=>A,L,r.shellTop,D,i)},M=Math.max(1,Math.ceil((d-o)/4.5)),v=(d-o)/M,R=new Set,P=n.tierFrontLevels??t.rings.map(w=>{let I=w.arcs.flatMap(L=>Array.from(L.frontLevelM)).filter(Number.isFinite).sort((L,O)=>L-O);return I[Math.floor(I.length/2)]});for(let w of P)Number.isFinite(w)&&w-o>=3&&w<d&&R.add(Math.max(0,Math.min(M-1,Math.floor((w-o)/v))));let x=Math.min(...P.filter(w=>Number.isFinite(w)&&w-o>=3&&w<d));for(let w=0;w<M;w++)o+(w+1)*v<=x-wn&&Number.isFinite(x)&&R.add(w);for(let w=0;w<M;w++){let I=o+(d-o)*w/M,L=o+(d-o)*(w+1)/M;R.has(w)&&L-I>=3.2?(g(p,b,I,I+.45,y),Ir(e,m,h,l.closed,I+.45,L-.16,r.shellTop,y,i,n.shapes,o)):g(p,b,I,L-.16,y),g(p,b,L-.16,L,ae(y,.62))}Ir(e,m,h,l.closed,d,f,r.shellTop,y,i,n.shapes,o);let S=8;for(let w=1;w<h.length;w++){if(S+=Math.hypot(h[w].x-h[w-1].x,h[w].y-h[w-1].y)*me,S<8)continue;S=0;let I=h[w],L=h[w-1],O=I.x-L.x,D=I.y-L.y,A=Math.max(1,Math.hypot(O,D)),E=O/A*.16*Ve,T=D/A*.16*Ve,V=Math.max(1,Math.hypot(I.x-t.centre.x,I.y-t.centre.y)),_=(I.x-t.centre.x)/V*.24*Ve,k=(I.y-t.centre.y)/V*.24*Ve,H=[{x:I.x-E,y:I.y-T},{x:I.x+E,y:I.y+T},{x:I.x+E+_,y:I.y+T+k},{x:I.x-E+_,y:I.y-T+k}];g(H,void 0,o,d,ae(y,1.12))}}}function Ds(e,t,n,o){let r=new Map;for(let s of t){let c=r.get(s.blockId);(!c||s.depth<c.depth)&&r.set(s.blockId,s)}let i=[.68,.72,.72],a=[.48,.55,.57];for(let s of r.values()){if(s.y-o<2.5||s.pts.length<2)continue;let c=s.pts.map(l=>{let m=l.x-n.x,h=l.y-n.y,d=Math.max(1,Math.hypot(m,h));return{x:l.x-m/d*.65/C,y:l.y-h/d*.65/C}}),u=2;for(let l=1;l<c.length;l++){let m=c[l-1],h=c[l],d=h.x-m.x,f=h.y-m.y,p=Math.hypot(d,f);if(p<1e-5||p*C>2)continue;let b=y=>{let g=-f/p*y/C/2,M=d/p*y/C/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}]};se(e,b(.22),void 0,()=>s.y-.06,s.y-.56,i,i,oe);for(let y of[.5,.95])se(e,b(.045),void 0,()=>s.y+y,s.y+y-.045,a,a,oe);if(u+=p*C,u>=1.8||l===c.length-1){u=0;let y=.028/C,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}];se(e,g,void 0,()=>s.y+.95-.045,s.y-.06,a,a,oe)}}}}function Os(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 u=s.pts[c],l=s.pts[c===0?1:c-1],m=u.x-l.x,h=u.y-l.y,d=Math.hypot(m,h);if(d<1e-5)continue;m/=d,h/=d;let f=1/0;for(let S=0;S<n.length;S++){let w=n[S],I=n[(S+1)%n.length],L=I.x-w.x,O=I.y-w.y,D=m*O-h*L;if(Math.abs(D)<1e-8)continue;let A=w.x-u.x,E=w.y-u.y,T=(A*O-E*L)/D,V=(A*h-E*m)/D;T>0&&V>=0&&V<=1&&(f=Math.min(f,T))}let p=.3/C,b=f-.04/C;if(!Number.isFinite(f)||f*C>2||b-p<.12/C)continue;let y=.27/C,g=[{x:u.x+m*p-h*y,y:u.y+h*p+m*y},{x:u.x+m*b-h*y,y:u.y+h*b+m*y},{x:u.x+m*b+h*y,y:u.y+h*b-m*y},{x:u.x+m*p+h*y,y:u.y+h*p-m*y}];if(!g.every(S=>De(n,S.x,S.y)))continue;let M=r?.[a]?.belowY,v=M==null?0:s.y-M,R=!!o&&v>.03&&v<=.65;if(R&&o){let S=(w,I)=>Math.hypot((w.x+I.x)/2-o.x,(w.y+I.y)/2-o.y);S(g[0],g[1])>S(g[3],g[2])&&(g=[g[3],g[2],g[1],g[0]])}let P=R?Math.ceil((v-1e-8)/.2):1,x=(S,w,I)=>({x:S.x+(w.x-S.x)*I,y:S.y+(w.y-S.y)*I});for(let S=0;S<P;S++){let w=S/P,I=(S+1)/P,L=[x(g[0],g[3],w),x(g[1],g[2],w),x(g[1],g[2],I),x(g[0],g[3],I)],O=s.y+.008-(R?v*(1-I):0);if(se(e,L,void 0,()=>O,O-(R?v/P+.1:.16),i,[.43,.47,.46],oe),!R)continue;let D=Math.hypot(L[3].x-L[0].x,L[3].y-L[0].y)*C,A=Math.min(.04/D,.25),E=x(L[0],L[3],A),T=x(L[1],L[2],A),V=k=>[k.x*C,O+.004,k.y*C],_=[.66,.59,.39];e.tri(V(L[0]),V(L[1]),V(T),[0,1,0],_),e.tri(V(L[0]),V(T),V(E),[0,1,0],_)}}}}function Bs(e,t,n,o,r,i,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),m=qa(o,s.tierTop);if(!r)return;let h=g=>r.deckAt(g.x,g.y),d=ja(t,a),f=d[0]??t.outline;if(r.rowLevels.length>=2){let g=Jn(r.rowLevels),M=Xa(Na(r.rowLevels,n.focal,g),d);for(let R of M){let P=Math.max(u,R.topY-Ns);for(let x of i.subtract(R.outline,P))ks(e,x,R.holes,P,u,s.tierTop,s.tierWall,l,!c)}M.length||se(e,f,t.holes,()=>r.landingY,u,m,s.tierWall,oe);let v={tread:[m[0]*oe.top,m[1]*oe.top,m[2]*oe.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let R of d.length?d:[f])Ga(e,r.rowLevels,n.focal,r.landingY,v,R,g);Ds(e,r.rowLevels,n.focal,u),Os(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:Ya,b=g=>r.normalAt(g.x,g.y),y=r.flat?r.landingY:void 0;for(let g of i.subtract(f,y))se(e,g,t.holes,h,u,m,s.tierWall,oe,p,b)}function qd(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 u=t[a];if(u.kind==="booth")continue;let l=r.get(s);l||(l=new Map,r.set(s,l));let m=u.rowId||`__seat-${a}`,h=l.get(m);h||(h={pts:[],levelM:0,n:0},l.set(m,h)),h.pts.push({x:u.x,y:u.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 u=s.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=r.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function $d(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 Ns=.02;function Zd(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 l of o.outline)l.x<i&&(i=l.x),l.x>a&&(a=l.x),l.y<s&&(s=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-Ns);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,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(!Te(c,s.outline,s.holes)&&$d(c,s.outline)>i)continue;let u=Math.min(s.surface.deckAt(o,r),s.floorTop);(a===null||u<a)&&(a=u)}return a}}var Qd=3,Jd=.4;function Vs(e,t,n,o,r,i,a=!0){let s=qd(t,n,o);if(s.length<Qd)return;let c=Cs(s,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((m,h)=>m+h.binCount,0)))/c.binCount;e.setMaterial(5),Fs(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(l=>Math.min(...l.rows.map(m=>m.levelM))),colors:{bandTop:ae(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??ae(r.tierWall,1.15),shellWall:i??r.tierWall},ao:oe,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a&&u>=Jd,standTopNear:Zd(t,o)}),e.setMaterial(0)}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 eh=.8,th=.6,nh=2;function ho(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=be(a)??[],c=Gs(s)/2;!(c>0)||oh(s)/c*C>nh||(n.push(...s),o+=c)}if(n.length<3)return null;let r=Pn(n);if(r.length<3||o<Gs(r)*th)return null;let i=0;for(let a of t)rh(a,r)&&(i+=1);return i>=t.length*eh?r:null}function oh(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 Gs(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 rh(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}var Hs=4;var ih=[[/\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"]],ah=1.2,sh=12;function zs(e){if(e.heightM!==void 0)return!1;let t=be(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*me<sh*2?!1:2*po(t)/n*me<=ah}function Ar(e){if(!e)return null;for(let[t,n]of ih)if(t.test(e))return n;return null}var Xs="auto-rows-";function Ws(e){return e.id.startsWith(Xs)&&!e.label}var ch=1.15,lh=.09,Ys=6,uh=34,mh=.35,fh=6,dh=.35,hh=.75,ph=12,bh=2.5,yh=40,gh=[18,24],xh=[12,16],Us=14,vh=.8,Mh=.6,Sh=5,wh=.3,Ks=.4,Ph=2,Ih=400,Rh=2.6,Ah=1.6,Ch=6e3,Eh=.6,_h="#c3c7cd",js=300,Th=240;function kh(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Er([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Th)return null;let{h:a,s,l:c}=wi(Mi(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&be(l)?.some(m=>Tr(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Lh="Estimated from the drawing; confirm with the venue.",qs=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},Er=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),po=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 Fh(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function _r(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 Tr(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 kr(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,u=s*s+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u)):0,m={x:i.x+s*l,y:i.y+c*l},h=Math.hypot(e.x-m.x,e.y-m.y);h<o&&(o=h,n=m)}return n}function $s(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,u=Math.hypot(s,c);if(u<1e-6)continue;let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=kr(l,t),h=m.x-l.x,d=m.y-l.y,f=Math.hypot(h,d);f<1e-6||(o+=Math.abs((-c*h+s*d)/(u*f))*r.length,n+=r.length)}return n?o/n:0}function Dh(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=be(r);return p?{shape:r,centre:Er(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 u=(a-i)*(c-s),l=[];for(let p of o){if(p.role)continue;let b=be(p);if(!b)continue;let y=po(b);if(y*me*me<6||y>u)continue;let g=Math.min(...b.map(w=>w.x)),M=Math.max(...b.map(w=>w.x)),v=Math.min(...b.map(w=>w.y)),R=Math.max(...b.map(w=>w.y)),P=0;for(let w of n)w.x>g&&w.x<M&&w.y>v&&w.y<R&&Tr(w,b)&&P++;if(P>n.length*.05)continue;let x=Er(b),S=$s(t,b);S>=vh&&l.push({shape:p,centre:x,outline:b,score:S,area:y,box:[g,v,M,R]})}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=l.filter(p=>!l.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 Oh(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=kr(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Zs(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 Bh(e){if(!e.length||e.length>Ch)return[];let t=[..._r(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),r=Ah/me,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 u=i[s],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.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 u=o(c),l=a.get(u);l?l.push(...s):a.set(u,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function Nh(e,t,n){if(!t.length)return null;let o=t.filter(S=>n.tableIds.has(S.rowId)||S.kind==="booth").length>t.length/2,r=_r(t),i=!n.outline||$s(r,n.outline)>=Mh,a=0,s=0;for(let S of r.values()){if(S.length<2)continue;let w=S[0],I=S[S.length-1],L=I.x-w.x,O=I.y-w.y,D=Math.hypot(L,O);if(D<1e-6)continue;let A={x:(w.x+I.x)/2,y:(w.y+I.y)/2},E=i?n.outline?kr(A,n.outline):n.focal:n.middle,T=-O/D,V=L/D;T*(E.x-A.x)+V*(E.y-A.y)<0&&(T=-T,V=-V),a+=T*S.length,s+=V*S.length}let c={x:t.reduce((S,w)=>S+w.x,0)/t.length,y:t.reduce((S,w)=>S+w.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let S=i?n.focal:n.middle;a=S.x-c.x,s=S.y-c.y}let u=Math.hypot(a,s)||1,l={x:a/u,y:s/u},m=S=>-(S.x*l.x+S.y*l.y),h=S=>-S.x*l.y+S.y*l.x,d=1/0,f=-1/0,p=1/0,b=-1/0,y=1/0,g=new Map;for(let S of t){let w=m(S),I=h(S);d=Math.min(d,w),f=Math.max(f,w),p=Math.min(p,I),b=Math.max(b,I),i&&(y=Math.min(y,Oh(S,n.focal,n.outline)));let L=S.logicalRowId??S.rowId,O=g.get(L);O?O.push(w):g.set(L,[w])}i||(y=Math.max(0,d-m(n.middle)));let M=[...g.values()].map(S=>qs(S)).sort((S,w)=>S-w),v=[];if(!o)for(let S of M)v.length&&S-v[v.length-1]<dh/me||v.push(S);let R=Fh(e),P=dt(e,{floorBaseHeightM:n.baseHeightM}),x={id:e.id,section:e,authored:R,plane:n,facing:l,facesAction:i,hull:Zs(t),sample:t.filter((S,w)=>w%Math.ceil(t.length/Ih)===0),frontD:d,backD:f,latMin:p,latMax:b,frontDistance:y,rowDepths:v,rowCount:v.length,level:0,height:P.height,rake:R?P.rake:0,backHeight:0};return x.backHeight=x.height+(f-d)*me*Math.tan(x.rake*Math.PI/180),x}function Vh(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*me),i=n+ch-o,a=0,s=0;for(let u=1;u<e.length;u++){let l=Math.max(hh,(e[u]-e[u-1])*me),m=(i+lh)*(r+l)/r;a+=m-i,s+=l,i=m,r+=l}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(Ys,Math.min(uh,c))*10)/10}function Gh(e,t){if(e.facing.x*t.facing.x+e.facing.y*t.facing.y<wh)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)<Ks*(e.latMax-e.latMin))return null;let a=Ph/me,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 u=[];for(let[m,h]of s){let d=c.get(m);d!==void 0&&u.push(h-d)}let l=u.length?qs(u):e.frontD-n;return l<-1/me?null:l}function Hh(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 u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}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>Ks*(e.latMax-e.latMin)&&s>1/me}function zh(e,t=!1){let n=t?xh:gh,o=new Map,r=[...e].sort((c,u)=>c.plane.floorIndex-u.plane.floorIndex||c.frontDistance-u.frontDistance),i=[],a=new Map,s=c=>{if(c.plane.floorIndex===0||c.plane.baseHeightM>0)return c.plane.baseHeightM;let u=a.get(c.plane.floorIndex-1);return u===void 0?c.plane.baseHeightM:u+Hs};for(let c of r){if(!c.authored){let l=s(c),m;for(let f of i){if(f.plane.floorIndex>c.plane.floorIndex)continue;if(Hh(c,f)){let y=f.backHeight+Rh;y>l&&(l=y,m=f);continue}let p=Gh(c,f);if(p==null)continue;let b=f.backHeight+mh+Math.min(fh,Math.max(0,p)*me)*Math.tan(f.rake*Math.PI/180);b>l&&(l=b,m=f)}c.height=Math.round(Math.min(l,c.plane.baseHeightM+yh)*100)/100;let h=!m&&c.height>c.plane.baseHeightM;if(c.level=m?m.level+1:h?1:0,c.rake=Vh(c.rowDepths,c.frontDistance,c.height,c.plane.focalHeightM),!c.facesAction&&c.rowCount<Sh)c.rake=0;else if(!m&&!h){let f=Math.max(1e-6,(c.backD-c.frontD)*me);c.rake=Math.min(c.rake,ph,Math.round(Math.atan(bh/f)*1800/Math.PI)/10)}else c.rowCount>=2&&(c.rake=Math.max(c.rake,n[Math.min(c.level,n.length)-1]));let d=(c.backD-c.frontD)*me;if(t&&d>0&&c.height+d*Math.tan(c.rake*Math.PI/180)>c.plane.baseHeightM+Us){let f=Math.max(0,c.plane.baseHeightM+Us-c.height);c.rake=Math.max(Ys,Math.round(Math.atan(f/d)*1800/Math.PI)/10)}c.backHeight=c.height+d*Math.tan(c.rake*Math.PI/180),o.set(c.id,m?.id)}let u=c.plane.floorIndex;a.set(u,Math.min(a.get(u)??1/0,c.height)),i.push(c)}return o}var Cr=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function bo(e,t={x:0,y:-40}){let n=zt(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,u=new Set,l=i.map(b=>{let y=O=>!e.floors?.length||O.floorId===b.floorId,g=Bh(n.filter(O=>!O.sectionId&&O.kind!=="booth"&&!a.has(O.rowId)&&y(O))),M=[];for(let O of g){let D=je(Ke(Zs(O)),Eh/me);if(n.some(E=>!y(E)&&Tr(E,D)))continue;let A=`${Xs}${b.floorIndex}-${M.length}`;u.add(A),o.set(A,O),M.push({type:"section",id:A,label:"",color:_h,outline:D})}let v=M.length?{...b,objects:[...b.objects,...M]}:b,R=new Set(v.objects.filter(O=>O.type==="section").map(O=>O.logicalSectionId??O.id)),P=[...o.entries()].filter(([O])=>R.has(O)).flatMap(([,O])=>O),x=Dh(v.objects,_r(P),P),S=v.focal;(x||v.focal&&!Cr(v.focal,t))&&(r.confident=!0),x&&(r.stage??={id:x.shape.id,inferred:x.inferred,...v.floorId?{floorId:v.floorId}:{}},(x.inferred||Cr(v.focal,t))&&(S=x.centre,r.focalInferred=!0));let w=x&&(!x.inferred||po(x.outline)*me*me<=js),I=x?void 0:c,L={tableIds:a,floorIndex:v.floorIndex,floorId:v.floorId,baseHeightM:v.baseHeightM,focal:I?.focal??S,outline:x?.outline??I?.outline,focalHeightM:I?.focalHeightM??v.baseHeightM+(x&&w?Xe({...x.shape,role:"stage"}).heightM:0),middle:P.length?{x:P.reduce((O,D)=>O+D.x,0)/P.length,y:P.reduce((O,D)=>O+D.y,0)/P.length}:S};for(let O of v.objects){if(O.type!=="section")continue;let D=Nh(O,o.get(O.logicalSectionId??O.id)??[],L);D&&s.push(D)}return L.outline&&(c=L),Cr(v.focal,L.focal)||(r.focal??=[]).push({...v.floorId?{floorId:v.floorId}:{},point:{...L.focal}}),{unit:v,plane:L,stage:x,planeSeats:P}}),m=i.flatMap(b=>b.objects).map(b=>b.type==="shape"&&!b.role&&(Ar(b.label)==="wall"||!Ar(b.label)&&zs(b))?{...b,role:"wall"}:b),h=ho({objects:m},n)!==null;h&&(r.indoor=!0);let d=zh(s,h),f=new Map(s.filter(b=>!b.authored).map(b=>[b.id,b])),p=l.map(({unit:b,plane:y,stage:g,planeSeats:M})=>b.objects.map(v=>{let R=v.type==="shape"&&!v.role&&v.id!==g?.shape.id?Ar(v.label):null;if(v.type==="shape"&&!v.role&&v.id!==g?.shape.id&&(R==="wall"||!R&&zs(v))&&v.type==="shape"){(r.roles??=[]).push({id:v.id,...y.floorId?{floorId:y.floorId}:{},role:"wall"});let{fill:L,...O}=v;return{...O,role:"wall"}}if(R&&v.type==="shape")return(r.roles??=[]).push({id:v.id,...y.floorId?{floorId:y.floorId}:{},role:R}),{...v,role:R};let x=g?.inferred&&v.id===g.shape.id&&v.type==="shape"?kh(v,g.outline,b.objects,M):null;if(x&&v.type==="shape")return r.stage?.id===v.id&&(r.stage.field=x),{...v,role:"stage",stageKind:x};if(g?.inferred&&v.id===g.shape.id&&v.type==="shape"&&po(g.outline)*me*me<=js)return r.stage?.id===v.id&&(r.stage.deck=!0),{...v,role:"stage"};let S=v.type==="section"?f.get(v.id):void 0;if(!S||v.type!=="section")return v;let w=S.rowCount>=2&&S.rake>0;u.has(S.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:S.id,floorId:y.floorId,surfaceKind:w?"rakedRows":"flat",height:S.height,rake:S.rake,stackedOn:d.get(S.id)});let I={status:"inferred",source:"public-2d-topology",note:Lh};return{...v,height:S.height,rake:S.rake,surfaceKind:w?"rakedRows":"flat",physical3dProvenance:{height:I,rake:I,surfaceKind:I}}}));if(e.floors?.length){let b=e.floors.map((y,g)=>({...y,objects:p[g],focalPoint:l[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:l[0].plane.focal},report:r}}var Qs=/^[\p{L}\p{N}]{1,4}$/u,Uh=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Js(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(Qs.test(a))return a}let i=Uh.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((r.startsWith(a)||a.startsWith(r))&&Qs.test(s))return s}return e}function ec(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 tc(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 jh=1.15,Xh=2.75,Wh=4.5,Yh=.85,Kh=.5,qh=.26;function nc(e,t,n){let o=Math.max(1e-6,t),r=e/o,i=n?.hasZoneLabels??!0,a=new Set;return r>=.75&&a.add("floor"),r>=jh&&a.add("zone"),r<=(i?Xh:Wh)&&(a.add("section"),a.add("ga")),r<=Yh&&(a.add("annotation"),a.add("booth")),r<=Kh&&a.add("row"),r<=qh&&a.add("seat"),a}function oc(e,t,n,o,r,i=6){let a=i+t,s=o-i-t,c=i+n,u=r-i-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>u?r/2:Math.max(c,Math.min(u,e.y))}}function Ze(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],u=r[1]*i+r[5]*a+r[9]*s+r[13],l=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=u/m,f=l/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 rc(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(In(i,s,t,n)){a=!0;break}a||o.push(i)}return o}var $h=6;function In(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+$h):n;return r<a&&i<o}function ic(e,t,n){return e.length*t*.58+(n?14:0)}var Zh={row:8,seat:14};function ac(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Zh}function sc(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 yo(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 u of r)if(In(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(In(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}function cc(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 Qh=6,Jh=2.2,lc=.1,ep=.3,tp=1.8,np=.9,op=.55,rp=6e3;function mc(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 l of n)for(let m of l.objects)m.type==="section"&&m.zone&&c.set(m.id,m.zone);let u=new Map;for(let l=0;l<o.length;l++){let m=o[l],h=r.seatOwner[l],d=m.zoneId??(h?c.get(h):void 0);if(!d)continue;let f=u.get(d);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.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(l)}for(let l of a){let m=u.get(l.id),h=[];for(let[d,f]of c)f===l.id&&h.push(d);if(!m||m.n===0){s.push({id:l.id,label:l.label,color:de(l.color),sectionIds:h,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*C,1.5,(l.focalPoint??i).y*C]});continue}s.push({id:l.id,label:l.label,color:de(l.color),sectionIds:h,seatCount:m.n,center:[(m.minX+m.maxX)/2*C,m.sumY/m.n,(m.minY+m.maxY)/2*C],radius:.5*Math.hypot((m.maxX-m.minX)*C,(m.maxY-m.minY)*C)||1,focalWorld:[(l.focalPoint??i).x*C,1.5,(l.focalPoint??i).y*C]})}}return s}function fc(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],l=[],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())||u.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+Qh,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"||Ws(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*C,y.deck/y.n,y.y/y.n*C],v=b.displayLabel||b.label||b.id;l.push({id:b.id,floorIndex:p.index,label:v,seatCount:y.n,center:M,radius:Math.max(1,Math.hypot(g.maxX-g.minX,g.maxY-g.minY)*.5*C),box:{min:[g.minX*C-.4,g.minDeck,g.minY*C-.4],max:[g.maxX*C+.4,g.maxDeck+1,g.maxY*C+.4]},focalWorld:[p.focal.x*C,p.baseHeightM+1.5,p.focal.y*C]});let R=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&R===v.trim().toLocaleLowerCase()||u.push({id:`section:${b.id}`,kind:"section",text:v,anchor:[M[0],M[1]+Jh,M[2]],floorIndex:p.index})}}{for(let y of n)for(let g of y.objects){if(g.type!=="gaArea")continue;let M=fn(g.points);if(!M)continue;let v=g.displayLabel||g.label||g.id;u.push({id:`ga:${g.id}`,kind:"ga",text:g.capacity>0?`${v} \xB7 ${g.capacity.toLocaleString()}`:v,anchor:[M.x*C,y.baseHeightM+tp,M.y*C],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),v=p.get(g.rowId);(!v||M>v.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,v=uc(g.seat.label,y,d.get(M??""),f.get(y));v&&u.push({id:`row:${y}`,kind:"row",text:v,anchor:[g.seat.x*C,r.seatDeckY(g.index)+np,g.seat.y*C],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:uc(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 v=y*3,R=i.iPosition[v],P=i.iPosition[v+1],x=i.iPosition[v+2];M.n++,M.x+=R,M.y+=P,M.z+=x,M.minX=Math.min(M.minX,R),M.maxX=Math.max(M.maxX,R),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<=rp)for(let y=0;y<o.length;y++){let g=o[y],M=Lr(g.displayLabel||g.label);M&&u.push({id:`seat:${g.id}`,kind:"seat",seatWidthM:i.iChairWidth[y]*2,text:M,anchor:[g.x*C,r.seatDeckY(y)+op,g.y*C],floorIndex:a[y],rowId:g.rowId})}}for(let d of n)for(let f of d.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let p=be(f),b=p?fn(p):null;if(!b||!f.label)continue;u.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[b.x*C,d.baseHeightM+Xe(f).heightM+lc,b.y*C],color:f.fill,floorIndex:d.index})}else if(f.type==="text"){if(!f.text)continue;u.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*C,d.baseHeightM+lc,f.position.y*C],color:f.color,rotation:f.rotation,floorIndex:d.index})}else if(f.type==="booth"){let p=qe(f);if(!p)continue;let b=fn(p);if(!b)continue;u.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[b.x*C,d.baseHeightM+co+ep,b.y*C],floorIndex:d.index})}return{labels:u,sections:l,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 Lr(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function uc(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&&Js(i,n)}function hc(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=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=u[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 l=new Map;for(let h=0;h<n.length;h++)for(let d of n[h].objects)d.type==="section"&&l.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?l.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*C,p.sumDeck+=y,p.sumZ+=b.y*C,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=u[h],b=Math.min(d.n?d.minX*C:n[h].focal.x*C-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(d.n?d.maxX*C:n[h].focal.x*C+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(d.n?d.minY*C:n[h].focal.y*C-1,Number.isFinite(p.minZ)?p.minZ:1/0),M=Math.max(d.n?d.maxY*C:n[h].focal.y*C+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),v=Math.min(d.n?Math.min(n[h].baseHeightM,d.minDeck):n[h].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),R=Math.max(d.n?Math.max(d.maxDeck,v+.5):v+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),P=[d.n?d.sumX/d.n:(b+y)/2,d.n?d.sumDeck/d.n:(v+R)/2,d.n?d.sumZ/d.n:(g+M)/2],x=Math.max(1,.5*Math.hypot(y-b,R-v,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:P,radius:x,box:{min:[b,v,g],max:[y,R,M]},focalWorld:[n[h].focal.x*C,n[h].baseHeightM+1.5,n[h].focal.y*C]})}}return c}function Fr(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 u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=qe(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="table"){let u=lo(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="decorImage"){let u=uo(c);if(u)for(let l of u)a(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function vc(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(...be(h)??h.points??[]):h.type==="gaArea"?s.push(...h.points):h.type==="booth"?s.push(...qe(h)??[]):h.type==="table"?s.push(...lo(h)??[]):h.type==="decorImage"&&s.push(...uo(h)??[]);if(yc(e,t[0],n,i)||xc(e,t[0],n,s,i))return!1;if(a&&bc(e,t[0].baseHeightM,s,i,a))return!0;let c=Pn(s),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,m=c.length>=3?c.map(h=>{let d=h.x-u,f=h.y-l,p=Math.max(1,Math.hypot(d,f));return{x:h.x+d/p*80,y:h.y+f/p*80}}):pn(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return se(e,m,void 0,()=>-.04,-.22,i.ground,i.ground,oe),!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)},u=n.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&u.push(...b.outline);if(yc(e,c,n,i)||xc(e,c,n,u,i))return!1;if(a&&bc(e,s.baseHeightM,u,i,a))return!0;let l=n.filter((b,y)=>o[y]===s.index),m=Fr([s],l),h=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),d=Math.max(28,Math.min(80,h*.04)),f=pn(m.minX-d,m.minY-d,m.maxX-m.minX+d*2,m.maxY-m.minY+d*2),p=s.baseHeightM-.03;return se(e,f,void 0,()=>p,p-.22,i.ground,i.ground,oe),!1}}function Dr(e,t,n,o){let{cx:r,cz:i,radius:a}=n,s=1/0,c=1/0,u=1/0,l=-1/0,m=-1/0,h=-1/0,d=(b,y,g)=>{s=Math.min(s,b),l=Math.max(l,b),c=Math.min(c,y),m=Math.max(m,y),u=Math.min(u,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],v=t.iPosition[y+2],R=Math.max(.35,t.iMaxRadius[b]??.35);d(g-R,M,v-R),d(g+R,M+1.6,v+R)}Number.isFinite(s)||(s=r-a,l=r+a,c=0,m=a*.16,u=i-a,h=i+a);let f=[(s+l)/2,(c+m)/2,(u+h)/2],p=Math.max(1,.5*Math.hypot(l-s,m-c,h-u));return{center:f,radius:p,minY:c,maxY:m}}function Mc(e,t,n,o,r,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let v=0;v<e.count;v++){let R=v*3,P=e.iPosition[R],x=e.iPosition[R+2];P<a&&(a=P),P>c&&(c=P),x<s&&(s=x),x>u&&(u=x)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),u=Math.max(u,v.cz+v.halfZ);let l=n.minX*C,m=n.maxX*C,h=n.minY*C,d=n.maxY*C,f=l,p=m,b=h,y=d;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,u-s));f=Math.max(l,a-v),p=Math.min(m,c+v),b=Math.max(h,s-v),y=Math.min(d,u+v)}let g=Math.min(0,o),M=Math.max(r,i*.05);return{min:[f,g,b],max:[p,M,y]}}var pc=12,ip=.6,ap=40;function bc(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,u=-1/0;for(let v of i)a=Math.min(a,v.x),c=Math.max(c,v.x),s=Math.min(s,v.y),u=Math.max(u,v.y);let l=Math.hypot(c-a,u-s)*C,m=je(i,pc/C,1.2),h=Math.max(ap,l*ip),d=je(i,(pc+h)/C,1.2);if(m.length!==d.length)return!1;let f=he(o.ground,[.78,.76,.72],.35),p=he(o.ground,[.56,.62,.52],.3);se(e,m,void 0,()=>t-.04,t-.22,f,f,oe);let b=t-.05,y=m.map(v=>[v.x*C,b,v.y*C]),g=d.map(v=>[v.x*C,b,v.y*C]),M=[0,1,0];for(let v=0;v<y.length;v++){let R=(v+1)%y.length;e.tri(y[v],g[R],g[v],M,p,r,r),e.tri(y[v],y[R],g[R],M,p,p,r)}return!0}function yc(e,t,n,o){let r=ho(t,n);if(!r)return!1;let i=t.baseHeightM,a=he(o.ground,[.62,.55,.47],.4);return se(e,r,void 0,()=>i-.04,i-.22,a,a,oe),!0}var sp=3e3,cp=20,gc=1.5,lp=1.2,up=.25;function xc(e,t,n,o,r){if(!n.length||n.length>sp||o.length<3)return!1;for(let w of t.objects){if(w.type==="shape"&&ma(w.stageKind))return!1;if(w.type==="section"){let{height:I}=dt(w,{floorBaseHeightM:t.baseHeightM});if(I-t.baseHeightM>cp)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,u=0;for(let w of o){let I=w.x-i,L=w.y-a;s+=I*I,c+=L*L,u+=I*L}let l=.5*Math.atan2(2*u,s-c),m=Math.cos(l),h=Math.sin(l),d=-h,f=m,p=1/0,b=-1/0,y=1/0,g=-1/0;for(let w of o){let I=(w.x-i)*m+(w.y-a)*h,L=(w.x-i)*d+(w.y-a)*f;p=Math.min(p,I),b=Math.max(b,I),y=Math.min(y,L),g=Math.max(g,L)}let M=w=>[[p-w,y-w],[b+w,y-w],[b+w,g+w],[p-w,g+w]].map(([I,L])=>({x:i+m*I+d*L,y:a+h*I+f*L})),v=M(gc/C),R=M((gc+up)/C),P=t.baseHeightM,x=he(r.ground,[.62,.55,.47],.4),S=he(r.ground,[.86,.86,.84],.55);return se(e,R,void 0,()=>P-.04,P-.22,x,x,oe),se(e,R,[v.slice().reverse()],()=>P+lp,P-.04,he(S,[1,1,1],.2),S,oe),!0}function Sc(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=pa(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]})),u=[];for(let m of r.value.overlay.productionElements??[]){let h=i.get(m.objectId),d=h?be(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(S=>S.x*C),b=d.map(S=>S.y*C),y=h.unit.baseHeightM+f,g=Math.min(...p),M=Math.max(...p),v=Math.min(...b),R=Math.max(...b),P,x=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&x&&(P=es(d,y,y+m.heightM,h.unit.focal),!P))if(M-g>=R-v){let S=Math.abs(v-h.unit.focal.y*C)<=Math.abs(R-h.unit.focal.y*C)?v-.006:R+.006;P=[[g,y,S],[M,y,S],[g,y+m.heightM,S],[M,y+m.heightM,S]]}else{let S=Math.abs(g-h.unit.focal.x*C)<=Math.abs(M-h.unit.focal.x*C)?g-.006:M+.006;P=[[S,y,v],[S,y,R],[S,y+m.heightM,v],[S,y+m.heightM,R]]}u.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:h.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[g,y,v],max:[M,y+m.heightM,R]},occlusion:m.occlusion,...x?{contentImageUrl:x}:{},...P?{contentPlane:P}:{}})}let l=u.sort((m,h)=>m.id.localeCompare(h.id));return{byObjectId:new Map(l.map(m=>[m.objectId,m])),elements:l}}var wc=[.13,.14,.17],qt=[.4,.43,.47],mp=.18,fp=.02,dp=2.4,hp=1500,pp=240;function Pc(e,t,n,o){let r=t.stageKind??"";if(Tt(r)||r==="round"||!o.length)return;let i=be(t);if(!i||i.length<3)return;let a={x:i.reduce((E,T)=>E+T.x,0)/i.length,y:i.reduce((E,T)=>E+T.y,0)/i.length},s=0,c=0,u=new Set;for(let E of o)s+=E.x,c+=E.y,u.add(Math.floor(Math.atan2(E.y-a.y,E.x-a.x)*180/Math.PI/10));if(u.size*10>pp)return;let l=a.x-s/o.length,m=a.y-c/o.length,h=Math.hypot(l,m);if(h<1e-6)return;let d=l/h,f=m/h,p=-f,b=d,y=-1/0,g=1/0,M=1/0,v=-1/0;for(let E of i){let T=(E.x-a.x)*d+(E.y-a.y)*f,V=(E.x-a.x)*p+(E.y-a.y)*b;y=Math.max(y,T),g=Math.min(g,T),M=Math.min(M,V),v=Math.max(v,V)}let R=(v-M)*C,P=(y-g)*C;if(R<3||P<1.5||R*P>hp)return;let x=mp/C,S=(E,T)=>({x:a.x+d*E+p*T,y:a.y+f*E+b*T}),w=(E,T,V,_)=>[S(E,V),S(E,_),S(T,_),S(T,V)],I=n+Math.max(3.5,Math.min(8,R*.35)),L=n+Math.min(dp,I-n-1),O=.2/C,D=g+Math.min(P*.25,1.5)/C,A=fp/C;se(e,w(y-2*x+A,y-x-A,M+x+O,v-x-O),void 0,()=>L,n,wc,wc,oe);for(let[E,T]of[[M+x,M+x+O],[v-x-O,v-x]])se(e,w(y-2*x,y-x,E,T),void 0,()=>I+.3,n,qt,qt,oe),se(e,w(D+O,y-2*x,E,T),void 0,()=>I+.3,I,qt,qt,oe);se(e,w(D,D+O,M+x,v-x),void 0,()=>I+.3,I,qt,qt,oe)}function Ne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Be(e){return Array.isArray(e)?e:[]}function bp(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!Ne(n))continue;let o=Ne(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 go(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function yp(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function gp(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 xp(e){let t=go(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:go(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:go(e.rotation,4),r=e.scale===void 0?[1,1,1]:go(e.scale,3);if(!n||!o||!r)return null;let[i,a,s,c]=o,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let l=i/u,m=a/u,h=s/u,d=c/u,f=l+l,p=m+m,b=h+h,y=l*f,g=l*p,M=l*b,v=m*p,R=m*b,P=h*b,x=d*f,S=d*p,w=d*b;return[(1-(v+P))*r[0],(g+w)*r[0],(M-S)*r[0],0,(g-w)*r[1],(1-(y+P))*r[1],(R+x)*r[1],0,(M+S)*r[2],(R-x)*r[2],(1-(y+v))*r[2],0,n[0],n[1],n[2],1]}function vp(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 Mp(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],u=e[10],l=i*u-a*c,m=a*s-r*u,h=r*c-i*s,d=t*l+n*m+o*h;if(Math.abs(d)<1e-12)return null;let f=1/d;return[l*f,m*f,h*f,(o*c-n*u)*f,(t*u-o*s)*f,(n*s-t*c)*f,(n*a-o*i)*f,(o*r-t*a)*f,(t*i-n*r)*f]}function Ic(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 Sp(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(!Ne(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 wp(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Pp(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Ip(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 Rp(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Sp(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!Ne(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Be(o.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||bp(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Be(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Be(o.images).length||Be(o.textures).length)return{ok:!1,issue:"external_resource"};let a=Be(o.buffers);if(a.length!==1||!Ne(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=Be(o.accessors),c=Be(o.bufferViews),u=Be(o.meshes),l=Be(o.nodes),m=Be(o.scenes),h=typeof o.scene=="number"?o.scene:0;if(!Ne(m[h]))return{ok:!1,issue:"unsupported_glb"};let d=new DataView(r.buffer,r.byteOffset,r.byteLength),f=(v,R,P)=>{if(typeof v!="number"||!Number.isInteger(v)||!Ne(s[v]))return null;let x=s[v];if(x.type!==R||x.sparse!==void 0||x.normalized===!0||typeof x.count!="number"||!Number.isInteger(x.count)||x.count<1||typeof x.componentType!="number"||!P.includes(x.componentType)||typeof x.bufferView!="number")return null;let S=c[x.bufferView];if(!Ne(S)||S.buffer!==0||typeof S.byteLength!="number"||!Number.isInteger(S.byteLength)||S.byteLength<0)return null;let w=Pp(x.type),I=wp(x.componentType),L=typeof S.byteStride=="number"?S.byteStride:w*I,O=typeof S.byteOffset=="number"?S.byteOffset:0,D=typeof x.byteOffset=="number"?x.byteOffset:0,A=O+D,E=D+(x.count-1)*L+w*I;if(!Number.isInteger(L)||!Number.isInteger(O)||!Number.isInteger(D)||L<w*I||O<0||D<0||O+S.byteLength>r.byteLength||E>S.byteLength)return null;let T=[];for(let V=0;V<x.count;V++){let _=[];for(let k=0;k<w;k++){let H=Ip(d,A+V*L+k*I,x.componentType);if(!Number.isFinite(H))return null;_.push(H)}T.push(_)}return T},p=[],b=[],y=0,g=new Set,M=(v,R)=>{if(typeof v!="number"||!Number.isInteger(v)||!Ne(l[v])||g.has(v))return!1;g.add(v);let P=l[v],x=xp(P);if(!x)return!1;let S=gp(R,x),w=Mp(S);if(!w)return!1;if(P.mesh!==void 0){if(typeof P.mesh!="number")return!1;let I=u[P.mesh];if(!Ne(I))return!1;for(let L of Be(I.primitives)){if(!Ne(L)||L.mode!==void 0&&L.mode!==4||!Ne(L.attributes))return!1;let O=f(L.attributes.POSITION,"VEC3",[5126]),D=L.attributes.NORMAL===void 0?null:f(L.attributes.NORMAL,"VEC3",[5126]);if(!O||L.attributes.NORMAL!==void 0&&!D)return!1;let A=O.length;if(L.indices!==void 0){let T=typeof L.indices=="number"?s[L.indices]:null;A=Ne(T)?T.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(y+=A/3,y>1e5))return!1;let E=L.indices===void 0?O.map((T,V)=>[V]):f(L.indices,"SCALAR",[5121,5123,5125]);if(!E||E.length%3!==0||E.length!==A)return!1;for(let T=0;T<E.length;T+=3){let V=[E[T][0],E[T+1][0],E[T+2][0]];if(V.some(H=>!Number.isInteger(H)||H<0||H>=O.length))return!1;let _=V.map(H=>vp(S,...O[H])),k=null;if(!D){let H=_[1][0]-_[0][0],B=_[1][1]-_[0][1],F=_[1][2]-_[0][2],G=_[2][0]-_[0][0],j=_[2][1]-_[0][1],N=_[2][2]-_[0][2];k=Ic([1,0,0,0,1,0,0,0,1],B*N-F*j,F*G-H*N,H*j-B*G)}for(let H=0;H<3;H++)p.push(..._[H]),b.push(...D?Ic(w,...D[V[H]]):k)}}}for(let I of Be(P.children))if(!M(I,S))return!1;return g.delete(v),!0};for(let v of Be(m[h].nodes))if(!M(v,yp()))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 Rc(e){try{return Rp(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function $t(e){let{doc:t}=e,n=Ji(t.theme),o=n.structure,r=Ua(t,e.eventConfigurationId??t.eventConfigurationId),i=Sc(e.eventConfigurationId,e.eventConfiguration,r),a=e.seats,s=new jn,c=null;if(e.registeredShellGlb){let Y=Rc(e.registeredShellGlb);if(Y.ok){let W=Y.position.length/3,Q=new Float32Array(Y.position.length),te=n.materials.shell??o.tierWall;for(let $=0;$<W;$++){let ne=Y.normal[$*3+1],ee=ne<-.25?.4:.62+.38*Math.max(0,ne);Q[$*3]=te[0]*ee,Q[$*3+1]=te[1]*ee,Q[$*3+2]=te[2]*ee}c={position:Y.position,normal:Y.normal,color:Q,floor:new Float32Array(W).fill(-2),material:new Float32Array(W),count:W}}}let u=new Map;for(let Y of r)for(let W of Y.objects)u.set(W.id,Y.index),W.type==="section"&&u.set(W.logicalSectionId??W.id,Y.index);let l=a.map(Y=>u.get(Y.sectionId??"")??u.get(Y.rowId??"")??0),m=Fr(r,a),h=s.vertexCount,f=vc(s,r,a,l,m,o,he(n.background.top,n.background.bottom,.5))?s.vertexCount:h,p=$a(t,a),b=new Map,y=new Map;for(let Y of t.categories??[])b.set(Y.key,Y.color),Y.seatGlyph&&y.set(Y.key,Y.seatGlyph);let g=[],M=Ka(r,a,l),v=new Map;a.forEach((Y,W)=>{let Q=M.seatDeckY(W);Number.isFinite(Q)&&v.set(Y.rowId,Math.min(v.get(Y.rowId)??1/0,Q))});let R=new Float32Array(a.length),P=[],x=new Map((t.floors??[]).map((Y,W)=>[Y.id,W])),S=r.map(()=>[]);for(let Y of a){let W=Y.floorId?x.get(Y.floorId)??0:0;S[Math.min(W,S.length-1)]?.push(Y)}let w=(Y,W)=>{if(!W||W.length<3)return!1;let Q=Math.min(...W.map(ee=>ee.x)),te=Math.max(...W.map(ee=>ee.x)),$=Math.min(...W.map(ee=>ee.y)),ne=Math.max(...W.map(ee=>ee.y));for(let ee=0;ee<Y;ee++)for(let q of S[ee])if(!(q.x<Q||q.x>te||q.y<$||q.y>ne)&&Te(q,W,void 0))return!0;return!1},I=null,L=Y=>r.length===1?a:a.filter((W,Q)=>l[Q]===Y),O=(Y,W)=>{let Q=qe(Y);if(!Q)return!1;let te=1/0,$=1/0,ne=-1/0,ee=-1/0;for(let q of Q)te=Math.min(te,q.x),ne=Math.max(ne,q.x),$=Math.min($,q.y),ee=Math.max(ee,q.y);return a.some((q,le)=>q.kind!=="booth"&&(r.length===1||l[le]===W)&&q.x>te&&q.x<ne&&q.y>$&&q.y<ee&&De(Q,q.x,q.y))};for(let Y=0;Y<r.length;Y++){let W=r[Y];s.setFloor(Y);let Q=new eo,te=[],$=W.objects.filter(q=>q.type==="shape"&&(q.role==="entrance"||q.role==="exit")),ne=W.objects.filter(q=>q.type==="section"&&!!q.outline&&q.outline.length>=3),ee=Ps(W.objects.filter(q=>q.type==="booth"),W.focal);for(let q of W.objects)if(q.type==="section"){let le=s.vertexCount;Bs(s,q,W,Za(q,p),M.bySection.get(q.id),Q,ne,o,Y>0&&w(Y,q.outline));let re=s.vertexCount-le;re>0&&P.push({sectionId:q.id,start:le,count:re})}else if(q.type==="shape"){let le=i.byObjectId.get(q.id),re=g.length;s.setMaterial((le?.kind??q.role)==="screen"?1:0);let Le=q.role==="stage"&&!le?Rs(q,L(Y)):q,Ce=Ja(Le,te);if(vs(s,Le,W.baseHeightM+Ce.supportOffsetM,Ce.topOffsetM-Ce.supportOffsetM,o,W.focal,g,le,$),s.setMaterial(0),q.role==="stage"&&!le&&g.length>re&&(I??Y)===Y){I=Y;let we=t.floors?.[Y]?.id,ve=r.length>1&&we?a.filter(tt=>tt.floorId===we):a;Pc(s,Le,g[g.length-1].y,ve)}}else q.type==="gaArea"?Ss(s,q,W.baseHeightM,de(b.get(q.categoryKey)),o):q.type==="booth"?ys(s,q,W.baseHeightM,de(b.get(q.categoryKey)),o,ee.get(q.id)??W.focal,O(q,Y)):q.type==="table"?xs(s,q,Math.max(W.baseHeightM,v.get(q.id)??W.baseHeightM),de(q.fill??t.theme?.decorFill??"#232c40"),o,!!(q.fill??t.theme?.decorFill)):q.type==="decorImage"&&Ms(s,q,W.baseHeightM,o);Vs(s,W,a,M,o,n.materials.shell,!c)}let D=r.length>1?{x:r.reduce((Y,W)=>Y+W.focal.x,0)/r.length,y:r.reduce((Y,W)=>Y+W.focal.y,0)/r.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=Ki(c?[s.build(),c]:[s.build()]),E=$i(a,e.initialState,M,R,b,y),T=mc({doc:t,units:r,seats:a,surfaces:M,focal:D}),{labels:V,sections:_,rows:k}=fc({doc:t,units:r,seats:a,surfaces:M,seatData:E,hintedSeatFloor:l,zones:T,focal:D}),H=new Map(_.map((Y,W)=>[Y.id,W]));M.seatOwner.forEach((Y,W)=>{E.iSection[W]=Y?H.get(Y)??-1:-1});let B=hc({doc:t,units:r,seats:a,surfaces:M,solids:A,hintedSeatFloor:l,seatFloor:R});dc(V,B),E.iYaw=gi(E.iPosition,a.length,Y=>a[Y].rowId,Y=>{let W=r[R[Y]]?.focal??D;return[W.x*C,W.y*C]});let F=(m.minX+m.maxX)/2*C,G=(m.minY+m.maxY)/2*C,j=.5*Math.hypot((m.maxX-m.minX)*C,(m.maxY-m.minY)*C)||10,N=Dr(A,E,{cx:F,cz:G,radius:j},[h,f]),z=Dr(A,E,{cx:F,cz:G,radius:j}),K=Mc(E,g,m,N.minY,N.maxY,j);return{sharedAisles:Zi(r.flatMap(Y=>Y.objects.flatMap(W=>{if(W.type!=="section")return[];let Q=M.bySection.get(W.id);return Q?[{sectionId:W.id,floorIndex:Y.index,rows:Q.rowLevels}]:[]}))),solids:A,sectionSolidRanges:P,seats:E,seatSectionIds:M.seatOwner,bounds:{center:[(K.min[0]+K.max[0])/2,(K.min[1]+K.max[1])/2,(K.min[2]+K.max[2])/2],radius:j,groundY:0,box:K},renderBounds:{center:N.center,radius:N.radius},clipBounds:{center:z.center,radius:z.radius},stateColorLUT:ea(n,Re),theme:n,seatCount:a.length,focalWorld:[D.x*C,1.5,D.y*C],zones:T,stages:g,productionElements:i.elements,sections:_,rows:k,labels:V,floors:B}}var gt=require("ogl"),Ap=.05,Cp=.6,Ep=12,_p=1.6,Tp=1,kp=2.5,Lp=650,Ac=24;function Fp(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,u=.24,l=.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,l,Math.sin(h)*c],p=[Math.cos(h)*u,l,Math.sin(h)*u],b=[Math.cos(d)*u,l,Math.sin(d)*u],y=[Math.cos(d)*c,l,Math.sin(d)*c];for(let g of[f,p,b,f,b,y])r(g,[0,1,0],1)}return new gt.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var Dp=`#version 300 es
21
+ precision highp float;
22
+ in vec3 position; in vec3 normal; in float part;
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;
26
+ void main() {
27
+ vNormal = normalize(normalMatrix * normal);
28
+ vPart = part;
29
+ // The stem rises out of the ring as the pin lands (uLift runs 1 \u2192 0).
30
+ float grow = part > 0.5 ? 1.0 : 1.0 - uLift;
31
+ // The ring is the seat's own size, not the stem's: grown with the stem it
32
+ // spread over the neighbouring seats and read as a horseshoe from afar.
33
+ float scale = part > 0.5 ? uRingScale : uHeight;
34
+ vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
35
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
36
+ }`,Op=`#version 300 es
37
+ precision highp float;
38
+ in vec3 vNormal; in float vPart;
39
+ uniform vec3 uColor; uniform float uRingAlpha;
40
+ out vec4 fragColor;
41
+ void main() {
42
+ if (vPart > 0.5) { fragColor = vec4(uColor, uRingAlpha); return; }
43
+ // View-space light from the upper left: a lit, round stem reads as an
44
+ // object standing in the venue rather than a line drawn on the screen.
45
+ float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
46
+ vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
47
+ fragColor = vec4(c, 1.0);
48
+ }`;function Bp(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 Or(e){return Math.max(Cp,Math.min(Ep,e*Ap))}function Cc(e,t){let n=new gt.Transform,o=Fp(e),r=new Map,i=(a,s)=>{let c=new gt.Program(e,{vertex:Dp,fragment:Op,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}),u=new gt.Mesh(e,{geometry:o,program:c});return u.frustumCulled=!1,u.setParent(n),{mesh:u,program:c,seat:a,start:s}};return{root:n,setSeats(a,s,c){let u=new Set(a.slice(0,Ac).map(l=>l.id));for(let[l,m]of r)u.has(l)||(m.mesh.setParent(null),r.delete(l));for(let l of a.slice(0,Ac))r.has(l.id)||r.set(l.id,i(l.position,c?s:-1/0))},update(a,s,c,u=!1){let l=!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>(u?Tp:kp);let b=Or(p),y=Math.max(0,Math.min(1,(a-m.start)/Lp));y<1&&(l=!0),m.program.uniforms.uHeight.value=b,m.program.uniforms.uRingScale.value=Math.min(b,_p),m.program.uniforms.uLift.value=u?1:1-Bp(y),m.program.uniforms.uRingAlpha.value=.55+.4*(y<1?Math.sin(y*Math.PI):0)}return l},dispose(){for(let a of r.values())a.mesh.setParent(null);r.clear(),o.remove()}}}var Rn="#ffffff",Ec="#0b1220",An=6,Np=80,_c=14,Tc=88,kc=20,Lc={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Vp=640,Gp=.8,Hp=11,zp="3px 7px",Up="2px 5px",Fc="rgba(10,14,22,.62)",jp="#f4f7fb",Dc=5,Oc=2,Xp=6,Cn=new Set(["row","seat"]),Bc={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Zt={row:{x:66,y:20},seat:{x:52,y:22}},Nr=de,Br=e=>Si(e);function Vr(e,t){let n=Br(e),o=Br(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function Gr(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 Wp(e,t=[.04,.06,.1],n=!0){let o=Br(t)<.42,r=o?"#f4f7fb":"#0b1220",i=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Gr(i,t):t,s=Nr(e),c=n?7:4.5,u=s&&Vr(s,a)>=c?e:r;return o?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Yp(e,t=[.04,.06,.1]){let n=Gr(Fc,t),o=Nr(e);return{ink:o&&Vr(o,n)>=4.5?e:jp,backing:Fc}}var Kp='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',xo=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||Kp,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=Lc[t].size;return!this.narrowStage||Cn.has(t)?n:Math.max(Hp,n*Gp)}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<Vp;let s=nc(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 S=x.kind==="seat"&&a&&this.selectedSeatLabelIds.has(x.id)?x.pinBase:void 0,w=S&&a?[S[0],S[1]+Or(Math.hypot(S[0]-a[0],S[1]-a[1],S[2]-a[2])),S[2]]:x.anchor,I=Ze(t,w,n,o);if(!I.visible)continue;let L=Cn.has(x.kind),O=this.sizeFor(x.kind),D=ic(x.text,O,!L)+(L?Dc*2:0);if(x.kind==="seat"&&x.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(x.id)&&cc(t,x.anchor,x.seatWidthM,n)<Math.max(22,D))continue;let A=oc(I,D/2,O/2+(L?Oc:4),n,o),E=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:sc(A,E,n,o),halfWidth:D/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let u=tc(c.filter(x=>x.label.kind==="floor"),n),l=[...c.filter(x=>!Cn.has(x.label.kind)&&x.label.kind!=="floor"),...u],m=ac(n),h=c.filter(x=>x.label.kind==="seat"&&this.selectedSeatLabelIds.has(x.label.id)),d=yo(h,Zt.seat.x,Zt.seat.y,m.seat);this.placePinHeads(h.filter(x=>x.label.pinBase&&!d.includes(x)).map(x=>x.screen));let f=rc(l,Tc,kc).filter(x=>!d.some(S=>In(x,S,Tc,kc))),p=yo(c.filter(x=>x.label.kind==="row"),Zt.row.x,Zt.row.y,m.row,[...f,...d]),b=this.seatNumberRow!==void 0,y=yo(c.filter(x=>x.label.kind==="seat"&&!this.selectedSeatLabelIds.has(x.label.id)&&(!b||this.seatNumberRow!==null&&x.label.rowId===this.seatNumberRow)),Zt.seat.x,Zt.seat.y,b?Np: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:S}of g){let I=this.nodeFor(x).style;I.display="";let L=!!x.pinBase&&this.selectedSeatLabelIds.has(x.id);I.transform=L?`translate(-50%, -100%) translate(${S.x.toFixed(1)}px, ${(S.y-An).toFixed(1)}px)`:`translate(-50%, -50%) translate(${S.x.toFixed(1)}px, ${S.y.toFixed(1)}px)`}let R=g.filter(({label:x})=>!Cn.has(x.kind)).sort((x,S)=>Bc[S.label.kind]-Bc[x.label.kind]||x.screen.depth-S.screen.depth||x.focus-S.focus).flatMap(({label:x})=>{let S=this.nodes.get(x.id);return S&&S.style.display!=="none"?[{node:S,box:S.getBoundingClientRect()}]:[]}),P=[];for(let{node:x,box:S}of R)P.some(I=>S.left<I.right+3&&S.right+3>I.left&&S.top<I.bottom+3&&S.bottom+3>I.top)?x.style.display="none":P.push(S);for(let[x,S]of this.nodes)M.has(x)||(S.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.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(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=`-${An}px`,b.transform="translateX(-50%)",b.borderLeft=`${An}px solid transparent`,b.borderRight=`${An}px solid transparent`,b.borderTop=`${An}px solid ${Rn}`,n.appendChild(p)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let i=Lc[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=Cn.has(t.kind),c=!s,u=Wp(t.color??this.opts.ink,this.opts.backgroundRgb,!0),l=s?Yp(t.color??this.opts.ink,this.opts.backgroundRgb):u;a.color=o?Ec:l.ink,a.background=o?Rn:l.backing,a.border=o?`1px solid ${Rn}`:c?`1px solid ${u.border}`:"",a.borderRadius=o||c?"999px":`${Xp}px`;let m=this.narrowStage?Up:zp;a.padding=o||c?m:`${Oc}px ${Dc}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?"none":"0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",a.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],d=Nr(o?Ec:l.ink)??[1,1,1],f=Gr(o?Rn:l.backing,h);return n.dataset.qualityContrast=Vr(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=`${_c}px`,o.height=`${_c}px`,o.borderRadius="50%",o.background=Rn,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 Vc=1;var qp=new Set(["floor","zone","section","ga","booth","annotation"]);function $p(e){return e.every(t=>Number.isFinite(t))}function Zp(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 Nc(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Lt(e){return Math.round(e*1e4)/1e4}function Qp(e){if(e)return{box:{x:Lt(e.box.x),y:Lt(e.box.y),width:Lt(e.box.width),height:Lt(e.box.height)},horizontalFillRatio:Lt(e.horizontalFillRatio),verticalFillRatio:Lt(e.verticalFillRatio),visibleAreaRatio:Lt(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Qe(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function vo(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>qp.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)Zp(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=[Qe("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Qe("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Qe("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Qe("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}`}]),Qe("camera-invalid","The capture camera must have a finite physical pose",$p(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Qe("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}]),Qe("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`}]),Qe("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}))),Qe("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}))),Qe("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:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Qp(e.framing)},metrics:{minimumHierarchyFontPx:Nc(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Nc(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function Gc(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var Se=require("ogl");var xt=require("ogl");var Mo=`
21
49
  float chairWeight(float depth) {
22
50
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
23
- }`,pc=`
51
+ }`,Hc=`
24
52
  float occupantWeight(float depth) {
25
- float nearWeight = smoothstep(${yi.toFixed(1)}, ${gi.toFixed(1)}, depth);
26
- float farWeight = 1.0 - smoothstep(${pi.toFixed(1)}, ${bi.toFixed(1)}, depth);
53
+ float nearWeight = smoothstep(${Di.toFixed(1)}, ${Oi.toFixed(1)}, depth);
54
+ float farWeight = 1.0 - smoothstep(${Li.toFixed(1)}, ${Fi.toFixed(1)}, depth);
27
55
  return nearWeight * farWeight;
28
- }`,kr=`
56
+ }`,Hr=`
29
57
  float glyphEq(float glyph, float expected) {
30
58
  return 1.0 - step(0.25, abs(glyph - expected));
31
59
  }
@@ -74,7 +102,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
74
102
  p.y += 0.16;
75
103
  }
76
104
  return p;
77
- }`,op=`#version 300 es
105
+ }`,Jp=`#version 300 es
78
106
  precision highp float;
79
107
  in vec3 position;
80
108
  in vec3 normal;
@@ -112,7 +140,7 @@ void main() {
112
140
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
113
141
  vColor = color;
114
142
  gl_Position = projectionMatrix * mv;
115
- }`,rp=`#version 300 es
143
+ }`,eb=`#version 300 es
116
144
  precision highp float;
117
145
  in vec3 vColor;
118
146
  in vec3 vNormalWorld;
@@ -252,8 +280,8 @@ void main() {
252
280
  + vec3(0.20, 0.10, 0.34) * focalHalo;
253
281
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
254
282
  fragColor = vec4(base, 1.0);
255
- }`,bc=`
256
- ${kr}
283
+ }`,zc=`
284
+ ${Hr}
257
285
  vec4 seatSurface(vec3 source, float radius) {
258
286
  vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
259
287
  if (iPhysicalSeat < 0.5) {
@@ -267,12 +295,12 @@ vec4 seatSurface(vec3 source, float radius) {
267
295
  if (surface < 0.5) return origin;
268
296
  vec3 p = glyphChairPosition(source, surface, iGlyph);
269
297
  p.xz *= iChairWidth;
270
- if (surface > 1.5) p.z -= max(p.y - ${ut.toFixed(2)}, 0.0) * ${an.toFixed(2)} * glyphBackRake(iGlyph);
298
+ if (surface > 1.5) p.z -= max(p.y - ${ft.toFixed(2)}, 0.0) * ${sn.toFixed(2)} * glyphBackRake(iGlyph);
271
299
  float c = cos(iYaw), s = sin(iYaw);
272
300
  vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
273
301
  return modelViewMatrix * vec4(iOffset + rotated, 1.0);
274
302
  }
275
- `,ip=`#version 300 es
303
+ `,tb=`#version 300 es
276
304
  precision highp float;
277
305
  in float surface;
278
306
  in float iYaw;
@@ -311,8 +339,8 @@ out float vSectionFade;
311
339
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
312
340
  out float vPhysicalSeat;
313
341
  out float vPixelRadius;
314
- ${po}
315
- ${bc}
342
+ ${Mo}
343
+ ${zc}
316
344
  void main() {
317
345
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
318
346
  float depth = max(-mv.z, 0.001);
@@ -333,7 +361,7 @@ void main() {
333
361
  mv = seatSurface(position, r);
334
362
  // Match the shell's non-uniform width/depth scale before its back rake.
335
363
  vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
336
- if (surface > 1.5) n.y += n.z * ${an.toFixed(2)} * glyphBackRake(iGlyph);
364
+ if (surface > 1.5) n.y += n.z * ${sn.toFixed(2)} * glyphBackRake(iGlyph);
337
365
  n = normalize(n);
338
366
  vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
339
367
  vSeatHeight = position.y;
@@ -345,13 +373,13 @@ void main() {
345
373
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
346
374
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
347
375
  gl_Position = projectionMatrix * mv;
348
- }`,yc=`
376
+ }`,Uc=`
349
377
  float seatSilhouette(vec2 uv, float physical) {
350
378
  // Solid furniture owns its silhouette in geometry. Only empty bays need
351
379
  // a fragment mask; cutting physical faces would open holes in the volume.
352
380
  return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
353
381
  }
354
- `,ap=`#version 300 es
382
+ `,nb=`#version 300 es
355
383
  precision highp float;
356
384
  in vec3 vSeatNormal;
357
385
  in float vSeatHeight;
@@ -371,7 +399,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
371
399
  uniform vec3 uFadeColor;
372
400
  uniform float uRoughness;
373
401
  out vec4 fragColor;
374
- ${yc}
402
+ ${Uc}
375
403
  void main() {
376
404
  if (vDim > 0.5) discard;
377
405
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
@@ -410,7 +438,10 @@ void main() {
410
438
  // seat rather than a sample in a dense screen-space pattern. This is based on
411
439
  // actual projected pixels, so it remains correct for unusually large or small
412
440
  // venues where a radius-normalised camera distance is misleading.
413
- float detailedAlpha = alpha * smoothstep(2.4, 3.2, vPixelRadius) * uSeatDetail;
441
+ // Seats show from ~2 px across. At the old 2.4-3.2 px radius a stadium's
442
+ // whole-venue view hid every seat behind its tier tint and read as a flat
443
+ // 2D map (owner, 2026-09-23); below ~1 px they still dissolve, not alias.
444
+ float detailedAlpha = alpha * smoothstep(0.9, 1.5, vPixelRadius) * uSeatDetail;
414
445
  float grainAlpha = smoothstep(1.0, 0.55, d) * overviewGrain * 0.42;
415
446
  c = mix(vec3(0.27, 0.31, 0.32), c, uSeatDetail);
416
447
  alpha = max(detailedAlpha, grainAlpha);
@@ -433,7 +464,7 @@ void main() {
433
464
  c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
434
465
  }
435
466
  fragColor = vec4(c, alpha);
436
- }`,sp=`#version 300 es
467
+ }`,ob=`#version 300 es
437
468
  precision highp float;
438
469
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
439
470
  in vec3 normal;
@@ -468,9 +499,10 @@ out float vDim;
468
499
  out float vSectionFade;
469
500
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
470
501
  out vec3 vOccupantTint;
471
- ${po}
472
- ${pc}
473
- ${kr}
502
+ out float vTaken; // 1 = sold or held: not for sale
503
+ ${Mo}
504
+ ${Hc}
505
+ ${Hr}
474
506
  void main() {
475
507
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
476
508
  float viewDepth = -anchor.z;
@@ -492,6 +524,7 @@ void main() {
492
524
  // rasteriser discards, exactly as the chair itself collapses at w=0.
493
525
  float occupant = step(9.5, part);
494
526
  float taken = step(0.0, iSeed);
527
+ vTaken = taken;
495
528
  vOccupant = occupant;
496
529
  p = glyphChairPosition(p, part, iGlyph);
497
530
  if (iPhysicalSeat < 0.5) {
@@ -555,7 +588,7 @@ void main() {
555
588
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
556
589
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
557
590
  gl_Position = projectionMatrix * mv;
558
- }`,cp=`#version 300 es
591
+ }`,rb=`#version 300 es
559
592
  precision highp float;
560
593
  in vec3 vColor;
561
594
  in vec3 vNormalWorld;
@@ -568,6 +601,7 @@ in float vDim;
568
601
  in float vSectionFade;
569
602
  in float vOccupant;
570
603
  in vec3 vOccupantTint;
604
+ in float vTaken;
571
605
  uniform vec3 uKeyDir;
572
606
  uniform vec3 uFadeColor;
573
607
  uniform float uRoughness;
@@ -614,6 +648,14 @@ void main() {
614
648
  // Occupant silhouettes retain their existing stronger separation.
615
649
  float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
616
650
  base += vec3(0.26, 0.31, 0.38) * fres * mix(0.24, 0.55, vOccupant) * mix(sheen, 1.0, vOccupant);
651
+ // Not for sale: the chair and the person in it go one muted grey, a step
652
+ // toward the venue. Their own clothing and the chair's category tint made a
653
+ // taken seat look like any other at a glance (owner report, 2026-09-23);
654
+ // now only the seats a buyer can take wear full colour.
655
+ if (vTaken > 0.5) {
656
+ float takenLum = dot(base, vec3(0.299, 0.587, 0.114));
657
+ base = mix(vec3(takenLum), uFadeColor, 0.35) * 0.92;
658
+ }
617
659
  // Outside the entered section: quieter, still visible and pickable. Not the
618
660
  // strong grey of a filtered seat, which means nothing to buy there.
619
661
  if (vSectionFade > 0.5) {
@@ -621,14 +663,14 @@ void main() {
621
663
  base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
622
664
  }
623
665
  fragColor = vec4(base, 1.0);
624
- }`,lp=`#version 300 es
666
+ }`,ib=`#version 300 es
625
667
  precision highp float;
626
668
  in vec2 position;
627
669
  out vec2 vUv;
628
670
  void main() {
629
671
  vUv = position * 0.5 + 0.5;
630
672
  gl_Position = vec4(position, 0.999, 1.0);
631
- }`,up=`#version 300 es
673
+ }`,ab=`#version 300 es
632
674
  precision highp float;
633
675
  in vec2 vUv;
634
676
  uniform vec3 uTop;
@@ -639,7 +681,7 @@ void main() {
639
681
  vec2 c = vUv - 0.5;
640
682
  float vig = 1.0 - dot(c, c) * 0.16; // soft vignette
641
683
  fragColor = vec4(col * vig, 1.0);
642
- }`,mp=`#version 300 es
684
+ }`,sb=`#version 300 es
643
685
  precision highp float;
644
686
  in float surface;
645
687
  in float iYaw;
@@ -667,8 +709,8 @@ out float vPhysicalSeat;
667
709
  out float vDotWeight;
668
710
  out float vHidden;
669
711
  flat out vec3 vPick;
670
- ${po}
671
- ${bc}
712
+ ${Mo}
713
+ ${zc}
672
714
  void main() {
673
715
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
674
716
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -682,7 +724,7 @@ void main() {
682
724
  vPhysicalSeat = iPhysicalSeat;
683
725
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
684
726
  gl_Position = projectionMatrix * mv;
685
- }`,fp=`#version 300 es
727
+ }`,cb=`#version 300 es
686
728
  precision highp float;
687
729
  in vec2 vUv;
688
730
  in float vPhysicalSeat;
@@ -690,7 +732,7 @@ in float vDotWeight;
690
732
  in float vHidden;
691
733
  flat in vec3 vPick;
692
734
  out vec4 fragColor;
693
- ${yc}
735
+ ${Uc}
694
736
  void main() {
695
737
  if (vHidden > 0.5) discard;
696
738
  if (vDotWeight <= 0.99) discard;
@@ -698,7 +740,7 @@ void main() {
698
740
  float d = seatSilhouette(vUv, vPhysicalSeat);
699
741
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
700
742
  fragColor = vec4(vPick, 1.0);
701
- }`,dp=`#version 300 es
743
+ }`,lb=`#version 300 es
702
744
  precision highp float;
703
745
  in vec3 position;
704
746
  in float part;
@@ -720,9 +762,9 @@ uniform float uFocusFloor;
720
762
  flat out vec3 vPick;
721
763
  out float vChairWeight;
722
764
  out float vHidden;
723
- ${po}
724
- ${pc}
725
- ${kr}
765
+ ${Mo}
766
+ ${Hc}
767
+ ${Hr}
726
768
  void main() {
727
769
  int id = int(iPickIndex + 0.5); // already global index + 1
728
770
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -756,7 +798,7 @@ void main() {
756
798
  float c = cos(iYaw), s = sin(iYaw);
757
799
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
758
800
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
759
- }`,hp=`#version 300 es
801
+ }`,ub=`#version 300 es
760
802
  precision highp float;
761
803
  flat in vec3 vPick;
762
804
  in float vHidden;
@@ -766,7 +808,7 @@ void main() {
766
808
  if (vHidden > 0.5) discard;
767
809
  if (vChairWeight < 0.01) discard;
768
810
  fragColor = vec4(vPick, 1.0);
769
- }`,pp=`#version 300 es
811
+ }`,mb=`#version 300 es
770
812
  precision highp float;
771
813
  in vec3 position;
772
814
  in float floorIndex;
@@ -777,14 +819,14 @@ out float vHidden;
777
819
  void main() {
778
820
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
779
821
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
780
- }`,bp=`#version 300 es
822
+ }`,fb=`#version 300 es
781
823
  precision highp float;
782
824
  in float vHidden;
783
825
  out vec4 fragColor;
784
826
  void main() {
785
827
  if (vHidden > 0.5) discard;
786
828
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
787
- }`;function gc(e){return new yt.Program(e,{vertex:mp,fragment:fp,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:et},uSeatScale:{value:1},uMinPixels:{value:Ot},uPixelToWorld:{value:.002},uChairFull:{value:un},uChairNone:{value:Bt},uFocusFloor:{value:-1}}})}function xc(e){return new yt.Program(e,{vertex:dp,fragment:hp,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:un},uChairNone:{value:Bt},uBackRake:{value:an},uBackBase:{value:ut},uFocusFloor:{value:-1}}})}function vc(e){return new yt.Program(e,{vertex:pp,fragment:bp,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Mc(e,t=.78,n=[.63,.66,.65]){return new yt.Program(e,{vertex:op,fragment:rp,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}}})}function Sc(e){return new yt.Program(e,{vertex:ip,fragment:ap,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:et},uSeatScale:{value:1},uMinPixels:{value:Ot},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:un},uChairNone:{value:Bt}}})}function wc(e,t=.78){return new yt.Program(e,{vertex:sp,fragment:cp,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:un},uChairNone:{value:Bt},uBackRake:{value:an},uBackBase:{value:ut},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function Pc(e,t,n){return new yt.Program(e,{vertex:lp,fragment:up,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var He=require("ogl");function Ic(e,t,n){let r=Math.max(3,n.radius*1.04),[i,a,s]=n.center,c=new He.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 u=new He.RenderTarget(e,{width:1024,height:1024,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),l=new He.Program(e,{cullFace:!1,vertex:`#version 300 es
829
+ }`;function jc(e){return new xt.Program(e,{vertex:sb,fragment:cb,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:nt},uSeatScale:{value:1},uMinPixels:{value:Nt},uPixelToWorld:{value:.002},uChairFull:{value:mn},uChairNone:{value:Vt},uFocusFloor:{value:-1}}})}function Xc(e){return new xt.Program(e,{vertex:lb,fragment:ub,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:mn},uChairNone:{value:Vt},uBackRake:{value:sn},uBackBase:{value:ft},uFocusFloor:{value:-1}}})}function Wc(e){return new xt.Program(e,{vertex:mb,fragment:fb,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Yc(e,t=.78,n=[.63,.66,.65]){return new xt.Program(e,{vertex:Jp,fragment:eb,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}}})}function Kc(e){return new xt.Program(e,{vertex:tb,fragment:nb,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:nt},uSeatScale:{value:1},uMinPixels:{value:Nt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mn},uChairNone:{value:Vt}}})}function qc(e,t=.78){return new xt.Program(e,{vertex:ob,fragment:rb,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:mn},uChairNone:{value:Vt},uBackRake:{value:sn},uBackBase:{value:ft},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function $c(e,t,n){return new xt.Program(e,{vertex:ib,fragment:ab,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var He=require("ogl");function Zc(e,t,n){let r=Math.max(3,n.radius*1.04),[i,a,s]=n.center,c=new He.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 u=new He.RenderTarget(e,{width:1024,height:1024,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),l=new He.Program(e,{cullFace:!1,vertex:`#version 300 es
788
830
  in vec3 position;
789
831
  uniform mat4 modelViewMatrix;
790
832
  uniform mat4 projectionMatrix;
@@ -793,7 +835,7 @@ void main() {
793
835
  out vec4 fragColor;
794
836
  void main() {
795
837
  fragColor = vec4(1.0);
796
- }`}),m=new He.Transform,h=new He.Mesh(e,{geometry:t,program:l});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:u})}finally{f&&e.enable(e.DITHER),e.clearColor(d[0],d[1],d[2],d[3]),l.remove()}let p=new He.Mat4().multiply(c.projectionMatrix,c.viewMatrix);return{texture:u.depthTexture,matrix:p,dispose(){for(let b of u.textures)e.deleteTexture(b.texture);e.deleteTexture(u.depthTexture.texture),e.deleteFramebuffer(u.buffer),u.depthBuffer&&e.deleteRenderbuffer(u.depthBuffer)}}}var yp=.65,gp=new Set(["dimmed","sold"]),xp=new Set(["dimmed","sold","held"]);function Cc(e,t,n){let o=new Set,r=!1,i=Ae.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?xp:gp;for(let c of e){let u=t.get(c.sectionId);if(!u||!u.length){o.add(c.sectionId);continue}let l=!1;for(let m of u){let h=Ae[n[m]]??"available";if(!s.has(h)){l=!0;break}}l?o.add(c.sectionId):r=!0}return{lit:o,anyUnlit:r}}function Rc(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 u=(s.start+s.count)*3;for(let l=s.start*3;l<u;l++)t[l]=c?n[l]:n[l]+(i[l%3]-n[l])*yp;a.push(s)}return a}function Ac(e,t,n,o,r,i){for(let a=n;a<n+o;a++){let c=i&&t[a]===0?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 vp=new Float32Array([-1,-1,3,-1,-1,3]);function Ec(e,t){let n=new ve.Transform,o=new ve.Transform,r=new ve.Geometry(e,{position:{size:2,data:vp}}),i=Pc(e,t.theme.background.top,t.theme.background.bottom),a=new ve.Mesh(e,{geometry:r,program:i});a.frustumCulled=!1,a.setParent(o);let s=new ve.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=Ic(e,s,t.renderBounds),u=Mc(e,t.theme.materials.roughness,t.theme.structure.tierTop);u.uniforms.tVenueShadow={value:c.texture},u.uniforms.uShadowMatrix={value:c.matrix};let l=new ve.Mesh(e,{geometry:s,program:u});l.frustumCulled=!1,l.setParent(n);let m=Sc(e),h=new Float32Array(t.seats.count*3),d=Ae.map(q=>t.theme.seatStates[q]),f=t.seats.iCategory.slice();for(let q=0;q<t.seats.count;q++){if(t.seats.iPhysicalSeat[q]<.5)continue;let oe=t.theme.materials.seat??li([f[q*3],f[q*3+1],f[q*3+2]]);f.set(oe,q*3)}Ac(h,t.seats.iState,0,t.seats.count,d,f);let p=ri(),b=new Uint8Array(t.seats.count),y=new ve.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 ve.Mesh(e,{geometry:y,program:m});g.frustumCulled=!1,t.seats.count>0&&g.setParent(n);let x=y.attributes.iColor,w=t.solids.color.slice(),I=t.theme.structure.ground,v=new Map(t.sectionSolidRanges.map(q=>[q.sectionId,!0])),P=ti(),S=wc(e,t.theme.materials.roughness),M=Bn,C=new Float32Array(M*3),T=new Float32Array(M*3),N=new Float32Array(M),D=new Float32Array(M),R=new Float32Array(M),A=new Float32Array(M*3),L=new Float32Array(M),O=new Float32Array(M),_=new Float32Array(M),k=new Float32Array(M),V=new Float32Array(M),F=new ve.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:C,instanced:1},iColor:{size:3,data:T,instanced:1},iRadius:{size:1,data:N,instanced:1},iYaw:{size:1,data:D,instanced:1},iGlyph:{size:1,data:R,instanced:1},iRing:{size:3,data:A,instanced:1},iFloor:{size:1,data:L,instanced:1},iSection:{size:1,data:O,instanced:1},iPhysicalSeat:{size:1,data:_,instanced:1},iSeed:{size:1,data:V,instanced:1},iPickIndex:{size:1,data:k,instanced:1}}),B=new ve.Mesh(e,{geometry:F,program:S});B.frustumCulled=!1;let z=0,U=!1,G=!1,H=null,K=null,Q=null,Y=new Int32Array(0),W=()=>{let q=t.seats;for(let oe=0;oe<z;oe++){let te=Y[oe];V[oe]=Ti(q.iState[te],te),T[oe*3]=h[te*3],T[oe*3+1]=h[te*3+1],T[oe*3+2]=h[te*3+2]}F.attributes.iColor.needsUpdate=!0,F.attributes.iSeed.needsUpdate=!0},Z={main:n,background:o,seatProgram:m,solidProgram:u,chairProgram:S,seatGeometry:y,chairGeometry:F,solidGeometry:s,drawCalls:3,setNearSeats(q,oe){let te=Math.min(oe,M,q.length);if(hc(b,q,te),y.attributes.iHasChair.needsUpdate=!0,Y=q,z=te,te===0){B.parent&&B.setParent(null),F.instancedCount=0,Z.drawCalls=3+(U?1:0);return}let $=t.seats;for(let ne=0;ne<te;ne++){let he=q[ne];C[ne*3]=$.iPosition[he*3],C[ne*3+1]=$.iPosition[he*3+1],C[ne*3+2]=$.iPosition[he*3+2],N[ne]=$.iChairWidth[he],D[ne]=$.iYaw[he],R[ne]=$.iGlyph[he],A[ne*3]=$.iRing[he*3],A[ne*3+1]=$.iRing[he*3+1],A[ne*3+2]=$.iRing[he*3+2],L[ne]=$.iFloor[he],O[ne]=$.iSection[he],_[ne]=$.iPhysicalSeat[he],k[ne]=he+1}W(),F.attributes.iOffset.needsUpdate=!0,F.attributes.iRadius.needsUpdate=!0,F.attributes.iYaw.needsUpdate=!0,F.attributes.iGlyph.needsUpdate=!0,F.attributes.iRing.needsUpdate=!0,F.attributes.iFloor.needsUpdate=!0,F.attributes.iSection.needsUpdate=!0,F.attributes.iPhysicalSeat.needsUpdate=!0,F.attributes.iSeed.needsUpdate=!0,F.attributes.iPickIndex.needsUpdate=!0,F.instancedCount=te,B.parent||B.setParent(n),Z.drawCalls=4+(U?1:0)},nearSeatCount(){return z},setSectionShellLit(q){u.uniforms.uSectionFilter.value=q===null?0:1;let oe=Rc(t.sectionSolidRanges,t.solids.color,w,v,q,I);if(!oe.length)return;let te=s.attributes.color,$=te.buffer;if(!$){te.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,$);for(let ne of oe){let he=t.solids.color.subarray(ne.start*3,(ne.start+ne.count)*3);e.bufferSubData(e.ARRAY_BUFFER,ne.start*3*Float32Array.BYTES_PER_ELEMENT,he)}},uploadSeatStateRuns(q){if(!q.length)return;z&&W();for(let te of q)Ac(h,t.seats.iState,te.start,te.length,d,f);let oe=x.buffer;if(!oe){x.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,oe);for(let te of q){let $=h.subarray(te.start*3,(te.start+te.length)*3);e.bufferSubData(e.ARRAY_BUFFER,te.start*3*Float32Array.BYTES_PER_ELEMENT,$)}},dispose(){G=!0,c.dispose(),r.remove(),i.remove(),s.remove(),u.remove(),y.remove(),m.remove(),F.remove(),S.remove(),H?.remove(),K?.remove(),Q?.texture&&e.deleteTexture(Q.texture)}},ee=t.productionElements.find(q=>q.contentImageUrl&&q.contentPlane);if(ee?.contentImageUrl&&ee.contentPlane?.length===4&&typeof Image<"u"){let q=new Image;q.crossOrigin="anonymous",q.onload=()=>{if(G)return;let oe=ee.contentPlane;H=new ve.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(ee.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),Q=new ve.Texture(e,{image:q,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),K=new ve.Program(e,{vertex:`#version 300 es
838
+ }`}),m=new He.Transform,h=new He.Mesh(e,{geometry:t,program:l});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:u})}finally{f&&e.enable(e.DITHER),e.clearColor(d[0],d[1],d[2],d[3]),l.remove()}let p=new He.Mat4().multiply(c.projectionMatrix,c.viewMatrix);return{texture:u.depthTexture,matrix:p,dispose(){for(let b of u.textures)e.deleteTexture(b.texture);e.deleteTexture(u.depthTexture.texture),e.deleteFramebuffer(u.buffer),u.depthBuffer&&e.deleteRenderbuffer(u.depthBuffer)}}}var db=.65,hb=new Set(["dimmed","sold"]),pb=new Set(["dimmed","sold","held"]);function Qc(e,t,n){let o=new Set,r=!1,i=Re.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?pb:hb;for(let c of e){let u=t.get(c.sectionId);if(!u||!u.length){o.add(c.sectionId);continue}let l=!1;for(let m of u){let h=Re[n[m]]??"available";if(!s.has(h)){l=!0;break}}l?o.add(c.sectionId):r=!0}return{lit:o,anyUnlit:r}}function Jc(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 u=(s.start+s.count)*3;for(let l=s.start*3;l<u;l++)t[l]=c?n[l]:n[l]+(i[l%3]-n[l])*db;a.push(s)}return a}var el=Re.indexOf("selected");function bb(e,t){return[0,1,2].map(n=>e[n]*.15+.75+t[n]*.1)}function tl(e,t,n,o,r,i){for(let a=n;a<n+o;a++){let s=i&&t[a]===0,c=i&&t[a]===el?bb([i[a*3],i[a*3+1],i[a*3+2]],r[el]??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 yb=new Float32Array([-1,-1,3,-1,-1,3]);function nl(e,t){let n=new Se.Transform,o=new Se.Transform,r=new Se.Geometry(e,{position:{size:2,data:yb}}),i=$c(e,t.theme.background.top,t.theme.background.bottom),a=new Se.Mesh(e,{geometry:r,program:i});a.frustumCulled=!1,a.setParent(o);let s=new Se.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=Zc(e,s,t.renderBounds),u=Yc(e,t.theme.materials.roughness,t.theme.structure.tierTop);u.uniforms.tVenueShadow={value:c.texture},u.uniforms.uShadowMatrix={value:c.matrix};let l=new Se.Mesh(e,{geometry:s,program:u});l.frustumCulled=!1,l.setParent(n);let m=Kc(e),h=new Float32Array(t.seats.count*3),d=Re.map($=>t.theme.seatStates[$]),f=t.seats.iCategory.slice();for(let $=0;$<t.seats.count;$++){if(t.seats.iPhysicalSeat[$]<.5)continue;let ne=t.theme.materials.seat??Ii([f[$*3],f[$*3+1],f[$*3+2]]);f.set(ne,$*3)}tl(h,t.seats.iState,0,t.seats.count,d,f);let p=vi(),b=new Uint8Array(t.seats.count),y=new Se.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 Se.Mesh(e,{geometry:y,program:m});g.frustumCulled=!1,t.seats.count>0&&g.setParent(n);let M=y.attributes.iColor,v=t.solids.color.slice(),R=t.theme.structure.ground,P=new Map(t.sectionSolidRanges.map($=>[$.sectionId,!0])),x=yi(),S=qc(e,t.theme.materials.roughness),w=Hn,I=new Float32Array(w*3),L=new Float32Array(w*3),O=new Float32Array(w),D=new Float32Array(w),A=new Float32Array(w),E=new Float32Array(w*3),T=new Float32Array(w),V=new Float32Array(w),_=new Float32Array(w),k=new Float32Array(w),H=new Float32Array(w),B=new Se.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:I,instanced:1},iColor:{size:3,data:L,instanced:1},iRadius:{size:1,data:O,instanced:1},iYaw:{size:1,data:D,instanced:1},iGlyph:{size:1,data:A,instanced:1},iRing:{size:3,data:E,instanced:1},iFloor:{size:1,data:T,instanced:1},iSection:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:_,instanced:1},iSeed:{size:1,data:H,instanced:1},iPickIndex:{size:1,data:k,instanced:1}}),F=new Se.Mesh(e,{geometry:B,program:S});F.frustumCulled=!1;let G=0,j=!1,N=!1,z=null,K=null,J=null,Y=new Int32Array(0),W=()=>{let $=t.seats;for(let ne=0;ne<G;ne++){let ee=Y[ne];H[ne]=qi($.iState[ee],ee),L[ne*3]=h[ee*3],L[ne*3+1]=h[ee*3+1],L[ne*3+2]=h[ee*3+2]}B.attributes.iColor.needsUpdate=!0,B.attributes.iSeed.needsUpdate=!0},Q={main:n,background:o,seatProgram:m,solidProgram:u,chairProgram:S,seatGeometry:y,chairGeometry:B,solidGeometry:s,drawCalls:3,setNearSeats($,ne){let ee=Math.min(ne,w,$.length);if(Gc(b,$,ee),y.attributes.iHasChair.needsUpdate=!0,Y=$,G=ee,ee===0){F.parent&&F.setParent(null),B.instancedCount=0,Q.drawCalls=3+(j?1:0);return}let q=t.seats;for(let le=0;le<ee;le++){let re=$[le];I[le*3]=q.iPosition[re*3],I[le*3+1]=q.iPosition[re*3+1],I[le*3+2]=q.iPosition[re*3+2],O[le]=q.iChairWidth[re],D[le]=q.iYaw[re],A[le]=q.iGlyph[re],E[le*3]=q.iRing[re*3],E[le*3+1]=q.iRing[re*3+1],E[le*3+2]=q.iRing[re*3+2],T[le]=q.iFloor[re],V[le]=q.iSection[re],_[le]=q.iPhysicalSeat[re],k[le]=re+1}W(),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,F.parent||F.setParent(n),Q.drawCalls=4+(j?1:0)},nearSeatCount(){return G},setSectionShellLit($){u.uniforms.uSectionFilter.value=$===null?0:1;let ne=Jc(t.sectionSolidRanges,t.solids.color,v,P,$,R);if(!ne.length)return;let ee=s.attributes.color,q=ee.buffer;if(!q){ee.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,q);for(let le of ne){let re=t.solids.color.subarray(le.start*3,(le.start+le.count)*3);e.bufferSubData(e.ARRAY_BUFFER,le.start*3*Float32Array.BYTES_PER_ELEMENT,re)}},uploadSeatStateRuns($){if(!$.length)return;G&&W();for(let ee of $)tl(h,t.seats.iState,ee.start,ee.length,d,f);let ne=M.buffer;if(!ne){M.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,ne);for(let ee of $){let q=h.subarray(ee.start*3,(ee.start+ee.length)*3);e.bufferSubData(e.ARRAY_BUFFER,ee.start*3*Float32Array.BYTES_PER_ELEMENT,q)}},dispose(){N=!0,c.dispose(),r.remove(),i.remove(),s.remove(),u.remove(),y.remove(),m.remove(),B.remove(),S.remove(),z?.remove(),K?.remove(),J?.texture&&e.deleteTexture(J.texture)}},te=t.productionElements.find($=>$.contentImageUrl&&$.contentPlane);if(te?.contentImageUrl&&te.contentPlane?.length===4&&typeof Image<"u"){let $=new Image;$.crossOrigin="anonymous",$.onload=()=>{if(N)return;let ne=te.contentPlane;z=new Se.Geometry(e,{position:{size:3,data:new Float32Array(ne.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(te.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),J=new Se.Texture(e,{image:$,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),K=new Se.Program(e,{vertex:`#version 300 es
797
839
  precision highp float;
798
840
  in vec3 position; in vec2 uv; in float floorIndex;
799
841
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -801,4 +843,4 @@ void main() {
801
843
  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
802
844
  precision highp float;
803
845
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
804
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:Q},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let te=new ve.Mesh(e,{geometry:H,program:K});te.frustumCulled=!1,te.setParent(n),Z.screenProgram=K,U=!0,Z.drawCalls=3+(z?1:0)+1},q.src=ee.contentImageUrl}return Z}var Ze=require("ogl");function Mp(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function _c(e,t,n,o,r,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let l=(c*t+u)*4,m=Mp(e[l],e[l+1],e[l+2]);if(m<0||m>=i)continue;let h=u-o,d=c-r,f=h*h+d*d;f<s&&(s=f,a=m)}return a}function Tc(e,t,n,o,r,i){let a=e-n.left,s=t-n.top,c=Math.round(a*o),u=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(r-1,c)),y:Math.max(0,Math.min(i-1,u))}}var Sp=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],bo=class{constructor(t,n,o,r,i){this.seatScene=new Ze.Transform;this.chairScene=new Ze.Transform;this.solidScene=new Ze.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=gc(this.gl),this.chairProg=xc(this.gl),this.depthProg=vc(this.gl);let a=new Ze.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ze.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ze.Mesh(this.gl,{geometry:r,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let o of Sp)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 Ze.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,u=Math.max(0,n-r),l=Math.max(0,o-r),m=Math.max(1,Math.min(s,n+r+1)-u),h=Math.max(1,Math.min(c,o+r+1)-l);i.enable(i.SCISSOR_TEST),i.scissor(u,l,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(u,l,m,h,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),_c(b,m,h,n-u,o-l,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function kc(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,cn(o.state)):n.push(o);return n}function Lc(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:Ae[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 gt=require("ogl");function wp(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Fc(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Pp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Dc(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 Lr(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Fr(e,t){return Math.max(0,Math.min(1,e+t))}function Oc(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],u=e[i+1],l=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]+u[f])*a+(2*s[f]-5*c[f]+4*u[f]-l[f])*m+(-s[f]+3*c[f]-3*u[f]+l[f])*h);return d}function Dr(e,t,n,o,r){let i=Dc(wp(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Fc(Fc(t,Pp(i,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=Dc(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,r),l=[o[0]+c[0]*u*1.3,o[1]+u*.75,o[2]+c[2]*u*1.3];return{waypoints:[e,l,a],finalPos:a}}function Or(e,t,n=35,o=28){let r=Lr(t),i=Oc(e,r),a=Lr(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(o-n)*a,eased:r}}function Gc(e,t,n){let o=e.position.clone(),r=new gt.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new gt.Vec3(n[0],n[1],n[2]));let i=new gt.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(r),i}var yo=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new gt.Quat;this.endQuat=new gt.Quat;this.outQuat=new gt.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}=Or(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,Fr(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 Hc=Bo,Ip=.12,Cp=.25,Rp=1.5;function zc(e,t,n=0,o,r){let i=[t.x*E,n+Rp,t.y*E],a=r?[r[0],r[1],r[2]]:i,s=e[1],c=Number.isFinite(s)?s+Hc:Number.isFinite(o)?n+o:n+Hc,u=i[0]-e[0],l=i[2]-e[2],m=Math.hypot(u,l),h=m>.001?Math.min(Ip,m*Cp):0,d=m>.001?u/m:0,f=m>.001?l/m:0;return{eye:[e[0]+d*h,c,e[2]+f*h],focal:a}}var kt=Math.PI/180,Ap=45,Uc=80,go=70,Ep=1,_p=.99;function Tp(e,t){if(!(e<Ep))return Uc;if(!(Number.isFinite(t)&&t>0))return go;let n=2*Math.atan(t/(2*xo*_p)/Math.max(.05,e))/kt;return Math.max(go,Math.min(Uc,n))}var kp=.25,xo=1,Lp=.25,Fp=12*kt,Dp=.2,Op=1.5,jc=.8,Xc=6,qc=1.9,Bp=2/3,Np=.12,Vp=.9,Gp=1.2,Hp=2,$c=.05,zp=6;function Zc(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+jc,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,u=a-i,l=Math.max(c,Math.min(u,Xc))/2,m=Math.max(u,Math.min(c,Xc))/2,h=(o+r)/2,d=(i+a)/2;return{min:[h-l,n,d-m],max:[h+l,Math.max(n+jc,s),d+m]}}function Up(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+qc,e.max[2]]}}function Br(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Op,t+Dp,t+qc*Bp),(e.min[2]+e.max[2])/2]}function Qc(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 Wc(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,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let l=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($c,d*o+f*r+p*i),y=(d*s+p*c)/b;y<l&&(l=y),y>m&&(m=y)}return m-l}function Yc(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,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let l=-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],x=Math.max($c,b*o+y*r+g*i),w=(b*l+y*m+g*h)/x;w<d&&(d=w),w>f&&(f=w)}return f-d}function vo(e,t){return Math.tan(e*kt/2)*Math.max(.05,t)}function Kc(e,t,n){let o=Tp(n,e),r=c=>Math.max(Ap,Math.min(o,c)),i=c=>2*Math.atan(c)/kt,a=Number.isFinite(e)&&e>0?r(i(e/(2*kp)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,r(i(t/(2*Np))));return e/(2*vo(s,n))>xo?a:s}function Jc(e,t,n,o={}){let r=Br(t),i=[e[0],e[1],e[2]],a=0,s=0,c=f=>{if(!(f>0))return;let p=Qc(i,r);i[0]+=p.x*f,i[2]+=p.z*f,s+=f},u=o.preserveEye?0:t.max[1]+Lp-i[1];u>0&&(i[1]+=u,a=u,c(u/Math.tan(Fp)));let l=Up(t),m=Wc(i,r,t),h=Kc(m,Yc(i,r,l),n),d=m/(2*vo(h,n));for(let f=0;!o.preserveEye&&f<zp&&d>xo;f++){let p=Math.max(1,Math.hypot(i[0]-r[0],i[2]-r[2])),b=Number.isFinite(d)?d/xo:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=Wc(i,r,t),h=Kc(m,Yc(i,r,l),n),d=m/(2*vo(h,n))}return{eye:i,focal:r,fov:h,raisedM:a,pulledBackM:s,stageFrameWidth:d}}function jp(e,t,n){let o=Math.tan(t*kt/2),r=vo(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,r)))}function el(e,t){let{aspect:n,venue:o}=t,r=e.focal,i=Qc(e.eye,r),a=h=>(h[0]-r[0])*i.x+(h[2]-r[2])*i.z,s=[{name:"seat",eye:e.eye,focal:r,fov:e.fov}],c=Hp*(t.rowDepthM??Vp);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Gp,e.eye[2]+i.z*c],focal:r,fov:e.fov});let u=(h,d,f,p)=>{let b=jp(f,e.fov,n)*1.08,y=b*Math.sin(p*kt),g=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,x=Math.max(y,g-d[1]),w=b*Math.cos(p*kt);return{name:h,eye:[d[0]+i.x*w,d[1]+x,d[2]+i.z*w],focal:d,fov:e.fov}};t.section&&t.section.radius>0&&s.push(u("section",t.section.center,t.section.radius,35)),s.push(u("venue",o.center,Math.max(1,o.radius),40));let l=[],m=-1/0;for(let h of s){let d=a(h.eye);l.length&&d<=m+.5||(l.push(h),m=d)}return l}var il=require("ogl"),Cn=Math.PI/180,tl=320,nl=70*Cn,Xp=32*Cn,Wp=24*Cn,ol=.0026,Yp=.22,Kp=.006,qp=180,$p=4,Ne=(e,t,n)=>Math.max(t,Math.min(n,e)),rl=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function al(e){let{canvas:t,camera:n}=e,o=[],r=!1,i=0,a=0,s=0,c=0,u=0,l=0,m=!1,h=[0,0],d=0,f=!1,p=null,b=null,y=new Map,g=!1,x=0,w=0,I=0,v=0,P=()=>r&&o.length?o[Ne(Math.round(i),0,o.length-1)].name:null,S=()=>{let k=P();k!==p&&(p=k,e.onStopChange?.(k))},M=()=>{if(!r||!o.length)return;let k=o[Ne(Math.floor(i),0,o.length-1)],V=o[Ne(Math.ceil(i),0,o.length-1)],F=Ne(i-Math.floor(i),0,1),B=(oe,te)=>oe+(te-oe)*F,z=[B(k.eye[0],V.eye[0]),B(k.eye[1],V.eye[1]),B(k.eye[2],V.eye[2])],U=[B(k.focal[0],V.focal[0]),B(k.focal[1],V.focal[1]),B(k.focal[2],V.focal[2])],G=U[0]-z[0],H=U[1]-z[1],K=U[2]-z[2],Q=Math.hypot(G,H,K)||1,Y=Math.atan2(G,K),W=Math.asin(Ne(H/Q,-1,1)),Z=Y+a,ee=Ne(W+s,-80*Cn,80*Cn),q=Math.cos(ee)*Q;G=Math.sin(Z)*q,H=Math.sin(ee)*Q,K=Math.cos(Z)*q,n.position.set(z[0],z[1],z[2]),n.fov=B(k.fov,V.fov),n.updateProjectionMatrix(),n.lookAt(new il.Vec3(z[0]+G,z[1]+H,z[2]+K)),e.onApplied?.()},C=()=>{if(!r||!o.length)return;let k=Ne(Math.round(i),0,o.length-1);if(e.reducedMotion()){m=!1,i=k,M(),S(),e.requestRender();return}if(Math.abs(k-i)<.001){m=!1,S();return}c=i,u=k,l=performance.now(),m=!0,e.requestRender()},T=k=>{!r||o.length<2||(m=!1,i=Ne(i+k,0,o.length-1),M(),S(),e.requestRender())},N=(k,V)=>{r&&(m=!1,f=!1,a=Ne(a-k*ol,-nl,nl),s=Ne(s-V*ol,-Wp,Xp),M(),e.requestRender())},D=k=>{r&&(y.set(k.pointerId,{x:k.clientX,y:k.clientY}),y.size===1?(g=!0,v=0,x=k.clientX,w=k.clientY):y.size===2&&(g=!1,I=R()))},R=()=>{let k=[...y.values()];return k.length<2?0:Math.hypot(k[0].x-k[1].x,k[0].y-k[1].y)},A=k=>{if(!r||!y.has(k.pointerId))return;if(y.set(k.pointerId,{x:k.clientX,y:k.clientY}),y.size>=2){let B=R();I>0&&T((I-B)*Kp),I=B;return}if(!g)return;let V=k.clientX-x,F=k.clientY-w;x=k.clientX,w=k.clientY,v+=Math.abs(V)+Math.abs(F),!(v<=$p)&&N(V,F)},L=k=>{y.delete(k.pointerId)&&(y.size<2&&(I=0),y.size===0&&(g=!1,C()))},O=k=>{if(!r)return;k.preventDefault();let V=k.deltaMode===1?16:k.deltaMode===2?100:1,F=Ne(k.deltaY*V/100,-2,2);T(F*Yp),b&&clearTimeout(b),b=setTimeout(()=>{b=null,C()},qp)},_=()=>{r&&(r=!1,m=!1,f=!1,o=[],y.clear(),g=!1,b&&(clearTimeout(b),b=null),p!==null&&(p=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",D),t.addEventListener("pointermove",A),t.addEventListener("pointerup",L),t.addEventListener("pointercancel",L),t.addEventListener("wheel",O,{passive:!1}),{get active(){return r},enter(k){if(k.length<2){_();return}o=k,r=!0,i=0,a=0,s=0,m=!1,f=!1,p=null,M(),S(),e.requestRender()},exit:_,recentre(){return r?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,M(),e.requestRender(),!0):(h=[a,s],d=performance.now(),f=!0,e.requestRender(),!0):!1},update(k){if(!r)return!1;let V=!1;if(f){let F=Ne((k-d)/tl,0,1),B=1-rl(F);a=h[0]*B,s=h[1]*B,F>=1?(f=!1,a=0,s=0):V=!0}if(m){let F=Ne((k-l)/tl,0,1);i=c+(u-c)*rl(F),F>=1?(m=!1,i=u,S()):V=!0}return M(),V},currentStop:P,dispose(){_(),t.removeEventListener("pointerdown",D),t.removeEventListener("pointermove",A),t.removeEventListener("pointerup",L),t.removeEventListener("pointercancel",L),t.removeEventListener("wheel",O)}}}function sl(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Hr=null;function vl(){return Hr??=Promise.resolve().then(()=>(xl(),gl)).catch(e=>{throw Hr=null,e}),Hr}var Ml=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Ro=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=Ml(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Ml()-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 Sl(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function wl(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"})},u=()=>{s?.remove(),s=null};return{show:(m,h,d=!1)=>{if(u(),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(C=>C.id===y.sectionId):void 0,x=y?.label??m;f.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${x}`);let w=document.createElement("span");w.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",g?.label,x].filter(Boolean).join(" \xB7 "),Object.assign(w.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(w);let I=document.createElement("div");Object.assign(I.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(I);let v=y?.rowId?i.get(y.rowId):void 0,P=v?.indexOf(m)??-1,S=P>=0?[v?.[P-1],v?.[P+1]]:[void 0,void 0],M=(C,T,N,D=!1)=>{let R=document.createElement("button");R.type="button",R.textContent=C,R.setAttribute("aria-label",T),Object.assign(R.style,{minHeight:"44px",padding:D?"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"}),D||(R.style.minWidth="44px"),D&&(R.dataset.panoramaTrigger=""),R.addEventListener("click",N),I.appendChild(R)};if(b&&S[0]){let C=r.get(S[0])?.label??S[0];M("\u2039",`View previous seat ${C}`,()=>{e.flyToSeat(S[0])})}if(b&&o.getSeatView){let C=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";M(d?`\u21BB Retry ${C}`:`\u25C9 ${C}`,`${d?"Retry":C} from seat ${x}`,()=>{if(e.isDisposed()||h!==e.flightGen()){u();return}u(),e.openPanorama(m,400,h)},!0)}if(b&&S[1]){let C=r.get(S[1])?.label??S[1];M("\u203A",`View next seat ${C}`,()=>{e.flyToSeat(S[1])})}return!I.childElementCount&&!p?null:(t.appendChild(f),s=f,c(),f)},remove:u,layout:c}}var mb={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Pl(e){let{container:t,orbit:n,isNarrow:o}=e,r={...mb,...e.labels??{}},i=(x,w)=>{x.setAttribute("aria-label",w),x.title=w},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 u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",i(l,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 x of[l,m,h,d])x.className="sl-3d-icon-control",Object.assign(x.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,m),u.append(d,h);let f=x=>{n.setPrimaryDragMode(x);let w=x==="orbit";l.setAttribute("aria-pressed",String(w)),m.setAttribute("aria-pressed",String(!w)),l.style.background=w?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=w?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=w?`${r.rotate} \xB7 ${r.move} with Shift`:`${r.move} \xB7 ${r.rotate} with Shift`};l.addEventListener("click",()=>f("orbit")),m.addEventListener("click",()=>f("pan"));let p=()=>{let{atMin:x,atMax:w}=n.dollyLimitState();d.disabled!==x&&(d.disabled=x),h.disabled!==w&&(h.disabled=w)};h.addEventListener("click",()=>{n.zoomBy(ln),p()}),d.addEventListener("click",()=>{n.zoomBy(Dt),p()}),a.append(c,u),f("orbit"),t.appendChild(a);let b=e.enabled!==!1,y=()=>{let x=o();a.style.display=s||!b?"none":"flex",a.style.right=x?"12px":"14px",a.style.bottom=x?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=x?"none":"flex",d.style.display=x?"none":"",h.style.display=x?"none":""};return y(),{element:a,utilityControls:u,setNavigationMode:f,syncZoomLimits:p,setSeatViewLocked:x=>{s=x,n.setInteractionEnabled(!x),y()},seatViewLocked:()=>s,layout:y}}var fb=12;function db(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)>fb}function Il(e){let{glctx:t,orbit:n,model:o,seats:r,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:l,tapMs:m,cancelFlight:h,focusSectionCamera:d,setSelection:f,ensureSeatView:p}=e,b=0,y=0,g=0,x=-1,w=!1,I=!1,v=T=>{e.seatViewLocked()||x===-1&&(x=T.pointerId,b=T.clientX,y=T.clientY,g=performance.now(),w=!1,I=a.active,a.active&&(s.cinematicCancelled(),h(),i.onViewTargetChange?.(null)))},P=T=>{T.pointerId===x&&Math.hypot(T.clientX-b,T.clientY-y)>l&&(w=!0)},S=(T,N,D,R,A)=>{let L=t.canvas.getBoundingClientRect(),O=t.canvas.clientWidth||L.width||1,_=t.canvas.clientHeight||L.height||1,k=T-L.left,V=N-L.top,F=R*R,B=-1,z=F,U=1/0;for(let G of r){if(D&&G.sectionId!==D)continue;let H=o.seats.idToIndex.get(G.id);if(H===void 0)continue;if(A){let ee=Math.round(o.seats.iState[H]??0);if(ee!==0&&ee!==3)continue}let K=H*3,Q=bt(n.camera.projectionViewMatrix,[o.seats.iPosition[K],o.seats.iPosition[K+1]+.55,o.seats.iPosition[K+2]],O,_);if(!Q.visible)continue;let Y=Q.x-k,W=Q.y-V,Z=Y*Y+W*W;(Z<z||Math.abs(Z-z)<1&&Q.depth<U)&&(B=H,z=Z,U=Q.depth)}return B},M=(T,N)=>{let D=e.gpu(),R=e.pick();if(!D||!R)return-1;R.syncFromSeatProgram(D.seatProgram);let A=t.canvas.getBoundingClientRect(),L=t.renderer.dpr,{x:O,y:_}=Tc(T,N,A,L,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),k=Math.max(2,Math.round(8*L));return R.pick(n.camera,O,_,k)};return{onDown:v,onMove:P,onUp:T=>{if(T.pointerId!==x)return;let N=!w&&performance.now()-g<m;if(x=-1,I){I=!1;return}let D=e.gpu(),R=e.pick();if(!N||!D||!R)return;let A=M(T.clientX,T.clientY);if(e.focusedSectionId()&&A>=0){let _=c[A],k=_?u.get(_):void 0;if(k&&k!==e.focusedSectionId()&&d(k))return}if(e.focusedSectionId()&&A<0&&(A=S(T.clientX,T.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&A<0){let _=S(T.clientX,T.clientY,null,72,!1),k=_>=0?c[_]:void 0,V=k?u.get(k):void 0;if(V&&V!==e.focusedSectionId()&&d(V))return}if(!e.focusedSectionId()){A<0&&(A=S(T.clientX,T.clientY,null,42,!1));let _=A>=0?c[A]:void 0,k=_?u.get(_):void 0;if(k&&d(k))return}if(A<0||A>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let L=c[A],O=Ae[Math.round(o.seats.iState[A]??0)]??"available";if(O!=="available"&&O!=="selected"){i.onSeatInspect?.(L,O);return}if(e.selection().has(L)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(L);return}if(f([L]),p(L),s.seatPicked(L,u.get(L)),i.onSeatPick?.(L),e.focusedSectionId()){let _=A*3,k=[o.seats.iPosition[_],o.seats.iPosition[_+1],o.seats.iPosition[_+2]];db(n.camera?.position,k)&&e.focusSeatCamera(L)}}}}var Ao=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,u=new Int32Array(c+1),l=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++)u[l(d)+1]++;for(let d=0;d<c;d++)u[d+1]+=u[d];let m=new Int32Array(this.count),h=u.slice(0,c);for(let d=0;d<this.count;d++)m[h[l(d)]++]=d;this.cellStart=u,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,u=o*o,l=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=l-p,x=l+p;for(let w=b;w<=y&&f<c;w++){if(w<0||w>=this.rows)continue;let I=w===b||w===y;for(let v=g;v<=x&&f<c;v++){if(!I&&v!==g&&v!==x){v=x-1;continue}if(v<0||v>=this.cols)continue;let P=w*this.cols+v;for(let S=a[P],M=a[P+1];S<M&&f<c;S++){let C=s[S],T=d[C*3]-t,N=d[C*3+2]-n,D=i===void 0?0:d[C*3+1]-i;T*T+D*D+N*N<=u&&(r[f++]=C)}}}}return f}};var Eo=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Bn);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new Ao(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)<jo)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>Uo){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(r.x,r.z,Uo,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 Cl(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*1.2);return{center:[e.center[0]+n/r*i,e.center[1],e.center[2]+o/r*i],radius:t+i*.4,azimuth:Math.atan2(-n,-o),polarDeg:50}}var _o=require("ogl");function Rl(){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 _l(e){let{container:t,model:n,opts:o,orbit:r,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:l}=e,m=0,h=-1,d=(P,S,M=28)=>{r.camera.position.set(P[0],P[1],P[2]),r.camera.lookAt(new _o.Vec3(S[0],S[1],S[2])),r.camera.fov=M,r.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.replaceChildren(Rl());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(Rl())};b();let y=P=>{h=P;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=P,S.solidProgram.uniforms.uFocusFloor.value=P,S.chairProgram.uniforms.uFocusFloor.value=P),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 P=h>=0?n.floors[h]:null;if(e.setNearFieldDetailEnabled(!!P),e.setSeatViewLocked(!1),x(),e.removeArriveChip(),e.setNavigationMode("orbit"),P){let S=P.focalWorld[0]-P.center[0],M=P.focalWorld[2]-P.center[2],C=Math.hypot(S,M)>P.radius*.12?Math.atan2(S,M):u,T={center:P.center,radius:P.radius,box:P.box},N={polarDeg:58,margin:1.12};e.reducedMotion()?r.frame(T,!1,C,!1,N):r.frameSoft(T,C,!1,N)}else e.reducedMotion()?r.frame(n.bounds,!1,u,o.portraitOverviewCrop===!0,l):r.frameSoft(n.bounds,u,o.portraitOverviewCrop===!0,l);e.showSectionSeatLabels(null),s.requestRender()},x=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),r.resumeAfterFlight(n.focalWorld))},w=P=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(P);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(P),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 M=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(M),e.setSeatViewLocked(!1);let C=++m;M?e.showArriveChip(P,C):e.removeArriveChip();let{eye:T,focal:N}=e.resolvedSeatViewPose(P,S),D=o.arriveAtSeatEye?e.seatViewArrival(P,S):null,R=D?D.focal:N,A=[r.camera.position.x,r.camera.position.y,r.camera.position.z],L=Dr(A,D?.eye??T,R,n.bounds.center,n.bounds.radius),O=D?D.eye:o.arriveAtSeatEye?T:L.finalPos,_=D?D.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?go:65:28,k=[L.waypoints[0],L.waypoints[1],O];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),d(O,R,_),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||r.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),D&&e.enterSeatView(D.stops),e.showArriveChip(P,C),Promise.resolve();let V=new _o.Quat().copy(r.camera.quaternion),F=Gc(r.camera,O,R);s.requestRender();let B=M?700:2500;return i.start(k,V,F,B,_).then(()=>{e.isDisposed()||C!==m||(e.setSeatStepping(!1),a.cinematicPlayed(B),r.resumeAfterFlight(R),e.setSeatViewLocked(o.arriveAtSeatEye===!0),D&&e.enterSeatView(D.stops),s.requestRender(),e.showArriveChip(P,C))})},I=P=>{let S=n.sections.find(C=>C.id===P);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&h!==S.floorIndex&&y(S.floorIndex),e.setNavigationMode("pan"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(P);let M=Cl(S);return r.frame({center:M.center,radius:M.radius},!1,M.azimuth,!1,{polarDeg:M.polarDeg,margin:1.12}),o.onSectionFocusChange?.(P),s.requestRender(),!0},v=P=>{if(e.isDisposed()||!e.gpu())return!1;let S=n.seats.idToIndex.get(P);if(S===void 0)return!1;let M=S*3,C=[n.seats.iPosition[M],n.seats.iPosition[M+1]+.55,n.seats.iPosition[M+2]];return e.reducedMotion()?r.frame({center:C,radius:Al},!1,void 0,!1,El):r.frameSoft({center:C,radius:Al},void 0,!1,El),s.requestRender(),!0};return f.addEventListener("click",g),{overviewChip:f,layoutOverviewChip:b,flightGen:()=>m,focusedFloor:()=>h,applyFloorFocus:y,placeCameraFinal:d,cancelFlight:x,focusOverview:g,flyToSeat:w,focusSectionCamera:I,focusSeatCamera:v}}var Al=4.5,El={polarDeg:48,margin:1.25};function An(e,t){let{doc:n,report:o}=lo(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])),u=d=>d.map(f=>f.type==="shape"&&c.has(f.id)?{...f,role:c.get(f.id)}:f),l=e.floors?.map(d=>({...d,objects:u(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:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:m,focal:h}}let i=new Map(Gt(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,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(a[u]=l.eyeHeightM),l.focalPoint&&(s[u*2]=l.focalPoint.x,s[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function zr(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 Tl(e){let t=e.estimate===!1?null:An(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:zr(e.seats,t)},estimate:t}:{input:e}}var pb={};function kl(e){let t=performance.now(),{input:n,estimate:o}=Tl(e);return{model:Kt(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function hb(e){let t=Gt(e.doc);return{...kl({...e,seats:t}),seats:t}}function Ll(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let o;try{o=new Worker(new URL("./scene/scene.worker.js",pb.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(r=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),o.terminate(),r(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);o.onerror=s,o.onmessage=u=>{let l=n(u.data);l?a(l):s()},o.postMessage(e)})}function Fl(e){return Ll(e,()=>kl(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function Dl(e){return Ll(e,()=>hb(e),({model:t,buildMs:n,seats:o,estimate:r})=>o?{model:t,buildMs:n,seats:o,source:"worker",...r?{estimate:r}:{}}:null)}var bb=Math.PI/180,yb=6,gb=500;function xb(e,t,n={}){let o=performance.now(),r=t.prepared?t.prepared.estimate:t.estimate===!1?null:An(t.doc,t.seats);r&&(t={...t,doc:r.doc,seats:zr(t.seats,r)});let i=t.prepared?.model??Kt(t),a=new Ro(n.onAnalytics),s=new Array(i.seats.count);for(let[j,X]of i.seats.idToIndex)s[X]=j;let c=new Map(t.seats.map(j=>[j.id,j])),u=new Map;for(let j of t.seats){if(!j.rowId)continue;let X=u.get(j.rowId);X?X.push(j.id):u.set(j.rowId,[j.id])}let l=new Map;t.seats.forEach((j,X)=>{l.set(j.id,i.seatSectionIds?.[X]??j.sectionId)});let m=new Map;for(let[j,X]of i.seats.idToIndex){let J=l.get(j);if(!J)continue;let ce=m.get(J);ce?ce.push(X):m.set(J,[X])}let h=()=>{if(!f||!i.sectionSolidRanges.length)return;let{lit:j,anyUnlit:X}=Cc(i.sectionSolidRanges,m,i.seats.iState);f.setSectionShellLit(X?j: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=!1,y=!1,g=!1,x=new Map,w=null,I=null,v=null,P=new Map,S=null,M=()=>{v===null&&(v=e.style.zIndex,e.style.zIndex="20")},C=()=>{v!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=v),v=null)},T=!1,N=()=>T?Ce.focusedFloor():-1,D=()=>{f=Ec(O.gl,i),h(),ee(),p=new bo(O.renderer,f.seatGeometry,f.chairGeometry,f.solidGeometry,i.seats.count),O.setClearColor(i.theme.background.top),p.setRestoreClear(i.theme.background.top),f.seatProgram.uniforms.uSeatRadius.value=et*i.theme.seatScale,f.seatProgram.uniforms.uFocusFloor.value=N(),f.solidProgram.uniforms.uFocusFloor.value=N(),f.chairProgram.uniforms.uFocusFloor.value=N(),f.screenProgram&&(f.screenProgram.uniforms.uFocusFloor.value=N()),A.forceRegather()},R=!1,A=new Eo({model:i,orbit:()=>_,gpu:()=>f}),L=j=>A.setDetailEnabled(j),O=new Fn(e,{onContextLost:()=>{g||a.contextLost(),b=!0,ne.stop(),f=null,p=null},onContextRestored:()=>{D(),b=!1,g||a.contextRestored(),ne.requestRender()}}),_=new Dn(O.gl,O.canvas,()=>ne.requestRender(),()=>a.orbitEngaged());_.setAspect(O.aspect);let k=(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&j.physical3dProvenance?.surfaceKind?.status==="inferred"),V=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(k&&i.stages.length===0))return $r(i.focalWorld,i.seats.iPosition,i.bounds)})(),F=(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="shape"&&j.stageKind?.startsWith("pitch-")),B=i.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:F?36:48,margin:1.05},z=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;_.frame(i.bounds,!z&&n.skipInitialOverviewAnimation!==!0,V,n.portraitOverviewCrop===!0,B);let U=new yo(_.camera),G=Sl(e),H=new fo(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:i.theme.background.top}),K=i.labels,Q=()=>Ls(K,i.floors.length,N());H.setLabels(Q());let Y=null,W=()=>[...x.keys()].flatMap(j=>{let X=i.seats.idToIndex.get(j),J=X===void 0?void 0:t.seats[X];if(X===void 0||J?.id!==j)return[];let ce=X*3;return[{id:`seat:${j}`,kind:"seat",seatWidthM:i.seats.iChairWidth[X]*2,text:J.displayLabel||J.label,anchor:[i.seats.iPosition[ce],i.seats.iPosition[ce+1]+1.05,i.seats.iPosition[ce+2]]}]}),Z=-1,ee=()=>{f&&(Z=Y?i.sections.findIndex(j=>j.id===Y):-1,f.seatProgram.uniforms.uFocusSection.value=Z,f.chairProgram.uniforms.uFocusSection.value=Z)},q=j=>{if(Y=j,ee(),H.setForcedDense(!!j),!j){let se=W(),Re=new Set(se.map(Me=>Me.id));H.setLabels([...Q().filter(Me=>!Re.has(Me.id)),...se]);return}let X=t.seats.filter(se=>l.get(se.id)===j),J=new Set(X.map(se=>se.id)),ce=new Set(X.map(se=>se.rowId)),fe=new Set(x.keys()),be=new Set(X.filter(se=>fe.has(se.id)).map(se=>se.id)),xe=Q().filter(se=>se.kind!=="row"&&se.kind!=="seat"||(se.kind==="row"?ce.has(se.id.slice(4)):J.has(se.id.slice(5))&&(be.size===0||be.has(se.id.slice(5)))));if(i.seatCount<=6e3&&be.size===0){H.setLabels(xe);return}let we=be.size?X.filter(se=>be.has(se.id)):X,St=new Set(we.map(se=>`seat:${se.id}`)),wt=we.flatMap(se=>{let Re=i.seats.idToIndex.get(se.id);if(Re===void 0)return[];let Me=Re*3;return[{id:`seat:${se.id}`,kind:"seat",seatWidthM:i.seats.iChairWidth[Re]*2,text:fe.has(se.id)?se.displayLabel||se.label:Pr(se.displayLabel||se.label),anchor:[i.seats.iPosition[Me],i.seats.iPosition[Me+1]+(fe.has(se.id)?1.05:.55),i.seats.iPosition[Me+2]]}]});H.setLabels([...xe.filter(se=>!St.has(se.id)),...wt])};D();let oe=null,te=null,$=j=>{if(b||!f||y)return!1;let X=sl({flying:U.active,panoramaMounted:w!==null,seatViewActive:oe?.active===!0}),J=X==="orbit"?Z:-1;f.seatProgram.uniforms.uFocusSection.value=J,f.chairProgram.uniforms.uFocusSection.value=J;let ce=X==="cinematic"?U.update(performance.now()):X==="seatView"?oe.update(performance.now()):X==="orbit"?_.update():!1;te?.syncZoomLimits();let fe=N()>=0?i.floors[N()]:null,be=fe?.radius??i.bounds.radius,xe=xi(_.currentDistance,be),we=R?{center:[_.camera.position.x,_.camera.position.y,_.camera.position.z],radius:520}:i.clipBounds??i.renderBounds;_.updateClipping(we);let St=fe?.center??i.renderBounds.center,wt=fe?.radius??i.renderBounds.radius,se=(ze,Pt)=>Math.hypot(_.camera.position.x-ze[0],_.camera.position.y-ze[1],_.camera.position.z-ze[2])<=Pt*(A.detailVisible?1.8:1.55),Re=se(St,wt);if(!Re&&Y){let ze=i.sections.find(Pt=>Pt.id===Y);ze&&(Re=se(ze.center,Math.max(12,ze.radius*2)))}A.detailVisible=Re;let Me=f.seatProgram.uniforms;Me.uSeatScale.value=xe.scale,Me.uSeatFade.value=xe.fade;let _n=!!fe&&vi(fe.seatCount,O.canvas.clientWidth||1,O.canvas.clientHeight||1),Tn=Mi(i.seats.count,be,_.currentDistance,_.camera.fov,O.canvas.clientHeight||1),tn=A.detailVisible||_n||Tn?1:0,nn=A.detailVisible||N()>=0||i.floors.length>1?1:0;A.ease(j,tn,nn),Me.uSeatDetail.value=A.seatDetailMix;let kn=tn===0&&A.seatDetailMix<.01;return f.seatGeometry.setDrawRange(kn?No:0,kn?oi:No),f.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,Me.uMinPixels.value=xe.minPixels,Me.uPixelToWorld.value=2*Math.tan(_.camera.fov*bb/2)/Math.max(1,O.pixelHeight),A.update(A.detailVisible),O.renderer.render({scene:f.background,clear:!0}),O.renderer.render({scene:f.main,camera:_.camera,clear:!1}),H.update(_.camera.projectionViewMatrix,O.canvas.clientWidth||1,O.canvas.clientHeight||1,_.currentDistance,be,[_.camera.position.x,_.camera.position.y,_.camera.position.z]),ce||A.seatDetailMix!==tn||A.structureDetailMix!==nn},ne=new On($),he=typeof ResizeObserver<"u"?new ResizeObserver(()=>Do.resize()):null;he?.observe(e);let Te=j=>{let X=fe=>{let be=i.seats.idToIndex.get(fe);return be===void 0?void 0:i.seats.iState[be]},{updates:J,next:ce}=Lc(x,j,X);if(x=ce,H.setSelectedSeatIds(x.keys()),q(Y),J.length){let fe=qo(i.seats,J);f&&f.uploadSeatStateRuns(fe),h(),ne.requestRender()}},Pe=()=>S!==null?S:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ke=8,Se=j=>{if(!n.getSeatView)return null;let X=P.get(j);if(!X)for(X=Promise.resolve(n.getSeatView(j)),P.set(j,X),X.catch(()=>{P.get(j)===X&&P.delete(j)});P.size>ke;){let J=P.keys().next().value;if(J===void 0)break;P.delete(J)}return X},Je=Zc(i.stages,i.focalWorld,i.bounds.groundY??0),Zt=Br(Je),it=(j,X)=>{let J=c.get(j),ce=Math.max(0,Math.round(i.seats.iFloor[X]??0)),fe=t.doc.floors?.[ce],be=i.floors[ce],xe=fe?.focalPoint??t.doc.focalPoint,we=be?{x:be.focalWorld[0]/E,y:be.focalWorld[2]/E}:xe,St=J?.focalPoint?{x:J.focalPoint.x+we.x-xe.x,y:J.focalPoint.y+we.y-xe.y}:we,wt=[i.seats.iPosition[X*3],i.seats.iPosition[X*3+1],i.seats.iPosition[X*3+2]];return zc(wt,St,fe?.baseHeightM??0,J?.eyeHeightM,Zt)},at=()=>(e.clientWidth||O.canvas.clientWidth)<=520,vt=null,Qt=null,Ol=async(j,X,J)=>{if(!n.getSeatView||g||J!==Ce.flightGen())return;let ce;try{ce=await vl()}catch{if(a.panoramaFailed(j,"mount"),!g&&J===Ce.flightGen()){let fe=ko(j,J,!0);requestAnimationFrame(()=>fe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(g||J!==Ce.flightGen()||!vt))return Qt??=ce.createOpenPanorama(vt),Qt(j,X,J)},To=wl({container:e,model:i,opts:n,expandedSeatById:c,seatIdsByRow:u,isNarrow:at,isDisposed:()=>g,flightGen:()=>Ce.flightGen(),flyToSeat:j=>Wr(j),openPanorama:(j,X,J)=>Ol(j,X,J)}),ko=To.show,Lo=To.remove,Bl=To.layout,Mt=Pl({container:e,orbit:_,isNarrow:at,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});te=Mt;let Nl=Mt.element,Jt=Mt.setNavigationMode,Vl=Mt.layout,Gl=Mt.utilityControls,en=null,Ur=!1,En=j=>{Mt.setSeatViewLocked(j),j||oe?.exit()};oe=al({canvas:O.canvas,camera:_.camera,requestRender:()=>ne.requestRender(),reducedMotion:Pe,onStopChange:j=>{let X=j??(Ur?"seat":null);en=X;try{n.onSeatViewStopChange?.(X)}catch{}},onApplied:()=>{g||_.syncFromCamera()}});let jr=i.sections.reduce((j,X)=>X.seatCount>0&&X.box?Math.max(j,X.box.max[1]):j,-1/0),Hl=(j,X)=>{let{eye:J}=it(j,X),ce=(e.clientWidth||O.canvas.clientWidth||1)/Math.max(1,e.clientHeight||O.canvas.clientHeight||1),fe=Jc(J,Je,ce,{preserveEye:!0});if(n.seatViewStops===!1)return{...fe,stops:[]};let be=l.get(j),xe=be?i.sections.find(we=>we.id===be):void 0;return{...fe,stops:el(fe,{aspect:ce,seatingTopY:Number.isFinite(jr)?jr: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}})}},Ce=_l({container:e,model:i,opts:n,orbit:_,cinematic:U,analytics:a,loop:ne,labelOverlay:H,stageAzimuth:V,overviewFraming:B,gpu:()=>f,isDisposed:()=>g,panorama:()=>w,setPanorama:j=>{w=j},setPanoramaSphereVisible:j=>{R=j},panoramaLoadAbort:()=>I,setPanoramaLoadAbort:j=>{I=j},setFrozen:j=>{y=j},restorePanoramaLayer:C,reducedMotion:Pe,resolvedSeatViewPose:it,showSectionSeatLabels:q,setNearFieldDetailEnabled:L,setSeatViewLocked:En,setNavigationMode:Jt,showArriveChip:ko,removeArriveChip:Lo,inSeatView:()=>en!==null,setSeatStepping:j=>{Ur=j},seatViewArrival:(j,X)=>n.arriveAtSeatEye?Hl(j,X):null,enterSeatView:j=>oe?.enter(j)});T=!0;let Fo=Ce.overviewChip,zl=Ce.layoutOverviewChip,Ul=Ce.applyFloorFocus,jl=Ce.focusOverview,Xr=Ce.cancelFlight,Wr=Ce.flyToSeat,Yr=Ce.focusSectionCamera;Gl.appendChild(Fo),vt={container:e,model:i,opts:n,analytics:a,orbit:_,loop:ne,seatsById:c,ensureSeatView:Se,resolvedSeatViewPose:it,gpu:()=>f,gl:O.gl,isContextLost:()=>b,isDisposed:()=>g,flightGen:()=>Ce.flightGen(),setPanorama:j=>{w=j},getLoadAbort:()=>I,setLoadAbort:j=>{I=j},setPanoramaSphereVisible:j=>{R=j,j&&oe?.exit()},setFrozen:j=>{y=j},raisePanoramaLayer:M,restorePanoramaLayer:C,getOverviewChip:()=>Fo,labelOverlay:H,reducedMotion:Pe,removeArriveChip:Lo,showArriveChip:ko};let st=Il({glctx:O,orbit:_,model:i,seats:t.seats,opts:n,cinematic:U,analytics:a,seatIdByIndex:s,sectionIdBySeatId:l,tapSlop:yb,tapMs:gb,gpu:()=>f,pick:()=>p,seatViewLocked:()=>Mt.seatViewLocked(),focusedSectionId:()=>Y,selection:()=>x,cancelFlight:Xr,focusSectionCamera:Yr,focusSeatCamera:Ce.focusSeatCamera,setSelection:Te,ensureSeatView:Se});O.canvas.addEventListener("pointerdown",st.onDown),O.canvas.addEventListener("pointermove",st.onMove),O.canvas.addEventListener("pointerup",st.onUp),O.canvas.addEventListener("pointercancel",st.onUp),ne.requestRender();let Do={setAvailability(j){let X=kc(x,j),J=qo(i.seats,X);J.length&&f&&f.uploadSeatStateRuns(J),h(),ne.requestRender()},setSelection:Te,setNavigationMode:Jt,zoomIn(){_.zoomBy(Dt),ne.requestRender()},zoomOut(){_.zoomBy(ln),ne.requestRender()},flyToSeat:Wr,focusOverview:jl,seatViewStop:()=>en,recentreSeatView:()=>oe?.recentre()??!1,resize(){let{width:j,height:X}=O.resize();_.setAspect(j/Math.max(1,X)),Bl(),Vl(),zl(),ne.requestRender()},stats(){return{...ne.stats(),drawCalls:f?f.drawCalls:0,fallbackTriangles:f?f.seatGeometry.drawRange.count/3*i.seats.count:0,seatCount:i.seatCount}},captureImage(j=1280){if(b||!f||typeof document>"u")return null;$(0);let X=O.canvas,J=Math.min(1,j/Math.max(X.width,X.height,1)),ce=document.createElement("canvas");ce.width=Math.max(1,Math.round(X.width*J)),ce.height=Math.max(1,Math.round(X.height*J));let fe=ce.getContext("2d");return fe?(fe.drawImage(X,0,0,ce.width,ce.height),ce.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let j=ne.stats(),X=O.canvas.clientWidth||1,J=O.canvas.clientHeight||1,ce=i.bounds.center,fe=bt(_.camera.projectionViewMatrix,[ce[0],i.bounds.box.min[1],ce[2]],X,J),be=bt(_.camera.projectionViewMatrix,[ce[0],i.bounds.box.max[1],ce[2]],X,J),xe=i.bounds.box,we=[xe.min[0],xe.max[0]].flatMap(se=>[xe.min[1],xe.max[1]].flatMap(Re=>[xe.min[2],xe.max[2]].map(Me=>bt(_.camera.projectionViewMatrix,[se,Re,Me],X,J)))).filter(se=>Number.isFinite(se.x)&&Number.isFinite(se.y)&&Number.isFinite(se.depth)),St=we.length?(()=>{let se=Math.min(...we.map(ct=>ct.x)),Re=Math.max(...we.map(ct=>ct.x)),Me=Math.min(...we.map(ct=>ct.y)),_n=Math.max(...we.map(ct=>ct.y)),Tn=Math.max(0,se),tn=Math.min(X,Re),nn=Math.max(0,Me),kn=Math.min(J,_n),ze=Math.max(0,tn-Tn),Pt=Math.max(0,kn-nn);return{box:{x:Tn,y:nn,width:ze,height:Pt},horizontalFillRatio:ze/X,verticalFillRatio:Pt/J,visibleAreaRatio:ze*Pt/(X*J),clippedEdges:[...Me<0?["top"]:[],...Re>X?["right"]:[],..._n>J?["bottom"]:[],...se<0?["left"]:[]]}})():void 0,wt=String(O.gl.getParameter(O.gl.VERSION)??"");return{viewport:{width:X,height:J},context:{webgl2:/webgl\s*2/i.test(wt),lost:b},frame:{rendered:j.rendered,idle:j.idle},camera:{position:[_.camera.position.x,_.camera.position.y,_.camera.position.z],distance:_.currentDistance,verticalFovDeg:_.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:fe.visible&&be.visible?Math.abs(fe.y-be.y):0},labels:H.qualityEvidence(),framing:St,...en?{seatView:{fovDeg:_.camera.fov,stop:en}}:{}}},getQualityReport(){return ho(Do.getQualityEvidence())},loseContextForTest(){O.simulateContextLossCycle()},floors(){return i.floors},focusFloor(j){if(j!==null&&!i.floors.some(J=>J.index===j))return!1;let X=j??-1;if(L(j!==null),En(!1),Ul(X),Jt("orbit"),j===null)U.cancel(),Pe()?_.frame(i.bounds,!1,V,n.portraitOverviewCrop===!0,B):_.frameSoft(i.bounds,V,n.portraitOverviewCrop===!0,B);else{let J=i.floors[j];if(J.seatCount>0){U.cancel();let ce=J.focalWorld[0]-J.center[0],fe=J.focalWorld[2]-J.center[2],be=Math.hypot(ce,fe)>J.radius*.12?Math.atan2(ce,fe):V;_.frame({center:J.center,radius:J.radius,box:J.box},!1,be,!1,{polarDeg:58,margin:1.12})}}return ne.requestRender(),!0},zones(){return i.zones},focusZone(j){let X=i.zones.find(be=>be.id===j);if(!X||X.seatCount===0)return!1;L(!1),En(!1),U.cancel(),Jt("orbit"),q(null),n.onSectionFocusChange?.(null);let J=X.focalWorld[0]-X.center[0],ce=X.focalWorld[2]-X.center[2],fe=Math.hypot(J,ce)>X.radius*.12?Math.atan2(J,ce):void 0;return _.frame({center:X.center,radius:X.radius*1.25},!1,fe),ne.requestRender(),!0},sections(){return i.sections},focusSection(j){return Yr(j)},rows(j){return j?i.rows.filter(X=>X.sectionId===j):i.rows},seatsInRow(j){return t.seats.filter(X=>X.rowId===j).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(j){let X=i.rows.find(J=>J.id===j);return!X||X.seatCount===0?!1:(L(!0),En(!1),U.cancel(),Jt("pan"),X.sectionId&&(q(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),_.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),ne.requestRender(),!0)},setReducedMotionForTest(j){S=j},dispose(){g=!0,Lo(),Fo.remove(),Nl.remove(),Xr(),oe?.dispose(),ne.stop(),H.dispose(),he?.disconnect(),w&&(w.dispose(),w=null),C(),G(),O.canvas.removeEventListener("pointerdown",st.onDown),O.canvas.removeEventListener("pointermove",st.onMove),O.canvas.removeEventListener("pointerup",st.onUp),O.canvas.removeEventListener("pointercancel",st.onUp),_.dispose(),p&&p.dispose(),f&&f.dispose(),f=null,p=null,O.dispose()}};return a.opened(i.seatCount,d,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),Do}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
846
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:J},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let ee=new Se.Mesh(e,{geometry:z,program:K});ee.frustumCulled=!1,ee.setParent(n),Q.screenProgram=K,j=!0,Q.drawCalls=3+(G?1:0)+1},$.src=te.contentImageUrl}return Q}var Je=require("ogl");function gb(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function ol(e,t,n,o,r,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let l=(c*t+u)*4,m=gb(e[l],e[l+1],e[l+2]);if(m<0||m>=i)continue;let h=u-o,d=c-r,f=h*h+d*d;f<s&&(s=f,a=m)}return a}function rl(e,t,n,o,r,i){let a=e-n.left,s=t-n.top,c=Math.round(a*o),u=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(r-1,c)),y:Math.max(0,Math.min(i-1,u))}}var xb=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],So=class{constructor(t,n,o,r,i){this.seatScene=new Je.Transform;this.chairScene=new Je.Transform;this.solidScene=new Je.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=jc(this.gl),this.chairProg=Xc(this.gl),this.depthProg=Wc(this.gl);let a=new Je.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Je.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Je.Mesh(this.gl,{geometry:r,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let o of xb)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 Je.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,u=Math.max(0,n-r),l=Math.max(0,o-r),m=Math.max(1,Math.min(s,n+r+1)-u),h=Math.max(1,Math.min(c,o+r+1)-l);i.enable(i.SCISSOR_TEST),i.scissor(u,l,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(u,l,m,h,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),ol(b,m,h,n-u,o-l,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function il(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,ln(o.state)):n.push(o);return n}function al(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:Re[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 vt=require("ogl");function vb(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function sl(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Mb(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function cl(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 zr(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Ur(e,t){return Math.max(0,Math.min(1,e+t))}function ll(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],u=e[i+1],l=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]+u[f])*a+(2*s[f]-5*c[f]+4*u[f]-l[f])*m+(-s[f]+3*c[f]-3*u[f]+l[f])*h);return d}function jr(e,t,n,o,r){let i=cl(vb(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=sl(sl(t,Mb(i,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=cl(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,r),l=[o[0]+c[0]*u*1.3,o[1]+u*.75,o[2]+c[2]*u*1.3];return{waypoints:[e,l,a],finalPos:a}}function Xr(e,t,n=35,o=28){let r=zr(t),i=ll(e,r),a=zr(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(o-n)*a,eased:r}}function dl(e,t,n){let o=e.position.clone(),r=new vt.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new vt.Vec3(n[0],n[1],n[2]));let i=new vt.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(r),i}var wo=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new vt.Quat;this.endQuat=new vt.Quat;this.outQuat=new vt.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}=Xr(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,Ur(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 hl=Xo,Sb=.12,wb=.25,Pb=1.5;function pl(e,t,n=0,o,r){let i=[t.x*C,n+Pb,t.y*C],a=r?[r[0],r[1],r[2]]:i,s=e[1],c=Number.isFinite(s)?s+hl:Number.isFinite(o)?n+o:n+hl,u=i[0]-e[0],l=i[2]-e[2],m=Math.hypot(u,l),h=m>.001?Math.min(Sb,m*wb):0,d=m>.001?u/m:0,f=m>.001?l/m:0;return{eye:[e[0]+d*h,c,e[2]+f*h],focal:a}}var Mt=Math.PI/180,Ib=45,Wr=80,Po=70,Rb=1,Ab=.99;function Cb(e,t){if(!(e<Rb))return Wr;if(!(Number.isFinite(t)&&t>0))return Po;let n=2*Math.atan(t/(2*Io*Ab)/Math.max(.05,e))/Mt;return Math.max(Po,Math.min(Wr,n))}var Eb=.25,Io=1,_b=.25,Tb=12*Mt,kb=.2,Lb=1.5,bl=.8,yl=6,wl=1.9,Fb=2/3,Db=.12,Ob=.9,Bb=1.2,Nb=2,Pl=.05,Vb=6;function Il(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+bl,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,u=a-i,l=Math.max(c,Math.min(u,yl))/2,m=Math.max(u,Math.min(c,yl))/2,h=(o+r)/2,d=(i+a)/2;return{min:[h-l,n,d-m],max:[h+l,Math.max(n+bl,s),d+m]}}function Gb(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+wl,e.max[2]]}}function Yr(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Lb,t+kb,t+wl*Fb),(e.min[2]+e.max[2])/2]}function Rl(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 gl(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,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let l=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(Pl,d*o+f*r+p*i),y=(d*s+p*c)/b;y<l&&(l=y),y>m&&(m=y)}return m-l}function xl(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,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let l=-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(Pl,b*o+y*r+g*i),v=(b*l+y*m+g*h)/M;v<d&&(d=v),v>f&&(f=v)}return f-d}function Ro(e,t){return Math.tan(e*Mt/2)*Math.max(.05,t)}function vl(e,t,n){let o=Cb(n,e),r=c=>Math.max(Ib,Math.min(o,c)),i=c=>2*Math.atan(c)/Mt,a=Number.isFinite(e)&&e>0?r(i(e/(2*Eb)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,r(i(t/(2*Db))));return e/(2*Ro(s,n))>Io?a:s}function Al(e,t,n,o={}){let r=Yr(t),i=[e[0],e[1],e[2]],a=0,s=0,c=f=>{if(!(f>0))return;let p=Rl(i,r);i[0]+=p.x*f,i[2]+=p.z*f,s+=f},u=o.preserveEye?0:t.max[1]+_b-i[1];u>0&&(i[1]+=u,a=u,c(u/Math.tan(Tb)));let l=Gb(t),m=gl(i,r,t),h=vl(m,xl(i,r,l),n),d=m/(2*Ro(h,n));for(let f=0;!o.preserveEye&&f<Vb&&d>Io;f++){let p=Math.max(1,Math.hypot(i[0]-r[0],i[2]-r[2])),b=Number.isFinite(d)?d/Io:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=gl(i,r,t),h=vl(m,xl(i,r,l),n),d=m/(2*Ro(h,n))}return{eye:i,focal:r,fov:h,raisedM:a,pulledBackM:s,stageFrameWidth:d}}function Hb(e,t,n){let o=Math.tan(t*Mt/2),r=Ro(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,r)))}var zb=.7,Ml=.5,Ub=.8;function Sl(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)))/Mt}function jb(e,t,n){let o=u=>{let l=Math.hypot(u[0],u[1],u[2])||1;return[u[0]/l,u[1]/l,u[2]/l]},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(u=>a[u]*(1-Ml)+s[u]*Ml));return[e[0]+c[0]*i,e[1]+c[1]*i,e[2]+c[2]*i]}function Cl(e,t){let{aspect:n,venue:o}=t,r=e.focal,i=Rl(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=Nb*(t.rowDepthM??Ob),u=[e.eye[0]+i.x*c,e.eye[1]+Bb,e.eye[2]+i.z*c],l=[e.eye[0],e.eye[1]-zb,e.eye[2]],m=jb(u,r,l);s.push({name:"row",eye:u,focal:m,fov:Math.min(Wr,Math.max(e.fov,2*Math.max(Sl(u,m,l),Sl(u,m,r))/Ub))});let h=(p,b,y,g)=>{let M=Hb(y,e.fov,n)*1.08,v=M*Math.sin(g*Mt),R=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,P=Math.max(v,R-b[1]),x=M*Math.cos(g*Mt);return{name:p,eye:[b[0]+i.x*x,b[1]+P,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 kl=require("ogl"),_n=Math.PI/180,Kr=320,El=70*_n,Xb=32*_n,Wb=24*_n,_l=.0026,Yb=.22,Kb=.006,qb=180,$b=900,Zb=1100,Qb=4,ke=(e,t,n)=>Math.max(t,Math.min(n,e)),Tl=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Ll(e){let{canvas:t,camera:n}=e,o=[],r=!1,i=0,a=0,s=0,c=0,u=0,l=0,m=Kr,h=null,d=()=>{h&&(clearTimeout(h),h=null)},f=!1,p=[0,0],b=0,y=!1,g=null,M=null,v=new Map,R=!1,P=0,x=0,S=0,w=0,I=()=>r&&o.length?o[ke(Math.round(i),0,o.length-1)].name:null,L=()=>{let F=I();F!==g&&(g=F,e.onStopChange?.(F))},O=()=>{if(!r||!o.length)return;let F=o[ke(Math.floor(i),0,o.length-1)],G=o[ke(Math.ceil(i),0,o.length-1)],j=ke(i-Math.floor(i),0,1),N=(le,re)=>le+(re-le)*j,z=[N(F.eye[0],G.eye[0]),N(F.eye[1],G.eye[1]),N(F.eye[2],G.eye[2])],K=[N(F.focal[0],G.focal[0]),N(F.focal[1],G.focal[1]),N(F.focal[2],G.focal[2])],J=K[0]-z[0],Y=K[1]-z[1],W=K[2]-z[2],Q=Math.hypot(J,Y,W)||1,te=Math.atan2(J,W),$=Math.asin(ke(Y/Q,-1,1)),ne=te+a,ee=ke($+s,-80*_n,80*_n),q=Math.cos(ee)*Q;J=Math.sin(ne)*q,Y=Math.sin(ee)*Q,W=Math.cos(ne)*q,n.position.set(z[0],z[1],z[2]),n.fov=N(F.fov,G.fov),n.updateProjectionMatrix(),n.lookAt(new kl.Vec3(z[0]+J,z[1]+Y,z[2]+W)),e.onApplied?.()},D=()=>{if(!r||!o.length)return;let F=ke(Math.round(i),0,o.length-1);if(e.reducedMotion()){f=!1,i=F,O(),L(),e.requestRender();return}if(Math.abs(F-i)<.001){f=!1,L();return}c=i,u=F,l=performance.now(),m=Kr,f=!0,e.requestRender()},A=F=>{!r||o.length<2||(d(),f=!1,i=ke(i+F,0,o.length-1),O(),L(),e.requestRender())},E=(F,G)=>{r&&(d(),f=!1,y=!1,a=ke(a-F*_l,-El,El),s=ke(s-G*_l,-Wb,Xb),O(),e.requestRender())},T=F=>{r&&(v.set(F.pointerId,{x:F.clientX,y:F.clientY}),v.size===1?(R=!0,w=0,P=F.clientX,x=F.clientY):v.size===2&&(R=!1,S=V()))},V=()=>{let F=[...v.values()];return F.length<2?0:Math.hypot(F[0].x-F[1].x,F[0].y-F[1].y)},_=F=>{if(!r||!v.has(F.pointerId))return;if(v.set(F.pointerId,{x:F.clientX,y:F.clientY}),v.size>=2){let N=V();S>0&&A((S-N)*Kb),S=N;return}if(!R)return;let G=F.clientX-P,j=F.clientY-x;P=F.clientX,x=F.clientY,w+=Math.abs(G)+Math.abs(j),!(w<=Qb)&&E(G,j)},k=F=>{v.delete(F.pointerId)&&(v.size<2&&(S=0),v.size===0&&(R=!1,D()))},H=F=>{if(!r)return;F.preventDefault();let G=F.deltaMode===1?16:F.deltaMode===2?100:1,j=ke(F.deltaY*G/100,-2,2);A(j*Yb),M&&clearTimeout(M),M=setTimeout(()=>{M=null,D()},qb)},B=()=>{d(),r&&(r=!1,f=!1,y=!1,o=[],v.clear(),R=!1,M&&(clearTimeout(M),M=null),g!==null&&(g=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",T),t.addEventListener("pointermove",_),t.addEventListener("pointerup",k),t.addEventListener("pointercancel",k),t.addEventListener("wheel",H,{passive:!1}),{get active(){return r},enter(F,G=0){if(F.length<2){B();return}d(),o=F,r=!0,i=e.reducedMotion()?0:ke(G,0,F.length-1),i>0&&(h=setTimeout(()=>{h=null,r&&(c=i,u=0,l=performance.now(),m=Zb,f=!0,e.requestRender())},$b)),a=0,s=0,f=!1,y=!1,g=null,O(),L(),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(F){if(!r)return!1;let G=!1;if(y){let j=ke((F-b)/Kr,0,1),N=1-Tl(j);a=p[0]*N,s=p[1]*N,j>=1?(y=!1,a=0,s=0):G=!0}if(f){let j=ke((F-l)/m,0,1);i=c+(u-c)*Tl(j),j>=1?(f=!1,i=u,L()):G=!0}return O(),G},currentStop:I,dispose(){B(),t.removeEventListener("pointerdown",T),t.removeEventListener("pointermove",_),t.removeEventListener("pointerup",k),t.removeEventListener("pointercancel",k),t.removeEventListener("wheel",H)}}}function Fl(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Qr=null;function Yl(){return Qr??=Promise.resolve().then(()=>(Wl(),Xl)).catch(e=>{throw Qr=null,e}),Qr}var Kl=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Lo=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=Kl(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Kl()-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 ql(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function $l(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"})},u=()=>{s?.remove(),s=null};return{show:(m,h,d=!1)=>{if(u(),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(I=>I.id===y.sectionId):void 0,M=y?.label??m;f.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${M}`);let v=document.createElement("span");v.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",g?.label,M].filter(Boolean).join(" \xB7 "),Object.assign(v.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(v);let R=document.createElement("div");Object.assign(R.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(R);let P=y?.rowId?i.get(y.rowId):void 0,x=P?.indexOf(m)??-1,S=x>=0?[P?.[x-1],P?.[x+1]]:[void 0,void 0],w=(I,L,O,D=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=I,A.setAttribute("aria-label",L),Object.assign(A.style,{minHeight:"44px",padding:D?"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"}),D||(A.style.minWidth="44px"),D&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",O),R.appendChild(A)};if(b&&S[0]){let I=r.get(S[0])?.label??S[0];w("\u2039",`View previous seat ${I}`,()=>{e.flyToSeat(S[0])})}if(b&&o.getSeatView){let I=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";w(d?`\u21BB Retry ${I}`:`\u25C9 ${I}`,`${d?"Retry":I} from seat ${M}`,()=>{if(e.isDisposed()||h!==e.flightGen()){u();return}u(),e.openPanorama(m,400,h)},!0)}if(b&&S[1]){let I=r.get(S[1])?.label??S[1];w("\u203A",`View next seat ${I}`,()=>{e.flyToSeat(S[1])})}return!R.childElementCount&&!p?null:(t.appendChild(f),s=f,c(),f)},remove:u,layout:c}}var dy={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Zl(e){let{container:t,orbit:n,isNarrow:o}=e,r={...dy,...e.labels??{}},i=(M,v)=>{M.setAttribute("aria-label",v),M.title=v},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 u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",i(l,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[l,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(l,m),u.append(d,h);let f=M=>{n.setPrimaryDragMode(M);let v=M==="orbit";l.setAttribute("aria-pressed",String(v)),m.setAttribute("aria-pressed",String(!v)),l.style.background=v?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=v?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=v?`${r.rotate} \xB7 ${r.move} with Shift`:`${r.move} \xB7 ${r.rotate} with Shift`};l.addEventListener("click",()=>f("orbit")),m.addEventListener("click",()=>f("pan"));let p=()=>{let{atMin:M,atMax:v}=n.dollyLimitState();d.disabled!==M&&(d.disabled=M),h.disabled!==v&&(h.disabled=v)};h.addEventListener("click",()=>{n.zoomBy(un),p()}),d.addEventListener("click",()=>{n.zoomBy(Bt),p()}),a.append(c,u),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:u,setNavigationMode:f,syncZoomLimits:p,setSeatViewLocked:M=>{s=M,n.setInteractionEnabled(!M),y()},seatViewLocked:()=>s,layout:y}}var hy=12;function py(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)>hy}var by=.5,yy=12;function gy(e,t,n){return!(e>0)||!(n>0)?0:by*n/(2*e*Math.tan(t*Math.PI/360))}function Ql(e){let{glctx:t,orbit:n,model:o,seats:r,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:l,tapMs:m,cancelFlight:h,focusSectionCamera:d,setSelection:f,ensureSeatView:p}=e,b=0,y=0,g=0,M=-1,v=!1,R=!1,P=O=>{e.seatViewLocked()||M===-1&&(M=O.pointerId,b=O.clientX,y=O.clientY,g=performance.now(),v=!1,R=a.active,a.active&&(s.cinematicCancelled(),h(),i.onViewTargetChange?.(null)))},x=O=>{O.pointerId===M&&Math.hypot(O.clientX-b,O.clientY-y)>l&&(v=!0)},S=(O,D,A,E,T)=>{let V=t.canvas.getBoundingClientRect(),_=t.canvas.clientWidth||V.width||1,k=t.canvas.clientHeight||V.height||1,H=O-V.left,B=D-V.top,F=E*E,G=-1,j=F,N=1/0;for(let z of r){if(A&&z.sectionId!==A)continue;let K=o.seats.idToIndex.get(z.id);if(K===void 0)continue;if(T){let $=Math.round(o.seats.iState[K]??0);if($!==0&&$!==3)continue}let J=K*3,Y=Ze(n.camera.projectionViewMatrix,[o.seats.iPosition[J],o.seats.iPosition[J+1]+.55,o.seats.iPosition[J+2]],_,k);if(!Y.visible)continue;let W=Y.x-H,Q=Y.y-B,te=W*W+Q*Q;(te<j||Math.abs(te-j)<1&&Y.depth<N)&&(G=K,j=te,N=Y.depth)}return G},w=(O,D)=>{let A=e.gpu(),E=e.pick();if(!A||!E)return-1;E.syncFromSeatProgram(A.seatProgram);let T=t.canvas.getBoundingClientRect(),V=t.renderer.dpr,{x:_,y:k}=rl(O,D,T,V,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),H=Math.max(2,Math.round(8*V));return E.pick(n.camera,_,k,H)},I=O=>{let D=n.camera?.position;if(!D)return!1;let A=O*3,E=Math.hypot(D.x-o.seats.iPosition[A],D.y-o.seats.iPosition[A+1],D.z-o.seats.iPosition[A+2]),T=t.canvas.clientHeight||t.canvas.getBoundingClientRect().height;return gy(E,n.fovY,T)>=yy};return{onDown:P,onMove:x,onUp:O=>{if(O.pointerId!==M)return;let D=!v&&performance.now()-g<m;if(M=-1,R){R=!1;return}let A=e.gpu(),E=e.pick();if(!D||!A||!E)return;let T=w(O.clientX,O.clientY),V=T>=0&&I(T),_=!1;if(e.focusedSectionId()&&T>=0){let B=c[T],F=B?u.get(B):void 0;if(F&&F!==e.focusedSectionId()&&d(F,{keepCamera:V})){if(!V)return;_=!0}}if(e.focusedSectionId()&&T<0&&(T=S(O.clientX,O.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&T<0){let B=S(O.clientX,O.clientY,null,72,!1),F=B>=0?c[B]:void 0,G=F?u.get(F):void 0;if(G&&G!==e.focusedSectionId()&&d(G))return}if(!e.focusedSectionId()){T<0&&(T=S(O.clientX,O.clientY,null,42,!1));let B=T>=0?c[T]:void 0,F=B?u.get(B):void 0;if(F&&d(F,{keepCamera:V})){if(!V)return;_=!0}}if(T<0||T>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let k=c[T],H=Re[Math.round(o.seats.iState[T]??0)]??"available";if(H!=="available"&&H!=="selected"){i.onSeatInspect?.(k,H);return}if(e.selection().has(k)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(k);return}if(f([k]),p(k),s.seatPicked(k,u.get(k)),i.onSeatPick?.(k),e.focusedSectionId()&&!_){let B=T*3,F=[o.seats.iPosition[B],o.seats.iPosition[B+1],o.seats.iPosition[B+2]];py(n.camera?.position,F)&&e.focusSeatCamera(k)}}}}var Fo=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,u=new Int32Array(c+1),l=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++)u[l(d)+1]++;for(let d=0;d<c;d++)u[d+1]+=u[d];let m=new Int32Array(this.count),h=u.slice(0,c);for(let d=0;d<this.count;d++)m[h[l(d)]++]=d;this.cellStart=u,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,u=o*o,l=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=l-p,M=l+p;for(let v=b;v<=y&&f<c;v++){if(v<0||v>=this.rows)continue;let R=v===b||v===y;for(let P=g;P<=M&&f<c;P++){if(!R&&P!==g&&P!==M){P=M-1;continue}if(P<0||P>=this.cols)continue;let x=v*this.cols+P;for(let S=a[x],w=a[x+1];S<w&&f<c;S++){let I=s[S],L=d[I*3]-t,O=d[I*3+2]-n,D=i===void 0?0:d[I*3+1]-i;L*L+D*D+O*O<=u&&(r[f++]=I)}}}}return f}};var Do=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Hn);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new Fo(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)<Jo)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>Qo){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(r.x,r.z,Qo,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 Jl(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 Oo=require("ogl");function eu(){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 ou(e){let{container:t,model:n,opts:o,orbit:r,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:l}=e,m=0,h=-1,d=(x,S,w=28)=>{r.camera.position.set(x[0],x[1],x[2]),r.camera.lookAt(new Oo.Vec3(S[0],S[1],S[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(eu());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(eu())};b();let y=x=>{h=x;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=x,S.solidProgram.uniforms.uFocusFloor.value=x,S.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 S=x.focalWorld[0]-x.center[0],w=x.focalWorld[2]-x.center[2],I=Math.hypot(S,w)>x.radius*.12?Math.atan2(S,w):u,L={center:x.center,radius:x.radius,box:x.box},O={polarDeg:58,margin:1.12};e.reducedMotion()?r.frame(L,!1,I,!1,O):r.frameSoft(L,I,!1,O)}else e.reducedMotion()?r.frame(n.bounds,!1,u,o.portraitOverviewCrop===!0,l):r.frameSoft(n.bounds,u,o.portraitOverviewCrop===!0,l);e.showSectionSeatLabels(null),s.requestRender()},M=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),r.resumeAfterFlight(n.focalWorld))},v=x=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(x);if(S===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 I=++m;w?e.showArriveChip(x,I):e.removeArriveChip();let{eye:L,focal:O}=e.resolvedSeatViewPose(x,S),D=o.arriveAtSeatEye?e.seatViewArrival(x,S):null,A=D&&D.stops.length>1&&D.stops[1].name==="row"?D.stops[1]:null,E=D?D.focal:O,T=[r.camera.position.x,r.camera.position.y,r.camera.position.z],V=jr(T,D?.eye??L,E,n.bounds.center,n.bounds.radius),_=A?A.eye:D?D.eye:o.arriveAtSeatEye?L:V.finalPos,k=D?D.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Po:65:28,H=[V.waypoints[0],V.waypoints[1],_];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),d(_,E,k),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||r.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),D&&e.enterSeatView(D.stops),e.showArriveChip(x,I),Promise.resolve();let B=new Oo.Quat().copy(r.camera.quaternion),F=dl(r.camera,_,E);s.requestRender();let G=w?700:2500;return i.start(H,B,F,G,k).then(()=>{e.isDisposed()||I!==m||(e.setSeatStepping(!1),a.cinematicPlayed(G),r.resumeAfterFlight(E),e.setSeatViewLocked(o.arriveAtSeatEye===!0),D&&e.enterSeatView(D.stops,A?1:0),s.requestRender(),e.showArriveChip(x,I))})},R=(x,S)=>{let w=n.sections.find(I=>I.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),!S?.keepCamera){let I=Jl(w),L={polarDeg:I.polarDeg,margin:1.12};e.reducedMotion()?r.frame({center:I.center,radius:I.radius},!1,r.currentAzimuth,!1,L):r.glideTo({center:I.center,radius:I.radius},L)}return o.onSectionFocusChange?.(x),s.requestRender(),!0},P=x=>{if(e.isDisposed()||!e.gpu())return!1;let S=n.seats.idToIndex.get(x);if(S===void 0)return!1;let w=S*3,I=[n.seats.iPosition[w],n.seats.iPosition[w+1]+.55,n.seats.iPosition[w+2]];return e.reducedMotion()?r.frame({center:I,radius:tu},!1,void 0,!1,nu):r.frameSoft({center:I,radius:tu},void 0,!1,nu),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:v,focusSectionCamera:R,focusSeatCamera:P}}var tu=4.5,nu={polarDeg:48,margin:1.25};function kn(e,t){let{doc:n,report:o}=bo(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])),u=d=>d.map(f=>f.type==="shape"&&c.has(f.id)?{...f,role:c.get(f.id)}:f),l=e.floors?.map(d=>({...d,objects:u(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:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:m,focal:h}}let i=new Map(zt(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,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(a[u]=l.eyeHeightM),l.focalPoint&&(s[u*2]=l.focalPoint.x,s[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function Jr(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 ru(e){let t=e.estimate===!1?null:kn(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Jr(e.seats,t)},estimate:t}:{input:e}}function ei(e,t,n,o,r,i,a,s,c=.5){let u=-1,l=s*s,m=1/0;for(let h=0;h<t;h++){let d=h*3,f=Ze(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<l-4||y<l+4&&f.depth<m)&&(u=h,l=Math.min(l,y),m=f.depth)}return u}var vy={};function iu(e){let t=performance.now(),{input:n,estimate:o}=ru(e);return{model:$t(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function xy(e){let t=zt(e.doc);return{...iu({...e,seats:t}),seats:t}}function au(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let o;try{o=new Worker(new URL("./scene/scene.worker.js",vy.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(r=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),o.terminate(),r(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);o.onerror=s,o.onmessage=u=>{let l=n(u.data);l?a(l):s()},o.postMessage(e)})}function su(e){return au(e,()=>iu(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function cu(e){return au(e,()=>xy(e),({model:t,buildMs:n,seats:o,estimate:r})=>o?{model:t,buildMs:n,seats:o,source:"worker",...r?{estimate:r}:{}}:null)}var My=40,Sy=48,wy=Math.PI/180,Py=6,Iy=500;function Ry(e,t,n={}){let o=performance.now(),r=t.prepared?t.prepared.estimate:t.estimate===!1?null:kn(t.doc,t.seats);r&&(t={...t,doc:r.doc,seats:Jr(t.seats,r)});let i=t.prepared?.model??$t(t),a=new Lo(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])),u=new Map;for(let U of t.seats){if(!U.rowId)continue;let X=u.get(U.rowId);X?X.push(U.id):u.set(U.rowId,[U.id])}let l=new Map;t.seats.forEach((U,X)=>{l.set(U.id,i.seatSectionIds?.[X]??U.sectionId)});let m=new Map;for(let[U,X]of i.seats.idToIndex){let Z=l.get(U);if(!Z)continue;let ie=m.get(Z);ie?ie.push(X):m.set(Z,[X])}let h=()=>{if(!f||!i.sectionSolidRanges.length)return;let{lit:U,anyUnlit:X}=Qc(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,v=new Map,R=null,P=null,x=null,S=new Map,w=null,I=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},L=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,D=()=>O?Ee.focusedFloor():-1,A=()=>{f=nl(_.gl,i),p?.dispose(),p=Cc(_.gl,[1,1,1]),ct(!1),h(),$(),b=new So(_.renderer,f.seatGeometry,f.chairGeometry,f.solidGeometry,i.seats.count),_.setClearColor(i.theme.background.top),b.setRestoreClear(i.theme.background.top),f.seatProgram.uniforms.uSeatRadius.value=nt*i.theme.seatScale,f.seatProgram.uniforms.uFocusFloor.value=D(),f.solidProgram.uniforms.uFocusFloor.value=D(),f.chairProgram.uniforms.uFocusFloor.value=D(),f.screenProgram&&(f.screenProgram.uniforms.uFocusFloor.value=D()),T.forceRegather()},E=!1,T=new Do({model:i,orbit:()=>k,gpu:()=>f}),V=U=>T.setDetailEnabled(U),_=new Nn(e,{onContextLost:()=>{M||a.contextLost(),y=!0,re.stop(),f=null,b=null},onContextRestored:()=>{A(),y=!1,M||a.contextRestored(),re.requestRender()}}),k=new Vn(_.gl,_.canvas,()=>re.requestRender(),()=>a.orbitEngaged());k.setAspect(_.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 fi(i.focalWorld,i.seats.iPosition,i.bounds)})(),F=(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:F?36:48,margin:1.05},j=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;k.frame(i.bounds,!j&&n.skipInitialOverviewAnimation!==!0,B,n.portraitOverviewCrop===!0,G);let N=new wo(k.camera),z=ql(e),K=new xo(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:i.theme.background.top}),J=i.labels,Y=()=>ec(J,i.floors.length,D());K.setLabels(Y());let W=null,Q=()=>[...v.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 ie=X*3;return[{id:`seat:${U}`,kind:"seat",seatWidthM:i.seats.iChairWidth[X]*2,text:Z.displayLabel||Z.label,anchor:[i.seats.iPosition[ie],i.seats.iPosition[ie+1]+1.05,i.seats.iPosition[ie+2]],pinBase:Ce(ie)}]}),te=-1,$=()=>{f&&(te=W?i.sections.findIndex(U=>U.id===W):-1,f.seatProgram.uniforms.uFocusSection.value=te,f.chairProgram.uniforms.uFocusSection.value=te)},ne=U=>{if(W=U,$(),K.setForcedDense(!!U),!U){let ce=Q(),_e=new Set(ce.map(Me=>Me.id));K.setLabels([...Y().filter(Me=>!_e.has(Me.id)),...ce]);return}let X=t.seats.filter(ce=>l.get(ce.id)===U),Z=new Set(X.map(ce=>ce.id)),ie=new Set(X.map(ce=>ce.rowId)),ue=new Set(v.keys()),ge=new Set(X.filter(ce=>ue.has(ce.id)).map(ce=>ce.id)),ye=Y().filter(ce=>ce.kind!=="row"&&ce.kind!=="seat"||(ce.kind==="row"?ie.has(ce.id.slice(4)):Z.has(ce.id.slice(5))));if(i.seatCount<=6e3&&ge.size===0){K.setLabels(ye);return}let Ie=X,It=new Set(Ie.map(ce=>`seat:${ce.id}`)),Rt=Ie.flatMap(ce=>{let _e=i.seats.idToIndex.get(ce.id);if(_e===void 0)return[];let Me=_e*3;return[{id:`seat:${ce.id}`,kind:"seat",seatWidthM:i.seats.iChairWidth[_e]*2,rowId:ce.rowId,text:ue.has(ce.id)?ce.displayLabel||ce.label:Lr(ce.displayLabel||ce.label),anchor:[i.seats.iPosition[Me],i.seats.iPosition[Me+1]+(ue.has(ce.id)?1.05:.55),i.seats.iPosition[Me+2]],...ue.has(ce.id)?{pinBase:Ce(Me)}:{}}]});K.setLabels([...ye.filter(ce=>!It.has(ce.id)),...Rt])};A();let ee=null,q=null,le=U=>{if(y||!f||g)return!1;let X=Fl({flying:N.active,panoramaMounted:R!==null,seatViewActive:ee?.active===!0}),Z=X==="orbit"?te:-1;f.seatProgram.uniforms.uFocusSection.value=Z,f.chairProgram.uniforms.uFocusSection.value=Z;let ie=X==="cinematic"?N.update(performance.now()):X==="seatView"?ee.update(performance.now()):X==="orbit"?k.update():!1;q?.syncZoomLimits();let ue=D()>=0?i.floors[D()]:null,ge=ue?.radius??i.bounds.radius,ye=Bi(k.currentDistance,ge),Ie=E?{center:[k.camera.position.x,k.camera.position.y,k.camera.position.z],radius:520}:i.clipBounds??i.renderBounds;k.updateClipping(Ie);let It=ue?.center??i.renderBounds.center,Rt=ue?.radius??i.renderBounds.radius,ce=(ze,Ue)=>Math.hypot(k.camera.position.x-ze[0],k.camera.position.y-ze[1],k.camera.position.z-ze[2])<=Ue*(T.detailVisible?1.8:1.55),_e=ce(It,Rt);if(!_e&&W){let ze=i.sections.find(Ue=>Ue.id===W);ze&&(_e=ce(ze.center,Math.max(12,ze.radius*2)))}T.detailVisible=_e;let Me=f.seatProgram.uniforms;Me.uSeatScale.value=ye.scale,Me.uSeatFade.value=ye.fade;let Fn=!!ue&&Ni(ue.seatCount,_.canvas.clientWidth||1,_.canvas.clientHeight||1),Dn=Vi(i.seats.count,ge,k.currentDistance,k.camera.fov,_.canvas.clientHeight||1),tn=T.detailVisible||Fn||Dn?1:0,nn=T.detailVisible||D()>=0||i.floors.length>1?1:0;T.ease(U,tn,nn),Me.uSeatDetail.value=T.seatDetailMix;let On=tn===0&&T.seatDetailMix<.01;f.seatGeometry.setDrawRange(On?Wo:0,On?xi:Wo),f.solidProgram.uniforms.uStructureDetail.value=T.structureDetailMix,Me.uMinPixels.value=ye.minPixels,Me.uPixelToWorld.value=2*Math.tan(k.camera.fov*wy/2)/Math.max(1,_.pixelHeight),T.update(T.detailVisible),_.renderer.render({scene:f.background,clear:!0}),_.renderer.render({scene:f.main,camera:k.camera,clear:!1});let on=p?p.update(performance.now(),[k.camera.position.x,k.camera.position.y,k.camera.position.z],R!==null,X==="seatView"):!1;return p&&_.renderer.render({scene:p.root,camera:k.camera,clear:!1}),K.update(k.camera.projectionViewMatrix,_.canvas.clientWidth||1,_.canvas.clientHeight||1,k.currentDistance,ge,[k.camera.position.x,k.camera.position.y,k.camera.position.z]),ie||on||T.seatDetailMix!==tn||T.structureDetailMix!==nn},re=new Gn(le),Le=typeof ResizeObserver<"u"?new ResizeObserver(()=>Uo.resize()):null;Le?.observe(e),k.setZoomPointResolver((U,X)=>{let Z=_.canvas.getBoundingClientRect(),ie=_.canvas.clientWidth||Z.width,ue=_.canvas.clientHeight||Z.height;if(!(ie>0)||!(ue>0))return null;k.camera.updateMatrixWorld();let ge=ei(i.seats.iPosition,i.seats.count,k.camera.projectionViewMatrix,ie,ue,U-Z.left,X-Z.top,My);if(ge<0)return null;let ye=ge*3;return[i.seats.iPosition[ye],i.seats.iPosition[ye+1]+.5,i.seats.iPosition[ye+2]]});function Ce(U){return[i.seats.iPosition[U],i.seats.iPosition[U+1]+.5,i.seats.iPosition[U+2]]}K.setSeatNumberRow(null);let we=null,ve=0,tt=()=>{ve=0;let U=null;if(we&&!ee?.active&&!N.active){let X=_.canvas.getBoundingClientRect(),Z=_.canvas.clientWidth||X.width,ie=_.canvas.clientHeight||X.height;if(Z>0&&ie>0){let ue=ei(i.seats.iPosition,i.seats.count,k.camera.projectionViewMatrix,Z,ie,we.x-X.left,we.y-X.top,Sy);U=ue>=0?t.seats[ue]?.rowId??null:null}}K.setSeatNumberRow(U)&&re.requestRender()},st=U=>{we={x:U.clientX,y:U.clientY},ve||(ve=requestAnimationFrame(tt))},wt=U=>{U.pointerType==="mouse"&&(we=null,ve||(ve=requestAnimationFrame(tt)))};_.canvas.addEventListener("pointermove",st),_.canvas.addEventListener("pointerdown",st),_.canvas.addEventListener("pointerleave",wt);function ct(U){if(!p)return;let X=[];for(let Z of v.keys()){let ie=i.seats.idToIndex.get(Z);if(ie===void 0)continue;let ue=ie*3;X.push({id:Z,position:Ce(ue)})}p.setSeats(X,performance.now(),U)}let Ft=U=>{let X=ue=>{let ge=i.seats.idToIndex.get(ue);return ge===void 0?void 0:i.seats.iState[ge]},{updates:Z,next:ie}=al(v,U,X);if(v=ie,K.setSelectedSeatIds(v.keys()),ct(!lt()),re.requestRender(),ne(W),Z.length){let ue=rr(i.seats,Z);f&&f.uploadSeatStateRuns(ue),h(),re.requestRender()}},lt=()=>w!==null?w:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,lu=8,ti=U=>{if(!n.getSeatView)return null;let X=S.get(U);if(!X)for(X=Promise.resolve(n.getSeatView(U)),S.set(U,X),X.catch(()=>{S.get(U)===X&&S.delete(U)});S.size>lu;){let Z=S.keys().next().value;if(Z===void 0)break;S.delete(Z)}return X},ni=Il(i.stages,i.focalWorld,i.bounds.groundY??0),uu=Yr(ni),Bo=(U,X)=>{let Z=c.get(U),ie=Math.max(0,Math.round(i.seats.iFloor[X]??0)),ue=t.doc.floors?.[ie],ge=i.floors[ie],ye=ue?.focalPoint??t.doc.focalPoint,Ie=ge?{x:ge.focalWorld[0]/C,y:ge.focalWorld[2]/C}:ye,It=Z?.focalPoint?{x:Z.focalPoint.x+Ie.x-ye.x,y:Z.focalPoint.y+Ie.y-ye.y}:Ie,Rt=[i.seats.iPosition[X*3],i.seats.iPosition[X*3+1],i.seats.iPosition[X*3+2]];return pl(Rt,It,ue?.baseHeightM??0,Z?.eyeHeightM,uu)},oi=()=>(e.clientWidth||_.canvas.clientWidth)<=520,No=null,ri=null,mu=async(U,X,Z)=>{if(!n.getSeatView||M||Z!==Ee.flightGen())return;let ie;try{ie=await Yl()}catch{if(a.panoramaFailed(U,"mount"),!M&&Z===Ee.flightGen()){let ue=Go(U,Z,!0);requestAnimationFrame(()=>ue?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||Z!==Ee.flightGen()||!No))return ri??=ie.createOpenPanorama(No),ri(U,X,Z)},Vo=$l({container:e,model:i,opts:n,expandedSeatById:c,seatIdsByRow:u,isNarrow:oi,isDisposed:()=>M,flightGen:()=>Ee.flightGen(),flyToSeat:U=>ci(U),openPanorama:(U,X,Z)=>mu(U,X,Z)}),Go=Vo.show,Ho=Vo.remove,fu=Vo.layout,Pt=Zl({container:e,orbit:k,isNarrow:oi,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});q=Pt;let du=Pt.element,Jt=Pt.setNavigationMode,hu=Pt.layout,pu=Pt.utilityControls,en=null,ii=!1,Ln=U=>{Pt.setSeatViewLocked(U),U||ee?.exit()};ee=Ll({canvas:_.canvas,camera:k.camera,requestRender:()=>re.requestRender(),reducedMotion:lt,onStopChange:U=>{let X=U??(ii?"seat":null);en=X;try{n.onSeatViewStopChange?.(X)}catch{}},onApplied:()=>{M||k.syncFromCamera()}});let ai=i.sections.reduce((U,X)=>X.seatCount>0&&X.box?Math.max(U,X.box.max[1]):U,-1/0),bu=(U,X)=>{let{eye:Z}=Bo(U,X),ie=(e.clientWidth||_.canvas.clientWidth||1)/Math.max(1,e.clientHeight||_.canvas.clientHeight||1),ue=Al(Z,ni,ie,{preserveEye:!0});if(n.seatViewStops===!1)return{...ue,stops:[]};let ge=l.get(U),ye=ge?i.sections.find(Ie=>Ie.id===ge):void 0;return{...ue,stops:Cl(ue,{aspect:ie,seatingTopY:Number.isFinite(ai)?ai:i.bounds.box.max[1],section:ye&&ye.seatCount>0?{center:ye.center,radius:ye.radius}:null,venue:{center:i.bounds.center,radius:i.bounds.radius}})}},Ee=ou({container:e,model:i,opts:n,orbit:k,cinematic:N,analytics:a,loop:re,labelOverlay:K,stageAzimuth:B,overviewFraming:G,gpu:()=>f,isDisposed:()=>M,panorama:()=>R,setPanorama:U=>{R=U},setPanoramaSphereVisible:U=>{E=U},panoramaLoadAbort:()=>P,setPanoramaLoadAbort:U=>{P=U},setFrozen:U=>{g=U},restorePanoramaLayer:L,reducedMotion:lt,resolvedSeatViewPose:Bo,showSectionSeatLabels:ne,setNearFieldDetailEnabled:V,setSeatViewLocked:Ln,setNavigationMode:Jt,showArriveChip:Go,removeArriveChip:Ho,inSeatView:()=>en!==null,setSeatStepping:U=>{ii=U},seatViewArrival:(U,X)=>n.arriveAtSeatEye?bu(U,X):null,enterSeatView:(U,X)=>ee?.enter(U,X)});O=!0;let zo=Ee.overviewChip,yu=Ee.layoutOverviewChip,gu=Ee.applyFloorFocus,xu=Ee.focusOverview,si=Ee.cancelFlight,ci=Ee.flyToSeat,li=Ee.focusSectionCamera;pu.appendChild(zo),No={container:e,model:i,opts:n,analytics:a,orbit:k,loop:re,seatsById:c,ensureSeatView:ti,resolvedSeatViewPose:Bo,gpu:()=>f,gl:_.gl,isContextLost:()=>y,isDisposed:()=>M,flightGen:()=>Ee.flightGen(),setPanorama:U=>{R=U},getLoadAbort:()=>P,setLoadAbort:U=>{P=U},setPanoramaSphereVisible:U=>{E=U,U&&ee?.exit()},setFrozen:U=>{g=U},raisePanoramaLayer:I,restorePanoramaLayer:L,getOverviewChip:()=>zo,labelOverlay:K,reducedMotion:lt,removeArriveChip:Ho,showArriveChip:Go};let ut=Ql({glctx:_,orbit:k,model:i,seats:t.seats,opts:n,cinematic:N,analytics:a,seatIdByIndex:s,sectionIdBySeatId:l,tapSlop:Py,tapMs:Iy,gpu:()=>f,pick:()=>b,seatViewLocked:()=>Pt.seatViewLocked(),focusedSectionId:()=>W,selection:()=>v,cancelFlight:si,focusSectionCamera:li,focusSeatCamera:Ee.focusSeatCamera,setSelection:Ft,ensureSeatView:ti});_.canvas.addEventListener("pointerdown",ut.onDown),_.canvas.addEventListener("pointermove",ut.onMove),_.canvas.addEventListener("pointerup",ut.onUp),_.canvas.addEventListener("pointercancel",ut.onUp),re.requestRender();let Uo={setAvailability(U){let X=il(v,U),Z=rr(i.seats,X);Z.length&&f&&f.uploadSeatStateRuns(Z),h(),re.requestRender()},setSelection:Ft,setNavigationMode:Jt,zoomIn(){k.zoomBy(Bt),re.requestRender()},zoomOut(){k.zoomBy(un),re.requestRender()},flyToSeat:ci,focusOverview:xu,seatViewStop:()=>en,recentreSeatView:()=>ee?.recentre()??!1,resize(){let{width:U,height:X}=_.resize();k.setAspect(U/Math.max(1,X)),fu(),hu(),yu(),re.requestRender()},stats(){return{...re.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;le(0);let X=_.canvas,Z=Math.min(1,U/Math.max(X.width,X.height,1)),ie=document.createElement("canvas");ie.width=Math.max(1,Math.round(X.width*Z)),ie.height=Math.max(1,Math.round(X.height*Z));let ue=ie.getContext("2d");return ue?(ue.drawImage(X,0,0,ie.width,ie.height),ie.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let U=re.stats(),X=_.canvas.clientWidth||1,Z=_.canvas.clientHeight||1,ie=i.bounds.center,ue=Ze(k.camera.projectionViewMatrix,[ie[0],i.bounds.box.min[1],ie[2]],X,Z),ge=Ze(k.camera.projectionViewMatrix,[ie[0],i.bounds.box.max[1],ie[2]],X,Z),ye=i.bounds.box,Ie=[ye.min[0],ye.max[0]].flatMap(ce=>[ye.min[1],ye.max[1]].flatMap(_e=>[ye.min[2],ye.max[2]].map(Me=>Ze(k.camera.projectionViewMatrix,[ce,_e,Me],X,Z)))).filter(ce=>Number.isFinite(ce.x)&&Number.isFinite(ce.y)&&Number.isFinite(ce.depth)),It=Ie.length?(()=>{let ce=Math.min(...Ie.map(Ue=>Ue.x)),_e=Math.max(...Ie.map(Ue=>Ue.x)),Me=Math.min(...Ie.map(Ue=>Ue.y)),Fn=Math.max(...Ie.map(Ue=>Ue.y)),Dn=Math.max(0,ce),tn=Math.min(X,_e),nn=Math.max(0,Me),On=Math.min(Z,Fn),on=Math.max(0,tn-Dn),ze=Math.max(0,On-nn);return{box:{x:Dn,y:nn,width:on,height:ze},horizontalFillRatio:on/X,verticalFillRatio:ze/Z,visibleAreaRatio:on*ze/(X*Z),clippedEdges:[...Me<0?["top"]:[],..._e>X?["right"]:[],...Fn>Z?["bottom"]:[],...ce<0?["left"]:[]]}})():void 0,Rt=String(_.gl.getParameter(_.gl.VERSION)??"");return{viewport:{width:X,height:Z},context:{webgl2:/webgl\s*2/i.test(Rt),lost:y},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[k.camera.position.x,k.camera.position.y,k.camera.position.z],distance:k.currentDistance,verticalFovDeg:k.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:ue.visible&&ge.visible?Math.abs(ue.y-ge.y):0},labels:K.qualityEvidence(),framing:It,...en?{seatView:{fovDeg:k.camera.fov,stop:en}}:{}}},getQualityReport(){return vo(Uo.getQualityEvidence())},loseContextForTest(){_.simulateContextLossCycle()},floors(){return i.floors},focusFloor(U){if(U!==null&&!i.floors.some(Z=>Z.index===U))return!1;let X=U??-1;if(V(U!==null),Ln(!1),gu(X),Jt("orbit"),U===null)N.cancel(),lt()?k.frame(i.bounds,!1,B,n.portraitOverviewCrop===!0,G):k.frameSoft(i.bounds,B,n.portraitOverviewCrop===!0,G);else{let Z=i.floors[U];if(Z.seatCount>0){N.cancel();let ie=Z.focalWorld[0]-Z.center[0],ue=Z.focalWorld[2]-Z.center[2],ge=Math.hypot(ie,ue)>Z.radius*.12?Math.atan2(ie,ue):B;k.frame({center:Z.center,radius:Z.radius,box:Z.box},!1,ge,!1,{polarDeg:58,margin:1.12})}}return re.requestRender(),!0},zones(){return i.zones},focusZone(U){let X=i.zones.find(ge=>ge.id===U);if(!X||X.seatCount===0)return!1;V(!1),Ln(!1),N.cancel(),Jt("orbit"),ne(null),n.onSectionFocusChange?.(null);let Z=X.focalWorld[0]-X.center[0],ie=X.focalWorld[2]-X.center[2],ue=Math.hypot(Z,ie)>X.radius*.12?Math.atan2(Z,ie):void 0;return k.frame({center:X.center,radius:X.radius*1.25},!1,ue),re.requestRender(),!0},sections(){return i.sections},focusSection(U){return li(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:(V(!0),Ln(!1),N.cancel(),Jt("pan"),X.sectionId&&(ne(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),k.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),re.requestRender(),!0)},setReducedMotionForTest(U){w=U},dispose(){M=!0,Ho(),zo.remove(),du.remove(),si(),ee?.dispose(),re.stop(),K.dispose(),Le?.disconnect(),R&&(R.dispose(),R=null),L(),z(),_.canvas.removeEventListener("pointerdown",ut.onDown),_.canvas.removeEventListener("pointermove",ut.onMove),_.canvas.removeEventListener("pointerup",ut.onUp),_.canvas.removeEventListener("pointercancel",ut.onUp),_.canvas.removeEventListener("pointermove",st),_.canvas.removeEventListener("pointerdown",st),_.canvas.removeEventListener("pointerleave",wt),ve&&cancelAnimationFrame(ve),k.dispose(),b&&b.dispose(),f&&f.dispose(),f=null,p?.dispose(),p=null,b=null,_.dispose()}};return a.opened(i.seatCount,d,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),Uo}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});