@seatlayer/core 0.106.0 → 0.106.1

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 (33) hide show
  1. package/dist/{chunk-BVEVCXMJ.js → chunk-3DHQYZ47.js} +1 -1
  2. package/dist/{chunk-HYTPOZJY.js → chunk-3YNO3XCY.js} +1 -1
  3. package/dist/{chunk-HKVCBUON.js → chunk-5R6I2XL7.js} +1 -1
  4. package/dist/{chunk-O4ZAGGMP.js → chunk-C5GKFG36.js} +1 -1
  5. package/dist/{chunk-QFX6XSO6.js → chunk-FQTSVDD4.js} +1 -1
  6. package/dist/{chunk-BF3XROP5.js → chunk-INCPWAWP.js} +1 -1
  7. package/dist/{chunk-4VVFOAKY.js → chunk-M4J7U2E2.js} +1 -1
  8. package/dist/chunk-M4NGX5NM.js +1 -0
  9. package/dist/{chunk-UKODEMIM.js → chunk-MLPJTJFE.js} +1 -1
  10. package/dist/chunk-S3VH7IDA.js +1 -0
  11. package/dist/{chunk-A2S3YDR5.js → chunk-TAKLS47V.js} +1 -1
  12. package/dist/{chunk-SH3ZYWJT.js → chunk-UGMXII72.js} +1 -1
  13. package/dist/{chunk-VHFSP53L.js → chunk-V65VJE6F.js} +1 -1
  14. package/dist/core/chart-ops/index.cjs +1 -1
  15. package/dist/core/chart-ops/index.js +1 -1
  16. package/dist/core/inventory/index.cjs +1 -1
  17. package/dist/core/inventory/index.js +1 -1
  18. package/dist/core/layout/index.cjs +1 -1
  19. package/dist/core/layout/index.js +1 -1
  20. package/dist/core/render-assets/index.js +1 -1
  21. package/dist/core/sections/index.cjs +1 -1
  22. package/dist/core/sections/index.d.cts +14 -2
  23. package/dist/core/sections/index.d.ts +14 -2
  24. package/dist/core/sections/index.js +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/view3d/index.cjs +28 -28
  28. package/dist/view3d/index.js +1 -1
  29. package/dist/view3d/scene/scene.worker.cjs +1 -1
  30. package/dist/view3d/scene/scene.worker.js +1 -1
  31. package/package.json +1 -1
  32. package/dist/chunk-KTMZ3QAO.js +0 -1
  33. package/dist/chunk-TFYAMLCK.js +0 -1
@@ -1 +1 @@
1
- import{l as X}from"./chunk-TFYAMLCK.js";import{O as _,Xa as T,Ya as j,cb as $,eb as B,fb as v}from"./chunk-HKVCBUON.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-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};