@seatlayer/core 0.106.1 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/ca-HSW3LSXH.js +1 -0
  2. package/dist/{categoryInventory-QTVDRqNG.d.ts → categoryInventory-BfYSZRQ-.d.ts} +1 -1
  3. package/dist/{categoryInventory-DYcNVyxN.d.cts → categoryInventory-D8g-kaQ4.d.cts} +1 -1
  4. package/dist/{chunk-3YNO3XCY.js → chunk-227OYVC4.js} +1 -1
  5. package/dist/{chunk-C5GKFG36.js → chunk-45W3GKPP.js} +1 -1
  6. package/dist/chunk-74TZDIMP.js +1 -0
  7. package/dist/{chunk-UGMXII72.js → chunk-BBPJXOTD.js} +1 -1
  8. package/dist/chunk-J33DNOMI.js +1 -0
  9. package/dist/{chunk-MLPJTJFE.js → chunk-N562FZPD.js} +1 -1
  10. package/dist/{chunk-M4J7U2E2.js → chunk-QXJEN5LV.js} +1 -1
  11. package/dist/{chunk-V65VJE6F.js → chunk-RI4LNRP4.js} +1 -1
  12. package/dist/{chunk-FQTSVDD4.js → chunk-T7DQX3MB.js} +1 -1
  13. package/dist/chunk-VBNOTYBG.js +1 -0
  14. package/dist/chunk-YPGONGDK.js +1 -0
  15. package/dist/core/chart-ops/index.cjs +1 -1
  16. package/dist/core/chart-ops/index.d.cts +6 -6
  17. package/dist/core/chart-ops/index.d.ts +6 -6
  18. package/dist/core/chart-ops/index.js +1 -1
  19. package/dist/core/inventory/index.cjs +1 -1
  20. package/dist/core/inventory/index.d.cts +4 -4
  21. package/dist/core/inventory/index.d.ts +4 -4
  22. package/dist/core/inventory/index.js +1 -1
  23. package/dist/core/layout/index.cjs +1 -1
  24. package/dist/core/layout/index.d.cts +9 -10
  25. package/dist/core/layout/index.d.ts +9 -10
  26. package/dist/core/layout/index.js +1 -1
  27. package/dist/core/quality/index.d.cts +3 -3
  28. package/dist/core/quality/index.d.ts +3 -3
  29. package/dist/core/render-assets/index.d.cts +2 -2
  30. package/dist/core/render-assets/index.d.ts +2 -2
  31. package/dist/core/seatConfidence.d.cts +1 -1
  32. package/dist/core/seatConfidence.d.ts +1 -1
  33. package/dist/core/sections/index.cjs +1 -1
  34. package/dist/core/sections/index.d.cts +5 -5
  35. package/dist/core/sections/index.d.ts +5 -5
  36. package/dist/core/sections/index.js +1 -1
  37. package/dist/{cs-L5EG7LLR.js → cs-W36YX555.js} +1 -1
  38. package/dist/cy-6264NCZV.js +1 -0
  39. package/dist/da-QPYLJUH7.js +1 -0
  40. package/dist/de-Q5VU4NBN.js +1 -0
  41. package/dist/el-HYLFHJC3.js +1 -0
  42. package/dist/et-HQUPUM5Y.js +1 -0
  43. package/dist/{eventConfigurations-1sMqxBpq.d.cts → eventConfigurations-Bw1zW-6G.d.cts} +1 -1
  44. package/dist/{eventConfigurations-B7vGmmD3.d.ts → eventConfigurations-DD1i6TSa.d.ts} +1 -1
  45. package/dist/hi-72CF2RXB.js +1 -0
  46. package/dist/hr-2CRBTSQT.js +1 -0
  47. package/dist/hu-Y33MEJPT.js +1 -0
  48. package/dist/{id-ECFNLK3G.js → id-UW2QRTC3.js} +1 -1
  49. package/dist/index.cjs +1 -1
  50. package/dist/index.d.cts +25 -14
  51. package/dist/index.d.ts +25 -14
  52. package/dist/index.js +1 -1
  53. package/dist/{it-HT57FDFI.js → it-XFIJHKQA.js} +1 -1
  54. package/dist/ko-MCXETVAQ.js +1 -0
  55. package/dist/{labeling-B-FQz2d2.d.cts → labeling-Bho4KGut.d.cts} +1 -1
  56. package/dist/{labeling-DqyXzIgw.d.ts → labeling-DABtLO2e.d.ts} +1 -1
  57. package/dist/localeLoaders-UTZMQJQF.js +1 -0
  58. package/dist/lt-OVUV42OZ.js +1 -0
  59. package/dist/ms-LF5QQTFJ.js +1 -0
  60. package/dist/no-JLXHCMSU.js +1 -0
  61. package/dist/pl-TR5U2EPQ.js +1 -0
  62. package/dist/pt-HRM4OUMU.js +1 -0
  63. package/dist/{renderedQuality-CAkqqUxs.d.cts → renderedQuality-BHQnbC9M.d.cts} +1 -1
  64. package/dist/{renderedQuality-C3Gz1Yyw.d.ts → renderedQuality-DFbFLsci.d.ts} +1 -1
  65. package/dist/{renderer-D-N5RoL3.d.cts → renderer-BDdsk9AZ.d.cts} +1 -1
  66. package/dist/{renderer-C5tLduz1.d.ts → renderer-DiMguwVt.d.ts} +1 -1
  67. package/dist/{seatTypeIcons-qlLxwByo.d.ts → seatTypeIcons-C_4CKG9D.d.ts} +1 -1
  68. package/dist/{seatTypeIcons-BTw3K-yP.d.cts → seatTypeIcons-DyJDDsaT.d.cts} +1 -1
  69. package/dist/{sections-dqlb491l.d.ts → sections-BHPs1PT8.d.ts} +1 -1
  70. package/dist/{sections-Cr6f5csG.d.cts → sections-BVrNW7Ne.d.cts} +1 -1
  71. package/dist/{segmentedRowModel-BSXPftwU.d.ts → segmentedRowModel-2c46otTs.d.ts} +1 -1
  72. package/dist/{segmentedRowModel-Dy_zNI1E.d.cts → segmentedRowModel-DPZ8VAbP.d.cts} +1 -1
  73. package/dist/{sk-XIK2KO3F.js → sk-4DALII6N.js} +1 -1
  74. package/dist/sr-KMFWIJPY.js +1 -0
  75. package/dist/sv-2JROBNJB.js +1 -0
  76. package/dist/{tableSizing-DzaJ08RF.d.ts → tableSizing-C8A2XC6C.d.ts} +3 -3
  77. package/dist/{tableSizing-CV8W2tXI.d.cts → tableSizing-Dj5yxEn5.d.cts} +3 -3
  78. package/dist/th-MF3TSZDL.js +1 -0
  79. package/dist/{ticketRestrictions-CJkUTyPM.d.ts → ticketRestrictions-DE79a54T.d.ts} +2 -2
  80. package/dist/{ticketRestrictions-Be7bbWPi.d.cts → ticketRestrictions-DsAql5wr.d.cts} +2 -2
  81. package/dist/tr-76YSRBN3.js +1 -0
  82. package/dist/{types-CB1llwVg.d.cts → types-BZQ35nwD.d.cts} +3 -3
  83. package/dist/{types-CB1llwVg.d.ts → types-BZQ35nwD.d.ts} +3 -3
  84. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  85. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  86. package/dist/view3d/index.cjs +65 -79
  87. package/dist/view3d/index.d.cts +6 -4
  88. package/dist/view3d/index.d.ts +6 -4
  89. package/dist/view3d/index.js +57 -71
  90. package/dist/view3d/scene/scene.worker.cjs +1 -1
  91. package/dist/view3d/scene/scene.worker.js +1 -1
  92. package/package.json +1 -1
  93. package/dist/ca-EXRTYE33.js +0 -1
  94. package/dist/chunk-3DHQYZ47.js +0 -1
  95. package/dist/chunk-5R6I2XL7.js +0 -1
  96. package/dist/chunk-INCPWAWP.js +0 -1
  97. package/dist/chunk-TAKLS47V.js +0 -1
  98. package/dist/cy-AB2Q6XHI.js +0 -1
  99. package/dist/da-EGJO7W4Q.js +0 -1
  100. package/dist/de-VXWKGCBD.js +0 -1
  101. package/dist/el-JW2YADAL.js +0 -1
  102. package/dist/et-53UYPQR7.js +0 -1
  103. package/dist/hi-RWHSYCVV.js +0 -1
  104. package/dist/hr-ECH5LYKR.js +0 -1
  105. package/dist/hu-BAXHRRWC.js +0 -1
  106. package/dist/ko-G2HVHBKT.js +0 -1
  107. package/dist/localeLoaders-STMEO2AW.js +0 -1
  108. package/dist/lt-GB2GJDNS.js +0 -1
  109. package/dist/ms-YH2PYOHG.js +0 -1
  110. package/dist/no-5YNLYHN4.js +0 -1
  111. package/dist/pl-RUXCR6JV.js +0 -1
  112. package/dist/pt-TKFGIUL6.js +0 -1
  113. package/dist/sr-A3TESNV3.js +0 -1
  114. package/dist/sv-HKGKDGSG.js +0 -1
  115. package/dist/th-ZPGRIY7D.js +0 -1
  116. package/dist/tr-IUB54G3R.js +0 -1
