this._pointInRoom(t,e));if(!a)return;if(!confirm(this._t("confirm.delete_room",{name:a.name})))return;const l=this._curSpaceCfg;l&&(l.rooms=l.rooms.filter(t=>t.id!==a.id),this._commitOpenSpans(),this._saveConfig(),this._regSignature="",this._maybeRebuildDevices(),this.requestUpdate())}get _wallKeyPitch(){return qs}get _spaceWalls(){const t=this._curSpaceCfg?.walls;return Array.isArray(t)?t:[]}_cfgOpenCuts(){return uo(this._curSpaceCfg?.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]])}_intervalCm(t){return eo(this._spaceModel().rooms,this._spaceWalls,this._openCuts(),t,this._wallKeyPitch,this._cellCm,this._gridPitch,ea)}_normalizeWalls(t,e){return On(to(this._spaceModel().rooms,t,e,this._wallKeyPitch,this._cellCm,this._gridPitch,ea),this._curSpaceCfg?.rooms||[],qs,1,e.map(t=>[t[0]/ea,t[1]/ea,t[2]/ea,t[3]/ea]))}_paperShapes(t){const e=this._spaceWalls;if(!e.length)return Me(t);const i=this._openPairs().flatMap(t=>t.segs);return ao(t,e,i,this._wallKeyPitch,this._cellCm,this._gridPitch,ea)}_thickWallCuts(){const t=this._spaceWalls;if(!t.length)return[];const e=this._openPairs().flatMap(t=>t.segs);return function(t,e,i,s,n,o,r=1){if(!e?.length)return[];const a=new Set,l=[];for(const c of t||[]){if(!c?.id)continue;const h=Jn(t,c.id,e,i,s,n,o,r);if(!h)continue;const d=h.poly;for(let t=0;t t[0]-e[0]);const c=[];for(const t of l){const i=c[c.length-1];i&&t[0]<=i[1]+e?i[1]=Math.max(i[1],t[1]):c.push([t[0],t[1]])}for(const[t,e]of c)r.push([[a[0]+i*t,a[1]+s*t],[a[0]+i*e,a[1]+s*e]])}return r}(t))}}const c=this._sunRaysCache.rays,h=this._sunRaysCache.rims;if(!c.length)return e;const d=(p=ms(s.elevation).warmth,ki("#ffe9c2","#ff9a45",gs(p)));var p;const u=[[0,1],[.26,.86],[.46,.6],[.64,.32],[.77,.1],[.85,0],[1,0]],_=function(t=1){return.42*gs(t)}(o),g=[[0,1],[.26,.86],[.46,.6],[.64,.32],[.77,.1],[.85,0],[1,0]];return j`
@@ -2804,14 +2832,14 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
t[0]-e[0]);const c=[];for(const t of l){const i=c[c.length-1];i&&t[0]<=i[1]+e?i[1]=Math.max(i[1],t[1]):c.push([t[0],t[1]])}for(const[t,e]of c)r.push([[a[0]+i*t,a[1]+s*t],[a[0]+i*e,a[1]+s*e]])}return r}(t))}}const c=this._sunRaysCache.rays,h=this._sunRaysCache.rims;if(!c.length)return e;const d=(p=fs(s.elevation).warmth,ki("#ffe9c2","#ff9a45",ms(p)));var p;const u=[[0,1],[.26,.86],[.46,.6],[.64,.32],[.77,.1],[.85,0],[1,0]],_=function(t=1){return.42*ms(t)}(n),g=[[0,1],[.26,.86],[.46,.6],[.64,.32],[.77,.1],[.85,0],[1,0]];return j`b?p.c=p.e=null:t.e0)for(;e--;h[i++]=0);for(e=$t-1;s>a;){if(h[--s]0)return-1;const s=e.comparePoint(t.rightSE.point);return 0!==s?s:-1}if(i.isGreaterThan(s)){if(r.isLessThan(a)&&r.isLessThan(c))return-1;if(r.isGreaterThan(a)&&r.isGreaterThan(c))return 1;const i=e.comparePoint(t.leftSE.point);if(0!==i)return i;const s=t.comparePoint(e.rightSE.point);return s<0?1:s>0?-1:1}if(r.isLessThan(a))return-1;if(r.isGreaterThan(a))return 1;if(n.isLessThan(o)){const i=e.comparePoint(t.rightSE.point);if(0!==i)return i}if(n.isGreaterThan(o)){const i=t.comparePoint(e.rightSE.point);if(i<0)return 1;if(i>0)return-1}if(!n.eq(o)){const t=l.minus(r),e=n.minus(i),h=c.minus(a),d=o.minus(s);if(t.isGreaterThan(e)&&h.isLessThan(d))return 1;if(t.isLessThan(e)&&h.isGreaterThan(d))return-1}return n.isGreaterThan(o)?1:n.isLessThan(o)||l.isLessThan(c)?-1:l.isGreaterThan(c)?1:t.ids||h>s)continue;const d=Gi(Vi(o,e),a),p=Gi(Vi(l,e),a),u=Math.max(0,Math.min(d,p)),_=Math.min(r,Math.max(d,p));_-u>s&&n.push([[e[0]+a[0]*u,e[1]+a[1]*u],[e[0]+a[0]*_,e[1]+a[1]*_]])}return n}function es(t,e,i,s,n){const o=ts(t,e,i,n);if(!o.length)return null;const r=t=>o.some(([e,i])=>Xi(t,e,i)<=n),a=t.length,l=[];for(let o=0;on||f>n)continue;const v=Gi(Vi(e,c),u),b=Gi(Vi(i,c),u),y=Math.max(0,Math.min(v,b)),w=Math.min(p,Math.max(v,b));if(!(w-y<=n)){if(y>n&&yMath.abs(r+(t-p)/m*(a-r));s=Math.min(s,f(_),f(g))}}return s}function os(t,e,i){if(We(t,e,i))return!0;if(He(t,e,i)||He(e,t,i))return!1;let s=0;try{const i=be([[...t.map(t=>[t[0],t[1]]),[t[0][0],t[0][1]]]],[[...e.map(t=>[t[0],t[1]]),[e[0][0],e[0][1]]]]);for(const t of i)t?.[0]&&(s+=je(t[0]))}catch{return!1}return s>Math.max(1e-7,i*i)}function rs(t,e,i,s,n){const o=[i.n[0]*s,i.n[1]*s],r={polys:{},openings:{},movedSpans:{}};if(Math.abs(s)<1e-9)return r;for(const e of t){if(e.id===i.roomId){r.polys[e.id]=Qi(e.poly,i.edge,s,i.n),r.movedSpans[e.id]=[[Ki(i.a,o),Ki(i.b,o)]];continue}const t=ts(e.poly,i.a,i.b,n);if(!t.length)continue;const a=es(e.poly,i.a,i.b,o,n);a&&(r.polys[e.id]=a,r.movedSpans[e.id]=t.map(([t,e])=>[Ki(t,o),Ki(e,o)]))}for(const t of e)Xi([t.x,t.y],i.a,i.b)<=n&&(r.openings[t.id]=[t.x+o[0],t.y+o[1]]);return r}function as(t,e,i){for(const s of e)for(let e=0;eb?p.c=p.e=null:t.e0)for(;e--;h[i++]=0);for(e=$t-1;s>a;){if(h[--s]0)return-1;const s=e.comparePoint(t.rightSE.point);return 0!==s?s:-1}if(i.isGreaterThan(s)){if(r.isLessThan(a)&&r.isLessThan(c))return-1;if(r.isGreaterThan(a)&&r.isGreaterThan(c))return 1;const i=e.comparePoint(t.leftSE.point);if(0!==i)return i;const s=t.comparePoint(e.rightSE.point);return s<0?1:s>0?-1:1}if(r.isLessThan(a))return-1;if(r.isGreaterThan(a))return 1;if(o.isLessThan(n)){const i=e.comparePoint(t.rightSE.point);if(0!==i)return i}if(o.isGreaterThan(n)){const i=t.comparePoint(e.rightSE.point);if(i<0)return 1;if(i>0)return-1}if(!o.eq(n)){const t=l.minus(r),e=o.minus(i),h=c.minus(a),d=n.minus(s);if(t.isGreaterThan(e)&&h.isLessThan(d))return 1;if(t.isLessThan(e)&&h.isGreaterThan(d))return-1}return o.isGreaterThan(n)?1:o.isLessThan(n)||l.isLessThan(c)?-1:l.isGreaterThan(c)?1:t.id