@seatlayer/core 0.101.0 → 0.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-D6ASWQBI.js +1 -0
- package/dist/be-T23MSCFC.js +1 -0
- package/dist/bg-2MMSY43I.js +1 -0
- package/dist/ca-EXRTYE33.js +1 -0
- package/dist/{categoryInventory-H77A_8pF.d.cts → categoryInventory-D_gpkfsq.d.cts} +1 -1
- package/dist/{categoryInventory-DZ5IcDOy.d.ts → categoryInventory-i-mGCBD3.d.ts} +1 -1
- package/dist/chunk-2STEWCI2.js +1 -0
- package/dist/chunk-33SRM2CP.js +1 -0
- package/dist/chunk-3W4ZMU4G.js +1 -0
- package/dist/chunk-76AUT55N.js +1 -0
- package/dist/chunk-B75VUM6L.js +1 -0
- package/dist/{chunk-L34T3APU.js → chunk-FAY7ARLB.js} +1 -1
- package/dist/{chunk-2RNZOV5I.js → chunk-GPZFVQXV.js} +1 -1
- package/dist/chunk-JRZHC75P.js +1 -0
- package/dist/chunk-KTMZ3QAO.js +1 -0
- package/dist/chunk-NWRHKTMV.js +1 -0
- package/dist/{chunk-5HXTEMRE.js → chunk-QG7ZFUNX.js} +1 -1
- package/dist/{chunk-GLGXP5I7.js → chunk-R2TRYVOY.js} +1 -1
- package/dist/chunk-RF4QU72N.js +1 -0
- package/dist/chunk-TFYAMLCK.js +1 -0
- package/dist/chunk-TZBJCAXH.js +1 -0
- package/dist/chunk-UEDS3HJ3.js +1 -0
- package/dist/chunk-UEYHH7Y5.js +1 -0
- package/dist/chunk-WH2EVBIG.js +1 -0
- package/dist/chunk-WKWXU5QM.js +1 -0
- package/dist/{chunk-P4J57TK6.js → chunk-YPVYZYMH.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +491 -18
- package/dist/core/chart-ops/index.d.ts +491 -18
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/color.d.cts +1 -1
- package/dist/core/color.d.ts +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +72 -5
- package/dist/core/inventory/index.d.ts +72 -5
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +63 -6
- package/dist/core/layout/index.d.ts +63 -6
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.cjs +1 -1
- package/dist/core/quality/index.d.cts +18 -4
- package/dist/core/quality/index.d.ts +18 -4
- package/dist/core/quality/index.js +1 -1
- package/dist/core/render-assets/index.cjs +1 -1
- package/dist/core/render-assets/index.d.cts +45 -5
- package/dist/core/render-assets/index.d.ts +45 -5
- package/dist/core/render-assets/index.js +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.cjs +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/core/sections/index.js +1 -1
- package/dist/cs-L5EG7LLR.js +1 -0
- package/dist/cy-AB2Q6XHI.js +1 -0
- package/dist/da-EGJO7W4Q.js +1 -0
- package/dist/de-Q56NNVPD.js +1 -0
- package/dist/el-JW2YADAL.js +1 -0
- package/dist/es-N35HVHMD.js +1 -0
- package/dist/et-53UYPQR7.js +1 -0
- package/dist/{eventConfigurations-ClFqXQi9.d.cts → eventConfigurations-C0x_OtjQ.d.cts} +1 -1
- package/dist/{eventConfigurations-B6aS6c-_.d.ts → eventConfigurations-CDPqKz_8.d.ts} +1 -1
- package/dist/fa-JL3HW42Q.js +1 -0
- package/dist/fi-ZFWROLPU.js +1 -0
- package/dist/fr-6EKBGKIT.js +1 -0
- package/dist/he-KSOTIRJW.js +1 -0
- package/dist/hi-RWHSYCVV.js +1 -0
- package/dist/hr-ECH5LYKR.js +1 -0
- package/dist/hu-BAXHRRWC.js +1 -0
- package/dist/id-ECFNLK3G.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +65 -17
- package/dist/index.d.ts +65 -17
- package/dist/index.js +1 -1
- package/dist/it-HT57FDFI.js +1 -0
- package/dist/ja-LHVHSM5J.js +1 -0
- package/dist/ko-G2HVHBKT.js +1 -0
- package/dist/ku-MNPV6BJJ.js +1 -0
- package/dist/{labeling-ByEZkLee.d.cts → labeling-20iLar-Q.d.ts} +11 -3
- package/dist/{labeling-CP3GhUrf.d.ts → labeling-DW_pEMgl.d.cts} +11 -3
- package/dist/localeLoaders-L36RHPNS.js +1 -0
- package/dist/lt-GB2GJDNS.js +1 -0
- package/dist/lv-3ZE6IM47.js +1 -0
- package/dist/ms-YH2PYOHG.js +1 -0
- package/dist/nl-D4FX7T7U.js +1 -0
- package/dist/no-5YNLYHN4.js +1 -0
- package/dist/pl-RUXCR6JV.js +1 -0
- package/dist/pt-TKFGIUL6.js +1 -0
- package/dist/{renderedQuality--H0toc-2.d.cts → renderedQuality-BIWwSRMS.d.cts} +1 -1
- package/dist/{renderedQuality-Bo4k99GE.d.ts → renderedQuality-CdpKQidA.d.ts} +1 -1
- package/dist/{renderer-BPhSZUGh.d.cts → renderer-BSjyHBDK.d.cts} +8 -1
- package/dist/{renderer-CWbam_zr.d.ts → renderer-BurPZ2Io.d.ts} +8 -1
- package/dist/ro-UFIOIOVH.js +1 -0
- package/dist/ru-VMRD53B7.js +1 -0
- package/dist/{seatTypeIcons-CSt1isBY.d.ts → seatTypeIcons-BlEzPXFf.d.cts} +2 -2
- package/dist/{seatTypeIcons-B2tvcQ0H.d.cts → seatTypeIcons-D_T5HfJs.d.ts} +2 -2
- package/dist/{sections-C_AKwOIh.d.cts → sections-BySKMsFE.d.ts} +5 -2
- package/dist/{sections-JHox6Lsw.d.ts → sections-DXUcW0ZT.d.cts} +5 -2
- package/dist/{segmentedRowModel-DQO0vHR1.d.ts → segmentedRowModel-C5qFY6jJ.d.ts} +1 -1
- package/dist/{segmentedRowModel-CZ0Ciea-.d.cts → segmentedRowModel-CyW-LFuI.d.cts} +1 -1
- package/dist/sk-XIK2KO3F.js +1 -0
- package/dist/sl-CDZGH6C6.js +1 -0
- package/dist/sr-A3TESNV3.js +1 -0
- package/dist/sv-HKGKDGSG.js +1 -0
- package/dist/{tableSizing-ClgbhNks.d.ts → tableSizing-Bos5ueqg.d.cts} +5 -4
- package/dist/{tableSizing-Cp5T_6Lw.d.cts → tableSizing-CAiE_oii.d.ts} +5 -4
- package/dist/th-ZPGRIY7D.js +1 -0
- package/dist/{ticketRestrictions-DUdzkp4F.d.ts → ticketRestrictions-DKdJWh9u.d.cts} +39 -3
- package/dist/{ticketRestrictions-BHNbxzFT.d.cts → ticketRestrictions-DRDtAVKw.d.ts} +39 -3
- package/dist/tr-IUB54G3R.js +1 -0
- package/dist/{types-5AlKCD4j.d.ts → types-ZviQR7ch.d.cts} +194 -9
- package/dist/{types-5AlKCD4j.d.cts → types-ZviQR7ch.d.ts} +194 -9
- package/dist/uk-JQKEV42K.js +1 -0
- package/dist/vi-KRM5S2Q7.js +1 -0
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +54 -54
- package/dist/view3d/index.d.cts +13 -3
- package/dist/view3d/index.d.ts +13 -3
- package/dist/view3d/index.js +44 -44
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-FEUYIOYS.js +1 -0
- package/dist/zh-Hant-PK2XOE2G.js +1 -0
- package/package.json +1 -1
- package/dist/ar-Q44JP5JY.js +0 -1
- package/dist/be-CGFFSIQL.js +0 -1
- package/dist/bg-WOYK6OLH.js +0 -1
- package/dist/ca-77ZVI3X5.js +0 -1
- package/dist/chunk-52XO3LA7.js +0 -1
- package/dist/chunk-5BMXWOE7.js +0 -1
- package/dist/chunk-5ITK5236.js +0 -1
- package/dist/chunk-5N4H3KMR.js +0 -1
- package/dist/chunk-5PFYIYM5.js +0 -1
- package/dist/chunk-CTIGUXXK.js +0 -1
- package/dist/chunk-D723OZEY.js +0 -1
- package/dist/chunk-FLZKBXHA.js +0 -1
- package/dist/chunk-HO4MFTVX.js +0 -1
- package/dist/chunk-JK3DUFRX.js +0 -1
- package/dist/chunk-N4J4CT6P.js +0 -1
- package/dist/chunk-NO6OLVTT.js +0 -1
- package/dist/chunk-TQN2VWQO.js +0 -1
- package/dist/chunk-UISTXRO5.js +0 -1
- package/dist/cs-OSBZYCSR.js +0 -1
- package/dist/cy-ZCOJW2WH.js +0 -1
- package/dist/da-2PDK6JTR.js +0 -1
- package/dist/de-R5LLVFUU.js +0 -1
- package/dist/el-ZPFVDCWA.js +0 -1
- package/dist/es-7YASJP32.js +0 -1
- package/dist/et-J4TV6KQL.js +0 -1
- package/dist/fa-4TEO7UGM.js +0 -1
- package/dist/fi-GIUDDKMH.js +0 -1
- package/dist/fr-J5J2XJLA.js +0 -1
- package/dist/he-OCEHSVUJ.js +0 -1
- package/dist/hi-EK5CTBW5.js +0 -1
- package/dist/hr-SLDTQOYC.js +0 -1
- package/dist/hu-2QNE77NO.js +0 -1
- package/dist/id-LGDAFQJK.js +0 -1
- package/dist/it-DT4Y3IYB.js +0 -1
- package/dist/ja-D5EY2XCQ.js +0 -1
- package/dist/ko-DD2NV45Q.js +0 -1
- package/dist/ku-KZCMVLBE.js +0 -1
- package/dist/localeLoaders-GGAKX22E.js +0 -1
- package/dist/lt-QWGTJ47Y.js +0 -1
- package/dist/lv-LYAIG3VK.js +0 -1
- package/dist/ms-XTF4KNGD.js +0 -1
- package/dist/nl-QEXY6XHS.js +0 -1
- package/dist/no-HCOXN2CN.js +0 -1
- package/dist/pl-BWY53TSD.js +0 -1
- package/dist/pt-2UJUBCPL.js +0 -1
- package/dist/ro-GGXOLTED.js +0 -1
- package/dist/ru-ZTFK3WCU.js +0 -1
- package/dist/sk-KU543Y2U.js +0 -1
- package/dist/sl-FT576R7A.js +0 -1
- package/dist/sr-WE3J46JE.js +0 -1
- package/dist/sv-YEAOPSEB.js +0 -1
- package/dist/th-BEBRDHJA.js +0 -1
- package/dist/tr-LOAHUPSH.js +0 -1
- package/dist/uk-2GMICSHN.js +0 -1
- package/dist/vi-TC5B6AUR.js +0 -1
- package/dist/zh-Hans-TSZWTZQY.js +0 -1
- package/dist/zh-Hant-TLB4FZYM.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ze,c as qe,d as $e}from"./chunk-FAY7ARLB.js";import{b as De,c as Ue,d as ze,e as Ke,h as Ve}from"./chunk-WKWXU5QM.js";import{v as Qe}from"./chunk-QG7ZFUNX.js";import{a as We,c as Vt,d as pt,f as xt,i as Ye}from"./chunk-B75VUM6L.js";import{e as Xe,l as je}from"./chunk-4N5CHKHD.js";import{n as Vn}from"./chunk-33SRM2CP.js";import{h as Mn}from"./chunk-UEDS3HJ3.js";import{Ba as Kt,C as Ce,Ca as Sn,D as Yt,Da as ve,Ha as Kn,Ja as Ne,Ya as Rt,ca as ke,da as Fe,fb as In,j as Oe,ka as $,la as Pt,ua as Pn,wa as zt,xa as Rn,za as Le}from"./chunk-3W4ZMU4G.js";import{A as It,D as He,b as Ge,d as it,y as st}from"./chunk-JBOTRSMY.js";var rn=["available","held","sold","selected","dimmed"];function Zn(t){let n=rn.indexOf(t);return n<0?0:n}var Je={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Ll(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.78,r=.86;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}var qn={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]},$n={top:[.05,.06,.08],bottom:[.1,.12,.15]};function V(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}import ri from"earcut";import no from"polygon-clipping";var R=$,ii=.002;function si(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<ii}var Xt=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},wn=class{constructor(){this.pos=new Xt;this.nor=new Xt;this.col=new Xt;this.flr=new Xt;this.mat=new Xt;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,r,o,a,i=a,s=a){si(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[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(n,e,r,o,a,i,s,c=s,l=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function ai(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],c=e[2]-t[2],l=o*c-a*s,u=a*i-r*c,f=r*s-o*i,m=Math.hypot(l,u,f)||1;return l/=m,u/=m,f/=m,[l,u,f]}function ci(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=ri(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Et(t){return pt(t)<0?[...t].reverse():t}var li=3;function ui(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,d,y,b)=>Math.abs(r({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(y+b)/2),c=(t.x+n.x+e.x)/3,l=(t.y+n.y+e.y)/3,u=(o+a+i)/3,f=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:c,y:l})-u)),m=(h,d,y)=>{let b=Math.abs(r({x:(h+c)/2,y:(d+l)/2})-(y+u)/2);b>f&&(f=b)};return m((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),m((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),f}function sn(t,n,e,r,o){if(o<=0)return ui(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(sn(t,a,s,r,o-1),sn(a,n,i,r,o-1),sn(s,i,e,r,o-1),sn(a,i,s,r,o-1))}function an(t,n,e,r,o,a,i,s){if(i>0){let m={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},d={x:(r.x+n.x)/2,y:(r.y+n.y)/2};an(t,n,m,d,o,a,i-1,s),an(t,m,e,h,o,a,i-1,s),an(t,d,h,r,o,a,i-1,s),an(t,m,h,d,o,a,i-1,s);return}let c=[n.x*R,o(n),n.y*R],l=[e.x*R,o(e),e.y*R],u=[r.x*R,o(r),r.y*R];if(s){t.triN(c,l,u,s(n),s(e),s(r),a);return}let f=ai(c,l,u);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),t.tri(c,l,u,f,a)}var fi=8;function to(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,c,l)=>{if(l>0){let u={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=n(u);if(Math.abs(f-(s+c)/2)>e){o(a,u,s,f,l-1),o(u,i,f,c,l-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),fi)}return r}function _n(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l);u>n&&Math.abs((i.x-a.x)*l-(i.y-a.y)*c)/u<n||r.push(i)}return r.length>=3?r:e}var An=.001*Pt*.1;function Z(t,n,e,r,o,a,i,s,c=1/0,l){if(!n||n.length<3||(c===void 0&&(c=1/0),Math.abs(pt(n))<1e-4))return;let u=_n(to(_n(Et(n),An),r,c),An),f=e?.map(x=>_n(to(_n(Et(x),An),r,c),An)).filter(x=>x.length>=3&&Math.abs(pt(x))>=1e-4),{pts:m,tris:h}=ci(u,f),d=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],b=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<li;g++){let x=0;for(let _=0;_<h.length;_+=3){let I=sn(m[h[_]],m[h[_+1]],m[h[_+2]],r,g);I>x&&(x=I)}if(x<=c)break}for(let x=0;x<h.length;x+=3){let _=m[h[x]],I=m[h[x+1]],S=m[h[x+2]];an(t,_,I,S,r,d,g,l);let B=[_.x*R,o,_.y*R],T=[I.x*R,o,I.y*R],F=[S.x*R,o,S.y*R];t.tri(B,F,T,[0,-1,0],y)}let P=x=>{if(g<=0)return x;let _=1<<g,I=[];for(let S=0;S<x.length;S++){let B=x[S],T=x[(S+1)%x.length];for(let F=0;F<_;F++){let k=F/_;I.push({x:B.x+(T.x-B.x)*k,y:B.y+(T.y-B.y)*k})}}return I},A=Ce(u),M=[{ring:P(u),flip:!1}];if(f)for(let x of f)x.length>=3&&M.push({ring:P(x),flip:!0});for(let{ring:x,flip:_}of M)for(let I=0;I<x.length;I++){let S=x[I],B=x[(I+1)%x.length],T=(B.x-S.x)*R,k=(B.y-S.y)*R,w=-T,E=Math.hypot(k,w)||1;k/=E,w/=E;let C=(S.x+B.x)/2-A.x,L=(S.y+B.y)/2-A.y,O=k*C+w*L;_&&(O=-O),O<0&&(k=-k,w=-w);let D=[k,0,w],H=[S.x*R,r(S),S.y*R],j=[B.x*R,r(B),B.y*R],G=[S.x*R,o,S.y*R],U=[B.x*R,o,B.y*R];t.tri(H,j,U,D,b,b,p),t.tri(H,U,G,D,b,p,p)}}function eo(t){let n=0;for(let c of t)n+=c.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let c of t)e.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),a.set(c.floor,s),i.set(c.material,s),s+=c.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function _t(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Et(t),o=r.length,a=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,f=l.y-c.y,m=Math.hypot(u,f)||1;a.push({x:f/m,y:-u/m})}let i=[];for(let s=0;s<o;s++){let c=r[s],l=a[(s-1+o)%o],u=a[s],f=l.x+u.x,m=l.y+u.y,h=Math.hypot(f,m),d=()=>{i.push([c.x+l.x*n,c.y+l.y*n]),i.push([c.x+u.x*n,c.y+u.y*n])};if(h<1e-9){d();continue}f/=h,m/=h;let y=f*l.x+m*l.y,b=1/Math.max(y,1e-6);if(!Number.isFinite(b)||b>e){d();continue}i.push([c.x+f*n*b,c.y+m*n*b])}if(i.length<3)return t;try{let s=no.union([[...i,i[0]]]),c=null,l=-1/0;for(let f of s){let m=Math.abs(pt(f[0].map(([h,d])=>({x:h,y:d}))));m>l&&(l=m,c=f[0])}if(!c)return t;let u=c.map(([f,m])=>({x:f,y:m}));if(u.length>1){let f=u[0],m=u[u.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:t}catch{return t}}function Lt(t,n,e=2.5){if(t.length<3)return[];if(n<=0)return t;let r=Et(t),o=r.length,a=[];for(let c=0;c<o;c++){let l=r[c],u=r[(c+1)%o],f=Math.hypot(u.x-l.x,u.y-l.y)||1;a.push({x:-(u.y-l.y)/f,y:(u.x-l.x)/f})}let i=[],s=[];for(let c=0;c<o;c++){let l=r[c],u=a[(c-1+o)%o],f=a[c],m=u.x+f.x,h=u.y+f.y,d=Math.hypot(m,h),y=d<1e-9?1/0:1/Math.max(m/d*u.x+h/d*u.y,1e-6);if(!Number.isFinite(y)||y>e){i.push({x:l.x+u.x*n,y:l.y+u.y*n},{x:l.x+f.x*n,y:l.y+f.y*n}),s.push(c,c);continue}m/=d,h/=d,i.push({x:l.x+m*n*y,y:l.y+h*n*y}),s.push(c)}for(let c=0;c<i.length;c++){let l=(c+1)%i.length,u=s[c],f=s[l];if(f!==(u+1)%o)continue;let m=r[u],h=r[f];if((i[l].x-i[c].x)*(h.x-m.x)+(i[l].y-i[c].y)*(h.y-m.y)<=0)return[]}try{let c=no.intersection([[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]],[[...r.map(d=>[d.x,d.y]),[r[0].x,r[0].y]]]),l=null,u=0;for(let d of c){let y=Math.abs(pt(d[0].map(([b,p])=>({x:b,y:p}))));y>u&&(u=y,l=d[0])}if(!l)return[];let f=l.map(([d,y])=>({x:d,y})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?Et(f):[]}catch{return[]}}function En(t,n,e,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function cn(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var ut={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},mi=.44,hi=.15,yi=.3,di=.24;function ro(t){return t===void 0||!Number.isFinite(t)||t<=0?di:Math.min(yi,Math.max(hi,t*mi))}var Ul=.21,pi=.05,Qn=.45,xi=Qn+pi,bi=.92,oo=.66,gi=1.205,Mi=-.23,Pi=.38,Ri=[{part:ut.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ut.pad,min:[-1,.36,-.95],max:[1,Qn,1]},{part:ut.back,min:[-1,xi,-1],max:[1,bi,-.72]},{part:ut.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ut.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ut.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ut.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ut.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ut.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ut.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Si=[{part:ut.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ut.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ut.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ut.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ut.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Ii=[{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 Wl(){let t=[],n=[],e=[],r=[],o=(G,U,X)=>{let Y=e.length,[nt,rt,q]=G,Q=[rt[0]-nt[0],rt[1]-nt[1],rt[2]-nt[2]],J=[q[0]-nt[0],q[1]-nt[1],q[2]-nt[2]],v=Q[1]*J[2]-Q[2]*J[1],N=Q[2]*J[0]-Q[0]*J[2],W=Q[0]*J[1]-Q[1]*J[0],lt=Math.hypot(v,N,W);lt>1e-9?(v/=lt,N/=lt,W/=lt):[v,N,W]=U,v*U[0]+N*U[1]+W*U[2]<0&&(v=-v,N=-N,W=-W);for(let ft of G)t.push(...ft),n.push(v,N,W),e.push(X);r.push(Y,Y+1,Y+2,Y,Y+2,Y+3)},a=G=>{for(let U of Ii){let X=U.c.map(Y=>Y.map((nt,rt)=>nt?G.max[rt]:G.min[rt]));o(X,U.n,G.part)}},i=(G,U)=>{let[X,Y,nt]=U?[0,1,2]:[0,2,1],rt=G.min[X],q=G.max[X],Q=G.min[Y],J=G.max[Y],v=(q-rt)*.1,N=(J-Q)*.1,W=U?[[rt+v,Q],[q-v,Q],[q,Q+N],[q*.94,J-(J-Q)*.23],[q*oo,J],[rt*oo,J],[rt*.94,J-(J-Q)*.23],[rt,Q+N]]:[[rt+v,Q],[q-v,Q],[q,Q+N],[q,J-N],[q-v,J],[rt+v,J],[rt,J-N],[rt,Q+N]],lt=(at,tt,et)=>{let ht=[0,0,0];return ht[X]=at,ht[Y]=tt,ht[nt]=et,ht},ft=[G.min[nt],G.max[nt]].map(at=>W.map(([tt,et])=>lt(tt,et,at)));for(let at=0;at<W.length;at++){let tt=(at+1)%W.length,et=[0,0,0];et[X]=(W[at][0]+W[tt][0])/2-(rt+q)/2,et[Y]=(W[at][1]+W[tt][1])/2-(Q+J)/2,o([ft[0][at],ft[0][tt],ft[1][tt],ft[1][at]],et,G.part)}for(let at=0;at<2;at++){let tt=[0,0,0];tt[nt]=at?1:-1;let et=ft[at];for(let ht=1;ht<et.length-1;ht++){let z=e.length;for(let mt of[et[0],et[ht],et[ht+1]])t.push(...mt),n.push(...tt),e.push(G.part);r.push(z,z+1,z+2)}}};for(let G of Ri)G.part===ut.pad||G.part===ut.back?i(G,G.part===ut.back):a(G);for(let G of Si)a(G);let s=Qn,c=1.08,l=.47,u=.69,f=-.55,m=.08,h=-.48,d=.01,y=[-l,s,f],b=[l,s,f],p=[-l,s,m],g=[l,s,m],P=[-u,c,h],A=[u,c,h],M=[-u,c,d],x=[u,c,d];o([b,A,x,g],[1,0,0],ut.body),o([p,M,P,y],[-1,0,0],ut.body),o([y,b,g,p],[0,-1,0],ut.body);let _=c+.07,I=.24,S=[-I,_,h],B=[I,_,h],T=[-I,_,d],F=[I,_,d];o([M,T,S,P],[-.5,1,0],ut.body),o([T,F,B,S],[0,1,0],ut.body),o([F,x,A,B],[.5,1,0],ut.body),o([g,x,M,p],[0,0,1],ut.body),o([x,F,T,M],[0,0,1],ut.body),o([y,P,A,b],[0,0,-1],ut.body),o([P,S,B,A],[0,0,-1],ut.body);let k=10,w=8,E=[0,gi,Mi],C=[.32,.115,Pi],L=e.length;for(let G=0;G<=w;G++){let U=Math.PI*G/w,X=Math.cos(U),Y=Math.sin(U);for(let nt=0;nt<=k;nt++){let rt=Math.PI*2*nt/k,q=Y*Math.cos(rt),Q=Y*Math.sin(rt);t.push(E[0]+C[0]*q,E[1]+C[1]*X,E[2]+C[2]*Q);let J=q/C[0],v=X/C[1],N=Q/C[2],W=Math.hypot(J,v,N)||1;J/=W,v/=W,N/=W,n.push(J,v,N),e.push(ut.head)}}for(let G=0;G<w;G++)for(let U=0;U<k;U++){let X=L+G*(k+1)+U,Y=X+k+1;r.push(X,Y,X+1,X+1,Y,Y+1)}let O=new Float32Array(t),D=new Float32Array(n),H=new Float32Array(e),j=new Uint16Array(r);return{position:O,normal:D,part:H,index:j,vertexCount:e.length,indexCount:r.length}}function io(t,n,e,r){let o=new Float32Array(n),a=l=>t[l*3],i=l=>t[l*3+2],s=0,c=(l,u)=>{let f=u-l;for(let m=l;m<u;m++){let[h,d]=r(m),y=h-a(m),b=d-i(m);if(f>=2){let p=Math.max(l,m-1),g=Math.min(u-1,m+1),P=a(g)-a(p),A=i(g)-i(p),M=Math.hypot(P,A);if(M>1e-6){let x=-A/M,_=P/M;x*y+_*b<0&&(x=-x,_=-_),y=x,b=_}}o[m]=y===0&&b===0?0:Math.atan2(y,b)}};for(let l=1;l<=n;l++)(l===n||e(l)!==e(s))&&(c(s,l),s=l);return o}var Bn=.22;function Jl(t,n){let e=rn[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var _i=.42;function Ai(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let d of t)d.x<r&&(r=d.x),d.y<o&&(o=d.y),d.x>a&&(a=d.x),d.y>i&&(i=d.y);let s=Math.max(a-r,1e-6),c=Math.max(i-o,1e-6),l=Math.max(Math.sqrt(s*c/n),1e-6),u=Math.max(1,Math.ceil(s/l)+1),f=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(d,y)=>{let b=Math.min(u-1,Math.max(0,Math.floor((d-r)/l)));return Math.min(f-1,Math.max(0,Math.floor((y-o)/l)))*u+b};for(let d=0;d<n;d++){let y=h(t[d].x,t[d].y),b=m.get(y);b?b.push(d):m.set(y,[d])}for(let d=0;d<n;d++){let y=t[d],b=Math.min(u-1,Math.max(0,Math.floor((y.x-r)/l))),p=Math.min(f-1,Math.max(0,Math.floor((y.y-o)/l))),g=1/0;for(let P=1;P<=4;P++){for(let A=p-P;A<=p+P;A++)if(!(A<0||A>=f))for(let M=b-P;M<=b+P;M++){if(M<0||M>=u||P>1&&Math.abs(A-p)<P&&Math.abs(M-b)<P)continue;let x=m.get(A*u+M);if(x)for(let _ of x){if(_===d)continue;let I=Math.hypot(t[_].x-y.x,t[_].y-y.y);I<g&&(g=I)}}if(Number.isFinite(g)&&g<=P*l)break}e[d]=g}return e}function wi(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Pn):0}function so(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),c=new Float32Array(i),l=new Float32Array(i*3),u=new Float32Array(i),f=new Float32Array(i),m=new Float32Array(i),h=new Float32Array(i),d=new Float32Array(i*3),y=new Map,b=Ai(t);for(let p=0;p<i;p++){let g=t[p],A=(e?.seatPitchU(p)??b[p])*R;u[p]=Number.isFinite(A)?Math.max(.06,Math.min(Bn,A*_i)):Bn,f[p]=ro(Number.isFinite(A)?A:void 0);let M=je(g.glyph,{seatGlyph:a?.get(g.categoryKey)});m[p]=Xe.indexOf(M),h[p]=g.wheelchairSpaceType==="no-seat"?0:1,s[p*3]=g.x*R,s[p*3+1]=e?e.seatDeckY(p):wi(g),s[p*3+2]=g.y*R,c[p]=Zn(n?n(g):"available");let x=it(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[p*3]=x[0],l[p*3+1]=x[1],l[p*3+2]=x[2],g.accessibility?.length){let _=it(Mn(g.accessibility));_&&(d[p*3]=_[0],d[p*3+1]=_[1],d[p*3+2]=_[2])}y.set(g.id,p)}return{count:i,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:d,idToIndex:y,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iSection:new Float32Array(i).fill(-1),iYaw:new Float32Array(i)}}var Ei=64;function tu(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let c=Zn(i.state);t.iState[s]!==c&&(t.iState[s]=c,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Ei){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}import Xi from"polygon-clipping";var K={top:1,wallBottom:.58,bottomCap:.4};function jt(t,n){if(!t)return n;let e=V(It(t,.4),.62);return st(n,e,.22)}function ao(t,n){return t?st(n,V(It(t,.25),.74),.62):n}function co(t,n){return t?st(n,V(It(t,.08),.9),.82):n}function lo(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,c=0,l=0,u=0;for(let[f,m]of i){let h=it(e.get(f));h&&(s+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&o.set(a,[s/u,c/u,l/u])}return o}function uo(t,n){return it(t.color)??n.get(t.logicalSectionId??t.id)??null}import Io from"polygon-clipping";import yo from"polygon-clipping";import Bi from"earcut";var Ti=.58,fo=.01,St=Bn*1.5*Pt,Oi=.5,Ci=.6;function ki(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],c=t[Math.min(e-1,i+1)],l=c.x-s.x,u=c.y-s.y,f=Math.hypot(l,u);if(f<1e-9){r.push([0,0]);continue}l/=f,u/=f,r.push([-u,l])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function Fi(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var mo=Math.PI/12;function Li(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function po(t,n){if(!t.length||!(n>0))return[];let e=Li(t),r=(s,c,l,u)=>{let f=l-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/mo)),h=n/Math.cos(f/m/2);for(let d=0;d<=m;d++){let y=c+f*d/m;u.push({x:s.x+Math.cos(y)*h,y:s.y+Math.sin(y)*h})}};if(e.length<3){let s=0,c=0;for(let h of e)s+=h.x,c+=h.y;s/=e.length||1,c/=e.length||1;let l=0;for(let h of e)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let u=[],f=Math.max(3,Math.ceil(Math.PI*2/mo)),m=(l+n)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;u.push({x:s+Math.cos(d)*m,y:c+Math.sin(d)*m})}return u}let o=e.length,a=[];for(let s=0;s<o;s++){let c=e[s],l=e[(s+1)%o];a.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return Po(i)}function vi(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,c=i.y-a.y,l=s*s+c*c,u=l>1e-12?((n-a.x)*s+(e-a.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let f=Math.hypot(n-(a.x+u*s),e-(a.y+u*c));f<r&&(r=f)}return r}function Tn(t){let n=t.map(o=>{let a=0,i=0;for(let l of o.pts)a+=l.x,i+=l.y;let s=o.pts.length||1;a/=s,i/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-a,l.y-i);u>c&&(c=u)}return{cx:a,cy:i,rad:c}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,c=null;for(let u of a){let f=1/0;for(let m=0;m<t.length;m++){if(m===o||Math.abs(t[m].y-t[o].y)<.001)continue;let h=n[m],d=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(d>=f&&d>=s)continue;let y=vi(t[m].pts,u.x,u.y);y<f&&(f=y),t[m].depth<t[o].depth&&y<s&&(s=y,c=t[m].y)}Number.isFinite(f)&&f>0&&i.push(f)}i.sort((u,f)=>u-f);let l=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function xo(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],f=u.x-r.x,m=u.y-r.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(e[n].pitch,.001)*.5;return[{x:u.x+m*d,y:u.y-f*d},{x:u.x-m*d,y:u.y+f*d}]})():[];if(a.length<2)return null;let i=0,s=0;for(let u=1;u<a.length;u++){let f=Math.hypot(a[u].x-a[u-1].x,a[u].y-a[u-1].y);f>1e-6&&(i+=f,s++)}let c=s>0?i/s:0,l=Fi(a,Math.max(c*Ci,St));return{pts:l,nrm:ki(l,r),front:Math.max(e[n].pitch*Ti,St),back:Math.max(e[n].pitch*Oi,St)}}var Zt=1.5,bo=.3;function Jn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,c=-1;for(let f=1;f<t.length-1;f++){let m=t[f],h=i>1e-12?Math.abs((m.x-e.x)*a-(m.y-e.y)*o)/i:Math.hypot(m.x-e.x,m.y-e.y);h>s&&(s=h,c=f)}if(s<=n||c<0)return[e,r];let l=Jn(t.slice(0,c+1),n),u=Jn(t.slice(c),n);return[...l.slice(0,-1),...u]}function go(t,n){if(t.length<4)return t;let e=Jn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Ni(t){let n=t.map((r,o)=>{let a=t[(o+1)%t.length];return{a:r,b:a,i:o,minX:Math.min(r.x,a.x),maxX:Math.max(r.x,a.x),minY:Math.min(r.y,a.y),maxY:Math.max(r.y,a.y)}}).sort((r,o)=>r.minX-o.minX),e=(r,o,a)=>(o.x-r.x)*(a.y-r.y)-(o.y-r.y)*(a.x-r.x);for(let r=0;r<n.length;r++){let o=n[r];for(let a=r+1;a<n.length&&n[a].minX<=o.maxX;a++){let i=n[a];if(!(Math.abs(o.i-i.i)===1||Math.abs(o.i-i.i)===t.length-1||o.maxY<i.minY||i.maxY<o.minY)&&e(o.a,o.b,i.a)*e(o.a,o.b,i.b)<=0&&e(i.a,i.b,o.a)*e(i.a,i.b,o.b)<=0)return!0}}return!1}function Mo(t,n,e){if(t.length<2)return[];let r=e??Tn(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let g of i){let P=t[g].patch;P&&P.length>=3?a.push({outline:[...P],holes:[],topY:t[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,P)=>t[g].depth-t[P].depth);let l=s.map(g=>xo(t,g,r,n)).filter(g=>g!==null);if(!l.length)continue;let u=(g,P)=>({x:g.pts[P].x-g.nrm[P][0]*(g.front+Zt),y:g.pts[P].y-g.nrm[P][1]*(g.front+Zt)}),f=(g,P)=>({x:g.pts[P].x+g.nrm[P][0]*(g.back+Zt),y:g.pts[P].y+g.nrm[P][1]*(g.back+Zt)}),m=l[0],h=l[l.length-1],d=[];for(let g=0;g<m.pts.length;g++)d.push(u(m,g));for(let g of l)d.push(f(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)d.push(f(h,g));for(let g=l.length-1;g>=0;g--)d.push(u(l[g],0));let y=Po(d),b=1/0;for(let g of s)t[g].y<b&&(b=t[g].y);if(!Number.isFinite(b))continue;if(y.length>=3&&Math.abs(pt(y))>1e-6&&l.every(g=>{let P=g.pts[Math.floor(g.pts.length/2)];return xt(y,P.x,P.y)})&&!Ni(y)){a.push({outline:go(y,bo),holes:[],topY:b});continue}for(let g of Di(l))a.push({outline:g,holes:[],topY:b})}return a}function Di(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+Zt,i=e.back+Zt;for(let c=0;c<e.pts.length;c++){let l=e.pts[c],u=e.nrm[c];r.push([l.x-u[0]*a,l.y-u[1]*a]),o.push([l.x+u[0]*i,l.y+u[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=yo.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([c,l])=>({x:c,y:l})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(go(a,bo))}return r}catch{return[]}}function Po(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var te=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!xt(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function ho(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let l=[0,1,0],u=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],h=r[f+1];t.tri([u.x*R,o,u.y*R],[m.x*R,o,m.y*R],[h.x*R,o,h.y*R],l,a)}return}let i=r.map(l=>[l.x,l.y]);i.push(i[0]);let s;try{s=yo.intersection([i],n)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],f=[],m=[];for(let d=0;d<u.length-1;d++)f.push(u[d][0],u[d][1]),m.push([u[d][0],u[d][1]]);if(m.length<3)continue;let h=Bi(f,void 0,2);for(let d=0;d<h.length;d+=3){let y=m[h[d]],b=m[h[d+1]],p=m[h[d+2]];t.tri([y[0]*R,o,y[1]*R],[b[0]*R,o,b[1]*R],[p[0]*R,o,p[1]*R],c,a)}}}function Ro(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??Tn(n),c=[0,1,0],l=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,u=a&&a.length>=3?new te([[...a]]):null,f=h=>{t.setMaterial(2),h(),t.setMaterial(0)},m=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let d=n[h];if(d.patch&&d.patch.length>=3){let M=[...d.patch],x=s[h].belowY??r;if(m(()=>{if(l&&u)ho(t,l,u,M,d.y,o.tread);else{let _=M[0];for(let I=1;I+1<M.length;I++){let S=M[I],B=M[I+1];t.tri([_.x*R,d.y,_.y*R],[S.x*R,d.y,S.y*R],[B.x*R,d.y,B.y*R],c,o.tread)}}}),d.y>x+fo){let _=0,I=0;for(let S of M)_+=S.x,I+=S.y;_/=M.length,I/=M.length,f(()=>{for(let S=0;S<M.length;S++){let B=M[S],T=M[(S+1)%M.length],F=T.x-B.x,k=T.y-B.y,w=Math.hypot(F,k);if(w<1e-6)continue;let E=k/w,C=-F/w;(B.x-_)*E+(B.y-I)*C<0&&(E=-E,C=-C);let L=[E,0,C],O=[B.x*R,d.y,B.y*R],D=[T.x*R,d.y,T.y*R],H=[B.x*R,x,B.y*R],j=[T.x*R,x,T.y*R];t.tri(O,D,j,L,o.riser),t.tri(O,j,H,L,o.riser)}})}continue}let y=xo(n,h,s,e);if(!y)continue;let{pts:b,nrm:p,front:g,back:P}=y,A=s[h].belowY??r;for(let M=0;M+1<b.length;M++){let x=b[M],_=b[M+1],I=p[M],S=p[M+1];if(Math.hypot(_.x-x.x,_.y-x.y)<1e-6||I[0]===0&&I[1]===0||S[0]===0&&S[1]===0)continue;let B=[(x.x-I[0]*g)*R,d.y,(x.y-I[1]*g)*R],T=[(_.x-S[0]*g)*R,d.y,(_.y-S[1]*g)*R],F=[(x.x+I[0]*P)*R,d.y,(x.y+I[1]*P)*R],k=[(_.x+S[0]*P)*R,d.y,(_.y+S[1]*P)*R];if(m(()=>{l&&u?ho(t,l,u,[{x:x.x-I[0]*g,y:x.y-I[1]*g},{x:_.x-S[0]*g,y:_.y-S[1]*g},{x:_.x+S[0]*P,y:_.y+S[1]*P},{x:x.x+I[0]*P,y:x.y+I[1]*P}],d.y,o.tread):(t.tri(B,T,k,c,o.tread),t.tri(B,k,F,c,o.tread))}),d.y>A+fo){let w=[B[0],A,B[2]],E=[T[0],A,T[2]],C=[-I[0],0,-I[1]];f(()=>{t.tri(B,T,E,C,o.riser),t.tri(B,E,w,C,o.riser)})}}}}function Gi(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function So(t,n){return t.filter(e=>e.type!=="shape"||Gi(e,n))}function _o(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:So(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:So(t.objects,n),focal:e,baseHeightM:0,index:0}]}var Hi={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Tt(t){return We(t)??Hi}function Ao(t,n){let e=_t(t.outline,St),r=Tt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&Vt(r,Tt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let i=Io.difference([a(e)],...o.map(c=>[a(c.outline)])),s=[];for(let c of i){if(!c.length)continue;let l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[e]}catch{return[e]}}function wo(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=Io.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:a.topY})}}return o.length?o:t}function ji(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var On=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=Tt(n),a=this.rings.filter((c,l)=>Vt(o,this.boxes[l])&&ji(e,this.levels[l])),i=[[r]];if(a.length)try{i=Xi.difference([r],...a).map(l=>l.map(u=>u.map(([f,m])=>[f,m])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let c of i){if(!c.length)continue;let l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function qt(t,n,e=t){if(!n)return t;let r=1/0,o=-1/0,a=1/0,i=-1/0;for(let m of e)r=Math.min(r,m.x),o=Math.max(o,m.x),a=Math.min(a,m.y),i=Math.max(i,m.y);let s=(r+o)/2,c=(a+i)/2,l=n*Math.PI/180,u=Math.cos(l),f=Math.sin(l);return t.map(m=>{let h=m.x-s,d=m.y-c;return{x:s+h*u-d*f,y:c+h*f+d*u}})}function Eo(t){let n=Fe(t);return!n.length||!t.points?.length?[]:n.map(e=>qt(e,t.rotation,t.points))}function ct(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3)return qt(ke(t,4),t.rotation,t.points);if(t.kind==="rect"&&t.width&&t.height&&(n=cn(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=En(e,r,t.width/2,t.height/2)}return n?qt(n,t.rotation):null}function At(t){let n=t.role??"",r=n==="stage"?{kind:"stage",heightM:ve(t.stageKind)}:{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}}[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var Ui=.08,Wi=30,Yi=.015;function zi(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}function Bo(t,n){let e=ct(t)??(t.points?.length?qt(t.points,t.rotation):null),r=At(t),a=!t.role&&r.kind==="plate"&&t.heightM===void 0&&!!e&&Math.abs(pt(e))*$**2>=Wi?Yi:r.heightM;if(!e)return{topOffsetM:a,supportOffsetM:0};if(r.kind!=="plate"&&r.kind!=="stage")return{topOffsetM:a,supportOffsetM:0};let i=1/0,s=1/0,c=-1/0,l=-1/0;for(let h of e)i=Math.min(i,h.x),s=Math.min(s,h.y),c=Math.max(c,h.x),l=Math.max(l,h.y);let u=a,f=0,m=1e-6*Math.max(1,c-i,l-s);for(let h of n)c>h.minX&&i<h.maxX&&l>h.minY&&s<h.maxY&&u<=h.topOffsetM+1e-6&&(u=h.topOffsetM+Ui),i>=h.minX-m&&c<=h.maxX+m&&s>=h.minY-m&&l<=h.maxY+m&&(!h.poly||e.every(b=>zi(b,h.poly)||Ki(b,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return t.fill&&t.fill!=="none"&&t.fill!=="transparent"&&n.push({minX:i,minY:s,maxX:c,maxY:l,topOffsetM:u,poly:e}),{topOffsetM:u,supportOffsetM:Math.min(f,u)}}function Ki(t,n,e){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[o],i=n[r],s=i.x-a.x,c=i.y-a.y,l=s*s+c*c,u=l?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)):0;if(Math.hypot(t.x-(a.x+u*s),t.y-(a.y+u*c))<=e)return!0}return!1}function vt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function bt(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function dt(t,n,e){return[vt(t[0],t[1],n),vt(t[0],t[1],e),vt(t[3],t[2],e),vt(t[3],t[2],n)]}function ln(t,n,e){return[vt(t[0],t[3],n),vt(t[1],t[2],n),vt(t[1],t[2],e),vt(t[0],t[3],e)]}function ot(t,n,e,r,o,a,i){Z(t,n,i?.length?i:void 0,()=>e,r,o,a,K)}function un(t){if(t.length<3)return t.map(a=>({...a}));let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o.map(a=>({...a})):n.map(a=>({...a}))}var Vi=.8,Zi=.6,qi=2;function Nt(t,n){if(!n.length)return null;let e=[],r=0;for(let i of t.objects){if(i.type!=="shape"||i.role!=="wall")continue;let s=ct(i)??[],c=To(s)/2;!(c>0)||Ji(s)/c*R>qi||(e.push(...s),r+=c)}if(e.length<3)return null;let o=un(e);if(o.length<3||r<To(o)*Zi)return null;let a=0;for(let i of n)ts(i,o)&&(a+=1);return a>=n.length*Vi?o:null}var Cn=6,$i=5,Qi=8;function Oo(t){return Math.max(Qi,(Number.isFinite(t)?t:0)+$i)}function $t(t){let n=0,e=0,r=0;for(let o=0;o<t.length;o++){let a=t[o],i=t[(o+1)%t.length],s=a.x*i.y-i.x*a.y;n+=s,e+=(a.x+i.x)*s,r+=(a.y+i.y)*s}if(Math.abs(n)<1e-9){let o=0,a=0;for(let i of t)o+=i.x,a+=i.y;return{x:o/Math.max(1,t.length),y:a/Math.max(1,t.length)}}return{x:e/(3*n),y:r/(3*n)}}function Ji(t){let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=r.x*o.y-o.x*r.y}return Math.abs(n)/2}function To(t){let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=Math.hypot(o.x-r.x,o.y-r.y)}return n}function ts(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}var ns=[[/\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"]],es=1.2,os=12;function Co(t){if(t.heightM!==void 0)return!1;let n=ct(t);if(!n||n.length<3)return!1;let e=0;for(let o=0;o<n.length;o++){let a=n[o],i=n[(o+1)%n.length];e+=Math.hypot(i.x-a.x,i.y-a.y)}return e*$<os*2?!1:2*fn(n)/e*$<=es}function ne(t){if(!t)return null;for(let[n,e]of ns)if(n.test(t))return e;return null}var Fo="auto-rows-";function Lo(t){return t.id.startsWith(Fo)&&!t.label}var rs=1.15,is=.09,vo=6,ss=34,as=.35,cs=6,ls=.35,us=.75,fs=12,ms=2.5,hs=40,ys=[18,24],ds=[12,16],ko=14,ps=.8,xs=.6,bs=5,gs=.3,No=.4,Do=2,Ms=400,Ps=2.6,Rs=.8,Ss=4,Is=26,_s=.7,As=.5,ws=.985,Es=1.5,Bs=2.2,Ts=3,Os=25,Cs=.985,ks=2,Fs=6,Ls=3,vs=.1,Ns=1.5,Ds=1.6,Gs=6e3,Hs=.6,Xs="#c3c7cd",ee=300,js=240;function Us(t,n,e,r){if(!t.fill||!/^#[0-9a-f]{6}$/i.test(t.fill))return null;let o=re([...n]),a=new Set;for(let u of r)a.add(Math.floor(Math.atan2(u.y-o.y,u.x-o.x)*180/Math.PI/10));if(a.size*10<js)return null;let{h:i,s,l:c}=He(Ge(t.fill));return i<70/360||i>170/360||s<.2||c<.08||c>.75||e.some(u=>u!==t&&u.type==="shape"&&ct(u)?.some(f=>ae(f,n)))?null:t.kind==="ellipse"?"oval-cricket":t.kind==="rect"?"pitch-football":null}var Ws="Estimated from the drawing; confirm with the venue.",ie=t=>{if(!t.length)return null;let n=[...t].sort((r,o)=>r-o),e=Math.floor(n.length/2);return n.length%2?n[e]:(n[e-1]+n[e])/2},re=t=>({x:t.reduce((n,e)=>n+e.x,0)/t.length,y:t.reduce((n,e)=>n+e.y,0)/t.length}),fn=t=>{let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=r.x*o.y-o.x*r.y}return Math.abs(n)/2};function Ys(t){return t.height!==void 0||t.rake!==void 0||t.elevation!==void 0||t.surfaceKind!==void 0}function se(t){let n=new Map;for(let e of t){let r=n.get(e.rowId);r?r.push(e):n.set(e.rowId,[e])}return n}function ae(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}function ce(t,n){let e=n[0],r=1/0;for(let o=0;o<n.length;o++){let a=n[o],i=n[(o+1)%n.length],s=i.x-a.x,c=i.y-a.y,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)):0,f={x:a.x+s*u,y:a.y+c*u},m=Math.hypot(t.x-f.x,t.y-f.y);m<r&&(r=m,e=f)}return e}function Go(t,n){let e=0,r=0;for(let o of t.values()){if(o.length<3)continue;let a=o[0],i=o[o.length-1],s=i.x-a.x,c=i.y-a.y,l=Math.hypot(s,c);if(l<1e-6)continue;let u={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=ce(u,n),m=f.x-u.x,h=f.y-u.y,d=Math.hypot(m,h);d<1e-6||(r+=Math.abs((-c*m+s*h)/(l*d))*o.length,e+=o.length)}return e?r/e:0}function zs(t,n,e){let r=t.filter(y=>y.type==="shape"),o=r.find(y=>y.role==="stage");if(o){let y=ct(o);return y?{shape:o,centre:re(y),outline:y,inferred:!1}:null}if(!e.length)return null;let a=1/0,i=-1/0,s=1/0,c=-1/0;for(let y of e)a=Math.min(a,y.x),i=Math.max(i,y.x),s=Math.min(s,y.y),c=Math.max(c,y.y);let l=(i-a)*(c-s),u=[];for(let y of r){if(y.role)continue;let b=ct(y);if(!b)continue;let p=fn(b);if(p*$*$<6||p>l)continue;let g=Math.min(...b.map(S=>S.x)),P=Math.max(...b.map(S=>S.x)),A=Math.min(...b.map(S=>S.y)),M=Math.max(...b.map(S=>S.y)),x=0;for(let S of e)S.x>g&&S.x<P&&S.y>A&&S.y<M&&ae(S,b)&&x++;if(x>e.length*.05)continue;let _=re(b),I=Go(n,b);I>=ps&&u.push({shape:y,centre:_,outline:b,score:I,area:p,box:[g,A,P,M]})}let f=(y,b)=>b!==y&&b.area>y.area&&y.box[0]>=b.box[0]-1e-6&&y.box[1]>=b.box[1]-1e-6&&y.box[2]<=b.box[2]+1e-6&&y.box[3]<=b.box[3]+1e-6,m=u.filter(y=>!u.some(b=>f(y,b))),h=Math.max(0,...m.map(y=>y.score)),d=m.filter(y=>y.score>=h-.03).sort((y,b)=>b.area-y.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Ks(t,n,e){if(!e||e.length<3)return Math.hypot(t.x-n.x,t.y-n.y);let r=ce(t,e);return Math.hypot(t.x-r.x,t.y-r.y)}function Ho(t){let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y);if(n.length<3)return n;let e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=[];for(let a of n){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}let o=[];for(let a=n.length-1;a>=0;a--){let i=n[a];for(;o.length>=2&&e(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}return[...r.slice(0,-1),...o.slice(0,-1)]}function Vs(t){if(!t.length||t.length>Gs)return[];let n=[...se(t).values()],e=n.map((s,c)=>c),r=s=>e[s]===s?s:e[s]=r(e[s]),o=Ds/$,a=n.map(s=>({minX:Math.min(...s.map(c=>c.x))-o,maxX:Math.max(...s.map(c=>c.x))+o,minY:Math.min(...s.map(c=>c.y))-o,maxY:Math.max(...s.map(c=>c.y))+o}));for(let s=0;s<n.length;s++)for(let c=s+1;c<n.length;c++){let l=a[s],u=a[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;n[s].some(m=>n[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=o))&&(e[r(s)]=r(c))}let i=new Map;return n.forEach((s,c)=>{let l=r(c),u=i.get(l);u?u.push(...s):i.set(l,[...s])}),[...i.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function Zs(t,n,e){if(!n.length)return null;let r=n.filter(I=>e.tableIds.has(I.rowId)||I.kind==="booth").length>n.length/2,o=se(n),a=!e.outline||Go(o,e.outline)>=xs,i=0,s=0;for(let I of o.values()){if(I.length<2)continue;let S=I[0],B=I[I.length-1],T=B.x-S.x,F=B.y-S.y,k=Math.hypot(T,F);if(k<1e-6)continue;let w={x:(S.x+B.x)/2,y:(S.y+B.y)/2},E=a?e.outline?ce(w,e.outline):e.focal:e.middle,C=-F/k,L=T/k;C*(E.x-w.x)+L*(E.y-w.y)<0&&(C=-C,L=-L),i+=C*I.length,s+=L*I.length}let c={x:n.reduce((I,S)=>I+S.x,0)/n.length,y:n.reduce((I,S)=>I+S.y,0)/n.length};if(Math.hypot(i,s)<1e-9){let I=a?e.focal:e.middle;i=I.x-c.x,s=I.y-c.y}let l=Math.hypot(i,s)||1,u={x:i/l,y:s/l},f=I=>-(I.x*u.x+I.y*u.y),m=I=>-I.x*u.y+I.y*u.x,h=1/0,d=-1/0,y=1/0,b=-1/0,p=1/0,g=new Map;for(let I of n){let S=f(I),B=m(I);h=Math.min(h,S),d=Math.max(d,S),y=Math.min(y,B),b=Math.max(b,B),a&&(p=Math.min(p,Ks(I,e.focal,e.outline)));let T=I.logicalRowId??I.rowId,F=g.get(T);F?F.push(S):g.set(T,[S])}a||(p=Math.max(0,h-f(e.middle)));let P=[...g.values()].map(I=>ie(I)).sort((I,S)=>I-S),A=[];if(!r)for(let I of P)A.length&&I-A[A.length-1]<ls/$||A.push(I);let M=Ys(t),x=zt(t,{floorBaseHeightM:e.baseHeightM}),_={id:t.id,section:t,authored:M,plane:e,facing:u,facesAction:a,hull:Ho(n),sample:n.filter((I,S)=>S%Math.ceil(n.length/Ms)===0),frontD:h,backD:d,latMin:y,latMax:b,frontDistance:p,rowDepths:A,rowCount:A.length,level:0,height:x.height,rake:M?x.rake:0,backHeight:0};return _.backHeight=_.height+(d-h)*$*Math.tan(_.rake*Math.PI/180),_}function qs(t,n,e,r){if(t.length<2)return 0;let o=Math.max(1,n*$),a=e+rs-r,i=0,s=0;for(let l=1;l<t.length;l++){let u=Math.max(us,(t[l]-t[l-1])*$),f=(a+is)*(o+u)/o;i+=f-a,s+=u,a=f,o+=u}let c=Math.atan(i/s)*180/Math.PI;return Math.round(Math.max(vo,Math.min(ss,c))*10)/10}function $s(t,n,e=!1){if(!e&&t.facing.x*n.facing.x+t.facing.y*n.facing.y<gs)return null;let r=-1/0,o=1/0,a=-1/0;for(let m of n.hull){r=Math.max(r,-(m.x*t.facing.x+m.y*t.facing.y));let h=-m.x*t.facing.y+m.y*t.facing.x;o=Math.min(o,h),a=Math.max(a,h)}if(Math.min(t.latMax,a)-Math.max(t.latMin,o)<(e?1e-6:No*(t.latMax-t.latMin)))return null;let s=Do/$,c=new Map,l=new Map;for(let m of t.sample){let h=Math.floor((-m.x*t.facing.y+m.y*t.facing.x)/s),d=-(m.x*t.facing.x+m.y*t.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of n.sample){let h=Math.floor((-m.x*t.facing.y+m.y*t.facing.x)/s),d=-(m.x*t.facing.x+m.y*t.facing.y);l.set(h,Math.max(l.get(h)??-1/0,d))}let u=[];for(let[m,h]of c){let d=l.get(m);d!==void 0&&u.push(h-d)}let f=u.length?ie(u):t.frontD-r;return f<-1/$?null:f}function Qs(t,n){if(n.plane.floorIndex>=t.plane.floorIndex)return!1;let e=-1/0,r=1/0,o=1/0,a=-1/0;for(let c of n.hull){let l=-(c.x*t.facing.x+c.y*t.facing.y);e=Math.max(e,l),r=Math.min(r,l);let u=-c.x*t.facing.y+c.y*t.facing.x;o=Math.min(o,u),a=Math.max(a,u)}let i=Math.min(t.latMax,a)-Math.max(t.latMin,o),s=Math.min(t.backD,e)-Math.max(t.frontD,r);return i>No*(t.latMax-t.latMin)&&s>1/$}function Js(t,n){let e=new Set;for(let r of t){let o=(Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI+360)%360;e.add(Math.floor(o/10))}return e.size/36}function ta(t,n){let e=1/0,r=-1/0;for(let a of n.hull){let i=-(a.x*t.facing.x+a.y*t.facing.y);e=Math.min(e,i),r=Math.max(r,i)}let o=Math.max(0,Math.min(r-e,t.frontD-e));return n.height+o*$*Math.tan(n.rake*Math.PI/180)}function na(t,n){if(!t.facesAction)return!1;let e={x:-t.facing.y,y:t.facing.x},r=Do/$,o=Math.max(1,Math.ceil((t.backD-t.frontD)/r)),a={left:new Map,right:new Map};for(let s of n)if(!(s===t||s.plane.floorIndex!==t.plane.floorIndex)&&!(s.facing.x*t.facing.x+s.facing.y*t.facing.y>=ws))for(let c of s.sample){let l=-(c.x*t.facing.x+c.y*t.facing.y);if(l<t.frontD||l>t.backD)continue;let u=-c.x*t.facing.y+c.y*t.facing.x,f=u<t.latMin?"left":u>t.latMax?"right":null;if(!f)return!1;let m=Math.min(o-1,Math.floor((l-t.frontD)/r)),h=f==="left"?t.latMin-u:u-t.latMax;h<(a[f].get(m)?.gap??1/0)&&a[f].set(m,{gap:h,other:s})}let i=s=>{let c=s==="left"?t.latMin:t.latMax,l=0;for(let[u,{other:f}]of a[s]){if((f.facing.x*e.x+f.facing.y*e.y)*(s==="left"?1:-1)<_s)continue;let h=t.frontD+(u+.5)*r,d={x:-h*t.facing.x+c*e.x,y:-h*t.facing.y+c*e.y},y=-(d.x*f.facing.x+d.y*f.facing.y),b=-d.x*f.facing.y+d.y*f.facing.x;y<f.frontD&&b>=f.latMin&&b<=f.latMax&&l++}return l/o>=As};return i("left")&&i("right")}function ea(t,n){if(n.plane.floorIndex!==t.plane.floorIndex||n.facing.x*t.facing.x+n.facing.y*t.facing.y<Cs)return!1;let e=1/0,r=-1/0,o=1/0;for(let s of n.hull){let c=-s.x*t.facing.y+s.y*t.facing.x;e=Math.min(e,c),r=Math.max(r,c),o=Math.min(o,-(s.x*t.facing.x+s.y*t.facing.y))}let a=(t.frontD-o)*$;if(a<-ks||a>Fs)return!1;let i=Math.max(e-t.latMax,t.latMin-r);return i*$<=Ls&&i*$>=-vs}function oa(t,n=!1,e=!1,r){let o=n?ds:ys,a=new Set(e?[]:t.filter(y=>!y.authored&&na(y,t))),i=[...t].sort((y,b)=>y.plane.floorIndex-b.plane.floorIndex||Number(a.has(b))-Number(a.has(y))||y.frontDistance-b.frontDistance);for(let y of a)r?.add(y.id);let s=(y,b,p)=>{let g=new Map,P=[],A=new Map,M=x=>{if(x.plane.floorIndex===0||x.plane.baseHeightM>0)return x.plane.baseHeightM;let _=A.get(x.plane.floorIndex-1);return _===void 0?x.plane.baseHeightM:_+Qe};for(let x of i){if(a.has(x))x.height=M(x),x.level=0,x.rake=0,x.backHeight=x.height,g.set(x.id,void 0);else if(!x.authored){let I=M(x),S;for(let w of P){if(w.plane.floorIndex>x.plane.floorIndex)continue;if(Qs(x,w)){let O=ta(x,w)+Ps;O>I&&(I=O,S=w);continue}let E=$s(x,w,a.has(w));if(E==null)continue;let C=e&&!!x.plane.stageDeck&&w.level===0&&w.plane.floorIndex===x.plane.floorIndex&&Math.max(0,E)*$<=Ss,L=a.has(w)?w.height+Es:C?w.backHeight:w.backHeight+as+Math.min(cs,Math.max(0,E)*$)*Math.tan(w.rake*Math.PI/180);L>I&&(I=L,S=w)}let B=y.get(x);B&&B.height>I+.01?(I=B.height,S=void 0):B=void 0,x.height=Math.round(Math.min(I,x.plane.baseHeightM+hs)*100)/100;let T=!S&&!B&&x.height>x.plane.baseHeightM;if(x.level=S?S.level+1:B?B.level:T?1:0,x.rake=qs(x.rowDepths,x.frontDistance,x.height,x.plane.focalHeightM),!x.facesAction&&x.rowCount<bs)x.rake=0;else if(x.level===0){let w=Math.max(1e-6,(x.backD-x.frontD)*$);x.rake=Math.min(x.rake,fs,Math.round(Math.atan(ms/w)*1800/Math.PI)/10)}else x.rowCount>=2&&(x.rake=Math.max(x.rake,o[Math.min(x.level,o.length)-1]));let F=(x.backD-x.frontD)*$,k=S&&a.has(S)||B&&p?.has(B.id);if(b!==void 0&&k&&x.rowCount>=2&&(x.rake=b),n&&F>0&&x.height+F*Math.tan(x.rake*Math.PI/180)>x.plane.baseHeightM+ko){let w=Math.max(0,x.plane.baseHeightM+ko-x.height);x.rake=Math.max(vo,Math.round(Math.atan(w/F)*1800/Math.PI)/10)}e&&x.plane.stageDeck&&x.level>0&&(x.rake=Math.min(x.rake,Is)),x.backHeight=x.height+F*Math.tan(x.rake*Math.PI/180),g.set(x.id,S?.id??(B?g.get(B.id):void 0))}let _=x.plane.floorIndex;A.set(_,Math.min(A.get(_)??1/0,x.height)),P.push(x)}return g},c=s(new Map),l=new Map,u=y=>l.get(y)?.height??y.height;for(let y=!0,b=0;y&&b<t.length;b++){y=!1;for(let p of t)if(!(p.authored||a.has(p)))for(let g of t){let P=l.get(g)??g;g===p||P.height-P.plane.baseHeightM<Ns||P.height<=u(p)+.01||ea(p,g)&&(l.set(p,P),y=!0)}}let f=new Map(t.map(y=>[y.id,y])),m=t.filter(y=>!y.authored&&y.rowCount>=2&&a.has(f.get(c.get(y.id)??""))),h=m.length?ie(m.map(y=>y.rake)):void 0;if(!l.size&&h===void 0)return c;let d=new Map([...new Set(l.values())].map(y=>[y,{...y}]));return s(new Map([...l].map(([y,b])=>[y,d.get(b)])),h,new Set(m.map(y=>y.id)))}var oe=(t,n)=>!!t&&t.x===n.x&&t.y===n.y;function Xo(t,n={x:0,y:-40}){let e=In(t),r=new Map;for(let p of e){if(!p.sectionId)continue;let g=r.get(p.sectionId);g?g.push(p):r.set(p.sectionId,[p])}let o={focalInferred:!1,confident:!1,sections:[]},a=t.floors?.length?t.floors.map((p,g)=>({objects:p.objects,floorIndex:g,floorId:p.id,baseHeightM:p.baseHeightM??0,focal:p.focalPoint??t.focalPoint})):[{objects:t.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:t.focalPoint}],i=new Set(a.flatMap(p=>p.objects.filter(g=>g.type==="table").map(g=>g.id))),s=[],c,l=new Set,u=a.map(p=>{let g=k=>!t.floors?.length||k.floorId===p.floorId,P=Vs(e.filter(k=>!k.sectionId&&k.kind!=="booth"&&!i.has(k.rowId)&&g(k))),A=[];for(let k of P){let w=_t(Et(Ho(k)),Hs/$);if(e.some(C=>!g(C)&&ae(C,w)))continue;let E=`${Fo}${p.floorIndex}-${A.length}`;l.add(E),r.set(E,k),A.push({type:"section",id:E,label:"",color:Xs,outline:w})}let M=A.length?{...p,objects:[...p.objects,...A]}:p,x=new Set(M.objects.filter(k=>k.type==="section").map(k=>k.logicalSectionId??k.id)),_=[...r.entries()].filter(([k])=>x.has(k)).flatMap(([,k])=>k),I=zs(M.objects,se(_),_),S=M.focal;(I||M.focal&&!oe(M.focal,n))&&(o.confident=!0),I&&(o.stage??={id:I.shape.id,inferred:I.inferred,...M.floorId?{floorId:M.floorId}:{}},(I.inferred||oe(M.focal,n))&&(S=I.centre,o.focalInferred=!0));let B=I&&(!I.inferred||fn(I.outline)*$*$<=ee),T=I?void 0:c,F={tableIds:i,floorIndex:M.floorIndex,floorId:M.floorId,baseHeightM:M.baseHeightM,focal:T?.focal??S,outline:I?.outline??T?.outline,focalHeightM:T?.focalHeightM??M.baseHeightM+(I&&B?At({...I.shape,role:"stage"}).heightM:0),stageDeck:T?.stageDeck??!!(I&&B&&fn(I.outline)*$*$<=ee),middle:_.length?{x:_.reduce((k,w)=>k+w.x,0)/_.length,y:_.reduce((k,w)=>k+w.y,0)/_.length}:S};for(let k of M.objects){if(k.type!=="section")continue;let w=Zs(k,r.get(k.logicalSectionId??k.id)??[],F);w&&s.push(w)}return F.outline&&(c=F),oe(M.focal,F.focal)||(o.focal??=[]).push({...M.floorId?{floorId:M.floorId}:{},point:{...F.focal}}),{unit:M,plane:F,stage:I,planeSeats:_}}),f=a.flatMap(p=>p.objects).map(p=>p.type==="shape"&&!p.role&&(ne(p.label)==="wall"||!ne(p.label)&&Co(p))?{...p,role:"wall"}:p),m=Nt({objects:f},e)!==null;m&&(o.indoor=!0);let h=new Set,d=oa(s,m,Js(e,u[0]?.plane.focal??n)<Rs,h),y=new Map(s.filter(p=>!p.authored).map(p=>[p.id,p])),b=u.map(({unit:p,plane:g,stage:P,planeSeats:A})=>p.objects.map(M=>{let x=M.type==="shape"&&!M.role&&M.id!==P?.shape.id?ne(M.label):null;if(M.type==="shape"&&!M.role&&M.id!==P?.shape.id&&(x==="wall"||!x&&Co(M))&&M.type==="shape"){(o.roles??=[]).push({id:M.id,...g.floorId?{floorId:g.floorId}:{},role:"wall"});let{fill:w,...E}=M;return{...E,role:"wall"}}if(x&&M.type==="shape")return(o.roles??=[]).push({id:M.id,...g.floorId?{floorId:g.floorId}:{},role:x}),{...M,role:x};let I=P?.inferred&&M.id===P.shape.id&&M.type==="shape"?Us(M,P.outline,p.objects,A):null;if(I&&M.type==="shape")return o.stage?.id===M.id&&(o.stage.field=I),{...M,role:"stage",stageKind:I};let S=M.type==="shape"&&M.id===P?.shape.id&&M.heightM===void 0&&!M.stageKind&&s.some(w=>w.plane===g&&(h.has(w.id)||w.level===0&&w.facesAction&&w.rake<=Ts&&(w.frontDistance+w.backD-w.frontD)*$>=Os)),B=S?{heightM:Bs}:{};if(P?.inferred&&M.id===P.shape.id&&M.type==="shape"&&fn(P.outline)*$*$<=ee)return o.stage?.id===M.id&&(o.stage.deck=!0),{...M,role:"stage",...B};if(S&&M.type==="shape"&&M.role==="stage")return{...M,...B};let T=M.type==="section"?y.get(M.id):void 0;if(!T||M.type!=="section")return M;let F=T.rowCount>=2&&T.rake>0;l.has(T.id)?o.looseRowBlocks=(o.looseRowBlocks??0)+1:o.sections.push({id:T.id,floorId:g.floorId,surfaceKind:F?"rakedRows":"flat",height:T.height,rake:T.rake,stackedOn:d.get(T.id)});let k={status:"inferred",source:"public-2d-topology",note:Ws};return{...M,height:T.height,rake:T.rake,surfaceKind:F?"rakedRows":"flat",physical3dProvenance:{height:k,rake:k,surfaceKind:k}}}));if(t.floors?.length){let p=t.floors.map((g,P)=>({...g,objects:b[P],focalPoint:u[P].plane.focal}));return{doc:{...t,floors:p,objects:p[0].objects,focalPoint:p[0].focalPoint},report:o}}return{doc:{...t,objects:b[0],focalPoint:u[0].plane.focal},report:o}}function Xu(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function ju(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var ra=1.15,ia=2.75,sa=4.5,aa=.85,ca=.5,la=.26;function Uu(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set(["stage","gate"]);return o>=.75&&i.add("floor"),o>=ra&&i.add("zone"),o<=(a?ia:sa)&&(i.add("section"),i.add("ga")),o<=aa&&(i.add("annotation"),i.add("booth")),o<=ca&&i.add("row"),o<=la&&i.add("seat"),i}function Wu(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,c=a+e,l=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:c>l?o/2:Math.max(c,Math.min(l,t.y))}}function Yu(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],c=o[0]*a+o[4]*i+o[8]*s+o[12],l=o[1]*a+o[5]*i+o[9]*s+o[13],u=o[2]*a+o[6]*i+o[10]*s+o[14],f=o[3]*a+o[7]*i+o[11]*s+o[15];if(!(f>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/f,h=l/f,d=u/f,y=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&d<=1;return{x:(m*.5+.5)*e,y:(1-(h*.5+.5))*r,depth:d,visible:y}}function zu(t,n,e=n,r=()=>0){let o=[],a=[...t].sort((i,s)=>r(s)-r(i)||i.screen.depth-s.screen.depth);for(let i of a){let s=!1;for(let c of o)if(le(i,c,n,e)){s=!0;break}s||o.push(i)}return o}var ua=6;function le(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+ua):e;return o<i&&a<r}function Ku(t,n,e){return t.length*n*.58+(e?14:0)}var fa={row:8,seat:14};function Vu(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:fa}function Zu(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function qu(t,n,e,r,o=[]){let a=[...t].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),i=[];for(let s of a){if(i.length>=r)break;let c=!1;for(let l of o)if(le(s,l,n,e)){c=!0;break}if(!c){for(let l of i)if(le(s,l,n,e)){c=!0;break}}c||i.push(s)}return i}function $u(t,n,e,r){let o=t[3]*n[0]+t[7]*n[1]+t[11]*n[2]+t[15];return o<=0||!(e>0)?0:e*Math.hypot(t[0],t[4],t[8])*r/(2*o)}function Qt(t,n,e){if(t.length!==4||e<=n)return null;let r=bt(t),o=Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*R,a=Math.hypot(r[3].x-r[0].x,r[3].y-r[0].y)*R;if(o<1e-6||a<1e-6)return null;let i=Math.min(.22/o,.16),s=Math.min(.28,(e-n)*.13),c=Math.min(.065/a,.2);return{quad:r,side:i,face:c,opening:dt(r,i,1-i),openingTop:e-s}}function ue(t,n,e){if(t.length!==4||e-n<=.2)return null;let r=bt(t),o=Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*R;if(o<=1e-6)return null;let a=Math.min(.14,(e-n)*.08,o*.08),i=a/o,s=dt(r,i,1-i);return{quad:r,side:i,trim:a,inner:s,panel:ln(s,.15,.85),bottom:n+a,top:e-a}}function jo(t,n,e,r){let o=ue(t,n,e);if(!o)return;let{panel:a}=o,i=(g,P)=>({x:(g.x+P.x)/2,y:(g.y+P.y)/2}),s=i(a[0],a[1]),c=i(a[3],a[2]),l=Math.hypot(s.x-r.x,s.y-r.y)<=Math.hypot(c.x-r.x,c.y-r.y),[u,f]=l?[a[0],a[1]]:[a[3],a[2]],m=l?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-u.y)*m.x+(f.x-u.x)*m.y<0&&([u,f]=[f,u]);let d=Math.min(.006,h*R*.05),y=m.x/h*d,b=m.y/h*d,p=(g,P)=>[g.x*R+y,P,g.y*R+b];return[p(u,o.bottom),p(f,o.bottom),p(u,o.top),p(f,o.top)]}import ha from"polygon-clipping";import ma from"polygon-clipping";function Ot(t,n,e,r,o,a,i,s={}){let c=Tt(n),l=s.ao??K,u=o.flatMap(y=>{if(y.role!=="entrance"&&y.role!=="exit")return[];let b=ct(y);if(!b||b.length!==4||!Vt(c,Tt(b)))return[];let p=s.portalBase??e,g=Qt(b,p,p+At(y).heightM);if(!g)return[];let P=Math.min(r,g.openingTop);return P<=e?[]:[{poly:g.opening,height:P}]});if(!u.length)return!1;let f=y=>y.map(b=>[b.x,b.y]),m=[f(n),...(s.holes??[]).map(f)],h=[e,...new Set(u.map(y=>y.height)),r].sort((y,b)=>y-b),d=[];try{for(let y=1;y<h.length;y++){let b=h[y-1],p=h[y];if(p-b<1e-6)continue;let g=u.filter(A=>A.height>b+1e-6).map(A=>[f(A.poly)]),P=g.length?ma.difference(m,...g):[m];d.push({low:b,high:p,polys:P})}}catch{return!1}for(let y of d)for(let b of y.polys){let[p,...g]=b.map(A=>A.map(([M,x])=>({x:M,y:x}))),P=A=>l.wallBottom+(l.top-l.wallBottom)*(A-e)/(r-e);Z(t,p,g,()=>y.high,y.low,a,i,{...l,top:P(y.high),wallBottom:P(y.low)})}return!0}var fe={depthM:1.6,thicknessM:.35,minWallM:6};function kn(t,n,e,r,o,a,i,s,c){let l=r-e;if(l<=0)return;let u=s&&(c??l)>=fe.minWallM?ya(n,s):null,f=u?r-fe.thicknessM:r,m=f-e,h=m<1.5?[[e,f,1]]:u?[[e,e+Math.min(.9,m*.18),.82],[e+Math.min(.9,m*.18),f,1]]:[[e,e+Math.min(.9,m*.18),.82],[e+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=y=>K.wallBottom+(K.top-K.wallBottom)*(y-e)/l;for(let[y,b,p]of h){let g={...K,top:d(b),wallBottom:d(y)},P=V(a,p),A=V(i,p);Ot(t,n,y,b,o,P,A,{portalBase:e,ao:g})||Z(t,n,void 0,()=>b,y,P,A,g)}for(let[y,...b]of u??[])Z(t,y,b.length?b:void 0,()=>r,f,V(a,1.12),V(i,.78),K)}function ya(t,n){let e=fe.depthM/R,r=t.map(i=>{let s=n.x-i.x,c=n.y-i.y,l=Math.hypot(s,c)||1;return{x:i.x+s/l*e,y:i.y+c/l*e}}),o=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s},a=[[o(t)],[o(r)]];for(let i=0;i<t.length;i++){let s=(i+1)%t.length;a.push([o([t[i],t[s],r[s],r[i]])])}try{let[i,...s]=a,c=ha.union(i,...s);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function mn(t,n,e){let r=it(n.stroke?.color),o=n.stroke?.width??0;if(!r||!Number.isFinite(o)||o<=0)return;let a=n.kind==="line"||n.kind==="polyline",i=a?qt(n.points??[],n.rotation):ct(n);if(!i||i.length<2)return;let s=o*.5,c=ze(n)?Ve(i,...Ke(o)):Array.from({length:a?i.length-1:i.length},(l,u)=>[i[u],i[(u+1)%i.length]]);for(let[l,u]of c){let f=Math.hypot(u.x-l.x,u.y-l.y);if(f<1e-6)continue;let m=-(u.y-l.y)/f*s,h=(u.x-l.x)/f*s,d=[(l.x+m)*R,e,(l.y+h)*R],y=[(u.x+m)*R,e,(u.y+h)*R],b=[(u.x-m)*R,e,(u.y-h)*R],p=[(l.x-m)*R,e,(l.y-h)*R];t.tri(d,y,b,[0,1,0],r),t.tri(d,b,p,[0,1,0],r)}}function Uo(t){return t==="bar"||t==="concession"||t==="coat"||t==="restroom"}var Jt=(t,n,e)=>({x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e});function Fn(t,n,e,r){let[o,a,i,s]=n?t:[t[3],t[2],t[1],t[0]];return[Jt(o,s,e),Jt(a,i,e),Jt(a,i,r),Jt(o,s,r)]}function Wo(t,n,e,r,o,a,i,s,c=!1){if(e.length!==4||o-r<.4)return!1;let l=I=>c?Math.min(I,o):I,u=bt(e),f=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*R;if(f<.4)return!1;let m=Jt(u[0],u[1],.5),h=Jt(u[3],u[2],.5),d=Math.hypot(m.x-s.x,m.y-s.y)<=Math.hypot(h.x-s.x,h.y-s.y),y=st(i,[.92,.9,.86],.35),b=V(a,.72),p=o-r;if(n==="restroom"){let I=Math.min(.18,p*.08);return ot(t,u,o-I,r,i,a),ot(t,u,o,o-I,y,y),!0}let g=r+Math.min(1.1,p),P=n==="coat"?1:Math.min(.5,.75/f),A=Fn(u,d,0,P);if(ot(t,A,g-.05,r,b,a),ot(t,A,g,g-.05,y,y),n==="coat"||f<1.2)return!0;if(n==="bar"){let I=Fn(u,d,Math.max(P+.2,1-.45/f),1),S=l(r+Math.max(Math.min(2.2,p*2),g-r+.6));return ot(t,I,S,r,i,b),!0}let M=Fn(u,d,Math.max(P+.25,.55),1),x=l(r+Math.max(2.6,g-r+1.4));if(x-.14<=g)return!0;ot(t,M,x-.14,r,i,a),ot(t,u,x,x-.14,y,b);let _=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*R));for(let[I,S]of[[0,_],[1-_,1]])ot(t,Fn(dt(u,I,S),d,0,Math.min(.08,.1/f)),x-.14,g,b,b);return!0}var Dt=.06,da=.05,zo=.05,Yo=.15,me=25;function Ko(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),c=new Map,l=[],u=new Set;for(let m=0;m<t.length;m+=1){let h=t[m];for(let d of h.objects){if(d.type==="table"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let y=_t(d.outline,St);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:m,box:Tt(y),section:d,unit:h,outline:y})}}let f=new Map;for(let m of l){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<n.length;m++){let h=n[m],d=e?f.get(e[m])??[]:l,y=h.sectionId?d.find(p=>p.id===h.sectionId)??d.find(p=>p.section.logicalSectionId===h.sectionId&&Rt({x:h.x,y:h.y},p.outline,p.section.holes)):void 0,b=y?[y]:d;for(let p of b){if(e&&p.floorIndex!==e[m]||!y&&(h.x<p.box.minX||h.x>p.box.maxX||h.y<p.box.minY||h.y>p.box.maxY||!Rt({x:h.x,y:h.y},p.outline,p.section.holes)))continue;o[m]=p.id;let g=c.get(p.id);g.hasSeats=!0;let P=h.focalPoint??p.unit.focal,A=Math.hypot(h.x-P.x,h.y-P.y);A<g.frontU&&(g.frontU=A),g.seatIndices.push(m);let M=h.rowId||`__seat-${m}`,x=g.rows.get(M);x?x.push({x:h.x,y:h.y}):g.rows.set(M,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=zt(h.section,{floorBaseHeightM:h.unit.baseHeightM}),y=h.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=d.rake<=.01&&d.height<=y+.001,g=h.section.surfaceKind,P=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:p,A=h.hasSeats?Le(m,n,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},x=A.rows.length<2?Ze([...h.rows.values()].map(O=>({points:O})),h.unit.focal):null,_=1/0;if(x){if(h.hasSeats)for(let O of h.rows.values())for(let D of O){let H=x.depthAt(D.x,D.y);H<_&&(_=H)}if(!h.hasSeats||!Number.isFinite(_)){_=1/0;for(let O of h.section.outline){let D=x.depthAt(O.x,O.y);D<_&&(_=D)}}}let I=y+da,S=Math.max(I,d.height),B=O=>{let D=Math.max(0,O-_)*$,H=Math.min(D*b,me);return Math.max(I,d.height+H)},T=O=>{let D=Math.max(0,O)*$,H=Math.min(D*b,me);return Math.max(I,d.height+H)},F=P?[]:A.rows.map(O=>({pts:O.pts,y:T(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...u.has(O.id)?{patch:po(O.pts,St)}:{}})),k=F.length?F[0].y:S,w=F.map(O=>{let D=O.patch&&O.patch.length>=3?O.patch:O.pts,H=0,j=0;for(let X of D)H+=X.x,j+=X.y;let G=D.length||1;H/=G,j/=G;let U=0;for(let X of D){let Y=Math.hypot(X.x-H,X.y-j);Y>U&&(U=Y)}return{cx:H,cy:j,rad:U}}),E=P?()=>S:F.length>=2?(O,D)=>{let H=1/0,j=k;for(let G=0;G<F.length;G++){let U=w[G];if(Math.hypot(O-U.cx,D-U.cy)-U.rad>=H)continue;let X=F[G].patch,Y=X&&X.length>=3?xt(X,O,D)?0:Rn(X,O,D):Rn(F[G].pts,O,D);Y<H&&(H=Y,j=F[G].y)}return j}:(O,D)=>x?B(x.depthAt(O,D)):S,C=[0,1,0],L=F.length>=2||P?()=>C:(O,D)=>{if(!x)return C;let H=x.depthAt(O,D);if(H<=_)return C;let j=(H-_)*$;if(j*b>=me||d.height+j*b<=I)return C;let[G,U]=x.gradientAt(O,D);if(G===0&&U===0)return C;let X=1/Math.hypot(b,1);return[-G*b*X,X,-U*b*X]};if(!P)for(let O of A.rows){let D=T(O.blockDepth);for(let H of O.seatIndices)i[H]=D}for(let O of A.rows){let D=[];for(let X=1;X<O.pts.length;X++){let Y=Math.hypot(O.pts[X].x-O.pts[X-1].x,O.pts[X].y-O.pts[X-1].y);Y>1e-6&&D.push(Y)}D.sort((X,Y)=>X-Y);let H=D.length?D[Math.floor(D.length/2)]:1/0,j=1/0,G=O.pts[Math.floor(O.pts.length/2)];if(G)for(let X of A.rows){if(X===O||X.blockId!==O.blockId)continue;let Y=Rn(X.pts,G.x,G.y);Y>1e-6&&Y<j&&(j=Y)}let U=Math.min(H,Math.max(j,H*.5));if(Number.isFinite(U)&&U>0)for(let X of O.seatIndices)s[X]=U}r.set(m,{sectionId:m,deckAt:E,normalAt:L,flat:P,bottomY:y,rowLevels:F,landingY:k})}for(let m=0;m<n.length;m++){let h=o[m],d=n[m];if(h){let p=i[m];a[m]=(p??r.get(h).deckAt(d.x,d.y))+Yo;continue}let y=d.eyeHeightM,b=Number.isFinite(y)?Math.max(0,y-Pn):0;a[m]=d.kind==="booth"?b+Dt+Yo:b}return{bySection:r,seatOwner:o,seatDeckY:m=>a[m],seatPitchU:m=>s[m]}}var pa=[.12,.38,.16],xa=[.72,.62,.45],ba=[.88,.93,.96],Vo=[.95,.95,.94],ga=[.66,.29,.22],he={length:20.12,width:3.05},Ma=.14,Pa=9.76,Ct=[.93,.94,.95],Ln=[.1,.11,.13],Ra=[.45,.85,1.25],Sa=1.45,Zo=.012,qo=.004,Ia=1.07,_a=.15;function nn(t,n,e,r,o,a){t.setMaterial(a),Z(t,n,e?[e.slice().reverse()]:void 0,()=>r,r-.004,o,o,K)}var $o=(t,n)=>Lt(t,n/R);function Qo(t,n,e){let r=n.x-t.x,o=n.y-t.y,a=Math.hypot(r,o);if(a<1e-9)return null;let i=-o/a*e,s=r/a*e;return[{x:t.x+i,y:t.y+s},{x:n.x+i,y:n.y+s},{x:n.x-i,y:n.y-s},{x:t.x-i,y:t.y-s}]}function Aa(t,n,e,r){let o=n.map(a=>[a.x*R,e,a.y*R]);t.tri(o[0],o[1],o[2],[0,1,0],r),t.tri(o[0],o[2],o[3],[0,1,0],r)}function vn(t,n,e,r,o,a){let i=e/R,s=[{x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i},{x:n.x-i,y:n.y+i}];Z(t,s,void 0,()=>o,r,a,V(a,.85),K)}function tn(t,n,e,r,o,a,i){let s=Qo(n,e,r/R);s&&Z(t,s,void 0,()=>a,o,i,V(i,.85),K)}function Nn(t){let n=bt(t),e={x:(n[0].x+n[2].x)/2,y:(n[0].y+n[2].y)/2},r=Math.hypot(n[1].x-n[0].x,n[1].y-n[0].y)||1,o=Math.hypot(n[3].x-n[0].x,n[3].y-n[0].y)||1,a={x:(n[1].x-n[0].x)/r,y:(n[1].y-n[0].y)/r},i={x:(n[3].x-n[0].x)/o,y:(n[3].y-n[0].y)/o};return{at:(c,l)=>({x:e.x+(a.x*c+i.x*l)/R,y:e.y+(a.y*c+i.y*l)/R}),lengthM:r*R,widthM:o*R}}function Jo(t,n,e){let r=Ne(n);if(!r.length)return;let o=1/0,a=-1/0,i=1/0,s=-1/0;for(let P of n.points??[])o=Math.min(o,P.x),a=Math.max(a,P.x),i=Math.min(i,P.y),s=Math.max(s,P.y);let c=(n.rotation??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),f=(o+a)/2,m=(i+s)/2,h=P=>c?{x:f+(P.x-f)*l-(P.y-m)*u,y:m+(P.x-f)*u+(P.y-m)*l}:P,d=Math.min(a-o,s-i)*R,y=Math.max(.04,Math.min(.3,d*.004))/R,b=0;t.setMaterial(0);for(let P of r){if(!P.fill)continue;let A=P.points.map(h);nn(t,A,null,e+Zo+b*qo,it(P.fill)??Ct,0),b++}let p=r.filter(P=>!(P.fill&&P.ink===P.fill)),g=[...new Set(p.map(P=>P.ink??Kn))];for(let P of g){let A=e+Zo+b++*qo,M=it(P)??Ct;for(let x of p){if((x.ink??Kn)!==P)continue;let _=x.points.map(h),I=x.closed?_.length:_.length-1;for(let S=0;S<I;S++){let B=Qo(_[S],_[(S+1)%_.length],y);B&&Aa(t,B,A,M)}}}}function tr(t,n,e,r,o){if(n.length<3)return!1;let a=r+.006,i=o??pa;if(e==="oval-cricket"){let s=n.reduce((M,x)=>M+x.x,0)/n.length,c=n.reduce((M,x)=>M+x.y,0)/n.length,l=M=>n.map(x=>({x:s+(x.x-s)*M,y:c+(x.y-c)*M})),u=8;for(let M=0;M<u;M++){let x=l(1-M/u),_=M===u-1?null:l(1-(M+1)/u);nn(t,x,_,a,V(i,M%2?1.04:.96),4)}let f=n[0];for(let M of n)Math.hypot(M.x-s,M.y-c)>Math.hypot(f.x-s,f.y-c)&&(f=M);let m=Math.hypot(f.x-s,f.y-c)||1,h=(f.x-s)/m,d=(f.y-c)/m,y=-d,b=h,p=Math.min(1,2*m*R*Ma/he.length),g=he.length*p/2/R,P=he.width*p/2/R,A=[[-g,-P],[g,-P],[g,P],[-g,P]].map(([M,x])=>({x:s+h*M+y*x,y:c+d*M+b*x}));return nn(t,A,null,a+.004,xa,0),t.setMaterial(0),!0}if(e==="rink-hockey"){let s=$o(n,_a);return nn(t,s,null,a,ba,0),t.setMaterial(0),Z(t,n,[s.slice().reverse()],()=>r+Ia,r,Vo,V(Vo,.9),K),!0}if(e==="ring-boxing"&&n.length===4){let{at:s}=Nn(n),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],l=[[.77,.19,.19],Ct,[.17,.42,.69],Ct];t.setMaterial(0),c.forEach((u,f)=>vn(t,u,.07,r,r+Sa,l[f]));for(let u of Ra)for(let f=0;f<4;f++)tn(t,c[f],c[(f+1)%4],.025,r+u-.025,r+u+.025,Ct);return!0}if(e==="court-tennis"&&n.length===4){let{at:s}=Nn(n);t.setMaterial(0),tn(t,s(0,-6.4),s(0,6.4),.015,r,r+.95,Ln),tn(t,s(0,-6.4),s(0,6.4),.03,r+.95,r+1,Ct);for(let c of[-1,1])vn(t,s(0,c*6.4),.05,r,r+1.07,Ln);return!0}if(e==="court-basketball"&&n.length===4){let{at:s,lengthM:c}=Nn(n),l=Math.min(14,c/2-.5);t.setMaterial(0);for(let u of[-1,1]){let f=s(u*(l+1.2),0),m=s(u*(l-1.2),0);vn(t,f,.12,r,r+3.4,Ln),tn(t,f,m,.06,r+3.25,r+3.4,Ln),tn(t,s(u*(l-1.2),-.9),s(u*(l-1.2),.9),.03,r+2.9,r+3.95,Ct)}return!0}if(e==="pitch-rugby"&&n.length===4){let{at:s,lengthM:c}=Nn(n),l=c*(50/120);t.setMaterial(0);for(let u of[-1,1]){for(let f of[-2.8,2.8])vn(t,s(u*l,f),.07,r,r+12,Ct);tn(t,s(u*l,-2.8),s(u*l,2.8),.06,r+2.94,r+3.06,Ct)}return!0}if(e==="track-athletics"){let s=$o(n,Pa);return s.length<3?!1:(nn(t,n,s,a,ga,0),nn(t,s,null,a,i,4),t.setMaterial(0),!0)}return!1}var nr=[.19,.4,.15],wa=.012,Xn=2.4,Ea=1,Ba=.75,Ta=.15;function wt(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),c=e/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,f])=>({x:n.x+u*i-f*s,y:n.y+u*s+f*i}))}function ar(t,n,e,r,o,a,i=!1){let s=wt(n);if(s){if(i){let c=jt(r,o.boothTop),l=Et([...s]);Z(t,_t(l,Oa/R),[l.slice().reverse()],()=>e+.03,e,c,V(c,.8),K);return}if(!(!n.points&&a&&ka(t,s,e,r,a))){if(!n.points&&a&&s.length===4){Ca(t,s,e,r,a);return}Z(t,s,void 0,()=>e+Xn,e,jt(r,o.boothTop),o.boothWall,K)}}}var ye=1.1,er=[.9,.9,.88],Oa=.1,Dn=[.87,.87,.85],or=.08;function cr(t,n){let e=c=>({x:(t[c].x+t[(c+1)%4].x)/2,y:(t[c].y+t[(c+1)%4].y)/2}),r=0,o=1/0;for(let c=0;c<4;c++){let l=e(c),u=Math.hypot(l.x-n.x,l.y-n.y);u<o&&(o=u,r=c)}let a=[0,1,2,3].map(c=>t[(r+c)%4]),i=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:a,part:(c,l,u,f)=>{let m=i(a[0],a[1],c),h=i(a[0],a[1],l),d=i(a[3],a[2],c),y=i(a[3],a[2],l);return[i(m,d,u),i(h,y,u),i(h,y,f),i(m,d,f)]},depthM:Math.hypot(a[3].x-a[0].x,a[3].y-a[0].y)*R,widthM:Math.hypot(a[1].x-a[0].x,a[1].y-a[0].y)*R}}function Ca(t,n,e,r,o){let{q:a,part:i}=cr(n,o),s=r??[.35,.42,.55],c=st(s,[.78,.78,.77],.62),l=st(s,[.95,.95,.94],.45);ot(t,a,e+Dt,e,c,V(c,.8)),ot(t,i(.05,.95,.72,.98),e+ye-.05,e+Dt,l,V(l,.8)),ot(t,i(.03,.97,.7,1),e+ye,e+ye-.05,er,V(er,.9))}function ka(t,n,e,r,o){if(n.length!==4)return!1;let{q:a,part:i,depthM:s,widthM:c}=cr(n,o);if(s<1||c<1)return!1;let l=r??[.35,.42,.55],u=st(l,[.78,.78,.77],.62),f=e+Xn,m=or/c,h=or/s;ot(t,a,e+Dt,e,u,V(u,.8)),ot(t,i(0,1,1-h,1),f,e+Dt,Dn,V(Dn,.9));for(let[b,p]of[[0,m],[1-m,1]])ot(t,i(b,p,0,1-h),f,e+Dt,Dn,V(Dn,.9));ot(t,i(m,1-m,0,Math.min(.5,.06/s)),f,f-.3,l,V(l,.85));let d=Math.min(.4,.6/c),y=Math.min(.12,.3/s);return ot(t,i(.5-d,.5+d,.72-y,.72+y),e+Ea,e+Dt,st(l,[.95,.95,.94],.7),V(l,.75)),!0}function jn(t){if(t.shape==="round"){let u=t.radius;return u?En(t.center.x,t.center.y,u,u,24):null}let{width:n,height:e,rotation:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),c=n/2,l=e/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,f])=>({x:o.x+u*i-f*s,y:o.y+u*s+f*i}))}function lr(t,n,e,r,o,a=!0){let i=jn(n);if(!i)return;let s=i.reduce((m,h)=>m+h.x,0)/i.length,c=i.reduce((m,h)=>m+h.y,0)/i.length,l=m=>i.map(h=>({x:s+(h.x-s)*m,y:c+(h.y-c)*m})),u=a&&r?jt(r,o.tableTop):Fa,f=e+Ba;Z(t,i,void 0,()=>f,e+La,u,V(u,.86),K),Z(t,l(.12),void 0,()=>f+.12,f,rr,V(rr,.8),K)}var Fa=[.93,.92,.89],rr=[.78,.66,.42],La=.25,hn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function va(t,n,e){let r=t.reduce((p,g)=>p+g.x,0)/4,o=t.reduce((p,g)=>p+g.y,0)/4,a=t[3].x-t[0].x,i=t[3].y-t[0].y,s=Math.hypot(a,i)||1;a/=s,i/=s,a*(n.x-r)+i*(n.y-o)<0&&(a=-a,i=-i);let c=-i,l=a,u=hn.armM/R,f=hn.widthM/R,m=s/2+hn.insideM/R,h=e?-1:1,d=r+a*(m+(e?0:u)),y=o+i*(m+(e?0:u)),b=(p,g)=>({x:d+a*p*h+c*g,y:y+i*p*h+l*g});return[b(0,0),b(-u,u),b(-u-f,u),b(-f,0),b(-u-f,-u),b(-u,-u)]}function Na(t,n,e,r,o){let a=[.94,.95,.96];Z(t,va(n,r,o),void 0,()=>e+hn.high,e+hn.low,a,a,K)}function Hn(t,n){let e=it(t);return e?{top:V(It(e,.12),.95),wall:V(It(e,.12),.85)}:{top:n.tierTop,wall:n.tierWall}}function ur(t,n,e,r,o,a,i,s,c=[]){let l=ct(n),u=Eo(n);if(!n.role&&(!n.fill||n.fill==="none"||n.fill==="transparent")||!l){mn(t,n,e+r+wa);return}let m=s?s.kind==="stage":n.role==="stage",h=s?s.kind==="screen":n.role==="screen",d=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:At(n),y=s?.baseY??e,b=s?.topY??e+r;if(m&&i){let S=1/0,B=-1/0,T=1/0,F=-1/0;for(let k of l)k.x<S&&(S=k.x),k.x>B&&(B=k.x),k.y<T&&(T=k.y),k.y>F&&(F=k.y);i.push({cx:(S+B)/2*R,cz:(T+F)/2*R,y:b,halfX:Math.max((B-S)/2*R,.5),halfZ:Math.max((F-T)/2*R,.5)})}let p=it(n.fill),g=n.role==="wall"||n.role==="entrance"||n.role==="exit",P=g?Hn(n.fill,o).top:m&&p?st(o.stageTop,V(It(p,.18),.9),.9):!n.role&&p?p:jt(p,m?o.stageTop:o.decorTop),A=h?p:null,M=g?Hn(n.fill,o).wall:m?p?st(o.stageWall,V(p,.58),.82):o.stageWall:h?A?st(V(A,1.42),[.24,.46,.82],.08):[.24,.46,.82]:jt(it(n.fill),o.decorWall);if(n.role==="wall"&&!s){kn(t,l,y,b,c,P,M,a),mn(t,n,b+.012);return}if(h&&l.length===4&&b-y>.2){let S=ue(l,y,b);if(!S)return;let{quad:B,side:T,trim:F,inner:k,panel:w}=S,E=[.12,.15,.18];for(let[C,L]of[[0,T],[1-T,1]])ot(t,dt(B,C,L),b,y,E,E);ot(t,k,y+F,y,E,E),ot(t,k,b,b-F,E,E),ot(t,w,b-F,y+F,M,M),mn(t,n,b+.012);return}let x=p?V(It(p,.15),.82):M,_=p?V(It(p,.1),1.02):P;if(Uo(n.role)&&!s&&Wo(t,n.role,l,y,b,x,_,a,n.heightM!==void 0))return;if((n.role==="sound"||s?.kind==="sound_desk")&&l.length===4&&b-y>.3){let S=bt(l),B=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*R,T=Math.min(.12,.09/Math.max(B,.001)),F=[.18,.21,.24],k=b-Math.min(.12,(b-y)*.15);for(let[w,E]of[[0,T],[1-T,1]])ot(t,dt(S,w,E),k,y,F,F);ot(t,S,b,k,P,F);return}if(n.role==="rail"&&l.length===4&&b>y){let S=bt(l),B=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*R,T=Math.max(1,Math.min(128,Math.ceil(B/1.4))),F=Math.min(.08,.055/Math.max(.055,B)),k=[.58,.64,.66];for(let w=0;w<=T;w++){let E=w/T,C=Math.min(1-F,Math.max(0,E-F/2));ot(t,dt(S,C,C+F),b,y,k,V(k,.8))}for(let w of[.52,1]){let E=y+(b-y)*w;ot(t,S,E,Math.max(y,E-.055),k,V(k,.8))}return}if(n.role==="goal"&&l.length===4){let S=bt(l),B=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*R,T=Math.min(.12,.1/Math.max(.1,B)),F=[.9,.94,.94];for(let[k,w]of[[0,T],[1-T,1]])ot(t,dt(S,k,w),Math.max(y,b-.1),y,F,F);ot(t,S,b,Math.max(y,b-.1),F,F);return}if(d.kind==="portal"&&l.length===4){let S=Qt(l,y,b);if(!S)return;let{quad:B,side:T,face:F,openingTop:k}=S;for(let[w,E,C]of[[0,F,1],[F,1-F,.67],[1-F,1,1]]){let L=ln(B,w,E),O=V(P,C),D=V(M,C);for(let[H,j]of[[0,T],[1-T,1]])ot(t,dt(L,H,j),k,y,O,D);ot(t,L,b,k,O,D)}(n.role==="entrance"||n.role==="exit")&&Na(t,B,y,a,n.role==="exit");return}if(d.kind==="suite"&&l.length===4){let S=l.map((F,k)=>{let w=l[(k+1)%4],E=(F.x+w.x)/2,C=(F.y+w.y)/2;return Math.hypot(E-a.x,C-a.y)}),B=S.indexOf(Math.min(...S)),T=[0,1,2,3].map(F=>l[(B+F)%4]);ot(t,dt(T,0,.08),b,y,P,M),ot(t,dt(T,.92,1),b,y,P,M),ot(t,ln(T,.88,1),b,y,P,M),ot(t,T,b,Math.max(y,b-.18),P,M);return}if(m&&!n.stageKind?.startsWith("pitch-")&&b-y>.12){let S=b-Math.min(.06,(b-y)*.15);ot(t,l,S,y,P,M,u),ot(t,l,b,S,P,st(P,M,.2),u)}else ot(t,l,b,y,P,M,u);if((n.stageKind==="pitch-football"||n.stageKind==="pitch-rugby")&&l.length===4){t.setMaterial(4);let S=bt(l),B=st(p??nr,nr,p?.45:0);for(let T=0;T<12;T++){let F=dt(S,T/12,(T+1)/12),k=V(B,T%2?1.09:.91),w=F.map(E=>[E.x*R,b+.006,E.y*R]);t.tri(w[0],w[1],w[2],[0,1,0],k),t.tri(w[0],w[2],w[3],[0,1,0],k)}}n.stageKind&&n.stageKind!=="pitch-football"&&tr(t,l,n.stageKind,b,p),m&&Kt(n.stageKind)&&Jo(t,n,b),t.setMaterial(h?1:0),mn(t,n,b+.012)}function Un(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,f=o/2;return[[-u,-f],[u,-f],[u,f],[-u,f]].map(([m,h])=>({x:a+m*c-h*l,y:i+m*l+h*c}))}function Da(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return it(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let c=it(s[1].trim());c&&i.push(c)}return i.length?i.reduce((s,c,l)=>st(s,c,1/(l+1)),i[0]):null}function fr(t,n,e,r){if(n.layer==="foreground")return;let o=Un(n);if(!o)return;let a=e+Ta,i=jt(Da(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=st(r.ground,i,s)),Z(t,o,void 0,()=>a,e,i,st(i,r.decorWall,.5),K)}function mr(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=ao(r,o.gaTop);Z(t,n.points,n.holes,()=>e+ir,e,a,o.gaWall,K),Xa(t,n.points,e+ir)}var ir=.15,Gn=[.72,.74,.76],de=1.1,sr=.12,pe=.05,Ga=.06,Ha=2.4;function Xa(t,n,e){let r=Et([...n]),o=Lt(r,sr/R),a=Lt(r,(sr+pe)/R);if(o.length<3||a.length<3)return;for(let s of[e+de,e+de*.5])Z(t,o,[a.slice().reverse()],()=>s,s-pe,Gn,V(Gn,.85),K);let i=Ga/2/R;for(let s=0;s<o.length;s++){let c=o[s],l=o[(s+1)%o.length],u=Math.hypot(l.x-c.x,l.y-c.y)*R,f=Math.max(1,Math.round(u/Ha));for(let m=0;m<f;m++){let h=m/f,d=c.x+(l.x-c.x)*h,y=c.y+(l.y-c.y)*h,b=[{x:d-i,y:y-i},{x:d+i,y:y-i},{x:d+i,y:y+i},{x:d-i,y:y+i}];Z(t,b,void 0,()=>e+de-pe,e,Gn,V(Gn,.8),K)}}}var ja=1.5,Ua=30,Wa=4,Ya=3.6,za=6,xe=15,Ka=3,Va=1;function Za(t){return Math.max(Ya,Math.min(za,2.4+.15*t))}var yn=Math.PI*2;function qa(t,n){let e=0,r=0;for(let f of t)e+=f.x,r+=f.y;let o=Math.atan2(r/t.length-n.y,e/t.length-n.x),a=t.map(f=>{let m=Math.atan2(f.y-n.y,f.x-n.x)-o;for(;m>Math.PI;)m-=yn;for(;m<-Math.PI;)m+=yn;return m+o}),i=a.map((f,m)=>m).sort((f,m)=>a[f]-a[m]),s=a[i[0]],c=a[i[i.length-1]];if(c-s>Math.PI)return null;let l=f=>Math.hypot(f.x-n.x,f.y-n.y),u=f=>{let m=t[f],h=(f+t.length-1)%t.length,d=(f+1)%t.length,y=Math.abs(a[h]-a[f])<=Math.abs(a[d]-a[f])?h:d,b=t[y];return l(m)<=l(b)?[m,b]:[b,m]};return{start:s,end:c,startEdge:u(i[0]),endEdge:u(i[i.length-1])}}function hr(t){return t.type==="shape"&&t.role==="wall"&&t.heightM===void 0}function be(t,n,e=()=>!0){let r=[];for(let c of t){if(!hr(c)||!e(c))continue;let l=ct(c);if(!l||l.length<3)continue;let u=qa(l,n);if(!u)return[];r.push(u)}if(r.length<2)return[];let o=t.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=ct(c);if(!l?.length)return[];let u=0,f=0;for(let m of l)u+=m.x,f+=m.y;return[{x:u/l.length,y:f/l.length}]}),a=c=>(c%yn+yn)%yn;r.sort((c,l)=>a(c.start)-a(l.start));let i=c=>Math.hypot(c.x-n.x,c.y-n.y),s=[];for(let c=0;c<r.length;c++){let l=r[c],u=r[(c+1)%r.length],f=a(u.start-l.end);if(f<=0||f>=Math.PI/2)continue;let m=x=>a(x-l.end)<f;if(r.some(x=>x!==l&&x!==u&&(m(x.start)||m(x.end)||a(l.end-x.start)<x.end-x.start)))continue;let[d,y]=l.endEdge,[b,p]=u.startEdge,g={x:(d.x+y.x)/2,y:(d.y+y.y)/2},P={x:(b.x+p.x)/2,y:(b.y+p.y)/2},A=Math.hypot(P.x-g.x,P.y-g.y)*R;if(A<ja||A>Ua||Math.abs(i(g)-i(P))*R>Wa+.2*A)continue;let M={x:(g.x+P.x)/2,y:(g.y+P.y)/2};o.some(x=>m(Math.atan2(x.y-n.y,x.x-n.x))&&Math.abs(i(x)-i(M))*R<=Ka)||s.push({quad:[d,y,p,b],mid:M,widthM:A,openingM:Za(A)})}return s}function yr(t,n){let e=[];for(let a of n)if(a.text?.trim())for(let i of t){let s=Math.hypot(a.position.x-i.mid.x,a.position.y-i.mid.y)*R;s<=xe&&e.push({text:a,gate:i,d:s})}e.sort((a,i)=>a.d-i.d);let r=new Map,o=new Set;for(let{text:a,gate:i}of e)r.has(a.id)||o.has(i)||(r.set(a.id,i),o.add(i));return r}function dr(t,n,e,r,o,a,i,s=()=>!0){let c=be(n,$t(e),s);if(!c.length)return;let l=n.find(f=>hr(f)&&s(f)),u=Hn(l?.fill,i);t.setMaterial(Cn);for(let f of c)o-f.openingM<Va||kn(t,f.quad,r+f.openingM,r+o,[],u.top,u.wall,a,o);t.setMaterial(0)}var $a=6,Qa=2.2,Wn=.1,Ja=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,tc=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),nc=.3,ec=1.8,oc=.9,rc=.55,ic=1,pr=4e3,sc=6,xr="#d8a425",ac="#e8c15a",ge="#1c1608";function br(t){let n=cc(t);if(!n)return null;let e=De(t).find(r=>r.icon===n.icon);return{...n,name:e?.titleFallback??n.icon}}function cc(t){let n=t.accessibility;if(n?.length)return{icon:n.includes("wheelchair")?"wheelchair":n[0],color:Mn(n)};let e=t.commercial;return e?.obstructedView?{icon:"obstructedView",color:xr,ink:ge}:e?.restrictedView?{icon:"restrictedView",color:xr,ink:ge}:e?.premium?{icon:"premium",color:ac,ink:ge}:null}function lc(t,n){if(!t)return;let e,r=0;for(let[a,i]of t)i>r&&(r=i,e=a);let o=n.categories?.find(a=>a.key===e)?.color;return o&&/^#[0-9a-f]{6}$/i.test(o)?o:void 0}var uc=6e3,fc=.25,gr=[-90,90,-135,135,-45,45];function mc(t,n,e,r){let o=t.flatMap(({id:i,a:s,members:c})=>{let l=(s.minX+s.maxX)/2,u=(s.minY+s.maxY)/2,f=.5*Math.hypot(s.maxX-s.minX,s.maxY-s.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(n[h].x-l,n[h].y-u));return c.length&&m>=f*fc?[{id:i,cx:l,cy:u,half:f,members:c}]:[]}).sort((i,s)=>i.half-s.half),a=new Map;return o.forEach(({id:i,cx:s,cy:c,members:l},u)=>{let f=r.x-s,m=r.y-c,y=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+gr[u%gr.length]*Math.PI/180,b=Math.cos(y),p=Math.sin(y),g=-1,P=-1/0;for(let A of l){let M=(n[A].x-s)*b+(n[A].y-c)*p;M>P&&(P=M,g=A)}a.set(i,[n[g].x*R,e.seatDeckY(g),n[g].y*R])}),a}function Pr(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let c=new Map;for(let m of e)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let l=new Map,u=new Map;for(let m=0;m<r.length;m++){let h=r[m],d=o.seatOwner[m],y=h.zoneId??(d?c.get(d):void 0);if(!y)continue;let b=l.get(y);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(y,b));let p=u.get(y);p||u.set(y,p=[]),p.push(m),b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y),b.sumY+=o.seatDeckY(m)}let f=mc(i.flatMap(m=>{let h=l.get(m.id);return h?[{id:m.id,a:h,members:u.get(m.id)??[]}]:[]}),r,o,a);for(let m of i){let h=l.get(m.id),d=[];for(let[y,b]of c)b===m.id&&d.push(y);if(!h||h.n===0){s.push({id:m.id,label:m.label,color:it(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??a).x*R,1.5,(m.focalPoint??a).y*R]});continue}s.push({id:m.id,label:m.label,color:it(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*R,h.sumY/h.n,(h.minY+h.maxY)/2*R],radius:.5*Math.hypot((h.maxX-h.minX)*R,(h.maxY-h.minY)*R)||1,focalWorld:[(m.focalPoint??a).x*R,1.5,(m.focalPoint??a).y*R]})}}return s}function Rr(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:c}=t,l=[],u=[],f=[],m=new Map;for(let h of e)for(let d of h.objects){if(d.type!=="section"||!d.zone)continue;let y=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!y)continue;let b=n.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(e.length>1&&b===y)continue;let p=m.get(d.zone);p||m.set(d.zone,p=new Set),p.add(y)}for(let h of s)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||l.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[(h.labelAt??h.center)[0],(h.labelAt??h.center)[1]+$a,(h.labelAt??h.center)[2]],color:n.zones?.find(d=>d.id===h.id)?.color}));{let h=new Map,d=new Map,y=new Map,b=new Map;for(let p=0;p<r.length;p++){let g=o.seatOwner[p];if(!g)continue;let P=h.get(g);P||(P={n:0,x:0,y:0,deck:0},h.set(g,P)),P.n++,P.x+=r[p].x,P.y+=r[p].y,P.deck+=o.seatDeckY(p);let A=r[p].categoryKey;if(A){let x=d.get(g);x||(x=new Map,d.set(g,x)),x.set(A,(x.get(A)??0)+1)}if(r[p].accessibility?.includes("wheelchair")){let x=y.get(g);x?x.push(p):y.set(g,[p])}let M=b.get(g);M||(M={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},b.set(g,M)),M.minDeck=Math.min(M.minDeck,o.seatDeckY(p)),M.maxDeck=Math.max(M.maxDeck,o.seatDeckY(p)),r[p].x<M.minX&&(M.minX=r[p].x),r[p].x>M.maxX&&(M.maxX=r[p].x),r[p].y<M.minY&&(M.minY=r[p].y),r[p].y>M.maxY&&(M.maxY=r[p].y)}for(let p of e)for(let g of p.objects){if(g.type!=="section"||Lo(g))continue;let P=h.get(g.id);if(!P||P.n===0)continue;let A=b.get(g.id),M=[P.x/P.n*R,P.deck/P.n,P.y/P.n*R],x=g.displayLabel||g.label||g.id;u.push({id:g.id,floorIndex:p.index,label:x,seatCount:P.n,center:M,radius:Math.max(1,Math.hypot(A.maxX-A.minX,A.maxY-A.minY)*.5*R),box:{min:[A.minX*R-.4,A.minDeck,A.minY*R-.4],max:[A.maxX*R+.4,A.maxDeck+1,A.maxY*R+.4]},focalWorld:[p.focal.x*R,p.baseHeightM+1.5,p.focal.y*R]});let _=n.floors?.[p.index]?.name?.trim().toLocaleLowerCase();if(!(e.length>1&&_===x.trim().toLocaleLowerCase())){let I=lc(d.get(g.id),n),S=y.get(g.id);l.push({id:`section:${g.id}`,kind:"section",text:x,anchor:[M[0],M[1]+Qa,M[2]],floorIndex:p.index,...I?{tint:I}:{},...S?{wheelchairSeats:S}:{}})}}}{for(let M of e)for(let x of M.objects){if(x.type!=="gaArea")continue;let _=Yt(x.points);if(!_)continue;let I=x.labelPresentation?.visible===!1?"":x.displayLabel||x.label||x.id,S=x.capacity>0?[I,x.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):I;S&&l.push({id:`ga:${x.id}`,kind:"ga",text:S,anchor:[_.x*R,M.baseHeightM+ec,_.y*R],floorIndex:M.index})}let h=new Map,d=new Map;for(let M of e)for(let x of M.objects)if(x.type==="section"&&h.set(x.id,x.displayLabel||x.label||x.id),x.type==="row"){let _=x.displayLabel?.trim()||x.segmentedRow?.displayLabel?.trim();_&&d.set(x.id,_)}let y=new Map;for(let M=0;M<r.length;M++){let x=r[M],_=Math.hypot(x.x-c.x,x.y-c.y),I=y.get(x.rowId);(!I||_>I.far)&&y.set(x.rowId,{seat:x,index:M,far:_})}for(let[M,x]of y){let _=o.seatOwner[x.index]??x.seat.sectionId,I=Mr(x.seat.label,M,h.get(_??""),d.get(M));I&&l.push({id:`row:${M}`,kind:"row",text:I,anchor:[x.seat.x*R,o.seatDeckY(x.index)+oc,x.seat.y*R],floorIndex:i[x.index]})}let b=new Map;for(let M=0;M<r.length;M++){let x=r[M],_=b.get(x.rowId);_||(_={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Mr(x.label,x.rowId,h.get(o.seatOwner[M]??x.sectionId??""),d.get(x.rowId)),sectionId:o.seatOwner[M]??x.sectionId},b.set(x.rowId,_));let I=M*3,S=a.iPosition[I],B=a.iPosition[I+1],T=a.iPosition[I+2];_.n++,_.x+=S,_.y+=B,_.z+=T,_.minX=Math.min(_.minX,S),_.maxX=Math.max(_.maxX,S),_.minZ=Math.min(_.minZ,T),_.maxZ=Math.max(_.maxZ,T)}for(let[M,x]of b)f.push({id:M,label:x.label,sectionId:x.sectionId,seatCount:x.n,center:[x.x/x.n,x.y/x.n,x.z/x.n],radius:Math.max(.8,Math.hypot(x.maxX-x.minX,x.maxZ-x.minZ)*.5)});let p=0,g=(M,x)=>{p++,l.push({id:`access:${r[M].id}`,kind:"access",text:x.name,icon:x.icon,color:x.color,...x.ink?{ink:x.ink}:{},seatWidthM:a.iChairWidth[M]*2,anchor:[r[M].x*R,o.seatDeckY(M)+ic,r[M].y*R],floorIndex:i[M],rowId:r[M].rowId})},P=null,A=()=>{if(P){let M=br(r[P.seats[0]]),x=P.seats.length,_=Math.max(1,Math.round(x/sc));for(let I=0;I<_&&p<pr;I++)g(P.seats[Math.min(x-1,Math.floor((I+.5)*x/_))],M)}P=null};for(let M=0;M<r.length&&p<pr;M++){let x=br(r[M]);if(x&&r[M].accessibility?.length){A(),g(M,x);continue}if(!x){A();continue}P&&P.rowId===r[M].rowId&&P.icon===x.icon?P.seats.push(M):(A(),P={rowId:r[M].rowId,icon:x.icon,seats:[M]})}if(A(),r.length<=uc)for(let M=0;M<r.length;M++){let x=r[M],_=hc(x.displayLabel||x.label);_&&l.push({id:`seat:${x.id}`,kind:"seat",seatWidthM:a.iChairWidth[M]*2,text:_,anchor:[x.x*R,o.seatDeckY(M)+rc,x.y*R],floorIndex:i[M],rowId:x.rowId})}}for(let h of e){let d=Nt(h,e.length===1?r:r.filter((p,g)=>i[g]===h.index)),y=d?yr(be(h.objects,$t(d)),h.objects.filter(p=>p.type==="text")):new Map,b=[...y.values()];for(let p of h.objects){let g=p.type==="text"?y.get(p.id):void 0;if(p.type==="shape"&&(p.role==="entrance"||p.role==="exit")&&Ja.test(p.label?.trim()??"")){let P=ct(p),A=P?Yt(P):null;if(A&&b.some(M=>Math.hypot(A.x-M.mid.x,A.y-M.mid.y)*R<=xe+M.widthM))continue}if(g&&p.type==="text")l.push({id:`text:${p.id}`,kind:"gate",text:p.text,icon:"entrance",anchor:[g.mid.x*R,h.baseHeightM+g.openingM+Wn,g.mid.y*R],color:p.color,floorIndex:h.index});else if(p.type==="shape"&&p.role&&tc.has(p.role)){let P=ct(p),A=P?Yt(P):null;if(!A||!p.label||p.gate?.hideFromBuyers)continue;l.push({id:`architecture:${p.id}`,kind:p.role==="stage"?"stage":p.role==="entrance"||p.role==="exit"?"gate":"annotation",text:p.label,...p.role==="entrance"||p.role==="exit"?{icon:p.role}:{},...p.gate?.stepFree?{stepFree:!0}:{},anchor:[A.x*R,h.baseHeightM+At(p).heightM+Wn,A.y*R],color:p.fill,floorIndex:h.index})}else if(p.type==="text"){let P=p.semanticKind==="icon"?Vn(p.iconKey)?.key:void 0,A=p.text||(P?Vn(P).label:"");if(!A)continue;l.push({id:`text:${p.id}`,kind:"annotation",text:A,...P?{venueIcon:P}:{},anchor:P?[(p.position.x+p.fontSize/2)*R,h.baseHeightM+Wn,(p.position.y+p.fontSize/2)*R]:[p.position.x*R,h.baseHeightM+Wn,p.position.y*R],color:p.color,rotation:p.rotation,floorIndex:h.index})}else if(p.type==="booth"){if(p.labelPresentation?.visible===!1)continue;let P=wt(p);if(!P)continue;let A=Yt(P);if(!A)continue;l.push({id:`booth:${p.id}`,kind:"booth",text:p.displayLabel||p.label||p.id,anchor:[A.x*R,h.baseHeightM+Xn+nc,A.y*R],floorIndex:h.index})}}}return{labels:l,sections:u,rows:f}}function Sr(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function hc(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Mr(t,n,e,r){if(r?.trim())return r.trim();let o=t?t.lastIndexOf("-"):-1,a=o>0?t.slice(0,o):n;return a&&Ue(a,e)}var dn=3,Ut=.38,pn=.24;function yc(t){if(t.length<3)return null;let n=t[0],e=t[Math.floor(t.length/2)],r=t[t.length-1],o=(e.x-n.x)*R,a=(e.y-n.y)*R,i=(r.x-n.x)*R,s=(r.y-n.y)*R,c=2*(o*s-a*i);if(Math.abs(c)<1e-7)return null;let l=o*o+a*a,u=i*i+s*s,f=(l*s-u*a)/c+n.x*R,m=(o*u-i*l)/c+n.y*R,h=Math.hypot(n.x*R-f,n.y*R-m);return h<1||h>200||!Number.isFinite(h)||t.some(d=>Math.abs(Math.hypot(d.x*R-f,d.y*R-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Ir(t){let n=[],e=new Map,r=(c,l)=>`${Math.floor(c/dn)},${Math.floor(l/dn)}`;for(let c of t)for(let l of c.rows){for(let f of l.pts){let m=f.x*R,h=f.y*R,d=r(m,h),y=e.get(d)??[];y.push({x:m,z:h,y:l.y,floor:c.floorIndex}),e.set(d,y)}if(l.patch||l.pts.length<2)continue;let u=yc(l.pts);for(let f of[0,l.pts.length-1]){let m=l.pts[f],h=l.pts[f===0?1:f-1],d=m.x-h.x,y=m.y-h.y,b=Math.hypot(d,y);b<1e-6||n.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:m,x:m.x*R,z:m.y*R,dx:d/b,dz:y/b})}}let o=new Map;n.forEach((c,l)=>{let u=r(c.x,c.z),f=o.get(u)??[];f.push(l),o.set(u,f)});let a=(c,l)=>{let u=Math.floor(c/dn),f=Math.floor(l/dn);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${u+m},${f+h}`))},i=new Map;n.forEach((c,l)=>{let u=-1,f=1/0,m=!1;for(let h of a(c.x,c.z))for(let d of o.get(h)??[]){let y=n[d];if(c.sectionId===y.sectionId&&c.row.blockId===y.row.blockId||c.floorIndex!==y.floorIndex||Math.abs(c.row.y-y.row.y)>.05)continue;let b=y.x-c.x,p=y.z-c.z,g=Math.hypot(b,p);if(g<Ut*2+.45||g>dn)continue;let P=c.curve&&y.curve&&Math.hypot(c.curve.x-y.curve.x,c.curve.z-y.curve.z)<=.05&&Math.abs(c.curve.radius-y.curve.radius)<=.05,A=Math.min((b*c.dx+p*c.dz)/g,(-b*y.dx-p*y.dz)/g);(P?A<.8:A<.98)||!P&&(Math.abs(b*c.dz-p*c.dx)>.15||Math.abs(b*y.dz-p*y.dx)>.15)||(g<f-.02?(u=d,f=g,m=!1):Math.abs(g-f)<=.02&&(m=!0))}u>=0&&!m&&i.set(l,u)});let s=[];for(let[c,l]of i){if(c>=l||i.get(l)!==c)continue;let u=n[c],f=n[l],m=Math.hypot(f.x-u.x,f.z-u.z),h=(f.x-u.x)/m,d=(f.z-u.z)/m,y=!1;for(let p of a((u.x+f.x)/2,(u.z+f.z)/2))for(let g of e.get(p)??[]){if(g.floor!==u.floorIndex||Math.abs(g.y-u.row.y)>.75)continue;let P=(g.x-u.x)*h+(g.z-u.z)*d,A=Math.abs((g.x-u.x)*d-(g.z-u.z)*h);P>.01&&P<m-.01&&A<pn+Ut&&(y=!0)}if(y)continue;let b=(p,g)=>({x:(u.x+h*p-d*g)/R,y:(u.z+d*p+h*g)/R});s.push({sections:[u.sectionId,f.sectionId],blocks:[u.row.blockId,f.row.blockId],floorIndex:u.floorIndex,ends:[u.point,f.point],clearWidthM:m-2*Ut,heightM:(u.row.y+f.row.y)/2,outline:[b(Ut,-pn),b(m-Ut,-pn),b(m-Ut,pn),b(Ut,pn)]})}return s}var dc=.15,pc=.9,xc=1.76;function _r(t){return!!t&&t[0]*.2126+t[1]*.7152+t[2]*.0722>.55?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function bc(){return{background:{top:[...$n.top],bottom:[...$n.bottom]},sky:_r(null),structure:qn,seatStates:{...Je},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function gc(t){return!!t&&t[0]*.2126+t[1]*.7152+t[2]*.0722>.55?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Ar(t){let n=bc();t??={};let e=it(t.background);if(e){n.background={top:V(e,pc),bottom:V(e,xc)},n.sky=_r(e);let s={};for(let[l,u]of Object.entries(qn))s[l]=st(u,e,dc);e[0]*.2126+e[1]*.7152+e[2]*.0722>.55&&(s.ground=V(e,.86)),n.structure=s}let r=it(t.selectionColor)??it(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Ye(o));let a=Object.fromEntries(Object.entries(t.venue3d??{}).filter(([,s])=>s!=null)),i={...gc(e),...a};if(i){let s=it(i.deck),c=it(i.fascia);s&&(n.structure={...n.structure,tierTop:s,gaTop:s}),c&&(n.structure={...n.structure,tierWall:c,gaWall:c}),n.materials.seat=it(i.seat),n.materials.shell=it(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return n}function wr(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Me=.6,Er=3,Mc=.25;function Pc(t,n){if(xt(n,t.x,t.y))return 0;let e=1/0;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[o],i=n[r],s=i.x-a.x,c=i.y-a.y,l=s*s+c*c||1,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l));e=Math.min(e,Math.hypot(t.x-(a.x+u*s),t.y-(a.y+u*c)))}return e}function Br(t,n){let e=t.map(i=>({booth:i,ring:wt(i)})).filter(i=>!!i.ring&&i.ring.length===4&&!i.booth.points),r=e.map(({ring:i})=>({minX:Math.min(...i.map(s=>s.x)),maxX:Math.max(...i.map(s=>s.x)),minY:Math.min(...i.map(s=>s.y)),maxY:Math.max(...i.map(s=>s.y))})),o=(Er+Me)/R,a=new Map;return e.forEach(({booth:i,ring:s},c)=>{let l={x:s.reduce((h,d)=>h+d.x,0)/4,y:s.reduce((h,d)=>h+d.y,0)/4},u=[0,1,2,3].map(h=>{let d=s[h],y=s[(h+1)%4],b={x:(d.x+y.x)/2,y:(d.y+y.y)/2},p=b.x-l.x,g=b.y-l.y,P=Math.hypot(p,g)||1,A={x:b.x+p/P*Me/R,y:b.y+g/P*Me/R},M=Er/R;return r.forEach((x,_)=>{_===c||A.x<x.minX-o||A.x>x.maxX+o||A.y<x.minY-o||A.y>x.maxY+o||(M=Math.min(M,Pc(A,e[_].ring)))}),{open:M*R,toward:{x:b.x+p/P*10/R,y:b.y+g/P*10/R},focal:Math.hypot(b.x-n.x,b.y-n.y)}}),f=Math.max(...u.map(h=>h.open)),m=u.filter(h=>h.open>=f-Mc).sort((h,d)=>h.focal-d.focal)[0];a.set(i.id,m.toward)}),a}import Rc from"polygon-clipping";var Sc=.45,Ic=1500,_c=200;function Tr(t,n){if(t.role!=="stage"||Kt(t.stageKind))return t;let e=ct(t);if(!e||e.length<3||Math.abs(pt(e))*R*R>Ic)return t;let r=n.filter(i=>xt(e,i.x,i.y));if(!r.length||r.length>_c)return t;let o=Sc/R,a=r.map(i=>[[[i.x-o,i.y-o],[i.x+o,i.y-o],[i.x+o,i.y+o],[i.x-o,i.y+o],[i.x-o,i.y-o]]]);try{let i=Rc.difference([[...e.map(l=>[l.x,l.y]),[e[0].x,e[0].y]]],...a),s=null,c=0;for(let l of i){let u=l[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(pt(u));f>c&&(c=f,s=u)}return!s||s.length<3?t:{...t,kind:"polygon",points:s,rotation:0}}catch{return t}}function Pe(t,n,e,r,o,a,i,s,c,l=[],u=o){if(n.length!==e.length||n.length<2||a-o<1.5)return;let f=(y,b,p)=>{Ot(t,y,b,p,l,i,s,{portalBase:u,ao:c})||Z(t,y,void 0,()=>p,b,i,s,c)},m=(y,b,p)=>({x:y.x+(b.x-y.x)*p,y:y.y+(b.y-y.y)*p}),h=r?n.length:n.length-1,d=0;for(let y=0;y<h;y++){let b=(y+1)%n.length,p=Math.hypot(e[b].x-e[y].x,e[b].y-e[y].y)*$;if(p<1e-5)continue;let g=(x,_)=>[m(n[y],n[b],x),m(n[y],n[b],_),m(e[y],e[b],_),m(e[y],e[b],x)];f(g(0,1),o,o+.95),f(g(0,1),a-.22,a);let P=Math.ceil((d-.32)/6)*6,A=!1,M=!1;for(let x=P;x<d+p;x+=6){let _=Math.max(0,(x-d)/p),I=Math.min(1,(x+.32-d)/p);I<=_||(f(g(_,I),o+.95,a-.22),A||=_<1e-6,M||=I>1-1e-6)}if(!r&&(y===0&&!A||y===h-1&&!M)){let x=Math.min(1,.32/p);f(g(y===0?0:1-x,y===0?x:1),o+.95,a-.22)}d+=p}}import Wt from"polygon-clipping";var bn=.65;function Re(t,n){let e=1/0;for(let r of n)for(let o=0;o<r.length;o++){let a=r[o],i=r[(o+1)%r.length],s=i.x-a.x,c=i.y-a.y,l=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/(s*s+c*c||1)));e=Math.min(e,Math.hypot(t.x-a.x-l*s,t.y-a.y-l*c))}return e}var Se=.01;function Or(t,n,e,r,o,a,i,s=[],c=!0,l={bays:[],walls:[]}){if(r-o<=1e-5)return;let u=r-o>=3,f=u?r-bn:o;t.setMaterial(5);let m=u?[]:s.filter(x=>{if(x.role!=="entrance"&&x.role!=="exit")return!1;let _=ct(x);if(!_)return!1;let I=Qt(_,o,o+At(x).heightM);return I!==null&&I.openingTop<=r-.12});if((!m.length||!Ot(t,n,f,r,m,a,i,{holes:e,portalBase:o}))&&Z(t,n,e,()=>r,f,a,i,K,void 0,()=>[0,1,0]),!u){t.setMaterial(0);return}let h=c&&l.bays.length?Ac(n,e,Lt(n,xn/R),l):null,d=6/R,y=.22/R,b=s.flatMap(x=>{if(x.role!=="entrance"&&x.role!=="exit")return[];let _=ct(x);return _?.length?[{minX:Math.min(..._.map(I=>I.x)),maxX:Math.max(..._.map(I=>I.x)),minY:Math.min(..._.map(I=>I.y)),maxY:Math.max(..._.map(I=>I.y))}]:[]}),p=Math.min(...n.map(x=>x.x)),g=Math.max(...n.map(x=>x.x)),P=Math.min(...n.map(x=>x.y)),A=Math.max(...n.map(x=>x.y));for(let x=p+d/2;x<g;x+=d)for(let _=P+d/2;_<A;_+=d){if(b.some(S=>x+y>=S.minX&&x-y<=S.maxX&&_+y>=S.minY&&_-y<=S.maxY))continue;let I=[{x:x-y,y:_-y},{x:x+y,y:_-y},{x:x+y,y:_+y},{x:x-y,y:_+y}];!Rt({x,y:_},n,e)||Re({x,y:_},[n,...e??[]])<y*Math.SQRT2+(c?xn/R:0)||h&&Re({x,y:_},h.flat())<y*Math.SQRT2+xn/R||Z(t,I,void 0,()=>f,o,a,i,K)}if(h){for(let[x,..._]of h)Z(t,x,_,()=>f,o-Se,a,i,K);t.setMaterial(0);return}let M=Lt(n,xn/R);if(c&&M.length>=3){let x=s.filter(S=>{if(S.role!=="entrance"&&S.role!=="exit")return!1;let B=ct(S);return!!B&&B.some(T=>!Rt(T,n,void 0)||Re(T,[n])<=xn/R)}),_=[M.slice().reverse()],I=o-Se;(!x.length||!Ot(t,n,I,f,x,a,i,{holes:_,portalBase:o+Se}))&&Z(t,n,_,()=>f,I,a,i,K)}t.setMaterial(0)}var Ie=.25,xn=Ie;function Ac(t,n,e,r){if(e.length<3)return null;let o=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s},a=i=>{let[s,...c]=i.map(l=>[o(l)]);return Wt.union(s,...c)};try{let i=[o(t),...(n??[]).map(o)],s=Wt.difference(i,[o(e)]),c=Wt.intersection(i,a(r.bays));if(!c.length)return null;let l=Wt.difference(Wt.intersection(i,a(r.walls)),c);return Wt.union(Wt.difference(s,c),l).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var wc=.02,Ec=.25,Bc=1.2,Tc=.6,Oc=.45,Cc=2.3,kc=Math.PI/180,Cr=.005;function Bt(t,n,e){let r=e*kc;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function Fc(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Lc=24,vc=.01;function Nc(t,n,e,r,o,a,i,s,c){let l=e.binCount,u=Lc,f=$,m=a+.02,h=a-vc,d=[];for(let w=0;w<l;w++){let E=(e.startBin+w+.5)*n.binStepDeg,C=new Float64Array(u+1);for(let L=0;L<=u;L++){let O=r[w]+(o[w]-r[w])*L/u;C[L]=Math.max(m,$e(n,e,E,O)-Ec)}d.push(C)}if(c){let w=0;for(let E=0;E+1<l;E++)for(let C=0;C<u;C++){let L=Bt(n.centre,r[E]+(o[E]-r[E])*C/u,(e.startBin+E+.5)*n.binStepDeg),O=Bt(n.centre,r[E+1]+(o[E+1]-r[E+1])*(C+1)/u,(e.startBin+E+1.5)*n.binStepDeg);w=Math.max(w,Math.hypot(O.x-L.x,O.y-L.y))}for(let E=0;E<l;E++){let C=(e.startBin+E+.5)*n.binStepDeg;for(let L=0;L<=u;L++){let O=Bt(n.centre,r[E]+(o[E]-r[E])*L/u,C),D=c(O.x,O.y,w*1.01);D!==null&&(d[E][L]=Math.min(d[E][L],Math.max(h+Cr,D-Cr)))}}}let y=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],g=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],P=(w,E)=>{let C=(e.startBin+w+.5)*n.binStepDeg,L=r[w]+(o[w]-r[w])*E/u,O=Bt(n.centre,L,C);return[O.x*f,d[w][E],O.y*f]};{let w=Math.tan(12*Math.PI/180);for(let E=0;E<6;E++){let C=!1;for(let O=0;O<l;O++)for(let D=u-1;D>=0;D--)d[O][D]>d[O][D+1]&&(d[O][D]=d[O][D+1],C=!0);let L=e.closed?l:l-1;for(let O=0;O<L;O++){let D=(O+1)%l;for(let H=0;H<=u;H++){let j=d[D][H]-d[O][H];if(Math.abs(j)>1)continue;let G=r[O]+(o[O]-r[O])*H/u,U=r[D]+(o[D]-r[D])*H/u,X=Bt(n.centre,G,(e.startBin+O+.5)*n.binStepDeg),Y=Bt(n.centre,U,(e.startBin+D+.5)*n.binStepDeg),nt=w*Math.hypot(Y.x-X.x,Y.y-X.y)*f;j>nt?(d[D][H]=d[O][H]+nt,C=!0):-j>nt&&(d[O][H]=d[D][H]+nt,C=!0)}}if(!C)break}}let A=1,M=(w,E)=>{for(let C=0;C<=u;C+=4)if(Math.abs(d[w][C]-d[E][C])>A)return!0;return Math.abs(d[w][u]-d[E][u])>A},x=Math.tan(38*Math.PI/180),_=w=>(o[w]-r[w])/u*f,I=(w,E)=>d[w][E+1]-d[w][E]>x*Math.max(1e-6,_(w)),S=(w,E)=>{let C=e.closed?(w-1+l)%l:Math.max(0,w-1),L=e.closed?(w+1)%l:Math.min(l-1,w+1);Math.abs(d[C][E]-d[w][E])>A&&(C=w),Math.abs(d[L][E]-d[w][E])>A&&(L=w);let O=Math.max(0,E-1),D=Math.min(u,E+1);O<E&&I(w,O)&&(O=E),D>E&&I(w,E)&&(D=E);let H=P(C,E),j=P(L,E),G=P(w,O),U=P(w,D),X=j[0]-H[0],Y=j[1]-H[1],nt=j[2]-H[2],rt=U[0]-G[0],q=U[1]-G[1],Q=U[2]-G[2],J=Y*Q-nt*q,v=nt*rt-X*Q,N=X*q-Y*rt,W=Math.hypot(J,v,N);return W>1e-12?(J/=W,v/=W,N/=W,v<0&&(J=-J,v=-v,N=-N),[J,v,N]):[0,1,0]},B=(w,E,C=!1)=>{let L=C&&Math.min(w[1],E[1])-a>=3,O=[w[0],L?w[1]-bn:h,w[2]],D=[E[0],L?E[1]-bn:h,E[2]],H=E[0]-w[0],j=E[2]-w[2],G=Math.hypot(H,j);if(!(G>1e-12))return;let U=[j/G,0,-H/G];t.tri(w,E,D,U,p,p,g),t.tri(w,D,O,U,p,g,g)},T=.05*Pt,F=w=>o[w]-r[w]<T,k=e.closed?l:l-1;for(let w=0;w<k;w++){let E=(w+1)%l;if(F(w)||F(E))continue;if(M(w,E)){let j=(e.startBin+w+1)*n.binStepDeg,G=(q,Q)=>{let J=(r[w]+r[E])/2,v=(o[w]+o[E])/2,N=J+(v-J)*Q/u,W=Bt(n.centre,N,j);return[W.x*f,d[q][Q],W.y*f]};for(let q=0;q<u;q++){let Q=P(w,q),J=P(w,q+1),v=G(w,q),N=G(w,q+1),W=S(w,q),lt=S(w,q+1);t.triN(Q,v,N,W,W,lt,y),t.triN(Q,N,J,W,lt,lt,y);let ft=P(E,q),at=P(E,q+1),tt=G(E,q),et=G(E,q+1),ht=S(E,q),z=S(E,q+1);t.triN(tt,ft,at,ht,ht,z,y),t.triN(tt,at,et,ht,z,z,y);let mt=G(w,q),yt=G(w,q+1),Gt=G(E,q+1),Ht=G(E,q),kt=yt[0]-mt[0],Ft=yt[2]-mt[2],on=Math.hypot(kt,Ft);if(on>1e-12){let gn=[Ft/on,0,-kt/on];t.tri(mt,yt,Gt,gn,p),t.tri(mt,Gt,Ht,gn,p)}}let U=P(w,0),X=P(E,0),Y=P(E,u),nt=P(w,u),rt=q=>[q[0],h,q[2]];Math.min(U[1],X[1])-a<3&&(t.tri(rt(U),rt(Y),rt(X),[0,-1,0],b),t.tri(rt(U),rt(nt),rt(Y),[0,-1,0],b)),B(U,X,!0),B(nt,Y,!0);continue}for(let j=0;j<u;j++){let G=S(w,j),U=S(E,j),X=S(E,j+1),Y=S(w,j+1);if(I(w,j)||I(E,j)){let J=(yt,Gt)=>{let Ht=(e.startBin+yt+.5)*n.binStepDeg,kt=r[yt]+(o[yt]-r[yt])*(j+.5)/u,Ft=Bt(n.centre,kt,Ht);return[Ft.x*f,Gt,Ft.y*f]},v=P(w,j),N=P(E,j),W=J(w,d[w][j]),lt=J(E,d[E][j]);t.triN(v,N,lt,G,U,U,y),t.triN(v,lt,W,G,U,G,y);let ft=P(E,j+1),at=P(w,j+1),tt=J(w,d[w][j+1]),et=J(E,d[E][j+1]);t.triN(tt,et,ft,Y,X,X,y),t.triN(tt,ft,at,Y,X,Y,y);let ht=lt[0]-W[0],z=lt[2]-W[2],mt=Math.hypot(ht,z);if(mt>1e-12){let yt=[-z/mt,0,ht/mt];t.tri(W,lt,et,yt,p),t.tri(W,et,tt,yt,p)}continue}let nt=P(w,j),rt=P(E,j),q=P(E,j+1),Q=P(w,j+1);t.triN(nt,rt,q,G,U,X,y),t.triN(nt,q,Q,G,X,Y,y)}let C=P(w,0),L=P(E,0),O=P(E,u),D=P(w,u),H=j=>[j[0],h,j[2]];Math.min(C[1],L[1])-a<3&&(t.tri(H(C),H(O),H(L),[0,-1,0],b),t.tri(H(C),H(D),H(O),[0,-1,0],b)),B(C,L,!0),B(D,O,!0)}if(!e.closed)for(let w of[0,l-1])for(let E=0;E<u;E++)B(P(w,E),P(w,E+1))}function kr(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let u of n.rings)for(let f of u.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let y=0;y<f.binCount;y++){let b=(f.startBin+y)%n.binCount,p=Math.max(0,f.innerR[y]-St);m[y]=Math.max(p,i[b]+.001),h[y]=Math.max(m[y]+.001,f.outerR[y]+St)}let d=0;for(let y=0;y<f.binCount;y++){let b=f.topLevelM[y]-r;b>d&&(d=b)}d>=Bc&&Nc(t,n,f,m,h,r,o,a,e.standTopNear);for(let y=0;y<f.binCount;y++){let b=(f.startBin+y)%n.binCount;h[y]>i[b]&&(i[b]=h[y])}}if(e.deriveShell===!1||Fc(e.shapes,n))return;let s=n.rings[n.rings.length-1],c=Tc*Pt,l=Oc*Pt;for(let u of s.arcs){let f=[],m=[];for(let S=0;S<u.binCount;S++){let B=(u.startBin+S+.5)*n.binStepDeg,T=u.outerR[S]+St+c;f.push(Bt(n.centre,T,B)),m.push(Bt(n.centre,T+l,B))}let h=-1/0;for(let S=0;S<u.binCount;S++)u.topLevelM[S]>h&&(h=u.topLevelM[S]);let d=h+Cc,y=u.closed?m:[...m,...f.slice().reverse()],b=u.closed?[f.slice().reverse()]:void 0,p=st(o.shellWall,[.66,.71,.72],.62),g=(S,B,T,F,k)=>{let w=Math.abs(F-h)<1e-6?F-wc:F;Ot(t,S,T,w,e.shapes,o.shellTop,k,{holes:B,portalBase:r,ao:a})||Z(t,S,B,()=>w,T,o.shellTop,k,a)},P=Math.max(1,Math.ceil((h-r)/4.5)),A=(h-r)/P,M=new Set,x=e.tierFrontLevels??n.rings.map(S=>{let B=S.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,F)=>T-F);return B[Math.floor(B.length/2)]});for(let S of x)Number.isFinite(S)&&S-r>=3&&S<h&&M.add(Math.max(0,Math.min(P-1,Math.floor((S-r)/A))));let _=Math.min(...x.filter(S=>Number.isFinite(S)&&S-r>=3&&S<h));for(let S=0;S<P;S++)r+(S+1)*A<=_-bn&&Number.isFinite(_)&&M.add(S);for(let S=0;S<P;S++){let B=r+(h-r)*S/P,T=r+(h-r)*(S+1)/P;M.has(S)&&T-B>=3.2?(g(y,b,B,B+.45,p),Pe(t,f,m,u.closed,B+.45,T-.16,o.shellTop,p,a,e.shapes,r)):g(y,b,B,T-.16,p),g(y,b,T-.16,T,V(p,.62))}Pe(t,f,m,u.closed,h,d,o.shellTop,p,a,e.shapes,r);let I=8;for(let S=1;S<m.length;S++){if(I+=Math.hypot(m[S].x-m[S-1].x,m[S].y-m[S-1].y)*$,I<8)continue;I=0;let B=m[S],T=m[S-1],F=B.x-T.x,k=B.y-T.y,w=Math.max(1,Math.hypot(F,k)),E=F/w*.16*Pt,C=k/w*.16*Pt,L=Math.max(1,Math.hypot(B.x-n.centre.x,B.y-n.centre.y)),O=(B.x-n.centre.x)/L*.24*Pt,D=(B.y-n.centre.y)/L*.24*Pt,H=[{x:B.x-E,y:B.y-C},{x:B.x+E,y:B.y+C},{x:B.x+E+O,y:B.y+C+D},{x:B.x-E+O,y:B.y-C+D}];g(H,void 0,r,h,V(p,1.12))}}}var Dc=2.5,Fr=.65,Gc=2,Hc=.03;function Xc(t,n){let e=()=>{let r=n;for(;t.length>2;){let o=t[0],a=t[1],i=Math.hypot(a.x-o.x,a.y-o.y);if(i>r){t[0]={x:o.x+(a.x-o.x)/i*r,y:o.y+(a.y-o.y)/i*r};return}r-=i,t.shift()}};e(),t.reverse(),e(),t.reverse()}function we(t,n,e){let r=new Map;for(let a of t){let i=r.get(a.blockId);(!i||a.depth<i.depth)&&r.set(a.blockId,a)}let o=[];for(let[a,i]of r){if(i.y-e<Dc||i.pts.length<2)continue;let s=i.pts.map(u=>{let f=u.x-n.x,m=u.y-n.y,h=Math.max(1,Math.hypot(f,m));return{x:u.x-f/h*Fr/R,y:u.y-m/h*Fr/R}}),c=[],l=[s[0]];for(let u=1;u<s.length;u++){let f=s[u-1],m=s[u];Math.hypot(m.x-f.x,m.y-f.y)*R>Gc?(l.length>=2&&c.push(l),l=[m]):l.push(m)}l.length>=2&&c.push(l);for(let u of c)Xc(u,Hc/R);c.length&&o.push({blockId:a,y:i.y,runs:c})}return o}var Lr=.1,jc=1.1,Uc=.22,_e=.95,Ae=.05,vr=1.8;function Nr(t,n,e,r){let o=[.72,.72,.69],a=[.48,.55,.57];for(let i of we(n,e,r)){let s=i.y;for(let c of i.runs){let l=vr;for(let u=1;u<c.length;u++){let f=c[u-1],m=c[u],h=m.x-f.x,d=m.y-f.y,y=Math.hypot(h,d);if(y<1e-5)continue;let b=p=>{let g=-d/y*p/R/2,P=h/y*p/R/2;return[{x:f.x+g,y:f.y+P},{x:m.x+g,y:m.y+P},{x:m.x-g,y:m.y-P},{x:f.x-g,y:f.y-P}]};if(Z(t,b(Uc),void 0,()=>s+Lr,s-jc,o,o,K),Z(t,b(Ae),void 0,()=>s+_e,s+_e-Ae,a,a,K),l+=y*R,l>=vr||u===c.length-1){l=0;let p=.028/R,g=[{x:f.x-p,y:f.y-p},{x:f.x+p,y:f.y-p},{x:f.x+p,y:f.y+p},{x:f.x-p,y:f.y+p}];Z(t,g,void 0,()=>s+_e-Ae,s+Lr,a,a,K)}}}}}var Wc=.9,Yc=1.5,zc=.3;function Dr(t,n,e){let r=[],o=[],a=Wc/R,i=Yc/R,s=zc/R;for(let c of t)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),f=(b,p)=>{let g=u[b],P=u[p],A=Math.hypot(g.x-P.x,g.y-P.y)||1;u[b]={x:g.x+(g.x-P.x)/A*s,y:g.y+(g.y-P.y)/A*s}};f(0,1),f(u.length-1,u.length-2);let m=u.map((b,p)=>{let g=u[Math.max(0,p-1)],P=u[Math.min(u.length-1,p+1)],A=P.x-g.x,M=P.y-g.y,x=Math.hypot(A,M)||1,_=-M/x,I=A/x;return _*(b.x-n.x)+I*(b.y-n.y)<0&&(_=-_,I=-I),{nx:_,ny:I}}),h=u.map((b,p)=>({x:b.x-m[p].nx*i,y:b.y-m[p].ny*i})),d=u.map((b,p)=>({x:b.x+m[p].nx*a,y:b.y+m[p].ny*a})),y=u.map((b,p)=>({x:b.x+m[p].nx*(a+e/R),y:b.y+m[p].ny*(a+e/R)}));r.push([...h,...d.slice().reverse()]),o.push([...d,...y.reverse()])}return{bays:r,walls:o}}var Ee=.88,Yn=.27,Kc=1.2,Vc=.01;function Gr(t,n,e,r,o){let a=[.67,.71,.68],i=[a[0]*Ee,a[1]*Ee,a[2]*Ee],s=c=>!!o&&o.some((l,u)=>u!==c&&l?.belowY!=null&&Math.abs(l.belowY-n[c].y)<1e-6&&n[u].blockId===n[c].blockId);for(let c=0;c<n.length;c++){let l=n[c];if(!(l.pts.length<2))for(let u of[0,l.pts.length-1]){let f=l.pts[u],m=l.pts[u===0?1:u-1],h=f.x-m.x,d=f.y-m.y,y=Math.hypot(h,d);if(y<1e-5)continue;h/=y,d/=y;let b=1/0;for(let E=0;E<e.length;E++){let C=e[E],L=e[(E+1)%e.length],O=L.x-C.x,D=L.y-C.y,H=h*D-d*O;if(Math.abs(H)<1e-8)continue;let j=C.x-f.x,G=C.y-f.y,U=(j*D-G*O)/H,X=(j*d-G*h)/H;U>0&&X>=0&&X<=1&&(b=Math.min(b,U))}let p=.3/R,g=b-.04/R;if(!Number.isFinite(b)||b*R>2||g-p<.12/R)continue;let P=!!r&&s(c),A=o?.[c]?.pitch,M=P&&A&&Number.isFinite(A)?Math.min(Kc/R,Math.max(Yn/R,A-Yn/R-Vc/R)):Yn/R,x=-d,_=h;r&&x*(r.x-f.x)+_*(r.y-f.y)<0&&(x=-x,_=-_);let I=Yn/R,S=[{x:f.x+h*p+x*I,y:f.y+d*p+_*I},{x:f.x+h*g+x*I,y:f.y+d*g+_*I},{x:f.x+h*g-x*M,y:f.y+d*g-_*M},{x:f.x+h*p-x*M,y:f.y+d*p-_*M}];if(!S.every(E=>xt(e,E.x,E.y)))continue;let B=o?.[c]?.belowY,T=B==null?0:l.y-B,F=!!r&&T>.03&&T<=.65;if(F&&r){let E=(C,L)=>Math.hypot((C.x+L.x)/2-r.x,(C.y+L.y)/2-r.y);E(S[0],S[1])>E(S[3],S[2])&&(S=[S[3],S[2],S[1],S[0]])}let k=F?Math.ceil((T-1e-8)/.2):1,w=(E,C,L)=>({x:E.x+(C.x-E.x)*L,y:E.y+(C.y-E.y)*L});for(let E=0;E<k;E++){let C=E/k,L=(E+1)/k,O=[w(S[0],S[3],C),w(S[1],S[2],C),w(S[1],S[2],L),w(S[0],S[3],L)],D=l.y+.008-(F?T*(1-L):0);Z(t,O,void 0,()=>D,D-(F?T/k+.1:.16),a,i,K)}}}}var Zc=.02,qc=.012,$c=.01,Qc=.3,Jc=.5;function tl(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,c=i.y-a.y,l=s*s+c*c,u=l>1e-12?((n-a.x)*s+(e-a.y)*c)/l:0;u=Math.max(0,Math.min(1,u)),r=Math.min(r,Math.hypot(n-(a.x+u*s),e-(a.y+u*c)))}return r}function nl(t,n,e,r){let o=1/0,a=Number.NaN;for(let i=0;i<t.length;i++){let s=n[i];if(Math.hypot(e-s.cx,r-s.cy)-s.rad>=o)continue;let c=tl(t[i].pts,e,r);c<o&&(o=c,a=t[i].y)}return a}function Hr(t,n,e,r,o,a,i){let s=r.filter(m=>m.pts.length>0);if(s.length<2||n.length<3)return;let c=s.map(m=>{let h=0,d=0;for(let b of m.pts)h+=b.x,d+=b.y;h/=m.pts.length,d/=m.pts.length;let y=0;for(let b of m.pts)y=Math.max(y,Math.hypot(b.x-h,b.y-d));return{cx:h,cy:d,rad:y}}),l=[...n],u=e.map(m=>[...m]),f=Zc/R;for(let m of[l,...u])for(let h=0;h<m.length;h++){let d=m[h],y=m[(h+1)%m.length],b=y.x-d.x,p=y.y-d.y,g=Math.hypot(b,p);if(g*R<.05)continue;let P=(d.x+y.x)/2,A=(d.y+y.y)/2,M=p/g,x=-b/g;Rt({x:P+M*f,y:A+x*f},l,u)&&(M=-M,x=-x);let _=o.x-P,I=o.y-A,S=Math.hypot(_,I)||1;if((M*_+x*I)/S>Jc)continue;let B=1/0;for(let O of[.2,.5,.8]){let D=nl(s,c,d.x+b*O-M*f*2,d.y+p*O-x*f*2);Number.isFinite(D)&&(B=Math.min(B,D))}if(!Number.isFinite(B)||B-a<Qc)continue;let T=a-$c,F=B-qc,k={x:(d.x-M*f)*R,z:(d.y-x*f)*R},w={x:(y.x-M*f)*R,z:(y.y-x*f)*R},E=[M,0,x],C=V(i,K.wallBottom),L=V(i,K.top);t.tri([k.x,F,k.z],[w.x,F,w.z],[w.x,T,w.z],E,L,L,C),t.tri([k.x,F,k.z],[w.x,T,w.z],[k.x,T,k.z],E,L,C,C)}}function Xr(t,n,e,r,o,a,i,s,c=!1){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,u=e.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),f=co(r,s.tierTop);if(!o)return;let m=g=>o.deckAt(g.x,g.y),h=Ao(n,i),d=h[0]??n.outline;if(o.rowLevels.length>=2){let g=Tn(o.rowLevels),P=wo(Mo(o.rowLevels,e.focal,g),h),A=Dr(we(o.rowLevels,e.focal,l),e.focal,Ie);for(let x of P){let _=Math.max(l,x.topY-jr);for(let I of a.subtract(x.outline,_))Or(t,I,x.holes,_,l,s.tierTop,s.tierWall,u,!c,A);t.setMaterial(5),Hr(t,x.outline,x.holes,o.rowLevels,e.focal,_,s.tierWall),t.setMaterial(0)}P.length||Z(t,d,n.holes,()=>o.landingY,l,f,s.tierWall,K);let M={tread:[f[0]*K.top,f[1]*K.top,f[2]*K.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let x of h.length?h:[d])Ro(t,o.rowLevels,e.focal,o.landingY,M,x,g);Nr(t,o.rowLevels,e.focal,l),Gr(t,o.rowLevels,n.outline,e.focal,g);return}let y=o.flat?1/0:zo,b=g=>o.normalAt(g.x,g.y),p=o.flat?o.landingY:void 0;for(let g of a.subtract(d,p))Z(t,g,n.holes,m,l,f,s.tierWall,K,y,b)}function el(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let c=e.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=n[i];if(l.kind==="booth")continue;let u=o.get(s);u||(u=new Map,o.set(s,u));let f=l.rowId||`__seat-${i}`,m=u.get(f);m||(m={pts:[],levelM:0,n:0},u.set(f,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=e.seatDeckY(i),m.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&a.push({sectionId:i.id,rows:l});continue}let c=o.get(i.id);c&&a.push({sectionId:i.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return a}function ol(t,n){let e=1/0;for(let r=0;r<n.length;r++){let o=n[r],a=n[(r+1)%n.length],i=a.x-o.x,s=a.y-o.y,c=Math.max(0,Math.min(1,((t.x-o.x)*i+(t.y-o.y)*s)/(i*i+s*s||1)));e=Math.min(e,Math.hypot(t.x-o.x-c*i,t.y-o.y-c*s))}return e}var jr=.02;function rl(t,n){let e=t.objects.filter(r=>r.type==="section"&&!!r.outline&&r.outline.length>=3).flatMap(r=>{let o=n.bySection.get(r.id);if(!o)return[];let a=1/0,i=-1/0,s=1/0,c=-1/0;for(let u of r.outline)u.x<a&&(a=u.x),u.x>i&&(i=u.x),u.y<s&&(s=u.y),u.y>c&&(c=u.y);let l=o.landingY;for(let u of o.rowLevels)l=Math.min(l,u.y-jr);return[{outline:r.outline,holes:r.holes,surface:o,floorTop:l,minX:a,maxX:i,minY:s,maxY:c}]});return(r,o,a)=>{let i=null;for(let s of e){if(r<s.minX-a||r>s.maxX+a||o<s.minY-a||o>s.maxY+a)continue;let c={x:r,y:o};if(!Rt(c,s.outline,s.holes)&&ol(c,s.outline)>a)continue;let l=Math.min(s.surface.deckAt(r,o),s.floorTop);(i===null||l<i)&&(i=l)}return i}}var il=3,sl=.4;function Ur(t,n,e,r,o,a,i=!0){let s=el(n,e,r);if(s.length<il)return;let c=qe(s,n.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;t.setMaterial(5),kr(t,c,{bottomY:n.baseHeightM,tierFrontLevels:s.map(u=>Math.min(...u.rows.map(f=>f.levelM))),colors:{bandTop:V(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??V(o.tierWall,1.15),shellWall:a??o.tierWall},ao:K,shapes:n.objects.filter(u=>u.type==="shape"),deriveShell:i&&l>=sl,standTopNear:rl(n,r)}),t.setMaterial(0)}function Wr(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,c=[];{let l=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<a.floor.length;m+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[m]))),d=m*3,y=l[h];y.minX=Math.min(y.minX,a.position[d]),y.minY=Math.min(y.minY,a.position[d+1]),y.minZ=Math.min(y.minZ,a.position[d+2]),y.maxX=Math.max(y.maxX,a.position[d]),y.maxY=Math.max(y.maxY,a.position[d+1]),y.maxZ=Math.max(y.maxZ,a.position[d+2])}let u=new Map;for(let m=0;m<e.length;m++)for(let h of e[m].objects)h.type==="section"&&u.set(h.id,m);let f=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let h=o.seatOwner[m],d=(h!==null?u.get(h):void 0)??i[m];if(d===void 0)continue;let y=f[d],b=r[m];y.n++,b.x<y.minX&&(y.minX=b.x),b.y<y.minY&&(y.minY=b.y),b.x>y.maxX&&(y.maxX=b.x),b.y>y.maxY&&(y.maxY=b.y);let p=o.seatDeckY(m);y.sumX+=b.x*R,y.sumDeck+=p,y.sumZ+=b.y*R,y.minDeck=Math.min(y.minDeck,p),y.maxDeck=Math.max(y.maxDeck,p+1.6),s[m]=d}for(let m=0;m<e.length;m++){let h=f[m],d=n.floors?.[m],y=l[m],b=Math.min(h.n?h.minX*R:e[m].focal.x*R-1,Number.isFinite(y.minX)?y.minX:1/0),p=Math.max(h.n?h.maxX*R:e[m].focal.x*R+1,Number.isFinite(y.maxX)?y.maxX:-1/0),g=Math.min(h.n?h.minY*R:e[m].focal.y*R-1,Number.isFinite(y.minZ)?y.minZ:1/0),P=Math.max(h.n?h.maxY*R:e[m].focal.y*R+1,Number.isFinite(y.maxZ)?y.maxZ:-1/0),A=Math.min(h.n?Math.min(e[m].baseHeightM,h.minDeck):e[m].baseHeightM,Number.isFinite(y.minY)?y.minY:1/0),M=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(y.maxY)?y.maxY:-1/0),x=[h.n?h.sumX/h.n:(b+p)/2,h.n?h.sumDeck/h.n:(A+M)/2,h.n?h.sumZ/h.n:(g+P)/2],_=Math.max(1,.5*Math.hypot(p-b,M-A,P-g));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(e.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:x,radius:_,box:{min:[b,A,g],max:[p,M,P]},focalWorld:[e[m].focal.x*R,e[m].baseHeightM+1.5,e[m].focal.y*R]})}}return c}function Be(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,c)=>{s<e&&(e=s),c<r&&(r=c),s>o&&(o=s),c>a&&(a=c)};for(let s of n)i(s.x,s.y);for(let s of t)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)i(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)i(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)i(l.x,l.y);else if(c.type==="booth"){let l=wt(c);if(l)for(let u of l)i(u.x,u.y)}else if(c.type==="table"){let l=jn(c);if(l)for(let u of l)i(u.x,u.y)}else if(c.type==="decorImage"){let l=Un(c);if(l)for(let u of l)i(u.x,u.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function qr(t,n,e,r,o,a,i){if(n.length===1){let s=e.map(m=>({x:m.x,y:m.y}));for(let m of n[0].objects)m.type==="section"?s.push(...m.outline):m.type==="shape"?s.push(...ct(m)??m.points??[]):m.type==="gaArea"?s.push(...m.points):m.type==="booth"?s.push(...wt(m)??[]):m.type==="table"?s.push(...jn(m)??[]):m.type==="decorImage"&&s.push(...Un(m)??[]);if(Kr(t,n[0],e,a)||Zr(t,n[0],e,s,a))return!1;if(i&&zr(t,n[0].baseHeightM,s,a,i))return!0;let c=un(s),l=(o.minX+o.maxX)/2,u=(o.minY+o.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-l,d=m.y-u,y=Math.max(1,Math.hypot(h,d));return{x:m.x+h/y*80,y:m.y+d/y*80}}):cn(o.minX-28,o.minY-28,o.maxX-o.minX+56,o.maxY-o.minY+56);return Z(t,f,void 0,()=>-.04,-.22,a.ground,a.ground,K),!1}else{let s=n.reduce((b,p)=>p.baseHeightM<b.baseHeightM?p:b);t.setFloor(s.index);let c={...s,objects:n.flatMap(b=>b.objects)},l=e.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&l.push(...b.outline);if(Kr(t,c,e,a)||Zr(t,c,e,l,a))return!1;if(i&&zr(t,s.baseHeightM,l,a,i))return!0;let u=e.filter((b,p)=>r[p]===s.index),f=Be([s],u),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),d=cn(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),y=s.baseHeightM-.03;return Z(t,d,void 0,()=>y,y-.22,a.ground,a.ground,K),!1}}function Te(t,n,e,r){let{cx:o,cz:a,radius:i}=e,s=1/0,c=1/0,l=1/0,u=-1/0,f=-1/0,m=-1/0,h=(b,p,g)=>{s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,p),f=Math.max(f,p),l=Math.min(l,g),m=Math.max(m,g)};for(let b=0;b<t.position.length;b+=3){let p=b/3;r&&p>=r[0]&&p<r[1]||h(t.position[b],t.position[b+1],t.position[b+2])}for(let b=0;b<n.count;b++){let p=b*3,g=n.iPosition[p],P=n.iPosition[p+1],A=n.iPosition[p+2],M=Math.max(.35,n.iMaxRadius[b]??.35);h(g-M,P,A-M),h(g+M,P+1.6,A+M)}Number.isFinite(s)||(s=o-i,u=o+i,c=0,f=i*.16,l=a-i,m=a+i);let d=[(s+u)/2,(c+f)/2,(l+m)/2],y=Math.max(1,.5*Math.hypot(u-s,f-c,m-l));return{center:d,radius:y,minY:c,maxY:f}}var al=4096;function $r(t,n,e=[]){let r=Math.max(1,Math.ceil(t.count/al)),o=Math.ceil(t.count/r),a=new Float32Array((o*2+n.length*4+e.length)*3),i=0;for(let s=0;s<t.count;s+=r){let c=t.iPosition[s*3],l=t.iPosition[s*3+1],u=t.iPosition[s*3+2];a[i++]=c,a[i++]=l,a[i++]=u,a[i++]=c,a[i++]=0,a[i++]=u}for(let[s,c,l]of e)a[i++]=s,a[i++]=c,a[i++]=l;for(let s of n)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])a[i++]=s.cx+c*s.halfX,a[i++]=s.y,a[i++]=s.cz+l*s.halfZ;return a.subarray(0,i)}function Qr(t,n,e,r,o,a,i=[]){let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let M=0;M<t.count;M++){let x=M*3,_=t.iPosition[x],I=t.iPosition[x+2];_<s&&(s=_),_>l&&(l=_),I<c&&(c=I),I>u&&(u=I)}for(let[M,,x]of i)M<s&&(s=M),M>l&&(l=M),x<c&&(c=x),x>u&&(u=x);for(let M of n)s=Math.min(s,M.cx-M.halfX),l=Math.max(l,M.cx+M.halfX),c=Math.min(c,M.cz-M.halfZ),u=Math.max(u,M.cz+M.halfZ);let f=e.minX*R,m=e.maxX*R,h=e.minY*R,d=e.maxY*R,y=f,b=m,p=h,g=d;if(Number.isFinite(s)){let M=Math.max(2,.06*Math.hypot(l-s,u-c));y=Math.max(f,s-M),b=Math.min(m,l+M),p=Math.max(h,c-M),g=Math.min(d,u+M)}let P=Math.min(0,r),A=Math.max(o,a*.05);return{min:[y,P,p],max:[b,A,g]}}var Yr=12,cl=.6,ll=40;function zr(t,n,e,r,o){let a=un([...e]);if(a.length<3)return!1;let i=1/0,s=1/0,c=-1/0,l=-1/0;for(let A of a)i=Math.min(i,A.x),c=Math.max(c,A.x),s=Math.min(s,A.y),l=Math.max(l,A.y);let u=Math.hypot(c-i,l-s)*R,f=_t(a,Yr/R,1.2),m=Math.max(ll,u*cl),h=_t(a,(Yr+m)/R,1.2);if(f.length!==h.length)return!1;let d=st(r.ground,[.78,.76,.72],.35),y=st(r.ground,[.56,.62,.52],.3);Z(t,f,void 0,()=>n-.04,n-.22,d,d,K);let b=n-.05,p=f.map(A=>[A.x*R,b,A.y*R]),g=h.map(A=>[A.x*R,b,A.y*R]),P=[0,1,0];for(let A=0;A<p.length;A++){let M=(A+1)%p.length;t.tri(p[A],g[M],g[A],P,y,o,o),t.tri(p[A],p[M],g[M],P,y,y,o)}return!0}function Kr(t,n,e,r){let o=Nt(n,e);if(!o)return!1;let a=n.baseHeightM,i=st(r.ground,[.62,.55,.47],.4);return Z(t,o,void 0,()=>a-.04,a-.22,i,i,K),!0}var ul=3e3,fl=20,Vr=1.5,ml=1.2,hl=.25;function Zr(t,n,e,r,o){if(!e.length||e.length>ul||r.length<3)return!1;for(let S of n.objects){if(S.type==="shape"&&Sn(S.stageKind))return!1;if(S.type==="section"){let{height:B}=zt(S,{floorBaseHeightM:n.baseHeightM});if(B-n.baseHeightM>fl)return!1}}let a=0,i=0;for(let S of r)a+=S.x,i+=S.y;a/=r.length,i/=r.length;let s=0,c=0,l=0;for(let S of r){let B=S.x-a,T=S.y-i;s+=B*B,c+=T*T,l+=B*T}let u=.5*Math.atan2(2*l,s-c),f=Math.cos(u),m=Math.sin(u),h=-m,d=f,y=1/0,b=-1/0,p=1/0,g=-1/0;for(let S of r){let B=(S.x-a)*f+(S.y-i)*m,T=(S.x-a)*h+(S.y-i)*d;y=Math.min(y,B),b=Math.max(b,B),p=Math.min(p,T),g=Math.max(g,T)}let P=S=>[[y-S,p-S],[b+S,p-S],[b+S,g+S],[y-S,g+S]].map(([B,T])=>({x:a+f*B+h*T,y:i+m*B+d*T})),A=P(Vr/R),M=P((Vr+hl)/R),x=n.baseHeightM,_=st(o.ground,[.62,.55,.47],.4),I=st(o.ground,[.86,.86,.84],.55);return Z(t,M,void 0,()=>x-.04,x-.22,_,_,K),Z(t,M,[A.slice().reverse()],()=>x+ml,x-.04,st(I,[1,1,1],.2),I,K),!0}function Jr(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=Oe(n);if(!o.ok||o.value.id!==t)return r();let a=new Map;for(let f of e)for(let m of f.objects)m.type==="shape"&&a.set(m.id,{shape:m,unit:f});let i=new Set,s=new Set,c=new Map((n.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),l=[];for(let f of o.value.overlay.productionElements??[]){let m=a.get(f.objectId),h=m?ct(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||i.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return r();i.add(f.id),s.add(f.objectId);let y=h.map(I=>I.x*R),b=h.map(I=>I.y*R),p=m.unit.baseHeightM+d,g=Math.min(...y),P=Math.max(...y),A=Math.min(...b),M=Math.max(...b),x,_=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&_&&(x=jo(h,p,p+f.heightM,m.unit.focal),!x))if(P-g>=M-A){let I=Math.abs(A-m.unit.focal.y*R)<=Math.abs(M-m.unit.focal.y*R)?A-.006:M+.006;x=[[g,p,I],[P,p,I],[g,p+f.heightM,I],[P,p+f.heightM,I]]}else{let I=Math.abs(g-m.unit.focal.x*R)<=Math.abs(P-m.unit.focal.x*R)?g-.006:P+.006;x=[[I,p,A],[I,p,M],[I,p+f.heightM,A],[I,p+f.heightM,M]]}l.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:p,topY:p+f.heightM,bounds:{min:[g,p,A],max:[P,p+f.heightM,M]},occlusion:f.occlusion,..._?{contentImageUrl:_}:{},...x?{contentPlane:x}:{}})}let u=l.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(u.map(f=>[f.objectId,f])),elements:u}}var ti=[.13,.14,.17],en=[.4,.43,.47],yl=.18,dl=.02,pl=2.4,xl=1500,bl=240,gl=.25;function ni(t,n,e,r){let o=n.stageKind??"";if(Kt(o)||o==="round"||!r.length)return;let a=ct(n);if(!a||a.length<3)return;let i={x:a.reduce((C,L)=>C+L.x,0)/a.length,y:a.reduce((C,L)=>C+L.y,0)/a.length},s=0,c=0,l=new Set;for(let C of r)s+=C.x,c+=C.y,l.add(Math.floor(Math.atan2(C.y-i.y,C.x-i.x)*180/Math.PI/10));let u=i.x-s/r.length,f=i.y-c/r.length,m=Math.hypot(u,f);if(m<1e-6)return;let h=r.reduce((C,L)=>C+Math.hypot(L.x-i.x,L.y-i.y),0)/r.length;if(l.size*10>bl&&m<gl*h)return;let d=u/m,y=f/m,b=-y,p=d,g=-1/0,P=1/0,A=1/0,M=-1/0;for(let C of a){let L=(C.x-i.x)*d+(C.y-i.y)*y,O=(C.x-i.x)*b+(C.y-i.y)*p;g=Math.max(g,L),P=Math.min(P,L),A=Math.min(A,O),M=Math.max(M,O)}let x=(M-A)*R,_=(g-P)*R;if(x<3||_<1.5||x*_>xl)return;let I=yl/R,S=(C,L)=>({x:i.x+d*C+b*L,y:i.y+y*C+p*L}),B=(C,L,O,D)=>[S(C,O),S(C,D),S(L,D),S(L,O)],T=e+Math.max(3.5,Math.min(8,x*.35)),F=e+Math.min(pl,T-e-1),k=.2/R,w=P+Math.min(_*.25,1.5)/R,E=dl/R;Z(t,B(g-2*I+E,g-I-E,A+I+k,M-I-k),void 0,()=>F,e,ti,ti,K);for(let[C,L]of[[A+I,A+I+k],[M-I-k,M-I]])Z(t,B(g-2*I,g-I,C,L),void 0,()=>T+.3,e,en,en,K),Z(t,B(w+k,g-2*I,C,L),void 0,()=>T+.3,T,en,en,K);Z(t,B(w,w+k,A+I,M-I),void 0,()=>T+.3,T,en,en,K)}function Mt(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gt(t){return Array.isArray(t)?t:[]}function Ml(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Mt(e))continue;let r=Mt(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function zn(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Pl(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Rl(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function Sl(t){let n=zn(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:zn(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:zn(t.rotation,4),o=t.scale===void 0?[1,1,1]:zn(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,c]=r,l=Math.hypot(a,i,s,c);if(!(l>1e-8))return null;let u=a/l,f=i/l,m=s/l,h=c/l,d=u+u,y=f+f,b=m+m,p=u*d,g=u*y,P=u*b,A=f*y,M=f*b,x=m*b,_=h*d,I=h*y,S=h*b;return[(1-(A+x))*o[0],(g+S)*o[0],(P-I)*o[0],0,(g-S)*o[1],(1-(p+x))*o[1],(M+_)*o[1],0,(P+I)*o[2],(M-_)*o[2],(1-(p+A))*o[2],0,e[0],e[1],e[2],1]}function Il(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function _l(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],c=t[6],l=t[10],u=a*l-i*c,f=i*s-o*l,m=o*c-a*s,h=n*u+e*f+r*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[u*d,f*d,m*d,(r*c-e*l)*d,(n*l-r*s)*d,(e*s-n*c)*d,(e*i-r*a)*d,(r*o-n*i)*d,(n*a-e*o)*d]}function ei(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Al(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Mt(c))return null;r=c}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function wl(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function El(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Bl(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function Tl(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Al(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Mt(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=gt(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||Ml(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||gt(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(gt(r.images).length||gt(r.textures).length)return{ok:!1,issue:"external_resource"};let i=gt(r.buffers);if(i.length!==1||!Mt(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=gt(r.accessors),c=gt(r.bufferViews),l=gt(r.meshes),u=gt(r.nodes),f=gt(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!Mt(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),d=(A,M,x)=>{if(typeof A!="number"||!Number.isInteger(A)||!Mt(s[A]))return null;let _=s[A];if(_.type!==M||_.sparse!==void 0||_.normalized===!0||typeof _.count!="number"||!Number.isInteger(_.count)||_.count<1||typeof _.componentType!="number"||!x.includes(_.componentType)||typeof _.bufferView!="number")return null;let I=c[_.bufferView];if(!Mt(I)||I.buffer!==0||typeof I.byteLength!="number"||!Number.isInteger(I.byteLength)||I.byteLength<0)return null;let S=El(_.type),B=wl(_.componentType),T=typeof I.byteStride=="number"?I.byteStride:S*B,F=typeof I.byteOffset=="number"?I.byteOffset:0,k=typeof _.byteOffset=="number"?_.byteOffset:0,w=F+k,E=k+(_.count-1)*T+S*B;if(!Number.isInteger(T)||!Number.isInteger(F)||!Number.isInteger(k)||T<S*B||F<0||k<0||F+I.byteLength>o.byteLength||E>I.byteLength)return null;let C=[];for(let L=0;L<_.count;L++){let O=[];for(let D=0;D<S;D++){let H=Bl(h,w+L*T+D*B,_.componentType);if(!Number.isFinite(H))return null;O.push(H)}C.push(O)}return C},y=[],b=[],p=0,g=new Set,P=(A,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Mt(u[A])||g.has(A))return!1;g.add(A);let x=u[A],_=Sl(x);if(!_)return!1;let I=Rl(M,_),S=_l(I);if(!S)return!1;if(x.mesh!==void 0){if(typeof x.mesh!="number")return!1;let B=l[x.mesh];if(!Mt(B))return!1;for(let T of gt(B.primitives)){if(!Mt(T)||T.mode!==void 0&&T.mode!==4||!Mt(T.attributes))return!1;let F=d(T.attributes.POSITION,"VEC3",[5126]),k=T.attributes.NORMAL===void 0?null:d(T.attributes.NORMAL,"VEC3",[5126]);if(!F||T.attributes.NORMAL!==void 0&&!k)return!1;let w=F.length;if(T.indices!==void 0){let C=typeof T.indices=="number"?s[T.indices]:null;w=Mt(C)?C.count:void 0}if(typeof w!="number"||!Number.isInteger(w)||w%3!==0||(p+=w/3,p>1e5))return!1;let E=T.indices===void 0?F.map((C,L)=>[L]):d(T.indices,"SCALAR",[5121,5123,5125]);if(!E||E.length%3!==0||E.length!==w)return!1;for(let C=0;C<E.length;C+=3){let L=[E[C][0],E[C+1][0],E[C+2][0]];if(L.some(H=>!Number.isInteger(H)||H<0||H>=F.length))return!1;let O=L.map(H=>Il(I,...F[H])),D=null;if(!k){let H=O[1][0]-O[0][0],j=O[1][1]-O[0][1],G=O[1][2]-O[0][2],U=O[2][0]-O[0][0],X=O[2][1]-O[0][1],Y=O[2][2]-O[0][2];D=ei([1,0,0,0,1,0,0,0,1],j*Y-G*X,G*U-H*Y,H*X-j*U)}for(let H=0;H<3;H++)y.push(...O[H]),b.push(...k?ei(S,...k[L[H]]):D)}}}for(let B of gt(x.children))if(!P(B,I))return!1;return g.delete(A),!0};for(let A of gt(f[m].nodes))if(!P(A,Pl()))return{ok:!1,issue:p>1e5?"triangle_limit":"unsupported_glb"};return!p||y.length!==p*9||b.length!==y.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:p,position:new Float32Array(y),normal:new Float32Array(b)}}function oi(t){try{return Tl(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function Oy(t){let{doc:n}=t,e=Ar(n.theme),r=e.structure,o=_o(n,t.eventConfigurationId??n.eventConfigurationId),a=Jr(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new wn,c=null;if(t.registeredShellGlb){let v=oi(t.registeredShellGlb);if(v.ok){let N=v.position.length/3,W=new Float32Array(v.position.length),lt=e.materials.shell??r.tierWall;for(let ft=0;ft<N;ft++){let at=v.normal[ft*3+1],tt=at<-.25?.4:.62+.38*Math.max(0,at);W[ft*3]=lt[0]*tt,W[ft*3+1]=lt[1]*tt,W[ft*3+2]=lt[2]*tt}c={position:v.position,normal:v.normal,color:W,floor:new Float32Array(N).fill(-2),material:new Float32Array(N),count:N}}}let l=new Map;for(let v of o)for(let N of v.objects)l.set(N.id,v.index),N.type==="section"&&l.set(N.logicalSectionId??N.id,v.index);let u=i.map(v=>l.get(v.sectionId??"")??l.get(v.rowId??"")??0),f=Be(o,i),m=s.vertexCount,d=qr(s,o,i,u,f,r,st(e.background.top,e.background.bottom,.5))?s.vertexCount:m,y=lo(n,i),b=new Map,p=new Map;for(let v of n.categories??[])b.set(v.key,v.color),v.seatGlyph&&p.set(v.key,v.seatGlyph);let g=[],P=Ko(o,i,u),A=new Map;i.forEach((v,N)=>{let W=P.seatDeckY(N);Number.isFinite(W)&&A.set(v.rowId,Math.min(A.get(v.rowId)??1/0,W))});let M=new Float32Array(i.length),x=[],_=new Map((n.floors??[]).map((v,N)=>[v.id,N])),I=o.map(()=>[]);for(let v of i){let N=v.floorId?_.get(v.floorId)??0:0;I[Math.min(N,I.length-1)]?.push(v)}let S=(v,N)=>{if(!N||N.length<3)return!1;let W=Math.min(...N.map(tt=>tt.x)),lt=Math.max(...N.map(tt=>tt.x)),ft=Math.min(...N.map(tt=>tt.y)),at=Math.max(...N.map(tt=>tt.y));for(let tt=0;tt<v;tt++)for(let et of I[tt])if(!(et.x<W||et.x>lt||et.y<ft||et.y>at)&&Rt(et,N,void 0))return!0;return!1},B=null,T=v=>o.length===1?i:i.filter((N,W)=>u[W]===v),F=(v,N)=>{let W=wt(v);if(!W)return!1;let lt=1/0,ft=1/0,at=-1/0,tt=-1/0;for(let et of W)lt=Math.min(lt,et.x),at=Math.max(at,et.x),ft=Math.min(ft,et.y),tt=Math.max(tt,et.y);return i.some((et,ht)=>et.kind!=="booth"&&(o.length===1||u[ht]===N)&&et.x>lt&&et.x<at&&et.y>ft&&et.y<tt&&xt(W,et.x,et.y))},k;for(let v=0;v<o.length;v++){let N=o[v];s.setFloor(v);let W=Nt(N,T(v)),lt=0;if(W){let z=0;for(let mt of N.objects)if(mt.type==="section")for(let yt of P.bySection.get(mt.id)?.rowLevels??[])z=Math.max(z,yt.y-N.baseHeightM);if(lt=Oo(z),!k){let mt=$t(W);k={centre:[mt.x*R,mt.y*R]}}}let ft=new On,at=[],tt=N.objects.filter(z=>z.type==="shape"&&(z.role==="entrance"||z.role==="exit")),et=N.objects.filter(z=>z.type==="section"&&!!z.outline&&z.outline.length>=3),ht=Br(N.objects.filter(z=>z.type==="booth"),N.focal);for(let z of N.objects)if(z.type==="section"){let mt=s.vertexCount;Xr(s,z,N,uo(z,y),P.bySection.get(z.id),ft,et,r,v>0&&S(v,z.outline));let yt=s.vertexCount-mt;yt>0&&x.push({sectionId:z.id,start:mt,count:yt})}else if(z.type==="shape"){let mt=a.byObjectId.get(z.id),yt=g.length,Gt=W!==null&&z.role==="wall"&&!mt;s.setMaterial(Gt?Cn:(mt?.kind??z.role)==="screen"?1:0);let Ht=z.role==="stage"&&!mt?Tr(z,T(v)):Gt&&z.heightM===void 0?{...z,heightM:lt}:z,kt=Bo(Ht,at);if(ur(s,Ht,N.baseHeightM+kt.supportOffsetM,kt.topOffsetM-kt.supportOffsetM,r,N.focal,g,mt,tt),s.setMaterial(0),z.role==="stage"&&!mt&&g.length>yt&&(B??v)===v){B=v;let Ft=n.floors?.[v]?.id,on=o.length>1&&Ft?i.filter(gn=>gn.floorId===Ft):i;ni(s,Ht,g[g.length-1].y,on)}}else z.type==="gaArea"?mr(s,z,N.baseHeightM,it(b.get(z.categoryKey)),r):z.type==="booth"?ar(s,z,N.baseHeightM,it(b.get(z.categoryKey)),r,ht.get(z.id)??N.focal,F(z,v)):z.type==="table"?lr(s,z,Math.max(N.baseHeightM,A.get(z.id)??N.baseHeightM),it(z.fill??n.theme?.decorFill??"#232c40"),r,!!(z.fill??n.theme?.decorFill)):z.type==="decorImage"&&fr(s,z,N.baseHeightM,r);W&&dr(s,N.objects,W,N.baseHeightM,lt,N.focal,r,z=>!a.byObjectId.has(z.id)),Ur(s,N,i,P,r,e.materials.shell,!c)}let w=o.length>1?{x:o.reduce((v,N)=>v+N.focal.x,0)/o.length,y:o.reduce((v,N)=>v+N.focal.y,0)/o.length}:n.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},E=eo(c?[s.build(),c]:[s.build()]),C=so(i,t.initialState,P,M,b,p),L=Pr({doc:n,units:o,seats:i,surfaces:P,focal:w}),{labels:O,sections:D,rows:H}=Rr({doc:n,units:o,seats:i,surfaces:P,seatData:C,hintedSeatFloor:u,zones:L,focal:w}),j=new Map(D.map((v,N)=>[v.id,N]));P.seatOwner.forEach((v,N)=>{C.iSection[N]=v?j.get(v)??-1:-1});let G=Wr({doc:n,units:o,seats:i,surfaces:P,solids:E,hintedSeatFloor:u,seatFloor:M});Sr(O,G),C.iYaw=io(C.iPosition,i.length,v=>i[v].rowId,v=>{let N=o[M[v]]?.focal??w;return[N.x*R,N.y*R]});let U=(f.minX+f.maxX)/2*R,X=(f.minY+f.maxY)/2*R,Y=.5*Math.hypot((f.maxX-f.minX)*R,(f.maxY-f.minY)*R)||10,nt=Te(E,C,{cx:U,cz:X,radius:Y},[m,d]),rt=Te(E,C,{cx:U,cz:X,radius:Y}),q=Ol(o),Q=Qr(C,g,f,nt.minY,nt.maxY,Y,q);return{sharedAisles:Ir(o.flatMap(v=>v.objects.flatMap(N=>{if(N.type!=="section")return[];let W=P.bySection.get(N.id);return W?[{sectionId:N.id,floorIndex:v.index,rows:W.rowLevels}]:[]}))),solids:E,sectionSolidRanges:x,seats:C,seatSectionIds:P.seatOwner,bounds:{center:[(Q.min[0]+Q.max[0])/2,(Q.min[1]+Q.max[1])/2,(Q.min[2]+Q.max[2])/2],radius:Y,groundY:0,box:Q,fitPoints:$r(C,g,q)},...k?{room:k}:{},...!k&&o.some(v=>v.objects.some(N=>N.type==="shape"&&Sn(N.stageKind)))?{outdoor:!0}:{},renderBounds:{center:nt.center,radius:nt.radius},clipBounds:{center:rt.center,radius:rt.radius},stateColorLUT:wr(e,rn),theme:e,seatCount:i.length,focalWorld:[w.x*R,1.5,w.y*R],zones:L,stages:g,productionElements:a.elements,sections:D,rows:H,labels:O,floors:G}}function Ol(t){let n=[];for(let e of t)for(let r of e.objects){let o=r.type==="gaArea"?r.points:r.type==="booth"?wt(r):null;for(let a of o??[])n.push([a.x*R,e.baseHeightM,a.y*R])}return n}function Cl(t,n){let{doc:e,report:r}=Xo(t),o=r.confident&&(r.sections.length>0||!!r.looseRowBlocks);if(!o&&!r.roles?.length)return null;if(!o){let c=new Map(r.roles.map(h=>[h.id,h.role])),l=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),u=t.floors?.map(h=>({...h,objects:l(h.objects)})),f=new Float64Array(n.length).fill(Number.NaN),m=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...t,objects:u?.[0]?.objects??l(t.objects),...u?{floors:u}:{}},report:r,eyeHeightM:f,focal:m}}let a=new Map(In(e).map(c=>[c.id,c])),i=new Float64Array(n.length).fill(Number.NaN),s=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((c,l)=>{let u=a.get(c.id)??c;u.eyeHeightM!==void 0&&(i[l]=u.eyeHeightM),u.focalPoint&&(s[l*2]=u.focalPoint.x,s[l*2+1]=u.focalPoint.y)}),{doc:e,report:r,eyeHeightM:i,focal:s}}function kl(t,n){return t.map((e,r)=>{let o=n.eyeHeightM[r],a=n.focal[r*2],i=n.focal[r*2+1],s={...e};return Number.isNaN(o)?delete s.eyeHeightM:s.eyeHeightM=o,Number.isNaN(a)?delete s.focalPoint:s.focalPoint={x:a,y:i},s})}function Ly(t){let n=t.estimate===!1?null:Cl(t.doc,t.seats);return n?{input:{...t,doc:n.doc,seats:kl(t.seats,n)},estimate:n}:{input:t}}export{Ul as a,xi as b,bi as c,oo as d,gi as e,Wl as f,rn as g,Zn as h,Ll as i,$n as j,R as k,Bn as l,Jl as m,tu as n,Xo as o,Xu as p,ju as q,Uu as r,Wu as s,Yu as t,zu as u,le as v,Ku as w,Vu as x,Zu as y,qu as z,$u as A,hc as B,Oy as C,Cl as D,kl as E,Ly as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as c,l as u}from"./chunk-
|
|
1
|
+
import{k as c,l as u}from"./chunk-UEDS3HJ3.js";import{Pa as h,Ta as b,ab as s}from"./chunk-3W4ZMU4G.js";var l=class extends Error{constructor(n,t,r={}){super(t);this.code=n;this.details=r;this.name="ChartOperationError"}};function P(e,o){let n=s(e),t=o?n.find(r=>r.id===o):n[0];if(!t)throw new l("floor_not_found",`Unknown chart floor: ${o}`,{floorId:o});return{floorId:t.id,objects:t.objects}}function D(e,o){if(!e.categories.some(n=>n.key===o))throw new l("category_not_found",`Unknown chart category: ${o}. Call get_chart to list valid category keys.`,{categoryKey:o})}function y(e,o,n,t){let r=new Set([...t,...e.categories.map(i=>i.key),...e.zones?.map(i=>i.id)??[],...e.floors?.map(i=>i.id)??[],...e.floors?.length?e.floors.flatMap(i=>i.objects.map(a=>a.id)):e.objects.map(i=>i.id)]);for(let i=0;i<100;i++){let a=n(o);if(a&&!r.has(a))return t.add(a),a}throw new l("id_generation_failed",`Unable to allocate a unique ${o} id`)}function L(e){let o=e.slice().sort((i,a)=>i.x-a.x||i.y-a.y);if(o.length<3)return o;let n=(i,a,f)=>(a.x-i.x)*(f.y-i.y)-(a.y-i.y)*(f.x-i.x),t=[];for(let i of o){for(;t.length>=2&&n(t[t.length-2],t[t.length-1],i)<=0;)t.pop();t.push(i)}let r=[];for(let i=o.length-1;i>=0;i--){let a=o[i];for(;r.length>=2&&n(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}return t.pop(),r.pop(),t.concat(r)}function C(e,o){if(!e.length)return e;let n={x:e.reduce((t,r)=>t+r.x,0)/e.length,y:e.reduce((t,r)=>t+r.y,0)/e.length};return e.map(t=>{let r=t.x-n.x,i=t.y-n.y,a=Math.hypot(r,i)||1;return{x:t.x+r/a*o,y:t.y+i/a*o}})}function O(e){let o=[];for(let t of e)t.type==="row"?o.push(...h(t).map(r=>({x:r.x,y:r.y}))):t.type==="table"?o.push(...b(t).map(r=>({x:r.x,y:r.y}))):t.type==="gaArea"?o.push(...t.points):t.type==="booth"&&o.push(t.center);if(o.length<3)return null;let n=C(L(o),22);return n.length>=3?n:null}function z(e,o){let n=P(e,o),t=s(e).find(r=>r.id===n.floorId);return{...e,objects:n.objects,floors:void 0,focalPoint:t.focalPoint,referenceImage:t.referenceImage,backgroundImage:t.backgroundImage}}var p=24,m=80;function v(e,o){let n=e.normalize("NFKC").trim();if(n.length>p)throw new l("invalid_operation",`${o} displayed type must be at most ${p} characters`);return n}function H(e,o){if(e.displayType===void 0)return!1;let n=v(e.displayType,o);return n?(e.displayType=n,!1):(delete e.displayType,!0)}function A(e,o){if(e.displayLabel===void 0)return!1;let n=e.displayLabel.normalize("NFKC").trim();if(n.length>m)throw new l("invalid_operation",`${o} displayed label must be at most ${m} characters`);return n?(e.displayLabel=n,!1):(delete e.displayLabel,!0)}function d(e,o){let n=e.trim().toLowerCase();if(!/^#[0-9a-f]{6}$/.test(n))throw new l("invalid_operation",`${o} must use a six-digit hex color`);return n}function x(e,o){if(!Number.isFinite(e)||e<c||e>u)throw new l("invalid_operation",`${o} label size must be from ${c} to ${u}`)}function $(e,o){e.size!==void 0&&e.size!==null&&x(e.size,o),e.color!==void 0&&e.color!==null&&d(e.color,`${o} label color`)}function k(e,o){if(e?.positionPreset!==void 0&&!["start","end","both","none"].includes(e.positionPreset))throw new l("invalid_operation",`${o} label positionPreset must be one of start, end, both, none`);let n=e?.labelStyle;n&&(n.size!==void 0&&x(n.size,o),n.color!==void 0&&d(n.color,`${o} label color`))}function E(e,o){let n=e?structuredClone(e):{},t=n.labelStyle?{...n.labelStyle}:{};return o.size===null?delete t.size:o.size!==void 0&&(t.size=o.size),o.color===null?delete t.color:o.color!==void 0&&(t.color=d(o.color,"Label color")),t.size===void 0&&t.color===void 0?delete n.labelStyle:n.labelStyle=t,o.visible!==void 0&&(n.visible=o.visible),Object.keys(n).length?n:void 0}function T(e,o,n){let t=o.normalize("NFKC").trim();if(!t||t.length>80)throw new l("invalid_operation","Zone labels must contain 1 to 80 characters");if((e.zones??[]).some(r=>r.id!==n&&r.label.normalize("NFKC").trim().toLocaleLowerCase("en")===t.toLocaleLowerCase("en")))throw new l("invalid_operation",`Zone label already exists: ${t}`);return t}function N(e,o){if(!Number.isFinite(e?.x)||!Number.isFinite(e?.y))throw new l("invalid_operation",`${o} must contain finite x and y values`);return{x:e.x,y:e.y}}function U(e,o,n){return(o.x-e.x)*(n.y-e.y)-(o.y-e.y)*(n.x-e.x)}var B=Math.PI/180,Z=Math.PI/180;function K(e){return e.type==="row"||e.type==="table"?e.seatCount:e.type==="gaArea"?Math.max(0,Math.floor(e.capacity)):e.type==="booth"?1:0}function _(e){if(e.floors?.length){let o=e.floors[0];e.objects=o.objects,e.focalPoint=o.focalPoint,e.referenceImage=o.referenceImage,e.backgroundImage=o.backgroundImage}return e}var S=0,g=120,w=4;function F(e){if(!Number.isFinite(e)||e<S||e>g)throw new l("invalid_operation","Floor base height must be a number from 0 to 120 metres")}function X(e,o){let n=s(e);if(n.length>=5)throw new l("invalid_operation","A chart can contain at most five physical floors");let t=(o.name??String(n.length+1)).normalize("NFKC").trim();if(!t||t.length>80)throw new l("invalid_operation","Floor names must contain 1 to 80 characters");if(n.some(I=>I.name.toLocaleLowerCase("en")===t.toLocaleLowerCase("en")))throw new l("invalid_operation",`Floor name already exists: ${t}`);e.floors?.length||(e.floors=[{id:"floor-0",name:"1",objects:e.objects,baseHeightM:0,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]);let i=e.floors[e.floors.length-1].baseHeightM??Math.min(g,(e.floors.length-1)*w),a=Math.min(g,i+w),f=y(e,"floor",o.idFactory,new Set);return e.floors.push({id:f,name:t,baseHeightM:a,objects:[],focalPoint:{...e.focalPoint}}),_(e),{changed:!0,floorId:f,floorCount:e.floors.length,baseHeightM:a}}function q(e,o){let n=s(e),t=n.find(a=>a.id===o.floorId);if(!t)throw new l("floor_not_found",`Unknown chart floor: ${o.floorId}`,{floorId:o.floorId});let r=o.name.normalize("NFKC").trim();if(!r||r.length>80)throw new l("invalid_operation","Floor names must contain 1 to 80 characters");if(n.some(a=>a.id!==t.id&&a.name.toLocaleLowerCase("en")===r.toLocaleLowerCase("en")))throw new l("invalid_operation",`Floor name already exists: ${r}`);let i=t.name!==r;return i&&(t.name=r),{changed:i,floorId:t.id,floorName:r}}function V(e,o){if(!e.floors?.length)throw new l("invalid_operation","A single-floor chart has an implicit base height of 0 metres");let n=e.floors.find(r=>r.id===o.floorId);if(!n)throw new l("floor_not_found",`Unknown chart floor: ${o.floorId}`,{floorId:o.floorId});F(o.baseHeightM);let t=n.baseHeightM!==o.baseHeightM;return t&&(n.baseHeightM=o.baseHeightM,n.physical3dProvenance={...n.physical3dProvenance,baseHeightM:{status:"confirmed",source:"user-review",note:"Physical floor height reviewed through the shared Designer/Copilot operation."}}),{changed:t,floorId:n.id,baseHeightM:o.baseHeightM}}function W(e,o){if(!e.floors?.length)throw new l("invalid_operation","A single-floor chart cannot remove its only floor");let n=e.floors.findIndex(r=>r.id===o.floorId);if(n<0)throw new l("floor_not_found",`Unknown chart floor: ${o.floorId}`,{floorId:o.floorId});let[t]=e.floors.splice(n,1);if(e.floors.length===1){let[r]=e.floors;e.objects=r.objects,e.focalPoint=r.focalPoint,e.referenceImage=r.referenceImage,e.backgroundImage=r.backgroundImage,e.floors=void 0}else _(e);return{changed:!0,floorId:t.id,removedObjects:t.objects.length,floorCount:s(e).length}}export{l as a,P as b,D as c,y as d,O as e,z as f,v as g,H as h,A as i,d as j,$ as k,k as l,E as m,T as n,N as o,U as p,B as q,Z as r,K as s,_ as t,g as u,w as v,X as w,q as x,V as y,W as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as E}from"./chunk-
|
|
1
|
+
import{l as E}from"./chunk-TFYAMLCK.js";import{O as R,db as B,gb as v}from"./chunk-3W4ZMU4G.js";var T=.08,Y=.045;function L(t){return`__floor__:${encodeURIComponent(t)}`}function X(t,e,o){return{...t,objects:e,floors:void 0,...o?{focalPoint:o}:{},referenceImage:void 0,backgroundImage:void 0}}function j(t,e,o){let s=t.focalPoint??e.focalPoint;return s?s.x:o.x+o.width/2}function Q(t){let e=t.floors??[];if(!e.length)return[];let o=e.map(n=>v(X(t,n.objects,n.focalPoint),{freeText:"exclude"})),a=Math.max(1,...o.map(n=>n.width))*T,r=0;return e.map((n,c)=>{let h=o[c],u=r-(h.y+h.height);return r-=h.height+a,{floorId:n.id,label:n.name??n.id,level:c,levelBadge:c===0?"G":String(c),translation:{x:-j(n,t,h),y:u},bounds:h}})}function z(t,e,o,s){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,o*Y),n=t.bounds.x+t.translation.x,c=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:n,y:c},fontSize:r,rotation:0,color:s,bold:!0};if(e==="name")return[u];let d=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:n-d*.35,y:c-d*.3,width:d*2,height:d*2,fill:"transparent",stroke:{color:s,width:Math.max(1,r*.09)},opacity:.8},u]}function W(t,e={}){let o=t.floors;if(!o||o.length<2)return t;let s=Q(t),a=[];o.forEach((u,d)=>{let{x:y,y:S}=s[d].translation;for(let I of u.objects)d>0&&I.type==="shape"&&I.role==="stage"||a.push(B(I,y,S))});let r={...t,objects:a,floors:void 0},n=v(r,{freeText:"exclude"}),c=Math.max(1,n.width,n.height),h=t.theme?.textColor??"#94a3b8";for(let u of s)a.push(...z(u,e.labelStyle??"number",c,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function H(t){if(!t.floors||t.floors.length<2)return t;let e=!t.zones?.length,o=new Set,s=t.floors.flatMap(r=>r.objects.flatMap(n=>{if(n.type==="shape"&&n.role==="stage"){let c=JSON.stringify([n.kind,n.x,n.y,n.width,n.height,n.points,n.rotation??0,n.label,n.heightM,n.eventConfigurationIds]);if(o.has(c))return[];o.add(c)}return e&&n.type==="section"?[{...n,zone:L(r.id)}]:[n]})),a=e?t.floors.map(r=>({id:L(r.id),label:r.name,focalPoint:{...r.focalPoint}})):t.zones;return{...t,objects:s,zones:a,floors:void 0,referenceImage:void 0,backgroundImage:E(t)}}function J(t){let e=t.floors;if(!e?.length)return null;let o=e.find(r=>r.objects.some(n=>n.type==="shape"&&n.role==="stage"));if(o)return o.id;let s=e[0],a=-1;for(let r of e){let n=v(X(t,r.objects,r.focalPoint),{freeText:"exclude"}),c=n.width*n.height;c>a&&(a=c,s=r)}return s.id}var V=640;function tt(t,e){return(t.floors?.length??0)<2?null:"all"}var U=9;function Z(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,o=t.height/2,s=t.rotation??0;if(!s)return{hx:e,hy:o};let a=s*Math.PI/180,r=Math.abs(Math.cos(a)),n=Math.abs(Math.sin(a));return{hx:e*r+o*n,hy:e*n+o*r}}function $(t,e,o){let s=e-t.seat.x,a=o-t.seat.y;if(t.shape.kind==="circle")return s*s+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,n=s,c=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),d=Math.sin(h);n=s*u-a*d,c=s*d+a*u}return Math.abs(n)<=t.shape.width/2&&Math.abs(c)<=t.shape.height/2}function N(t,e,o,s,a){if(t.shape.kind==="circle"){let f=Math.min(Math.max(t.seat.x,e),s),x=Math.min(Math.max(t.seat.y,o),a),m=t.seat.x-f,p=t.seat.y-x;return m*m+p*p<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=s&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=o;let n=r*Math.PI/180,c=Math.cos(n),h=Math.sin(n),u=t.shape.width/2,d=t.shape.height/2,y=[[-u,-d],[u,-d],[u,d],[-u,d]].map(([f,x])=>[t.seat.x+f*c-x*h,t.seat.y+f*h+x*c]),S=[[e,o],[s,o],[s,a],[e,a]],I=[[1,0],[0,1],[c,h],[-h,c]];for(let[f,x]of I){let m=1/0,p=-1/0;for(let[w,O]of y){let i=w*f+O*x;i<m&&(m=i),i>p&&(p=i)}let M=1/0,P=-1/0;for(let[w,O]of S){let i=w*f+O*x;i<M&&(M=i),i>P&&(P=i)}if(p<M||P<m)return!1}return!0}function ot(t,e={}){let o=e.seatRadius??U,s=t.length,a=new Array(s),r=1/0,n=1/0,c=-1/0,h=-1/0,u=0;for(let i=0;i<s;i++){let l=t[i],D=e.shapeOf?.(l)??{kind:"circle",r:o},{hx:g,hy:b}=Z(D);a[i]={seat:l,shape:D,hx:g,hy:b},l.x-g<r&&(r=l.x-g),l.y-b<n&&(n=l.y-b),l.x+g>c&&(c=l.x+g),l.y+b>h&&(h=l.y+b),g>u&&(u=g),b>u&&(u=b)}s===0&&(r=0,n=0,c=0,h=0);let d=u>0?u*4:1,y=Math.max(c-r,0),S=Math.max(h-n,0),I=Math.max(64,e.maxCells??s*4),f=d,x=Math.max(1,Math.ceil(y/f)||1),m=Math.max(1,Math.ceil(S/f)||1);for(;x*m>I&&(x>1||m>1);)f*=2,x=Math.max(1,Math.ceil(y/f)||1),m=Math.max(1,Math.ceil(S/f)||1);let p=x*m,M=new Int32Array(p+1),P=0;for(let i=0;i<s;i++){let l=a[i],D=R(Math.floor((l.seat.x-l.hx-r)/f),0,x-1),g=R(Math.floor((l.seat.x+l.hx-r)/f),0,x-1),b=R(Math.floor((l.seat.y-l.hy-n)/f),0,m-1),F=R(Math.floor((l.seat.y+l.hy-n)/f),0,m-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++)M[A*x+C+1]++,P++}for(let i=0;i<p;i++)M[i+1]+=M[i];let w=new Int32Array(P),O=M.slice(0,p);for(let i=0;i<s;i++){let l=a[i],D=R(Math.floor((l.seat.x-l.hx-r)/f),0,x-1),g=R(Math.floor((l.seat.x+l.hx-r)/f),0,x-1),b=R(Math.floor((l.seat.y-l.hy-n)/f),0,m-1),F=R(Math.floor((l.seat.y+l.hy-n)/f),0,m-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++){let k=A*x+C;w[O[k]++]=i}}return{seats:t,entries:a,minX:r,minY:n,cell:f,cols:x,rows:m,cellStart:M,items:w,stamp:new Int32Array(s),epoch:0}}function rt(t,e,o={}){let{cols:s,rows:a,cell:r,minX:n,minY:c,cellStart:h,items:u,entries:d}=t,y=Math.floor((e.x-n)/r),S=Math.floor((e.y-c)/r);if(y<0||S<0||y>=s||S>=a)return null;let I=S*s+y,f=h[I+1],x=-1,m=1/0;for(let p=h[I];p<f;p++){let M=u[p],P=d[M];if(o.filter&&!o.filter(P.seat.id,P.seat)||!$(P,e.x,e.y))continue;let w=e.x-P.seat.x,O=e.y-P.seat.y,i=w*w+O*O;(i<m||i===m&&M<x)&&(m=i,x=M)}return x<0?null:d[x].seat.id}function st(t,e,o,s={}){if(!(o>0))return null;let{cols:a,rows:r,cell:n,minX:c,minY:h,cellStart:u,items:d,entries:y}=t,S=Math.max(0,Math.floor((e.x-o-c)/n)),I=Math.min(a-1,Math.floor((e.x+o-c)/n)),f=Math.max(0,Math.floor((e.y-o-h)/n)),x=Math.min(r-1,Math.floor((e.y+o-h)/n));if(S>I||f>x)return null;let m=-1,p=o*o,M=t.stamp,P=++t.epoch;for(let w=f;w<=x;w++){let O=w*a;for(let i=S;i<=I;i++){let l=O+i,D=u[l+1];for(let g=u[l];g<D;g++){let b=d[g];if(M[b]===P)continue;M[b]=P;let F=y[b];if(s.filter&&!s.filter(F.seat.id,F.seat))continue;let A=e.x-F.seat.x,C=e.y-F.seat.y,k=A*A+C*C;(k<p||k===p&&b<m)&&(p=k,m=b)}}}return m<0?null:y[m].seat.id}function at(t,e,o={}){let s=Math.min(e.x,e.x+e.width),a=Math.max(e.x,e.x+e.width),r=Math.min(e.y,e.y+e.height),n=Math.max(e.y,e.y+e.height),c=o.mode??"center",{cols:h,rows:u,cell:d,minX:y,minY:S,cellStart:I,items:f,entries:x}=t,m=Math.max(0,Math.floor((s-y)/d)),p=Math.min(h-1,Math.floor((a-y)/d)),M=Math.max(0,Math.floor((r-S)/d)),P=Math.min(u-1,Math.floor((n-S)/d));if(m>p||M>P)return[];let w=[],O=t.stamp,i=++t.epoch;for(let l=M;l<=P;l++){let D=l*h;for(let g=m;g<=p;g++){let b=D+g,F=I[b+1];for(let A=I[b];A<F;A++){let C=f[A];if(O[C]===i)continue;O[C]=i;let k=x[C];if(o.filter&&!o.filter(k.seat.id,k.seat))continue;(c==="center"?k.seat.x>=s&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=n:N(k,s,r,a,n))&&w.push(C)}}}return w.sort((l,D)=>l-D),w.map(l=>x[l].seat.id)}function ct(t){let e=t.cols*t.rows,o=0,s=0;for(let r=0;r<e;r++){let n=t.cellStart[r+1]-t.cellStart[r];n>0&&o++,n>s&&(s=n)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:o,refs:a,maxPerCell:s,meanPerOccupiedCell:o?a/o:0}}function lt(t,e=0){let o=Math.max(1,t.width,t.height),s={x:t.x+t.width/2,y:t.y+t.height/2},a=o*1.55,r=Math.max(o*.82,Math.max(0,e)+o*.45);return{target:s,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function _(t,e,o=0){let s=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),n=Math.sin(t.yawRad),c=s*r-a*n,u=s*n+a*r-t.distance,d=o-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*d)/y,I=(-t.height*u+t.distance*d)/y,f=Math.max(y*.08,S),x=t.focalLength/f;return{x:t.target.x+c*x,y:t.target.y-I*x,depth:f,scale:x}}function ht(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function ut(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let o=t.d/e,s=-t.b/e,a=-t.c/e,r=t.a/e;return{a:o,b:s,c:a,d:r,e:-(o*t.e+a*t.f),f:-(s*t.e+r*t.f)}}function xt(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function dt(t,e,o=()=>0){let s=_(t,e,o(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},n=_(t,a,o(a)),c=_(t,r,o(r)),h=n.x-s.x,u=n.y-s.y,d=c.x-s.x,y=c.y-s.y;return{a:h,b:u,c:d,d:y,e:s.x-h*e.x-d*e.y,f:s.y-u*e.x-y*e.y}}function ft(t){let e=Math.hypot(t.a,t.b),o=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:o/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(o,1e-9)}}export{T as a,L as b,Q as c,W as d,H as e,J as f,V as g,tt as h,U as i,ot as j,rt as k,st as l,at as m,ct as n,lt as o,_ as p,ht as q,ut as r,xt as s,dt as t,ft as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as S}from"./chunk-UEDS3HJ3.js";import{N as f,ab as A,ja as w}from"./chunk-3W4ZMU4G.js";var j=36,x=160;function C(e,t=360){let o=f(Math.round(Number.isFinite(e)?e:1),1,40),s=f(Number.isFinite(t)?t:360,120,360);return Math.round(f(o*4*(360/s),j,x))}function l(e){return typeof e=="string"&&S.includes(e)}function b(e,t){return e&&t?"both":e?"start":t?"end":"none"}function g(e){let t=new Map,o=w(e);if(!o.size)return t;let s=new Map;for(let r of e){if(r.type!=="row"||!o.has(r.id))continue;let i=r.segmentedRow.groupId,a=s.get(i)??[];a.push(r),s.set(i,a)}for(let r of s.values())r.sort((i,a)=>i.segmentedRow.componentIndex-a.segmentedRow.componentIndex),r.forEach((i,a)=>{let c=r[a+1];t.set(i.id,{start:a>0&&i.segmentedRow.boundaryBefore==="continuous",end:!!c&&c.segmentedRow.boundaryBefore==="continuous"})});return t}function h(e,t){let o=Number.isInteger(e.seatCount)&&e.seatCount>0?e.seatCount:0,s=new Set;for(let n of e.overrides??[])n.skip&&s.add(n.index);let r=n=>n>=0&&n<o&&!s.has(n),i=b(!t?.start,!t?.end),a=l(e.aisleSeats)?e.aisleSeats:void 0,c=a??i,d=-1,m=-1;for(let n=0;n<o;n+=1)r(n)&&(d<0&&(d=n),m=n);let u=new Set;if(d>=0){(c==="start"||c==="both")&&u.add(d),(c==="end"||c==="both")&&u.add(m);for(let n of s)r(n-1)&&u.add(n-1),r(n+1)&&u.add(n+1)}return{...a?{override:a}:{},automatic:i,slots:[...u].sort((n,O)=>n-O)}}function D(e,t=[e]){return h(e,e.segmentedRow?g(t).get(e.id):void 0)}function I(e){let t=new Set;for(let o of A(e)){let s=g(o.objects);for(let r of o.objects)if(r.type==="row")for(let i of h(r,s.get(r.id)).slots)t.add(`${r.id}:${i}`)}return t}function E(e,t,o){return I(e).has(`${t}:${o}`)}function R(e){let t=l(e.aisleSeats)?e.aisleSeats:"both";return{start:t==="start"||t==="both",end:t==="end"||t==="both"}}function p(e,t){t==="both"?delete e.aisleSeats:e.aisleSeats=t}function N(e,t,o){if(!l(e.aisleSeats)){delete t.aisleSeats,delete o.aisleSeats;return}let s=R(e);p(t,b(s.start,!0)),p(o,b(!0,s.end))}function U(e,t){let o=e[0],s=e[e.length-1];if(!o||!s||!l(o.aisleSeats)&&!l(s.aisleSeats)){delete t.aisleSeats;return}p(t,b(R(o).start,R(s).end))}export{j as a,x as b,C as c,l as d,D as e,I as f,E as g,N as h,U as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as g,h as l,i as b,m as y,o as p}from"./chunk-KTMZ3QAO.js";var k=["skip","dx","dy","glyph","accessible","accessibility","wheelchairSpaceType","commercial","viewFromSeatUrl","viewFromSeatMeta","confidenceEvidence"];function v(e,t){return!e||!t?!e&&!t:e.size===t.size&&e.color===t.color}function u(e){let t=new Map;for(let n of e.overrides??[])t.set(n.index,n);return t}function m(e){let t=u(e),n=[];for(let r=0;r<e.seatCount;r+=1){let a=t.get(r),o={};for(let i of k){let s=a?.[i];s!==void 0&&(o[i]=s)}n.push([l(e,r,a),b(e,r,void 0,a),a?.categoryKey??e.categoryKey,a?.labelStyle??e.seatLabelStyle??null,o])}return JSON.stringify(n)}function j(e){return JSON.parse(JSON.stringify(e))}function d(e,t){let n=j(e);return t(n)&&m(n)===m(e)?n:e}function D(e){if(e.seatLabelStyle||e.seatCount<1)return!1;let t=u(e);if(t.size<e.seatCount)return!1;let n;for(let r=0;r<e.seatCount;r+=1){let a=t.get(r)?.labelStyle;if(!a)return!1;if(!n)n=a;else if(!v(n,a))return!1}if(!n)return!1;e.seatLabelStyle={...n};for(let r of e.overrides??[])delete r.labelStyle;return!0}function T(e){if(!/^-?\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)&&String(t)===e?t:void 0}function B(e){if(!e.length)return;let t=e[0].lastIndexOf("-");if(t<=0)return;let n=e[0].slice(0,t),r=[];for(let o of e){if(!o.startsWith(`${n}-`))return;let i=T(o.slice(n.length+1));if(i===void 0)return;r.push(i)}if(r.length===1)return{base:n,start:r[0],direction:"ltr"};let a=r[1]-r[0];if(!(a!==1&&a!==-1)){for(let o=1;o<r.length;o+=1)if(r[o]-r[o-1]!==a)return;return a===1?{base:n,start:r[0],direction:"ltr"}:{base:n,start:r[r.length-1],direction:"rtl"}}}function w(e){if(e.seatCount<1)return!1;let t=u(e);if(!(e.overrides??[]).some(a=>a.label!==void 0))return!1;let n=[];for(let a=0;a<e.seatCount;a+=1)n.push(l(e,a,t.get(a)));let r=B(n);if(!r)return!1;r.base===e.label?delete e.seatLabelBase:e.seatLabelBase=r.base,r.start===1?delete e.seatLabelStart:e.seatLabelStart=r.start,r.direction==="ltr"?delete e.seatNumbering:e.seatNumbering={direction:"rtl"};for(let a of e.overrides??[])delete a.label;return!0}function P(e){if(e.seatDisplayLabelMode||e.seatCount<1)return!1;let t=u(e);for(let n=0;n<e.seatCount;n+=1){let r=t.get(n)?.displayLabel;if(r===void 0||r!==g(e,n))return!1}e.seatDisplayLabelMode="number";for(let n of e.overrides??[])delete n.displayLabel;return!0}function A(e,t){t.categoryKey===e.categoryKey&&delete t.categoryKey,t.labelStyle&&v(t.labelStyle,e.seatLabelStyle)&&delete t.labelStyle,t.label!==void 0&&t.label===l(e,t.index)&&delete t.label,(!e.segmentedRow||e.seatDisplayLabelMode==="number")&&t.displayLabel!==void 0&&t.displayLabel===b(e,t.index)&&delete t.displayLabel}function I(e){return Object.keys(e).every(t=>t==="index")}function E(e){if(!e.overrides?.length)return!1;for(let n of e.overrides)A(e,n);let t=e.overrides.filter(n=>!I(n));return t.length?e.overrides=t:delete e.overrides,!0}function N(e,t){if(!t.segmentedRow||JSON.stringify([e.seatNumbering,e.seatLabelStart])===JSON.stringify([t.seatNumbering,t.seatLabelStart])||t.seatDisplayLabelMode==="number")return!0;let r=u(t);for(let a=0;a<t.seatCount;a+=1)if(r.get(a)?.displayLabel===void 0)return!1;return!0}function M(e){if(e.type!=="row")return e;let t=d(e,D);return t=d(t,w),t=d(t,P),t=d(t,E),N(e,t)?t:e}function F(e){if(!e.overrides?.length)return e;let t=[];for(let r of e.overrides){let a={...r};a.label===y(e,a.index)&&delete a.label,a.displayLabel===p(e,a.index)&&delete a.displayLabel,a.categoryKey===e.categoryKey&&delete a.categoryKey,a.dx===0&&delete a.dx,a.dy===0&&delete a.dy,I(a)||t.push(a)}let n={...e};return t.length?n.overrides=t:delete n.overrides,n}function O(e){return e.type==="row"?M(e):e.type==="table"?F(e):e}function V(e){let t=e.objects.map(O),n=e.floors?.map(r=>({...r,objects:r.objects.map(O)}));return{...e,objects:t,...n?{floors:n}:{}}}var S=2,K=3,h=6;function c(e,t){if(!Number.isFinite(e))return e;let n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function f(e){return{...e,x:c(e.x,S),y:c(e.y,S)}}function C(e){let t={...e};t.origin&&typeof t.origin=="object"&&(t.origin=f(t.origin)),Array.isArray(t.outline)&&(t.outline=t.outline.map(f)),Array.isArray(t.points)&&(t.points=t.points.map(f)),typeof t.rotation=="number"&&(t.rotation=c(t.rotation,h)),typeof t.seatSpacing=="number"&&(t.seatSpacing=c(t.seatSpacing,h));let n=t.labelPresentation;return n?.position&&(t.labelPresentation={...n,position:f(n.position)}),Array.isArray(t.overrides)&&(t.overrides=t.overrides.map(r=>{let a={...r};for(let o of["dx","dy"]){let i=a[o];if(typeof i!="number")continue;let s=c(i,K);s===0?delete a[o]:a[o]=s}return a})),t}function x(e){let t=e;return delete t.referenceScan,delete t.referenceInventorySource,delete t.referenceInventoryExclusion,delete t.referenceSource,delete t.referenceAnnotationSource,e}function q(e){return(e.type==="shape"||e.type==="text")&&(e.referenceAnnotationSource?.kind==="direct-landmark-v1"||e.referenceAnnotationSource?.kind==="direct-stage-v1")&&(e.referenceAnnotationSource.ownership="organizer"),e}function W(e){return e.type==="shape"&&_(e)}function _(e){return e.type!=="shape"&&e.type!=="text"||e.labelImportance==="detail"?!1:e.labelImportance==="orientation"||e.referenceAnnotationSource?.kind==="direct-landmark-v1"}function X(e){return e.referenceImage??(e.backgroundImage?.assetId?e.backgroundImage:void 0)}function J(e){let t=e.backgroundImage;return t?.url&&!t.assetId?t:void 0}function L(e){let t=J(e);if(!t?.url)return;let{calibration:n,derivedScale:r,assetId:a,...o}=t;return o}function Z(e){let t=n=>{let r=n.backgroundImage;r?.assetId&&(n.referenceImage||(n.referenceImage=r,n.backgroundImage=void 0))};t(e);for(let n of e.floors??[])t(n);return e}function R(e){let t=C(e);return x(t),delete t.editor,delete t.arcFanGeneration,delete t.rowBlockGeneration,t}function U(e){let t={...e};return delete t.referenceCategorySource,delete t.referenceDirectSeatImport,t}function ee(e){let t=L(e),n=e.floors?.map(r=>({...r,objects:r.objects.map(R),referenceImage:void 0,backgroundImage:L(r)}));return{...e,categories:e.categories.map(U),objects:e.objects.map(R),referenceImage:void 0,venueSurveyRegistrations:void 0,designerSettings:void 0,backgroundImage:t,...n?{floors:n}:{}}}function te(e){return!!e.referenceImage?.assetId&&!!e.backgroundImage?.assetId&&e.referenceImage.assetId!==e.backgroundImage.assetId}export{q as a,W as b,_ as c,m as d,B as e,A as f,M as g,F as h,V as i,C as j,X as k,J as l,Z as m,ee as n,te as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(t){if(!Number.isFinite(t))return 0;let n=(t%360+360)%360;return Object.is(n,-0)||Math.abs(n)<1e-9?0:n}function r(t){let n=(t%360+360)%360,e=n>=180?n-360:n;return Object.is(e,-0)||Math.abs(e)<1e-9?0:e}function i(t){return t==="row"?"signed180":"unsigned360"}function a(t,n){return i(t)==="signed180"?r(n):o(n)}export{r as a,a as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var d=["horizontal","vertical","auto"],n=72;function u(e,t){return e==="vertical"?!0:e==="auto"?!!t&&t.height>t.width:!1}var g="seatmap.chart";var r=[{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"}],i=new Map(r.map(e=>[e.key,e]));function p(e){return i.get(e)}var o={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 S(e){let t=e?.[0];return t&&o[t]||"#3b82f6"}var a=[{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"}],s=new Map(a.map(e=>[e.key,e]));function y(e){return s.get(e)}var v=8,f=24,h=["start","end","both","none"],x=["inline","corner","peninsula","island"],c=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],l=new Set(c);function w(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&l.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}export{d as a,n as b,u as c,g as d,r as e,p as f,o as g,S as h,a as i,y as j,v as k,f as l,h as m,x as n,c as o,w as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as D}from"./chunk-76AUT55N.js";import{g as A,i as P}from"./chunk-WH2EVBIG.js";import{C as M,N as v,Na as w,Pa as C,Qa as S,Sa as O,Ta as j}from"./chunk-3W4ZMU4G.js";function x(r){return r.floors?.length?r.floors.flatMap(o=>o.objects):r.objects}function B(r){return x(r).reduce((o,n)=>n.type==="row"?o+w(n):n.type==="table"?o+O(n):n.type==="gaArea"?o+Math.max(0,Math.floor(n.capacity)):n.type==="booth"?o+1:o,0)}function G(r){let o={};for(let a of r.categories??[])o[a.key]=0;let n=(a,s)=>{s>0&&(o[a]=(o[a]??0)+s)};for(let a of x(r))if(a.type==="row")for(let s of C(a))n(s.categoryKey,1);else if(a.type==="table")if(a.bookAsWhole||a.variableOccupancy)n(a.categoryKey,Math.max(0,Math.round(a.seatCount)));else for(let s of j(a))n(s.categoryKey,1);else a.type==="gaArea"?n(a.categoryKey,Math.max(0,Math.floor(a.capacity))):a.type==="booth"&&n(a.categoryKey,1);return o}function _(r){if(!r.template)return null;let o=x(r),n=o.filter(c=>c.type==="row"||c.type==="table"||c.type==="gaArea");if(!n.length)return null;let s=o.filter(c=>c.type==="booth").length+n.reduce((c,l)=>c+(l.type==="table"?2:1),0),y=B(r),h=Math.max(s+1,Math.min(5e4,y*4)),d=[.5,1,1.5,2].map(c=>v(Math.round(y*c),s,h));return{family:r.template.family,display:r.template.family.replace(/-/g," ").replace(/\b\w/g,c=>c.toUpperCase()),min:s,max:h,presets:["S","M","L","XL"].map((c,l)=>({size:c,seats:d[l]}))}}function R(r){let o=C(r);return o.length?M(o):{...r.origin}}function N(r,o){let n=_(r);if(!n)return structuredClone(r);let a=structuredClone(r),s=x(a),y=s.filter(t=>t.type==="row"||t.type==="table"||t.type==="gaArea"),h=s.filter(t=>t.type==="booth").length,d=Math.max(n.min,Math.min(n.max,Math.round(o))),c=d-h,l=y.map((t,e)=>{let u=t.type==="gaArea"?Math.max(0,Math.floor(t.capacity)):t.seatCount,p=t.type==="table"?2:1;return{object:t,index:e,current:u,minimum:p,value:p,fraction:0}}),K=l.reduce((t,e)=>t+e.minimum,0),g=Math.max(0,c-K),T=l.reduce((t,e)=>t+Math.max(1,e.current-e.minimum),0);for(let t of l){let e=g*Math.max(1,t.current-t.minimum)/T,u=Math.floor(e);t.value+=u,t.fraction=e-u}g=c-l.reduce((t,e)=>t+e.value,0),l.sort((t,e)=>e.fraction-t.fraction||t.index-e.index);for(let t=0;t<g;t++)l[t%l.length].value++;l.sort((t,e)=>t.index-e.index);for(let t of l)if(t.object.type==="row"){let e=R(t.object);t.object.seatCount=t.value;let u=R(t.object);t.object.origin.x+=e.x-u.x,t.object.origin.y+=e.y-u.y}else if(t.object.type==="table"){let e=t.object;if(e.seatCountsBySide){let u=["top","bottom","left","right"],p=S(e),z=u.reduce((i,f)=>i+p[f],0)||1,m=u.map((i,f)=>{let b=t.value*p[i]/z;return{side:i,index:f,value:Math.floor(b),fraction:b-Math.floor(b)}}),L=t.value-m.reduce((i,f)=>i+f.value,0);m.sort((i,f)=>f.fraction-i.fraction||i.index-f.index);for(let i=0;i<L;i++)m[i%m.length].value+=1;m.sort((i,f)=>i.index-f.index),e.seatCountsBySide={top:m[0].value,bottom:m[1].value,left:m[2].value,right:m[3].value},e.sides=u.filter(i=>e.seatCountsBySide[i]>0)}e.seatCount=t.value,e.overrides&&(e.overrides=e.overrides.filter(u=>u.index<t.value),e.overrides.length||delete e.overrides)}else{let e=t.object;e.capacity=P(e)?Math.min(t.value,A):t.value,e.variableOccupancy&&(e.maxOccupancy=Math.min(e.maxOccupancy??e.capacity,e.capacity),e.minOccupancy=Math.min(e.minOccupancy??1,e.maxOccupancy)),e.wheelchairPlaces&&(e.wheelchairPlaces=Math.min(e.wheelchairPlaces,e.capacity))}return a.floors?.length&&(a.objects=a.floors[0].objects),a.template={family:a.template.family,targetSeats:d},a=D(a).doc,a.template={family:r.template.family,targetSeats:B(a)},a}export{B as a,G as b,_ as c,N as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$a as d,Pa as I,Ta as A,Ua as y,ab as S,cb as f}from"./chunk-3W4ZMU4G.js";var p="__sl_ga__";function w(t){return t.startsWith(p)}var E=p,g=1e5;function L(t,e){return`${E}${encodeURIComponent(t)}__${e+1}`}function C(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let n=0,r=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>g||(n+=o.count,n>g))return!1;let c=r.get(o.sourceAreaId)??[],s=o.startIndex+o.count;if(c.some(i=>o.startIndex<i.end&&s>i.start))return!1;c.push({start:o.startIndex,end:s}),r.set(o.sourceAreaId,c)}return n===t.capacity}function x(t){let e=Math.min(g,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:C(t)?t.inventorySegments.map(n=>({...n})):[]}var v=100,k=`An area sold to one party holds at most ${v} guests.`;function h(t){return t.variableOccupancy?"variable":t.bookAsWhole?"whole":null}function $(t){return h(t)==="variable"?{min:t.minOccupancy??1,max:t.maxOccupancy??t.capacity}:{min:t.capacity,max:t.capacity}}function j(t){return O(t,2)}function O(t,e){return e===2&&h(t)&&t.inventorySegments===void 0?t.label.trim()?[t.label]:[]:x(t).flatMap(n=>Array.from({length:n.count},(r,o)=>L(n.sourceAreaId,n.startIndex+o)))}function N(t){let e=t.wheelchairPlaces;return!Number.isInteger(e)||e<=0?0:Math.min(e,Math.max(0,Math.floor(t.capacity)))}function J(t,e=2){let n=N(t);if(!n)return new Set;let r=O(t,e);return r.length===1&&h(t)&&e===2?new Set(r):new Set(r.slice(Math.max(0,r.length-n)))}function q(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let n=x(t);if(!n.length)return;let r=e-t.capacity;if(!r)return n;let c=n.filter(i=>i.sourceAreaId===t.id).reduce((i,a)=>Math.max(i,a.startIndex+a.count),0),s=n[n.length-1];if(s?.sourceAreaId===t.id&&s.startIndex+s.count===c)s.count+=r;else{if(n.length>=256)return;n.push({sourceAreaId:t.id,startIndex:c,count:r})}return n}function K(t){return f(t).filter(e=>e.type==="gaArea")}var m="__ungrouped__";function R(t){return t.type==="row"?I(t).map(e=>e.label):t.type==="table"?A(t).map(e=>e.label):t.type==="booth"?y(t).map(e=>e.label):t.type==="gaArea"?j(t):[]}function M(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function T(t){return t.displayLabel||t.label||"Section"}function _(t){let e=new Map;for(let n of f(t)){if(n.type!=="section")continue;let r=n.logicalSectionId??n.id;e.has(r)||e.set(r,{id:r,label:T(n),zone:n.zone})}return e}function rt(t){let e=new Map;for(let n of f(t)){if(n.type!=="section")continue;let r=n.logicalSectionId??n.id,o=n.entrance?.trim();o&&!e.has(r)&&e.set(r,o)}return e}function it(t){let e=new Map;for(let[n,r]of _(t))e.set(n,r.label);return e}function D(t){let e=new Map;for(let n of S(t)){let r=n.objects.filter(o=>o.type==="section");if(r.length)for(let o of n.objects){if(!M(o))continue;let c=d(n.objects,o,r);c&&e.set(o.id,c.logicalSectionId??c.id)}}return e}function G(t,e){let n=f(t),r=n.filter(i=>i.type==="section"),o=new Map;for(let[i,a]of _(t))o.set(i,{id:i,label:a.label,zone:a.zone,seatCount:0,objectIds:[],seatLabels:[]});let c={id:m,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},s=new Map;for(let i of n){if(!M(i))continue;let a=R(i);if(a.length===0)continue;let u;if(e)u=e.get(i.id);else{let b=d(n,i,r);u=b?b.logicalSectionId??b.id:void 0}let l=u?o.get(u):c;l.seatCount+=a.length,l.objectIds.push(i.id),l.seatLabels.push(...a),s.set(i.id,l.id)}return{sections:[...o.values()],ungrouped:c.objectIds.length?c:null,objectToSection:s}}function st(t){return G(t,null)}function U(t){return G(t,D(t))}function z(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function B(t,e){let n=new Set;if(!e.size)return n;let{sections:r,ungrouped:o,objectToSection:c}=U(t),s=new Set,i=new Map(r.map(u=>[u.id,u.zone]));for(let u of r){let l=i.get(u.id);(e.has(u.id)||l&&e.has(l))&&s.add(u.id)}let a=!!o&&e.has(m);for(let[u,l]of c)(s.has(l)||a&&l===m)&&n.add(u);return n}function ct(t,e){if(!e.size)return t;let n=B(t,e),r=e instanceof Set?e:new Set(e),o=s=>!(n.has(s.id)||s.type==="section"&&z(s,r));if(t.floors&&t.floors.length){let s=!1,i=t.floors.map(a=>{let u=a.objects.filter(o);return u.length!==a.objects.length&&(s=!0),u.length===a.objects.length?a:{...a,objects:u}});return s?{...t,floors:i,objects:i[0].objects}:t}let c=t.objects.filter(o);return c.length===t.objects.length?t:{...t,objects:c}}export{p as a,w as b,g as c,L as d,C as e,x as f,v as g,k as h,h as i,$ as j,j as k,O as l,N as m,J as n,q as o,K as p,m as q,_ as r,rt as s,it as t,D as u,st as v,U as w,z as x,B as y,ct as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as m}from"./chunk-UEDS3HJ3.js";var b={inline:"Inline booth \xB7 1 open side",corner:"Corner booth \xB7 2 open sides",peninsula:"Peninsula booth \xB7 3 open sides",island:"Island booth \xB7 4 open sides"},w=new Map(m.map(e=>[e.key,e.label]));function k(e){return`picker.access.${e}`}function x(e){let t=[],r=e.boothType;r&&Object.prototype.hasOwnProperty.call(b,r)&&t.push({key:`booth:${r}`,icon:"booth",titleKey:`picker.boothType.${r}`,titleFallback:b[r],tone:"place"});let a=e.wheelchairSpaceType;for(let n of e.accessibility??[]){if(n==="wheelchair"&&a)continue;let s=w.get(n);s&&t.push({key:`access:${n}`,icon:n,titleKey:k(n),titleFallback:s,tone:"access"})}a==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):a==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"}),e.aisle===!0&&t.push({key:"place:aisle",icon:"aisle",titleKey:"picker.aisleSeat",titleFallback:"Aisle seat",tone:"place"});let o=e.commercial;o?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),o?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),o?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let c=o?.note?.trim();if(c){let n=t.find(s=>s.tone==="warn"||s.tone==="premium");n?n.note=c:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:c})}let i=typeof e.entrance=="string"?e.entrance.trim():"";return i&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:i}),t}var f=/^[\p{L}\p{N}]{1,4}$/u,d=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function F(e,t){let r=t?.trim();if(!r)return e;let a=e.toLocaleLowerCase("en-US"),o=r.toLocaleLowerCase("en-US");if(a.startsWith(`${o} `)){let i=e.slice(r.length).trim();if(f.test(i))return i}let c=d.exec(e);if(c){let i=c[1].toLocaleLowerCase("en-US"),n=c[2].trim();if((o.startsWith(i)||i.startsWith(o))&&f.test(n))return n}return e}function A(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function R(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function M(e){let t=Number.isFinite(e)&&e>0?e:4;return Math.min(64,Math.max(18,t*5))}function N(e){let t=e.points;if(!t||t.length<2)return null;let r=t.reduce((n,s)=>n+s.x,0)/t.length,a=t.reduce((n,s)=>n+s.y,0)/t.length,o=(e.rotation??0)*Math.PI/180,c=t[0].x-r,i=t[0].y-a;return{x:r+c*Math.cos(o)-i*Math.sin(o),y:a+c*Math.sin(o)+i*Math.cos(o)}}function P(e,t,r){let a=[];if(e.length<2||!(t>0)||!(r>=0))return a;let o=!0,c=t;for(let i=0;i<e.length-1;i+=1){let n=e[i],s=e[i+1],p=Math.hypot(s.x-n.x,s.y-n.y);if(p<1e-9)continue;let y=(s.x-n.x)/p,h=(s.y-n.y)/p,l=0;for(;l<p-1e-9;){let u=Math.min(c,p-l);o&&a.push([{x:n.x+y*l,y:n.y+h*l},{x:n.x+y*(l+u),y:n.y+h*(l+u)}]),l+=u,c-=u,c<=1e-9&&(o=!o,c=o?t:r)}}return a}export{k as a,x as b,F as c,A as d,R as e,M as f,N as g,P as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M=20,i={wheelchair:'<circle cx="10.6" cy="3.7" r="1.7" /><path d="M8.9 6.3v4.3a1.3 1.3 0 0 0 1.3 1.3h3.4l1.9 4.5h1.9" /><circle cx="9.7" cy="13.3" r="4.7" />',companion:'<circle cx="6" cy="6" r="2" /><circle cx="14" cy="6" r="2" /><path d="M2.5 16v-3.5A3.5 3.5 0 0 1 6 9a3.5 3.5 0 0 1 3.5 3.5V16M10.5 16v-3.5A3.5 3.5 0 0 1 14 9a3.5 3.5 0 0 1 3.5 3.5V16" />',"semi-ambulatory":'<circle cx="8" cy="4" r="1.7" /><path d="m8 6 2 4 3 2M10 10l-2 3-1 4M10 10l2 7M14 7l2 10" />',"designated-aisle":'<path d="M3.5 5.5v7h8.5V10H6.5M5 12.5V17M11 12.5V17" /><path d="M13.5 6.5H19M16.5 4l2.5 2.5L16.5 9" />',"step-free":'<circle cx="5.5" cy="5" r="1.7" /><path d="M5.5 7v4l3 2M2.5 16.5H8l7-7h3M8 16.5h10" />',hearing:'<path d="M7 16c-1-1.2-1.5-2.4-1.5-3.8V9a5 5 0 1 1 10 0c0 2.2-1.2 3.2-2.6 4-1.2.7-1.7 1.4-1.7 2.4A2.6 2.6 0 0 1 8.6 18" />',cart:'<path d="M8 6.5A4 4 0 1 0 8 13M17 6.5a4 4 0 1 0 0 6.5" />',"sign-language":'<path d="M6 16V8.5a1 1 0 0 1 2 0v3M8 11V5.5a1 1 0 0 1 2 0V11M10 11V4.5a1 1 0 0 1 2 0V11M12 11V6a1 1 0 0 1 2 0v6l1-1.5a1.2 1.2 0 0 1 2 1.3L14 17H9.5A3.5 3.5 0 0 1 6 13.5" />',"low-vision":'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><circle cx="10" cy="10" r="2.5" /><path d="m15 4 .5-1.5M17 5l1.5-.8" />',"sensory-friendly":'<path d="M4 11v-1a6 6 0 0 1 12 0v1M4 11h2.5v5H5a1 1 0 0 1-1-1v-4ZM16 11h-2.5v5H15a1 1 0 0 0 1-1v-4Z" /><path d="M8.5 11.5c.8.7 2.2.7 3 0M9 14c.6.4 1.4.4 2 0" />',"plus-size":'<path d="M5 9V6.5A2.5 2.5 0 0 1 7.5 4h5A2.5 2.5 0 0 1 15 6.5V9M3.5 8.5v5h13v-5M6 13.5V17M14 13.5V17" />',"lift-armrest":'<path d="M5 10V6.5A2.5 2.5 0 0 1 7.5 4h4A2.5 2.5 0 0 1 14 6.5V10M4 9v4h11V9M6 13v4M13 13v4" /><path d="M17 11V4M15 6l2-2 2 2" />',obstructedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="m4 17 12-14" />',restrictedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="M10 7.5v3.5M10 13.5h.01" />',premium:'<path d="m10 2.5 2.2 4.6 5 .7-3.6 3.5.9 5-4.5-2.4-4.5 2.4.9-5-3.6-3.5 5-.7Z" />',note:'<circle cx="10" cy="10" r="7.5" /><path d="M10 9.2v4.6M10 6.3h.01" />',aisle:'<path d="M2.5 6v7h6.5v-2.5H4.5M3.5 13v3.5M8 13v3.5" /><path d="M12.5 3v14M17 3v14" />',entrance:'<path d="M10 3.5h6.5v13H10" /><path d="M3 10h8.5M8.5 7l3 3-3 3" />',booth:'<path d="M3.5 8.5h13v8h-13ZM2.5 8.5 4 4h12l1.5 4.5M8 16.5v-4h4v4" />'};function h(e){return i[e]??""}function s(e,t={}){let a=h(e);if(!a)return"";let c=t.size??18,r=20;return`<svg viewBox="0 0 ${r} ${r}" width="${c}" height="${c}" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"`+(t.className?` class="${t.className}"`:"")+` aria-hidden="true" focusable="false">${a}</svg>`}export{M as a,i as b,h as c,s as d};
|