@@ -1 +1 @@
1
- import{xa as Y}from"./chunk-5R6I2XL7.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
1
+ import{xa as Y}from"./chunk-J33DNOMI.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
@@ -0,0 +1 @@
1
+ import{Sa as re,bb as le,eb as se}from"./chunk-J33DNOMI.js";function P(e){let i=Number(e.slice(e.lastIndexOf(":")+1));return Number.isFinite(i)?i:-1}function ve(e,i,n){let t=new Map;for(let a of e){if(a.kind==="booth")continue;let o=t.get(a.rowId);o?o.push(a):t.set(a.rowId,[a])}let c=a=>n.has(a.id)||i(a.id)!=="free",r=[];for(let a of t.values())if(!(a.length<3)){a.sort((o,s)=>P(o.id)-P(s.id));for(let o=1;o<a.length-1;o++){let s=a[o];if(c(s))continue;let p=a[o-1],f=a[o+1];P(s.id)-P(p.id)!==1||P(f.id)-P(s.id)!==1||!c(p)||!c(f)||!n.has(p.id)&&!n.has(f.id)||r.push(s)}}return r}function ye(e){return Array.isArray(e.objects)}function de(e,i){if(i.seatsByLabel)return i.seatsByLabel;if(!ye(e))throw new Error("ticketRestrictions: a categories-only chart document requires options.seatsByLabel");return new Map(se(e,{resolveEyeHeights:!1}).map(n=>[n.label,n]))}function he(e){return{code:"ticket_option_not_applicable",labels:e,message:"That ticket choice is not available for the selected seat."}}function U(e,i){let n=e.applicability;return n?!(n.seatLabels?.length&&!n.seatLabels.includes(i.label)||n.accessibility?.length&&!n.accessibility.some(t=>i.accessibility?.includes(t))):!0}function De(e,i){return(e.categories.find(n=>n.key===i.categoryKey)?.tiers??[]).filter(n=>U(n,i))}function ue(e,i,n){let t=e.categories.find(r=>r.key===i.categoryKey)?.tiers;if(!t?.length)return{kind:"none"};let c=n==null?t.find(r=>U(r,i)):t.find(r=>r.id===n&&U(r,i));return c?{kind:"resolved",tier:c}:{kind:"invalid"}}function me(e,i){return(e.logicalRowId??e.rowId)===(i.logicalRowId??i.rowId)}function ce(e){if(Number.isInteger(e.logicalSeatIndex))return e.logicalSeatIndex;let i=e.id.slice(e.id.lastIndexOf(":")+1),n=Number(i);return Number.isInteger(n)?n:void 0}function xe(e,i){if(!me(e,i))return!1;let n=ce(e),t=ce(i);return n!=null&&t!=null&&Math.abs(n-t)===1}function Se(e,i,n={}){if(!i.length)return null;let t=de(e,n),c=i.flatMap(o=>{let s=t.get(o.label);return s?[{selection:o,seat:s}]:[]}),r=c.map(({seat:o})=>o).filter(o=>o.accessibility?.includes("wheelchair")),a=[];for(let{selection:o,seat:s}of c){let p=ue(e,s,o.tierId),f=p.kind==="resolved"?p.tier:void 0;(s.accessibility?.includes("companion")||f?.restriction==="companion")&&!r.some(b=>b.id!==s.id&&xe(s,b))&&a.push(s.label)}return a.length?{code:"companion_pair_required",labels:a,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function Me(e,i,n={}){if(!i.length)return null;let t=de(e,n),c=new Set(e.categories.filter(o=>o.notForSale).map(o=>o.key)),r=[],a=[];for(let o of i){let s=t.get(o.label);if(!s)continue;if(c.has(s.categoryKey)){r.push(s.label);continue}ue(e,s,o.tierId).kind==="invalid"&&a.push(s.label)}return r.length?{code:"not_for_sale",labels:r,message:"These seats are not for sale."}:a.length?he(a):Se(e,i,{seatsByLabel:t})}function pe(e){return e.sectionId?`s:${e.sectionId}`:`r:${e.logicalRowId??e.rowId}`}function Ie(e,i){let n=new Set,t=new Map;for(let c of e){let r=c.focalPoint??i,a=`${r.x},${r.y}`,o=t.get(a);o||(o={focal:r,seats:[]},t.set(a,o)),o.seats.push(c)}for(let{focal:c,seats:r}of t.values()){let a=Y(r),o=a.x-c.x,s=a.y-c.y,p=Math.hypot(o,s),f=0;for(let g of r)f=Math.max(f,Math.abs(g.x-c.x),Math.abs(g.y-c.y));let u=Math.max(f,1)*1e-6;if(!(p>u))continue;let b=0,w=new Set;for(let g of r)((g.x-c.x)*o+(g.y-c.y)*s)/p<-u&&(b+=1,w.add(pe(g)));if(!w.size||b*10>r.length)continue;let k=r.filter(g=>w.has(pe(g)));if(!(k.length*4>r.length))for(let g of k)n.add(g.label)}return n}function W(e,i){if(Number.isInteger(e.logicalSeatIndex))return e.logicalSeatIndex;let n=e.id.lastIndexOf(":");if(n<0)return i;let t=Number(e.id.slice(n+1));return Number.isFinite(t)?t:i}function A(e,i){let n=e.x-i.x,t=e.y-i.y;return n*n+t*t}function Y(e){let i=0,n=0;for(let t of e)i+=t.x,n+=t.y;return{x:i/e.length,y:n/e.length}}function we(e,i){return e.find(n=>n.focalPoint)?.focalPoint??i}function V(e){return e.commercial?.premium===!0}var be=new WeakMap;function ke(e){let i=be.get(e);if(i&&i.length===e.length&&i.first===e[0]&&i.last===e[e.length-1])return i;let n=new Map;e.forEach((a,o)=>{let s=a.logicalRowId??a.rowId,p=n.get(s);p||(p=[],n.set(s,p)),p.push({seat:a,index:W(a,o),order:o})});let t=new Map([...n].map(([a,o])=>[a,Y(o.map(s=>s.seat))])),c=[...n].map(([a,o])=>({rowId:a,slots:[...o].sort((s,p)=>s.index-p.index)})),r={length:e.length,first:e[0],last:e[e.length-1],rows:c,rowCentres:t,behind:new Map};return be.set(e,r),r}function Te(e,i,n){let t=`${n.x},${n.y}`,c=e.behind.get(t);return c||(c=Ie(i,n),e.behind.set(t,c)),c}function Ce(e,i,n){let t=Math.floor(n.qty);if(!Number.isFinite(t)||t<=0)return{labels:[],reason:"sold_out"};let{categoryKey:c,zoneId:r,focal:a,preferPremium:o,preferNearest:s,preferredRowIds:p,accessibility:f,requireContiguous:u}=n,b=n.preferAisle&&n.aisleLabels?.size?n.aisleLabels:null,w=ke(e),k=new Uint8Array(e.length),g=0;for(let l=0;l<e.length;l++){let d=e[l];i.has(d.label)&&(!c||d.categoryKey===c)&&(!r||d.zoneId===r)&&(!f||f.some(x=>d.accessibility?.includes(x)))&&(k[l]=1,g+=1)}if(g===0)return{labels:[],reason:"sold_out"};let R=!c&&!r&&!s?Te(w,e,a):new Set,{rowCentres:H}=w,X=(p??[]).map(l=>H.get(l)).filter(l=>!!l),J=l=>{let d=H.get(l);return!d||!X.length?0:Math.min(...X.map(x=>A(d,x)))},L=!1,Q=[],N=0,Z="",ee=0,B=0,F=0,K=0,j=0,q=0,v=0;for(let{rowId:l,slots:d}of w.rows){let x=J(l),y=0;for(;y<d.length;){if(!k[d[y].order]){y++;continue}let h=y;for(;h<d.length&&k[d[h].order]&&(h===y||d[h].index===d[h-1].index+1);)h++;let I=h-y;for(let m=0;m+t<=I;m++){let fe=m,ge=I-(m+t),z=fe===1||ge===1?1:0,M=y+m,O=0,_=0,ne=!1,ie=0,oe=0,$;for(let C=M;C<M+t;C++){let T=d[C].seat;o&&!V(T)&&(O+=1),R.size&&R.has(T.label)&&(_+=1),b&&b.has(T.label)&&(ne=!0),ie+=T.x,oe+=T.y,!$&&T.focalPoint&&($=T.focalPoint)}let G=b&&!ne?1:0,E=A({x:ie/t,y:oe/t},s?a:$??a),ae=d[M].index,S;if(!L)S=!0;else if(o&&O!==F)S=O<F;else if(s&&x!==q)S=x<q;else if(s&&E!==v)S=E<v;else if(_!==K)S=_<K;else if(G!==j)S=G<j;else if(z!==B)S=z<B;else if(E!==v)S=E<v;else{let C=l.localeCompare(Z);S=C!==0?C<0:ae<ee}S&&(L=!0,Q=d,N=M,Z=l,ee=ae,B=z,F=O,K=_,j=G,q=x,v=E)}y=h}}if(L)return{labels:Q.slice(N,N+t).map(l=>l.seat.label)};if(u)return{labels:[],reason:"not_enough_together"};if(g<t)return{labels:[],reason:"not_enough_together"};let te=[];for(let l=0;l<e.length;l++)k[l]&&te.push(e[l]);return{labels:te.map((l,d)=>({seat:l,i:d,rowD2:J(l.logicalRowId??l.rowId),d2:A(l,s?a:l.focalPoint??a)})).sort((l,d)=>{if(o){let I=V(l.seat)?0:1,m=V(d.seat)?0:1;if(I!==m)return I-m}if(s&&l.rowD2!==d.rowD2)return l.rowD2-d.rowD2;let x=R.has(l.seat.label)?1:0,y=R.has(d.seat.label)?1:0;if(x!==y)return x-y;if(b){let I=b.has(l.seat.label)?0:1,m=b.has(d.seat.label)?0:1;if(I!==m)return I-m}if(l.d2!==d.d2)return l.d2-d.d2;let h=(l.seat.logicalRowId??l.seat.rowId).localeCompare(d.seat.logicalRowId??d.seat.rowId);return h!==0?h:W(l.seat,l.i)-W(d.seat,d.i)}).slice(0,t).map(l=>l.seat.label)}}function _e(e,i,n,t){let c=Math.floor(t.qty),r=Ce(e,n,t),o=i.filter(u=>u.bookingMode==="whole"&&u.capacity===c&&n.has(u.label)&&(!t.categoryKey||u.categoryKey===t.categoryKey)&&(!t.zoneId||u.zoneId===t.zoneId)&&!t.accessibility).map(u=>({table:u,d2:A(u.center,t.preferNearest?t.focal:u.focalPoint??t.focal)})).sort((u,b)=>u.d2-b.d2||u.table.label.localeCompare(b.table.label))[0];if(!o)return r;if(!r.labels.length)return{labels:[o.table.label]};if(t.preferAisle&&t.aisleLabels&&r.labels.some(u=>t.aisleLabels.has(u)))return r;let s=new Map(e.map(u=>[u.label,u])),p=r.labels.map(u=>s.get(u)).filter(u=>!!u),f=p.length?A(Y(p),we(p,t.focal)):Number.POSITIVE_INFINITY;return o.d2<f?{labels:[o.table.label]}:r}var D=class extends Error{constructor(n,t){super(t);this.objectId=n;this.name="GroupedTableProjectionError"}};function Pe(e){let i=e.minOccupancy,n=e.maxOccupancy;if(!Number.isInteger(i)||!Number.isInteger(n)||i<1||n<i||n>e.seatCount)throw new D(e.id,`Table "${e.label}" has invalid variable-occupancy bounds`);return{min:i,max:n}}function Be(e,i){if(i!==2)return[];let n=[];for(let t of le(e)){if(t.type!=="table"||!t.bookAsWhole&&!t.variableOccupancy)continue;if(t.bookAsWhole&&t.variableOccupancy)throw new D(t.id,`Table "${t.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(t.seatCount)||t.seatCount<1||!t.label.trim())throw new D(t.id,"Grouped tables require a label and at least one chair");let c=t.variableOccupancy?"variable":"whole",r=c==="variable"?Pe(t):{min:t.seatCount,max:t.seatCount};n.push({objectId:t.id,label:t.label,...t.displayLabel?{displayLabel:t.displayLabel}:{},...t.displayType?{displayType:t.displayType}:{},categoryKey:t.categoryKey,mode:c,capacity:t.seatCount,minOccupancy:r.min,maxOccupancy:r.max,chairs:re(t)})}return n}export{ve as a,ye as b,he as c,U as d,De as e,ue as f,Se as g,Me as h,Ie as i,Ce as j,_e as k,D as l,Be as m};
@@ -1 +1 @@
1
- import{f as D}from"./chunk-3YNO3XCY.js";import{g as A,i as P}from"./chunk-MLPJTJFE.js";import{C as M,Ma as w,N as v,Oa as C,Pa as S,Ra as O,Sa as j}from"./chunk-5R6I2XL7.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};
1
+ import{f as D}from"./chunk-227OYVC4.js";import{g as A,i as P}from"./chunk-N562FZPD.js";import{C as M,Ma as w,N as v,Oa as C,Pa as S,Ra as O,Sa as j}from"./chunk-J33DNOMI.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{h as Ae,j as he,n as Ne,p as Le}from"./chunk-S3VH7IDA.js";import{c as je}from"./chunk-CRCGO52K.js";var co=2e6,Tt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,At=/[\s"'<>`\\]/;function Nt(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Tt.test(e);if(At.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Fe(e){let t=e.trim();return Nt(t)?t:null}var Lt=2e5,uo=1e5,jt="large_venue_inventory";function fo(e){return e?.includes(jt)?2e5:1e5}var te="seatlayer.event-configuration/1",me="seatlayer.event-configuration-export/1",G=100,Ft=120,Dt=2e5,Vt=1e4,Ve=/^[a-f0-9]{64}$/,Ht=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function z(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function H(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function He(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function De(e){return!Array.isArray(e)||e.length>Dt||!e.every(t=>H(t,G))?null:[...new Set(e)].sort()}function Ue(e){return!z(e)||!H(e.chartId,G)||!H(e.version,G)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Ve.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function pe(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Ut(e){return z(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&pe(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Vt)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!z(l)||!H(l.id,G)||!H(l.objectId,G)||!n.has(l.objectId)||!Ht.has(String(l.kind))||!pe(l.heightM,.05,50)||l.baseElevationM!==void 0&&!pe(l.baseElevationM,-10,100))return null;let h=Ut(l.occlusion);if(!h||i.has(l.id)||o.has(l.objectId))return null;let a=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?Fe(l.contentImageUrl):null;if(l.contentImageUrl!==void 0&&(!a||l.kind!=="screen"||++r>1))return null;i.add(l.id),o.add(l.objectId),s.push({id:l.id,objectId:l.objectId,kind:l.kind,heightM:l.heightM,...l.baseElevationM!==void 0?{baseElevationM:l.baseElevationM}:{},occlusion:h,...a?{contentImageUrl:a}:{}})}return s.sort((l,h)=>l.id.localeCompare(h.id))}function Ge(e){let t=[];if(!z(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==te&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${te}`}),H(e.id,G)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),H(e.label,Ft)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),He(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ue(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let i=z(e.overlay)?e.overlay:null,o=De(i?.objectIds),r=De(i?.productionKillSeatIds),s=o?Gt(i?.productionElements,o):null;return(!i||!o||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!r||s===null?{issues:t}:{issues:t,value:{schema:te,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function po(e){let t=Ge(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function yo(e){if(!z(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==me&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${me}`}),(typeof e.contentSha256!="string"||!Ve.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Ge(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:me,configuration:n.value,contentSha256:e.contentSha256}}}function bo(e){return JSON.stringify({schema:te,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function go(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var Xt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function xo(e,t){return e===t||Xt[e].has(t)}function So(e,t,n){return!He(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Kt(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function ye(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)ye(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){H(o,G)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)H(r,G)?t.add(r):n.add(String(r));continue}ye(o,t,n)}}}function Mo(e,t){let n=Ue(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(ye(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Kt(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:te,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(l=>l.type==="shape"&&l.eventConfigurationIds?.includes(s)).map(l=>l.id).sort(),productionKillSeatIds:[]}}))}}var vo=40,Eo=1200,Io=.8,wo=3,Co=-2,_o=20,Oo=.1,ko=40,Ro=40,Xe=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function Bt(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Xe(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let l of r.split(/\s+/)){let h=l.length;s&&s+1+h<=i?s+=1+h:(o+=Math.max(1,Math.ceil(h/i)),s=h%i)}}return Math.max(1,o)}function Ke(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Xe(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=Bt(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Be=Math.PI/180;function R(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Ye(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function Ao(e,t,n){return n?Ye(e,t,n*Be):e}function No(e,t){return Ye(e,{x:0,y:0},t*Be)}function j(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Yt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function Lo(e){return e.length?Yt(e):null}function be(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function Do(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function $e(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[be(e,.5)];let i=Array.from({length:n+1},(h,a)=>be(e,a/n)),o=new Float64Array(i.length);for(let h=1;h<i.length;h+=1){let a=i[h].x-i[h-1].x,c=i[h].y-i[h-1].y;o[h]=o[h-1]+Math.hypot(a,c)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let h=0;h<t;h+=1){let a=r*h/(t-1);for(;l<o.length-1&&o[l]<a;)l+=1;let c=o[l-1],u=o[l],m=u===c?0:(a-c)/(u-c);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*m,y:i[l-1].y+(i[l].y-i[l-1].y)*m})}return s}function F(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ne(e,t){return{x:e.x-t.x,y:e.y-t.y}}function D(e,t){return{x:e.x*t,y:e.y*t}}function se(e,t=13){return Array.from({length:t},(n,i)=>be(e,i/(t-1)))}function ze(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return j(e[i],e[i+1],n-i)}function We(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[ze(e,i)];for(let s=1;s<e.length-1;s+=1){let l=s/(e.length-1);l>i+1e-9&&l<o-1e-9&&r.push(e[s])}return r.push(ze(e,o)),r}function qe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([m,d],p)=>{let f=R(j(e[m],e[d],.5),t);f<o&&(o=f,i=p)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],h=e[(i+3)%4],a=j(r,s,.5),c=ne(t,a),u=Math.max(1e-9,Math.hypot(c.x,c.y));return{p0:r,p1:s,p2:l,p3:h,normal:D(c,1/u),depth:(R(r,h)+R(s,l))/2}}function Qe(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=ne(n,t),h=ne(i,o),a=s*.22,c=s*.12;return{nearPath:{start:t,control1:F(F(t,D(l,1/3)),D(r,a)),control2:F(F(t,D(l,2/3)),D(r,a)),end:n},farPath:{start:i,control1:F(F(o,D(h,2/3)),D(r,c)),control2:F(F(o,D(h,1/3)),D(r,c)),end:o}}}function Vo(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((p,f)=>F(p,f),{x:0,y:0});i.x/=4,i.y/=4;let o=R(e[0],e[1]),r=R(e[0],e[3]),s=n==="auto"?o>r*1.25&&R(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(p=>({...p}))};let l=qe(e,t),{p0:h,p1:a,p2:c,p3:u}=l;if(s==="tapered")return{mode:s,outline:[F(h,D(ne(a,h),.14)),F(h,D(ne(a,h),1-.14)),c,u]};let{nearPath:m,farPath:d}=Qe(l);return{mode:s,outline:[...se(m),...se(d).slice(1)]}}function Ho(e,t,n,i){if(e.length!==4)throw new Error("Aisle generation requires four mapped bounds corners");if(!Number.isInteger(n)||n<0||n>3)throw new Error("Aisle count must be an integer from 0 to 3");if(n===0)return[];let o=qe(e,t),{p0:r,p1:s,p2:l,p3:h}=o,a=i==="bezier"?Qe(o):null,c=a?se(a.nearPath):null,u=a?se(a.farPath).reverse():null,m=Math.min(.055,.18/(n+1));return Array.from({length:n},(d,p)=>{let f=(p+1)/(n+1),g=f-m/2,v=f+m/2;return c&&u?[...We(c,g,v),...We(u,g,v).reverse()]:[j(r,s,g),j(r,s,v),j(h,l,v),j(h,l,g)]})}function zt(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Wt(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=zt(e,i[r],i[o]);s<n&&(n=s)}return n}function Je(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function et(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function $t(e,t,n){let i=Je(e,t)&&!n.some(r=>Je(e,r)),o=Wt(e,[t,...n]);return i?o:-o}function W(e,t,n,i,o){let r=$t({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var ge=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,l=o;if(r<t.length&&t[r].max>t[l].max&&(l=r),s<t.length&&t[s].max>t[l].max&&(l=s),l===o)break;[t[l],t[o]]=[t[o],t[l]],o=l}}return n}};function Ze(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function Go(e,t){return Math.max(0,Ze(e)-et(t).reduce((n,i)=>n+Ze(i),0))}function tt(e,t){let n=et(t);if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let f=e.reduce((v,E)=>v+E.x,0)/e.length,g=e.reduce((v,E)=>v+E.y,0)/e.length;return{point:{x:f,y:g},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let f of e)f.x<i&&(i=f.x),f.y<o&&(o=f.y),f.x>r&&(r=f.x),f.y>s&&(s=f.y);let l=r-i,h=s-o,a=Math.min(l,h);if(!(a>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let c=Math.max(l,h)/150,u=new ge,m=a/2;for(let f=i;f<r;f+=a)for(let g=o;g<s;g+=a)u.push(W(f+m,g+m,m,e,n));let d=W(i+l/2,o+h/2,0,e,n),p=0;for(;u.size;){let f=u.pop();if(!f)break;f.d>d.d&&(d=f),!(f.max-d.d<=c)&&(p>=4e3||(p+=1,m=f.h/2,u.push(W(f.x-m,f.y-m,m,e,n)),u.push(W(f.x+m,f.y-m,m,e,n)),u.push(W(f.x-m,f.y+m,m,e,n)),u.push(W(f.x+m,f.y+m,m,e,n))))}return{point:{x:d.x,y:d.y},radius:Math.max(0,d.d)}}function qt(e,t,n){return Math.max(t,Math.min(n,e))}function Ko(e,t,n){return e<t?t:e>n?n:e}function Qt(e){return qt(e,0,1)}function nt(e){let t=Qt(e);return t*t*(3-2*t)}var $=Math.PI*2;function q(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Jt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=$;for(;i>=$;)i-=$}else{for(;i>0;)i-=$;for(;i<=-$;)i+=$}return i}function Wo(e){return e.end}function rt(e){if(e.version!==1||e.closed!==!0||!q(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!q(n.end))return!1;if(n.kind==="line"){if(R(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!q(n.control1)||!q(n.control2)||R(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!q(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(R(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(R(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||R(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return R(t,e.start)<=1e-4}function Zt(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function st(e,t=2){if(!rt(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),l=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),h=Jt(s,l,r.clockwise),a=Math.max(2,Math.ceil(Math.abs(h)*r.radius/n));for(let c=1;c<=a;c+=1){let u=s+h*c/a;i.push({x:r.center.x+Math.cos(u)*r.radius,y:r.center.y+Math.sin(u)*r.radius})}}else{let s=R(o,r.control1)+R(r.control1,r.control2)+R(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let h=1;h<=l;h+=1)i.push(Zt(o,r,h/l))}o=r.end}return R(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function at(e,t,n){return en(e,o=>({x:o.x+t,y:o.y+n}))}function en(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}function $o(e){return e.map(t=>t===0?0:-t)}var tn=45,xe=150,nn=60;function on(e){let t=tn/100;if(e<=t)return xe;let n=Math.min(1,(e-t)/(1-t));return xe-n*(xe-nn)}var ot=.5523;function it(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function rn(e){let t=[],n=[];for(e.forEach((i,o)=>{q(i)&&(t.length&&it(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&it(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function qo(e,t,n){return Se(e,{cornerSmoothing:t,...n})}var sn=.5,an=4/3;function cn(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,l=i/r,h=n*an;return{kind:"bezier",control1:{x:e.x+i/3+s*h,y:e.y+o/3+l*h},control2:{x:e.x+i*2/3+s*h,y:e.y+o*2/3+l*h},end:{...t}}}function Se(e,t){let{points:n,sourceIndex:i}=rn(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,l=new Array(o).fill(0);if(s?.length)for(let x=0;x<o;x+=1){let S=s[i[x]];l[x]=Number.isFinite(S)?Math.min(100,Math.max(-100,S))/100:0}let h=l.some(x=>Math.abs(x)>1e-6);if(r<=0&&!h)return null;let a=t.wideAngleThresholdDeg??on(r),c=[];for(let x=0;x<o;x+=1)c[x]=R(n[x],n[(x+1)%o]);let u=new Array(o).fill(0);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o],P={x:S.x-y.x,y:S.y-y.y},M={x:b.x-y.x,y:b.y-y.y},C=Math.hypot(P.x,P.y),T=Math.hypot(M.x,M.y);if(C<=1e-9||T<=1e-9)continue;let I=Math.min(1,Math.max(-1,(P.x*M.x+P.y*M.y)/(C*T))),_=Math.acos(I)*180/Math.PI;if(_<a)continue;let O=nt((_-a)/(180-a));u[x]=r*O*.5*Math.min(C,T)}for(let x=0;x<o;x+=1){let S=(x+1)%o,y=u[x]+u[S];if(y>c[x]&&y>1e-9){let b=c[x]/y;u[x]*=b,u[S]*=b}}let m=new Array(o),d=new Array(o);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o];if(u[x]<=1e-6){m[x]={...y},d[x]={...y};continue}let P=R(y,S)||1,M=R(y,b)||1;m[x]={x:y.x+(S.x-y.x)/P*u[x],y:y.y+(S.y-y.y)/P*u[x]},d[x]={x:y.x+(b.x-y.x)/M*u[x],y:y.y+(b.y-y.y)/M*u[x]}}if(u.every(x=>x<=1e-6)&&!h)return null;let p=[],f={...d[0]},g=f,v=(x,S)=>{if(R(g,x)<=1e-9)return;let y=l[S];Math.abs(y)>1e-6?p.push(cn(g,x,y*sn*c[S])):p.push({kind:"line",end:{...x}}),g=x};for(let x=1;x<=o;x+=1){let S=x%o,y=n[S];v(m[S],(x-1)%o),u[S]>1e-6&&R(m[S],d[S])>1e-9&&(p.push({kind:"bezier",control1:j(m[S],y,ot),control2:j(d[S],y,ot),end:{...d[S]}}),g=d[S])}if(!p.length)return null;let E=p[p.length-1];R(E.end,f)>1e-9&&(E.kind==="line"?E.end={...f}:p.push({kind:"line",end:{...f}}));let w={version:1,closed:!0,start:f,segments:p};return rt(w)?w:null}function Qo(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function Zo(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],l=Math.hypot(s.x-r.x,s.y-r.y);if(l<=0)continue;let h=Math.max(1,Math.round(l/n)),a=l/h,c=Math.atan2(s.y-r.y,s.x-r.x),u=o===0,d=(o>0?t[o-1]:void 0)==="break"?2:1,p=u?{...r}:{x:r.x+Math.cos(c)*a*d,y:r.y+Math.sin(c)*a*d},f=u?h+1:Math.max(1,h-(d-1));i.push({origin:p,rotation:c*180/Math.PI,seatCount:f,seatSpacing:a})}return i}function ei(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function ti(e){return e.reduce((t,n)=>t+n.seatCount,0)}function ct(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((m,d)=>m.segmentedRow.componentIndex-d.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,l=r[0]?.segmentedRow;if(!l||!(s>=2&&r.length===s&&l?.boundaryBefore==="start"&&r.every((m,d)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===i&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===d&&m.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(d===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===l.displayLabel)))continue;let a=r.reduce((m,d)=>m+d.seatCount,0),c=0,u=0;for(let m of r)m.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(m.id,{groupId:i,adjacencyOffset:c,displayOffset:u,displayLabel:l.displayLabel,totalSeats:a,canonical:r[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),c+=m.seatCount,u+=m.seatCount}return t}var Q=.02291666666666667,ve=1/Q,ln=58,un=ln*Q,oi=0,dn=3,lt=0,Me=120,fn=0,hn=45,mn=7,J=1.2;function Pe(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function pn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=mn?e:dn}function ut(e,t={}){let n=Pe(t.floorBaseHeightM,lt,Me,0),i=Math.min(Me,n+pn(e.elevation)*un),o=e.height===void 0?i:Pe(e.height,lt,Me,i),r=Pe(e.rake,fn,hn,0);return{height:o,rake:r}}function dt(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function ft(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],l=s.x-r.x,h=s.y-r.y,a=l*l+h*h,c=a>1e-12?((t-r.x)*l+(n-r.y)*h)/a:0;c<0?c=0:c>1&&(c=1);let u=t-(r.x+c*l),m=n-(r.y+c*h);if(Math.abs(u)>=i||Math.abs(m)>=i)continue;let d=Math.hypot(u,m);d<i&&(i=d)}return i}function yn(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function ht(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Ee(e,t){let n=1/0;for(let i of dt(e)){let o=ft(t,i.x,i.y);o<n&&(n=o)}for(let i of dt(t)){let o=ft(e,i.x,i.y);o<n&&(n=o)}return n}function bn(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let c of e)n+=c.x,i+=c.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let c of e){let u=Math.hypot(c.x-n,c.y-i);u>o&&(o=u,r=c)}let s=r.x-n,l=r.y-i,h=Math.hypot(s,l);h>1e-9?(s/=h,l/=h):(s=1,l=0);let a=e.map((c,u)=>({p:c,i:u,t:(c.x-n)*s+(c.y-i)*l})).sort((c,u)=>c.t-u.t);return{pts:a.map(c=>c.p),seatIndices:a.map(c=>t[c.i])}}function gn(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let E of e)n+=E.x,i+=E.y;n/=t,i/=t;let o=0,r=0,s=0,l=0,h=0,a=0,c=0;for(let E of e){let w=E.x-n,x=E.y-i;o+=w*w,s+=x*x,r+=w*x,l+=w*w*w,h+=x*x*x,a+=w*x*x,c+=x*w*w}let u=o*s-r*r;if(Math.abs(u)<1e-9)return null;let m=(l+a)/2,d=(h+c)/2,p=(m*s-d*r)/u,f=(d*o-m*r)/u,g=p+n,v=f+i;return!Number.isFinite(g)||!Number.isFinite(v)?null:{cx:g,cy:v}}var xn=.15;function Sn(e){if(e.length<2)return null;let t=e.map(S=>{let y=0,b=0;for(let P of S.pts)y+=P.x,b+=P.y;return{x:y/S.pts.length,y:b/S.pts.length}}),n=0,i=0;for(let S of t)n+=S.x,i+=S.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let S of t){let y=S.x-n,b=S.y-i;o+=y*y,r+=y*b,s+=b*b}let l=o+s,h=o*s-r*r,a=l/2+Math.sqrt(Math.max(0,l*l/4-h)),c,u;Math.abs(r)>1e-12?(c=a-s,u=r):o>=s?(c=1,u=0):(c=0,u=1);let m=Math.hypot(c,u);if(!(m>1e-12))return null;c/=m,u/=m;let d=0,p=0,f=0;for(let S of e){if(S.pts.length<2)continue;let y=S.pts[0],b=S.pts[S.pts.length-1],P=b.x-y.x,M=b.y-y.y,C=Math.hypot(P,M);if(!(C>1e-9))continue;let T=P/C,I=M/C;d+=(T*T-I*I)*C,p+=2*T*I*C,f+=C}if(f>0&&Math.hypot(d,p)>=Pn*f){let S=Math.atan2(p,d)/2;c=-Math.sin(S),u=Math.cos(S)}let g=1/0,v=-1/0,E=[];for(let S of e){let y=1/0,b=-1/0;for(let P of S.pts){let M=P.x*c+P.y*u;M<y&&(y=M),M>b&&(b=M),M<g&&(g=M),M>v&&(v=M)}E.push(b-y)}let w=v-g;return w>1e-9?(E.sort((S,y)=>S-y),E[Math.min(E.length-1,Math.floor(E.length*.9))]/w<=Mn?{x:c,y:u}:null):null}var Mn=.35,Pn=.8;function mt(e,t,n,i){let o=new Map;for(let y of n){let b=t[y],P=b.rowId||`__seat-${y}`,M=o.get(P);M||(M={pts:[],idx:[]},o.set(P,M)),M.pts.push({x:b.x,y:b.y}),M.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[y,b]of o){let P=bn(b.pts,b.idx),M=0;for(let C of P.pts)M+=Math.hypot(C.x-i.x,C.y-i.y);r.push({id:y,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/P.pts.length})}let s=r.map(y=>yn(y.pts)),l=r.length<=256?r.length*(r.length-1)/2:0,h=l?new Float64Array(l):null;h?.fill(Number.NaN);let a=h?new Map(r.map((y,b)=>[y,b])):null,c=(y,b)=>(y>b&&([y,b]=[b,y]),y*(2*r.length-y-1)/2+(b-y-1)),u=(y,b)=>{if(!h)return Ee(r[y].pts,r[b].pts);let P=c(y,b),M=h[P];if(!Number.isNaN(M))return M;let C=Ee(r[y].pts,r[b].pts);return h[P]=C,C},m=(y,b)=>a?u(a.get(y),a.get(b)):Ee(y.pts,b.pts),d=[];for(let y=0;y<r.length;y++){let b=1/0;for(let P=0;P<r.length;P++){if(y===P||ht(s[y],s[P])>=b)continue;let M=u(y,P);M<b&&(b=M)}Number.isFinite(b)&&d.push(b)}d.sort((y,b)=>y-b);let p=d.length?d[Math.floor(d.length/2)]:1,f=Math.max(p*1.8,1e-6),g=r.map(()=>[]);for(let y=0;y<r.length;y++)for(let b=y+1;b<r.length;b++)ht(s[y],s[b])>f||u(y,b)<=f&&(g[y].push(b),g[b].push(y));let v=0;for(let y=0;y<r.length;y++){if(r[y].blockId!==-1)continue;let b=v++,P=[y];for(r[y].blockId=b;P.length;){let M=P.pop();for(let C of g[M])r[C].blockId===-1&&(r[C].blockId=b,P.push(C))}}let E=new Map;for(let y of r){let b=E.get(y.blockId)??[];b.push(y),E.set(y.blockId,b)}let w=[];for(let y of r){if(y.pts.length<4)continue;let b=gn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||w.push({x:b.cx,y:b.cy}))}let x=w.length>=2?(()=>{let y=w.map(M=>M.x).sort((M,C)=>M-C),b=w.map(M=>M.y).sort((M,C)=>M-C),P=Math.floor(w.length/2);return{cx:y[P],cy:b[P]}})():null;if(x){let y=I=>Math.hypot(I.x-x.cx,I.y-x.cy),b=1/0,P=-1/0,M=[];for(let I of r){let _=1/0,O=-1/0;for(let N of I.pts){let A=y(N);A<_&&(_=A),A>O&&(O=A)}M.push(O-_),_<b&&(b=_),O>P&&(P=O)}let C=P-b;M.sort((I,_)=>I-_);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(C>1e-9&&T/C<=xn){let I=r.map(k=>{let re=0;for(let Rt of k.pts)re+=y(Rt);return{row:k,radius:re/k.pts.length}}),_=0,O=0;for(let k of I)_+=k.radius,O+=k.row.focalDistance;_/=I.length,O/=I.length;let N=0;for(let k of I)N+=(k.radius-_)*(k.row.focalDistance-O);if(N<0)for(let k of I)k.radius=-k.radius;let L=1/0;for(let k of I)k.radius<L&&(L=k.radius);I.sort((k,re)=>k.radius-re.radius);let V=-1,Y=-1/0,kt=C/Math.max(1,I.length)*.5,Te=[];for(let k of I)k.radius-Y>kt&&(V++,Y=k.radius),k.row.ordinal=V,k.row.blockDepth=k.radius-L,Te.push(k.row);return{sectionId:e,rows:Te,blockCount:v}}}let S=[];for(let[,y]of E){let b=Sn(y);if(b){let P=I=>{let _=0;for(let O of I.pts)_+=O.x*b.x+O.y*b.y;return _/I.pts.length};y.sort((I,_)=>P(I)-P(_)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let M=[],C=p*.5;for(let I of y){let _=M[M.length-1];_&&Math.abs(P(I)-P(_[0]))<C?_.push(I):M.push([I])}let T=0;for(let I=0;I<M.length;I++){if(I>0){let _=1/0;for(let O of M[I-1])for(let N of M[I])_=Math.min(_,m(O,N));T+=_}for(let _ of M[I])_.ordinal=I,_.blockDepth=T,S.push(_)}}else{let P=1/0;for(let M of y)M.focalDistance<P&&(P=M.focalDistance);y.sort((M,C)=>M.focalDistance-C.focalDistance);for(let M=0;M<y.length;M++)y[M].ordinal=M,y[M].blockDepth=Math.max(0,y[M].focalDistance-P),S.push(y[M])}}return{sectionId:e,rows:S,blockCount:v}}function vn(e,t){return Math.abs(e.x-t.x)<=1e-7&&Math.abs(e.y-t.y)<=1e-7}function oe(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)}function ae(e,t,n){let i=oe(t,n,e);return Math.abs(i)>1e-7?!1:e.x>=Math.min(t.x,n.x)-1e-7&&e.x<=Math.max(t.x,n.x)+1e-7&&e.y>=Math.min(t.y,n.y)-1e-7&&e.y<=Math.max(t.y,n.y)+1e-7}function En(e,t,n,i){let o=oe(e,t,n),r=oe(e,t,i),s=oe(n,i,e),l=oe(n,i,t);return(o>1e-7&&r<-1e-7||o<-1e-7&&r>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)?!0:Math.abs(o)<=1e-7&&ae(n,e,t)||Math.abs(r)<=1e-7&&ae(i,e,t)||Math.abs(s)<=1e-7&&ae(e,n,i)||Math.abs(l)<=1e-7&&ae(t,n,i)}function In(e){return e.reduce((t,n,i)=>{let o=e[(i+1)%e.length];return t+n.x*o.y-o.x*n.y},0)}function wn(e){for(let t=0;t<e.length;t+=1){let n=(t+1)%e.length;for(let i=t+1;i<e.length;i+=1){let o=(i+1)%e.length;if(!(t===i||n===i||o===t)&&En(e[t],e[n],e[i],e[o]))return!0}}return!1}function si(e){return e.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:e.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:e.some(t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)||Math.abs(t.x)>1e7||Math.abs(t.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:e.some((t,n)=>vn(t,e[(n+1)%e.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(In(e))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:wn(e)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}var ui=64;function Cn(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((i,o)=>{let r=e.edgeCurvature[o];return Number.isFinite(r)?Math.min(100,Math.max(-100,r)):0});return n.some(i=>Math.abs(i)>.5)?n:[]}function _n(e){let t=Cn(e);return t.length?Se(e.points,{edgeCurvature:t}):null}function ie(e,t=2){let n=_n(e);return n?st(n,t):e.points??[]}function di(e){return e.kind==="polygon"?X(e.holes):[]}function fi(e,t){let n=ie(e);return n.length<3||t.length<3||!t.flatMap((o,r)=>{let s=t[(r+1)%t.length];return[o,{x:(o.x+s.x)/2,y:(o.y+s.y)/2}]}).every(o=>Z(o,n)||Ie(o,n))?!1:!t.some((o,r)=>{let s=t[(r+1)%t.length];return n.some((l,h)=>pt(o,s,l,n[(h+1)%n.length]))})}function pt(e,t,n,i){let o=(a,c,u)=>(c.x-a.x)*(u.y-a.y)-(c.y-a.y)*(u.x-a.x),r=o(e,t,n),s=o(e,t,i),l=o(n,i,e),h=o(n,i,t);return r*s<-1e-9&&l*h<-1e-9}function hi(e,t){return Z(e[0],t)||Z(t[0],e)?!0:e.some((n,i)=>{let o=e[(i+1)%e.length];return t.some((r,s)=>pt(n,o,r,t[(s+1)%t.length]))})}var yi=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."},{key:"pitch-rugby",label:"Rugby pitch",blurb:"100 \xD7 70 m field of play with in-goal areas, 22 m and 10 m lines."},{key:"diamond-baseball",label:"Baseball field",blurb:"Diamond, infield, mound and foul lines out to 99 m poles."},{key:"court-basketball",label:"Basketball court",blurb:"28 \xD7 15 m court with keys and three-point lines."},{key:"court-tennis",label:"Tennis court",blurb:"23.77 \xD7 10.97 m doubles court with run-off and net."},{key:"ring-boxing",label:"Boxing ring",blurb:"Raised ring, 6.1 m inside the ropes, coloured corners."}],On=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),kn=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Rn(e){return!!e&&On.has(e)}function bi(e){return!!e&&kn.has(e)}var Ce=1.1;function gi(e){return ce(e)?e==="ring-boxing"?Ce:.06:1}var yt={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},bt={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};function xi(e){let t=yt[e];return t?{width:t.width*ve,height:t.height*ve}:{width:300,height:70}}var Tn="#232c40",gt=Math.PI*2;function xt(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function An(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=(d,p)=>{u.push({x:d,y:p})};switch(t){case"rect":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"rounded":{let d=Math.min(o,r)*.18,p=5,f=(g,v,E)=>{for(let w=0;w<=p;w++){let x=E+w/p*(Math.PI/2);m(g+d*Math.cos(x),v+d*Math.sin(x))}};f(a-d,-c+d,-Math.PI/2),f(a-d,c-d,0),f(-a+d,c-d,Math.PI/2),f(-a+d,-c+d,Math.PI);break}case"arc":{let d=r*.45;m(-a,-c),m(a,-c);let p=24;for(let f=0;f<=p;f++){let g=f/p,v=a-g*o,E=c+d*(1-Math.pow(2*v/o,2));m(v,E)}break}case"thrust":{let d=o*.18,p=r*1.1;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"runway":{let d=o*.1,p=r*3;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"round":case"oval-cricket":{for(let p=0;p<40;p++){let f=p/40*gt;m(a*Math.cos(f),c*Math.sin(f))}break}case"pitch-football":case"pitch-rugby":case"court-basketball":case"court-tennis":case"ring-boxing":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"diamond-baseball":{for(let d of Ln(a,c))m(d.x,d.y);break}case"rink-hockey":{for(let d of Nn(a,c,a*(8.5/60),c*(8.5/30)))m(d.x,d.y);break}case"track-athletics":{for(let d of we(a,c))m(d.x,d.y);break}}return u.map(d=>xt(d.x,d.y,l,h,n,i))}function Si(e,t="stage"){return{type:"shape",id:t,kind:"polygon",points:An(e),fill:e.fill??bt[e.kind]??Tn,label:e.label??"STAGE",role:"stage",stageKind:e.kind}}function Nn(e,t,n,i){let o=[],s=(l,h,a)=>{for(let c=0;c<=8;c++){let u=a+c/8*(Math.PI/2);o.push({x:l+n*Math.cos(u),y:h+i*Math.sin(u)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function we(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var B=(()=>{let t={x:0,y:52},n=25,i={x:70,y:t.y-70},o=(i.x*i.x+i.y*i.y-4900)/(2*(i.y+70)),r=o+70,s=[],l=Math.atan2(i.y-o,i.x),h=Math.atan2(i.y-o,-i.x);for(let a=0;a<=24;a++){let c=l+(h-l)*a/24;s.push({x:r*Math.cos(c),y:o+r*Math.sin(c)})}return{half:70,home:t,backstop:n,fence:s}})();function Ln(e,t){let n=e/B.half,i=t/B.half;return[{x:-B.backstop*n,y:t},{x:B.backstop*n,y:t},...B.fence.map(o=>({x:o.x*n,y:o.y*i}))]}var jn="#f1f5f9";function Mi(e){switch(e){case"pitch-football":return"PITCH";case"rink-hockey":return"RINK";case"track-athletics":return"TRACK";case"oval-cricket":return"OVAL";case"pitch-rugby":return"PITCH";case"diamond-baseball":return"FIELD";case"court-basketball":case"court-tennis":return"COURT";case"ring-boxing":return"RING";default:return"STAGE"}}function ce(e){return Rn(e)}function K(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*gt;r.push({x:e+n*Math.cos(l),y:t+i*Math.sin(l)})}return r}function U(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function Fn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=yt[t],d=f=>m?f/m.width*o:0,p=f=>m?f/m.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1}),u.push({points:K(0,0,d(9.15),p(9.15)),closed:!0});for(let f of[-1,1])u.push({points:U(f*(a-d(16.5)/2),0,d(16.5)/2,p(40.32)/2),closed:!0}),u.push({points:U(f*(a-d(5.5)/2),0,d(5.5)/2,p(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1,ink:"#d63b3b"});for(let f of[-1,1]){u.push({points:[{x:f*d(7.5),y:-c},{x:f*d(7.5),y:c}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:f*(a-d(4)),y:-p(11)},{x:f*(a-d(4)),y:p(11)}],closed:!1,ink:"#d63b3b"});for(let g of[-1,1])u.push({points:K(f*d(20.5),g*p(7),d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:K(0,0,d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let g=c-p(1.22)*8;g>0&&u.push({points:we(a-d(1.22)*8,g),closed:!0,fill:"#2f7d4f"});for(let v=1;v<8;v++){let E=p(1.22)*v,w=c-E;if(w<=0)break;u.push({points:we(a-d(1.22)*v,w),closed:!0})}break}case"oval-cricket":{u.push({points:K(0,0,d(27.4),p(27.4+20.12/2),40),closed:!0}),u.push({points:U(0,0,d(3.05)/2,p(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let f=g=>({points:[{x:d(g),y:-c},{x:d(g),y:c}],closed:!1});u.push(f(0));for(let g of[-1,1]){u.push(f(g*50),f(g*28));for(let v=-35;v<35;v+=4)u.push({points:[{x:d(g*10),y:p(v)},{x:d(g*10),y:p(Math.min(35,v+2))}],closed:!1})}break}case"diamond-baseball":{let f=(A,L)=>({x:d(A),y:p(L)}),{home:g}=B,v=27.43,E=v/Math.SQRT2,w={x:g.x+E,y:g.y-E},x={x:g.x,y:g.y-2*E},S={x:g.x-E,y:g.y-E},y={x:g.x,y:g.y-18.44},b="#b98a59",P=bt["diamond-baseball"],M=38.94,C=[f(g.x,g.y)],T=Math.atan2(g.y-M/Math.SQRT2-y.y,M/Math.SQRT2),I=Math.PI-T;for(let A=0;A<=16;A++){let L=T-(T+Math.PI*2-I)%(Math.PI*2)*(A/16);C.push(f(y.x+29*Math.cos(L),y.y+29*Math.sin(L)))}u.push({points:C,closed:!0,fill:b,ink:b});let _={x:g.x,y:g.y-E},O=[{x:g.x,y:g.y},w,x,S].map(A=>f(_.x+(A.x-_.x)*.84,_.y+(A.y-_.y)*.84));u.push({points:O,closed:!0,fill:P,ink:P}),u.push({points:K(d(y.x),p(y.y),d(2.74),p(2.74),20),closed:!0,fill:b,ink:b}),u.push({points:K(d(g.x),p(g.y),d(3.96),p(3.96),20),closed:!0,fill:b,ink:b});let N=B.fence;u.push({points:[f(g.x,g.y),f(N[0].x,N[0].y)],closed:!1}),u.push({points:[f(g.x,g.y),f(N[N.length-1].x,N[N.length-1].y)],closed:!1});for(let A of[w,x,S])u.push({points:U(d(A.x),p(A.y),d(.3),p(.3)),closed:!0,fill:jn});break}case"court-basketball":{u.push({points:U(0,0,d(14),p(7.5)),closed:!0}),u.push({points:[{x:0,y:-p(7.5)},{x:0,y:p(7.5)}],closed:!1}),u.push({points:K(0,0,d(1.8),p(1.8),24),closed:!0});for(let f of[-1,1]){let g=f*14,v=f*(14-5.8),E=f*(14-1.575);u.push({points:U(d((g+v)/2),0,d(2.9),p(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:K(d(v),0,d(1.8),p(1.8),24),closed:!0});let w=Math.sqrt(6.75*6.75-6.6*6.6),x=[{x:d(g),y:-p(6.6)}],S=Math.atan2(-6.6,-f*w),y=2*Math.atan2(6.6,w);for(let b=0;b<=16;b++){let P=S-f*y*(b/16);x.push({x:d(E+6.75*Math.cos(P)),y:p(6.75*Math.sin(P))})}x.push({x:d(g),y:p(6.6)}),u.push({points:x,closed:!1})}break}case"court-tennis":{u.push({points:U(0,0,d(11.885),p(5.485)),closed:!0,fill:"#2b5f99"});for(let f of[-1,1])u.push({points:[{x:-d(11.885),y:f*p(4.115)},{x:d(11.885),y:f*p(4.115)}],closed:!1}),u.push({points:[{x:f*d(6.4),y:-p(4.115)},{x:f*d(6.4),y:p(4.115)}],closed:!1});u.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-p(6.4)},{x:0,y:p(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:U(0,0,d(3.05),p(3.05)),closed:!0});let v=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[E,w,x]of v)u.push({points:U(E*d(3.05),w*p(3.05),d(.3),p(.3)),closed:!0,fill:x,ink:x});break}default:return[]}return u.map(f=>({...f,points:f.points.map(g=>xt(g.x,g.y,l,h,n,i))}))}function Pi(e){if(e.role!=="stage"||!ce(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(c=>c.x),i=e.points.map(c=>c.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),l=Math.max(...i),h=Math.max(1,r-o),a=Math.max(1,l-s);t={cx:o+h/2,cy:s+a/2,width:h,height:a}}return t?Fn({kind:e.stageKind,...t}):[]}function Dn(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?ie(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function Vn(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,l=e.y-t.y;return{x:t.x+s*o-l*r,y:t.y+s*r+l*o}}function St(e){let t=Dn(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(h=>Vn(h,{x:t.reduce((a,c)=>a+c.x,0)/t.length,y:t.reduce((a,c)=>a+c.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,l=-1/0;for(let h of i)o=Math.min(o,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var Hn=5,Un=3,Gn=.92,Xn=1.9,Kn=2,Bn=.6,Yn=1,zn=.06;function Wn(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?Ce:ce(e.stageKind)?zn:Yn}function Mt(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of _e(e)){let l=s.baseHeightM??0;for(let h of s.objects){if(h.type!=="shape"||h.role!=="stage")continue;let a=St(h);a&&(t=Math.min(t,a.minX),n=Math.min(n,a.minY),i=Math.max(i,a.maxX),o=Math.max(o,a.maxY),r=Math.max(r,l+Wn(h)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function $n(e,t,n,i){let o=1/0,r=1/0,s=-1/0,l=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(o=Math.min(o,d.x),s=Math.max(s,d.x),r=Math.min(r,d.y),l=Math.max(l,d.y));if(!Number.isFinite(o))return null;let h=o*t,a=r*t,c=Math.max(1,Math.ceil((s-o)*t/n)+1),u=Math.max(1,Math.ceil((l-r)*t/n)+1),m=new Float64Array(c*u).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let p=d.eyeHeightM-J,f=Math.min(c-1,Math.max(0,Math.floor((d.x*t-h)/n))),v=Math.min(u-1,Math.max(0,Math.floor((d.y*t-a)/n)))*c+f,E=p+i;E>m[v]&&(m[v]=E)}return{cellM:n,minX:h,minY:a,cols:c,rows:u,top:m}}function qn(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function Pt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??Q,r=n.cellM??Bn,s=n.chairBackM??Gn,l=n.selfRowSkipM??Kn,h=n.clearThreshold??.9,a=n.partialThreshold??.25,c=Math.max(1,n.columns??Hn),u=Math.max(1,n.rows??Un),m=$n(e,o,r,s);if(!m)return i;let d=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,f=d>=p,g=(t.minX+t.maxX)/2*o,v=(t.minY+t.maxY)/2*o,E=[];for(let x=0;x<c;x++){let S=(x+.5)/c-.5,y=f?g+S*d:g,b=f?v:v+S*p;for(let P=0;P<u;P++){let M=t.deckTopM+(u===1?0:P/(u-1)*Xn);E.push({x:y,y:b,z:M})}}let w=r/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let S=x.x*o,y=x.y*o,b=x.eyeHeightM,P=0,M=1/0;for(let T of E){let I=T.x-S,_=T.y-y,O=Math.hypot(I,_);if(!(O>l)){P++;continue}let N=I/O,A=_/O,L=0;for(let V=l;V<O;V+=w){let Y=qn(m,S+N*V,y+A*V);if(!(!Number.isFinite(Y)||Y>=b)&&Y>b+(T.z-b)*V/O){L=V;break}}L?M=Math.min(M,L):P++}let C=P/E.length;C>=h||i.set(x.id,{seatId:x.id,mark:C<a?"obstructedView":"restrictedView",visibleFraction:C,totalRays:E.length,atDistanceM:Number.isFinite(M)?M:0})}return i}function vt(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function Oe(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var de=Math.PI/180,Qn=9,ee=16;function ke(e,t,n,i){let o=n*de,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function Re(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return $e(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let a=0;a<t;a++)s.push(ke(a*n,0,o,r));return s}let l=i/(t-1)*de,h=n/(2*Math.sin(Math.abs(l)/2));for(let a=0;a<t;a++){let c=a*l,u=h*Math.sin(c),m=-h+h*Math.cos(c);s.push(ke(u,m,o,r))}return s}function Ct(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function zi(e){let t=new Set((e.overrides??[]).filter(n=>n.skip&&Number.isInteger(n.index)&&n.index>=0&&n.index<e.seatCount).map(n=>n.index));return Math.max(0,e.seatCount-t.size)}function Jn(e,t){let n=Ct(e);return Re(e).map((i,o)=>{let r=n.get(o),s=Oe(r),l=Ae(e,o,r),h={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:he(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(h).some(a=>a!==void 0&&a!==!1&&a!=="")?h:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function Zn(e){let t=[];for(let n of Jn(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function eo(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function _t(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(c=>[c.index,c])),o=(c,u,m,d)=>{let p=i.get(c),f=Oe(p),g=p?.label??Ne(e,c);return{index:c,label:g,displayLabel:p?.displayLabel??Le(e,c),x:u+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:f.length>0,accessibility:f,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let c=(e.radius??40)+ee,u=e.rotation*de,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let g=0;g<n;g++){let v=u+g/n*2*Math.PI;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let d=m*de,p=(2*Math.PI-d)/2,f=u+p;for(let g=0;g<n;g++){let v=f+g/(n-1)*d;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let r=e.width??80,s=e.height??50,l=eo(e),h=["top","bottom","left","right"],a=0;for(let c of h){let u=l[c];for(let m=0;m<u;m++){let d,p;c==="top"?(d=-r/2+(m+.5)*r/u,p=-s/2-ee):c==="bottom"?(d=-r/2+(m+.5)*r/u,p=s/2+ee):c==="left"?(d=-r/2-ee,p=-s/2+(m+.5)*s/u):(d=r/2+ee,p=-s/2+(m+.5)*s/u);let f=ke(d,p,e.rotation,e.center);t.push(o(a++,f.x,f.y,c))}}return t}function Wi(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):_t(e).filter(t=>!t.skipped).length}function to(e){return _t(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function no(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function Z(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function Ie(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),l=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function X(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function fe(e,t,n){return Z(e,t)&&!X(n).some(i=>Z(e,i)||Ie(e,i))}function $i(e,t){return tt(e,t).point}function ue(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function Ot(e){switch(e.type){case"row":{let t=Re(e),n=Ct(e),i=0,o=0,r=0;for(let s=0;s<t.length;s++){let l=n.get(s);l?.skip||(i+=t[s].x+(l?.dx??0),o+=t[s].y+(l?.dy??0),r++)}return r?{x:i/r,y:o/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return ue(e.points);case"section":return ue(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?ue(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Et(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function oo(e,t){if(e.type!=="gaArea"||!Et(e.points,t.outline))return!1;let n=X(e.holes),i=X(t.holes);return n.length===i.length&&n.every((o,r)=>Et(o,i[r]))}function io(e,t,n=e.filter(o=>o.type==="section"),i=Ot(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(oo(t,s)||fe(i,s.outline,s.holes))):void 0)??n.find(s=>fe(i,s.outline,s.holes))}function _e(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function qi(e,t){let n=_e(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function ro(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function so(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:X(e.holes).map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:at(e.outlinePath,t,n)}:{},...e.holes?{holes:X(e.holes).map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.holes?{holes:X(e.holes).map(o)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function Qi(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:so(s,0,r))}),{...e,objects:n,floors:void 0}}function It(e,t,n,i,o,r,s,l,h){let a=[],c=e.filter(f=>f.type==="section"),u=ct(e),m=f=>!f?.eventConfigurationId||f.eventConfigurationId===i&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===h),d=f=>je(f,{activeConfigurationId:i,activeConfigurationVersion:h,activeBasisSha256:o,now:l}),p=(f,g)=>d(f)?{...f,coverage:g}:void 0;for(let f of e){let g=[];if(f.type==="row"?g=Zn(f):f.type==="table"?g=to(f):f.type==="booth"&&(g=no(f)),!g.length)continue;for(let S of g)S.viewUrl&&!m(S.viewMeta)&&(S.viewUrl=void 0,S.viewMeta=void 0);if(f.type==="row"){let S=u.get(f.id);if(S){let y=new Map((f.overrides??[]).map(b=>[b.index,b]));for(let b of g){let P=Number(b.id.slice(b.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;b.logicalRowId=S.groupId,b.logicalSeatIndex=S.adjacencyOffset+P,y.get(P)?.displayLabel||(b.displayLabel=he(f,P,S)),!b.viewUrl&&S.viewFromSeatUrl&&m(S.viewFromSeatMeta)&&(b.viewUrl=S.viewFromSeatUrl,b.viewMeta=S.viewFromSeatMeta);let M=y.get(P)?.confidenceEvidence;b.confidenceEvidence=p(M,"exact-seat")??p(f.confidenceEvidence,"row-representative")??p(S.confidenceEvidence,"row-representative")}}}let v=io(e,f,c,f.type==="row"?ue(g):Ot(f)),E=v?.viewFromSeatUrl,x=(v?.zone?t?.find(S=>S.id===v.zone):void 0)?.focalPoint??n;for(let S of g){if(!S.confidenceEvidence){let y=Number(S.id.slice(S.id.lastIndexOf(":")+1)),b=(f.type==="row"||f.type==="table")&&Number.isInteger(y)?f.overrides?.find(P=>P.index===y)?.confidenceEvidence:void 0;S.confidenceEvidence=p(b,"exact-seat")??(f.type==="row"?p(f.confidenceEvidence,"row-representative"):void 0)}S.confidenceEvidence??=p(v?.confidenceEvidence,"section-representative")??(s?p(s.evidence,s.coverage):void 0),!S.viewUrl&&E&&m(v?.viewFromSeatMeta)&&(S.viewUrl=E,S.viewMeta=v?.viewFromSeatMeta),!S.viewUrl&&r&&m(r.meta)&&(S.viewUrl=r.url,S.viewMeta=r.meta),v&&(S.sectionId=v.logicalSectionId??v.id),v?.zone&&(S.zoneId=v.zone),x&&(S.focalPoint={...x})}a.push(...g)}return a}function Ji(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,h=It(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&wt(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,h);for(let a of h)a.floorId=o.id;for(let a of h)i.push(a)}return i}let n=It(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&wt(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),ao(e,n,t)}function ao(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||vt(t,Pt(t,Mt(e))),t}function wt(e,t,n,i){let o=e.filter(u=>u.type==="section"),r=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!r||!t){for(let u of i)u.eyeHeightM=n+J;return}let s=new Array(i.length),l=new Map;for(let u of o)l.has(u.id)||l.set(u.id,u);let h=new Map,a=new Map;for(let u=0;u<i.length;u++){let m=i[u],p=(m.sectionId?l.get(m.sectionId)??o.find(g=>g.logicalSectionId===m.sectionId&&fe({x:m.x,y:m.y},g.outline,g.holes)):void 0)??o.find(g=>fe({x:m.x,y:m.y},g.outline,g.holes))??null;if(s[u]=p,!p)continue;h.has(p.id)||h.set(p.id,ut(p,{floorBaseHeightM:n}));let f=a.get(p.id);f?f.push(u):a.set(p.id,[u])}let c=new Array(i.length).fill(void 0);for(let[u,m]of a){let d=h.get(u);if(!d)continue;let p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=mt(u,i,m,t);for(let g of f.rows){let v=g.blockDepth*Q*p,E=d.height+v;for(let w of g.seatIndices)c[w]=E}}for(let u=0;u<i.length;u++){let m=i[u],d=s[u];if(!d){m.eyeHeightM=n+J;continue}let p=h.get(d.id);m.eyeHeightM=(c[u]??p.height)+J}}var le=40;function Zi(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,l=(a,c)=>{a<i&&(i=a),c<o&&(o=c),a>r&&(r=a),c>s&&(s=c)},h=a=>{if(Array.isArray(a))for(let c of a)!c||typeof c!="object"||l(c.x,c.y)};for(let a of ro(e))if(a.type==="row"){let c=new Map((a.overrides??[]).map(u=>[u.index,u]));Re(a).forEach((u,m)=>{let d=c.get(m);d?.skip||l(u.x+(d?.dx??0),u.y+(d?.dy??0))})}else if(a.type==="gaArea")h(a.points);else if(a.type==="section")h(a.outline);else if(a.type==="decorImage")l(a.x,a.y),l(a.x+a.width,a.y+a.height);else if(a.type==="shape")a.points&&a.points.length?h(ie(a)):a.x!=null&&a.y!=null&&a.width!=null&&a.height!=null&&(l(a.x,a.y),l(a.x+a.width,a.y+a.height));else if(a.type==="table"){let c=ee+Qn,u=a.shape==="round"?(a.radius??40)+c:Math.max((a.width??80)/2,(a.height??50)/2)+c;l(a.center.x-u,a.center.y-u),l(a.center.x+u,a.center.y+u)}else if(a.type==="booth"){let c=Math.max(a.width,a.height)/2;l(a.center.x-c,a.center.y-c),l(a.center.x+c,a.center.y+c)}else if(a.type==="text"){if(n)continue;let c=Ke(a);l(a.position.x,a.position.y),l(a.position.x+c.width,a.position.y+c.height)}for(let a of[e.referenceImage,e.backgroundImage]){if(!a)continue;let{center:c,width:u}=a;if(!c||!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(u))continue;let m=u*3/4;l(c.x-u/2,c.y-m/2),l(c.x+u/2,c.y+m/2)}if(!isFinite(i)){let a=e.focalPoint??{x:0,y:0};return{x:a.x-200,y:a.y-200,width:400,height:400}}return{x:i-le,y:o-le,width:r-i+le*2,height:s-o+le*2}}export{co as a,Nt as b,Fe as c,Lt as d,uo as e,jt as f,fo as g,te as h,me as i,po as j,yo as k,bo as l,go as m,xo as n,So as o,Mo as p,vo as q,Eo as r,Io as s,wo as t,Co as u,_o as v,Oo as w,ko as x,Ro as y,Ke as z,Ao as A,No as B,Yt as C,Lo as D,be as E,Do as F,$e as G,Vo as H,Ho as I,Wt as J,Ze as K,Go as L,tt as M,qt as N,Ko as O,Wo as P,rt as Q,st as R,at as S,en as T,$o as U,tn as V,on as W,qo as X,sn as Y,Se as Z,Qo as _,si as $,ui as aa,_n as ba,ie as ca,di as da,fi as ea,hi as fa,Zo as ga,ei as ha,ti as ia,ct as ja,Q as ka,ve as la,un as ma,oi as na,dn as oa,lt as pa,Me as qa,fn as ra,hn as sa,mn as ta,J as ua,ut as va,ft as wa,gn as xa,mt as ya,yi as za,Rn as Aa,bi as Ba,gi as Ca,xi as Da,An as Ea,Si as Fa,jn as Ga,Mi as Ha,Pi as Ia,Oe as Ja,ee as Ka,Re as La,zi as Ma,Jn as Na,Zn as Oa,eo as Pa,_t as Qa,Wi as Ra,to as Sa,no as Ta,Z as Ua,Ie as Va,X as Wa,fe as Xa,$i as Ya,Ot as Za,io as _a,_e as $a,qi as ab,ro as bb,so as cb,Qi as db,Ji as eb,Zi as fb};
@@ -1 +1 @@
1
- import{$a as S,Oa as I,Sa as A,Ta as y,_a as d,bb as f}from"./chunk-5R6I2XL7.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};
1
+ import{$a as S,Oa as I,Sa as A,Ta as y,_a as d,bb as f}from"./chunk-J33DNOMI.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};
@@ -1 +1 @@
1
- import{k as c,l as u}from"./chunk-R6BN4HDQ.js";import{$a as s,Oa as h,Sa as b}from"./chunk-5R6I2XL7.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
+ import{k as c,l as u}from"./chunk-R6BN4HDQ.js";import{$a as s,Oa as h,Sa as b}from"./chunk-J33DNOMI.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 X}from"./chunk-M4NGX5NM.js";import{O as _,Xa as T,Ya as j,cb as $,eb as B,fb as v}from"./chunk-5R6I2XL7.js";var W=.08,N=.045;function Y(t){return`__floor__:${encodeURIComponent(t)}`}function L(t,n,r){return{...t,objects:n,floors:void 0,...r?{focalPoint:r}:{},referenceImage:void 0,backgroundImage:void 0}}function U(t,n,r){let s=t.focalPoint??n.focalPoint;return s?s.x:r.x+r.width/2}function G(t){let n=t.floors??[];if(!n.length)return[];let r=n.map(e=>v(L(t,e.objects,e.focalPoint),{freeText:"exclude"})),c=Math.max(1,...r.map(e=>e.width))*W,o=0;return n.map((e,i)=>{let a=r[i],l=o-(a.y+a.height);return o-=a.height+c,{floorId:e.id,label:e.name??e.id,level:i,levelBadge:i===0?"G":String(i),translation:{x:-U(e,t,a),y:l},bounds:a}})}function H(t,n,r,s){let c=n==="name"?t.label:t.levelBadge;if(!c)return[];let o=Math.max(1,r*N),e=t.bounds.x+t.translation.x-o*2.4,i=t.bounds.y+t.translation.y+o*.4,a=`floor-level-${t.floorId}`;if(n==="name")return[{type:"text",id:`${a}-text`,text:c,position:{x:e,y:i},fontSize:o,rotation:0,color:s,bold:!0}];let l=o*.95,h={type:"shape",id:`${a}-badge`,kind:"ellipse",x:e-l*.35,y:i-l*.3,width:l*2,height:l*2,fill:"transparent",stroke:{color:s,width:Math.max(1,o*.09)},opacity:.8},p={type:"text",id:`${a}-text`,text:c,position:{x:h.x,y:h.y+l-o/2},width:l*2,align:"center",lineHeight:1,fontSize:o,rotation:0,color:s,bold:!0};return[h,p]}function it(t,n={}){let r=t.floors;if(!r||r.length<2)return t;let s=G(t),c=[];r.forEach((l,h)=>{let{x:p,y:x}=s[h].translation;for(let b of l.objects)h>0&&b.type==="shape"&&b.role==="stage"||c.push($(b,p,x))});let o={...t,objects:c,floors:void 0},e=v(o,{freeText:"exclude"}),i=Math.max(1,e.width,e.height),a=t.theme?.textColor??"#94a3b8";for(let l of s)c.push(...H(l,n.labelStyle??"number",i,a));return{...o,objects:c,referenceImage:void 0,backgroundImage:void 0}}function ct(t){if(!t.floors||t.floors.length<2)return t;let n=!t.zones?.length,r=new Set,s=t.floors.flatMap(o=>o.objects.flatMap(e=>{if(e.type==="shape"&&e.role==="stage"){let i=JSON.stringify([e.kind,e.x,e.y,e.width,e.height,e.points,e.rotation??0,e.label,e.heightM,e.eventConfigurationIds]);if(r.has(i))return[];r.add(i)}return n&&e.type==="section"?[{...e,zone:Y(o.id)}]:[e]})),c=n?t.floors.map(o=>({id:Y(o.id),label:o.name,focalPoint:{...o.focalPoint}})):t.zones;return{...t,objects:s,zones:c,floors:void 0,referenceImage:void 0,backgroundImage:X(t)}}function V(t){return t.floorOverview==="combined"?"combined":"separated"}function lt(t){let n=t.floors??[];if(n.length<2||n.some(c=>!c.objects.some(o=>Z.has(o.type))))return"separated";let r=z.get(t);if(r)return r;let s=K(t)?"separated":"combined";return z.set(t,s),s}var Z=new Set(["row","table","booth","gaArea","section"]),q=.1,D=18,z=new WeakMap;function K(t){let n=t.floors??[],r=(o,e)=>`${Math.floor(o/D)}:${Math.floor(e/D)}`,s=n.map(o=>{let e=B(L(t,o.objects,o.focalPoint)).map(a=>({x:a.x,y:a.y})),i={areas:[],seats:new Map};for(let a of o.objects)a.type==="section"&&a.outline?.length>=3&&i.areas.push({outer:a.outline,holes:a.holes}),a.type==="gaArea"&&a.points?.length>=3&&i.areas.push({outer:a.points,holes:a.holes});for(let a of e){let l=r(a.x,a.y),h=i.seats.get(l);h?h.push(a):i.seats.set(l,[a])}return{seats:e,footprint:i}}),c=(o,e)=>{let i=Math.floor(o.x/D),a=Math.floor(o.y/D);for(let l=-1;l<=1;l+=1)for(let h=-1;h<=1;h+=1)for(let p of e.seats.get(`${i+l}:${a+h}`)??[])if(Math.hypot(p.x-o.x,p.y-o.y)<D)return!0;return!1};return s.some((o,e)=>{if(!o.seats.length)return!1;let i=s.filter((l,h)=>h!==e).map(l=>l.footprint),a=0;for(let l of o.seats)i.some(h=>h.areas.some(p=>T(l,p.outer,p.holes))||c(l,h))&&(a+=1);return a/o.seats.length>q})}var R="level-context:";function ht(t,n){let r=t.floors??[];if(r.length<2||V(t)!=="combined")return[];let s="#8a93a6",c=[],o=r.find(i=>i.id===n),e=o?v(L(t,o.objects,o.focalPoint),{freeText:"exclude"}):null;for(let i of r){if(i.id===n)continue;let a=0;for(let x of i.objects){let b=x.type==="section"?x.outline:x.type==="gaArea"?x.points:null;if(!b||b.length<3)continue;let d={type:"shape",id:`${R}${i.id}:${a++}`,kind:"polygon",label:"",points:b.map(m=>({...m})),fill:"transparent",stroke:{color:s,width:1.5},opacity:.35};c.push(d)}let l=v(L(t,i.objects,i.focalPoint),{freeText:"exclude"});if(!a||!e||!J(l,e))continue;let h=c.filter(x=>x.type==="shape"&&x.id.startsWith(`${R}${i.id}:`)&&!!x.points),p=h.reduce((x,b)=>Q(b.points)>Q(x.points)?b:x,h[0]);c.push({type:"text",id:`${R}${i.id}:name`,text:i.name??i.id,position:j(p.points,void 0),fontSize:Math.max(1,Math.max(e.width,e.height)*.024),rotation:0,color:s,opacity:.6})}return c}function J(t,n){return t.x>=n.x&&t.y>=n.y&&t.x+t.width<=n.x+n.width&&t.y+t.height<=n.y+n.height}function Q(t){let n=t.map(s=>s.x),r=t.map(s=>s.y);return(Math.max(...n)-Math.min(...n))*(Math.max(...r)-Math.min(...r))}function ft(t){let n=t.floors;if(!n?.length)return null;let r=n.find(o=>o.objects.some(e=>e.type==="shape"&&e.role==="stage"));if(r)return r.id;let s=n[0],c=-1;for(let o of n){let e=v(L(t,o.objects,o.focalPoint),{freeText:"exclude"}),i=e.width*e.height;i>c&&(c=i,s=o)}return s.id}var ut=640;function mt(t,n){return(t.floors?.length??0)<2?null:"all"}var tt=9;function et(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let n=t.width/2,r=t.height/2,s=t.rotation??0;if(!s)return{hx:n,hy:r};let c=s*Math.PI/180,o=Math.abs(Math.cos(c)),e=Math.abs(Math.sin(c));return{hx:n*o+r*e,hy:n*e+r*o}}function nt(t,n,r){let s=n-t.seat.x,c=r-t.seat.y;if(t.shape.kind==="circle")return s*s+c*c<=t.shape.r*t.shape.r;let o=t.shape.rotation??0,e=s,i=c;if(o){let a=-o*Math.PI/180,l=Math.cos(a),h=Math.sin(a);e=s*l-c*h,i=s*h+c*l}return Math.abs(e)<=t.shape.width/2&&Math.abs(i)<=t.shape.height/2}function ot(t,n,r,s,c){if(t.shape.kind==="circle"){let d=Math.min(Math.max(t.seat.x,n),s),m=Math.min(Math.max(t.seat.y,r),c),y=t.seat.x-d,g=t.seat.y-m;return y*y+g*g<=t.shape.r*t.shape.r}let o=t.shape.rotation??0;if(!o)return t.seat.x-t.hx<=s&&t.seat.x+t.hx>=n&&t.seat.y-t.hy<=c&&t.seat.y+t.hy>=r;let e=o*Math.PI/180,i=Math.cos(e),a=Math.sin(e),l=t.shape.width/2,h=t.shape.height/2,p=[[-l,-h],[l,-h],[l,h],[-l,h]].map(([d,m])=>[t.seat.x+d*i-m*a,t.seat.y+d*a+m*i]),x=[[n,r],[s,r],[s,c],[n,c]],b=[[1,0],[0,1],[i,a],[-a,i]];for(let[d,m]of b){let y=1/0,g=-1/0;for(let[O,k]of p){let f=O*d+k*m;f<y&&(y=f),f>g&&(g=f)}let S=1/0,I=-1/0;for(let[O,k]of x){let f=O*d+k*m;f<S&&(S=f),f>I&&(I=f)}if(g<S||I<y)return!1}return!0}function yt(t,n={}){let r=n.seatRadius??tt,s=t.length,c=new Array(s),o=1/0,e=1/0,i=-1/0,a=-1/0,l=0;for(let f=0;f<s;f++){let u=t[f],F=n.shapeOf?.(u)??{kind:"circle",r},{hx:w,hy:M}=et(F);c[f]={seat:u,shape:F,hx:w,hy:M},u.x-w<o&&(o=u.x-w),u.y-M<e&&(e=u.y-M),u.x+w>i&&(i=u.x+w),u.y+M>a&&(a=u.y+M),w>l&&(l=w),M>l&&(l=M)}s===0&&(o=0,e=0,i=0,a=0);let h=l>0?l*4:1,p=Math.max(i-o,0),x=Math.max(a-e,0),b=Math.max(64,n.maxCells??s*4),d=h,m=Math.max(1,Math.ceil(p/d)||1),y=Math.max(1,Math.ceil(x/d)||1);for(;m*y>b&&(m>1||y>1);)d*=2,m=Math.max(1,Math.ceil(p/d)||1),y=Math.max(1,Math.ceil(x/d)||1);let g=m*y,S=new Int32Array(g+1),I=0;for(let f=0;f<s;f++){let u=c[f],F=_(Math.floor((u.seat.x-u.hx-o)/d),0,m-1),w=_(Math.floor((u.seat.x+u.hx-o)/d),0,m-1),M=_(Math.floor((u.seat.y-u.hy-e)/d),0,y-1),E=_(Math.floor((u.seat.y+u.hy-e)/d),0,y-1);for(let P=M;P<=E;P++)for(let C=F;C<=w;C++)S[P*m+C+1]++,I++}for(let f=0;f<g;f++)S[f+1]+=S[f];let O=new Int32Array(I),k=S.slice(0,g);for(let f=0;f<s;f++){let u=c[f],F=_(Math.floor((u.seat.x-u.hx-o)/d),0,m-1),w=_(Math.floor((u.seat.x+u.hx-o)/d),0,m-1),M=_(Math.floor((u.seat.y-u.hy-e)/d),0,y-1),E=_(Math.floor((u.seat.y+u.hy-e)/d),0,y-1);for(let P=M;P<=E;P++)for(let C=F;C<=w;C++){let A=P*m+C;O[k[A]++]=f}}return{seats:t,entries:c,minX:o,minY:e,cell:d,cols:m,rows:y,cellStart:S,items:O,stamp:new Int32Array(s),epoch:0}}function pt(t,n,r={}){let{cols:s,rows:c,cell:o,minX:e,minY:i,cellStart:a,items:l,entries:h}=t,p=Math.floor((n.x-e)/o),x=Math.floor((n.y-i)/o);if(p<0||x<0||p>=s||x>=c)return null;let b=x*s+p,d=a[b+1],m=-1,y=1/0;for(let g=a[b];g<d;g++){let S=l[g],I=h[S];if(r.filter&&!r.filter(I.seat.id,I.seat)||!nt(I,n.x,n.y))continue;let O=n.x-I.seat.x,k=n.y-I.seat.y,f=O*O+k*k;(f<y||f===y&&S<m)&&(y=f,m=S)}return m<0?null:h[m].seat.id}function bt(t,n,r,s={}){if(!(r>0))return null;let{cols:c,rows:o,cell:e,minX:i,minY:a,cellStart:l,items:h,entries:p}=t,x=Math.max(0,Math.floor((n.x-r-i)/e)),b=Math.min(c-1,Math.floor((n.x+r-i)/e)),d=Math.max(0,Math.floor((n.y-r-a)/e)),m=Math.min(o-1,Math.floor((n.y+r-a)/e));if(x>b||d>m)return null;let y=-1,g=r*r,S=t.stamp,I=++t.epoch;for(let O=d;O<=m;O++){let k=O*c;for(let f=x;f<=b;f++){let u=k+f,F=l[u+1];for(let w=l[u];w<F;w++){let M=h[w];if(S[M]===I)continue;S[M]=I;let E=p[M];if(s.filter&&!s.filter(E.seat.id,E.seat))continue;let P=n.x-E.seat.x,C=n.y-E.seat.y,A=P*P+C*C;(A<g||A===g&&M<y)&&(g=A,y=M)}}}return y<0?null:p[y].seat.id}function gt(t,n,r={}){let s=Math.min(n.x,n.x+n.width),c=Math.max(n.x,n.x+n.width),o=Math.min(n.y,n.y+n.height),e=Math.max(n.y,n.y+n.height),i=r.mode??"center",{cols:a,rows:l,cell:h,minX:p,minY:x,cellStart:b,items:d,entries:m}=t,y=Math.max(0,Math.floor((s-p)/h)),g=Math.min(a-1,Math.floor((c-p)/h)),S=Math.max(0,Math.floor((o-x)/h)),I=Math.min(l-1,Math.floor((e-x)/h));if(y>g||S>I)return[];let O=[],k=t.stamp,f=++t.epoch;for(let u=S;u<=I;u++){let F=u*a;for(let w=y;w<=g;w++){let M=F+w,E=b[M+1];for(let P=b[M];P<E;P++){let C=d[P];if(k[C]===f)continue;k[C]=f;let A=m[C];if(r.filter&&!r.filter(A.seat.id,A.seat))continue;(i==="center"?A.seat.x>=s&&A.seat.x<=c&&A.seat.y>=o&&A.seat.y<=e:ot(A,s,o,c,e))&&O.push(C)}}}return O.sort((u,F)=>u-F),O.map(u=>m[u].seat.id)}function Mt(t){let n=t.cols*t.rows,r=0,s=0;for(let o=0;o<n;o++){let e=t.cellStart[o+1]-t.cellStart[o];e>0&&r++,e>s&&(s=e)}let c=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:n,occupiedCells:r,refs:c,maxPerCell:s,meanPerOccupiedCell:r?c/r:0}}export{W as a,Y as b,G as c,it as d,ct as e,V as f,lt as g,q as h,R as i,ht as j,ft as k,ut as l,mt as m,tt as n,yt as o,pt as p,bt as q,gt as r,Mt as s};
1
+ import{l as X}from"./chunk-M4NGX5NM.js";import{O as _,Xa as T,Ya as j,cb as $,eb as B,fb as v}from"./chunk-J33DNOMI.js";var W=.08,N=.045;function Y(t){return`__floor__:${encodeURIComponent(t)}`}function L(t,n,r){return{...t,objects:n,floors:void 0,...r?{focalPoint:r}:{},referenceImage:void 0,backgroundImage:void 0}}function U(t,n,r){let s=t.focalPoint??n.focalPoint;return s?s.x:r.x+r.width/2}function G(t){let n=t.floors??[];if(!n.length)return[];let r=n.map(e=>v(L(t,e.objects,e.focalPoint),{freeText:"exclude"})),c=Math.max(1,...r.map(e=>e.width))*W,o=0;return n.map((e,i)=>{let a=r[i],l=o-(a.y+a.height);return o-=a.height+c,{floorId:e.id,label:e.name??e.id,level:i,levelBadge:i===0?"G":String(i),translation:{x:-U(e,t,a),y:l},bounds:a}})}function H(t,n,r,s){let c=n==="name"?t.label:t.levelBadge;if(!c)return[];let o=Math.max(1,r*N),e=t.bounds.x+t.translation.x-o*2.4,i=t.bounds.y+t.translation.y+o*.4,a=`floor-level-${t.floorId}`;if(n==="name")return[{type:"text",id:`${a}-text`,text:c,position:{x:e,y:i},fontSize:o,rotation:0,color:s,bold:!0}];let l=o*.95,h={type:"shape",id:`${a}-badge`,kind:"ellipse",x:e-l*.35,y:i-l*.3,width:l*2,height:l*2,fill:"transparent",stroke:{color:s,width:Math.max(1,o*.09)},opacity:.8},p={type:"text",id:`${a}-text`,text:c,position:{x:h.x,y:h.y+l-o/2},width:l*2,align:"center",lineHeight:1,fontSize:o,rotation:0,color:s,bold:!0};return[h,p]}function it(t,n={}){let r=t.floors;if(!r||r.length<2)return t;let s=G(t),c=[];r.forEach((l,h)=>{let{x:p,y:x}=s[h].translation;for(let b of l.objects)h>0&&b.type==="shape"&&b.role==="stage"||c.push($(b,p,x))});let o={...t,objects:c,floors:void 0},e=v(o,{freeText:"exclude"}),i=Math.max(1,e.width,e.height),a=t.theme?.textColor??"#94a3b8";for(let l of s)c.push(...H(l,n.labelStyle??"number",i,a));return{...o,objects:c,referenceImage:void 0,backgroundImage:void 0}}function ct(t){if(!t.floors||t.floors.length<2)return t;let n=!t.zones?.length,r=new Set,s=t.floors.flatMap(o=>o.objects.flatMap(e=>{if(e.type==="shape"&&e.role==="stage"){let i=JSON.stringify([e.kind,e.x,e.y,e.width,e.height,e.points,e.rotation??0,e.label,e.heightM,e.eventConfigurationIds]);if(r.has(i))return[];r.add(i)}return n&&e.type==="section"?[{...e,zone:Y(o.id)}]:[e]})),c=n?t.floors.map(o=>({id:Y(o.id),label:o.name,focalPoint:{...o.focalPoint}})):t.zones;return{...t,objects:s,zones:c,floors:void 0,referenceImage:void 0,backgroundImage:X(t)}}function V(t){return t.floorOverview==="combined"?"combined":"separated"}function lt(t){let n=t.floors??[];if(n.length<2||n.some(c=>!c.objects.some(o=>Z.has(o.type))))return"separated";let r=z.get(t);if(r)return r;let s=K(t)?"separated":"combined";return z.set(t,s),s}var Z=new Set(["row","table","booth","gaArea","section"]),q=.1,D=18,z=new WeakMap;function K(t){let n=t.floors??[],r=(o,e)=>`${Math.floor(o/D)}:${Math.floor(e/D)}`,s=n.map(o=>{let e=B(L(t,o.objects,o.focalPoint)).map(a=>({x:a.x,y:a.y})),i={areas:[],seats:new Map};for(let a of o.objects)a.type==="section"&&a.outline?.length>=3&&i.areas.push({outer:a.outline,holes:a.holes}),a.type==="gaArea"&&a.points?.length>=3&&i.areas.push({outer:a.points,holes:a.holes});for(let a of e){let l=r(a.x,a.y),h=i.seats.get(l);h?h.push(a):i.seats.set(l,[a])}return{seats:e,footprint:i}}),c=(o,e)=>{let i=Math.floor(o.x/D),a=Math.floor(o.y/D);for(let l=-1;l<=1;l+=1)for(let h=-1;h<=1;h+=1)for(let p of e.seats.get(`${i+l}:${a+h}`)??[])if(Math.hypot(p.x-o.x,p.y-o.y)<D)return!0;return!1};return s.some((o,e)=>{if(!o.seats.length)return!1;let i=s.filter((l,h)=>h!==e).map(l=>l.footprint),a=0;for(let l of o.seats)i.some(h=>h.areas.some(p=>T(l,p.outer,p.holes))||c(l,h))&&(a+=1);return a/o.seats.length>q})}var R="level-context:";function ht(t,n){let r=t.floors??[];if(r.length<2||V(t)!=="combined")return[];let s="#8a93a6",c=[],o=r.find(i=>i.id===n),e=o?v(L(t,o.objects,o.focalPoint),{freeText:"exclude"}):null;for(let i of r){if(i.id===n)continue;let a=0;for(let x of i.objects){let b=x.type==="section"?x.outline:x.type==="gaArea"?x.points:null;if(!b||b.length<3)continue;let d={type:"shape",id:`${R}${i.id}:${a++}`,kind:"polygon",label:"",points:b.map(m=>({...m})),fill:"transparent",stroke:{color:s,width:1.5},opacity:.35};c.push(d)}let l=v(L(t,i.objects,i.focalPoint),{freeText:"exclude"});if(!a||!e||!J(l,e))continue;let h=c.filter(x=>x.type==="shape"&&x.id.startsWith(`${R}${i.id}:`)&&!!x.points),p=h.reduce((x,b)=>Q(b.points)>Q(x.points)?b:x,h[0]);c.push({type:"text",id:`${R}${i.id}:name`,text:i.name??i.id,position:j(p.points,void 0),fontSize:Math.max(1,Math.max(e.width,e.height)*.024),rotation:0,color:s,opacity:.6})}return c}function J(t,n){return t.x>=n.x&&t.y>=n.y&&t.x+t.width<=n.x+n.width&&t.y+t.height<=n.y+n.height}function Q(t){let n=t.map(s=>s.x),r=t.map(s=>s.y);return(Math.max(...n)-Math.min(...n))*(Math.max(...r)-Math.min(...r))}function ft(t){let n=t.floors;if(!n?.length)return null;let r=n.find(o=>o.objects.some(e=>e.type==="shape"&&e.role==="stage"));if(r)return r.id;let s=n[0],c=-1;for(let o of n){let e=v(L(t,o.objects,o.focalPoint),{freeText:"exclude"}),i=e.width*e.height;i>c&&(c=i,s=o)}return s.id}var ut=640;function mt(t,n){return(t.floors?.length??0)<2?null:"all"}var tt=9;function et(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let n=t.width/2,r=t.height/2,s=t.rotation??0;if(!s)return{hx:n,hy:r};let c=s*Math.PI/180,o=Math.abs(Math.cos(c)),e=Math.abs(Math.sin(c));return{hx:n*o+r*e,hy:n*e+r*o}}function nt(t,n,r){let s=n-t.seat.x,c=r-t.seat.y;if(t.shape.kind==="circle")return s*s+c*c<=t.shape.r*t.shape.r;let o=t.shape.rotation??0,e=s,i=c;if(o){let a=-o*Math.PI/180,l=Math.cos(a),h=Math.sin(a);e=s*l-c*h,i=s*h+c*l}return Math.abs(e)<=t.shape.width/2&&Math.abs(i)<=t.shape.height/2}function ot(t,n,r,s,c){if(t.shape.kind==="circle"){let d=Math.min(Math.max(t.seat.x,n),s),m=Math.min(Math.max(t.seat.y,r),c),y=t.seat.x-d,g=t.seat.y-m;return y*y+g*g<=t.shape.r*t.shape.r}let o=t.shape.rotation??0;if(!o)return t.seat.x-t.hx<=s&&t.seat.x+t.hx>=n&&t.seat.y-t.hy<=c&&t.seat.y+t.hy>=r;let e=o*Math.PI/180,i=Math.cos(e),a=Math.sin(e),l=t.shape.width/2,h=t.shape.height/2,p=[[-l,-h],[l,-h],[l,h],[-l,h]].map(([d,m])=>[t.seat.x+d*i-m*a,t.seat.y+d*a+m*i]),x=[[n,r],[s,r],[s,c],[n,c]],b=[[1,0],[0,1],[i,a],[-a,i]];for(let[d,m]of b){let y=1/0,g=-1/0;for(let[O,k]of p){let f=O*d+k*m;f<y&&(y=f),f>g&&(g=f)}let S=1/0,I=-1/0;for(let[O,k]of x){let f=O*d+k*m;f<S&&(S=f),f>I&&(I=f)}if(g<S||I<y)return!1}return!0}function yt(t,n={}){let r=n.seatRadius??tt,s=t.length,c=new Array(s),o=1/0,e=1/0,i=-1/0,a=-1/0,l=0;for(let f=0;f<s;f++){let u=t[f],F=n.shapeOf?.(u)??{kind:"circle",r},{hx:w,hy:M}=et(F);c[f]={seat:u,shape:F,hx:w,hy:M},u.x-w<o&&(o=u.x-w),u.y-M<e&&(e=u.y-M),u.x+w>i&&(i=u.x+w),u.y+M>a&&(a=u.y+M),w>l&&(l=w),M>l&&(l=M)}s===0&&(o=0,e=0,i=0,a=0);let h=l>0?l*4:1,p=Math.max(i-o,0),x=Math.max(a-e,0),b=Math.max(64,n.maxCells??s*4),d=h,m=Math.max(1,Math.ceil(p/d)||1),y=Math.max(1,Math.ceil(x/d)||1);for(;m*y>b&&(m>1||y>1);)d*=2,m=Math.max(1,Math.ceil(p/d)||1),y=Math.max(1,Math.ceil(x/d)||1);let g=m*y,S=new Int32Array(g+1),I=0;for(let f=0;f<s;f++){let u=c[f],F=_(Math.floor((u.seat.x-u.hx-o)/d),0,m-1),w=_(Math.floor((u.seat.x+u.hx-o)/d),0,m-1),M=_(Math.floor((u.seat.y-u.hy-e)/d),0,y-1),E=_(Math.floor((u.seat.y+u.hy-e)/d),0,y-1);for(let P=M;P<=E;P++)for(let C=F;C<=w;C++)S[P*m+C+1]++,I++}for(let f=0;f<g;f++)S[f+1]+=S[f];let O=new Int32Array(I),k=S.slice(0,g);for(let f=0;f<s;f++){let u=c[f],F=_(Math.floor((u.seat.x-u.hx-o)/d),0,m-1),w=_(Math.floor((u.seat.x+u.hx-o)/d),0,m-1),M=_(Math.floor((u.seat.y-u.hy-e)/d),0,y-1),E=_(Math.floor((u.seat.y+u.hy-e)/d),0,y-1);for(let P=M;P<=E;P++)for(let C=F;C<=w;C++){let A=P*m+C;O[k[A]++]=f}}return{seats:t,entries:c,minX:o,minY:e,cell:d,cols:m,rows:y,cellStart:S,items:O,stamp:new Int32Array(s),epoch:0}}function pt(t,n,r={}){let{cols:s,rows:c,cell:o,minX:e,minY:i,cellStart:a,items:l,entries:h}=t,p=Math.floor((n.x-e)/o),x=Math.floor((n.y-i)/o);if(p<0||x<0||p>=s||x>=c)return null;let b=x*s+p,d=a[b+1],m=-1,y=1/0;for(let g=a[b];g<d;g++){let S=l[g],I=h[S];if(r.filter&&!r.filter(I.seat.id,I.seat)||!nt(I,n.x,n.y))continue;let O=n.x-I.seat.x,k=n.y-I.seat.y,f=O*O+k*k;(f<y||f===y&&S<m)&&(y=f,m=S)}return m<0?null:h[m].seat.id}function bt(t,n,r,s={}){if(!(r>0))return null;let{cols:c,rows:o,cell:e,minX:i,minY:a,cellStart:l,items:h,entries:p}=t,x=Math.max(0,Math.floor((n.x-r-i)/e)),b=Math.min(c-1,Math.floor((n.x+r-i)/e)),d=Math.max(0,Math.floor((n.y-r-a)/e)),m=Math.min(o-1,Math.floor((n.y+r-a)/e));if(x>b||d>m)return null;let y=-1,g=r*r,S=t.stamp,I=++t.epoch;for(let O=d;O<=m;O++){let k=O*c;for(let f=x;f<=b;f++){let u=k+f,F=l[u+1];for(let w=l[u];w<F;w++){let M=h[w];if(S[M]===I)continue;S[M]=I;let E=p[M];if(s.filter&&!s.filter(E.seat.id,E.seat))continue;let P=n.x-E.seat.x,C=n.y-E.seat.y,A=P*P+C*C;(A<g||A===g&&M<y)&&(g=A,y=M)}}}return y<0?null:p[y].seat.id}function gt(t,n,r={}){let s=Math.min(n.x,n.x+n.width),c=Math.max(n.x,n.x+n.width),o=Math.min(n.y,n.y+n.height),e=Math.max(n.y,n.y+n.height),i=r.mode??"center",{cols:a,rows:l,cell:h,minX:p,minY:x,cellStart:b,items:d,entries:m}=t,y=Math.max(0,Math.floor((s-p)/h)),g=Math.min(a-1,Math.floor((c-p)/h)),S=Math.max(0,Math.floor((o-x)/h)),I=Math.min(l-1,Math.floor((e-x)/h));if(y>g||S>I)return[];let O=[],k=t.stamp,f=++t.epoch;for(let u=S;u<=I;u++){let F=u*a;for(let w=y;w<=g;w++){let M=F+w,E=b[M+1];for(let P=b[M];P<E;P++){let C=d[P];if(k[C]===f)continue;k[C]=f;let A=m[C];if(r.filter&&!r.filter(A.seat.id,A.seat))continue;(i==="center"?A.seat.x>=s&&A.seat.x<=c&&A.seat.y>=o&&A.seat.y<=e:ot(A,s,o,c,e))&&O.push(C)}}}return O.sort((u,F)=>u-F),O.map(u=>m[u].seat.id)}function Mt(t){let n=t.cols*t.rows,r=0,s=0;for(let o=0;o<n;o++){let e=t.cellStart[o+1]-t.cellStart[o];e>0&&r++,e>s&&(s=e)}let c=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:n,occupiedCells:r,refs:c,maxPerCell:s,meanPerOccupiedCell:r?c/r:0}}export{W as a,Y as b,G as c,it as d,ct as e,V as f,lt as g,q as h,R as i,ht as j,ft as k,ut as l,mt as m,tt as n,yt as o,pt as p,bt as q,gt as r,Mt as s};
@@ -1 +1 @@
1
- import{N as c}from"./chunk-5R6I2XL7.js";function s(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let i=e[n],a=e[(n+1)%o];t+=i.x*a.y-a.x*i.y}return t/2}function g(e){return s(e)*2}function X(e,t,n){let o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let r=e[i],u=e[a];r.y>n!=u.y>n&&t<(u.x-r.x)*(n-r.y)/(u.y-r.y)+r.x&&(o=!o)}return o}var l=.15,x=1.6;function O(e){return c(e??1,l,x)}var Y=["in","out","both"];function p(e){return e?.type==="shape"&&e.gate!=null&&typeof e.gate=="object"}function T(e){return e?.type==="shape"&&!e.gate&&(e.role==="entrance"||e.role==="exit")&&e.kind!=="line"&&e.kind!=="polyline"}function C(e){return e.type==="row"||e.type==="section"||e.type==="table"||e.type==="booth"||e.type==="gaArea"}function B(e){return e==="out"?"exit":"entrance"}function m(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function f(e){let t=new Map;for(let n of m(e))p(n)&&t.set(n.id,n);return t}function I(e){if(e.gate.hideFromBuyers)return;let t=e.label?.normalize("NFKC").trim();return t?t.slice(0,40):void 0}function R(e){let t=new Set([...f(e).values()].map(n=>n.label?.trim().toLowerCase()));for(let n=0;n<26;n++){let o=`Gate ${String.fromCharCode(65+n)}`;if(!t.has(o.toLowerCase()))return o}for(let n=27;;n++)if(!t.has(`gate ${n}`))return`Gate ${n}`}function _(e,t,n){let o=t*.46,i=Math.max(e.length,2)*o*.6,a=n?o*1.25:0;return Math.round(i+a+t)}function d(e){let t=1/0,n=1/0,o=-1/0,i=-1/0,a=!1;for(let r of e)!Number.isFinite(r.x)||!Number.isFinite(r.y)||(a=!0,r.x<t&&(t=r.x),r.y<n&&(n=r.y),r.x>o&&(o=r.x),r.y>i&&(i=r.y));return a?{minX:t,minY:n,maxX:o,maxY:i}:null}function j(e){let t=d(e);return t?y(t):null}function y(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function w(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{d as a,j as b,w as c,s as d,g as e,X as f,l as g,x as h,O as i,Y as j,p as k,T as l,C as m,B as n,f as o,I as p,R as q,_ as r};
1
+ import{N as c}from"./chunk-J33DNOMI.js";function s(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let i=e[n],a=e[(n+1)%o];t+=i.x*a.y-a.x*i.y}return t/2}function g(e){return s(e)*2}function X(e,t,n){let o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let r=e[i],u=e[a];r.y>n!=u.y>n&&t<(u.x-r.x)*(n-r.y)/(u.y-r.y)+r.x&&(o=!o)}return o}var l=.15,x=1.6;function O(e){return c(e??1,l,x)}var Y=["in","out","both"];function p(e){return e?.type==="shape"&&e.gate!=null&&typeof e.gate=="object"}function T(e){return e?.type==="shape"&&!e.gate&&(e.role==="entrance"||e.role==="exit")&&e.kind!=="line"&&e.kind!=="polyline"}function C(e){return e.type==="row"||e.type==="section"||e.type==="table"||e.type==="booth"||e.type==="gaArea"}function B(e){return e==="out"?"exit":"entrance"}function m(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function f(e){let t=new Map;for(let n of m(e))p(n)&&t.set(n.id,n);return t}function I(e){if(e.gate.hideFromBuyers)return;let t=e.label?.normalize("NFKC").trim();return t?t.slice(0,40):void 0}function R(e){let t=new Set([...f(e).values()].map(n=>n.label?.trim().toLowerCase()));for(let n=0;n<26;n++){let o=`Gate ${String.fromCharCode(65+n)}`;if(!t.has(o.toLowerCase()))return o}for(let n=27;;n++)if(!t.has(`gate ${n}`))return`Gate ${n}`}function _(e,t,n){let o=t*.46,i=Math.max(e.length,2)*o*.6,a=n?o*1.25:0;return Math.round(i+a+t)}function d(e){let t=1/0,n=1/0,o=-1/0,i=-1/0,a=!1;for(let r of e)!Number.isFinite(r.x)||!Number.isFinite(r.y)||(a=!0,r.x<t&&(t=r.x),r.y<n&&(n=r.y),r.x>o&&(o=r.x),r.y>i&&(i=r.y));return a?{minX:t,minY:n,maxX:o,maxY:i}:null}function j(e){let t=d(e);return t?y(t):null}function y(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function w(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{d as a,j as b,w as c,s as d,g as e,X as f,l as g,x as h,O as i,Y as j,p as k,T as l,C as m,B as n,f as o,I as p,R as q,_ as r};
@@ -0,0 +1 @@
1
+ import{m as S}from"./chunk-R6BN4HDQ.js";import{$a as A,N as f,ja as w}from"./chunk-J33DNOMI.js";var j=36,x=160;function v(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;if(!a)return{automatic:i,slots:[]};let c=a,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{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:"none";return{start:t==="start"||t==="both",end:t==="end"||t==="both"}}function p(e,t){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,v as c,l as d,D as e,I as f,E as g,N as h,U as i};