diff --git a/NextFloor/assets/nextfloor-3d.js b/NextFloor/assets/nextfloor-3d.js index b17981e..1141274 100644 --- a/NextFloor/assets/nextfloor-3d.js +++ b/NextFloor/assets/nextfloor-3d.js @@ -1,11 +1,11 @@ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ -var M0=1.3,S0=(i,e=new Date().toISOString().slice(0,10))=>!!i.due&&i.due<=e;var Dl={lawn:.012,terrace:.12,path:.02,driveway:.02,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function Jr(i){return i==="hedge"||i==="fence"||i==="pergola"}function Kh(i,e,t){let n=i.slope??0;if(!n||i.type==="pool")return 0;let r=i.slope_dir??"x",s=(c,u)=>r==="x"?c:r==="-x"?-c:r==="z"?u:-u,o=1/0,a=-1/0;for(let[c,u]of i.points){let h=s(c,u);o=Math.min(o,h),a=Math.max(a,h)}if(a-o<1e-6)return 0;let l=Math.min(1,Math.max(0,(s(e,t)-o)/(a-o)));return n*l}function d1(i,e,t,n){return jo(i)+(e.offset??0)+Dl[e.type]-Kh(e,t,n)}function jo(i){return i.elevation>.3?0:-.2}function w0(i,e,t){let n=(i.outdoor??[]).filter(s=>!Jr(s.type)&&s.type!=="pool"&&Ge([e,t],s.points)),r=[...n].reverse().find(s=>s.cut)??n[0];return r?d1(i,r,e,t):jo(i)}var T0=i=>i.cut??i.type==="pool";var p1={type:"none",pitch:35,overhang:.4},A0="#d6cfc2",Zh="#e8e3da",ZP={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...p1}};var E0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),Ul=1.75;function R0(i){return E0.has(i)||!!vt(i)?.light}var m1=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function jr(i){switch(i.type){case"home_battery":return i.variant==="wall"?.5:0;case"kitchen_wall":return 1.45;case"tv_wall":return Math.max(0,1.3-i.h/2);case"radiator":return .12;case"inverter":return 1.1;case"wallbox":return 1;case"meter":return .4;default:return 0}}var C0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan"]);function P0(i,e){return i.filter(t=>t.elevationt.rooms.filter(n=>n.points.length>=3&&n.ceiling!=null&&n.ceiling>t.height+.005&&t.elevation+n.ceiling>e.elevation+.05)).map(t=>t.points)}var Qr=i=>i?.floor_offset&&Number.isFinite(i.floor_offset)?i.floor_offset:0;function I0(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&r.floor_offset&&Ge([e,t],r.points));return Qr(n)}function Jh(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&Ge([e,t],r.points));return n?.ceiling!=null&&n.ceiling>0?n.ceiling:i.height}var Bl=(i,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:Jh(i,e.x,e.z);function L0(i,e,t){let n=0;for(let r of i.furniture)!(m1.has(r.type)||vt(r.type)?.surface)||!Ge([e,t],ts(r))||(n=Math.max(n,r.h));return n}var g1=new Set([...E0,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]);var x1=["interior","front","front_glass","sidelight","sidelights","glass","sliding","passage"],b1=["standard","bars","glass_wall"];function vr(i,e){return i.type==="door"?i.style&&x1.includes(i.style)?i.style:e?"front":"interior":i.style&&b1.includes(i.style)?i.style:"standard"}function F0(i,e,t,n){if(e!=="sidelight"&&e!=="sidelights")return null;let r=e==="sidelights",s=i-.04,o=Math.min(1.05,Math.max(.6,s-(r?.6:.3))),a=(s-o)/(r?2:1),l=n.sidelight_width??a,c=r?n.sidelight_width2??n.sidelight_width??a:0;l=Math.max(.1,l),c=r?Math.max(.1,c):0;let u=s-.5;if(l+c>u){let f=Math.max(0,u)/(l+c);l*=f,c*=f}return r?{panels:[[.02,.02+l],[i-.02-c,i-.02]],x0:.02+l,x1:i-.02-c}:(t?!!n.sidelight_hinge:!n.sidelight_hinge)?{panels:[[.02,.02+l]],x0:.02+l,x1:i-.02}:{panels:[[i-.02-l,i-.02]],x0:.02,x1:i-.02-l}}function N0(i){return i==="front"||i==="front_glass"||i==="sidelight"||i==="sidelights"}function es(i){let e=0;for(let t=0;ts+o[0],0)/r,i.reduce((s,o)=>s+o[1],0)/r]}let t=0,n=0;for(let r=0;r1e-6&&Math.abs(n-s)>1e-6)return!1}return!0}function D0(i){let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let[s,o]of i)e=Math.min(e,s),t=Math.min(t,o),n=Math.max(n,s),r=Math.max(r,o);return{x0:e,z0:t,x1:n,z1:r}}function ts(i){let e=i.rotation*Math.PI/180,t=Math.cos(e),n=Math.sin(e),r=i.w/2,s=i.d/2;return[[-r,-s],[r,-s],[r,s],[-r,s]].map(([o,a])=>[i.x+o*t-a*n,i.z+o*n+a*t])}function Ge(i,e){let t=!1;for(let n=0,r=e.length-1;ni[1]!=l>i[1]&&i[0]<(a-s)*(i[1]-o)/(l-o)+s&&(t=!t)}return t}var y1=[],ea=new Map,_1=0,k0=(i,e)=>`pack:${i}:${e}`,v1=i=>i.startsWith("pack:");function kl(i){y1=i,ea=new Map;for(let e of i)for(let t of e.items)ea.set(k0(e.id,t.id),t);_1+=1}var M1={};function vt(i){if(!v1(i))return;let e=ea.get(i);if(e)return e;let[,t,...n]=i.split(":"),r=M1[t];return r?ea.get(k0(r,n.join(":"))):void 0}var S1=.22;function U0(i,e,t,n){let r=Math.min(S1,t/3);if(n<=r*2.4||Math.abs(n-t)<1e-6)return e*(n/t)+(i-e)*(n/t);let s=e*(n/t),o=i-e;return o<=r?s+o:o>=t-r?s+n-(t-o):s+r+(o-r)*(n-2*r)/(t-2*r)}function Qo(i,e,t,n,r){return[U0(i*n,t*n,n,r)/r,U0(e*n,t*n,n,r)/r]}var B0=new WeakMap;function ta(i,e,t,n){let[r,s,o]=i.size;if(i.vehicle||i.stretch||Math.abs(e-r)<1e-4&&Math.abs(t-s)<1e-4&&Math.abs(n-o)<1e-4)return i.parts;let a=`${e.toFixed(4)}|${t.toFixed(4)}|${n.toFixed(4)}`,l=B0.get(i),c=l?.get(a);if(c)return c;let u=i.parts.map(h=>{if(h.shape==="sweep")return h;let[f,d]=Qo(h.x-h.w/2,h.x+h.w/2,-.5,r,e),[p,g]=Qo(h.z-h.d/2,h.z+h.d/2,-.5,s,t),[m,x]=Qo(h.y,h.y+h.h,0,o,n);if(h.rot)return{...h,x:(f+d)/2,z:(p+g)/2,w:h.w*r/e,d:h.d*s/t,y:m,h:x-m};let b={...h,x:(f+d)/2,z:(p+g)/2,w:d-f,d:g-p,y:m,h:x-m};if(h.shape==="loft"){let[_,y,M,S]=[h.tx??h.x,h.tz??h.z,h.tw??h.w,h.td??h.d],[v,w]=Qo(_-M/2,_+M/2,-.5,r,e),[C,A]=Qo(y-S/2,y+S/2,-.5,s,t);Object.assign(b,{tx:(v+w)/2,tz:(C+A)/2,tw:w-v,td:A-C})}return b});return l||B0.set(i,l=new Map),l.size>32&&l.clear(),l.set(a,u),u}var z0=i=>!!i?.parts.some(e=>e.move);function V0(i,e){if(e===null)return Math.min(1,Math.max(0,i.cover_rest??1));let t=Math.min(1,Math.max(0,e/100));return i.cover==="extends"?t:1-t}function G0(i,e){let t=[];for(let n of i){if(!n.move)continue;let r={...n},s=(o,a)=>a+(o-a)*e;if(n.move==="down"){let[o,a]=[s(n.y,1),s(n.y+n.h,1)];Object.assign(r,{y:o,h:a-o})}else if(n.move==="left"||n.move==="right"){let o=n.move==="left"?-.5:.5,[a,l]=[s(n.x-n.w/2,o),s(n.x+n.w/2,o)];if(Object.assign(r,{x:(a+l)/2,w:Math.abs(l-a)}),n.tx!==void 0||n.tw!==void 0){let[c,u]=[s((n.tx??n.x)-(n.tw??n.w)/2,o),s((n.tx??n.x)+(n.tw??n.w)/2,o)];Object.assign(r,{tx:(c+u)/2,tw:Math.abs(u-c)})}}else if(n.move==="out"){let[o,a]=[s(n.z-n.d/2,-.5),s(n.z+n.d/2,-.5)];if(Object.assign(r,{z:(o+a)/2,d:a-o}),n.tz!==void 0||n.td!==void 0){let[l,c]=[s((n.tz??n.z)-(n.td??n.d)/2,-.5),s((n.tz??n.z)+(n.td??n.d)/2,-.5)];Object.assign(r,{tz:(l+c)/2,td:c-l})}}else{let o=(1-e)*n.w*(n.move==="slide_left"?-1:1);Object.assign(r,{x:n.x+o,...n.tx!==void 0?{tx:n.tx+o}:{}})}r.w>.002&&r.d>.002&&r.h>.002&&t.push(r)}return t}function Gt(i,e){return e.mount_y!=null?e.mount_y:T1(i,e)+(w1(e)?0:I0(i,e.x,e.z))}var w1=i=>i.type==="led_strip"||vt(i.type)?.mount==="ceiling";function T1(i,e){if(e.type==="lamp_wall")return Ul;if(e.type==="led_strip")return Math.max(0,Jh(i,e.x,e.z)-.04-Math.max(.02,e.h));let t=vt(e.type);if(!t)return jr(e);switch(t.mount){case"surface":return L0(i,e.x,e.z);case"wall":return t.wall_y??1;case"ceiling":return Math.max(0,Bl(i,e)-e.h);default:return 0}}var H0=null,W0=new Set,X0=i=>{H0=i},Y0=()=>H0,q0=i=>{W0.add(i)};function zl(i){let e=ea.get(i)?.mesh;return e!==void 0&&W0.has(e)}var Vg=0,zf=1,Gg=2;var Ga=1,Hg=2,yo=3,Ai=0,un=1,ht=2,gs=0,Ei=1,Ft=2,Vf=3,Ha=4,Wg=5;var xs=100,Xg=101,Yg=102,qg=103,$g=104,Kg=200,Zg=201,Jg=202,jg=203,Gf=204,Hf=205,Qg=206,ex=207,tx=208,nx=209,ix=210,rx=211,sx=212,ox=213,ax=214,yc=0,_c=1,vc=2,so=3,Mc=4,Sc=5,wc=6,Tc=7,Hc=0,lx=1,cx=2,Ri=0,Wf=1,Xf=2,Yf=3,qf=4,$f=5,Kf=6,Zf=7,wf="attached",ux="detached",Jf=300,bs=301,_o=302,Wc=303,Xc=304,kn=1e3,ln=1001,Cr=1002,Ut=1003,vo=1004;var lr=1005;var Ht=1006,Dr=1007;var Fn=1008;var Nn=1009,jf=1010,Qf=1011,Mo=1012,Yc=1013,oi=1014,Vn=1015,ai=1016,qc=1017,$c=1018,ys=1020,ed=35902,td=35899,nd=1021,id=1022,On=1023,Ki=1026,cr=1027,Kc=1028,Zc=1029,Ur=1030,Jc=1031;var jc=1033,Wa=33776,Xa=33777,Ya=33778,qa=33779,Qc=35840,eu=35841,tu=35842,nu=35843,iu=36196,ru=37492,su=37496,ou=37488,au=37489,$a=37490,lu=37491,cu=37808,uu=37809,hu=37810,fu=37811,du=37812,pu=37813,mu=37814,gu=37815,xu=37816,bu=37817,yu=37818,_u=37819,vu=37820,Mu=37821,Su=36492,wu=36494,Tu=36495,Au=36283,Eu=36284,Ka=36285,Ru=36286;var Zi=2300,Ji=2301,xc=2302,Tf=2303,Af=2400,Ef=2401,Rf=2402,hx=2500;var rd=0,Za=1,So=2,fx=3200;var Ja=0,dx=1,li="",dt="srgb",Mn="srgb-linear",xa="linear",Mt="srgb";var bc=7680;var px=519,mx=512,gx=513,xx=514,sd=515,bx=516,yx=517,od=518,ad=519,ld=35044,cd=35048;var ud="300 es",$n=2e3,oo=2001;function A1(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function E1(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ao(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function _x(){let i=ao("canvas");return i.style.display="block",i}var $0={},lo=null;function ba(...i){let e="THREE."+i.shift();lo?lo("log",e,...i):console.log(e,...i)}function vx(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Fe(...i){i=vx(i);let e="THREE."+i.shift();if(lo)lo("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function He(...i){i=vx(i);let e="THREE."+i.shift();if(lo)lo("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function os(...i){let e=i.join(" ");e in $0||($0[e]=!0,Fe(...i))}function Mx(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var Sx={[yc]:yc,[vc]:wc,[Mc]:Mc,[so]:Sc,[_c]:_c,[wc]:vc,[Tc]:Tc,[Sc]:so},yi=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s>8&255]+dn[i>>16&255]+dn[i>>24&255]+"-"+dn[e&255]+dn[e>>8&255]+"-"+dn[e>>16&15|64]+dn[e>>24&255]+"-"+dn[t&63|128]+dn[t>>8&255]+"-"+dn[t>>16&255]+dn[t>>24&255]+dn[n&255]+dn[n>>8&255]+dn[n>>16&255]+dn[n>>24&255]).toLowerCase()}function st(i,e,t){return Math.max(e,Math.min(t,i))}function hd(i,e){return(i%e+e)%e}function R1(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function C1(i,e,t){return i!==e?(t-i)/(e-i):0}function ga(i,e,t){return(1-t)*i+t*e}function P1(i,e,t,n){return ga(i,e,1-Math.exp(-t*n))}function I1(i,e=1){return e-Math.abs(hd(i,e*2)-e)}function L1(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function F1(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function N1(i,e){return i+Math.floor(Math.random()*(e-i+1))}function O1(i,e){return i+Math.random()*(e-i)}function D1(i){return i*(.5-Math.random())}function U1(i){i!==void 0&&(K0=i);let e=K0+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function B1(i){return i*ma}function k1(i){return i*as}function z1(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function V1(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function fd(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function G1(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),p=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*h,l*f,a*c);break;case"YZY":i.set(l*f,a*u,l*h,a*c);break;case"ZXZ":i.set(l*h,l*f,a*u,a*c);break;case"XZX":i.set(a*u,l*p,l*d,a*c);break;case"YXY":i.set(l*d,a*u,l*p,a*c);break;case"ZYZ":i.set(l*p,l*d,a*u,a*c);break;default:Fe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Cu(i){switch(i.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function dd(i,e){if(e.constructor===Float32Array)return i;let t=Cu(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.max(i/t,-1)}function pd(i,e){if(e.constructor===Float32Array)return i;let t=Cu(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.round(i*t)}var Br={DEG2RAD:ma,RAD2DEG:as,generateUUID:Ci,clamp:st,euclideanModulo:hd,mapLinear:R1,inverseLerp:C1,lerp:ga,damp:P1,pingpong:I1,smoothstep:L1,smootherstep:F1,randInt:N1,randFloat:O1,randFloatSpread:D1,seededRandom:U1,degToRad:B1,radToDeg:k1,isPowerOfTwo:z1,ceilPowerOfTwo:V1,floorPowerOfTwo:fd,setQuaternionFromProperEuler:G1,normalize:pd,denormalize:dd},yd=class yd{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(st(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};yd.prototype.isVector2=!0;var Be=yd,Sn=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],h=n[r+3],f=s[o+0],d=s[o+1],p=s[o+2],g=s[o+3];if(h!==g||l!==f||c!==d||u!==p){let m=l*f+c*d+u*p+h*g;m<0&&(f=-f,d=-d,p=-p,g=-g,m=-m);let x=1-a;if(m<.9995){let b=Math.acos(m),_=Math.sin(b);x=Math.sin(x*b)/_,a=Math.sin(a*b)/_,l=l*x+f*a,c=c*x+d*a,u=u*x+p*a,h=h*x+g*a}else{l=l*x+f*a,c=c*x+d*a,u=u*x+p*a,h=h*x+g*a;let b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],h=s[o],f=s[o+1],d=s[o+2],p=s[o+3];return e[t]=a*p+u*h+l*d-c*f,e[t+1]=l*p+u*f+c*h-a*d,e[t+2]=c*p+u*d+a*f-l*h,e[t+3]=u*p-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),h=a(s/2),f=l(n/2),d=l(r/2),p=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h-f*d*p;break;case"YXZ":this._x=f*u*h+c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h+f*d*p;break;case"ZXY":this._x=f*u*h-c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h-f*d*p;break;case"ZYX":this._x=f*u*h-c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h+f*d*p;break;case"YZX":this._x=f*u*h+c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h-f*d*p;break;case"XZY":this._x=f*u*h-c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h+f*d*p;break;default:Fe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-r)*d}else if(n>a&&n>h){let d=2*Math.sqrt(1+n-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+c)/d}else if(a>h){let d=2*Math.sqrt(1+a-n-h);this._w=(s-c)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(l+u)/d}else{let d=2*Math.sqrt(1+h-n-a);this._w=(o-r)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(st(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},_d=class _d{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Z0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Z0.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),h=2*(s*n-o*t);return this.x=t+l*c+o*h-a*u,this.y=n+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this.z=st(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this.z=st(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return jh.copy(this).projectOnVector(e),this.sub(jh)}reflect(e){return this.sub(jh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(st(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};_d.prototype.isVector3=!0;var U=_d,jh=new U,Z0=new Sn,vd=class vd{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],p=n[8],g=r[0],m=r[3],x=r[6],b=r[1],_=r[4],y=r[7],M=r[2],S=r[5],v=r[8];return s[0]=o*g+a*b+l*M,s[3]=o*m+a*_+l*S,s[6]=o*x+a*y+l*v,s[1]=c*g+u*b+h*M,s[4]=c*m+u*_+h*S,s[7]=c*x+u*y+h*v,s[2]=f*g+d*b+p*M,s[5]=f*m+d*_+p*S,s[8]=f*x+d*y+p*v,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,d=c*s-o*l,p=t*h+n*f+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/p;return e[0]=h*g,e[1]=(r*c-u*n)*g,e[2]=(a*n-r*o)*g,e[3]=f*g,e[4]=(u*t-r*l)*g,e[5]=(r*s-a*t)*g,e[6]=d*g,e[7]=(n*l-c*t)*g,e[8]=(o*t-n*s)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return os("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Qh.makeScale(e,t)),this}rotate(e){return os("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Qh.makeRotation(-e)),this}translate(e,t){return os("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Qh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};vd.prototype.isMatrix3=!0;var We=vd,Qh=new We,J0=new We().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),j0=new We().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function H1(){let i={enabled:!0,workingColorSpace:Mn,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Mt&&(r.r=$i(r.r),r.g=$i(r.g),r.b=$i(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Mt&&(r.r=ro(r.r),r.g=ro(r.g),r.b=ro(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===li?xa:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[o].fromXYZ).multiply(this.spaces[s].toXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Mn]:{primaries:e,whitePoint:n,transfer:xa,toXYZ:J0,fromXYZ:j0,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:dt},outputColorSpaceConfig:{drawingBufferColorSpace:dt}},[dt]:{primaries:e,whitePoint:n,transfer:Mt,toXYZ:J0,fromXYZ:j0,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:dt}}}),i}var nt=H1();function $i(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ro(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var zs,co=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{zs===void 0&&(zs=ao("canvas")),zs.width=e.width,zs.height=e.height;let r=zs.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=zs}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=ao("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o1),this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(tf).x}get height(){return this.source.getSize(tf).y}get depth(){return this.source.getSize(tf).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Fe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Fe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Jf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case kn:e.x=e.x-Math.floor(e.x);break;case ln:e.x=e.x<0?0:1;break;case Cr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case kn:e.y=e.y-Math.floor(e.y);break;case ln:e.y=e.y<0?0:1;break;case Cr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Kt.DEFAULT_IMAGE=null;Kt.DEFAULT_MAPPING=Jf;Kt.DEFAULT_ANISOTROPY=1;var Md=class Md{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],p=l[9],g=l[2],m=l[6],x=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-g)<.01&&Math.abs(p-m)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+g)<.1&&Math.abs(p+m)<.1&&Math.abs(c+d+x-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let _=(c+1)/2,y=(d+1)/2,M=(x+1)/2,S=(u+f)/4,v=(h+g)/4,w=(p+m)/4;return _>y&&_>M?_<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(_),r=S/n,s=v/n):y>M?y<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),n=S/r,s=w/r):M<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(M),n=v/s,r=w/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-p)*(m-p)+(h-g)*(h-g)+(f-u)*(f-u));return Math.abs(b)<.001&&(b=1),this.x=(m-p)/b,this.y=(h-g)/b,this.z=(f-u)/b,this.w=Math.acos((c+d+x-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this.z=st(this.z,e.z,t.z),this.w=st(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this.z=st(this.z,e,t),this.w=st(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Md.prototype.isVector4=!0;var _t=Md,Ac=class extends yi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ht,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new _t(0,0,e,t),this.scissorTest=!1,this.viewport=new _t(0,0,e,t),this.textures=[];let r=n.count;for(let s=0;s1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nd+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.quaternion,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(j1)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new rt;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},wx={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},wr={h:0,s:0,l:0},Hl={h:0,s:0,l:0};function rf(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var W=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=dt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,nt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=nt.workingColorSpace){return this.r=e,this.g=t,this.b=n,nt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=nt.workingColorSpace){if(e=hd(e,1),t=st(t,0,1),n=st(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=rf(o,s,e+1/3),this.g=rf(o,s,e),this.b=rf(o,s,e-1/3)}return nt.colorSpaceToWorking(this,r),this}setStyle(e,t=dt){function n(s){s!==void 0&&parseFloat(s)<1&&Fe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseFloat(s[1]))/100,Math.min(100,parseFloat(s[2]))/100,Math.min(100,parseFloat(s[3]))/100,t);break;case"hsl":case"hsla":if(s=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Fe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Fe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=dt){let n=wx[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Fe("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$i(e.r),this.g=$i(e.g),this.b=$i(e.b),this}copyLinearToSRGB(e){return this.r=ro(e.r),this.g=ro(e.g),this.b=ro(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=dt){return nt.workingToColorSpace(pn.copy(this),e),Math.round(st(pn.r*255,0,255))*65536+Math.round(st(pn.g*255,0,255))*256+Math.round(st(pn.b*255,0,255))}getHexString(e=dt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nt.workingColorSpace){nt.workingToColorSpace(pn.copy(this),t);let n=pn.r,r=pn.g,s=pn.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(r-s)/h+(r0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){ii.subVectors(r,t),Gi.subVectors(n,t),sf.subVectors(e,t);let o=ii.dot(ii),a=ii.dot(Gi),l=ii.dot(sf),c=Gi.dot(Gi),u=Gi.dot(sf),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;let f=1/h,d=(c*l-a*u)*f,p=(o*u-a*l)*f;return s.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Hi)===null?!1:Hi.x>=0&&Hi.y>=0&&Hi.x+Hi.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Hi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Hi.x),l.addScaledVector(o,Hi.y),l.addScaledVector(a,Hi.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return cf.setScalar(0),uf.setScalar(0),hf.setScalar(0),cf.fromBufferAttribute(e,t),uf.fromBufferAttribute(e,n),hf.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(cf,s.x),o.addScaledVector(uf,s.y),o.addScaledVector(hf,s.z),o}static isFrontFacing(e,t,n,r){return ii.subVectors(n,t),Gi.subVectors(e,t),ii.cross(Gi).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ii.subVectors(this.c,this.b),Gi.subVectors(this.a,this.b),ii.cross(Gi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;Ws.subVectors(r,n),Xs.subVectors(s,n),of.subVectors(e,n);let l=Ws.dot(of),c=Xs.dot(of);if(l<=0&&c<=0)return t.copy(n);af.subVectors(e,r);let u=Ws.dot(af),h=Xs.dot(af);if(u>=0&&h<=u)return t.copy(r);let f=l*h-u*c;if(f<=0&&l>=0&&u<=0&&l-u>0)return o=l/(l-u),t.copy(n).addScaledVector(Ws,o);lf.subVectors(e,s);let d=Ws.dot(lf),p=Xs.dot(lf);if(p>=0&&d<=p)return t.copy(s);let g=d*c-l*p;if(g<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(n).addScaledVector(Xs,a);let m=u*p-d*h;if(m<=0&&h-u>=0&&d-p>=0)return og.subVectors(s,r),a=(h-u)/(h-u+(d-p)),t.copy(r).addScaledVector(og,a);let x=1/(m+g+f);return o=g*x,a=f*x,t.copy(n).addScaledVector(Ws,o).addScaledVector(Xs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Ct=class{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ri),ri.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ia),Xl.subVectors(this.max,ia),Ys.subVectors(e.a,ia),qs.subVectors(e.b,ia),$s.subVectors(e.c,ia),Tr.subVectors(qs,Ys),Ar.subVectors($s,qs),ns.subVectors(Ys,$s);let t=[0,-Tr.z,Tr.y,0,-Ar.z,Ar.y,0,-ns.z,ns.y,Tr.z,0,-Tr.x,Ar.z,0,-Ar.x,ns.z,0,-ns.x,-Tr.y,Tr.x,0,-Ar.y,Ar.x,0,-ns.y,ns.x,0];return!ff(t,Ys,qs,$s,Xl)||(t=[1,0,0,0,1,0,0,0,1],!ff(t,Ys,qs,$s,Xl))?!1:(Yl.crossVectors(Tr,Ar),t=[Yl.x,Yl.y,Yl.z],ff(t,Ys,qs,$s,Xl))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ri).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ri).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Wi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Wi=[new U,new U,new U,new U,new U,new U,new U,new U],ri=new U,Wl=new Ct,Ys=new U,qs=new U,$s=new U,Tr=new U,Ar=new U,ns=new U,ia=new U,Xl=new U,Yl=new U,is=new U;function ff(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){is.fromArray(i,s);let a=r.x*Math.abs(is.x)+r.y*Math.abs(is.y)+r.z*Math.abs(is.z),l=e.dot(is),c=t.dot(is),u=n.dot(is);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var $t=new U,ql=new Be,Q1=0,wt=class extends yi{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Q1++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ld,this.updateRanges=[],this.gpuType=Vn,this.version=0,this._normalizationScale=e!==void 0?Cu(e):void 0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ra.subVectors(e,this.center);let t=ra.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ra,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(df.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ra.copy(e.center).add(df)),this.expandByPoint(ra.copy(e.center).sub(df))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},tS=0,qn=new ze,pf=new Et,Ks=new U,Bn=new Ct,sa=new Ct,rn=new U,Ce=class i extends yi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tS++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(A1(e)?cs:_a)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new We().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return qn.makeRotationFromQuaternion(e),this.applyMatrix4(qn),this}rotateX(e){return qn.makeRotationX(e),this.applyMatrix4(qn),this}rotateY(e){return qn.makeRotationY(e),this.applyMatrix4(qn),this}rotateZ(e){return qn.makeRotationZ(e),this.applyMatrix4(qn),this}translate(e,t,n){return qn.makeTranslation(e,t,n),this.applyMatrix4(qn),this}scale(e,t,n){return qn.makeScale(e,t,n),this.applyMatrix4(qn),this}lookAt(e){return pf.lookAt(e),pf.updateMatrix(),this.applyMatrix4(pf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ks).negate(),this.translate(Ks.x,Ks.y,Ks.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;rt.count&&Fe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ct);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){He("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],h=s[c];for(let f=0,d=h.length;f1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||iS.getNormalMatrix(e),r=this.coplanarPoint(mf).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},rS=0,mn=class extends yi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rS++}),this.uuid=Ci(),this.name="",this.type="Material",this.blending=Ei,this.side=Ai,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Gf,this.blendDst=Hf,this.blendEquation=xs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new W(0,0,0),this.blendAlpha=0,this.depthFunc=so,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=px,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bc,this.stencilZFail=bc,this.stencilZPass=bc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Fe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Fe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(s=>s.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new W().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.diffuseRoughness!==void 0&&(this.diffuseRoughness=e.diffuseRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum),e.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1]),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(n=>new si().fromJSON(n))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Be().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Be().fromArray(e.clearcoatNormalScale)),e.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},vi=class extends mn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new W(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Zs,oa=new U,Js=new U,js=new U,Qs=new Be,aa=new Be,Tx=new ze,$l=new U,la=new U,Kl=new U,lg=new Be,gf=new Be,cg=new Be,Qi=class extends Et{constructor(e=new vi){if(super(),this.isSprite=!0,this.type="Sprite",Zs===void 0){Zs=new Ce;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new us(t,5);Zs.setIndex([0,1,2,0,2,3]),Zs.setAttribute("position",new Pr(n,3,0,!1)),Zs.setAttribute("uv",new Pr(n,2,3,!1))}this.geometry=Zs,this.material=e,this.center=new Be(.5,.5),this.count=1}intersectsFrustum(e){return e.intersectsSprite(this)}raycast(e,t){e.camera===null&&He('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Js.setFromMatrixScale(this.matrixWorld),Tx.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),js.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Js.multiplyScalar(-js.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;Zl($l.set(-.5,-.5,0),js,o,Js,r,s),Zl(la.set(.5,-.5,0),js,o,Js,r,s),Zl(Kl.set(.5,.5,0),js,o,Js,r,s),lg.set(0,0),gf.set(1,0),cg.set(1,1);let a=e.ray.intersectTriangle($l,la,Kl,!1,oa);if(a===null&&(Zl(la.set(-.5,.5,0),js,o,Js,r,s),gf.set(0,1),a=e.ray.intersectTriangle($l,Kl,la,!1,oa),a===null))return;let l=e.ray.origin.distanceTo(oa);le.far||t.push({distance:l,point:oa.clone(),uv:qi.getInterpolation(oa,$l,la,Kl,lg,gf,cg,new Be),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}toJSON(e){let t=super.toJSON(e);return t.object.center=this.center.toArray(),t}};function Zl(i,e,t,n,r,s){Qs.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(aa.x=s*Qs.x-r*Qs.y,aa.y=r*Qs.x+s*Qs.y):aa.copy(Qs),i.copy(e),i.x+=aa.x,i.y+=aa.y,i.applyMatrix4(Tx)}var Xi=new U,xf=new U,Jl=new U,jl=new U,Ir=class{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Xi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Xi.copy(this.origin).addScaledVector(this.direction,t),Xi.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){xf.copy(e).add(t).multiplyScalar(.5),Jl.copy(t).sub(e).normalize(),jl.copy(this.origin).sub(xf);let s=e.distanceTo(t)*.5,o=-this.direction.dot(Jl),a=jl.dot(this.direction),l=-jl.dot(Jl),c=jl.lengthSq(),u=Math.abs(1-o*o),h,f,d,p;if(u>0)if(h=o*l-a,f=o*a-l,p=s*u,h>=0)if(f>=-p)if(f<=p){let g=1/u;h*=g,f*=g,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-p?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=p?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(xf).addScaledVector(Jl,f),d}intersectSphere(e,t){if(e.radius<0)return null;Xi.subVectors(e.center,this.origin);let n=Xi.dot(this.direction),r=Xi.dot(Xi)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||a>r)||((a>n||n!==n)&&(n=a),(l=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Xi)!==null}intersectTriangle(e,t,n,r,s){let o=this.origin,a=this.direction,l=a.x,c=a.y,u=a.z,h=e.x-o.x,f=e.y-o.y,d=e.z-o.z,p=t.x-o.x,g=t.y-o.y,m=t.z-o.z,x=n.x-o.x,b=n.y-o.y,_=n.z-o.z,y=Math.abs(l),M=Math.abs(c),S=Math.abs(u),v,w,C,A,R,N,O,P,I,D,F,H;if(y>=M&&y>=S?(C=l,N=h,I=p,H=x,l>=0?(v=c,w=u,A=f,R=d,O=g,P=m,D=b,F=_):(v=u,w=c,A=d,R=f,O=m,P=g,D=_,F=b)):M>=S?(C=c,N=f,I=g,H=b,c>=0?(v=u,w=l,A=d,R=h,O=m,P=p,D=_,F=x):(v=l,w=u,A=h,R=d,O=p,P=m,D=x,F=_)):(C=u,N=d,I=m,H=_,u>=0?(v=l,w=c,A=h,R=f,O=p,P=g,D=x,F=b):(v=c,w=l,A=f,R=h,O=g,P=p,D=b,F=x)),C===0)return null;let B=v/C,X=w/C,V=1/C,re=A-B*N,be=R-X*N,Y=O-B*I,Q=P-X*I,se=D-B*H,Se=F-X*H,ce=se*Q-Se*Y,Le=re*Se-be*se,at=Y*be-Q*re;if(r){if(ce<0||Le<0||at<0)return null}else if((ce<0||Le<0||at<0)&&(ce>0||Le>0||at>0))return null;let Te=ce+Le+at;if(Te===0)return null;let ft=V*(ce*N+Le*I+at*H);return(Te>0?ft<0:ft>0)?null:this.at(ft/Te,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},$e=class extends mn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new W(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _i,this.combine=Hc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},ug=new ze,rs=new Ir,Ql=new Cn,hg=new U,ec=new U,tc=new U,nc=new U,bf=new U,ic=new U,fg=new U,rc=new U,we=class extends Et{constructor(e=new Ce,t=new $e){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0?this.morphTargetInfluences=e.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,e.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(ug.copy(s).invert(),rs.copy(e.ray).applyMatrix4(ug),!(n.boundingBox!==null&&rs.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,rs)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,g=f.length;pt.far?null:{distance:c,point:rc.clone(),object:i}}function sc(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,ec),i.getVertexPosition(l,tc),i.getVertexPosition(c,nc);let u=sS(i,e,t,n,ec,tc,nc,fg);if(u){let h=new U;qi.getBarycoord(fg,ec,tc,nc,h),r&&(u.uv=qi.getInterpolatedAttribute(r,a,l,c,h,new Be)),s&&(u.uv1=qi.getInterpolatedAttribute(s,a,l,c,h,new Be)),o&&(u.normal=qi.getInterpolatedAttribute(o,a,l,c,h,new U),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let f={a,b:l,c,normal:new U,materialIndex:0};qi.getNormal(ec,tc,nc,f.normal),u.face=f,u.barycoord=h}return u}var ca=new _t,dg=new _t,pg=new _t,oS=new _t,mg=new ze,oc=new U,yf=new Cn,gg=new ze,_f=new Ir,va=class extends we{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=wf,this.bindMatrix=new ze,this.bindMatrixInverse=new ze,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ct),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n0?e.max.x:e.min.x,lc.y=r.normal.y>0?e.max.y:e.min.y,lc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(lc)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},_g=new ze,Rc=class i{constructor(){this.coordinateSystem=$n,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sn)return;vf.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(vf);if(!(ce.far))return{distance:c,point:Mg.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var Sg=new U,wg=new U,gn=class extends Pn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var Fr=class extends Kt{constructor(e=[],t,n,r,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,r,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};var wa=class extends Kt{constructor(e=[],t=bs,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},zt=class extends Kt{constructor(e,t,n,r,s,o,a,l,c){super(e,t,n,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}};var tr=class extends Kt{constructor(e,t,n=oi,r,s,o,a=Ut,l=Ut,c,u=Ki,h=1){if(u!==Ki&&u!==cr)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let f={width:e,height:t,depth:h};super(f,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ji(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},Ta=class extends tr{constructor(e,t=oi,n=bs,r,s,o=Ut,a=Ut,l,c=Ki){let u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Aa=class extends Kt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Mi=class i extends Ce{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],h=[],f=0,d=0;p("z","y","x",-1,-1,n,t,e,o,s,0),p("z","y","x",1,-1,n,t,-e,o,s,1),p("x","z","y",1,1,e,n,t,r,o,2),p("x","z","y",1,-1,e,n,-t,r,o,3),p("x","y","z",1,-1,e,t,n,r,s,4),p("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new De(c,3)),this.setAttribute("normal",new De(u,3)),this.setAttribute("uv",new De(h,2));function p(g,m,x,b,_,y,M,S,v,w,C){let A=y/v,R=M/w,N=y/2,O=M/2,P=S/2,I=v+1,D=w+1,F=0,H=0,B=new U;for(let X=0;X0?1:-1,u.push(B.x,B.y,B.z),h.push(re/v),h.push(1-X/w),F+=1}}for(let X=0;X80*t){a=i[0],l=i[1];let u=a,h=l;for(let f=t;fu&&(u=d),p>h&&(h=p)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return Ra(s,o,t,a,l,c,0),o}function Ax(i,e,t,n,r){let s;if(r===AS(i,e,t,n)>0)for(let o=e;o=e;o-=n)s=Eg(o/n|0,i[o],i[o+1],s);return s&&mo(s,s.next)&&(Pa(s),s=s.next),s}function fs(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(mo(t,t.next)||Dt(t.prev,t,t.next)===0)){if(Pa(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ra(i,e,t,n,r,s,o){if(!i)return;!o&&s&&_S(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?fS(i,n,r,s):hS(i)){e.push(l.i,i.i,c.i),Pa(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=dS(fs(i),e),Ra(i,e,t,n,r,s,2)):o===2&&pS(i,e,t,n,r,s):Ra(fs(i),e,t,n,r,s,1);break}}}function hS(i){let e=i.prev,t=i,n=i.next;if(Dt(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),h=Math.min(a,l,c),f=Math.max(r,s,o),d=Math.max(a,l,c),p=n.next;for(;p!==e;){if(p.x>=u&&p.x<=f&&p.y>=h&&p.y<=d&&da(r,a,s,l,o,c,p.x,p.y)&&Dt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function fS(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Dt(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,f=o.y,d=Math.min(a,l,c),p=Math.min(u,h,f),g=Math.max(a,l,c),m=Math.max(u,h,f),x=Pf(d,p,e,t,n),b=Pf(g,m,e,t,n),_=i.prevZ,y=i.nextZ;for(;_&&_.z>=x&&y&&y.z<=b;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&da(a,u,l,h,c,f,_.x,_.y)&&Dt(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=d&&y.x<=g&&y.y>=p&&y.y<=m&&y!==r&&y!==o&&da(a,u,l,h,c,f,y.x,y.y)&&Dt(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=x;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&da(a,u,l,h,c,f,_.x,_.y)&&Dt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=b;){if(y.x>=d&&y.x<=g&&y.y>=p&&y.y<=m&&y!==r&&y!==o&&da(a,u,l,h,c,f,y.x,y.y)&&Dt(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function dS(i,e){let t=i;do{let n=t.prev,r=t.next.next;!mo(n,r)&&Rx(n,t,t.next,r)&&Ca(n,r)&&Ca(r,n)&&(e.push(n.i,t.i,r.i),Pa(t),Pa(t.next),t=i=r),t=t.next}while(t!==i);return fs(t)}function pS(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&SS(o,a)){let l=Cx(o,a);o=fs(o,o.next),l=fs(l,l.next),Ra(o,e,t,n,r,s,0),Ra(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function mS(i,e,t,n){let r=[];for(let s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){let h=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=n&&h>s&&(s=h,o=t.x=t.x&&t.x>=l&&n!==t.x&&Ex(ro.x||t.x===o.x&&yS(o,t)))&&(o=t,u=h)}t=t.next}while(t!==a);return o}function yS(i,e){return Dt(i.prev,i,e.prev)<0&&Dt(e.next,i,i.next)<0}function _S(i,e,t,n){let r=i;do r.z===0&&(r.z=Pf(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,vS(r)}function vS(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function Pf(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function MS(i){let e=i,t=i;do(e.x=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function da(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&Ex(i,e,t,n,r,s,o,a)}function SS(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!wS(i,e)&&(Ca(i,e)&&Ca(e,i)&&TS(i,e)&&(Dt(i.prev,i,e.prev)||Dt(i,e.prev,e))||mo(i,e)&&Dt(i.prev,i,i.next)>0&&Dt(e.prev,e,e.next)>0)}function Dt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function mo(i,e){return i.x===e.x&&i.y===e.y}function Rx(i,e,t,n){let r=pc(Dt(i,e,t)),s=pc(Dt(i,e,n)),o=pc(Dt(t,n,i)),a=pc(Dt(t,n,e));return!!(r!==s&&o!==a||r===0&&dc(i,t,e)||s===0&&dc(i,n,e)||o===0&&dc(t,i,n)||a===0&&dc(t,e,n))}function dc(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function pc(i){return i>0?1:i<0?-1:0}function wS(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Rx(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Ca(i,e){return Dt(i.prev,i,i.next)<0?Dt(i,e,i.next)>=0&&Dt(i,i.prev,e)>=0:Dt(i,e,i.prev)<0||Dt(i,i.next,e)<0}function TS(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function Cx(i,e){let t=If(i.i,i.x,i.y),n=If(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Eg(i,e,t,n){let r=If(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Pa(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function If(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function AS(i,e,t,n){let r=0;for(let s=e,o=t-n;s2&&i[e-1].equals(i[0])&&i.pop()}function Cg(i,e){for(let t=0;t0)&&d.push(_,y,S),(x!==n-1||l!!i.due&&i.due<=e;var Vl={lawn:.012,terrace:.12,path:.02,driveway:.02,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function jr(i){return i==="hedge"||i==="fence"||i==="pergola"}function af(i,e,t){let n=i.slope??0;if(!n||i.type==="pool")return 0;let r=i.slope_dir??"x",s=(c,u)=>r==="x"?c:r==="-x"?-c:r==="z"?u:-u,o=1/0,a=-1/0;for(let[c,u]of i.points){let h=s(c,u);o=Math.min(o,h),a=Math.max(a,h)}if(a-o<1e-6)return 0;let l=Math.min(1,Math.max(0,(s(e,t)-o)/(a-o)));return n*l}function I1(i,e,t,n){return ea(i)+(e.offset??0)+Vl[e.type]-af(e,t,n)}function ea(i){return i.elevation>.3?0:-.2}function U0(i,e,t){let n=(i.outdoor??[]).filter(s=>!jr(s.type)&&s.type!=="pool"&&Ge([e,t],s.points)),r=[...n].reverse().find(s=>s.cut)??n[0];return r?I1(i,r,e,t):ea(i)}var B0=i=>i.cut??i.type==="pool";var L1={type:"none",pitch:35,overhang:.4},k0="#d6cfc2",lf="#e8e3da",vI={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...L1}};var z0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),Gl=1.75;function V0(i){return z0.has(i)||!!_t(i)?.light}var F1=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function Qr(i){switch(i.type){case"home_battery":return i.variant==="wall"?.5:0;case"kitchen_wall":return 1.45;case"tv_wall":return Math.max(0,1.3-i.h/2);case"radiator":return .12;case"inverter":return 1.1;case"wallbox":return 1;case"meter":return .4;default:return 0}}var G0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan"]);function H0(i,e){return i.filter(t=>t.elevationt.rooms.filter(n=>n.points.length>=3&&n.ceiling!=null&&n.ceiling>t.height+.005&&t.elevation+n.ceiling>e.elevation+.05)).map(t=>t.points)}var es=i=>i?.floor_offset&&Number.isFinite(i.floor_offset)?i.floor_offset:0;function W0(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&r.floor_offset&&Ge([e,t],r.points));return es(n)}function cf(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&Ge([e,t],r.points));return n?.ceiling!=null&&n.ceiling>0?n.ceiling:i.height}var Hl=(i,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:cf(i,e.x,e.z);function X0(i,e,t){let n=0;for(let r of i.furniture)!(F1.has(r.type)||_t(r.type)?.surface)||!Ge([e,t],ns(r))||(n=Math.max(n,r.h));return n}var N1=new Set([...z0,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]);var O1=["interior","front","front_glass","sidelight","sidelights","glass","sliding","passage"],D1=["standard","bars","glass_wall"];function Mr(i,e){return i.type==="door"?i.style&&O1.includes(i.style)?i.style:e?"front":"interior":i.style&&D1.includes(i.style)?i.style:"standard"}function Y0(i,e,t,n){if(e!=="sidelight"&&e!=="sidelights")return null;let r=e==="sidelights",s=i-.04,o=Math.min(1.05,Math.max(.6,s-(r?.6:.3))),a=(s-o)/(r?2:1),l=n.sidelight_width??a,c=r?n.sidelight_width2??n.sidelight_width??a:0;l=Math.max(.1,l),c=r?Math.max(.1,c):0;let u=s-.5;if(l+c>u){let f=Math.max(0,u)/(l+c);l*=f,c*=f}return r?{panels:[[.02,.02+l],[i-.02-c,i-.02]],x0:.02+l,x1:i-.02-c}:(t?!!n.sidelight_hinge:!n.sidelight_hinge)?{panels:[[.02,.02+l]],x0:.02+l,x1:i-.02}:{panels:[[i-.02-l,i-.02]],x0:.02,x1:i-.02-l}}function q0(i){return i==="front"||i==="front_glass"||i==="sidelight"||i==="sidelights"}function ts(i){let e=0;for(let t=0;ts+o[0],0)/r,i.reduce((s,o)=>s+o[1],0)/r]}let t=0,n=0;for(let r=0;r1e-6&&Math.abs(n-s)>1e-6)return!1}return!0}function K0(i){let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let[s,o]of i)e=Math.min(e,s),t=Math.min(t,o),n=Math.max(n,s),r=Math.max(r,o);return{x0:e,z0:t,x1:n,z1:r}}function ns(i){let e=i.rotation*Math.PI/180,t=Math.cos(e),n=Math.sin(e),r=i.w/2,s=i.d/2;return[[-r,-s],[r,-s],[r,s],[-r,s]].map(([o,a])=>[i.x+o*t-a*n,i.z+o*n+a*t])}function Ge(i,e){let t=!1;for(let n=0,r=e.length-1;ni[1]!=l>i[1]&&i[0]<(a-s)*(i[1]-o)/(l-o)+s&&(t=!t)}return t}var U1=[],na=new Map,B1=0,j0=(i,e)=>`pack:${i}:${e}`,k1=i=>i.startsWith("pack:");function Wl(i){U1=i,na=new Map;for(let e of i)for(let t of e.items)na.set(j0(e.id,t.id),t);B1+=1}var z1={};function _t(i){if(!k1(i))return;let e=na.get(i);if(e)return e;let[,t,...n]=i.split(":"),r=z1[t];return r?na.get(j0(r,n.join(":"))):void 0}var V1=.22;function Z0(i,e,t,n){let r=Math.min(V1,t/3);if(n<=r*2.4||Math.abs(n-t)<1e-6)return e*(n/t)+(i-e)*(n/t);let s=e*(n/t),o=i-e;return o<=r?s+o:o>=t-r?s+n-(t-o):s+r+(o-r)*(n-2*r)/(t-2*r)}function ta(i,e,t,n,r){return[Z0(i*n,t*n,n,r)/r,Z0(e*n,t*n,n,r)/r]}var J0=new WeakMap;function ia(i,e,t,n){let[r,s,o]=i.size;if(i.vehicle||i.stretch||Math.abs(e-r)<1e-4&&Math.abs(t-s)<1e-4&&Math.abs(n-o)<1e-4)return i.parts;let a=`${e.toFixed(4)}|${t.toFixed(4)}|${n.toFixed(4)}`,l=J0.get(i),c=l?.get(a);if(c)return c;let u=i.parts.map(h=>{if(h.shape==="sweep")return h;let[f,d]=ta(h.x-h.w/2,h.x+h.w/2,-.5,r,e),[p,x]=ta(h.z-h.d/2,h.z+h.d/2,-.5,s,t),[g,m]=ta(h.y,h.y+h.h,0,o,n);if(h.rot)return{...h,x:(f+d)/2,z:(p+x)/2,w:h.w*r/e,d:h.d*s/t,y:g,h:m-g};let y={...h,x:(f+d)/2,z:(p+x)/2,w:d-f,d:x-p,y:g,h:m-g};if(h.shape==="loft"){let[_,b,M,S]=[h.tx??h.x,h.tz??h.z,h.tw??h.w,h.td??h.d],[v,w]=ta(_-M/2,_+M/2,-.5,r,e),[R,T]=ta(b-S/2,b+S/2,-.5,s,t);Object.assign(y,{tx:(v+w)/2,tz:(R+T)/2,tw:w-v,td:T-R})}return y});return l||J0.set(i,l=new Map),l.size>32&&l.clear(),l.set(a,u),u}var Q0=i=>!!i?.parts.some(e=>e.move);function eg(i,e){if(e===null)return Math.min(1,Math.max(0,i.cover_rest??1));let t=Math.min(1,Math.max(0,e/100));return i.cover==="extends"?t:1-t}function tg(i,e){let t=[];for(let n of i){if(!n.move)continue;let r={...n},s=(o,a)=>a+(o-a)*e;if(n.move==="down"){let[o,a]=[s(n.y,1),s(n.y+n.h,1)];Object.assign(r,{y:o,h:a-o})}else if(n.move==="left"||n.move==="right"){let o=n.move==="left"?-.5:.5,[a,l]=[s(n.x-n.w/2,o),s(n.x+n.w/2,o)];if(Object.assign(r,{x:(a+l)/2,w:Math.abs(l-a)}),n.tx!==void 0||n.tw!==void 0){let[c,u]=[s((n.tx??n.x)-(n.tw??n.w)/2,o),s((n.tx??n.x)+(n.tw??n.w)/2,o)];Object.assign(r,{tx:(c+u)/2,tw:Math.abs(u-c)})}}else if(n.move==="out"){let[o,a]=[s(n.z-n.d/2,-.5),s(n.z+n.d/2,-.5)];if(Object.assign(r,{z:(o+a)/2,d:a-o}),n.tz!==void 0||n.td!==void 0){let[l,c]=[s((n.tz??n.z)-(n.td??n.d)/2,-.5),s((n.tz??n.z)+(n.td??n.d)/2,-.5)];Object.assign(r,{tz:(l+c)/2,td:c-l})}}else{let o=(1-e)*n.w*(n.move==="slide_left"?-1:1);Object.assign(r,{x:n.x+o,...n.tx!==void 0?{tx:n.tx+o}:{}})}r.w>.002&&r.d>.002&&r.h>.002&&t.push(r)}return t}function Gt(i,e){return e.mount_y!=null?e.mount_y:H1(i,e)+(G1(e)?0:W0(i,e.x,e.z))}var G1=i=>i.type==="led_strip"||_t(i.type)?.mount==="ceiling";function H1(i,e){if(e.type==="lamp_wall")return Gl;if(e.type==="led_strip")return Math.max(0,cf(i,e.x,e.z)-.04-Math.max(.02,e.h));let t=_t(e.type);if(!t)return Qr(e);switch(t.mount){case"surface":return X0(i,e.x,e.z);case"wall":return t.wall_y??1;case"ceiling":return Math.max(0,Hl(i,e)-e.h);default:return 0}}var ng=null,ig=new Set,rg=i=>{ng=i},sg=()=>ng,og=i=>{ig.add(i)};function Xl(i){let e=na.get(i)?.mesh;return e!==void 0&&ig.has(e)}var ex=0,Jf=1,tx=2;var Wa=1,nx=2,Mo=3,Ai=0,un=1,ht=2,xs=0,Ei=1,Ft=2,jf=3,Xa=4,ix=5;var ys=100,rx=101,sx=102,ox=103,ax=104,lx=200,cx=201,ux=202,hx=203,Qf=204,ed=205,fx=206,dx=207,px=208,mx=209,gx=210,xx=211,yx=212,bx=213,vx=214,wc=0,Tc=1,Ac=2,lo=3,Ec=4,Rc=5,Cc=6,Pc=7,$c=0,_x=1,Mx=2,Ri=0,td=1,nd=2,id=3,rd=4,sd=5,od=6,ad=7,Of="attached",Sx="detached",ld=300,bs=301,So=302,Kc=303,Zc=304,kn=1e3,ln=1001,Pr=1002,Ut=1003,wo=1004;var cr=1005;var Ht=1006,Ur=1007;var Fn=1008;var Nn=1009,cd=1010,ud=1011,To=1012,Jc=1013,ai=1014,Vn=1015,li=1016,jc=1017,Qc=1018,vs=1020,hd=35902,fd=35899,dd=1021,pd=1022,On=1023,Ki=1026,ur=1027,eu=1028,tu=1029,Br=1030,nu=1031;var iu=1033,Ya=33776,qa=33777,$a=33778,Ka=33779,ru=35840,su=35841,ou=35842,au=35843,lu=36196,cu=37492,uu=37496,hu=37488,fu=37489,Za=37490,du=37491,pu=37808,mu=37809,gu=37810,xu=37811,yu=37812,bu=37813,vu=37814,_u=37815,Mu=37816,Su=37817,wu=37818,Tu=37819,Au=37820,Eu=37821,Ru=36492,Cu=36494,Pu=36495,Iu=36283,Lu=36284,Ja=36285,Fu=36286;var Zi=2300,Ji=2301,Mc=2302,Df=2303,Uf=2400,Bf=2401,kf=2402,wx=2500;var md=0,ja=1,Ao=2,Tx=3200;var Qa=0,Ax=1,ci="",dt="srgb",Mn="srgb-linear",ba="linear",Mt="srgb";var Sc=7680;var Ex=519,Rx=512,Cx=513,Px=514,gd=515,Ix=516,Lx=517,xd=518,yd=519,bd=35044,vd=35048;var _d="300 es",$n=2e3,co=2001;function W1(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function X1(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function uo(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Fx(){let i=uo("canvas");return i.style.display="block",i}var ag={},ho=null;function va(...i){let e="THREE."+i.shift();ho?ho("log",e,...i):console.log(e,...i)}function Nx(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Oe(...i){i=Nx(i);let e="THREE."+i.shift();if(ho)ho("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function We(...i){i=Nx(i);let e="THREE."+i.shift();if(ho)ho("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function as(...i){let e=i.join(" ");e in ag||(ag[e]=!0,Oe(...i))}function Ox(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var Dx={[wc]:wc,[Ac]:Cc,[Ec]:Ec,[lo]:Rc,[Tc]:Tc,[Cc]:Ac,[Pc]:Pc,[Rc]:lo},vi=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s>8&255]+dn[i>>16&255]+dn[i>>24&255]+"-"+dn[e&255]+dn[e>>8&255]+"-"+dn[e>>16&15|64]+dn[e>>24&255]+"-"+dn[t&63|128]+dn[t>>8&255]+"-"+dn[t>>16&255]+dn[t>>24&255]+dn[n&255]+dn[n>>8&255]+dn[n>>16&255]+dn[n>>24&255]).toLowerCase()}function st(i,e,t){return Math.max(e,Math.min(t,i))}function Md(i,e){return(i%e+e)%e}function Y1(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function q1(i,e,t){return i!==e?(t-i)/(e-i):0}function ya(i,e,t){return(1-t)*i+t*e}function $1(i,e,t,n){return ya(i,e,1-Math.exp(-t*n))}function K1(i,e=1){return e-Math.abs(Md(i,e*2)-e)}function Z1(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function J1(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function j1(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Q1(i,e){return i+Math.random()*(e-i)}function eS(i){return i*(.5-Math.random())}function tS(i){i!==void 0&&(lg=i);let e=lg+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function nS(i){return i*xa}function iS(i){return i*ls}function rS(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function sS(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Sd(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function oS(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),p=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*h,l*f,a*c);break;case"YZY":i.set(l*f,a*u,l*h,a*c);break;case"ZXZ":i.set(l*h,l*f,a*u,a*c);break;case"XZX":i.set(a*u,l*p,l*d,a*c);break;case"YXY":i.set(l*d,a*u,l*p,a*c);break;case"ZYZ":i.set(l*p,l*d,a*u,a*c);break;default:Oe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Nu(i){switch(i.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function wd(i,e){if(e.constructor===Float32Array)return i;let t=Nu(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.max(i/t,-1)}function Td(i,e){if(e.constructor===Float32Array)return i;let t=Nu(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.round(i*t)}var kr={DEG2RAD:xa,RAD2DEG:ls,generateUUID:Ci,clamp:st,euclideanModulo:Md,mapLinear:Y1,inverseLerp:q1,lerp:ya,damp:$1,pingpong:K1,smoothstep:Z1,smootherstep:J1,randInt:j1,randFloat:Q1,randFloatSpread:eS,seededRandom:tS,degToRad:nS,radToDeg:iS,isPowerOfTwo:rS,ceilPowerOfTwo:sS,floorPowerOfTwo:Sd,setQuaternionFromProperEuler:oS,normalize:Td,denormalize:wd},Pd=class Pd{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(st(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Pd.prototype.isVector2=!0;var Ue=Pd,Sn=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],h=n[r+3],f=s[o+0],d=s[o+1],p=s[o+2],x=s[o+3];if(h!==x||l!==f||c!==d||u!==p){let g=l*f+c*d+u*p+h*x;g<0&&(f=-f,d=-d,p=-p,x=-x,g=-g);let m=1-a;if(g<.9995){let y=Math.acos(g),_=Math.sin(y);m=Math.sin(m*y)/_,a=Math.sin(a*y)/_,l=l*m+f*a,c=c*m+d*a,u=u*m+p*a,h=h*m+x*a}else{l=l*m+f*a,c=c*m+d*a,u=u*m+p*a,h=h*m+x*a;let y=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=y,c*=y,u*=y,h*=y}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],h=s[o],f=s[o+1],d=s[o+2],p=s[o+3];return e[t]=a*p+u*h+l*d-c*f,e[t+1]=l*p+u*f+c*h-a*d,e[t+2]=c*p+u*d+a*f-l*h,e[t+3]=u*p-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),h=a(s/2),f=l(n/2),d=l(r/2),p=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h-f*d*p;break;case"YXZ":this._x=f*u*h+c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h+f*d*p;break;case"ZXY":this._x=f*u*h-c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h-f*d*p;break;case"ZYX":this._x=f*u*h-c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h+f*d*p;break;case"YZX":this._x=f*u*h+c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h-f*d*p;break;case"XZY":this._x=f*u*h-c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h+f*d*p;break;default:Oe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-r)*d}else if(n>a&&n>h){let d=2*Math.sqrt(1+n-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+c)/d}else if(a>h){let d=2*Math.sqrt(1+a-n-h);this._w=(s-c)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(l+u)/d}else{let d=2*Math.sqrt(1+h-n-a);this._w=(o-r)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(st(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Id=class Id{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(cg.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cg.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),h=2*(s*n-o*t);return this.x=t+l*c+o*h-a*u,this.y=n+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this.z=st(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this.z=st(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return uf.copy(this).projectOnVector(e),this.sub(uf)}reflect(e){return this.sub(uf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(st(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Id.prototype.isVector3=!0;var U=Id,uf=new U,cg=new Sn,Ld=class Ld{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],p=n[8],x=r[0],g=r[3],m=r[6],y=r[1],_=r[4],b=r[7],M=r[2],S=r[5],v=r[8];return s[0]=o*x+a*y+l*M,s[3]=o*g+a*_+l*S,s[6]=o*m+a*b+l*v,s[1]=c*x+u*y+h*M,s[4]=c*g+u*_+h*S,s[7]=c*m+u*b+h*v,s[2]=f*x+d*y+p*M,s[5]=f*g+d*_+p*S,s[8]=f*m+d*b+p*v,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,d=c*s-o*l,p=t*h+n*f+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let x=1/p;return e[0]=h*x,e[1]=(r*c-u*n)*x,e[2]=(a*n-r*o)*x,e[3]=f*x,e[4]=(u*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=d*x,e[7]=(n*l-c*t)*x,e[8]=(o*t-n*s)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return as("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(hf.makeScale(e,t)),this}rotate(e){return as("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(hf.makeRotation(-e)),this}translate(e,t){return as("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(hf.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Ld.prototype.isMatrix3=!0;var Xe=Ld,hf=new Xe,ug=new Xe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),hg=new Xe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function aS(){let i={enabled:!0,workingColorSpace:Mn,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Mt&&(r.r=$i(r.r),r.g=$i(r.g),r.b=$i(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Mt&&(r.r=ao(r.r),r.g=ao(r.g),r.b=ao(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ci?ba:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[o].fromXYZ).multiply(this.spaces[s].toXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Mn]:{primaries:e,whitePoint:n,transfer:ba,toXYZ:ug,fromXYZ:hg,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:dt},outputColorSpaceConfig:{drawingBufferColorSpace:dt}},[dt]:{primaries:e,whitePoint:n,transfer:Mt,toXYZ:ug,fromXYZ:hg,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:dt}}}),i}var it=aS();function $i(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ao(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Hs,fo=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Hs===void 0&&(Hs=uo("canvas")),Hs.width=e.width,Hs.height=e.height;let r=Hs.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Hs}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=uo("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o1),this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(df).x}get height(){return this.source.getSize(df).y}get depth(){return this.source.getSize(df).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Oe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Oe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ld)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case kn:e.x=e.x-Math.floor(e.x);break;case ln:e.x=e.x<0?0:1;break;case Pr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case kn:e.y=e.y-Math.floor(e.y);break;case ln:e.y=e.y<0?0:1;break;case Pr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Kt.DEFAULT_IMAGE=null;Kt.DEFAULT_MAPPING=ld;Kt.DEFAULT_ANISOTROPY=1;var Fd=class Fd{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],p=l[9],x=l[2],g=l[6],m=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-x)<.01&&Math.abs(p-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+x)<.1&&Math.abs(p+g)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let _=(c+1)/2,b=(d+1)/2,M=(m+1)/2,S=(u+f)/4,v=(h+x)/4,w=(p+g)/4;return _>b&&_>M?_<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(_),r=S/n,s=v/n):b>M?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=S/r,s=w/r):M<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(M),n=v/s,r=w/s),this.set(n,r,s,t),this}let y=Math.sqrt((g-p)*(g-p)+(h-x)*(h-x)+(f-u)*(f-u));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(h-x)/y,this.z=(f-u)/y,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this.z=st(this.z,e.z,t.z),this.w=st(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this.z=st(this.z,e,t),this.w=st(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Fd.prototype.isVector4=!0;var vt=Fd,Ic=class extends vi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ht,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new vt(0,0,e,t),this.scissorTest=!1,this.viewport=new vt(0,0,e,t),this.textures=[];let r=n.count;for(let s=0;s1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nd+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.quaternion,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(gS)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new et;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Ux={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Tr={h:0,s:0,l:0},$l={h:0,s:0,l:0};function mf(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var W=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=dt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,it.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=it.workingColorSpace){return this.r=e,this.g=t,this.b=n,it.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=it.workingColorSpace){if(e=Md(e,1),t=st(t,0,1),n=st(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=mf(o,s,e+1/3),this.g=mf(o,s,e),this.b=mf(o,s,e-1/3)}return it.colorSpaceToWorking(this,r),this}setStyle(e,t=dt){function n(s){s!==void 0&&parseFloat(s)<1&&Oe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseFloat(s[1]))/100,Math.min(100,parseFloat(s[2]))/100,Math.min(100,parseFloat(s[3]))/100,t);break;case"hsl":case"hsla":if(s=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Oe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Oe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=dt){let n=Ux[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Oe("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$i(e.r),this.g=$i(e.g),this.b=$i(e.b),this}copyLinearToSRGB(e){return this.r=ao(e.r),this.g=ao(e.g),this.b=ao(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=dt){return it.workingToColorSpace(pn.copy(this),e),Math.round(st(pn.r*255,0,255))*65536+Math.round(st(pn.g*255,0,255))*256+Math.round(st(pn.b*255,0,255))}getHexString(e=dt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=it.workingColorSpace){it.workingToColorSpace(pn.copy(this),t);let n=pn.r,r=pn.g,s=pn.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(r-s)/h+(r0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){ri.subVectors(r,t),Gi.subVectors(n,t),gf.subVectors(e,t);let o=ri.dot(ri),a=ri.dot(Gi),l=ri.dot(gf),c=Gi.dot(Gi),u=Gi.dot(gf),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;let f=1/h,d=(c*l-a*u)*f,p=(o*u-a*l)*f;return s.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Hi)===null?!1:Hi.x>=0&&Hi.y>=0&&Hi.x+Hi.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Hi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Hi.x),l.addScaledVector(o,Hi.y),l.addScaledVector(a,Hi.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return vf.setScalar(0),_f.setScalar(0),Mf.setScalar(0),vf.fromBufferAttribute(e,t),_f.fromBufferAttribute(e,n),Mf.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(vf,s.x),o.addScaledVector(_f,s.y),o.addScaledVector(Mf,s.z),o}static isFrontFacing(e,t,n,r){return ri.subVectors(n,t),Gi.subVectors(e,t),ri.cross(Gi).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ri.subVectors(this.c,this.b),Gi.subVectors(this.a,this.b),ri.cross(Gi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;qs.subVectors(r,n),$s.subVectors(s,n),xf.subVectors(e,n);let l=qs.dot(xf),c=$s.dot(xf);if(l<=0&&c<=0)return t.copy(n);yf.subVectors(e,r);let u=qs.dot(yf),h=$s.dot(yf);if(u>=0&&h<=u)return t.copy(r);let f=l*h-u*c;if(f<=0&&l>=0&&u<=0&&l-u>0)return o=l/(l-u),t.copy(n).addScaledVector(qs,o);bf.subVectors(e,s);let d=qs.dot(bf),p=$s.dot(bf);if(p>=0&&d<=p)return t.copy(s);let x=d*c-l*p;if(x<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(n).addScaledVector($s,a);let g=u*p-d*h;if(g<=0&&h-u>=0&&d-p>=0)return bg.subVectors(s,r),a=(h-u)/(h-u+(d-p)),t.copy(r).addScaledVector(bg,a);let m=1/(g+x+f);return o=x*m,a=f*m,t.copy(n).addScaledVector(qs,o).addScaledVector($s,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Ct=class{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,si),si.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(sa),Zl.subVectors(this.max,sa),Ks.subVectors(e.a,sa),Zs.subVectors(e.b,sa),Js.subVectors(e.c,sa),Ar.subVectors(Zs,Ks),Er.subVectors(Js,Zs),is.subVectors(Ks,Js);let t=[0,-Ar.z,Ar.y,0,-Er.z,Er.y,0,-is.z,is.y,Ar.z,0,-Ar.x,Er.z,0,-Er.x,is.z,0,-is.x,-Ar.y,Ar.x,0,-Er.y,Er.x,0,-is.y,is.x,0];return!Sf(t,Ks,Zs,Js,Zl)||(t=[1,0,0,0,1,0,0,0,1],!Sf(t,Ks,Zs,Js,Zl))?!1:(Jl.crossVectors(Ar,Er),t=[Jl.x,Jl.y,Jl.z],Sf(t,Ks,Zs,Js,Zl))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,si).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(si).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Wi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Wi=[new U,new U,new U,new U,new U,new U,new U,new U],si=new U,Kl=new Ct,Ks=new U,Zs=new U,Js=new U,Ar=new U,Er=new U,is=new U,sa=new U,Zl=new U,Jl=new U,rs=new U;function Sf(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){rs.fromArray(i,s);let a=r.x*Math.abs(rs.x)+r.y*Math.abs(rs.y)+r.z*Math.abs(rs.z),l=e.dot(rs),c=t.dot(rs),u=n.dot(rs);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var $t=new U,jl=new Ue,xS=0,wt=class extends vi{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xS++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=bd,this.updateRanges=[],this.gpuType=Vn,this.version=0,this._normalizationScale=e!==void 0?Nu(e):void 0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;oa.subVectors(e,this.center);let t=oa.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(oa,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(wf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(oa.copy(e.center).add(wf)),this.expandByPoint(oa.copy(e.center).sub(wf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},bS=0,qn=new ze,Tf=new Et,js=new U,Bn=new Ct,aa=new Ct,rn=new U,Pe=class i extends vi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bS++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(W1(e)?us:Ma)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Xe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return qn.makeRotationFromQuaternion(e),this.applyMatrix4(qn),this}rotateX(e){return qn.makeRotationX(e),this.applyMatrix4(qn),this}rotateY(e){return qn.makeRotationY(e),this.applyMatrix4(qn),this}rotateZ(e){return qn.makeRotationZ(e),this.applyMatrix4(qn),this}translate(e,t,n){return qn.makeTranslation(e,t,n),this.applyMatrix4(qn),this}scale(e,t,n){return qn.makeScale(e,t,n),this.applyMatrix4(qn),this}lookAt(e){return Tf.lookAt(e),Tf.updateMatrix(),this.applyMatrix4(Tf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(js).negate(),this.translate(js.x,js.y,js.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;rt.count&&Oe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ct);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){We("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],h=s[c];for(let f=0,d=h.length;f1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||_S.getNormalMatrix(e),r=this.coplanarPoint(Af).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},MS=0,mn=class extends vi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:MS++}),this.uuid=Ci(),this.name="",this.type="Material",this.blending=Ei,this.side=Ai,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Qf,this.blendDst=ed,this.blendEquation=ys,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new W(0,0,0),this.blendAlpha=0,this.depthFunc=lo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ex,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Sc,this.stencilZFail=Sc,this.stencilZPass=Sc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Oe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Oe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(s=>s.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new W().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.diffuseRoughness!==void 0&&(this.diffuseRoughness=e.diffuseRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum),e.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1]),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(n=>new oi().fromJSON(n))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Ue().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Ue().fromArray(e.clearcoatNormalScale)),e.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},_i=class extends mn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new W(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Qs,la=new U,eo=new U,to=new U,no=new Ue,ca=new Ue,Bx=new ze,Ql=new U,ua=new U,ec=new U,_g=new Ue,Ef=new Ue,Mg=new Ue,Qi=class extends Et{constructor(e=new _i){if(super(),this.isSprite=!0,this.type="Sprite",Qs===void 0){Qs=new Pe;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new hs(t,5);Qs.setIndex([0,1,2,0,2,3]),Qs.setAttribute("position",new Ir(n,3,0,!1)),Qs.setAttribute("uv",new Ir(n,2,3,!1))}this.geometry=Qs,this.material=e,this.center=new Ue(.5,.5),this.count=1}intersectsFrustum(e){return e.intersectsSprite(this)}raycast(e,t){e.camera===null&&We('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),eo.setFromMatrixScale(this.matrixWorld),Bx.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),to.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&eo.multiplyScalar(-to.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;tc(Ql.set(-.5,-.5,0),to,o,eo,r,s),tc(ua.set(.5,-.5,0),to,o,eo,r,s),tc(ec.set(.5,.5,0),to,o,eo,r,s),_g.set(0,0),Ef.set(1,0),Mg.set(1,1);let a=e.ray.intersectTriangle(Ql,ua,ec,!1,la);if(a===null&&(tc(ua.set(-.5,.5,0),to,o,eo,r,s),Ef.set(0,1),a=e.ray.intersectTriangle(Ql,ec,ua,!1,la),a===null))return;let l=e.ray.origin.distanceTo(la);le.far||t.push({distance:l,point:la.clone(),uv:qi.getInterpolation(la,Ql,ua,ec,_g,Ef,Mg,new Ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}toJSON(e){let t=super.toJSON(e);return t.object.center=this.center.toArray(),t}};function tc(i,e,t,n,r,s){no.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ca.x=s*no.x-r*no.y,ca.y=r*no.x+s*no.y):ca.copy(no),i.copy(e),i.x+=ca.x,i.y+=ca.y,i.applyMatrix4(Bx)}var Xi=new U,Rf=new U,nc=new U,ic=new U,Lr=class{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Xi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Xi.copy(this.origin).addScaledVector(this.direction,t),Xi.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Rf.copy(e).add(t).multiplyScalar(.5),nc.copy(t).sub(e).normalize(),ic.copy(this.origin).sub(Rf);let s=e.distanceTo(t)*.5,o=-this.direction.dot(nc),a=ic.dot(this.direction),l=-ic.dot(nc),c=ic.lengthSq(),u=Math.abs(1-o*o),h,f,d,p;if(u>0)if(h=o*l-a,f=o*a-l,p=s*u,h>=0)if(f>=-p)if(f<=p){let x=1/u;h*=x,f*=x,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-p?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=p?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(Rf).addScaledVector(nc,f),d}intersectSphere(e,t){if(e.radius<0)return null;Xi.subVectors(e.center,this.origin);let n=Xi.dot(this.direction),r=Xi.dot(Xi)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||a>r)||((a>n||n!==n)&&(n=a),(l=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Xi)!==null}intersectTriangle(e,t,n,r,s){let o=this.origin,a=this.direction,l=a.x,c=a.y,u=a.z,h=e.x-o.x,f=e.y-o.y,d=e.z-o.z,p=t.x-o.x,x=t.y-o.y,g=t.z-o.z,m=n.x-o.x,y=n.y-o.y,_=n.z-o.z,b=Math.abs(l),M=Math.abs(c),S=Math.abs(u),v,w,R,T,C,L,O,P,I,D,F,H;if(b>=M&&b>=S?(R=l,L=h,I=p,H=m,l>=0?(v=c,w=u,T=f,C=d,O=x,P=g,D=y,F=_):(v=u,w=c,T=d,C=f,O=g,P=x,D=_,F=y)):M>=S?(R=c,L=f,I=x,H=y,c>=0?(v=u,w=l,T=d,C=h,O=g,P=p,D=_,F=m):(v=l,w=u,T=h,C=d,O=p,P=g,D=m,F=_)):(R=u,L=d,I=g,H=_,u>=0?(v=l,w=c,T=h,C=f,O=p,P=x,D=m,F=y):(v=c,w=l,T=f,C=h,O=x,P=p,D=y,F=m)),R===0)return null;let B=v/R,X=w/R,V=1/R,re=T-B*L,ye=C-X*L,Y=O-B*I,Q=P-X*I,se=D-B*H,we=F-X*H,le=se*Q-we*Y,Ne=re*we-ye*se,at=Y*ye-Q*re;if(r){if(le<0||Ne<0||at<0)return null}else if((le<0||Ne<0||at<0)&&(le>0||Ne>0||at>0))return null;let Ae=le+Ne+at;if(Ae===0)return null;let ft=V*(le*L+Ne*I+at*H);return(Ae>0?ft<0:ft>0)?null:this.at(ft/Ae,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ye=class extends mn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new W(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Kn,this.combine=$c,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Sg=new ze,ss=new Lr,rc=new Cn,wg=new U,sc=new U,oc=new U,ac=new U,Cf=new U,lc=new U,Tg=new U,cc=new U,Se=class extends Et{constructor(e=new Pe,t=new Ye){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0?this.morphTargetInfluences=e.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,e.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(Sg.copy(s).invert(),ss.copy(e.ray).applyMatrix4(Sg),!(n.boundingBox!==null&&ss.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ss)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,x=f.length;pt.far?null:{distance:c,point:cc.clone(),object:i}}function uc(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,sc),i.getVertexPosition(l,oc),i.getVertexPosition(c,ac);let u=SS(i,e,t,n,sc,oc,ac,Tg);if(u){let h=new U;qi.getBarycoord(Tg,sc,oc,ac,h),r&&(u.uv=qi.getInterpolatedAttribute(r,a,l,c,h,new Ue)),s&&(u.uv1=qi.getInterpolatedAttribute(s,a,l,c,h,new Ue)),o&&(u.normal=qi.getInterpolatedAttribute(o,a,l,c,h,new U),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let f={a,b:l,c,normal:new U,materialIndex:0};qi.getNormal(sc,oc,ac,f.normal),u.face=f,u.barycoord=h}return u}var ha=new vt,Ag=new vt,Eg=new vt,wS=new vt,Rg=new ze,hc=new U,Pf=new Cn,Cg=new ze,If=new Lr,Sa=class extends Se{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Of,this.bindMatrix=new ze,this.bindMatrixInverse=new ze,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ct),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n0?e.max.x:e.min.x,dc.y=r.normal.y>0?e.max.y:e.min.y,dc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dc)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Fg=new ze,Fc=class i{constructor(){this.coordinateSystem=$n,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sn)return;Lf.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(Lf);if(!(ce.far))return{distance:c,point:Og.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var Dg=new U,Ug=new U,gn=class extends Pn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var Nr=class extends Kt{constructor(e=[],t,n,r,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,r,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};var Aa=class extends Kt{constructor(e=[],t=bs,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},zt=class extends Kt{constructor(e,t,n,r,s,o,a,l,c){super(e,t,n,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}};var tr=class extends Kt{constructor(e,t,n=ai,r,s,o,a=Ut,l=Ut,c,u=Ki,h=1){if(u!==Ki&&u!==ur)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let f={width:e,height:t,depth:h};super(f,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ji(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},Ea=class extends tr{constructor(e,t=ai,n=bs,r,s,o=Ut,a=Ut,l,c=Ki){let u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Ra=class extends Kt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Mi=class i extends Pe{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],h=[],f=0,d=0;p("z","y","x",-1,-1,n,t,e,o,s,0),p("z","y","x",1,-1,n,t,-e,o,s,1),p("x","z","y",1,1,e,n,t,r,o,2),p("x","z","y",1,-1,e,n,-t,r,o,3),p("x","y","z",1,-1,e,t,n,r,s,4),p("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function p(x,g,m,y,_,b,M,S,v,w,R){let T=b/v,C=M/w,L=b/2,O=M/2,P=S/2,I=v+1,D=w+1,F=0,H=0,B=new U;for(let X=0;X0?1:-1,u.push(B.x,B.y,B.z),h.push(re/v),h.push(1-X/w),F+=1}}for(let X=0;X0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function y(){let b=new U,M=new U,S=0,v=(t-e)/n;for(let w=0;w<=s;w++){let R=[],T=w/s,C=T*(t-e)+e;for(let L=0;L<=r;L++){let O=L/r,P=O*l+a,I=Math.sin(P),D=Math.cos(P);M.x=C*I,M.y=-T*n+g,M.z=C*D,h.push(M.x,M.y,M.z),b.set(I,v,D).normalize(),f.push(b.x,b.y,b.z),d.push(O,1-T),R.push(p++)}x.push(R)}for(let w=0;w0||R!==0)&&(u.push(T,C,O),S+=3),(t>0||R!==s-1)&&(u.push(C,L,O),S+=3)}c.addGroup(m,S,0),m+=S}function _(b){let M=p,S=new Ue,v=new U,w=0,R=b===!0?e:t,T=b===!0?1:-1;for(let L=1;L<=r;L++)h.push(0,g*T,0),f.push(0,T,0),d.push(.5,.5),p++;let C=p;for(let L=0;L<=r;L++){let P=L/r*l+a,I=Math.cos(P),D=Math.sin(P);v.x=R*D,v.y=g*T,v.z=R*I,h.push(v.x,v.y,v.z),f.push(0,T,0),S.x=I*.5+.5,S.y=D*.5*T+.5,d.push(S.x,S.y),p++}for(let L=0;L80*t){a=i[0],l=i[1];let u=a,h=l;for(let f=t;fu&&(u=d),p>h&&(h=p)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return Pa(s,o,t,a,l,c,0),o}function kx(i,e,t,n,r){let s;if(r===WS(i,e,t,n)>0)for(let o=e;o=e;o-=n)s=zg(o/n|0,i[o],i[o+1],s);return s&&yo(s,s.next)&&(La(s),s=s.next),s}function ps(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(yo(t,t.next)||Dt(t.prev,t,t.next)===0)){if(La(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Pa(i,e,t,n,r,s,o){if(!i)return;!o&&s&&BS(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?PS(i,n,r,s):CS(i)){e.push(l.i,i.i,c.i),La(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=IS(ps(i),e),Pa(i,e,t,n,r,s,2)):o===2&&LS(i,e,t,n,r,s):Pa(ps(i),e,t,n,r,s,1);break}}}function CS(i){let e=i.prev,t=i,n=i.next;if(Dt(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),h=Math.min(a,l,c),f=Math.max(r,s,o),d=Math.max(a,l,c),p=n.next;for(;p!==e;){if(p.x>=u&&p.x<=f&&p.y>=h&&p.y<=d&&ma(r,a,s,l,o,c,p.x,p.y)&&Dt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function PS(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Dt(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,f=o.y,d=Math.min(a,l,c),p=Math.min(u,h,f),x=Math.max(a,l,c),g=Math.max(u,h,f),m=Vf(d,p,e,t,n),y=Vf(x,g,e,t,n),_=i.prevZ,b=i.nextZ;for(;_&&_.z>=m&&b&&b.z<=y;){if(_.x>=d&&_.x<=x&&_.y>=p&&_.y<=g&&_!==r&&_!==o&&ma(a,u,l,h,c,f,_.x,_.y)&&Dt(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=d&&b.x<=x&&b.y>=p&&b.y<=g&&b!==r&&b!==o&&ma(a,u,l,h,c,f,b.x,b.y)&&Dt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=m;){if(_.x>=d&&_.x<=x&&_.y>=p&&_.y<=g&&_!==r&&_!==o&&ma(a,u,l,h,c,f,_.x,_.y)&&Dt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=y;){if(b.x>=d&&b.x<=x&&b.y>=p&&b.y<=g&&b!==r&&b!==o&&ma(a,u,l,h,c,f,b.x,b.y)&&Dt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function IS(i,e){let t=i;do{let n=t.prev,r=t.next.next;!yo(n,r)&&Vx(n,t,t.next,r)&&Ia(n,r)&&Ia(r,n)&&(e.push(n.i,t.i,r.i),La(t),La(t.next),t=i=r),t=t.next}while(t!==i);return ps(t)}function LS(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&VS(o,a)){let l=Gx(o,a);o=ps(o,o.next),l=ps(l,l.next),Pa(o,e,t,n,r,s,0),Pa(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function FS(i,e,t,n){let r=[];for(let s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){let h=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=n&&h>s&&(s=h,o=t.x=t.x&&t.x>=l&&n!==t.x&&zx(ro.x||t.x===o.x&&US(o,t)))&&(o=t,u=h)}t=t.next}while(t!==a);return o}function US(i,e){return Dt(i.prev,i,e.prev)<0&&Dt(e.next,i,i.next)<0}function BS(i,e,t,n){let r=i;do r.z===0&&(r.z=Vf(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,kS(r)}function kS(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function Vf(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function zS(i){let e=i,t=i;do(e.x=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function ma(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&zx(i,e,t,n,r,s,o,a)}function VS(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!GS(i,e)&&(Ia(i,e)&&Ia(e,i)&&HS(i,e)&&(Dt(i.prev,i,e.prev)||Dt(i,e.prev,e))||yo(i,e)&&Dt(i.prev,i,i.next)>0&&Dt(e.prev,e,e.next)>0)}function Dt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function yo(i,e){return i.x===e.x&&i.y===e.y}function Vx(i,e,t,n){let r=bc(Dt(i,e,t)),s=bc(Dt(i,e,n)),o=bc(Dt(t,n,i)),a=bc(Dt(t,n,e));return!!(r!==s&&o!==a||r===0&&yc(i,t,e)||s===0&&yc(i,n,e)||o===0&&yc(t,i,n)||a===0&&yc(t,e,n))}function yc(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function bc(i){return i>0?1:i<0?-1:0}function GS(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Vx(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Ia(i,e){return Dt(i.prev,i,i.next)<0?Dt(i,e,i.next)>=0&&Dt(i,i.prev,e)>=0:Dt(i,e,i.prev)<0||Dt(i,i.next,e)<0}function HS(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function Gx(i,e){let t=Gf(i.i,i.x,i.y),n=Gf(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function zg(i,e,t,n){let r=Gf(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function La(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Gf(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function WS(i,e,t,n){let r=0;for(let s=e,o=t-n;s2&&i[e-1].equals(i[0])&&i.pop()}function Gg(i,e){for(let t=0;t0)&&d.push(_,b,S),(m!==n-1||l0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new W().setHex(r.value);break;case"v2":this.uniforms[n].value=new Be().fromArray(r.value);break;case"v3":this.uniforms[n].value=new U().fromArray(r.value);break;case"v4":this.uniforms[n].value=new _t().fromArray(r.value);break;case"m3":this.uniforms[n].value=new We().fromArray(r.value);break;case"m4":this.uniforms[n].value=new ze().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Ic=class extends Si{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},In=class extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new W(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ja,this.normalScale=new Be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _i,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},An=class extends In{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Be(1,1),this.clearcoatNormalMap=null,this.diffuseRoughnessMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return st(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessMinimum=100,this.iridescenceThicknessMaximum=400,this.iridescenceThicknessMap=null,this.sheenColor=new W(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new W(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new W(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._diffuseRoughness=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get diffuseRoughness(){return this._diffuseRoughness}set diffuseRoughness(e){this._diffuseRoughness>0!=e>0&&this.version++,this._diffuseRoughness=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){this._retroreflectivity>0!=e>0&&this.version++,this._retroreflectivity=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}get iridescenceThicknessRange(){return os('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),[this.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum]}set iridescenceThicknessRange(e){os('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),this.iridescenceThicknessMinimum=e[0],this.iridescenceThicknessMaximum=e[1]}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.diffuseRoughness=e.diffuseRoughness,this.diffuseRoughnessMap=e.diffuseRoughnessMap,this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};var Fa=class extends mn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new W(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ja,this.normalScale=new Be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _i,this.combine=Hc,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Lc=class extends mn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=fx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Fc=class extends mn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function Rr(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function pa(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}function PS(i){function e(r,s){return i[r]-i[s]}let t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Ig(i,e,t){let n=i.length,r=new i.constructor(n);for(let s=0,o=0;o!==n;++s){let a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=i[a+l]}return r}function IS(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=i[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=i[r++];while(s!==void 0)}var wi=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];n:{e:{let o;t:{i:if(!(e=s)){let a=t[1];e=s)break e}o=n,n=0;break t}break n}for(;n>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(He("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(He("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){He("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){He("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&E1(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){He("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===xc,s=e.length-1,o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,pa(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}};function Lg(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]+=e}function Fg(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]*=e}Ln.prototype.ValueTypeName="";Ln.prototype.TimeBufferType=Float32Array;Ln.prototype.ValueBufferType=Float32Array;Ln.prototype.DefaultInterpolation=Ji;var nr=class extends Ln{constructor(e,t,n){super(e,t,n)}};nr.prototype.ValueTypeName="bool";nr.prototype.ValueBufferType=Array;nr.prototype.DefaultInterpolation=Zi;nr.prototype.InterpolantFactoryMethodLinear=void 0;nr.prototype.InterpolantFactoryMethodSmooth=void 0;var Na=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}};Na.prototype.ValueTypeName="color";var ir=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}};ir.prototype.ValueTypeName="number";var Bc=class extends wi{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)Sn.slerpFlat(s,0,o,c-a,o,c,l);return s}},rr=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Bc(this.times,this.values,this.getValueSize(),e)}};rr.prototype.ValueTypeName="quaternion";rr.prototype.InterpolantFactoryMethodSmooth=void 0;var sr=class extends Ln{constructor(e,t,n){super(e,t,n)}};sr.prototype.ValueTypeName="string";sr.prototype.ValueBufferType=Array;sr.prototype.DefaultInterpolation=Zi;sr.prototype.InterpolantFactoryMethodLinear=void 0;sr.prototype.InterpolantFactoryMethodSmooth=void 0;var Nr=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}};Nr.prototype.ValueTypeName="vector";var Oa=class{constructor(e="",t=-1,n=[],r=hx){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(OS(n[o]).scale(r));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,o=n.length;s!==o;++s)t.push(Ln.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let s=t.length,o=[];for(let a=0;a1){let h=u[1],f=r[h];f||(r[h]=f=[]),f.push(c)}}let o=[];for(let a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,n));return o}resetDuration(){let e=this.tracks,t=0;for(let n=0,r=e.length;n!==r;++n){let s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e{t&&t(s),this.manager.itemEnd(e)},0);return}if(Yi[e]!==void 0){Yi[e].push({onLoad:t,onProgress:n,onError:r});return}Yi[e]=[],Yi[e].push({onLoad:t,onProgress:n,onError:r});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",priority:this.priority,cache:this.cache,signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&Fe("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=Yi[e],h=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,g=0,m=new ReadableStream({start(x){b();function b(){h.read().then(({done:_,value:y})=>{if(_)x.close();else{g+=y.byteLength;let M=new ProgressEvent("progress",{lengthComputable:p,loaded:g,total:d});for(let S=0,v=u.length;S{x.error(_)})}}});return new Response(m)}else throw new Ff(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a==="")return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{bi.add(`file:${e}`,c);let u=Yi[e];delete Yi[e];for(let h=0,f=u.length;h{let u=Yi[e];if(u===void 0)throw this.manager.itemError(e),c;delete Yi[e];for(let h=0,f=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var to=new WeakMap,zc=class extends Ti{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=bi.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let h=to.get(o);h===void 0&&(h=[],to.set(o,h)),h.push({onLoad:t,onError:r})}return o}let a=ao("img");function l(){u(),t&&t(this);let h=to.get(this)||[];for(let f=0;f"u"&&Fe("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Fe("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=bi.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{Sf.has(o)===!0?(r&&r(Sf.get(o)),s.manager.itemError(e),s.manager.itemEnd(e)):(t&&t(c),s.manager.itemEnd(e))});return}setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);return}let a={};a.credentials=this.withCredentials||this.crossOrigin!=="anonymous"?"include":"same-origin",a.headers=this.requestHeader,a.priority=this.priority,a.cache=this.cache,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign({},s.options,{colorSpaceConversion:"none"}))}).then(function(c){return bi.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Sf.set(l,c),bi.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});bi.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var no=-90,io=1,bo=class extends Et{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Jt(no,io,e,t);r.layers=this.layers,this.add(r);let s=new Jt(no,io,e,t);s.layers=this.layers,this.add(s);let o=new Jt(no,io,e,t);o.layers=this.layers,this.add(o);let a=new Jt(no,io,e,t);a.layers=this.layers,this.add(a);let l=new Jt(no,io,e,t);l.layers=this.layers,this.add(l);let c=new Jt(no,io,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===$n)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===oo)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let g=n.texture.mipmapsAutoUpdate;n.texture.mipmapsAutoUpdate=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.mipmapsAutoUpdate=g,e.setRenderTarget(n,5,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(h,f,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},Vc=class extends Jt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e,this.perCameraFrustumCulled=!1}};var gd="\\[\\]\\.:\\/",DS=new RegExp("["+gd+"]","g"),xd="[^"+gd+"]",US="[^"+gd.replace("\\.","")+"]",BS=/((?:WC+[\/:])*)/.source.replace("WC",xd),kS=/(WCOD+)?/.source.replace("WCOD",US),zS=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xd),VS=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xd),GS=new RegExp("^"+BS+kS+zS+VS+"$"),HS=["material","materials","bones","map"],Uf=class{constructor(e,t,n){let r=n||gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},gt=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(DS,"")}static parseTrackName(e){let t=GS.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);HS.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;od.start-p.start);let f=0;for(let d=1;d0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new W().setHex(r.value);break;case"v2":this.uniforms[n].value=new Ue().fromArray(r.value);break;case"v3":this.uniforms[n].value=new U().fromArray(r.value);break;case"v4":this.uniforms[n].value=new vt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Xe().fromArray(r.value);break;case"m4":this.uniforms[n].value=new ze().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Dc=class extends Si{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},In=class extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new W(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qa,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Kn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},An=class extends In{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ue(1,1),this.clearcoatNormalMap=null,this.diffuseRoughnessMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return st(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessMinimum=100,this.iridescenceThicknessMaximum=400,this.iridescenceThicknessMap=null,this.sheenColor=new W(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new W(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new W(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._diffuseRoughness=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get diffuseRoughness(){return this._diffuseRoughness}set diffuseRoughness(e){this._diffuseRoughness>0!=e>0&&this.version++,this._diffuseRoughness=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){this._retroreflectivity>0!=e>0&&this.version++,this._retroreflectivity=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}get iridescenceThicknessRange(){return as('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),[this.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum]}set iridescenceThicknessRange(e){as('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),this.iridescenceThicknessMinimum=e[0],this.iridescenceThicknessMaximum=e[1]}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.diffuseRoughness=e.diffuseRoughness,this.diffuseRoughnessMap=e.diffuseRoughnessMap,this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};var Oa=class extends mn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new W(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qa,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Kn,this.combine=$c,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Uc=class extends mn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Tx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Bc=class extends mn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function Cr(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function ga(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}function $S(i){function e(r,s){return i[r]-i[s]}let t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Wg(i,e,t){let n=i.length,r=new i.constructor(n);for(let s=0,o=0;o!==n;++s){let a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=i[a+l]}return r}function KS(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=i[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=i[r++];while(s!==void 0)}var wi=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];n:{e:{let o;t:{i:if(!(e=s)){let a=t[1];e=s)break e}o=n,n=0;break t}break n}for(;n>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(We("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(We("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){We("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){We("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&X1(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){We("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Mc,s=e.length-1,o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,ga(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}};function Xg(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]+=e}function Yg(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]*=e}Ln.prototype.ValueTypeName="";Ln.prototype.TimeBufferType=Float32Array;Ln.prototype.ValueBufferType=Float32Array;Ln.prototype.DefaultInterpolation=Ji;var ir=class extends Ln{constructor(e,t,n){super(e,t,n)}};ir.prototype.ValueTypeName="bool";ir.prototype.ValueBufferType=Array;ir.prototype.DefaultInterpolation=Zi;ir.prototype.InterpolantFactoryMethodLinear=void 0;ir.prototype.InterpolantFactoryMethodSmooth=void 0;var Da=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}};Da.prototype.ValueTypeName="color";var rr=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}};rr.prototype.ValueTypeName="number";var Hc=class extends wi{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)Sn.slerpFlat(s,0,o,c-a,o,c,l);return s}},sr=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Hc(this.times,this.values,this.getValueSize(),e)}};sr.prototype.ValueTypeName="quaternion";sr.prototype.InterpolantFactoryMethodSmooth=void 0;var or=class extends Ln{constructor(e,t,n){super(e,t,n)}};or.prototype.ValueTypeName="string";or.prototype.ValueBufferType=Array;or.prototype.DefaultInterpolation=Zi;or.prototype.InterpolantFactoryMethodLinear=void 0;or.prototype.InterpolantFactoryMethodSmooth=void 0;var Or=class extends Ln{constructor(e,t,n,r){super(e,t,n,r)}};Or.prototype.ValueTypeName="vector";var Ua=class{constructor(e="",t=-1,n=[],r=wx){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Ci(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(QS(n[o]).scale(r));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,o=n.length;s!==o;++s)t.push(Ln.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let s=t.length,o=[];for(let a=0;a1){let h=u[1],f=r[h];f||(r[h]=f=[]),f.push(c)}}let o=[];for(let a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,n));return o}resetDuration(){let e=this.tracks,t=0;for(let n=0,r=e.length;n!==r;++n){let s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e{t&&t(s),this.manager.itemEnd(e)},0);return}if(Yi[e]!==void 0){Yi[e].push({onLoad:t,onProgress:n,onError:r});return}Yi[e]=[],Yi[e].push({onLoad:t,onProgress:n,onError:r});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",priority:this.priority,cache:this.cache,signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&Oe("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=Yi[e],h=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,x=0,g=new ReadableStream({start(m){y();function y(){h.read().then(({done:_,value:b})=>{if(_)m.close();else{x+=b.byteLength;let M=new ProgressEvent("progress",{lengthComputable:p,loaded:x,total:d});for(let S=0,v=u.length;S{m.error(_)})}}});return new Response(g)}else throw new Wf(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a==="")return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{bi.add(`file:${e}`,c);let u=Yi[e];delete Yi[e];for(let h=0,f=u.length;h{let u=Yi[e];if(u===void 0)throw this.manager.itemError(e),c;delete Yi[e];for(let h=0,f=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var ro=new WeakMap,Xc=class extends Ti{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=bi.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let h=ro.get(o);h===void 0&&(h=[],ro.set(o,h)),h.push({onLoad:t,onError:r})}return o}let a=uo("img");function l(){u(),t&&t(this);let h=ro.get(this)||[];for(let f=0;f"u"&&Oe("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Oe("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=bi.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{Nf.has(o)===!0?(r&&r(Nf.get(o)),s.manager.itemError(e),s.manager.itemEnd(e)):(t&&t(c),s.manager.itemEnd(e))});return}setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);return}let a={};a.credentials=this.withCredentials||this.crossOrigin!=="anonymous"?"include":"same-origin",a.headers=this.requestHeader,a.priority=this.priority,a.cache=this.cache,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign({},s.options,{colorSpaceConversion:"none"}))}).then(function(c){return bi.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Nf.set(l,c),bi.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});bi.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var so=-90,oo=1,_o=class extends Et{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Jt(so,oo,e,t);r.layers=this.layers,this.add(r);let s=new Jt(so,oo,e,t);s.layers=this.layers,this.add(s);let o=new Jt(so,oo,e,t);o.layers=this.layers,this.add(o);let a=new Jt(so,oo,e,t);a.layers=this.layers,this.add(a);let l=new Jt(so,oo,e,t);l.layers=this.layers,this.add(l);let c=new Jt(so,oo,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===$n)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===co)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let x=n.texture.mipmapsAutoUpdate;n.texture.mipmapsAutoUpdate=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.mipmapsAutoUpdate=x,e.setRenderTarget(n,5,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(h,f,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},Yc=class extends Jt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e,this.perCameraFrustumCulled=!1}};var Ed="\\[\\]\\.:\\/",ew=new RegExp("["+Ed+"]","g"),Rd="[^"+Ed+"]",tw="[^"+Ed.replace("\\.","")+"]",nw=/((?:WC+[\/:])*)/.source.replace("WC",Rd),iw=/(WCOD+)?/.source.replace("WCOD",tw),rw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rd),sw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rd),ow=new RegExp("^"+nw+iw+rw+sw+"$"),aw=["material","materials","bones","map"],$f=class{constructor(e,t,n){let r=n||gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},gt=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ew,"")}static parseTrackName(e){let t=ow.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);aw.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;od.start-p.start);let f=0;for(let d=1;d!!i.due&&i.due<=e;var : cases.z; return clamp( threshold , 1.0e-6, 1.0 ); } -#endif`,$S=`#ifdef USE_ALPHAMAP +#endif`,fw=`#ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; -#endif`,KS=`#ifdef USE_ALPHAMAP +#endif`,dw=`#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,ZS=`#ifdef USE_ALPHATEST +#endif`,pw=`#ifdef USE_ALPHATEST #ifdef ALPHA_TO_COVERAGE diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); if ( diffuseColor.a == 0.0 ) discard; #else if ( diffuseColor.a < alphaTest ) discard; #endif -#endif`,JS=`#ifdef USE_ALPHATEST +#endif`,mw=`#ifdef USE_ALPHATEST uniform float alphaTest; -#endif`,jS=`#ifdef USE_AOMAP +#endif`,gw=`#ifdef USE_AOMAP float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; reflectedLight.indirectDiffuse *= ambientOcclusion; #if defined( USE_CLEARCOAT ) @@ -66,10 +66,10 @@ var M0=1.3,S0=(i,e=new Date().toISOString().slice(0,10))=>!!i.due&&i.due<=e;var float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); #endif -#endif`,QS=`#ifdef USE_AOMAP +#endif`,xw=`#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; -#endif`,ew=`#ifdef USE_BATCHING +#endif`,yw=`#ifdef USE_BATCHING #if ! defined( GL_ANGLE_multi_draw ) #define gl_DrawID _gl_DrawID uniform int _gl_DrawID; @@ -103,15 +103,15 @@ var M0=1.3,S0=(i,e=new Date().toISOString().slice(0,10))=>!!i.due&&i.due<=e;var int y = j / size; return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); } -#endif`,tw=`#ifdef USE_BATCHING +#endif`,bw=`#ifdef USE_BATCHING mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); -#endif`,nw=`vec3 transformed = vec3( position ); +#endif`,vw=`vec3 transformed = vec3( position ); #ifdef USE_ALPHAHASH vPosition = vec3( position ); -#endif`,iw=`vec3 objectNormal = vec3( normal ); +#endif`,_w=`vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); -#endif`,rw=`float G_BlinnPhong_Implicit( ) { +#endif`,Mw=`float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { @@ -125,7 +125,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); -} // validated`,sw=`#ifdef USE_IRIDESCENCE +} // validated`,Sw=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, @@ -188,7 +188,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve } return max( I, vec3( 0.0 ) ); } -#endif`,ow=`#ifdef USE_BUMPMAP +#endif`,ww=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { @@ -209,7 +209,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } -#endif`,aw=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Tw=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -255,20 +255,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,lw=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Aw=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,cw=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Ew=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,uw=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Rw=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,hw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) +#endif`,Cw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; -#endif`,fw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) +#endif`,Pw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) varying vec4 vColor; -#endif`,dw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) +#endif`,Iw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec4 vColor; -#endif`,pw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) +#endif`,Lw=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec4( 1.0 ); #endif #ifdef USE_COLOR_ALPHA @@ -281,7 +281,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_BATCHING_COLOR vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); -#endif`,mw=`#define PI 3.141592653589793 +#endif`,Fw=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -352,7 +352,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,gw=`vec3 transformedNormal = objectNormal; +} // validated`,Nw=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -378,21 +378,21 @@ transformedNormal = normalMatrix * transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; -#endif`,xw=`#ifdef USE_DISPLACEMENTMAP +#endif`,Ow=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,bw=`#ifdef USE_DISPLACEMENTMAP +#endif`,Dw=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,yw=`#ifdef USE_EMISSIVEMAP +#endif`,Uw=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,_w=`#ifdef USE_EMISSIVEMAP +#endif`,Bw=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,vw="gl_FragColor = linearToOutputTexel( gl_FragColor );",Mw=`vec4 LinearTransferOETF( in vec4 value ) { +#endif`,kw="gl_FragColor = linearToOutputTexel( gl_FragColor );",zw=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { @@ -400,7 +400,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) { } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,Sw=`#ifdef USE_ENVMAP +}`,Vw=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -427,7 +427,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif -#endif`,ww=`#ifdef USE_ENVMAP +#endif`,Gw=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform mat3 envMapRotation; uniform samplerCube envMap; @@ -437,7 +437,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { return ENVMAP_MAX_LOD * r * ( 2.0 - r ); } #endif -#endif`,Tw=`#ifdef USE_ENVMAP +#endif`,Hw=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -448,7 +448,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,Aw=`#ifdef USE_ENVMAP +#endif`,Ww=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -459,7 +459,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,Ew=`#ifdef USE_ENVMAP +#endif`,Xw=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -476,18 +476,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,Rw=`#ifdef USE_FOG +#endif`,Yw=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,Cw=`#ifdef USE_FOG +#endif`,qw=`#ifdef USE_FOG varying float vFogDepth; -#endif`,Pw=`#ifdef USE_FOG +#endif`,$w=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,Iw=`#ifdef USE_FOG +#endif`,Kw=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -496,7 +496,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,Lw=`#ifdef USE_GRADIENTMAP +#endif`,Zw=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -508,12 +508,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,Fw=`#ifdef USE_LIGHTMAP +}`,Jw=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,Nw=`LambertMaterial material; +#endif`,jw=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Ow=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Qw=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -527,7 +527,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Dw=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,e2=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -656,7 +656,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi return irradiance; } #endif -#include `,Uw=`#ifdef USE_ENVMAP +#include `,t2=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_PMREM vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); @@ -713,8 +713,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi } #endif #endif -#endif`,Bw=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,kw=`varying vec3 vViewPosition; +#endif`,n2=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,i2=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -726,11 +726,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,zw=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,r2=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Vw=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,s2=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -747,7 +747,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Gw=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,o2=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb; material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); material.metalness = metalnessFactor; @@ -848,7 +848,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,Hw=`uniform sampler2D dfgLUT; +#endif`,a2=`uniform sampler2D dfgLUT; struct PhysicalMaterial { vec3 diffuseColor; vec3 diffuseContribution; @@ -1271,7 +1271,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,Ww=` +}`,l2=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1429,7 +1429,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,Xw=`#if defined( RE_IndirectDiffuse ) +#endif`,c2=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1459,7 +1459,7 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Yw=`#if defined( RE_IndirectDiffuse ) +#endif`,u2=`#if defined( RE_IndirectDiffuse ) #if defined( LAMBERT ) || defined( PHONG ) irradiance += iblIrradiance; #endif @@ -1467,7 +1467,7 @@ IncidentLight directLight; #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,qw=`#if NUM_LIGHT_PROBE_GRIDS > 0 +#endif`,h2=`#if NUM_LIGHT_PROBE_GRIDS > 0 uniform highp sampler3D probesSH[ NUM_LIGHT_PROBE_GRIDS ]; uniform vec3 probesMin[ NUM_LIGHT_PROBE_GRIDS ]; uniform vec3 probesMax[ NUM_LIGHT_PROBE_GRIDS ]; @@ -1516,27 +1516,27 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 result += c8 * 0.429043 * ( x * x - y * y ); return max( result, vec3( 0.0 ) ); } -#endif`,$w=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) +#endif`,f2=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Kw=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) +#endif`,d2=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Zw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER +#endif`,p2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER varying float vFragDepth; varying float vIsPerspective; -#endif`,Jw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER +#endif`,m2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,jw=`#ifdef USE_MAP +#endif`,g2=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,Qw=`#ifdef USE_MAP +#endif`,x2=`#ifdef USE_MAP uniform sampler2D map; -#endif`,e2=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,y2=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1548,7 +1548,7 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,t2=`#if defined( USE_POINTS_UV ) +#endif`,b2=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1560,19 +1560,19 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,n2=`float metalnessFactor = metalness; +#endif`,v2=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,i2=`#ifdef USE_METALNESSMAP +#endif`,_2=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,r2=`#ifdef USE_INSTANCING_MORPH +#endif`,M2=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } -#endif`,s2=`#if defined( USE_MORPHCOLORS ) +#endif`,S2=`#if defined( USE_MORPHCOLORS ) #if defined( USE_COLOR_ALPHA ) vColor *= morphTargetBaseInfluence; #elif defined( USE_COLOR ) @@ -1585,12 +1585,12 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 if ( morphTargetInfluences[ i ] != 0.0 ) vColor.rgb += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,o2=`#ifdef USE_MORPHNORMALS +#endif`,w2=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } -#endif`,a2=`#ifdef USE_MORPHTARGETS +#endif`,T2=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1604,12 +1604,12 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,l2=`#ifdef USE_MORPHTARGETS +#endif`,A2=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } -#endif`,c2=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,E2=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1650,7 +1650,7 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,u2=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,R2=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1668,19 +1668,19 @@ vec3 nonPerturbedNormal = normal;`,u2=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,h2=`#ifndef FLAT_SHADED +#endif`,C2=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,f2=`#ifndef FLAT_SHADED +#endif`,P2=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,d2=`#ifndef FLAT_SHADED +#endif`,I2=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); @@ -1689,7 +1689,7 @@ vec3 nonPerturbedNormal = normal;`,u2=`#ifdef USE_NORMALMAP_OBJECTSPACE vBitangent = - vBitangent; #endif #endif -#endif`,p2=`#ifdef USE_NORMALMAP +#endif`,L2=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1711,13 +1711,13 @@ vec3 nonPerturbedNormal = normal;`,u2=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,m2=`#ifdef USE_CLEARCOAT +#endif`,F2=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,g2=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,N2=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,x2=`#ifdef USE_CLEARCOATMAP +#endif`,O2=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1726,18 +1726,18 @@ vec3 nonPerturbedNormal = normal;`,u2=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,b2=`#ifdef USE_IRIDESCENCEMAP +#endif`,D2=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,y2=`#ifdef OPAQUE +#endif`,U2=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,_2=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,B2=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1816,9 +1816,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const #else return ( near * far ) / ( ( far - near ) * depth - far ); #endif -}`,v2=`#ifdef PREMULTIPLIED_ALPHA +}`,k2=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,M2=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,z2=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1826,22 +1826,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,V2=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,w2=`#ifdef DITHERING +#endif`,G2=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,T2=`float roughnessFactor = roughness; +#endif`,H2=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,A2=`#ifdef USE_ROUGHNESSMAP +#endif`,W2=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,E2=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,X2=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2095,7 +2095,7 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING } #endif #endif -#endif`,R2=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Y2=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2140,7 +2140,7 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,C2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,q2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) #ifdef HAS_NORMAL vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); #else @@ -2180,7 +2180,7 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,P2=`float getShadowMask() { +#endif`,$2=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_SUN_LIGHT_SHADOWS > 0 @@ -2221,12 +2221,12 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING #endif #endif return shadow; -}`,I2=`#ifdef USE_SKINNING +}`,K2=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,L2=`#ifdef USE_SKINNING +#endif`,Z2=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2241,7 +2241,7 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,F2=`#ifdef USE_SKINNING +#endif`,J2=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2249,7 +2249,7 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,N2=`#ifdef USE_SKINNING +#endif`,j2=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2260,17 +2260,17 @@ gl_Position = projectionMatrix * mvPosition;`,S2=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,O2=`float specularStrength; +#endif`,Q2=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,D2=`#ifdef USE_SPECULARMAP +#endif`,eT=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,U2=`#if defined( TONE_MAPPING ) +#endif`,tT=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,B2=`#ifndef saturate +#endif`,nT=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2367,7 +2367,7 @@ vec3 NeutralToneMapping( vec3 color ) { float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,iT=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2388,7 +2388,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,z2=`#ifdef USE_TRANSMISSION +#endif`,rT=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2514,7 +2514,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,V2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,sT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2587,7 +2587,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,G2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,oT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2685,7 +2685,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,H2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,aT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2759,7 +2759,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,W2=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,lT=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2768,12 +2768,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k2=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`,X2=`varying vec2 vUv; +#endif`,cT=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Y2=`uniform sampler2D t2D; +}`,uT=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2785,14 +2785,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,q2=`varying vec3 vWorldDirection; +}`,hT=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,$2=`uniform float backgroundBlurriness; +}`,fT=`uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; @@ -2807,14 +2807,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,K2=`varying vec3 vWorldDirection; +}`,dT=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Z2=`uniform samplerCube tCube; +}`,pT=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2824,7 +2824,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,J2=`#include +}`,mT=`#include #include #include #include @@ -2851,7 +2851,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,j2=`#if DEPTH_PACKING == 3200 +}`,gT=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2889,7 +2889,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,Q2=`#define DISTANCE +}`,xT=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2916,7 +2916,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,eT=`#define DISTANCE +}`,yT=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2939,13 +2939,13 @@ void main() { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); -}`,tT=`varying vec3 vWorldDirection; +}`,bT=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,nT=`uniform sampler2D tEquirect; +}`,vT=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2954,7 +2954,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,iT=`uniform float scale; +}`,_T=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2976,7 +2976,7 @@ void main() { #include #include #include -}`,rT=`uniform vec3 diffuse; +}`,MT=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -3004,7 +3004,7 @@ void main() { #include #include #include -}`,sT=`#include +}`,ST=`#include #include #include #include @@ -3036,7 +3036,7 @@ void main() { #include #include #include -}`,oT=`uniform vec3 diffuse; +}`,wT=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -3084,7 +3084,7 @@ void main() { #include #include #include -}`,aT=`#define LAMBERT +}`,TT=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3123,7 +3123,7 @@ void main() { #include #include #include -}`,lT=`#define LAMBERT +}`,AT=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3180,7 +3180,7 @@ void main() { #include #include #include -}`,cT=`#define MATCAP +}`,ET=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3214,7 +3214,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,uT=`#define MATCAP +}`,RT=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3260,7 +3260,7 @@ void main() { #include #include #include -}`,hT=`#define NORMAL +}`,CT=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3293,7 +3293,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,fT=`#define NORMAL +}`,PT=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3314,7 +3314,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,dT=`#define PHONG +}`,IT=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3353,7 +3353,7 @@ void main() { #include #include #include -}`,pT=`#define PHONG +}`,LT=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3412,7 +3412,7 @@ void main() { #include #include #include -}`,mT=`#define STANDARD +}`,FT=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3455,7 +3455,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,gT=`#define STANDARD +}`,NT=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3588,7 +3588,7 @@ void main() { #include #include #include -}`,xT=`#define TOON +}`,OT=`#define TOON varying vec3 vViewPosition; #include #include @@ -3625,7 +3625,7 @@ void main() { #include #include #include -}`,bT=`#define TOON +}`,DT=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3677,7 +3677,7 @@ void main() { #include #include #include -}`,yT=`uniform float size; +}`,UT=`uniform float size; uniform float scale; #include #include @@ -3708,7 +3708,7 @@ void main() { #include #include #include -}`,_T=`uniform vec3 diffuse; +}`,BT=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3733,7 +3733,7 @@ void main() { #include #include #include -}`,vT=`#include +}`,kT=`#include #include #include #include @@ -3756,7 +3756,7 @@ void main() { #include #include #include -}`,MT=`uniform vec3 color; +}`,zT=`uniform vec3 color; uniform float opacity; #include #include @@ -3772,7 +3772,7 @@ void main() { #include #include #include -}`,ST=`uniform float rotation; +}`,VT=`uniform float rotation; uniform vec2 center; #include #include @@ -3796,7 +3796,7 @@ void main() { #include #include #include -}`,wT=`uniform vec3 diffuse; +}`,GT=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3821,7 +3821,7 @@ void main() { #include #include #include -}`,Qe={alphahash_fragment:YS,alphahash_pars_fragment:qS,alphamap_fragment:$S,alphamap_pars_fragment:KS,alphatest_fragment:ZS,alphatest_pars_fragment:JS,aomap_fragment:jS,aomap_pars_fragment:QS,batching_pars_vertex:ew,batching_vertex:tw,begin_vertex:nw,beginnormal_vertex:iw,bsdfs:rw,iridescence_fragment:sw,bumpmap_pars_fragment:ow,clipping_planes_fragment:aw,clipping_planes_pars_fragment:lw,clipping_planes_pars_vertex:cw,clipping_planes_vertex:uw,color_fragment:hw,color_pars_fragment:fw,color_pars_vertex:dw,color_vertex:pw,common:mw,defaultnormal_vertex:gw,displacementmap_pars_vertex:xw,displacementmap_vertex:bw,emissivemap_fragment:yw,emissivemap_pars_fragment:_w,colorspace_fragment:vw,colorspace_pars_fragment:Mw,envmap_fragment:Sw,envmap_common_pars_fragment:ww,envmap_pars_fragment:Tw,envmap_pars_vertex:Aw,envmap_physical_pars_fragment:Uw,envmap_vertex:Ew,fog_vertex:Rw,fog_pars_vertex:Cw,fog_fragment:Pw,fog_pars_fragment:Iw,gradientmap_pars_fragment:Lw,lightmap_pars_fragment:Fw,lights_lambert_fragment:Nw,lights_lambert_pars_fragment:Ow,lights_pars_begin:Dw,lights_toon_fragment:Bw,lights_toon_pars_fragment:kw,lights_phong_fragment:zw,lights_phong_pars_fragment:Vw,lights_physical_fragment:Gw,lights_physical_pars_fragment:Hw,lights_fragment_begin:Ww,lights_fragment_maps:Xw,lights_fragment_end:Yw,lightprobes_pars_fragment:qw,logdepthbuf_fragment:$w,logdepthbuf_pars_fragment:Kw,logdepthbuf_pars_vertex:Zw,logdepthbuf_vertex:Jw,map_fragment:jw,map_pars_fragment:Qw,map_particle_fragment:e2,map_particle_pars_fragment:t2,metalnessmap_fragment:n2,metalnessmap_pars_fragment:i2,morphinstance_vertex:r2,morphcolor_vertex:s2,morphnormal_vertex:o2,morphtarget_pars_vertex:a2,morphtarget_vertex:l2,normal_fragment_begin:c2,normal_fragment_maps:u2,normal_pars_fragment:h2,normal_pars_vertex:f2,normal_vertex:d2,normalmap_pars_fragment:p2,clearcoat_normal_fragment_begin:m2,clearcoat_normal_fragment_maps:g2,clearcoat_pars_fragment:x2,iridescence_pars_fragment:b2,opaque_fragment:y2,packing:_2,premultiplied_alpha_fragment:v2,project_vertex:M2,dithering_fragment:S2,dithering_pars_fragment:w2,roughnessmap_fragment:T2,roughnessmap_pars_fragment:A2,shadowmap_pars_fragment:E2,shadowmap_pars_vertex:R2,shadowmap_vertex:C2,shadowmask_pars_fragment:P2,skinbase_vertex:I2,skinning_pars_vertex:L2,skinning_vertex:F2,skinnormal_vertex:N2,specularmap_fragment:O2,specularmap_pars_fragment:D2,tonemapping_fragment:U2,tonemapping_pars_fragment:B2,transmission_fragment:k2,transmission_pars_fragment:z2,uv_pars_fragment:V2,uv_pars_vertex:G2,uv_vertex:H2,worldpos_vertex:W2,background_vert:X2,background_frag:Y2,backgroundCube_vert:q2,backgroundCube_frag:$2,cube_vert:K2,cube_frag:Z2,depth_vert:J2,depth_frag:j2,distance_vert:Q2,distance_frag:eT,equirect_vert:tT,equirect_frag:nT,linedashed_vert:iT,linedashed_frag:rT,meshbasic_vert:sT,meshbasic_frag:oT,meshlambert_vert:aT,meshlambert_frag:lT,meshmatcap_vert:cT,meshmatcap_frag:uT,meshnormal_vert:hT,meshnormal_frag:fT,meshphong_vert:dT,meshphong_frag:pT,meshphysical_vert:mT,meshphysical_frag:gT,meshtoon_vert:xT,meshtoon_frag:bT,points_vert:yT,points_frag:_T,shadow_vert:vT,shadow_frag:MT,sprite_vert:ST,sprite_frag:wT},ve={common:{diffuse:{value:new W(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new We}},envmap:{envMap:{value:null},envMapRotation:{value:new We},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new We}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new We}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new We},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new We},normalScale:{value:new Be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new We},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new We}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new We}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new We}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new W(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:[]},probesMin:{value:[]},probesMax:{value:[]},probesResolution:{value:[]}},points:{diffuse:{value:new W(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0},uvTransform:{value:new We}},sprite:{diffuse:{value:new W(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0}}},Ii={basic:{uniforms:bn([ve.common,ve.specularmap,ve.envmap,ve.aomap,ve.lightmap,ve.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:bn([ve.common,ve.specularmap,ve.envmap,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.fog,ve.lights,{emissive:{value:new W(0)},envMapIntensity:{value:1}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:bn([ve.common,ve.specularmap,ve.envmap,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.fog,ve.lights,{emissive:{value:new W(0)},specular:{value:new W(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:bn([ve.common,ve.envmap,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.roughnessmap,ve.metalnessmap,ve.fog,ve.lights,{emissive:{value:new W(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:bn([ve.common,ve.aomap,ve.lightmap,ve.emissivemap,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.gradientmap,ve.fog,ve.lights,{emissive:{value:new W(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:bn([ve.common,ve.bumpmap,ve.normalmap,ve.displacementmap,ve.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:bn([ve.points,ve.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:bn([ve.common,ve.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:bn([ve.common,ve.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:bn([ve.common,ve.bumpmap,ve.normalmap,ve.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.meshnormal_vert,fragmentShader:Qe.meshnormal_frag},sprite:{uniforms:bn([ve.sprite,ve.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new We},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new We}},vertexShader:Qe.backgroundCube_vert,fragmentShader:Qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distance:{uniforms:bn([ve.common,ve.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distance_vert,fragmentShader:Qe.distance_frag},shadow:{uniforms:bn([ve.lights,ve.fog,{color:{value:new W(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};Ii.physical={uniforms:bn([Ii.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new We},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new We},clearcoatNormalScale:{value:new Be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new We},diffuseRoughness:{value:0},diffuseRoughnessMap:{value:null},diffuseRoughnessMapTransform:{value:new We},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new We},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new We},sheen:{value:0},sheenColor:{value:new W(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new We},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new We},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new We},transmissionSamplerSize:{value:new Be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new We},attenuationDistance:{value:0},attenuationColor:{value:new W(0)},specularColor:{value:new W(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new We},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new We},anisotropyVector:{value:new Be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new We}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};var Pu={r:0,b:0,g:0},TT=new ze,tb=new We;tb.set(-1,0,0,0,1,0,0,0,1);function AT(i,e,t,n,r,s){let o=new W(0),a=r===!0?0:1,l,c,u=null,h=0,f=null;function d(b){let _=b.isScene===!0?b.background:null;if(_&&_.isTexture){let y=b.backgroundBlurriness>0;_=e.get(_,y)}return _}function p(b){let _=!1,y=d(b);y===null?m(o,a):y&&y.isColor&&(m(y,1),_=!0);let M=i.xr.getEnvironmentBlendMode();M==="additive"?t.buffers.color.setClear(0,0,0,1,s):M==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||_)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function g(b,_){let y=d(_);y&&y.isCubeTexture?(c===void 0&&(c=new we(new Mi(1,1,1),new Si({name:"BackgroundCubeMaterial",uniforms:_s(Ii.backgroundCube.uniforms),vertexShader:Ii.backgroundCube.vertexShader,fragmentShader:Ii.backgroundCube.fragmentShader,side:un,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(M,S,v){this.matrixWorld.copyPosition(v.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=y,c.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(TT.makeRotationFromEuler(_.backgroundRotation)).transpose(),y.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(tb),c.material.toneMapped=nt.getTransfer(y.colorSpace)!==Mt,(u!==y||h!==y.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,u=y,h=y.version,f=i.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(l===void 0&&(l=new we(new sn(2,2),new Si({name:"BackgroundMaterial",uniforms:_s(Ii.background.uniforms),vertexShader:Ii.background.vertexShader,fragmentShader:Ii.background.fragmentShader,side:Ai,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=y,l.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,l.material.toneMapped=nt.getTransfer(y.colorSpace)!==Mt,y.matrixAutoUpdate===!0&&y.updateMatrix(),l.material.uniforms.uvTransform.value.copy(y.matrix),(u!==y||h!==y.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=y,h=y.version,f=i.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null))}function m(b,_){b.getRGB(Pu,md(i)),t.buffers.color.setClear(Pu.r,Pu.g,Pu.b,_,s)}function x(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(b,_=1){o.set(b),a=_,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(b){a=b,m(o,a)},render:p,addToRenderList:g,dispose:x}}function ET(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null),s=r,o=!1;function a(R,N,O,P,I){let D=!1,F=h(R,P,O,N);s!==F&&(s=F,c(s.object)),D=d(R,P,O,I),D&&p(R,P,O,I),I!==null&&e.update(I,i.ELEMENT_ARRAY_BUFFER),(D||o)&&(o=!1,y(R,N,O,P),I!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(I).buffer))}function l(){return i.createVertexArray()}function c(R){return i.bindVertexArray(R)}function u(R){return i.deleteVertexArray(R)}function h(R,N,O,P){let I=P.wireframe===!0,D=n[N.id];D===void 0&&(D={},n[N.id]=D);let F=R.isInstancedMesh===!0?R.id:0,H=D[F];H===void 0&&(H={},D[F]=H);let B=H[O.id];B===void 0&&(B={},H[O.id]=B);let X=B[I];return X===void 0&&(X=f(l()),B[I]=X),X}function f(R){let N=[],O=[],P=[];for(let I=0;I=0){let V=I[B],re=D[B];if(re===void 0&&(B==="instanceMatrix"&&R.instanceMatrix&&(re=R.instanceMatrix),B==="instanceColor"&&R.instanceColor&&(re=R.instanceColor)),V===void 0||V.attribute!==re||re&&V.data!==re.data)return!0;F++}return s.attributesNum!==F||s.index!==P}function p(R,N,O,P){let I={},D=N.attributes,F=0,H=O.getAttributes();for(let B in H)if(H[B].location>=0){let V=D[B];V===void 0&&(B==="instanceMatrix"&&R.instanceMatrix&&(V=R.instanceMatrix),B==="instanceColor"&&R.instanceColor&&(V=R.instanceColor));let re={};re.attribute=V,V&&V.data&&(re.data=V.data),I[B]=re,F++}s.attributes=I,s.attributesNum=F,s.index=P}function g(){let R=s.newAttributes;for(let N=0,O=R.length;N=0){let X=I[H];if(X===void 0&&(H==="instanceMatrix"&&R.instanceMatrix&&(X=R.instanceMatrix),H==="instanceColor"&&R.instanceColor&&(X=R.instanceColor)),X!==void 0){let V=X.normalized,re=X.itemSize,be=e.get(X);if(be===void 0)continue;let Y=be.buffer,Q=be.type,se=be.bytesPerElement,Se=Q===i.INT||Q===i.UNSIGNED_INT||X.gpuType===Yc;if(X.isInterleavedBufferAttribute){let ce=X.data,Le=ce.isInterleavedBuffer===!0?ce.stride:ce.itemSize,at=X.offset;if(ce.isInstancedInterleavedBuffer||ce.isInstancedBufferAttribute){for(let Te=0;Te0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";v="mediump"}return v==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Fe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=t.logarithmicDepthBuffer===!0&&h===!1;t.reversedDepthBuffer===!0&&h===!1&&Fe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),t.logarithmicDepthBuffer===!0&&h===!0&&Fe("WebGLRenderer: Logarithmic depth buffer is ignored when reversed depth buffer is enabled.");let d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),x=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),M=i.getParameter(i.MAX_SAMPLES),S=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:m,maxAttributes:x,maxVertexUniforms:b,maxVaryings:_,maxFragmentUniforms:y,maxSamples:M,samples:S}}function PT(i){let e=this,t=null,n=0,r=!1,s=!1,o=new si,a=new We,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){let d=h.length!==0||f||n!==0||r;return r=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){let p=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,x=i.get(h);if(!r||p===null||p.length===0||s&&!m)s?u(null):c();else{let b=s?0:n,_=b*4,y=x.clippingState||null;l.value=y,y=u(p,f,_,d);for(let M=0;M!==_;++M)y[M]=t[M];x.clippingState=y,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,p){let g=h!==null?h.length:0,m=null;if(g!==0){if(m=l.value,p!==!0||m===null){let x=d+g*4,b=f.matrixWorldInverse;a.getNormalMatrix(b),(m===null||m.length0;_=e.get(_,b)}return _}function p(y){let _=!1,b=d(y);b===null?g(o,a):b&&b.isColor&&(g(b,1),_=!0);let M=i.xr.getEnvironmentBlendMode();M==="additive"?t.buffers.color.setClear(0,0,0,1,s):M==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||_)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function x(y,_){let b=d(_);b&&b.isCubeTexture?(c===void 0&&(c=new Se(new Mi(1,1,1),new Si({name:"BackgroundCubeMaterial",uniforms:_s(Ii.backgroundCube.uniforms),vertexShader:Ii.backgroundCube.vertexShader,fragmentShader:Ii.backgroundCube.fragmentShader,side:un,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(M,S,v){this.matrixWorld.copyPosition(v.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(HT.makeRotationFromEuler(_.backgroundRotation)).transpose(),b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(py),c.material.toneMapped=it.getTransfer(b.colorSpace)!==Mt,(u!==b||h!==b.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,u=b,h=b.version,f=i.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new Se(new sn(2,2),new Si({name:"BackgroundMaterial",uniforms:_s(Ii.background.uniforms),vertexShader:Ii.background.vertexShader,fragmentShader:Ii.background.fragmentShader,side:Ai,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,l.material.toneMapped=it.getTransfer(b.colorSpace)!==Mt,b.matrixAutoUpdate===!0&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),(u!==b||h!==b.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=b,h=b.version,f=i.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function g(y,_){y.getRGB(Ou,Ad(i)),t.buffers.color.setClear(Ou.r,Ou.g,Ou.b,_,s)}function m(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,_=1){o.set(y),a=_,g(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(y){a=y,g(o,a)},render:p,addToRenderList:x,dispose:m}}function XT(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null),s=r,o=!1;function a(C,L,O,P,I){let D=!1,F=h(C,P,O,L);s!==F&&(s=F,c(s.object)),D=d(C,P,O,I),D&&p(C,P,O,I),I!==null&&e.update(I,i.ELEMENT_ARRAY_BUFFER),(D||o)&&(o=!1,b(C,L,O,P),I!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(I).buffer))}function l(){return i.createVertexArray()}function c(C){return i.bindVertexArray(C)}function u(C){return i.deleteVertexArray(C)}function h(C,L,O,P){let I=P.wireframe===!0,D=n[L.id];D===void 0&&(D={},n[L.id]=D);let F=C.isInstancedMesh===!0?C.id:0,H=D[F];H===void 0&&(H={},D[F]=H);let B=H[O.id];B===void 0&&(B={},H[O.id]=B);let X=B[I];return X===void 0&&(X=f(l()),B[I]=X),X}function f(C){let L=[],O=[],P=[];for(let I=0;I=0){let V=I[B],re=D[B];if(re===void 0&&(B==="instanceMatrix"&&C.instanceMatrix&&(re=C.instanceMatrix),B==="instanceColor"&&C.instanceColor&&(re=C.instanceColor)),V===void 0||V.attribute!==re||re&&V.data!==re.data)return!0;F++}return s.attributesNum!==F||s.index!==P}function p(C,L,O,P){let I={},D=L.attributes,F=0,H=O.getAttributes();for(let B in H)if(H[B].location>=0){let V=D[B];V===void 0&&(B==="instanceMatrix"&&C.instanceMatrix&&(V=C.instanceMatrix),B==="instanceColor"&&C.instanceColor&&(V=C.instanceColor));let re={};re.attribute=V,V&&V.data&&(re.data=V.data),I[B]=re,F++}s.attributes=I,s.attributesNum=F,s.index=P}function x(){let C=s.newAttributes;for(let L=0,O=C.length;L=0){let X=I[H];if(X===void 0&&(H==="instanceMatrix"&&C.instanceMatrix&&(X=C.instanceMatrix),H==="instanceColor"&&C.instanceColor&&(X=C.instanceColor)),X!==void 0){let V=X.normalized,re=X.itemSize,ye=e.get(X);if(ye===void 0)continue;let Y=ye.buffer,Q=ye.type,se=ye.bytesPerElement,we=Q===i.INT||Q===i.UNSIGNED_INT||X.gpuType===Jc;if(X.isInterleavedBufferAttribute){let le=X.data,Ne=le.isInterleavedBuffer===!0?le.stride:le.itemSize,at=X.offset;if(le.isInstancedInterleavedBuffer||le.isInstancedBufferAttribute){for(let Ae=0;Ae0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";v="mediump"}return v==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Oe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=t.logarithmicDepthBuffer===!0&&h===!1;t.reversedDepthBuffer===!0&&h===!1&&Oe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),t.logarithmicDepthBuffer===!0&&h===!0&&Oe("WebGLRenderer: Logarithmic depth buffer is ignored when reversed depth buffer is enabled.");let d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),m=i.getParameter(i.MAX_VERTEX_ATTRIBS),y=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),b=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),M=i.getParameter(i.MAX_SAMPLES),S=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:x,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:b,maxSamples:M,samples:S}}function $T(i){let e=this,t=null,n=0,r=!1,s=!1,o=new oi,a=new Xe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){let d=h.length!==0||f||n!==0||r;return r=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){let p=h.clippingPlanes,x=h.clipIntersection,g=h.clipShadows,m=i.get(h);if(!r||p===null||p.length===0||s&&!g)s?u(null):c();else{let y=s?0:n,_=y*4,b=m.clippingState||null;l.value=b,b=u(p,f,_,d);for(let M=0;M!==_;++M)b[M]=t[M];m.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,p){let x=h!==null?h.length:0,g=null;if(x!==0){if(g=l.value,p!==!0||g===null){let m=d+x*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0&&(u.texture.mipmapsAutoUpdate=!1);let h=l.autoClear,f=l.autoClearColor,d=l.autoClearDepth,p=l.autoClearStencil,g=e.background;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,g===null&&(e.background=l.getClearColor(OT));let m=new bo(n,r,u);return m.position.copy(a),m.update(l,e),l.autoClear=h,l.autoClearColor=f,l.autoClearDepth=d,l.autoClearStencil=p,e.background=g,t>0&&(u.texture.mipmapsAutoUpdate=!0,this._blur(c,t)),this._applyPMREM(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Dx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ox(),this._compileMaterial(this._equirectMaterial))}dispose(){this._sourceTarget!==null&&this._sourceTarget.dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._integrationMaterial!==null&&this._integrationMaterial.dispose(),this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max(Fx,fd(e))}_fromTexture(e,t){e.mapping===bs||e.mapping===_o?this._setSize(e.image.length===0?Fx:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4);let n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){let e=this._cubeSize,t=Nx(e,!1,!1),n=Math.log2(e)-IT;for(let r=0;r<=n;r++)t.texture.mipmaps.push({width:e>>r,height:e>>r});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){let t=this._cubeSize,n=this._sourceTarget;return(n===null||n.width!==t||e&&n.depthBuffer===!1)&&(n!==null&&n.dispose(),this._sourceTarget=Nx(t,!0,e)),this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){let r=this._boxMesh,s=this._cubeCamera;r.material=n,s.renderTarget=e,s.activeMipmapLevel=t;let o=e.width>>t;e.viewport.set(0,0,o,o),s.update(this._renderer,r),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;e.mapping===bs||e.mapping===_o?(this._cubemapMaterial===null&&(this._cubemapMaterial=Dx()),t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):(this._equirectMaterial===null&&(this._equirectMaterial=Ox()),t=this._equirectMaterial),t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){this._ggxMaterial===null&&(this._ggxMaterial=DT(),this._integrationMaterial=UT());let t=this._cubeSize,n=e.texture.mipmaps.length-1,r=this._ggxMaterial.uniforms;r.envMap.value=this._sourceTarget.texture;let s=this._integrationMaterial.uniforms;s.envMap.value=this._sourceTarget.texture,s.sourceLod.value=Math.log2(t/ib);for(let o=0;o<=n;o++){let a=i.lodToRoughness(o,n);if(o>n-FT)s.roughness.value=a,this._renderCube(e,o,this._integrationMaterial);else{let l=a>0?Math.log2(t)+.5*Math.log2(6/(nb*Math.pow(a,4)))+.5:0;r.roughness.value=a,r.lodBias.value=l,this._renderCube(e,o,this._ggxMaterial)}}}_blur(e,t){this._blurMaterial===null&&(this._blurMaterial=BT());let n=this._blurMaterial,r=n.uniforms,s=this._sourceTarget;r.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,r.envMap.value=s.texture,this._renderCube(e,0,n),r.envMap.value=e.texture,this._renderCube(s,0,n)}};function Nx(i,e,t){return new el(i,{minFilter:Fn,generateMipmaps:e,type:ai,colorSpace:Mn,depthBuffer:t})}function tl(i,e,t){return new Si({name:i,uniforms:e,vertexShader:Qe.cube_vert,fragmentShader:t,side:un,blending:gs,depthTest:!1,depthWrite:!1})}function DT(){return tl("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},` + `},r=new Mi(5,5,5),s=new Si({name:"CubemapFromEquirect",uniforms:_s(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:un,blending:xs});s.uniforms.tEquirect.value=t;let o=new Se(r,s),a=t.minFilter;return t.minFilter===Fn&&(t.minFilter=Ht),new _o(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},Yx=256,KT=3,ZT=20,my=256,gy=16,JT=3,jT=new U,QT=new W,Ro=class i{constructor(e){this._renderer=e,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new _o(1,10,null),this._boxMesh=new Se(new Mi(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=jT}=s,l=this._renderer;this._setSize(o);let c=this._allocateTarget(),u=this._getSourceTarget(!0);t>0&&(u.texture.mipmapsAutoUpdate=!1);let h=l.autoClear,f=l.autoClearColor,d=l.autoClearDepth,p=l.autoClearStencil,x=e.background;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,x===null&&(e.background=l.getClearColor(QT));let g=new _o(n,r,u);return g.position.copy(a),g.update(l,e),l.autoClear=h,l.autoClearColor=f,l.autoClearDepth=d,l.autoClearStencil=p,e.background=x,t>0&&(u.texture.mipmapsAutoUpdate=!0,this._blur(c,t)),this._applyPMREM(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Kx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=$x(),this._compileMaterial(this._equirectMaterial))}dispose(){this._sourceTarget!==null&&this._sourceTarget.dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._integrationMaterial!==null&&this._integrationMaterial.dispose(),this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max(Yx,Sd(e))}_fromTexture(e,t){e.mapping===bs||e.mapping===So?this._setSize(e.image.length===0?Yx:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4);let n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){let e=this._cubeSize,t=qx(e,!1,!1),n=Math.log2(e)-KT;for(let r=0;r<=n;r++)t.texture.mipmaps.push({width:e>>r,height:e>>r});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){let t=this._cubeSize,n=this._sourceTarget;return(n===null||n.width!==t||e&&n.depthBuffer===!1)&&(n!==null&&n.dispose(),this._sourceTarget=qx(t,!0,e)),this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){let r=this._boxMesh,s=this._cubeCamera;r.material=n,s.renderTarget=e,s.activeMipmapLevel=t;let o=e.width>>t;e.viewport.set(0,0,o,o),s.update(this._renderer,r),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;e.mapping===bs||e.mapping===So?(this._cubemapMaterial===null&&(this._cubemapMaterial=Kx()),t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):(this._equirectMaterial===null&&(this._equirectMaterial=$x()),t=this._equirectMaterial),t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){this._ggxMaterial===null&&(this._ggxMaterial=eA(),this._integrationMaterial=tA());let t=this._cubeSize,n=e.texture.mipmaps.length-1,r=this._ggxMaterial.uniforms;r.envMap.value=this._sourceTarget.texture;let s=this._integrationMaterial.uniforms;s.envMap.value=this._sourceTarget.texture,s.sourceLod.value=Math.log2(t/gy);for(let o=0;o<=n;o++){let a=i.lodToRoughness(o,n);if(o>n-JT)s.roughness.value=a,this._renderCube(e,o,this._integrationMaterial);else{let l=a>0?Math.log2(t)+.5*Math.log2(6/(my*Math.pow(a,4)))+.5:0;r.roughness.value=a,r.lodBias.value=l,this._renderCube(e,o,this._ggxMaterial)}}}_blur(e,t){this._blurMaterial===null&&(this._blurMaterial=nA());let n=this._blurMaterial,r=n.uniforms,s=this._sourceTarget;r.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,r.envMap.value=s.texture,this._renderCube(e,0,n),r.envMap.value=e.texture,this._renderCube(s,0,n)}};function qx(i,e,t){return new nl(i,{minFilter:Fn,generateMipmaps:e,type:li,colorSpace:Mn,depthBuffer:t})}function il(i,e,t){return new Si({name:i,uniforms:e,vertexShader:tt.cube_vert,fragmentShader:t,side:un,blending:xs,depthTest:!1,depthWrite:!1})}function eA(){return il("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},` - #define GGX_SAMPLES ${nb}u + #define GGX_SAMPLES ${my}u varying vec3 vWorldDirection; @@ -3940,7 +3940,7 @@ void main() { gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 ); } - `)}function UT(){return tl("PMREMGGXIntegration",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:ib}},` + `)}function tA(){return il("PMREMGGXIntegration",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:gy}},` varying vec3 vWorldDirection; @@ -3993,9 +3993,9 @@ void main() { gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 ); } - `)}function BT(){return tl("PMREMSphericalGaussianBlur",{envMap:{value:null},sigma:{value:0}},` + `)}function nA(){return il("PMREMSphericalGaussianBlur",{envMap:{value:null},sigma:{value:0}},` - #define SAMPLES ${LT} + #define SAMPLES ${ZT} #define GOLDEN_ANGLE 2.39996322973 varying vec3 vWorldDirection; @@ -4041,7 +4041,7 @@ void main() { gl_FragColor = vec4( accumColor / accumWeight, 1.0 ); } - `)}function Ox(){return tl("PMREMEquirectangularToCubemap",{envMap:{value:null}},` + `)}function $x(){return il("PMREMEquirectangularToCubemap",{envMap:{value:null}},` varying vec3 vWorldDirection; @@ -4063,7 +4063,7 @@ void main() { gl_FragColor = vec4( color * 0.25, 1.0 ); } - `)}function Dx(){return tl("PMREMCubemapToCubemap",{envMap:{value:null},flipEnvMap:{value:-1}},` + `)}function Kx(){return il("PMREMCubemapToCubemap",{envMap:{value:null},flipEnvMap:{value:-1}},` varying vec3 vWorldDirection; @@ -4075,7 +4075,7 @@ void main() { gl_FragColor = vec4( textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ).rgb, 1.0 ); } - `)}function kT(i){let e=new WeakMap,t=new WeakMap,n=null;function r(f,d=!1){return f==null?null:d?o(f):s(f)}function s(f){if(f&&f.isTexture){let d=f.mapping;if(d===Wc||d===Xc)if(e.has(f)){let p=e.get(f).texture;return a(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let g=new el(p.height);return g.fromEquirectangularTexture(i,f),e.set(f,g),f.addEventListener("dispose",c),a(g.texture,f.mapping)}else return null}}return f}function o(f){if(f&&f.isTexture&&f.isPMREMTexture!==!0){let d=f.mapping,p=d===Wc||d===Xc,g=d===bs||d===_o;if(p||g){let m=t.get(f),x=m!==void 0?m.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==x)return n===null&&(n=new To(i)),m=p?n.fromEquirectangular(f,m):n.fromCubemap(f,m),m.texture.pmremVersion=f.pmremVersion,t.set(f,m),m.texture;if(m!==void 0)return m.texture;{let b=f.image;return p&&b&&b.height>0||g&&b&&l(b)?(n===null&&(n=new To(i)),m=p?n.fromEquirectangular(f):n.fromCubemap(f),m.texture.pmremVersion=f.pmremVersion,t.set(f,m),f.addEventListener("dispose",u),m.texture):null}}}return f}function a(f,d){return d===Wc?f.mapping=bs:d===Xc&&(f.mapping=_o),f}function l(f){let d=0,p=6;for(let g=0;gdelete r[p]);function a(p){l(p.target)}function l(p){p.index!==null&&e.remove(p.index);for(let m in p.attributes)e.remove(p.attributes[m]);p.removeEventListener("dispose",a),delete r[p.id],o.unregister(p);let g=s.get(p);g&&(e.remove(g),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function c(p,g){return r[g.id]!==void 0||(g.addEventListener("dispose",a),r[g.id]=new WeakRef(g),o.register(g,g.id,g),t.memory.geometries++),g}function u(p){let g=p.attributes;for(let m in g)e.update(g[m],i.ARRAY_BUFFER)}function h(p){let g=p.index,m=p.attributes.position,x=0;if(m===void 0)return;let b=g!==null?g.array.length:m.array.length/3-1,_=m.count>=65535?cs:_a,y=new _(Math.ceil(b/3)*6,1),M=y.array;if(g!==null){let v=g.array;x=g.version;for(let w=0,C=0;we.maxTextureSize&&(M=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);let S=new Float32Array(y*M*4*h),v=new ya(S,y,M,h);v.type=Vn,v.needsUpdate=!0;let w=_*4;for(let A=0;A0){let x=new nl(p.height);return x.fromEquirectangularTexture(i,f),e.set(f,x),f.addEventListener("dispose",c),a(x.texture,f.mapping)}else return null}}return f}function o(f){if(f&&f.isTexture&&f.isPMREMTexture!==!0){let d=f.mapping,p=d===Kc||d===Zc,x=d===bs||d===So;if(p||x){let g=t.get(f),m=g!==void 0?g.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==m)return n===null&&(n=new Ro(i)),g=p?n.fromEquirectangular(f,g):n.fromCubemap(f,g),g.texture.pmremVersion=f.pmremVersion,t.set(f,g),g.texture;if(g!==void 0)return g.texture;{let y=f.image;return p&&y&&y.height>0||x&&y&&l(y)?(n===null&&(n=new Ro(i)),g=p?n.fromEquirectangular(f):n.fromCubemap(f),g.texture.pmremVersion=f.pmremVersion,t.set(f,g),f.addEventListener("dispose",u),g.texture):null}}}return f}function a(f,d){return d===Kc?f.mapping=bs:d===Zc&&(f.mapping=So),f}function l(f){let d=0,p=6;for(let x=0;xdelete r[p]);function a(p){l(p.target)}function l(p){p.index!==null&&e.remove(p.index);for(let g in p.attributes)e.remove(p.attributes[g]);p.removeEventListener("dispose",a),delete r[p.id],o.unregister(p);let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function c(p,x){return r[x.id]!==void 0||(x.addEventListener("dispose",a),r[x.id]=new WeakRef(x),o.register(x,x.id,x),t.memory.geometries++),x}function u(p){let x=p.attributes;for(let g in x)e.update(x[g],i.ARRAY_BUFFER)}function h(p){let x=p.index,g=p.attributes.position,m=0;if(g===void 0)return;let y=x!==null?x.array.length:g.array.length/3-1,_=g.count>=65535?us:Ma,b=new _(Math.ceil(y/3)*6,1),M=b.array;if(x!==null){let v=x.array;m=x.version;for(let w=0,R=0;we.maxTextureSize&&(M=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);let S=new Float32Array(b*M*4*h),v=new _a(S,b,M,h);v.type=Vn,v.needsUpdate=!0;let w=_*4;for(let T=0;T0&&_[0].isRenderPass===!0;let S=o.width,v=o.height;_.length>0&&a===null&&(a=new wn(S,v,{type:ai,depthBuffer:!1,stencilBuffer:!1}),l=new wn(S,v,{type:ai,depthBuffer:!1,stencilBuffer:!1}));let w=r===!0&&_.some(C=>C.needsDepthTexture===!0);w!==(o.depthTexture!==null)&&(w===!0&&c===null&&(c=new tr(S,v),s===!0&&(c.format=cr,c.type=ys)),o.dispose(),o.depthTexture=w?c:null,o.resolveDepthBuffer=w,o.storeMultisampledDepthBuffer=w);for(let C=0;C<_.length;C++){let A=_[C];A.setSize&&A.setSize(S,v),w&&A.needsDepthTexture===!0&&A.setDepthTexture&&A.setDepthTexture(c)}},this.begin=function(M,S){if(m||M.toneMapping===Ri&&_.length===0)return!1;if(b=S,S!==null){let v=S.width,w=S.height;(o.width!==v||o.height!==w)&&this.setSize(v,w)}return y===!1&&M.setRenderTarget(o),x=M.toneMapping,M.toneMapping=Ri,!0},this.hasRenderPass=function(){return y},this.end=function(M,S){M.toneMapping=x,m=!0;let v=o,w=a;for(let C=0;C<_.length;C++){let A=_[C];A.enabled!==!1&&(A.render(M,w,v,S),A.needsSwap!==!1&&(v=w,w=w===a?l:a))}if(p!==M.outputColorSpace||g!==M.toneMapping){p=M.outputColorSpace,g=M.toneMapping,h.defines={},nt.getTransfer(p)===Mt&&(h.defines.SRGB_TRANSFER="");let C=YT[g];C&&(h.defines[C]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=v.texture,M.setRenderTarget(b),M.render(f,d),b=null,m=!1},this.isCompositing=function(){return m},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),l!==null&&l.dispose(),u.dispose(),h.dispose()}}var rb=new Kt,sb=new tr(1,1),ob=new Ta(1),ab=new ya,lb=new Ec,cb=new wa,Ux=[],Bx=[],kx=new Float32Array(16),zx=new Float32Array(9),Vx=new Float32Array(4);function Ao(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=Ux[r];if(s===void 0&&(s=new Float32Array(r),Ux[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function jt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function Hx(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var OA=37297,DA=0;function UA(i,e){let t=i.split(` + }`,depthTest:!1,depthWrite:!1}),f=new Se(u,h),d=new zn(-1,1,1,-1,0,1),p=null,x=null,g=!1,m,y=null,_=[],b=!1;this.setSize=function(M,S){o.setSize(M,S),a!==null&&a.setSize(M,S),l!==null&&l.setSize(M,S);for(let v=0;v<_.length;v++){let w=_[v];w.setSize&&w.setSize(M,S)}},this.setEffects=function(M){_=M,b=_.length>0&&_[0].isRenderPass===!0;let S=o.width,v=o.height;_.length>0&&a===null&&(a=new wn(S,v,{type:li,depthBuffer:!1,stencilBuffer:!1}),l=new wn(S,v,{type:li,depthBuffer:!1,stencilBuffer:!1}));let w=r===!0&&_.some(R=>R.needsDepthTexture===!0);w!==(o.depthTexture!==null)&&(w===!0&&c===null&&(c=new tr(S,v),s===!0&&(c.format=ur,c.type=vs)),o.dispose(),o.depthTexture=w?c:null,o.resolveDepthBuffer=w,o.storeMultisampledDepthBuffer=w);for(let R=0;R<_.length;R++){let T=_[R];T.setSize&&T.setSize(S,v),w&&T.needsDepthTexture===!0&&T.setDepthTexture&&T.setDepthTexture(c)}},this.begin=function(M,S){if(g||M.toneMapping===Ri&&_.length===0)return!1;if(y=S,S!==null){let v=S.width,w=S.height;(o.width!==v||o.height!==w)&&this.setSize(v,w)}return b===!1&&M.setRenderTarget(o),m=M.toneMapping,M.toneMapping=Ri,!0},this.hasRenderPass=function(){return b},this.end=function(M,S){M.toneMapping=m,g=!0;let v=o,w=a;for(let R=0;R<_.length;R++){let T=_[R];T.enabled!==!1&&(T.render(M,w,v,S),T.needsSwap!==!1&&(v=w,w=w===a?l:a))}if(p!==M.outputColorSpace||x!==M.toneMapping){p=M.outputColorSpace,x=M.toneMapping,h.defines={},it.getTransfer(p)===Mt&&(h.defines.SRGB_TRANSFER="");let R=uA[x];R&&(h.defines[R]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=v.texture,M.setRenderTarget(y),M.render(f,d),y=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),l!==null&&l.dispose(),u.dispose(),h.dispose()}}var xy=new Kt,yy=new tr(1,1),by=new Ea(1),vy=new _a,_y=new Lc,My=new Aa,Zx=[],Jx=[],jx=new Float32Array(16),Qx=new Float32Array(9),ey=new Float32Array(4);function Co(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=Zx[r];if(s===void 0&&(s=new Float32Array(r),Zx[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function jt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function ny(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var QA=37297,eE=0;function tE(i,e){let t=i.split(` `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o":" "} ${a}: ${t[o]}`)}return n.join(` -`)}var Wx=new We;function BA(i){nt._getMatrix(Wx,nt.workingColorSpace,i);let e=`mat3( ${Wx.elements.map(t=>t.toFixed(4))} )`;switch(nt.getTransfer(i)){case xa:return[e,"LinearTransferOETF"];case Mt:return[e,"sRGBTransferOETF"];default:return Fe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Xx(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+` +`)}var iy=new Xe;function nE(i){it._getMatrix(iy,it.workingColorSpace,i);let e=`mat3( ${iy.elements.map(t=>t.toFixed(4))} )`;switch(it.getTransfer(i)){case ba:return[e,"LinearTransferOETF"];case Mt:return[e,"sRGBTransferOETF"];default:return Oe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ry(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+` `+s+` -`+UA(i.getShaderSource(e),a)}else return s}function kA(i,e){let t=BA(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( ${t[0]} * value.rgb, value.a ) );`,"}"].join(` -`)}var zA={[Wf]:"Linear",[Xf]:"Reinhard",[Yf]:"Cineon",[qf]:"ACESFilmic",[Kf]:"AgX",[Zf]:"Neutral",[$f]:"Custom"};function VA(i,e){let t=zA[e];return t===void 0?(Fe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var Iu=new U;function GA(){nt.getLuminanceCoefficients(Iu);let i=Iu.x.toFixed(4),e=Iu.y.toFixed(4),t=Iu.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function HA(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Qa).join(` -`)}function WA(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function XA(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function Cd(i){return i.replace(YA,qA)}function qA(i,e){let t=Qe[e];if(t===void 0)throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">");return Cd(t)}var $A=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function $x(i){return i.replace($A,KA)}function KA(i,e,t,n){let r="";for(let s=parseInt(e);s/gm;function zd(i){return i.replace(uE,hE)}function hE(i,e){let t=tt[e];if(t===void 0)throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">");return zd(t)}var fE=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ay(i){return i.replace(fE,dE)}function dE(i,e,t,n){let r="";for(let s=parseInt(e);s0&&(x+=` +`),g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(tl).join(` `),g.length>0&&(g+=` -`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(Qa).join(` -`),m.length>0&&(m+=` -`)):(g=[Kx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.diffuseRoughnessMapUv?"#define DIFFUSE_ROUGHNESSMAP_UV "+t.diffuseRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Qa).join(` -`),m=[Kx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",t.envMapPMREM?"#define ENVMAP_MAX_LOD "+t.envMapMaxLod+".0":"",t.envMapPMREM?"#define ENVMAP_SIZE "+t.envMapSize+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughness?"#define USE_DIFFUSE_ROUGHNESS":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?Qe.tonemapping_pars_fragment:"",t.toneMapping!==Ri?VA("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Qe.colorspace_pars_fragment,kA("linearToOutputTexel",t.outputColorSpace),GA(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Qa).join(` -`)),o=Cd(o),o=Yx(o,t),o=qx(o,t),a=Cd(a),a=Yx(a,t),a=qx(a,t),o=$x(o),a=$x(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es -`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)):(x=[ly(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.diffuseRoughnessMapUv?"#define DIFFUSE_ROUGHNESSMAP_UV "+t.diffuseRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(tl).join(` +`),g=[ly(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",t.envMapPMREM?"#define ENVMAP_MAX_LOD "+t.envMapMaxLod+".0":"",t.envMapPMREM?"#define ENVMAP_SIZE "+t.envMapSize+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughness?"#define USE_DIFFUSE_ROUGHNESS":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?tt.tonemapping_pars_fragment:"",t.toneMapping!==Ri?sE("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",tt.colorspace_pars_fragment,iE("linearToOutputTexel",t.outputColorSpace),oE(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(tl).join(` +`)),o=zd(o),o=sy(o,t),o=oy(o,t),a=zd(a),a=sy(a,t),a=oy(a,t),o=ay(o),a=ay(a),t.isRawShaderMaterial!==!0&&(m=`#version 300 es +`,x=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+g,m=["#define varying in",t.glslVersion===ud?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ud?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+x,g=["#define varying in",t.glslVersion===_d?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===_d?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+m);let b=x+g+o,_=x+m+a,y=Hx(r,r.VERTEX_SHADER,b),M=Hx(r,r.FRAGMENT_SHADER,_);r.attachShader(p,y),r.attachShader(p,M),t.index0AttributeName!==void 0?r.bindAttribLocation(p,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(p,0,"position"),r.linkProgram(p);function S(A){if(i.debug.checkShaderErrors){let R=r.getProgramInfoLog(p)||"",N=r.getShaderInfoLog(y)||"",O=r.getShaderInfoLog(M)||"",P=R.trim(),I=N.trim(),D=O.trim(),F=!0,H=!0;if(r.getProgramParameter(p,r.LINK_STATUS)===!1)if(F=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,p,y,M);else{let B=Xx(r,y,"vertex"),X=Xx(r,M,"fragment");He("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(p,r.VALIDATE_STATUS)+` +`+g);let y=m+x+o,_=m+g+a,b=ny(r,r.VERTEX_SHADER,y),M=ny(r,r.FRAGMENT_SHADER,_);r.attachShader(p,b),r.attachShader(p,M),t.index0AttributeName!==void 0?r.bindAttribLocation(p,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(p,0,"position"),r.linkProgram(p);function S(T){if(i.debug.checkShaderErrors){let C=r.getProgramInfoLog(p)||"",L=r.getShaderInfoLog(b)||"",O=r.getShaderInfoLog(M)||"",P=C.trim(),I=L.trim(),D=O.trim(),F=!0,H=!0;if(r.getProgramParameter(p,r.LINK_STATUS)===!1)if(F=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,p,b,M);else{let B=ry(r,b,"vertex"),X=ry(r,M,"fragment");We("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(p,r.VALIDATE_STATUS)+` -Material Name: `+A.name+` -Material Type: `+A.type+` +Material Name: `+T.name+` +Material Type: `+T.type+` Program Info Log: `+P+` `+B+` -`+X)}else P!==""?Fe("WebGLProgram: Program Info Log:",P):(I===""||D==="")&&(H=!1);H&&(A.diagnostics={runnable:F,programLog:P,vertexShader:{log:I,prefix:g},fragmentShader:{log:D,prefix:m}})}r.deleteShader(y),r.deleteShader(M),v=new wo(r,p),w=XA(r,p)}let v;this.getUniforms=function(){return v===void 0&&S(this),v};let w;this.getAttributes=function(){return w===void 0&&S(this),w};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=r.getProgramParameter(p,OA)),C},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(p),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=DA++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=y,this.fragmentShader=M,this}var iE=0,Pd=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Id(e),t.set(e,n)),n}},Id=class{constructor(e){this.id=iE++,this.code=e,this.usedTimes=0}};function rE(i){return i===Ur||i===$a||i===Ka}function sE(i,e,t,n,r,s){let o=new uo,a=new Pd,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function d(v){return l.add(v),v===0?"uv":`uv${v}`}function p(v,w,C,A,R,N){let O=A.fog,P=R.geometry,I=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?A.environment:null,D=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,F=e.get(v.envMap||I,D),H=f[v.type],B=n.precision;v.precision!==null&&(B=n.getMaxPrecision(v.precision),B!==v.precision&&Fe("WebGLProgram.getParameters:",v.precision,"not supported, using",B,"instead."));let X=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,V=X!==void 0?X.length:0,re=0;P.morphAttributes.position!==void 0&&(re=1),P.morphAttributes.normal!==void 0&&(re=2),P.morphAttributes.color!==void 0&&(re=3);let be,Y,Q,se;if(H){let _e=Ii[H];be=_e.vertexShader,Y=_e.fragmentShader}else{be=v.vertexShader,Y=v.fragmentShader;let _e=a.getVertexShaderStage(v),St=a.getFragmentShaderStage(v);a.update(v,_e,St),Q=_e.id,se=St.id}let Se=i.getRenderTarget(),ce=i.state.buffers.depth.getReversed(),Le=R.isInstancedMesh===!0,at=R.isBatchedMesh===!0,Te=!!v.map,ft=!!v.matcap,bt=!!F,tt=bt&&F.isPMREMTexture===!0,Yt=!!v.aoMap,kt=!!v.lightMap,on=!!v.bumpMap&&v.wireframe===!1,Nt=!!v.normalMap,gi=!!v.displacementMap,en=!!v.emissiveMap,Hn=!!v.metalnessMap,Wn=!!v.roughnessMap,Xn=v.anisotropy>0,G=v.clearcoat>0,Yn=v.diffuseRoughness>0,Pt=v.dispersion>0,It=v.retroreflectivity>0,ye=v.iridescence>0,Zt=v.sheen>0,Ve=v.transmission>0,Xe=Xn&&!!v.anisotropyMap,L=G&&!!v.clearcoatMap,T=G&&!!v.clearcoatNormalMap,K=G&&!!v.clearcoatRoughnessMap,oe=Yn&&!!v.diffuseRoughnessMap,ie=ye&&!!v.iridescenceMap,he=ye&&!!v.iridescenceThicknessMap,ge=Zt&&!!v.sheenColorMap,ee=Zt&&!!v.sheenRoughnessMap,te=!!v.specularMap,de=!!v.specularColorMap,k=!!v.specularIntensityMap,ne=Ve&&!!v.transmissionMap,j=Ve&&!!v.thicknessMap,pe=!!v.gradientMap,ue=!!v.alphaMap,fe=v.alphaTest>0,Oe=!!v.alphaHash,je=!!v.extensions,ae=Ri;v.toneMapped&&(Se===null||Se.isXRRenderTarget===!0)&&(ae=i.toneMapping);let Ue=tt?F.isCompressedCubeTexture?F.image[0].mipmaps:F.mipmaps:null,Je={shaderID:H,shaderType:v.type,shaderName:v.name,vertexShader:be,fragmentShader:Y,defines:v.defines,customVertexShaderID:Q,customFragmentShaderID:se,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:B,batching:at,batchingColor:at&&R._colorsTexture!==null,instancing:Le,instancingColor:Le&&R.instanceColor!==null,instancingMorph:Le&&R.morphTexture!==null,outputColorSpace:Se===null?i.outputColorSpace:Se.isXRRenderTarget===!0?Se.texture.colorSpace:nt.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Te,matcap:ft,envMap:bt,envMapMode:bt&&F.mapping,envMapPMREM:tt,envMapMaxLod:tt?Ue.length-1:null,envMapSize:tt?Ue[0].width:null,aoMap:Yt,lightMap:kt,bumpMap:on,normalMap:Nt,displacementMap:gi,emissiveMap:en,normalMapObjectSpace:Nt&&v.normalMapType===dx,normalMapTangentSpace:Nt&&v.normalMapType===Ja,packedNormalMap:Nt&&v.normalMapType===Ja&&rE(v.normalMap.format),metalnessMap:Hn,roughnessMap:Wn,anisotropy:Xn,anisotropyMap:Xe,clearcoat:G,clearcoatMap:L,clearcoatNormalMap:T,clearcoatRoughnessMap:K,diffuseRoughness:Yn,diffuseRoughnessMap:oe,dispersion:Pt,retroreflection:It,iridescence:ye,iridescenceMap:ie,iridescenceThicknessMap:he,sheen:Zt,sheenColorMap:ge,sheenRoughnessMap:ee,specularMap:te,specularColorMap:de,specularIntensityMap:k,transmission:Ve,transmissionMap:ne,thicknessMap:j,gradientMap:pe,opaque:v.transparent===!1&&v.blending===Ei&&v.alphaToCoverage===!1,alphaMap:ue,alphaTest:fe,alphaHash:Oe,combine:v.combine,mapUv:Te&&d(v.map.channel),aoMapUv:Yt&&d(v.aoMap.channel),lightMapUv:kt&&d(v.lightMap.channel),bumpMapUv:on&&d(v.bumpMap.channel),normalMapUv:Nt&&d(v.normalMap.channel),displacementMapUv:gi&&d(v.displacementMap.channel),emissiveMapUv:en&&d(v.emissiveMap.channel),metalnessMapUv:Hn&&d(v.metalnessMap.channel),roughnessMapUv:Wn&&d(v.roughnessMap.channel),anisotropyMapUv:Xe&&d(v.anisotropyMap.channel),clearcoatMapUv:L&&d(v.clearcoatMap.channel),clearcoatNormalMapUv:T&&d(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:K&&d(v.clearcoatRoughnessMap.channel),diffuseRoughnessMapUv:oe&&d(v.diffuseRoughnessMap.channel),iridescenceMapUv:ie&&d(v.iridescenceMap.channel),iridescenceThicknessMapUv:he&&d(v.iridescenceThicknessMap.channel),sheenColorMapUv:ge&&d(v.sheenColorMap.channel),sheenRoughnessMapUv:ee&&d(v.sheenRoughnessMap.channel),specularMapUv:te&&d(v.specularMap.channel),specularColorMapUv:de&&d(v.specularColorMap.channel),specularIntensityMapUv:k&&d(v.specularIntensityMap.channel),transmissionMapUv:ne&&d(v.transmissionMap.channel),thicknessMapUv:j&&d(v.thicknessMap.channel),alphaMapUv:ue&&d(v.alphaMap.channel),vertexTangents:!!P.attributes.tangent&&(Nt||Xn),vertexNormals:!!P.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,pointsUvs:R.isPoints===!0&&!!P.attributes.uv&&(Te||ue),fog:!!O,useFog:v.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||P.attributes.normal===void 0&&Nt===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:ce,skinning:R.isSkinnedMesh===!0,hasPositionAttribute:P.attributes.position!==void 0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:V,morphTextureStride:re,numSunLights:w.sun.length,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numSunLightShadows:w.sunShadowMap.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numLightProbeGrids:N.filter(_e=>_e.texture!==null).length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:v.dithering,shadowMapEnabled:i.shadowMap.enabled&&C.length>0,shadowMapType:i.shadowMap.type,toneMapping:ae,decodeVideoTexture:Te&&v.map.isVideoTexture===!0&&nt.getTransfer(v.map.colorSpace)===Mt,decodeVideoTextureEmissive:en&&v.emissiveMap.isVideoTexture===!0&&nt.getTransfer(v.emissiveMap.colorSpace)===Mt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===ht,flipSided:v.side===un,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:je&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(je&&v.extensions.multiDraw===!0||at)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return Je.vertexUv1s=l.has(1),Je.vertexUv2s=l.has(2),Je.vertexUv3s=l.has(3),l.clear(),Je}function g(v){let w=[];if(v.shaderID?w.push(v.shaderID):(w.push(v.customVertexShaderID),w.push(v.customFragmentShaderID)),v.defines!==void 0)for(let C in v.defines)w.push(C),w.push(v.defines[C]);return v.isRawShaderMaterial===!1&&(m(w,v),x(w,v),w.push(i.outputColorSpace)),w.push(v.customProgramCacheKey),w.join()}function m(v,w){v.push(w.precision),v.push(w.outputColorSpace),v.push(w.envMapMode),v.push(w.envMapPMREM),v.push(w.envMapMaxLod),v.push(w.envMapSize),v.push(w.mapUv),v.push(w.alphaMapUv),v.push(w.lightMapUv),v.push(w.aoMapUv),v.push(w.bumpMapUv),v.push(w.normalMapUv),v.push(w.displacementMapUv),v.push(w.emissiveMapUv),v.push(w.metalnessMapUv),v.push(w.roughnessMapUv),v.push(w.anisotropyMapUv),v.push(w.clearcoatMapUv),v.push(w.clearcoatNormalMapUv),v.push(w.clearcoatRoughnessMapUv),v.push(w.diffuseRoughnessMapUv),v.push(w.iridescenceMapUv),v.push(w.iridescenceThicknessMapUv),v.push(w.sheenColorMapUv),v.push(w.sheenRoughnessMapUv),v.push(w.specularMapUv),v.push(w.specularColorMapUv),v.push(w.specularIntensityMapUv),v.push(w.transmissionMapUv),v.push(w.thicknessMapUv),v.push(w.combine),v.push(w.fogExp2),v.push(w.sizeAttenuation),v.push(w.morphTargetsCount),v.push(w.numSunLights),v.push(w.numDirLights),v.push(w.numPointLights),v.push(w.numSpotLights),v.push(w.numSpotLightMaps),v.push(w.numHemiLights),v.push(w.numRectAreaLights),v.push(w.numSunLightShadows),v.push(w.numDirLightShadows),v.push(w.numPointLightShadows),v.push(w.numSpotLightShadows),v.push(w.numSpotLightShadowsWithMaps),v.push(w.numLightProbes),v.push(w.numLightProbeGrids),v.push(w.shadowMapType),v.push(w.toneMapping),v.push(w.numClippingPlanes),v.push(w.numClipIntersection),v.push(w.depthPacking)}function x(v,w){o.disableAll(),w.instancing&&o.enable(0),w.instancingColor&&o.enable(1),w.instancingMorph&&o.enable(2),w.matcap&&o.enable(3),w.envMap&&o.enable(4),w.normalMapObjectSpace&&o.enable(5),w.normalMapTangentSpace&&o.enable(6),w.clearcoat&&o.enable(7),w.iridescence&&o.enable(8),w.alphaTest&&o.enable(9),w.vertexColors&&o.enable(10),w.vertexAlphas&&o.enable(11),w.vertexUv1s&&o.enable(12),w.vertexUv2s&&o.enable(13),w.vertexUv3s&&o.enable(14),w.vertexTangents&&o.enable(15),w.anisotropy&&o.enable(16),w.alphaHash&&o.enable(17),w.batching&&o.enable(18),w.dispersion&&o.enable(19),w.retroreflection&&o.enable(24),w.diffuseRoughness&&o.enable(25),w.batchingColor&&o.enable(20),w.gradientMap&&o.enable(21),w.packedNormalMap&&o.enable(22),w.vertexNormals&&o.enable(23),v.push(o.mask),o.disableAll(),w.fog&&o.enable(0),w.useFog&&o.enable(1),w.flatShading&&o.enable(2),w.logarithmicDepthBuffer&&o.enable(3),w.reversedDepthBuffer&&o.enable(4),w.skinning&&o.enable(5),w.morphTargets&&o.enable(6),w.morphNormals&&o.enable(7),w.morphColors&&o.enable(8),w.premultipliedAlpha&&o.enable(9),w.shadowMapEnabled&&o.enable(10),w.doubleSided&&o.enable(11),w.flipSided&&o.enable(12),w.useDepthPacking&&o.enable(13),w.dithering&&o.enable(14),w.transmission&&o.enable(15),w.sheen&&o.enable(16),w.opaque&&o.enable(17),w.pointsUvs&&o.enable(18),w.decodeVideoTexture&&o.enable(19),w.decodeVideoTextureEmissive&&o.enable(20),w.alphaToCoverage&&o.enable(21),w.numLightProbeGrids>0&&o.enable(22),w.hasPositionAttribute&&o.enable(23),v.push(o.mask)}function b(v){let w=f[v.type],C;if(w){let A=Ii[w];C=Px.clone(A.uniforms)}else C=v.uniforms;return C}function _(v,w){let C=u.get(w);return C!==void 0?++C.usedTimes:(C=new nE(i,w,v,r),c.push(C),u.set(w,C)),C}function y(v){if(--v.usedTimes===0){let w=c.indexOf(v);c[w]=c[c.length-1],c.pop(),u.delete(v.cacheKey),v.destroy()}}function M(v){a.remove(v)}function S(){a.dispose()}return{getParameters:p,getProgramCacheKey:g,getUniforms:b,acquireProgram:_,releaseProgram:y,releaseShaderCache:M,programs:c,dispose:S}}function oE(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function aE(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function Zx(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Jx(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(f){let d=0;return f.isInstancedMesh&&(d+=2),f.isSkinnedMesh&&(d+=1),d}function a(f,d,p,g,m,x){let b=i[e];return b===void 0?(b={id:f.id,object:f,geometry:d,material:p,materialVariant:o(f),groupOrder:g,renderOrder:f.renderOrder,z:m,group:x},i[e]=b):(b.id=f.id,b.object=f,b.geometry=d,b.material=p,b.materialVariant=o(f),b.groupOrder=g,b.renderOrder=f.renderOrder,b.z=m,b.group=x),e++,b}function l(f,d,p,g,m,x,b){b.reversedDepth===!0&&(m=-m);let _=a(f,d,p,g,m,x);p.transmission>0?n.push(_):p.transparent===!0?r.push(_):t.push(_)}function c(f,d,p,g,m,x){let b=a(f,d,p,g,m,x);p.transmission>0?n.unshift(b):p.transparent===!0?r.unshift(b):t.unshift(b)}function u(f,d){t.length>1&&t.sort(f||aE),n.length>1&&n.sort(d||Zx),r.length>1&&r.sort(d||Zx)}function h(){for(let f=e,d=i.length;f=s.length?(o=new Jx,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function cE(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={direction:new U,color:new W};break;case"SpotLight":t={position:new U,direction:new U,color:new W,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new W,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new W,groundColor:new W};break;case"RectAreaLight":t={color:new W,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function uE(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var hE=0;function fE(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function dE(i){let e=new cE,t=uE(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new U);let r=new U,s=new ze,o=new ze;function a(c){let u=0,h=0,f=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let d=0,p=0,g=0,m=0,x=0,b=0,_=0,y=0,M=0,S=0,v=0,w=0,C=0,A=0;c.sort(fE);for(let N=0,O=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ve.LTC_FLOAT_1,n.rectAreaLTC2=ve.LTC_FLOAT_2):(n.rectAreaLTC1=ve.LTC_HALF_1,n.rectAreaLTC2=ve.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;let R=n.hash;(R.sunLength!==d||R.directionalLength!==m||R.pointLength!==x||R.spotLength!==b||R.rectAreaLength!==_||R.hemiLength!==y||R.numSunShadows!==p||R.numDirectionalShadows!==M||R.numPointShadows!==S||R.numSpotShadows!==v||R.numSpotMaps!==w||R.numLightProbes!==A)&&(n.sun.length=d,n.directional.length=m,n.spot.length=b,n.rectArea.length=_,n.point.length=x,n.hemi.length=y,n.sunShadow.length=p,n.sunShadowMap.length=p,n.sunShadowMatrix.length=g,n.sunShadowCascade.length=g,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.directionalShadowMatrix.length=M,n.pointShadow.length=S,n.pointShadowMap.length=S,n.pointShadowMatrix.length=S,n.spotShadow.length=v,n.spotShadowMap.length=v,n.spotLightMatrix.length=v+w-C,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=C,n.numLightProbes=A,R.sunLength=d,R.directionalLength=m,R.pointLength=x,R.spotLength=b,R.rectAreaLength=_,R.hemiLength=y,R.numSunShadows=p,R.numDirectionalShadows=M,R.numPointShadows=S,R.numSpotShadows=v,R.numSpotMaps=w,R.numLightProbes=A,n.version=hE++)}function l(c,u){let h=0,f=0,d=0,p=0,g=0,m=0,x=u.matrixWorldInverse;for(let b=0,_=c.length;b<_;b++){let y=c[b];if(y.isSunLight){let M=n.sun[h];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(x),h++}else if(y.isDirectionalLight){let M=n.directional[f];M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(x),f++}else if(y.isSpotLight){let M=n.spot[p];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(x),M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(x),p++}else if(y.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(x),o.identity(),s.copy(y.matrixWorld),s.premultiply(x),o.extractRotation(s),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(o),M.halfHeight.applyMatrix4(o),g++}else if(y.isPointLight){let M=n.point[d];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(x),d++}else if(y.isHemisphereLight){let M=n.hemi[m];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(x),m++}}}return{setup:a,setupView:l,state:n}}function jx(i){let e=new dE(i),t=[],n=[],r=[];function s(h){u.camera=h,t.length=0,n.length=0,r.length=0}function o(h){h.isLightProbeGrid?r.push(h):t.push(h)}function a(h){n.push(h)}function l(){e.setup(t),r.sort((h,f)=>h.priority-f.priority||h.id-f.id)}function c(h){e.setupView(t,h)}let u={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:u,setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function pE(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new jx(i),e.set(r,[a])):s>=o.length?(a=new jx(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var mE=`void main() { +`+X)}else P!==""?Oe("WebGLProgram: Program Info Log:",P):(I===""||D==="")&&(H=!1);H&&(T.diagnostics={runnable:F,programLog:P,vertexShader:{log:I,prefix:x},fragmentShader:{log:D,prefix:g}})}r.deleteShader(b),r.deleteShader(M),v=new Eo(r,p),w=cE(r,p)}let v;this.getUniforms=function(){return v===void 0&&S(this),v};let w;this.getAttributes=function(){return w===void 0&&S(this),w};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=r.getProgramParameter(p,QA)),R},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(p),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=eE++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=b,this.fragmentShader=M,this}var _E=0,Vd=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Gd(e),t.set(e,n)),n}},Gd=class{constructor(e){this.id=_E++,this.code=e,this.usedTimes=0}};function ME(i){return i===Br||i===Za||i===Ja}function SE(i,e,t,n,r,s){let o=new po,a=new Vd,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function d(v){return l.add(v),v===0?"uv":`uv${v}`}function p(v,w,R,T,C,L){let O=T.fog,P=C.geometry,I=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?T.environment:null,D=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,F=e.get(v.envMap||I,D),H=f[v.type],B=n.precision;v.precision!==null&&(B=n.getMaxPrecision(v.precision),B!==v.precision&&Oe("WebGLProgram.getParameters:",v.precision,"not supported, using",B,"instead."));let X=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,V=X!==void 0?X.length:0,re=0;P.morphAttributes.position!==void 0&&(re=1),P.morphAttributes.normal!==void 0&&(re=2),P.morphAttributes.color!==void 0&&(re=3);let ye,Y,Q,se;if(H){let ve=Ii[H];ye=ve.vertexShader,Y=ve.fragmentShader}else{ye=v.vertexShader,Y=v.fragmentShader;let ve=a.getVertexShaderStage(v),St=a.getFragmentShaderStage(v);a.update(v,ve,St),Q=ve.id,se=St.id}let we=i.getRenderTarget(),le=i.state.buffers.depth.getReversed(),Ne=C.isInstancedMesh===!0,at=C.isBatchedMesh===!0,Ae=!!v.map,ft=!!v.matcap,yt=!!F,nt=yt&&F.isPMREMTexture===!0,Yt=!!v.aoMap,kt=!!v.lightMap,on=!!v.bumpMap&&v.wireframe===!1,Nt=!!v.normalMap,xi=!!v.displacementMap,en=!!v.emissiveMap,Hn=!!v.metalnessMap,Wn=!!v.roughnessMap,Xn=v.anisotropy>0,G=v.clearcoat>0,Yn=v.diffuseRoughness>0,Pt=v.dispersion>0,It=v.retroreflectivity>0,be=v.iridescence>0,Zt=v.sheen>0,Ve=v.transmission>0,qe=Xn&&!!v.anisotropyMap,N=G&&!!v.clearcoatMap,A=G&&!!v.clearcoatNormalMap,K=G&&!!v.clearcoatRoughnessMap,oe=Yn&&!!v.diffuseRoughnessMap,ie=be&&!!v.iridescenceMap,he=be&&!!v.iridescenceThicknessMap,ge=Zt&&!!v.sheenColorMap,ee=Zt&&!!v.sheenRoughnessMap,te=!!v.specularMap,de=!!v.specularColorMap,k=!!v.specularIntensityMap,ne=Ve&&!!v.transmissionMap,j=Ve&&!!v.thicknessMap,pe=!!v.gradientMap,ce=!!v.alphaMap,fe=v.alphaTest>0,De=!!v.alphaHash,Qe=!!v.extensions,ae=Ri;v.toneMapped&&(we===null||we.isXRRenderTarget===!0)&&(ae=i.toneMapping);let Be=nt?F.isCompressedCubeTexture?F.image[0].mipmaps:F.mipmaps:null,je={shaderID:H,shaderType:v.type,shaderName:v.name,vertexShader:ye,fragmentShader:Y,defines:v.defines,customVertexShaderID:Q,customFragmentShaderID:se,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:B,batching:at,batchingColor:at&&C._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&C.instanceColor!==null,instancingMorph:Ne&&C.morphTexture!==null,outputColorSpace:we===null?i.outputColorSpace:we.isXRRenderTarget===!0?we.texture.colorSpace:it.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Ae,matcap:ft,envMap:yt,envMapMode:yt&&F.mapping,envMapPMREM:nt,envMapMaxLod:nt?Be.length-1:null,envMapSize:nt?Be[0].width:null,aoMap:Yt,lightMap:kt,bumpMap:on,normalMap:Nt,displacementMap:xi,emissiveMap:en,normalMapObjectSpace:Nt&&v.normalMapType===Ax,normalMapTangentSpace:Nt&&v.normalMapType===Qa,packedNormalMap:Nt&&v.normalMapType===Qa&&ME(v.normalMap.format),metalnessMap:Hn,roughnessMap:Wn,anisotropy:Xn,anisotropyMap:qe,clearcoat:G,clearcoatMap:N,clearcoatNormalMap:A,clearcoatRoughnessMap:K,diffuseRoughness:Yn,diffuseRoughnessMap:oe,dispersion:Pt,retroreflection:It,iridescence:be,iridescenceMap:ie,iridescenceThicknessMap:he,sheen:Zt,sheenColorMap:ge,sheenRoughnessMap:ee,specularMap:te,specularColorMap:de,specularIntensityMap:k,transmission:Ve,transmissionMap:ne,thicknessMap:j,gradientMap:pe,opaque:v.transparent===!1&&v.blending===Ei&&v.alphaToCoverage===!1,alphaMap:ce,alphaTest:fe,alphaHash:De,combine:v.combine,mapUv:Ae&&d(v.map.channel),aoMapUv:Yt&&d(v.aoMap.channel),lightMapUv:kt&&d(v.lightMap.channel),bumpMapUv:on&&d(v.bumpMap.channel),normalMapUv:Nt&&d(v.normalMap.channel),displacementMapUv:xi&&d(v.displacementMap.channel),emissiveMapUv:en&&d(v.emissiveMap.channel),metalnessMapUv:Hn&&d(v.metalnessMap.channel),roughnessMapUv:Wn&&d(v.roughnessMap.channel),anisotropyMapUv:qe&&d(v.anisotropyMap.channel),clearcoatMapUv:N&&d(v.clearcoatMap.channel),clearcoatNormalMapUv:A&&d(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:K&&d(v.clearcoatRoughnessMap.channel),diffuseRoughnessMapUv:oe&&d(v.diffuseRoughnessMap.channel),iridescenceMapUv:ie&&d(v.iridescenceMap.channel),iridescenceThicknessMapUv:he&&d(v.iridescenceThicknessMap.channel),sheenColorMapUv:ge&&d(v.sheenColorMap.channel),sheenRoughnessMapUv:ee&&d(v.sheenRoughnessMap.channel),specularMapUv:te&&d(v.specularMap.channel),specularColorMapUv:de&&d(v.specularColorMap.channel),specularIntensityMapUv:k&&d(v.specularIntensityMap.channel),transmissionMapUv:ne&&d(v.transmissionMap.channel),thicknessMapUv:j&&d(v.thicknessMap.channel),alphaMapUv:ce&&d(v.alphaMap.channel),vertexTangents:!!P.attributes.tangent&&(Nt||Xn),vertexNormals:!!P.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!P.attributes.uv&&(Ae||ce),fog:!!O,useFog:v.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||P.attributes.normal===void 0&&Nt===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:le,skinning:C.isSkinnedMesh===!0,hasPositionAttribute:P.attributes.position!==void 0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:V,morphTextureStride:re,numSunLights:w.sun.length,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numSunLightShadows:w.sunShadowMap.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numLightProbeGrids:L.filter(ve=>ve.texture!==null).length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:v.dithering,shadowMapEnabled:i.shadowMap.enabled&&R.length>0,shadowMapType:i.shadowMap.type,toneMapping:ae,decodeVideoTexture:Ae&&v.map.isVideoTexture===!0&&it.getTransfer(v.map.colorSpace)===Mt,decodeVideoTextureEmissive:en&&v.emissiveMap.isVideoTexture===!0&&it.getTransfer(v.emissiveMap.colorSpace)===Mt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===ht,flipSided:v.side===un,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:Qe&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&v.extensions.multiDraw===!0||at)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return je.vertexUv1s=l.has(1),je.vertexUv2s=l.has(2),je.vertexUv3s=l.has(3),l.clear(),je}function x(v){let w=[];if(v.shaderID?w.push(v.shaderID):(w.push(v.customVertexShaderID),w.push(v.customFragmentShaderID)),v.defines!==void 0)for(let R in v.defines)w.push(R),w.push(v.defines[R]);return v.isRawShaderMaterial===!1&&(g(w,v),m(w,v),w.push(i.outputColorSpace)),w.push(v.customProgramCacheKey),w.join()}function g(v,w){v.push(w.precision),v.push(w.outputColorSpace),v.push(w.envMapMode),v.push(w.envMapPMREM),v.push(w.envMapMaxLod),v.push(w.envMapSize),v.push(w.mapUv),v.push(w.alphaMapUv),v.push(w.lightMapUv),v.push(w.aoMapUv),v.push(w.bumpMapUv),v.push(w.normalMapUv),v.push(w.displacementMapUv),v.push(w.emissiveMapUv),v.push(w.metalnessMapUv),v.push(w.roughnessMapUv),v.push(w.anisotropyMapUv),v.push(w.clearcoatMapUv),v.push(w.clearcoatNormalMapUv),v.push(w.clearcoatRoughnessMapUv),v.push(w.diffuseRoughnessMapUv),v.push(w.iridescenceMapUv),v.push(w.iridescenceThicknessMapUv),v.push(w.sheenColorMapUv),v.push(w.sheenRoughnessMapUv),v.push(w.specularMapUv),v.push(w.specularColorMapUv),v.push(w.specularIntensityMapUv),v.push(w.transmissionMapUv),v.push(w.thicknessMapUv),v.push(w.combine),v.push(w.fogExp2),v.push(w.sizeAttenuation),v.push(w.morphTargetsCount),v.push(w.numSunLights),v.push(w.numDirLights),v.push(w.numPointLights),v.push(w.numSpotLights),v.push(w.numSpotLightMaps),v.push(w.numHemiLights),v.push(w.numRectAreaLights),v.push(w.numSunLightShadows),v.push(w.numDirLightShadows),v.push(w.numPointLightShadows),v.push(w.numSpotLightShadows),v.push(w.numSpotLightShadowsWithMaps),v.push(w.numLightProbes),v.push(w.numLightProbeGrids),v.push(w.shadowMapType),v.push(w.toneMapping),v.push(w.numClippingPlanes),v.push(w.numClipIntersection),v.push(w.depthPacking)}function m(v,w){o.disableAll(),w.instancing&&o.enable(0),w.instancingColor&&o.enable(1),w.instancingMorph&&o.enable(2),w.matcap&&o.enable(3),w.envMap&&o.enable(4),w.normalMapObjectSpace&&o.enable(5),w.normalMapTangentSpace&&o.enable(6),w.clearcoat&&o.enable(7),w.iridescence&&o.enable(8),w.alphaTest&&o.enable(9),w.vertexColors&&o.enable(10),w.vertexAlphas&&o.enable(11),w.vertexUv1s&&o.enable(12),w.vertexUv2s&&o.enable(13),w.vertexUv3s&&o.enable(14),w.vertexTangents&&o.enable(15),w.anisotropy&&o.enable(16),w.alphaHash&&o.enable(17),w.batching&&o.enable(18),w.dispersion&&o.enable(19),w.retroreflection&&o.enable(24),w.diffuseRoughness&&o.enable(25),w.batchingColor&&o.enable(20),w.gradientMap&&o.enable(21),w.packedNormalMap&&o.enable(22),w.vertexNormals&&o.enable(23),v.push(o.mask),o.disableAll(),w.fog&&o.enable(0),w.useFog&&o.enable(1),w.flatShading&&o.enable(2),w.logarithmicDepthBuffer&&o.enable(3),w.reversedDepthBuffer&&o.enable(4),w.skinning&&o.enable(5),w.morphTargets&&o.enable(6),w.morphNormals&&o.enable(7),w.morphColors&&o.enable(8),w.premultipliedAlpha&&o.enable(9),w.shadowMapEnabled&&o.enable(10),w.doubleSided&&o.enable(11),w.flipSided&&o.enable(12),w.useDepthPacking&&o.enable(13),w.dithering&&o.enable(14),w.transmission&&o.enable(15),w.sheen&&o.enable(16),w.opaque&&o.enable(17),w.pointsUvs&&o.enable(18),w.decodeVideoTexture&&o.enable(19),w.decodeVideoTextureEmissive&&o.enable(20),w.alphaToCoverage&&o.enable(21),w.numLightProbeGrids>0&&o.enable(22),w.hasPositionAttribute&&o.enable(23),v.push(o.mask)}function y(v){let w=f[v.type],R;if(w){let T=Ii[w];R=Hx.clone(T.uniforms)}else R=v.uniforms;return R}function _(v,w){let R=u.get(w);return R!==void 0?++R.usedTimes:(R=new vE(i,w,v,r),c.push(R),u.set(w,R)),R}function b(v){if(--v.usedTimes===0){let w=c.indexOf(v);c[w]=c[c.length-1],c.pop(),u.delete(v.cacheKey),v.destroy()}}function M(v){a.remove(v)}function S(){a.dispose()}return{getParameters:p,getProgramCacheKey:x,getUniforms:y,acquireProgram:_,releaseProgram:b,releaseShaderCache:M,programs:c,dispose:S}}function wE(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function TE(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function cy(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function uy(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(f){let d=0;return f.isInstancedMesh&&(d+=2),f.isSkinnedMesh&&(d+=1),d}function a(f,d,p,x,g,m){let y=i[e];return y===void 0?(y={id:f.id,object:f,geometry:d,material:p,materialVariant:o(f),groupOrder:x,renderOrder:f.renderOrder,z:g,group:m},i[e]=y):(y.id=f.id,y.object=f,y.geometry=d,y.material=p,y.materialVariant=o(f),y.groupOrder=x,y.renderOrder=f.renderOrder,y.z=g,y.group=m),e++,y}function l(f,d,p,x,g,m,y){y.reversedDepth===!0&&(g=-g);let _=a(f,d,p,x,g,m);p.transmission>0?n.push(_):p.transparent===!0?r.push(_):t.push(_)}function c(f,d,p,x,g,m){let y=a(f,d,p,x,g,m);p.transmission>0?n.unshift(y):p.transparent===!0?r.unshift(y):t.unshift(y)}function u(f,d){t.length>1&&t.sort(f||TE),n.length>1&&n.sort(d||cy),r.length>1&&r.sort(d||cy)}function h(){for(let f=e,d=i.length;f=s.length?(o=new uy,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function EE(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={direction:new U,color:new W};break;case"SpotLight":t={position:new U,direction:new U,color:new W,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new W,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new W,groundColor:new W};break;case"RectAreaLight":t={color:new W,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function RE(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var CE=0;function PE(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function IE(i){let e=new EE,t=RE(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new U);let r=new U,s=new ze,o=new ze;function a(c){let u=0,h=0,f=0;for(let L=0;L<9;L++)n.probe[L].set(0,0,0);let d=0,p=0,x=0,g=0,m=0,y=0,_=0,b=0,M=0,S=0,v=0,w=0,R=0,T=0;c.sort(PE);for(let L=0,O=c.length;L0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=_e.LTC_FLOAT_1,n.rectAreaLTC2=_e.LTC_FLOAT_2):(n.rectAreaLTC1=_e.LTC_HALF_1,n.rectAreaLTC2=_e.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;let C=n.hash;(C.sunLength!==d||C.directionalLength!==g||C.pointLength!==m||C.spotLength!==y||C.rectAreaLength!==_||C.hemiLength!==b||C.numSunShadows!==p||C.numDirectionalShadows!==M||C.numPointShadows!==S||C.numSpotShadows!==v||C.numSpotMaps!==w||C.numLightProbes!==T)&&(n.sun.length=d,n.directional.length=g,n.spot.length=y,n.rectArea.length=_,n.point.length=m,n.hemi.length=b,n.sunShadow.length=p,n.sunShadowMap.length=p,n.sunShadowMatrix.length=x,n.sunShadowCascade.length=x,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.directionalShadowMatrix.length=M,n.pointShadow.length=S,n.pointShadowMap.length=S,n.pointShadowMatrix.length=S,n.spotShadow.length=v,n.spotShadowMap.length=v,n.spotLightMatrix.length=v+w-R,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=T,C.sunLength=d,C.directionalLength=g,C.pointLength=m,C.spotLength=y,C.rectAreaLength=_,C.hemiLength=b,C.numSunShadows=p,C.numDirectionalShadows=M,C.numPointShadows=S,C.numSpotShadows=v,C.numSpotMaps=w,C.numLightProbes=T,n.version=CE++)}function l(c,u){let h=0,f=0,d=0,p=0,x=0,g=0,m=u.matrixWorldInverse;for(let y=0,_=c.length;y<_;y++){let b=c[y];if(b.isSunLight){let M=n.sun[h];M.direction.setFromMatrixPosition(b.matrixWorld),M.direction.transformDirection(m),h++}else if(b.isDirectionalLight){let M=n.directional[f];M.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(m),f++}else if(b.isSpotLight){let M=n.spot[p];M.position.setFromMatrixPosition(b.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(m),p++}else if(b.isRectAreaLight){let M=n.rectArea[x];M.position.setFromMatrixPosition(b.matrixWorld),M.position.applyMatrix4(m),o.identity(),s.copy(b.matrixWorld),s.premultiply(m),o.extractRotation(s),M.halfWidth.set(b.width*.5,0,0),M.halfHeight.set(0,b.height*.5,0),M.halfWidth.applyMatrix4(o),M.halfHeight.applyMatrix4(o),x++}else if(b.isPointLight){let M=n.point[d];M.position.setFromMatrixPosition(b.matrixWorld),M.position.applyMatrix4(m),d++}else if(b.isHemisphereLight){let M=n.hemi[g];M.direction.setFromMatrixPosition(b.matrixWorld),M.direction.transformDirection(m),g++}}}return{setup:a,setupView:l,state:n}}function hy(i){let e=new IE(i),t=[],n=[],r=[];function s(h){u.camera=h,t.length=0,n.length=0,r.length=0}function o(h){h.isLightProbeGrid?r.push(h):t.push(h)}function a(h){n.push(h)}function l(){e.setup(t),r.sort((h,f)=>h.priority-f.priority||h.id-f.id)}function c(h){e.setupView(t,h)}let u={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:u,setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function LE(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new hy(i),e.set(r,[a])):s>=o.length?(a=new hy(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var FE=`void main() { gl_Position = vec4( position, 1.0 ); -}`,gE=`uniform sampler2D shadow_pass; +}`,NE=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; void main() { @@ -4199,12 +4199,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); -}`,xE=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],bE=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],Qx=new ze,ja=new U,Td=new U;function yE(i,e,t){let n=new Lr,r=new Be,s=new Be,o=new _t,a=new Lc,l=new Fc,c={},u=t.maxTextureSize,h={[Ai]:un,[un]:Ai,[ht]:ht},f=new Si({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:mE,fragmentShader:gE}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Ce;p.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new we(p,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ga;let x=this.type;this.render=function(S,v,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;this.type===Hg&&(Fe("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Ga);let C=i.getRenderTarget(),A=i.getActiveCubeFace(),R=i.getActiveMipmapLevel(),N=i.state;N.setBlending(gs),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);let O=x!==this.type;O&&v.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(I=>I.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,I=S.length;Pu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/H.x),r.x=s.x*H.x,F.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/H.y),r.y=s.y*H.y,F.mapSize.y=s.y));let B=i.state.buffers.depth.getReversed();if(F.camera._reversedDepth=B,F.map===null||O===!0){if(F.map!==null&&(F.map.depthTexture!==null&&(F.map.depthTexture.dispose(),F.map.depthTexture=null),F.map.dispose()),this.type===yo){if(D.isPointLight){Fe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}F.map=new wn(r.x,r.y,{format:Ur,type:ai,minFilter:Ht,magFilter:Ht,generateMipmaps:!1}),F.map.texture.name=D.name+".shadowMap",F.map.depthTexture=new tr(r.x,r.y,Vn),F.map.depthTexture.name=D.name+".shadowMapDepth",F.map.depthTexture.format=Ki,F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut}else D.isPointLight?(F.map=new el(r.x),F.map.depthTexture=new Ta(r.x,oi)):(F.map=new wn(r.x,r.y),F.map.depthTexture=new tr(r.x,r.y,oi)),F.map.depthTexture.name=D.name+".shadowMap",F.map.depthTexture.format=Ki,this.type===Ga?(F.map.depthTexture.compareFunction=B?od:sd,F.map.depthTexture.minFilter=Ht,F.map.depthTexture.magFilter=Ht):(F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut);F.camera.updateProjectionMatrix()}F.map.isWebGLCubeRenderTarget!==!0&&(F.map.width!==r.x||F.map.height!==r.y)&&F.map.setSize(r.x,r.y);let X=F.map.isWebGLCubeRenderTarget?6:F.getViewportCount();D.isPointLight!==!0&&F.updateMatrices(D,w);let V=(F.camera.layers.mask&4294967294)!==0?F.camera.layers:w.layers;for(let re=0;re0||v.map&&v.alphaTest>0||v.alphaToCoverage===!0){let N=A.uuid,O=v.uuid,P=c[N];P===void 0&&(P={},c[N]=P);let I=P[O];I===void 0&&(I=A.clone(),P[O]=I,v.addEventListener("dispose",M)),A=I}if(A.visible=v.visible,A.wireframe=v.wireframe,C===yo?A.side=v.shadowSide!==null?v.shadowSide:v.side:A.side=v.shadowSide!==null?v.shadowSide:h[v.side],A.alphaMap=v.alphaMap,A.alphaTest=v.alphaToCoverage===!0?.5:v.alphaTest,A.map=v.map,A.clipShadows=v.clipShadows,A.clippingPlanes=v.clippingPlanes,A.clipIntersection=v.clipIntersection,A.displacementMap=v.displacementMap,A.displacementScale=v.displacementScale,A.displacementBias=v.displacementBias,A.wireframeLinewidth=v.wireframeLinewidth,A.linewidth=v.linewidth,w.isPointLight===!0&&A.isMeshDistanceMaterial===!0){let N=i.properties.get(A);N.light=w}return A}function y(S,v,w,C,A,R){if(S.visible===!1)return;if(S.layers.test(A)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===yo)&&(!S.frustumCulled||S.intersectsFrustum(n))){S.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,S.matrixWorld);let P=e.update(S),I=S.material;if(Array.isArray(I)){let D=P.groups;for(let F=0,H=D.length;F=1):B.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),F=H>=2);let X=null,V={},re=i.getParameter(i.SCISSOR_BOX),be=i.getParameter(i.VIEWPORT),Y=new _t().fromArray(re),Q=new _t().fromArray(be);function se(k,ne,j,pe){let ue=new Uint8Array(4),fe=i.createTexture();i.bindTexture(k,fe),i.texParameteri(k,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(k,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Oe=0;Oe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Be,u=new WeakMap,h=new Set,f,d=new WeakMap,p=new Set,g=new FinalizationRegistry(L=>p.delete(L)),m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(L,T){return m?new OffscreenCanvas(L,T):ao("canvas")}function b(L,T,K){let oe=1,ie=Xe(L);if((ie.width>K||ie.height>K)&&(oe=K/Math.max(ie.width,ie.height)),oe<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){let he=Math.floor(oe*ie.width),ge=Math.floor(oe*ie.height);f===void 0&&(f=x(he,ge));let ee=T?x(he,ge):f;return ee.width=he,ee.height=ge,ee.getContext("2d").drawImage(L,0,0,he,ge),Fe("WebGLRenderer: Texture has been resized from ("+ie.width+"x"+ie.height+") to ("+he+"x"+ge+")."),ee}else return"data"in L&&Fe("WebGLRenderer: Image in DataTexture is too big ("+ie.width+"x"+ie.height+")."),L;return L}function _(L){return L.generateMipmaps}function y(L){i.generateMipmap(L)}function M(L){return L.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:L.isWebGL3DRenderTarget?i.TEXTURE_3D:L.isWebGLArrayRenderTarget||L.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function S(L,T,K,oe,ie,he=!1){if(L!==null){if(i[L]!==void 0)return i[L];Fe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let ge;oe&&(ge=e.get("EXT_texture_norm16"),ge||Fe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ee=T;if(T===i.RED&&(K===i.FLOAT&&(ee=i.R32F),K===i.HALF_FLOAT&&(ee=i.R16F),K===i.UNSIGNED_BYTE&&(ee=i.R8),K===i.UNSIGNED_SHORT&&ge&&(ee=ge.R16_EXT),K===i.SHORT&&ge&&(ee=ge.R16_SNORM_EXT)),T===i.RED_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.R8UI),K===i.UNSIGNED_SHORT&&(ee=i.R16UI),K===i.UNSIGNED_INT&&(ee=i.R32UI),K===i.BYTE&&(ee=i.R8I),K===i.SHORT&&(ee=i.R16I),K===i.INT&&(ee=i.R32I)),T===i.RG&&(K===i.FLOAT&&(ee=i.RG32F),K===i.HALF_FLOAT&&(ee=i.RG16F),K===i.UNSIGNED_BYTE&&(ee=i.RG8),K===i.UNSIGNED_SHORT&&ge&&(ee=ge.RG16_EXT),K===i.SHORT&&ge&&(ee=ge.RG16_SNORM_EXT)),T===i.RG_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.RG8UI),K===i.UNSIGNED_SHORT&&(ee=i.RG16UI),K===i.UNSIGNED_INT&&(ee=i.RG32UI),K===i.BYTE&&(ee=i.RG8I),K===i.SHORT&&(ee=i.RG16I),K===i.INT&&(ee=i.RG32I)),T===i.RGB_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.RGB8UI),K===i.UNSIGNED_SHORT&&(ee=i.RGB16UI),K===i.UNSIGNED_INT&&(ee=i.RGB32UI),K===i.BYTE&&(ee=i.RGB8I),K===i.SHORT&&(ee=i.RGB16I),K===i.INT&&(ee=i.RGB32I)),T===i.RGBA_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.RGBA8UI),K===i.UNSIGNED_SHORT&&(ee=i.RGBA16UI),K===i.UNSIGNED_INT&&(ee=i.RGBA32UI),K===i.BYTE&&(ee=i.RGBA8I),K===i.SHORT&&(ee=i.RGBA16I),K===i.INT&&(ee=i.RGBA32I)),T===i.RGB&&(K===i.UNSIGNED_SHORT&&ge&&(ee=ge.RGB16_EXT),K===i.SHORT&&ge&&(ee=ge.RGB16_SNORM_EXT),K===i.UNSIGNED_INT_5_9_9_9_REV&&(ee=i.RGB9_E5),K===i.UNSIGNED_INT_10F_11F_11F_REV&&(ee=i.R11F_G11F_B10F)),T===i.RGBA){let te=he?xa:nt.getTransfer(ie);K===i.FLOAT&&(ee=i.RGBA32F),K===i.HALF_FLOAT&&(ee=i.RGBA16F),K===i.UNSIGNED_BYTE&&(ee=te===Mt?i.SRGB8_ALPHA8:i.RGBA8),K===i.UNSIGNED_SHORT&&ge&&(ee=ge.RGBA16_EXT),K===i.SHORT&&ge&&(ee=ge.RGBA16_SNORM_EXT),K===i.UNSIGNED_SHORT_4_4_4_4&&(ee=i.RGBA4),K===i.UNSIGNED_SHORT_5_5_5_1&&(ee=i.RGB5_A1)}return(ee===i.R16F||ee===i.R32F||ee===i.RG16F||ee===i.RG32F||ee===i.RGBA16F||ee===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ee}function v(L,T){let K;return L?T===null||T===oi||T===ys?K=i.DEPTH24_STENCIL8:T===Vn?K=i.DEPTH32F_STENCIL8:T===Mo&&(K=i.DEPTH24_STENCIL8,Fe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===oi||T===ys?K=i.DEPTH_COMPONENT24:T===Vn?K=i.DEPTH_COMPONENT32F:T===Mo&&(K=i.DEPTH_COMPONENT16),K}function w(L,T){return _(L)===!0||L.isFramebufferTexture&&L.minFilter!==Ut&&L.minFilter!==Ht?Math.log2(Math.max(T.width,T.height))+1:L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?T.mipmaps.length:1}function C(L){let T=new WeakRef(L);n.get(L).__ref=T,p.add(T),g.register(L,T,T)}function A(L){let T=n.get(L).__ref;T!==void 0&&(p.delete(T),g.unregister(T))}function R(L){O(L.target)}function N(L){P(L.target)}function O(L){L.removeEventListener("dispose",R),A(L),D(L),L.isVideoTexture&&u.delete(L),L.isHTMLTexture&&h.delete(L)}function P(L){L.removeEventListener("dispose",N),A(L),H(L)}function I(){for(let L of p){let T=L.deref();T!==void 0&&(T.isRenderTarget===!0?P(T):O(T))}p.clear(),h.clear()}function D(L){let T=n.get(L);if(T.__webglInit===void 0)return;let K=L.source,oe=d.get(K);if(oe){let ie=oe[T.__cacheKey];ie.usedTimes--,ie.usedTimes===0&&F(L),Object.keys(oe).length===0&&d.delete(K)}n.remove(L)}function F(L){let T=n.get(L);i.deleteTexture(T.__webglTexture);let K=L.source,oe=d.get(K);delete oe[T.__cacheKey],o.memory.textures--}function H(L){let T=n.get(L);T.__depthDisposeCallback&&T.__depthDisposeCallback();let K=L.depthTexture;if(K&&K.renderTarget===L&&O(K),L.isWebGLCubeRenderTarget)for(let ie=0;ie<6;ie++){if(Array.isArray(T.__webglFramebuffer[ie]))for(let he=0;he=r.maxTextures&&Fe("WebGLTextures: Trying to use "+(L+1)+" texture units while this GPU supports only "+r.maxTextures),B+=1,L}function Y(L){let T=[];return T.push(L.wrapS),T.push(L.wrapT),T.push(L.wrapR||0),T.push(L.magFilter),T.push(L.minFilter),T.push(L.anisotropy),T.push(L.internalFormat),T.push(L.format),T.push(L.type),T.push(L.generateMipmaps),T.push(L.mipmapsAutoUpdate),T.push(L.premultiplyAlpha),T.push(L.flipY),T.push(L.unpackAlignment),T.push(L.colorSpace),T.join()}function Q(L,T){let K=n.get(L);if(L.isVideoTexture&&Zt(L),L.isRenderTargetTexture===!1&&L.isExternalTexture!==!0&&L.version>0&&K.__version!==L.version){let oe=L.image;if(oe===null)Fe("WebGLRenderer: Texture marked for update but no image data found.");else if(oe.complete===!1)Fe("WebGLRenderer: Texture marked for update but image is incomplete");else{kt(K,L,T);return}}else L.isExternalTexture&&(K.__webglTexture=L.sourceTexture?L.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,K.__webglTexture,i.TEXTURE0+T)}function se(L,T){let K=n.get(L);if(L.isRenderTargetTexture===!1&&L.version>0&&K.__version!==L.version){kt(K,L,T);return}else L.isExternalTexture&&(K.__webglTexture=L.sourceTexture?L.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,K.__webglTexture,i.TEXTURE0+T)}function Se(L,T){let K=n.get(L);if(L.isRenderTargetTexture===!1&&L.version>0&&K.__version!==L.version){kt(K,L,T);return}t.bindTexture(i.TEXTURE_3D,K.__webglTexture,i.TEXTURE0+T)}function ce(L,T){let K=n.get(L);if(L.version>0&&K.__version!==L.version){on(K,L,T);return}t.bindTexture(i.TEXTURE_CUBE_MAP,K.__webglTexture,i.TEXTURE0+T)}let Le={[kn]:i.REPEAT,[ln]:i.CLAMP_TO_EDGE,[Cr]:i.MIRRORED_REPEAT},at={[Ut]:i.NEAREST,[vo]:i.NEAREST_MIPMAP_NEAREST,[lr]:i.NEAREST_MIPMAP_LINEAR,[Ht]:i.LINEAR,[Dr]:i.LINEAR_MIPMAP_NEAREST,[Fn]:i.LINEAR_MIPMAP_LINEAR},Te={[mx]:i.NEVER,[ad]:i.ALWAYS,[gx]:i.LESS,[sd]:i.LEQUAL,[xx]:i.EQUAL,[od]:i.GEQUAL,[bx]:i.GREATER,[yx]:i.NOTEQUAL};function ft(L,T){if(T.type===Vn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===Ht||T.magFilter===Dr||T.magFilter===lr||T.magFilter===Fn||T.minFilter===Ht||T.minFilter===Dr||T.minFilter===lr||T.minFilter===Fn)&&Fe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(L,i.TEXTURE_WRAP_S,Le[T.wrapS]),i.texParameteri(L,i.TEXTURE_WRAP_T,Le[T.wrapT]),(L===i.TEXTURE_3D||L===i.TEXTURE_2D_ARRAY)&&i.texParameteri(L,i.TEXTURE_WRAP_R,Le[T.wrapR]),i.texParameteri(L,i.TEXTURE_MAG_FILTER,at[T.magFilter]),i.texParameteri(L,i.TEXTURE_MIN_FILTER,at[T.minFilter]),T.compareFunction&&(i.texParameteri(L,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(L,i.TEXTURE_COMPARE_FUNC,Te[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Ut||T.minFilter!==lr&&T.minFilter!==Fn||T.type===Vn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||n.get(T).__currentAnisotropy){let K=e.get("EXT_texture_filter_anisotropic");i.texParameterf(L,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,r.getMaxAnisotropy())),n.get(T).__currentAnisotropy=T.anisotropy}}}function bt(L,T){let K=!1;L.__webglInit===void 0&&(L.__webglInit=!0,T.addEventListener("dispose",R),C(T));let oe=T.source,ie=d.get(oe);ie===void 0&&(ie={},d.set(oe,ie));let he=Y(T);if(he!==L.__cacheKey){ie[he]===void 0&&(ie[he]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,K=!0),ie[he].usedTimes++;let ge=ie[L.__cacheKey];ge!==void 0&&(ie[L.__cacheKey].usedTimes--,ge.usedTimes===0&&F(T)),L.__cacheKey=he,L.__webglTexture=ie[he].texture}return K}function tt(L,T,K){return Math.floor(Math.floor(L/K)/T)}function Yt(L,T,K,oe){let he=L.updateRanges;if(he.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,T.width,T.height,K,oe,T.data);else{he.sort((k,ne)=>k.start-ne.start);let ge=0;for(let k=1;k0){ue&&fe&&t.texStorage2D(i.TEXTURE_2D,je,ne,pe[0].width,pe[0].height);for(let ae=0,Ue=pe.length;ae0){let Je=bd(j.width,j.height,T.format,T.type);for(let _e of T.layerUpdates){let St=j.data.subarray(_e*Je/j.data.BYTES_PER_ELEMENT,(_e+1)*Je/j.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ae,0,0,_e,j.width,j.height,1,de,St)}}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ae,0,0,0,j.width,j.height,te.depth,de,j.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,ae,ne,j.width,j.height,te.depth,0,j.data,0,0);else Fe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ue?Oe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,ae,0,0,0,j.width,j.height,te.depth,de,k,j.data):t.texImage3D(i.TEXTURE_2D_ARRAY,ae,ne,j.width,j.height,te.depth,0,de,k,j.data);T.layerUpdates.size>0&&T.clearLayerUpdates()}else{ue&&fe&&t.texStorage2D(i.TEXTURE_2D,je,ne,pe[0].width,pe[0].height);for(let ae=0,Ue=pe.length;ae0){let ae=bd(te.width,te.height,T.format,T.type);for(let Ue of T.layerUpdates){let Je=te.data.subarray(Ue*ae/te.data.BYTES_PER_ELEMENT,(Ue+1)*ae/te.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Ue,te.width,te.height,1,de,k,Je)}T.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,te.width,te.height,te.depth,de,k,te.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,ne,te.width,te.height,te.depth,0,de,k,te.data);else if(T.isData3DTexture)ue?(fe&&t.texStorage3D(i.TEXTURE_3D,je,ne,te.width,te.height,te.depth),Oe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,te.width,te.height,te.depth,de,k,te.data)):t.texImage3D(i.TEXTURE_3D,0,ne,te.width,te.height,te.depth,0,de,k,te.data);else if(T.isFramebufferTexture){if(fe)if(ue)t.texStorage2D(i.TEXTURE_2D,je,ne,te.width,te.height);else{let ae=te.width,Ue=te.height;for(let Je=0;Je>=1,Ue>>=1}}else if(T.isHTMLTexture){if("texElementImage2D"in i){let ae=i.canvas;if(ae.hasAttribute("layoutsubtree")||ae.setAttribute("layoutsubtree","true"),te.parentNode!==ae){ae.appendChild(te),h.add(T),ae.onpaint=Ue=>{let Je=Ue.changedElements;for(let _e of h)Je.includes(_e.image)&&(_e.needsUpdate=!0)},ae.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,te);else{let Je=i.RGBA,_e=i.RGBA,St=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Je,_e,St,te)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(pe.length>0){if(ue&&fe){let ae=Xe(pe[0]);t.texStorage2D(i.TEXTURE_2D,je,ne,ae.width,ae.height)}for(let ae=0,Ue=pe.length;ae0&&Ue++;let _e=Xe(ne[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Ue,fe,_e.width,_e.height)}for(let _e=0;_e<6;_e++)if(k){Oe?ae&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,0,0,ne[_e].width,ne[_e].height,pe,ue,ne[_e].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,fe,ne[_e].width,ne[_e].height,0,pe,ue,ne[_e].data);for(let St=0;St>he),j=Math.max(1,T.height>>he);ie===i.TEXTURE_3D||ie===i.TEXTURE_2D_ARRAY?t.texImage3D(ie,he,te,ne,j,T.depth,0,ge,ee,null):t.texImage2D(ie,he,te,ne,j,0,ge,ee,null)}t.bindFramebuffer(i.FRAMEBUFFER,L),ye(T)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,oe,ie,k.__webglTexture,0,It(T)):(ie===i.TEXTURE_2D||ie>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ie<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,oe,ie,k.__webglTexture,he),t.bindFramebuffer(i.FRAMEBUFFER,null)}function gi(L,T,K){if(i.bindRenderbuffer(i.RENDERBUFFER,L),T.depthBuffer){let oe=T.depthTexture,ie=oe&&oe.isDepthTexture?oe.type:null,he=v(T.stencilBuffer,ie),ge=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;ye(T)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,It(T),he,T.width,T.height):K?i.renderbufferStorageMultisample(i.RENDERBUFFER,It(T),he,T.width,T.height):i.renderbufferStorage(i.RENDERBUFFER,he,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ge,i.RENDERBUFFER,L)}else{let oe=T.textures;for(let ie=0;ie{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,oe.removeEventListener("dispose",ie)};oe.addEventListener("dispose",ie),T.__depthDisposeCallback=ie}T.__boundDepthTexture=oe}if(L.depthTexture&&!T.__autoAllocateDepthBuffer)if(K)for(let oe=0;oe<6;oe++)en(T.__webglFramebuffer[oe],L,oe);else L.texture.mipmaps.length>0?en(T.__webglFramebuffer[0],L,0):en(T.__webglFramebuffer,L,0);else if(K){T.__webglDepthbuffer=[];for(let oe=0;oe<6;oe++)if(t.bindFramebuffer(i.FRAMEBUFFER,T.__webglFramebuffer[oe]),T.__webglDepthbuffer[oe]===void 0)T.__webglDepthbuffer[oe]=i.createRenderbuffer(),gi(T.__webglDepthbuffer[oe],L,!1);else{let ie=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=T.__webglDepthbuffer[oe];i.bindRenderbuffer(i.RENDERBUFFER,he),i.framebufferRenderbuffer(i.FRAMEBUFFER,ie,i.RENDERBUFFER,he)}}else if(L.texture.mipmaps.length>0?t.bindFramebuffer(i.FRAMEBUFFER,T.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=i.createRenderbuffer(),gi(T.__webglDepthbuffer,L,!1);else{let ie=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=T.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,he),i.framebufferRenderbuffer(i.FRAMEBUFFER,ie,i.RENDERBUFFER,he)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Wn(L,T,K){let oe=n.get(L);T!==void 0&&Nt(oe.__webglFramebuffer,L,L.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),K!==void 0&&Hn(L)}function Xn(L){let T=L.texture,K=n.get(L),oe=n.get(T);L.addEventListener("dispose",N),C(L);let ie=L.textures,he=L.isWebGLCubeRenderTarget===!0,ge=ie.length>1;if(ge||(oe.__webglTexture===void 0&&(oe.__webglTexture=i.createTexture()),oe.__version=T.version,o.memory.textures++),he){K.__webglFramebuffer=[];for(let ee=0;ee<6;ee++)if(T.mipmaps.length>0){K.__webglFramebuffer[ee]=[];for(let te=0;te0){K.__webglFramebuffer=[];for(let ee=0;ee0&&ye(L)===!1){K.__webglMultisampledFramebuffer=i.createFramebuffer(),K.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let ee=0;ee0)for(let te=0;te0&&i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAX_LEVEL,T.mipmaps.length-1),t.unbindTexture()}else if(ge){for(let ee=0,te=ie.length;ee0)for(let te=0;te0&&i.texParameteri(ee,i.TEXTURE_MAX_LEVEL,T.mipmaps.length-1),t.unbindTexture()}L.depthBuffer&&Hn(L)}function G(L){let T=L.textures;for(let K=0,oe=T.length;K0){if(ye(L)===!1){let T=L.textures,K=L.width,oe=L.height,ie=i.COLOR_BUFFER_BIT,he=L.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ge=n.get(L),ee=T.length>1;if(ee)for(let de=0;de0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let de=0;de0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function Zt(L){let T=o.render.frame;u.get(L)!==T&&(u.set(L,T),L.update())}function Ve(L,T){let K=L.colorSpace,oe=L.format,ie=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||K!==Mn&&K!==li&&(nt.getTransfer(K)===Mt?(oe!==On||ie!==Nn)&&Fe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):He("WebGLTextures: Unsupported texture color space:",K)),T}function Xe(L){return typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement?(c.width=L.naturalWidth||L.width,c.height=L.naturalHeight||L.height):typeof VideoFrame<"u"&&L instanceof VideoFrame?(c.width=L.displayWidth,c.height=L.displayHeight):(c.width=L.width,c.height=L.height),c}this.allocateTextureUnit=be,this.resetTextureUnits=X,this.getTextureUnits=V,this.setTextureUnits=re,this.setTexture2D=Q,this.setTexture2DArray=se,this.setTexture3D=Se,this.setTextureCube=ce,this.rebindTextures=Wn,this.setupRenderTarget=Xn,this.updateRenderTargetMipmap=G,this.updateMultisampleRenderTarget=Pt,this.setupDepthRenderbuffer=Hn,this.setupFrameBufferTexture=Nt,this.useMultisampledRTT=ye,this.dispose=I}function ME(i,e){function t(n,r=li){let s,o=nt.getTransfer(r);if(n===Nn)return i.UNSIGNED_BYTE;if(n===qc)return i.UNSIGNED_SHORT_4_4_4_4;if(n===$c)return i.UNSIGNED_SHORT_5_5_5_1;if(n===ed)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===td)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===jf)return i.BYTE;if(n===Qf)return i.SHORT;if(n===Mo)return i.UNSIGNED_SHORT;if(n===Yc)return i.INT;if(n===oi)return i.UNSIGNED_INT;if(n===Vn)return i.FLOAT;if(n===ai)return i.HALF_FLOAT;if(n===nd)return i.ALPHA;if(n===id)return i.RGB;if(n===On)return i.RGBA;if(n===Ki)return i.DEPTH_COMPONENT;if(n===cr)return i.DEPTH_STENCIL;if(n===Kc)return i.RED;if(n===Zc)return i.RED_INTEGER;if(n===Ur)return i.RG;if(n===Jc)return i.RG_INTEGER;if(n===jc)return i.RGBA_INTEGER;if(n===Wa||n===Xa||n===Ya||n===qa)if(o===Mt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Wa)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ya)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===qa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Wa)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xa)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ya)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===qa)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Qc||n===eu||n===tu||n===nu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Qc)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===eu)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===tu)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===nu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===iu||n===ru||n===su||n===ou||n===au||n===$a||n===lu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===iu||n===ru)return o===Mt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===su)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ou)return s.COMPRESSED_R11_EAC;if(n===au)return s.COMPRESSED_SIGNED_R11_EAC;if(n===$a)return s.COMPRESSED_RG11_EAC;if(n===lu)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===cu||n===uu||n===hu||n===fu||n===du||n===pu||n===mu||n===gu||n===xu||n===bu||n===yu||n===_u||n===vu||n===Mu)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===cu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===uu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===hu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===fu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===du)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===pu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===mu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===gu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===xu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===bu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===_u)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===vu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Mu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Su||n===wu||n===Tu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Su)return o===Mt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===wu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Tu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Au||n===Eu||n===Ka||n===Ru)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Au)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Eu)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ka)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ru)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ys?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var SE=` +}`,OE=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],DE=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],fy=new ze,el=new U,Dd=new U;function UE(i,e,t){let n=new Fr,r=new Ue,s=new Ue,o=new vt,a=new Uc,l=new Bc,c={},u=t.maxTextureSize,h={[Ai]:un,[un]:Ai,[ht]:ht},f=new Si({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ue},radius:{value:4}},vertexShader:FE,fragmentShader:NE}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Pe;p.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new Se(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Wa;let m=this.type;this.render=function(S,v,w){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;this.type===nx&&(Oe("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Wa);let R=i.getRenderTarget(),T=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),L=i.state;L.setBlending(xs),L.buffers.depth.getReversed()===!0?L.buffers.color.setClear(0,0,0,0):L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);let O=m!==this.type;O&&v.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(I=>I.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,I=S.length;Pu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/H.x),r.x=s.x*H.x,F.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/H.y),r.y=s.y*H.y,F.mapSize.y=s.y));let B=i.state.buffers.depth.getReversed();if(F.camera._reversedDepth=B,F.map===null||O===!0){if(F.map!==null&&(F.map.depthTexture!==null&&(F.map.depthTexture.dispose(),F.map.depthTexture=null),F.map.dispose()),this.type===Mo){if(D.isPointLight){Oe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}F.map=new wn(r.x,r.y,{format:Br,type:li,minFilter:Ht,magFilter:Ht,generateMipmaps:!1}),F.map.texture.name=D.name+".shadowMap",F.map.depthTexture=new tr(r.x,r.y,Vn),F.map.depthTexture.name=D.name+".shadowMapDepth",F.map.depthTexture.format=Ki,F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut}else D.isPointLight?(F.map=new nl(r.x),F.map.depthTexture=new Ea(r.x,ai)):(F.map=new wn(r.x,r.y),F.map.depthTexture=new tr(r.x,r.y,ai)),F.map.depthTexture.name=D.name+".shadowMap",F.map.depthTexture.format=Ki,this.type===Wa?(F.map.depthTexture.compareFunction=B?xd:gd,F.map.depthTexture.minFilter=Ht,F.map.depthTexture.magFilter=Ht):(F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut);F.camera.updateProjectionMatrix()}F.map.isWebGLCubeRenderTarget!==!0&&(F.map.width!==r.x||F.map.height!==r.y)&&F.map.setSize(r.x,r.y);let X=F.map.isWebGLCubeRenderTarget?6:F.getViewportCount();D.isPointLight!==!0&&F.updateMatrices(D,w);let V=(F.camera.layers.mask&4294967294)!==0?F.camera.layers:w.layers;for(let re=0;re0||v.map&&v.alphaTest>0||v.alphaToCoverage===!0){let L=T.uuid,O=v.uuid,P=c[L];P===void 0&&(P={},c[L]=P);let I=P[O];I===void 0&&(I=T.clone(),P[O]=I,v.addEventListener("dispose",M)),T=I}if(T.visible=v.visible,T.wireframe=v.wireframe,R===Mo?T.side=v.shadowSide!==null?v.shadowSide:v.side:T.side=v.shadowSide!==null?v.shadowSide:h[v.side],T.alphaMap=v.alphaMap,T.alphaTest=v.alphaToCoverage===!0?.5:v.alphaTest,T.map=v.map,T.clipShadows=v.clipShadows,T.clippingPlanes=v.clippingPlanes,T.clipIntersection=v.clipIntersection,T.displacementMap=v.displacementMap,T.displacementScale=v.displacementScale,T.displacementBias=v.displacementBias,T.wireframeLinewidth=v.wireframeLinewidth,T.linewidth=v.linewidth,w.isPointLight===!0&&T.isMeshDistanceMaterial===!0){let L=i.properties.get(T);L.light=w}return T}function b(S,v,w,R,T,C){if(S.visible===!1)return;if(S.layers.test(T)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&C===Mo)&&(!S.frustumCulled||S.intersectsFrustum(n))){S.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,S.matrixWorld);let P=e.update(S),I=S.material;if(Array.isArray(I)){let D=P.groups;for(let F=0,H=D.length;F=1):B.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),F=H>=2);let X=null,V={},re=i.getParameter(i.SCISSOR_BOX),ye=i.getParameter(i.VIEWPORT),Y=new vt().fromArray(re),Q=new vt().fromArray(ye);function se(k,ne,j,pe){let ce=new Uint8Array(4),fe=i.createTexture();i.bindTexture(k,fe),i.texParameteri(k,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(k,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let De=0;De"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ue,u=new WeakMap,h=new Set,f,d=new WeakMap,p=new Set,x=new FinalizationRegistry(N=>p.delete(N)),g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(N,A){return g?new OffscreenCanvas(N,A):uo("canvas")}function y(N,A,K){let oe=1,ie=qe(N);if((ie.width>K||ie.height>K)&&(oe=K/Math.max(ie.width,ie.height)),oe<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){let he=Math.floor(oe*ie.width),ge=Math.floor(oe*ie.height);f===void 0&&(f=m(he,ge));let ee=A?m(he,ge):f;return ee.width=he,ee.height=ge,ee.getContext("2d").drawImage(N,0,0,he,ge),Oe("WebGLRenderer: Texture has been resized from ("+ie.width+"x"+ie.height+") to ("+he+"x"+ge+")."),ee}else return"data"in N&&Oe("WebGLRenderer: Image in DataTexture is too big ("+ie.width+"x"+ie.height+")."),N;return N}function _(N){return N.generateMipmaps}function b(N){i.generateMipmap(N)}function M(N){return N.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?i.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function S(N,A,K,oe,ie,he=!1){if(N!==null){if(i[N]!==void 0)return i[N];Oe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ge;oe&&(ge=e.get("EXT_texture_norm16"),ge||Oe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ee=A;if(A===i.RED&&(K===i.FLOAT&&(ee=i.R32F),K===i.HALF_FLOAT&&(ee=i.R16F),K===i.UNSIGNED_BYTE&&(ee=i.R8),K===i.UNSIGNED_SHORT&&ge&&(ee=ge.R16_EXT),K===i.SHORT&&ge&&(ee=ge.R16_SNORM_EXT)),A===i.RED_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.R8UI),K===i.UNSIGNED_SHORT&&(ee=i.R16UI),K===i.UNSIGNED_INT&&(ee=i.R32UI),K===i.BYTE&&(ee=i.R8I),K===i.SHORT&&(ee=i.R16I),K===i.INT&&(ee=i.R32I)),A===i.RG&&(K===i.FLOAT&&(ee=i.RG32F),K===i.HALF_FLOAT&&(ee=i.RG16F),K===i.UNSIGNED_BYTE&&(ee=i.RG8),K===i.UNSIGNED_SHORT&&ge&&(ee=ge.RG16_EXT),K===i.SHORT&&ge&&(ee=ge.RG16_SNORM_EXT)),A===i.RG_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.RG8UI),K===i.UNSIGNED_SHORT&&(ee=i.RG16UI),K===i.UNSIGNED_INT&&(ee=i.RG32UI),K===i.BYTE&&(ee=i.RG8I),K===i.SHORT&&(ee=i.RG16I),K===i.INT&&(ee=i.RG32I)),A===i.RGB_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.RGB8UI),K===i.UNSIGNED_SHORT&&(ee=i.RGB16UI),K===i.UNSIGNED_INT&&(ee=i.RGB32UI),K===i.BYTE&&(ee=i.RGB8I),K===i.SHORT&&(ee=i.RGB16I),K===i.INT&&(ee=i.RGB32I)),A===i.RGBA_INTEGER&&(K===i.UNSIGNED_BYTE&&(ee=i.RGBA8UI),K===i.UNSIGNED_SHORT&&(ee=i.RGBA16UI),K===i.UNSIGNED_INT&&(ee=i.RGBA32UI),K===i.BYTE&&(ee=i.RGBA8I),K===i.SHORT&&(ee=i.RGBA16I),K===i.INT&&(ee=i.RGBA32I)),A===i.RGB&&(K===i.UNSIGNED_SHORT&&ge&&(ee=ge.RGB16_EXT),K===i.SHORT&&ge&&(ee=ge.RGB16_SNORM_EXT),K===i.UNSIGNED_INT_5_9_9_9_REV&&(ee=i.RGB9_E5),K===i.UNSIGNED_INT_10F_11F_11F_REV&&(ee=i.R11F_G11F_B10F)),A===i.RGBA){let te=he?ba:it.getTransfer(ie);K===i.FLOAT&&(ee=i.RGBA32F),K===i.HALF_FLOAT&&(ee=i.RGBA16F),K===i.UNSIGNED_BYTE&&(ee=te===Mt?i.SRGB8_ALPHA8:i.RGBA8),K===i.UNSIGNED_SHORT&&ge&&(ee=ge.RGBA16_EXT),K===i.SHORT&&ge&&(ee=ge.RGBA16_SNORM_EXT),K===i.UNSIGNED_SHORT_4_4_4_4&&(ee=i.RGBA4),K===i.UNSIGNED_SHORT_5_5_5_1&&(ee=i.RGB5_A1)}return(ee===i.R16F||ee===i.R32F||ee===i.RG16F||ee===i.RG32F||ee===i.RGBA16F||ee===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ee}function v(N,A){let K;return N?A===null||A===ai||A===vs?K=i.DEPTH24_STENCIL8:A===Vn?K=i.DEPTH32F_STENCIL8:A===To&&(K=i.DEPTH24_STENCIL8,Oe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):A===null||A===ai||A===vs?K=i.DEPTH_COMPONENT24:A===Vn?K=i.DEPTH_COMPONENT32F:A===To&&(K=i.DEPTH_COMPONENT16),K}function w(N,A){return _(N)===!0||N.isFramebufferTexture&&N.minFilter!==Ut&&N.minFilter!==Ht?Math.log2(Math.max(A.width,A.height))+1:N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?A.mipmaps.length:1}function R(N){let A=new WeakRef(N);n.get(N).__ref=A,p.add(A),x.register(N,A,A)}function T(N){let A=n.get(N).__ref;A!==void 0&&(p.delete(A),x.unregister(A))}function C(N){O(N.target)}function L(N){P(N.target)}function O(N){N.removeEventListener("dispose",C),T(N),D(N),N.isVideoTexture&&u.delete(N),N.isHTMLTexture&&h.delete(N)}function P(N){N.removeEventListener("dispose",L),T(N),H(N)}function I(){for(let N of p){let A=N.deref();A!==void 0&&(A.isRenderTarget===!0?P(A):O(A))}p.clear(),h.clear()}function D(N){let A=n.get(N);if(A.__webglInit===void 0)return;let K=N.source,oe=d.get(K);if(oe){let ie=oe[A.__cacheKey];ie.usedTimes--,ie.usedTimes===0&&F(N),Object.keys(oe).length===0&&d.delete(K)}n.remove(N)}function F(N){let A=n.get(N);i.deleteTexture(A.__webglTexture);let K=N.source,oe=d.get(K);delete oe[A.__cacheKey],o.memory.textures--}function H(N){let A=n.get(N);A.__depthDisposeCallback&&A.__depthDisposeCallback();let K=N.depthTexture;if(K&&K.renderTarget===N&&O(K),N.isWebGLCubeRenderTarget)for(let ie=0;ie<6;ie++){if(Array.isArray(A.__webglFramebuffer[ie]))for(let he=0;he=r.maxTextures&&Oe("WebGLTextures: Trying to use "+(N+1)+" texture units while this GPU supports only "+r.maxTextures),B+=1,N}function Y(N){let A=[];return A.push(N.wrapS),A.push(N.wrapT),A.push(N.wrapR||0),A.push(N.magFilter),A.push(N.minFilter),A.push(N.anisotropy),A.push(N.internalFormat),A.push(N.format),A.push(N.type),A.push(N.generateMipmaps),A.push(N.mipmapsAutoUpdate),A.push(N.premultiplyAlpha),A.push(N.flipY),A.push(N.unpackAlignment),A.push(N.colorSpace),A.join()}function Q(N,A){let K=n.get(N);if(N.isVideoTexture&&Zt(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&K.__version!==N.version){let oe=N.image;if(oe===null)Oe("WebGLRenderer: Texture marked for update but no image data found.");else if(oe.complete===!1)Oe("WebGLRenderer: Texture marked for update but image is incomplete");else{kt(K,N,A);return}}else N.isExternalTexture&&(K.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,K.__webglTexture,i.TEXTURE0+A)}function se(N,A){let K=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&K.__version!==N.version){kt(K,N,A);return}else N.isExternalTexture&&(K.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,K.__webglTexture,i.TEXTURE0+A)}function we(N,A){let K=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&K.__version!==N.version){kt(K,N,A);return}t.bindTexture(i.TEXTURE_3D,K.__webglTexture,i.TEXTURE0+A)}function le(N,A){let K=n.get(N);if(N.version>0&&K.__version!==N.version){on(K,N,A);return}t.bindTexture(i.TEXTURE_CUBE_MAP,K.__webglTexture,i.TEXTURE0+A)}let Ne={[kn]:i.REPEAT,[ln]:i.CLAMP_TO_EDGE,[Pr]:i.MIRRORED_REPEAT},at={[Ut]:i.NEAREST,[wo]:i.NEAREST_MIPMAP_NEAREST,[cr]:i.NEAREST_MIPMAP_LINEAR,[Ht]:i.LINEAR,[Ur]:i.LINEAR_MIPMAP_NEAREST,[Fn]:i.LINEAR_MIPMAP_LINEAR},Ae={[Rx]:i.NEVER,[yd]:i.ALWAYS,[Cx]:i.LESS,[gd]:i.LEQUAL,[Px]:i.EQUAL,[xd]:i.GEQUAL,[Ix]:i.GREATER,[Lx]:i.NOTEQUAL};function ft(N,A){if(A.type===Vn&&e.has("OES_texture_float_linear")===!1&&(A.magFilter===Ht||A.magFilter===Ur||A.magFilter===cr||A.magFilter===Fn||A.minFilter===Ht||A.minFilter===Ur||A.minFilter===cr||A.minFilter===Fn)&&Oe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(N,i.TEXTURE_WRAP_S,Ne[A.wrapS]),i.texParameteri(N,i.TEXTURE_WRAP_T,Ne[A.wrapT]),(N===i.TEXTURE_3D||N===i.TEXTURE_2D_ARRAY)&&i.texParameteri(N,i.TEXTURE_WRAP_R,Ne[A.wrapR]),i.texParameteri(N,i.TEXTURE_MAG_FILTER,at[A.magFilter]),i.texParameteri(N,i.TEXTURE_MIN_FILTER,at[A.minFilter]),A.compareFunction&&(i.texParameteri(N,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(N,i.TEXTURE_COMPARE_FUNC,Ae[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(A.magFilter===Ut||A.minFilter!==cr&&A.minFilter!==Fn||A.type===Vn&&e.has("OES_texture_float_linear")===!1)return;if(A.anisotropy>1||n.get(A).__currentAnisotropy){let K=e.get("EXT_texture_filter_anisotropic");i.texParameterf(N,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,r.getMaxAnisotropy())),n.get(A).__currentAnisotropy=A.anisotropy}}}function yt(N,A){let K=!1;N.__webglInit===void 0&&(N.__webglInit=!0,A.addEventListener("dispose",C),R(A));let oe=A.source,ie=d.get(oe);ie===void 0&&(ie={},d.set(oe,ie));let he=Y(A);if(he!==N.__cacheKey){ie[he]===void 0&&(ie[he]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,K=!0),ie[he].usedTimes++;let ge=ie[N.__cacheKey];ge!==void 0&&(ie[N.__cacheKey].usedTimes--,ge.usedTimes===0&&F(A)),N.__cacheKey=he,N.__webglTexture=ie[he].texture}return K}function nt(N,A,K){return Math.floor(Math.floor(N/K)/A)}function Yt(N,A,K,oe){let he=N.updateRanges;if(he.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,A.width,A.height,K,oe,A.data);else{he.sort((k,ne)=>k.start-ne.start);let ge=0;for(let k=1;k0){ce&&fe&&t.texStorage2D(i.TEXTURE_2D,Qe,ne,pe[0].width,pe[0].height);for(let ae=0,Be=pe.length;ae0){let je=Cd(j.width,j.height,A.format,A.type);for(let ve of A.layerUpdates){let St=j.data.subarray(ve*je/j.data.BYTES_PER_ELEMENT,(ve+1)*je/j.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ae,0,0,ve,j.width,j.height,1,de,St)}}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ae,0,0,0,j.width,j.height,te.depth,de,j.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,ae,ne,j.width,j.height,te.depth,0,j.data,0,0);else Oe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ce?De&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,ae,0,0,0,j.width,j.height,te.depth,de,k,j.data):t.texImage3D(i.TEXTURE_2D_ARRAY,ae,ne,j.width,j.height,te.depth,0,de,k,j.data);A.layerUpdates.size>0&&A.clearLayerUpdates()}else{ce&&fe&&t.texStorage2D(i.TEXTURE_2D,Qe,ne,pe[0].width,pe[0].height);for(let ae=0,Be=pe.length;ae0){let ae=Cd(te.width,te.height,A.format,A.type);for(let Be of A.layerUpdates){let je=te.data.subarray(Be*ae/te.data.BYTES_PER_ELEMENT,(Be+1)*ae/te.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Be,te.width,te.height,1,de,k,je)}A.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,te.width,te.height,te.depth,de,k,te.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,ne,te.width,te.height,te.depth,0,de,k,te.data);else if(A.isData3DTexture)ce?(fe&&t.texStorage3D(i.TEXTURE_3D,Qe,ne,te.width,te.height,te.depth),De&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,te.width,te.height,te.depth,de,k,te.data)):t.texImage3D(i.TEXTURE_3D,0,ne,te.width,te.height,te.depth,0,de,k,te.data);else if(A.isFramebufferTexture){if(fe)if(ce)t.texStorage2D(i.TEXTURE_2D,Qe,ne,te.width,te.height);else{let ae=te.width,Be=te.height;for(let je=0;je>=1,Be>>=1}}else if(A.isHTMLTexture){if("texElementImage2D"in i){let ae=i.canvas;if(ae.hasAttribute("layoutsubtree")||ae.setAttribute("layoutsubtree","true"),te.parentNode!==ae){ae.appendChild(te),h.add(A),ae.onpaint=Be=>{let je=Be.changedElements;for(let ve of h)je.includes(ve.image)&&(ve.needsUpdate=!0)},ae.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,te);else{let je=i.RGBA,ve=i.RGBA,St=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,je,ve,St,te)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(pe.length>0){if(ce&&fe){let ae=qe(pe[0]);t.texStorage2D(i.TEXTURE_2D,Qe,ne,ae.width,ae.height)}for(let ae=0,Be=pe.length;ae0&&Be++;let ve=qe(ne[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Be,fe,ve.width,ve.height)}for(let ve=0;ve<6;ve++)if(k){De?ae&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,0,0,ne[ve].width,ne[ve].height,pe,ce,ne[ve].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,fe,ne[ve].width,ne[ve].height,0,pe,ce,ne[ve].data);for(let St=0;St>he),j=Math.max(1,A.height>>he);ie===i.TEXTURE_3D||ie===i.TEXTURE_2D_ARRAY?t.texImage3D(ie,he,te,ne,j,A.depth,0,ge,ee,null):t.texImage2D(ie,he,te,ne,j,0,ge,ee,null)}t.bindFramebuffer(i.FRAMEBUFFER,N),be(A)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,oe,ie,k.__webglTexture,0,It(A)):(ie===i.TEXTURE_2D||ie>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ie<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,oe,ie,k.__webglTexture,he),t.bindFramebuffer(i.FRAMEBUFFER,null)}function xi(N,A,K){if(i.bindRenderbuffer(i.RENDERBUFFER,N),A.depthBuffer){let oe=A.depthTexture,ie=oe&&oe.isDepthTexture?oe.type:null,he=v(A.stencilBuffer,ie),ge=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;be(A)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,It(A),he,A.width,A.height):K?i.renderbufferStorageMultisample(i.RENDERBUFFER,It(A),he,A.width,A.height):i.renderbufferStorage(i.RENDERBUFFER,he,A.width,A.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ge,i.RENDERBUFFER,N)}else{let oe=A.textures;for(let ie=0;ie{delete A.__boundDepthTexture,delete A.__depthDisposeCallback,oe.removeEventListener("dispose",ie)};oe.addEventListener("dispose",ie),A.__depthDisposeCallback=ie}A.__boundDepthTexture=oe}if(N.depthTexture&&!A.__autoAllocateDepthBuffer)if(K)for(let oe=0;oe<6;oe++)en(A.__webglFramebuffer[oe],N,oe);else N.texture.mipmaps.length>0?en(A.__webglFramebuffer[0],N,0):en(A.__webglFramebuffer,N,0);else if(K){A.__webglDepthbuffer=[];for(let oe=0;oe<6;oe++)if(t.bindFramebuffer(i.FRAMEBUFFER,A.__webglFramebuffer[oe]),A.__webglDepthbuffer[oe]===void 0)A.__webglDepthbuffer[oe]=i.createRenderbuffer(),xi(A.__webglDepthbuffer[oe],N,!1);else{let ie=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=A.__webglDepthbuffer[oe];i.bindRenderbuffer(i.RENDERBUFFER,he),i.framebufferRenderbuffer(i.FRAMEBUFFER,ie,i.RENDERBUFFER,he)}}else if(N.texture.mipmaps.length>0?t.bindFramebuffer(i.FRAMEBUFFER,A.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer===void 0)A.__webglDepthbuffer=i.createRenderbuffer(),xi(A.__webglDepthbuffer,N,!1);else{let ie=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,he=A.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,he),i.framebufferRenderbuffer(i.FRAMEBUFFER,ie,i.RENDERBUFFER,he)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Wn(N,A,K){let oe=n.get(N);A!==void 0&&Nt(oe.__webglFramebuffer,N,N.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),K!==void 0&&Hn(N)}function Xn(N){let A=N.texture,K=n.get(N),oe=n.get(A);N.addEventListener("dispose",L),R(N);let ie=N.textures,he=N.isWebGLCubeRenderTarget===!0,ge=ie.length>1;if(ge||(oe.__webglTexture===void 0&&(oe.__webglTexture=i.createTexture()),oe.__version=A.version,o.memory.textures++),he){K.__webglFramebuffer=[];for(let ee=0;ee<6;ee++)if(A.mipmaps.length>0){K.__webglFramebuffer[ee]=[];for(let te=0;te0){K.__webglFramebuffer=[];for(let ee=0;ee0&&be(N)===!1){K.__webglMultisampledFramebuffer=i.createFramebuffer(),K.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let ee=0;ee0)for(let te=0;te0&&i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAX_LEVEL,A.mipmaps.length-1),t.unbindTexture()}else if(ge){for(let ee=0,te=ie.length;ee0)for(let te=0;te0&&i.texParameteri(ee,i.TEXTURE_MAX_LEVEL,A.mipmaps.length-1),t.unbindTexture()}N.depthBuffer&&Hn(N)}function G(N){let A=N.textures;for(let K=0,oe=A.length;K0){if(be(N)===!1){let A=N.textures,K=N.width,oe=N.height,ie=i.COLOR_BUFFER_BIT,he=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ge=n.get(N),ee=A.length>1;if(ee)for(let de=0;de0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let de=0;de0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function Zt(N){let A=o.render.frame;u.get(N)!==A&&(u.set(N,A),N.update())}function Ve(N,A){let K=N.colorSpace,oe=N.format,ie=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||K!==Mn&&K!==ci&&(it.getTransfer(K)===Mt?(oe!==On||ie!==Nn)&&Oe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):We("WebGLTextures: Unsupported texture color space:",K)),A}function qe(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=ye,this.resetTextureUnits=X,this.getTextureUnits=V,this.setTextureUnits=re,this.setTexture2D=Q,this.setTexture2DArray=se,this.setTexture3D=we,this.setTextureCube=le,this.rebindTextures=Wn,this.setupRenderTarget=Xn,this.updateRenderTargetMipmap=G,this.updateMultisampleRenderTarget=Pt,this.setupDepthRenderbuffer=Hn,this.setupFrameBufferTexture=Nt,this.useMultisampledRTT=be,this.dispose=I}function zE(i,e){function t(n,r=ci){let s,o=it.getTransfer(r);if(n===Nn)return i.UNSIGNED_BYTE;if(n===jc)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Qc)return i.UNSIGNED_SHORT_5_5_5_1;if(n===hd)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===fd)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===cd)return i.BYTE;if(n===ud)return i.SHORT;if(n===To)return i.UNSIGNED_SHORT;if(n===Jc)return i.INT;if(n===ai)return i.UNSIGNED_INT;if(n===Vn)return i.FLOAT;if(n===li)return i.HALF_FLOAT;if(n===dd)return i.ALPHA;if(n===pd)return i.RGB;if(n===On)return i.RGBA;if(n===Ki)return i.DEPTH_COMPONENT;if(n===ur)return i.DEPTH_STENCIL;if(n===eu)return i.RED;if(n===tu)return i.RED_INTEGER;if(n===Br)return i.RG;if(n===nu)return i.RG_INTEGER;if(n===iu)return i.RGBA_INTEGER;if(n===Ya||n===qa||n===$a||n===Ka)if(o===Mt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ya)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===qa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===$a)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ka)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ya)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===qa)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===$a)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ka)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ru||n===su||n===ou||n===au)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ru)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===su)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ou)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===au)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===lu||n===cu||n===uu||n===hu||n===fu||n===Za||n===du)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===lu||n===cu)return o===Mt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===uu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===hu)return s.COMPRESSED_R11_EAC;if(n===fu)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Za)return s.COMPRESSED_RG11_EAC;if(n===du)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===pu||n===mu||n===gu||n===xu||n===yu||n===bu||n===vu||n===_u||n===Mu||n===Su||n===wu||n===Tu||n===Au||n===Eu)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===pu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===mu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===gu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===xu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===yu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===bu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===vu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===_u)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Mu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Su)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===wu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Tu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Au)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Eu)return o===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ru||n===Cu||n===Pu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ru)return o===Mt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Cu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Pu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Iu||n===Lu||n===Ja||n===Fu)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Iu)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Lu)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ja)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Fu)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===vs?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var VE=` void main() { gl_Position = vec4( position, 1.0 ); -}`,wE=` +}`,GE=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -4223,7 +4223,7 @@ void main() { } -}`,Ld=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Aa(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Si({vertexShader:SE,fragmentShader:wE,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new we(new sn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Fd=class extends yi{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,p=null,g=typeof XRWebGLBinding<"u",m=new Ld,x={},b=t.getContextAttributes(),_=null,y=null,M=[],S=[],v=new Be,w=null,C=null,A=new Jt;A.viewport=new _t;let R=new Jt;R.viewport=new _t;let N=[A,R],O=new Vc,P=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let Q=M[Y];return Q===void 0&&(Q=new ho,M[Y]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(Y){let Q=M[Y];return Q===void 0&&(Q=new ho,M[Y]=Q),Q.getGripSpace()},this.getHand=function(Y){let Q=M[Y];return Q===void 0&&(Q=new ho,M[Y]=Q),Q.getHandSpace()};function D(Y){let Q=S.indexOf(Y.inputSource);if(Q===-1)return;let se=M[Q];se!==void 0&&(se.update(Y.inputSource,Y.frame,c||o),se.dispatchEvent({type:Y.type,data:Y.inputSource}))}function F(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",H);for(let Y=0;Y=0&&(S[Se]=null,M[Se].disconnect(se))}for(let Q=0;Q=S.length){S.push(se),Se=Le;break}else if(S[Le]===null){S[Le]=se,Se=Le;break}if(Se===-1)break}let ce=M[Se];ce&&ce.connect(se)}}function B(Y,Q){Q===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(Q.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let Q=Y.near,se=Y.far;m.texture!==null&&(m.depthNear>0&&(Q=m.depthNear),m.depthFar>0&&(se=m.depthFar)),O.near=R.near=A.near=Q,O.far=R.far=A.far=se,(P!==O.near||I!==O.far)&&(r.updateRenderState({depthNear:O.near,depthFar:O.far}),P=O.near,I=O.far),O.layers.mask=Y.layers.mask|6,A.layers.mask=O.layers.mask&-5,R.layers.mask=O.layers.mask&-3;let Se=Y.parent,ce=O.cameras;B(O,Se);for(let Le=0;Le0&&(m.alphaTest.value=x.alphaTest);let b=e.get(x),_=b.envMap,y=b.envMapRotation;_&&(m.envMap.value=_,m.envMapRotation.value.setFromMatrix4(TE.makeRotationFromEuler(y)).transpose(),_.isCubeTexture&&_.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(ub),m.reflectivity.value=x.reflectivity,m.ior.value=x.ior,m.refractionRatio.value=x.refractionRatio),x.lightMap&&(m.lightMap.value=x.lightMap,m.lightMapIntensity.value=x.lightMapIntensity,t(x.lightMap,m.lightMapTransform)),x.aoMap&&(m.aoMap.value=x.aoMap,m.aoMapIntensity.value=x.aoMapIntensity,t(x.aoMap,m.aoMapTransform))}function o(m,x){m.diffuse.value.copy(x.color),m.opacity.value=x.opacity,x.map&&(m.map.value=x.map,t(x.map,m.mapTransform))}function a(m,x){m.dashSize.value=x.dashSize,m.totalSize.value=x.dashSize+x.gapSize,m.scale.value=x.scale}function l(m,x,b,_){m.diffuse.value.copy(x.color),m.opacity.value=x.opacity,m.size.value=x.size*b,m.scale.value=_*.5,x.map&&(m.map.value=x.map,t(x.map,m.uvTransform)),x.alphaMap&&(m.alphaMap.value=x.alphaMap,t(x.alphaMap,m.alphaMapTransform)),x.alphaTest>0&&(m.alphaTest.value=x.alphaTest)}function c(m,x){m.diffuse.value.copy(x.color),m.opacity.value=x.opacity,m.rotation.value=x.rotation,x.map&&(m.map.value=x.map,t(x.map,m.mapTransform)),x.alphaMap&&(m.alphaMap.value=x.alphaMap,t(x.alphaMap,m.alphaMapTransform)),x.alphaTest>0&&(m.alphaTest.value=x.alphaTest)}function u(m,x){m.specular.value.copy(x.specular),m.shininess.value=Math.max(x.shininess,1e-4)}function h(m,x){x.gradientMap&&(m.gradientMap.value=x.gradientMap)}function f(m,x){m.metalness.value=x.metalness,x.metalnessMap&&(m.metalnessMap.value=x.metalnessMap,t(x.metalnessMap,m.metalnessMapTransform)),m.roughness.value=x.roughness,x.roughnessMap&&(m.roughnessMap.value=x.roughnessMap,t(x.roughnessMap,m.roughnessMapTransform)),x.envMap&&(m.envMapIntensity.value=x.envMapIntensity)}function d(m,x,b){m.ior.value=x.ior,x.diffuseRoughness>0&&(m.diffuseRoughness.value=x.diffuseRoughness,x.diffuseRoughnessMap&&(m.diffuseRoughnessMap.value=x.diffuseRoughnessMap,t(x.diffuseRoughnessMap,m.diffuseRoughnessMapTransform))),x.sheen>0&&(m.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),m.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(m.sheenColorMap.value=x.sheenColorMap,t(x.sheenColorMap,m.sheenColorMapTransform)),x.sheenRoughnessMap&&(m.sheenRoughnessMap.value=x.sheenRoughnessMap,t(x.sheenRoughnessMap,m.sheenRoughnessMapTransform))),x.clearcoat>0&&(m.clearcoat.value=x.clearcoat,m.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(m.clearcoatMap.value=x.clearcoatMap,t(x.clearcoatMap,m.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,t(x.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(m.clearcoatNormalMap.value=x.clearcoatNormalMap,t(x.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===un&&m.clearcoatNormalScale.value.negate())),x.dispersion>0&&(m.dispersion.value=x.dispersion),x.retroreflectivity>0&&(m.retroreflectivity.value=x.retroreflectivity),x.iridescence>0&&(m.iridescence.value=x.iridescence,m.iridescenceIOR.value=x.iridescenceIOR,m.iridescenceThicknessMinimum.value=x.iridescenceThicknessMinimum,m.iridescenceThicknessMaximum.value=x.iridescenceThicknessMaximum,x.iridescenceMap&&(m.iridescenceMap.value=x.iridescenceMap,t(x.iridescenceMap,m.iridescenceMapTransform)),x.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=x.iridescenceThicknessMap,t(x.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),x.transmission>0&&(m.transmission.value=x.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),x.transmissionMap&&(m.transmissionMap.value=x.transmissionMap,t(x.transmissionMap,m.transmissionMapTransform)),m.thickness.value=x.thickness,x.thicknessMap&&(m.thicknessMap.value=x.thicknessMap,t(x.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=x.attenuationDistance,m.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(m.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(m.anisotropyMap.value=x.anisotropyMap,t(x.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=x.specularIntensity,m.specularColor.value.copy(x.specularColor),x.specularColorMap&&(m.specularColorMap.value=x.specularColorMap,t(x.specularColorMap,m.specularColorMapTransform)),x.specularIntensityMap&&(m.specularIntensityMap.value=x.specularIntensityMap,t(x.specularIntensityMap,m.specularIntensityMapTransform))}function p(m,x){x.matcap&&(m.matcap.value=x.matcap)}function g(m,x){let b=e.get(x).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function EE(i,e,t,n){let r={},s={};function o(b,_){let y=_.program;n.uniformBlockBinding(b,y,r[b.id])}function a(b,_){let y=r[b.id];y===void 0&&(p(b),y=l(b),r[b.id]=y,b.addEventListener("dispose",m));let M=_.program;n.updateUBOMapping(b,M);let S=e.render.frame;s[b.id]!==S&&(c(b),s[b.id]=S)}function l(b){let _=i.createBuffer(),y=b.__size,M=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,_),i.bufferData(i.UNIFORM_BUFFER,y,M),i.bindBuffer(i.UNIFORM_BUFFER,null),_}function c(b){let _=r[b.id],y=b.uniforms,M=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,_);for(let S=0,v=y.length;S0&&(y+=M-S),b.__size=y,b.__cache={},this}function g(b,_){let y={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(y.boundary=4,y.storage=4):b.isVector2?(y.boundary=8,y.storage=8):b.isVector3||b.isColor?(y.boundary=16,y.storage=12):b.isVector4?(y.boundary=16,y.storage=16):b.isMatrix3?(y.boundary=16,y.storage=48):b.isMatrix4?(y.boundary=16,y.storage=64):b.isTexture?Fe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(b)?(y.boundary=16,y.storage=b.byteLength):Fe("WebGLRenderer: Unsupported uniform value type.",b),_===!0&&(y.boundary=16,y.storage=Math.ceil(y.storage/16)*16),y}function m(b){let _=b.target;_.removeEventListener("dispose",m),i.deleteBuffer(r[_.id]),delete r[_.id],delete s[_.id]}function x(){for(let b in r)i.deleteBuffer(r[b]);r={},s={}}return{bind:o,update:a,dispose:x}}var RE=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Pi=null;function CE(){return Pi===null&&(Pi=new po(RE,16,16,Ur,ai),Pi.name="DFG_LUT",Pi.minFilter=Ht,Pi.magFilter=Ht,Pi.wrapS=ln,Pi.wrapT=ln,Pi.generateMipmaps=!1,Pi.needsUpdate=!0),Pi}var kr=class{constructor(e={}){let{canvas:t=_x(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:f=!1,outputBufferType:d=Nn}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=o;let g=d,m=new Set([jc,Jc,Zc]),x=new Set([Nn,oi,Mo,ys,qc,$c]),b=new Uint32Array(4),_=new Int32Array(4),y={textures:[],min:[],max:[],resolution:[]},M=null,S=null,v=[],w=[],C=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let A=this,R=!1,N=null,O=null,P=null,I=null;this._outputColorSpace=dt;let D=0,F=0,H=null,B=-1,X=null,V=new _t,re=new _t,be=null,Y=new W(0),Q=0,se=t.width,Se=t.height,ce=1,Le=null,at=null,Te=new _t(0,0,se,Se),ft=new _t(0,0,se,Se),bt=!1,tt=new Lr,Yt=new Rc,kt=!1,on=!1,Nt=new ze,gi=new U,en=new _t,Hn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Wn=!1;function Xn(){return H===null?ce:1}let G=n;function Yn(E,z){return t.getContext(E,z)}let Pt,It,ye,Zt,Ve,Xe,L,T,K,oe,ie,he,ge,ee,te,de,k,ne,j,pe,ue,fe,Oe;try{let E={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"187"}`),t.addEventListener("webglcontextlost",Ue,!1),t.addEventListener("webglcontextrestored",Je,!1),t.addEventListener("webglcontextcreationerror",_e,!1),G===null){let z="webgl2";if(G=Yn(z,E),G===null)throw Yn(z)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}je()}catch(E){throw t.removeEventListener("webglcontextlost",Ue,!1),t.removeEventListener("webglcontextrestored",Je,!1),t.removeEventListener("webglcontextcreationerror",_e,!1),He("WebGLRenderer: "+E.message),E}function je(){Pt=new zT(G),Pt.init(),ue=new ME(G,Pt),It=new CT(G,Pt,e,ue),ye=new _E(G,Pt),It.reversedDepthBuffer&&f&&ye.buffers.depth.setReversed(!0),O=G.createFramebuffer(),P=G.createFramebuffer(),I=G.createFramebuffer(),Zt=new HT(G),Ve=new oE,Xe=new vE(G,Pt,ye,Ve,It,ue,Zt),L=new kT(A),T=new XS(G),fe=new ET(G,T),K=new VT(G,T,Zt,fe),oe=new XT(G,K,T,fe,Zt),ne=new WT(G,It,Xe),te=new PT(Ve),ie=new sE(A,L,Pt,It,fe,te),he=new AE(A,Ve),ge=new lE,ee=new pE(Pt),k=new AT(A,L,ye,oe,p,l),de=new yE(A,oe,It),Oe=new EE(G,Zt,It,ye),j=new RT(G,Pt,Zt),pe=new GT(G,Pt,Zt),Zt.programs=ie.programs,A.capabilities=It,A.extensions=Pt,A.properties=Ve,A.renderLists=ge,A.shadowMap=de,A.state=ye,A.info=Zt}g!==Nn&&(C=new qT(g,t.width,t.height,a,r,s));let ae=new Fd(A,G);this.xr=ae,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){let E=Pt.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){let E=Pt.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return ce},this.setPixelRatio=function(E){E!==void 0&&(ce=E,this.setSize(se,Se,!1))},this.getSize=function(E){return E.set(se,Se)},this.setSize=function(E,z,J=!0){if(ae.isPresenting){Fe("WebGLRenderer: Can't change size while VR device is presenting.");return}se=E,Se=z,t.width=Math.floor(E*ce),t.height=Math.floor(z*ce),J===!0&&(t.style.width=E+"px",t.style.height=z+"px"),C!==null&&C.setSize(t.width,t.height),this.setViewport(0,0,E,z)},this.getDrawingBufferSize=function(E){return E.set(se*ce,Se*ce).floor()},this.setDrawingBufferSize=function(E,z,J){se=E,Se=z,ce=J,t.width=Math.floor(E*J),t.height=Math.floor(z*J),this.setViewport(0,0,E,z)},this.setEffects=function(E){if(g===Nn){He("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(E){for(let z=0;z{function xe(){if($.forEach(function(Ae){let Me=Ve.get(Ae).currentProgram;(Me===void 0||Me.isReady())&&$.delete(Ae)}),$.size===0){Z(E);return}setTimeout(xe,10)}Pt.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let qh=null;function l1(E){qh&&qh(E)}function f0(){$r.stop()}function d0(){$r.start()}let $r=new eb;$r.setAnimationLoop(l1),typeof self<"u"&&$r.setContext(self),this.setAnimationLoop=function(E){qh=E,ae.setAnimationLoop(E),E===null?$r.stop():$r.start()},ae.addEventListener("sessionstart",f0),ae.addEventListener("sessionend",d0),this.render=function(E,z){if(z!==void 0&&z.isCamera!==!0){He("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;N!==null&&N.renderStart(E,z);let J=ae.enabled===!0&&ae.isPresenting===!0,$=C!==null&&(H===null||J)&&C.begin(A,H);if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),z.parent===null&&z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),ae.enabled===!0&&ae.isPresenting===!0&&(C===null||C.isCompositing()===!1)&&(ae.cameraAutoUpdate===!0&&ae.updateCamera(z),z=ae.getCamera()),E.isScene===!0&&E.onBeforeRender(A,E,z,H),S=ee.get(E,w.length),S.init(z),S.state.textureUnits=Xe.getTextureUnits(),w.push(S),Nt.multiplyMatrices(z.projectionMatrix,z.matrixWorldInverse),z.isArrayCamera?Yt.setFromArrayCamera(z):tt.setFromProjectionMatrix(Nt,$n,z.reversedDepth),on=this.localClippingEnabled,kt=te.init(this.clippingPlanes,on),M=ge.get(E,v.length),M.init(),v.push(M),this.info.render.frame++,ae.enabled===!0&&ae.isPresenting===!0){let Ae=A.xr.getDepthSensingMesh();Ae!==null&&$h(Ae,z,-1/0,A.sortObjects)}$h(E,z,0,A.sortObjects),M.finish(),N!==null&&N.updateLights(S.state.lightsArray),A.sortObjects===!0&&M.sort(Le,at),Wn=ae.enabled===!1||ae.isPresenting===!1||ae.hasDepthSensing()===!1,Wn&&k.addToRenderList(M,E),this.info.autoReset===!0&&this.info.reset(),kt===!0&&te.beginShadows();let Z=S.state.shadowsArray;if(de.render(Z,E,z),kt===!0&&te.endShadows(),($&&C.hasRenderPass())===!1){let Ae=M.opaque,me=M.transmissive;if(S.setupLights(),z.isArrayCamera){let Me=z.cameras;if(me.length>0)for(let Pe=0,qe=Me.length;Pe0&&m0(Ae,me,E,z),Wn&&k.render(E),p0(M,E,z)}H!==null&&F===0&&(Xe.updateMultisampleRenderTarget(H),Xe.updateRenderTargetMipmap(H)),$&&C.end(A),E.isScene===!0&&E.onAfterRender(A,E,z),fe.resetDefaultState(),B=-1,X=null,w.pop(),w.length>0?(S=w[w.length-1],Xe.setTextureUnits(S.state.textureUnits),kt===!0&&te.setGlobalState(A.clippingPlanes,S.state.camera)):S=null,v.pop(),v.length>0?M=v[v.length-1]:M=null,N!==null&&N.renderEnd()};function $h(E,z,J,$){if(E.visible===!1)return;if(E.layers.test(z.layers)){if(E.isGroup)J=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(z);else if(E.isLight)S.pushLight(E),E.castShadow&&S.pushShadow(E);else if(E.isSprite){let Ae=z.isArrayCamera?Yt:tt;if(!E.frustumCulled||E.intersectsFrustum(Ae)){$&&en.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Nt);let me=oe.update(E),Me=E.material;Me.visible&&M.push(E,me,Me,J,en.z,null,z)}}else if(E.isMesh||E.isLine||E.isPoints){let Ae=z.isArrayCamera?Yt:tt;if(!E.frustumCulled||E.intersectsFrustum(Ae)){let me=oe.update(E),Me=E.material;if($&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),en.copy(E.boundingSphere.center)):(me.boundingSphere===null&&me.computeBoundingSphere(),en.copy(me.boundingSphere.center)),en.applyMatrix4(E.matrixWorld).applyMatrix4(Nt)),Array.isArray(Me)){let Pe=me.groups;for(let qe=0,lt=Pe.length;qe0&&Nl(Z,z,J),xe.length>0&&Nl(xe,z,J),Ae.length>0&&Nl(Ae,z,J),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function m0(E,z,J,$){if((J.isScene===!0?J.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[$.id]===void 0){let Ee=Pt.has("EXT_color_buffer_half_float")||Pt.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[$.id]=new wn(1,1,{generateMipmaps:!0,type:Ee?ai:Nn,minFilter:Fn,samples:Math.max(4,It.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:nt.workingColorSpace})}let xe=S.state.transmissionRenderTarget[$.id],Ae=$.viewport||V;xe.setSize(Ae.z*A.transmissionResolutionScale,Ae.w*A.transmissionResolutionScale);let me=A.getRenderTarget(),Me=A.getActiveCubeFace(),Pe=A.getActiveMipmapLevel();A.setRenderTarget(xe),A.getClearColor(Y),Q=A.getClearAlpha(),Q<1&&A.setClearColor(16777215,.5),A.clear(),Wn&&k.render(J);let qe=A.toneMapping;A.toneMapping=Ri;let lt=$.viewport;if($.viewport!==void 0&&($.viewport=void 0),S.setupLightsView($),kt===!0&&te.setGlobalState(A.clippingPlanes,$),Nl(E,J,$),Xe.updateMultisampleRenderTarget(xe),Xe.updateRenderTargetMipmap(xe),Pt.has("WEBGL_multisampled_render_to_texture")===!1){let Ee=!1;for(let ct=0,qt=z.length;ct0),Ee=!!J.morphAttributes.position,ct=!!J.morphAttributes.normal,qt=!!J.morphAttributes.color,Rt=Ri;$.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(Rt=A.toneMapping);let At=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,hn=At!==void 0?At.length:0,Re=Ve.get($),_n=S.state.lights;if(kt===!0&&(on===!0||E!==X)){let Ot=E===X&&$.id===B;te.setState($,E,Ot)}let yt=!1,Kr=!1;$.version===Re.__version?Re.needsLights&&Re.lightsStateVersion!==_n.state.version||Z.isBatchedMesh&&Re.batching===!1||!Z.isBatchedMesh&&Re.batching===!0||Z.isBatchedMesh&&Re.batchingColor===!0&&Z._colorsTexture===null||Z.isBatchedMesh&&Re.batchingColor===!1&&Z._colorsTexture!==null||Z.isInstancedMesh&&Re.instancing===!1||!Z.isInstancedMesh&&Re.instancing===!0||Z.isSkinnedMesh&&Re.skinning===!1||!Z.isSkinnedMesh&&Re.skinning===!0||Z.isInstancedMesh&&Re.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&Re.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&Re.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&Re.instancingMorph===!1&&Z.morphTexture!==null||Re.envMap!==Pe||$.fog===!0&&Re.fog!==xe||Re.numClippingPlanes!==void 0&&(Re.numClippingPlanes!==te.numPlanes||Re.numIntersection!==te.numIntersection)||Re.vertexAlphas!==qe||Re.vertexTangents!==lt||Re.morphTargets!==Ee||Re.morphNormals!==ct||Re.morphColors!==qt||Re.morphTargetsCount!==hn||Re.numLightProbeGrids!==x0(S.state.lightProbeGridArray)?yt=!0:(Re.outputColorSpace!==me||Re.toneMapping!==Rt)&&(Kr=!0):(yt=!0,Re.__version=$.version);let fn=Re.currentProgram;(yt===!0||Kr===!0)&&(fn=Kr===!0?c1($,z,Z,me,Rt):Jo($,z,Z),N&&$.isNodeMaterial&&N.onUpdateProgram($,fn,Re));let Ol=!1,_r=!1,Zr=!1,pt=fn.getUniforms(),an=Re.uniforms;if(ye.useProgram(fn.program)&&(Ol=!0,_r=!0,Zr=!0),$.id!==B&&(B=$.id,_r=!0),Ol||X!==E){ye.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),pt.setValue(G,"projectionMatrix",E.projectionMatrix),pt.setValue(G,"viewMatrix",E.matrixWorldInverse);let nn=pt.map.cameraPosition;nn!==void 0&&nn.setValue(G,gi.setFromMatrixPosition(E.matrixWorld)),It.logarithmicDepthBuffer&&pt.setValue(G,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&pt.setValue(G,"isOrthographic",E.isOrthographicCamera===!0),X!==E&&(X=E,_r=!0,Zr=!0)}if(Re.needsLights&&(_n.state.sunShadowMap.length>0&&pt.setValue(G,"sunShadowMap",_n.state.sunShadowMap,Xe),_n.state.directionalShadowMap.length>0&&pt.setValue(G,"directionalShadowMap",_n.state.directionalShadowMap,Xe),_n.state.spotShadowMap.length>0&&pt.setValue(G,"spotShadowMap",_n.state.spotShadowMap,Xe),_n.state.pointShadowMap.length>0&&pt.setValue(G,"pointShadowMap",_n.state.pointShadowMap,Xe)),Z.isSkinnedMesh){pt.setOptional(G,Z,"bindMatrix"),pt.setOptional(G,Z,"bindMatrixInverse");let Ot=Z.skeleton;Ot&&(Ot.boneTexture===null&&Ot.computeBoneTexture(),pt.setValue(G,"boneTexture",Ot.boneTexture,Xe))}Z.isBatchedMesh&&(pt.setOptional(G,Z,"batchingTexture"),pt.setValue(G,"batchingTexture",Z._matricesTexture,Xe),pt.setOptional(G,Z,"batchingIdTexture"),pt.setValue(G,"batchingIdTexture",Z._indirectTexture,Xe),pt.setOptional(G,Z,"batchingColorTexture"),Z._colorsTexture!==null&&pt.setValue(G,"batchingColorTexture",Z._colorsTexture,Xe));let ti=J.morphAttributes;if((ti.position!==void 0||ti.normal!==void 0||ti.color!==void 0)&&ne.update(Z,J,fn),(_r||Re.receiveShadow!==Z.receiveShadow)&&(Re.receiveShadow=Z.receiveShadow,pt.setValue(G,"receiveShadow",Z.receiveShadow)),($.isMeshStandardMaterial||$.isMeshLambertMaterial||$.isMeshPhongMaterial)&&$.envMap===null&&z.environment!==null&&(an.envMapIntensity.value=z.environmentIntensity),an.dfgLUT!==void 0&&(an.dfgLUT.value=CE()),_r){if(pt.setValue(G,"toneMappingExposure",A.toneMappingExposure),Re.needsLights&&h1(an,Zr),xe&&$.fog===!0&&he.refreshFogUniforms(an,xe),he.refreshMaterialUniforms(an,$,ce,Se,S.state.transmissionRenderTarget[E.id]),Re.needsLights&&Re.numLightProbeGrids>0){let Ot=y,nn=0;for(let zi of S.state.lightProbeGridArray)zi.texture!==null&&(Ot.textures[nn]=zi.texture,Ot.min[nn]=zi.boundingBox.min,Ot.max[nn]=zi.boundingBox.max,Ot.resolution[nn]=zi.resolution,nn++);for(let zi in Ot)Ot[zi].length=nn;an.probesSH.value=Ot.textures,an.probesMin.value=Ot.min,an.probesMax.value=Ot.max,an.probesResolution.value=Ot.resolution}wo.upload(G,b0(Re),an,Xe)}if($.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(wo.upload(G,b0(Re),an,Xe),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&pt.setValue(G,"center",Z.center),pt.setValue(G,"modelViewMatrix",Z.modelViewMatrix),pt.setValue(G,"normalMatrix",Z.normalMatrix),pt.setValue(G,"modelMatrix",Z.matrixWorld),$.uniformsGroups!==void 0){let Ot=$.uniformsGroups;for(let nn=0,zi=Ot.length;nn0&&Xe.useMultisampledRTT(E)===!1?$=Ve.get(E).__webglMultisampledFramebuffer:Array.isArray(Pe)?$=Pe[J]:$=Pe,V.copy(E.viewport),re.copy(E.scissor),be=E.scissorTest}else V.copy(Te).multiplyScalar(ce).floor(),re.copy(ft).multiplyScalar(ce).floor(),be=bt;if(J!==0&&($=O),ye.bindFramebuffer(G.FRAMEBUFFER,$)&&ye.drawBuffers(E,$),ye.viewport(V),ye.scissor(re),ye.setScissorTest(be),Z){let me=Ve.get(E.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_CUBE_MAP_POSITIVE_X+z,me.__webglTexture,J)}else if(xe){let me=z;for(let Me=0;Me1&&G.readBuffer(G.COLOR_ATTACHMENT0+me);let Ee=_0(Pe);if(Ee.__formatReadable===!1){He("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Ee.__typeReadable===!1){He("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=E.width-$&&J>=0&&J<=E.height-Z&&G.readPixels(z,J,$,Z,ue.convert(qe),ue.convert(lt),xe)}finally{let Pe=H!==null?Ve.get(H).__webglFramebuffer:null;ye.bindFramebuffer(G.FRAMEBUFFER,Pe)}}},this.readRenderTargetPixelsAsync=async function(E,z,J,$,Z,xe,Ae,me=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Me=Ve.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Ae!==void 0&&(Me=Me[Ae],Array.isArray(Me)&&(Me=Me[0])),Me)if(z>=0&&z<=E.width-$&&J>=0&&J<=E.height-Z){ye.bindFramebuffer(G.FRAMEBUFFER,Me);let Pe=E.textures[me],qe=Pe.format,lt=Pe.type;E.textures.length>1&&G.readBuffer(G.COLOR_ATTACHMENT0+me);let Ee=_0(Pe);if(Ee.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Ee.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let ct=G.createBuffer();G.bindBuffer(G.PIXEL_PACK_BUFFER,ct),G.bufferData(G.PIXEL_PACK_BUFFER,xe.byteLength,G.STREAM_READ),G.readPixels(z,J,$,Z,ue.convert(qe),ue.convert(lt),0),G.bindBuffer(G.PIXEL_PACK_BUFFER,null);let qt=H!==null?Ve.get(H).__webglFramebuffer:null;ye.bindFramebuffer(G.FRAMEBUFFER,qt);let Rt=G.fenceSync(G.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),await Mx(G,Rt,4),G.bindBuffer(G.PIXEL_PACK_BUFFER,ct),G.getBufferSubData(G.PIXEL_PACK_BUFFER,0,xe),G.bindBuffer(G.PIXEL_PACK_BUFFER,null),G.deleteBuffer(ct),G.deleteSync(Rt),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,z=null,J=0){let $=Math.pow(2,-J),Z=Math.floor(E.image.width*$),xe=Math.floor(E.image.height*$),Ae=z!==null?z.x:0,me=z!==null?z.y:0;Xe.setTexture2D(E,0),G.copyTexSubImage2D(G.TEXTURE_2D,J,0,0,Ae,me,Z,xe),ye.unbindTexture()},this.copyTextureToTexture=function(E,z,J=null,$=null,Z=0,xe=0){let Ae,me,Me,Pe,qe,lt,Ee,ct,qt,Rt=E.isCompressedTexture?E.mipmaps[xe]:E.image;if(J!==null)Ae=J.max.x-J.min.x,me=J.max.y-J.min.y,Me=J.isBox3?J.max.z-J.min.z:1,Pe=J.min.x,qe=J.min.y,lt=J.isBox3?J.min.z:0;else{let pt=Math.pow(2,-Z);Ae=Math.floor(Rt.width*pt),me=Math.floor(Rt.height*pt),E.isDataArrayTexture?Me=Rt.depth:E.isData3DTexture?Me=Math.floor(Rt.depth*pt):Me=1,Pe=0,qe=0,lt=0}$!==null?(Ee=$.x,ct=$.y,qt=$.z):(Ee=0,ct=0,qt=0);let At=ue.convert(z.format),hn=ue.convert(z.type),Re;z.isData3DTexture?(Xe.setTexture3D(z,0),Re=G.TEXTURE_3D):z.isDataArrayTexture||z.isCompressedArrayTexture?(Xe.setTexture2DArray(z,0),Re=G.TEXTURE_2D_ARRAY):(Xe.setTexture2D(z,0),Re=G.TEXTURE_2D),ye.activeTexture(G.TEXTURE0),ye.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,z.flipY),ye.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),ye.pixelStorei(G.UNPACK_ALIGNMENT,z.unpackAlignment);let _n=ye.getParameter(G.UNPACK_ROW_LENGTH),yt=ye.getParameter(G.UNPACK_IMAGE_HEIGHT),Kr=ye.getParameter(G.UNPACK_SKIP_PIXELS),fn=ye.getParameter(G.UNPACK_SKIP_ROWS),Ol=ye.getParameter(G.UNPACK_SKIP_IMAGES);ye.pixelStorei(G.UNPACK_ROW_LENGTH,Rt.width),ye.pixelStorei(G.UNPACK_IMAGE_HEIGHT,Rt.height),ye.pixelStorei(G.UNPACK_SKIP_PIXELS,Pe),ye.pixelStorei(G.UNPACK_SKIP_ROWS,qe),ye.pixelStorei(G.UNPACK_SKIP_IMAGES,lt);let _r=E.isDataArrayTexture||E.isData3DTexture,Zr=z.isDataArrayTexture||z.isData3DTexture;if(E.isDepthTexture){let pt=Ve.get(E),an=Ve.get(z),ti=Ve.get(pt.__renderTarget),Ot=Ve.get(an.__renderTarget);ye.bindFramebuffer(G.READ_FRAMEBUFFER,ti.__webglFramebuffer),ye.bindFramebuffer(G.DRAW_FRAMEBUFFER,Ot.__webglFramebuffer);for(let nn=0;nn.5+.5*Math.min(1,Math.max(0,i/1.6));function Dd(i,e){let t=Math.hypot(i,e);return .8+.28*((e/t*nl[0]-i/t*nl[1]+1)/2)}var Ye=-1,rl=16,ur=32,Ud=48,Ou=64,Bd=128,zr=(i,e)=>new De(i,e),ut=class{p=[];c=[];f=[];uv;tile;constructor(e=!1,t=!1){this.uv=e?[]:null,this.tile=t?[]:null}tri(e,t,n,r,s=r,o=r,a,l=Ye,c=[0,1]){this.p.push(...e,...t,...n);for(let u of[r,s,o])this.c.push(u.r,u.g,u.b);this.f.push(l,l,l),this.uv?.push(...a??[.5,.5,.5,.5,.5,.5]),this.tile?.push(...c,...c,...c)}get count(){return this.p.length/9}geometry(){let e=new Ce;return e.setAttribute("position",zr(this.p,3)),e.setAttribute("color",zr(this.c,3)),e.setAttribute("fold",zr(this.f,1)),this.uv&&e.setAttribute("uv",zr(this.uv,2)),this.tile&&e.setAttribute("tile",zr(this.tile,2)),e.computeBoundingSphere(),e}},Wt=class{p=[];c=[];f=[];seg(e,t,n=Li,r=Ye){this.p.push(...e,...t),this.c.push(n.r,n.g,n.b,n.r,n.g,n.b),this.f.push(r,r)}segSplit(e,t,n,r,s){let[o,a]=e[1]<=t[1]?[e,t]:[t,e];if(a[1]<=r+1e-6||s<0)return this.seg(o,a,n,Ye);if(o[1]>=r-1e-6)return this.seg(o,a,n,s);let l=(r-o[1])/(a[1]-o[1]),c=[o[0]+(a[0]-o[0])*l,r,o[2]+(a[2]-o[2])*l];this.seg(o,c,n,Ye),this.seg(c,a,n,s)}geometry(){let e=new Ce;return e.setAttribute("position",zr(this.p,3)),e.setAttribute("color",zr(this.c,3)),e.setAttribute("fold",zr(this.f,1)),e}};var kd=(i,e,t)=>i.map((n,r)=>n+(e[r]-n)*t);function hb(i,e,t){let n=(t-i.p[1])/(e.p[1]-i.p[1]);return{p:kd(i.p,e.p,n),c:kd(i.c,e.c,n),uv:i.uv&&e.uv?kd(i.uv,e.uv,n):null,tile:i.tile}}function PE(i,e){return{p:i.p.slice(e*3,e*3+3),c:i.c.slice(e*3,e*3+3),uv:i.uv?i.uv.slice(e*2,e*2+2):null,tile:i.tile?i.tile.slice(e*2,e*2+2):null}}function IE(i,e,t,n){t.forEach((r,s)=>{let o=e*3+s;r.p.forEach((a,l)=>i.p[o*3+l]=a),r.c.forEach((a,l)=>i.c[o*3+l]=a),i.uv&&r.uv&&r.uv.forEach((a,l)=>i.uv[o*2+l]=a),i.tile&&r.tile&&r.tile.forEach((a,l)=>i.tile[o*2+l]=a),i.f[o]=n})}function fb(i,e,t){for(let n of e)i.p.push(...n.p),i.c.push(...n.c),i.f.push(t),i.uv?.push(...n.uv??[.5,.5]),i.tile?.push(...n.tile??[0,1])}function zd(i,e,t,n){let r=i.count;for(let s=e;sPE(i,s*3+_)),a=o.map(_=>_.p[1]>t+1e-6),l=o.map(_=>_.p[1]=t-1e-6){i.f[s*2]=n,i.f[s*2+1]=n;continue}let u=(t-l[1])/(c[1]-l[1]),h=[l[0]+(c[0]-l[0])*u,t,l[2]+(c[2]-l[2])*u],f=i.c.slice(s*6,s*6+3);i.p.splice(s*6,6,...l,...h),i.p.push(...h,...c),i.c.push(...f,...f),i.f.push(n,n)}}var LE=i=>i.reduce((e,t,n)=>e+t[0]*i[(n+1)%i.length][1]-i[(n+1)%i.length][0]*t[1],0),db=([i,e])=>new Be(i,e);function Vr(i,e=[]){return Ia.triangulateShape(i.map(db),e.map(t=>t.map(db)))}var Eo=(i,e)=>[i[0]-e[0],i[1]-e[1],i[2]-e[2]],pb=(i,e)=>[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]],mb=(i,e)=>i[0]*e[0]+i[1]*e[1]+i[2]*e[2],gb=i=>{let e=Math.hypot(i[0],i[1],i[2])||1;return[i[0]/e,i[1]/e,i[2]/e]};function Gd(i,e,t,n,r,s,o){let a=new W(o);for(let f=0;f<4;f++){let[d,p]=[e[f],e[(f+1)%4]],[g,m]=[t[f],t[(f+1)%4]],[x,b]=[p[0]-d[0],p[1]-d[1]],_=Math.hypot(x,b);if(_<1e-6)continue;let y=(g[0]+m[0]-d[0]-p[0])/2*(-b/_)+(g[1]+m[1]-d[1]-p[1])/2*(x/_),M=Math.max(0,Math.min(1,y/Math.max(1e-6,Math.hypot(y,r-n)))),S=Dd(x,b),v=ke(s,il(n)*S).lerp(a,M),w=ke(s,il(r)*S).lerp(a,M);i.tri([d[0],n,d[1]],[g[0],r,g[1]],[m[0],r,m[1]],v,w,w),i.tri([d[0],n,d[1]],[m[0],r,m[1]],[p[0],n,p[1]],v,w,v)}let[l,c,u,h]=t;Math.hypot(u[0]-l[0],u[1]-l[1])>1e-4&&(i.tri([l[0],r,l[1]],[u[0],r,u[1]],[c[0],r,c[1]],a),i.tri([l[0],r,l[1]],[h[0],r,h[1]],[u[0],r,u[1]],a))}function Hd(i,e,t,n){let r=e.length;if(r<2)return;let s=e[0].length,o=new W(n),a=e.map(h=>[0,1,2].map(f=>h.reduce((d,p)=>d+p[f],0)/s)),l=e.map((h,f)=>h.map((d,p)=>{let g=Eo(e[Math.min(r-1,f+1)][p],e[Math.max(0,f-1)][p]),m=Eo(h[(p+1)%s],h[(p+s-1)%s]),x=gb(pb(g,m));return mb(x,Eo(d,a[f]))<0?x.map(b=>-b):x})),c=(h,f)=>{let d=(f[0]*nl[0]+f[2]*nl[1]+1)/2;return ke(t,il(h[1])*(.8+.28*d)).lerp(o,Math.max(0,f[1])*.9)},u=(h,f,d,p,g,m,x)=>{mb(pb(Eo(f,h),Eo(d,h)),p)>=0?i.tri(h,f,d,g,m,x):i.tri(h,d,f,g,x,m)};for(let h=0;h+1c(M,g[S])),y=[0,1,2].map(M=>g.reduce((S,v)=>S+v[M],0));u(p[0],p[1],p[2],y,m,x,b),u(p[0],p[2],p[3],y,m,b,_)}for(let[h,f]of[[0,-1],[r-1,1]]){let d=e[h],p=Eo(e[h===0?1:r-2][0],d[0]),g=gb(p.map(x=>x*-f)),m=c(a[h],g);for(let x=0;x{let g=p/c*Math.PI*2;return{y:s+Math.cos(g)*o,across:r+Math.sin(g)*o}}),f=(d,p)=>{let{y:g,across:m}=h[p%c],[x,b]=e(d,m);return[x,g,b]};for(let d=0;dn:g=>Math.max(t+.002,n(g[0],g[1])),l=o.aoFrom??t,c=o.fold??Ye,u=g=>il(g-l),h=(o.holes??[]).map(g=>LE(g)>0?[...g].reverse():g),f=h.length?[...e,...h.flat()]:e,d=o.topFace!==!1,p=!d&&!o.bottom?[]:Vr(e,h);if(d){let g=new W(s);for(let[m,x,b]of p){let[_,y,M]=[f[m],f[x],f[b]];i.tri([_[0],a(_),_[1]],[M[0],a(M),M[1]],[y[0],a(y),y[1]],g,g,g,void 0,o.topFold??c)}}if(o.bottom){let g=ke(r,.55);for(let[m,x,b]of p){let[_,y,M]=[f[m],f[x],f[b]];i.tri([_[0],t,_[1]],[y[0],t,y[1]],[M[0],t,M[1]],g,g,g,void 0,c)}}for(let g of[e,...h])g.forEach((m,x)=>{let b=g[(x+1)%g.length];if(Math.hypot(b[0]-m[0],b[1]-m[1])<1e-6||o.skipSide?.(m,b))return;let _=Dd(b[0]-m[0],b[1]-m[1]),[y,M]=[a(m),a(b)],S=o.sideColor?o.sideColor(m,b):r,v=ke(S,u(t)*_),w=ke(S,u(y)*_),C=ke(S,u(M)*_);i.tri([m[0],t,m[1]],[m[0],y,m[1]],[b[0],M,b[1]],v,w,C,void 0,c),i.tri([m[0],t,m[1]],[b[0],M,b[1]],[b[0],t,b[1]],v,C,v,void 0,c)})}var vs=i=>{let e=Math.hypot(i[0],i[1])||1;return[i[0]/e,i[1]/e]};function Gr(i){return i.reduce((t,n,r)=>t+n[0]*i[(r+1)%i.length][1]-i[(r+1)%i.length][0]*n[1],0)>=0?i:[...i].reverse()}function xb(i,e){let t=[];return i.forEach((n,r)=>{let s=i[(r+1)%i.length],[o,a]=[e(n),e(s)];if(o>=0&&t.push(n),o>=0!=a>=0){let l=o/(o-a);t.push([n[0]+(s[0]-n[0])*l,n[1]+(s[1]-n[1])*l])}}),t}function Yd(i,e,t,n,r){let s=a=>(a[0]-e[0])*t[0]+(a[1]-e[1])*t[1],o=i;return Number.isFinite(n)&&(o=xb(o,a=>s(a)-n)),Number.isFinite(r)&&(o=xb(o,a=>r-s(a))),o}var bb=i=>Math.round(i*1e3),sl=i=>`${bb(i[0])},${bb(i[1])}`,Xd=(i,e)=>{let[t,n]=[sl(i),sl(e)];return t{let s=i[(r+1)%i.length],[o,a]=[s[0]-n[0],s[1]-n[1]],l=o*o+a*a;if(l<1e-8)return;let c=e.map(h=>({t:((h[0]-n[0])*o+(h[1]-n[1])*a)/l,off:Math.abs((h[0]-n[0])*a-(h[1]-n[1])*o)/Math.sqrt(l)})).filter(({t:h,off:f})=>h>1e-6&&h<1-1e-6&&f<1e-4).map(({t:h})=>h).sort((h,f)=>h-f),u=n;for(let h of c){let f=[n[0]+o*h,n[1]+a*h];sl(f)!==sl(u)&&t.push([u,f]),u=f}t.push([u,s])}),t}function qd(i,e){let t=i.map(l=>({wall:l,edges:FE(l.footprint,e)})),n=new Map;for(let{edges:l}of t)for(let[c,u]of l)n.set(Xd(c,u),(n.get(Xd(c,u))??0)+1);let r=[],s=new Map,o=(l,c,u)=>{let h=sl(l);s.has(h)||s.set(h,{p:l,wall:c,d:[]}),s.get(h).d.push(u)};for(let{wall:l,edges:c}of t)for(let[u,h]of c){let f=Math.hypot(h[0]-u[0],h[1]-u[1]);if(n.get(Xd(u,h))!==1||f<1e-4)continue;r.push({a:u,b:h,wall:l});let d=[(h[0]-u[0])/f,(h[1]-u[1])/f];o(u,l,d),o(h,l,d)}let a=[...s.values()].filter(({d:l})=>l.some(c=>l.some(u=>Math.abs(c[0]*u[1]-c[1]*u[0])>.05))).map(({p:l,wall:c})=>({p:l,wall:c}));return{edges:r,corners:a}}function Ro(i,e){if(e.length===0)return[[i.a,i.b]];let t=vs([i.wall.b[0]-i.wall.a[0],i.wall.b[1]-i.wall.a[1]]),n=vs([i.b[0]-i.a[0],i.b[1]-i.a[1]]);if(Math.abs(t[0]*n[0]+t[1]*n[1])<.99)return[[i.a,i.b]];let r=c=>(c[0]-i.wall.a[0])*t[0]+(c[1]-i.wall.a[1])*t[1],[s,o]=[r(i.a),r(i.b)],a=[[Math.min(s,o),Math.max(s,o)]];for(let c of e)a=a.flatMap(([u,h])=>{if(c.s1<=u||c.s0>=h)return[[u,h]];let f=[];return c.s0>u&&f.push([u,c.s0]),c.s1{let u=(c-s)/(o-s||1);return[i.a[0]+(i.b[0]-i.a[0])*u,i.a[1]+(i.b[1]-i.a[1])*u]};return a.filter(([c,u])=>u-c>1e-4).map(([c,u])=>s<=o?[l(c),l(u)]:[l(u),l(c)])}var yb=["body","wood","fabric","white","metal","dark"];var Ie={body:1516088,bodyTop:1911623,fabric:1713732,fabricTop:2241114,cushion:2373217,wood:1647420,woodTop:2108747,white:1911110,whiteTop:2504542,metal:2767456,dark:725279,glass:1849938,plant:1191982,plantTop:1721664,pot:1910336,accent:2854835},et=(i,e=i)=>({side:i,top:e}),q={body:et(Ie.body,Ie.bodyTop),fabric:et(Ie.fabric,Ie.fabricTop),cushion:et(Ie.cushion),cushionSoft:et(Ie.cushion,Ie.fabricTop),wood:et(Ie.wood,Ie.woodTop),white:et(Ie.white,Ie.whiteTop),worktop:et(Ie.whiteTop),metal:et(Ie.metal),dark:et(Ie.dark),darkBody:et(Ie.dark,Ie.body),glass:et(Ie.glass),accent:et(Ie.accent),pot:et(Ie.pot),plant:et(Ie.plant,Ie.plantTop),bedding:et(Ie.white,Ie.whiteTop),pillow:et(Ie.whiteTop)};var le=ke(5995775,.3),Ne=ke(5995775,.17),Ke=ke(3662079,.45);var $d={...Ie},_b=Object.fromEntries(Object.entries(q).map(([i,e])=>[i,{...e}])),vb="",NE=i=>typeof i=="string"&&/^#[0-9a-f]{6}$/i.test(i)?Number.parseInt(i.slice(1),16):null;function Mb(i){let e=Object.fromEntries(yb.map(s=>[s,NE(i?.[s])]).filter(([,s])=>s!==null)),t=JSON.stringify(e);if(t===vb)return!1;vb=t,Object.assign(Ie,$d);for(let[s,o]of Object.entries(_b))Object.assign(q[s],o);let n=s=>ke(s,1.25).getHex(),r=(s,o,a,l)=>{let c=e[s];if(c===void 0)return;for(let h of o)Ie[h]=c;for(let h of a)Ie[h]=n(c);let u=new Map([...o.map(h=>[$d[h],c]),...a.map(h=>[$d[h],n(c)])]);for(let h of l){let f=_b[h];q[h].side=u.get(f.side)??q[h].side,q[h].top=u.get(f.top)??q[h].top}};return r("body",["body"],["bodyTop"],["body","darkBody"]),r("wood",["wood"],["woodTop"],["wood"]),r("fabric",["fabric","cushion"],["fabricTop"],["fabric","cushion","cushionSoft"]),r("white",["white"],["whiteTop"],["white","worktop","bedding","pillow"]),r("metal",["metal"],[],["metal"]),r("dark",["dark"],[],["dark","darkBody"]),!0}function Sb(i){let e=i(0,0),t=i(1,0),n=i(0,1);return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])<0}function Ms(i,e){let t=(n,r,s)=>{if(n)for(let o=0;othis.plan(e+(o-e)*r-(a-t)*s,t+(o-e)*s+(a-t)*r))}seg(e,t,n,r,s,o,a=le){this.edge(this.plan(e,n),this.plan(r,o),t,s,a)}edge(e,t,n,r,s){this.lines.seg([e[0],n,e[1]],[t[0],r,t[1]],s,Ye)}block({x:[e,t],y:[n,r],z:[s,o]},a,l=null){if(t-e<1e-4||o-s<1e-4||r-n<1e-4)return;let c=[this.plan(e,s),this.plan(e,o),this.plan(t,o),this.plan(t,s)];Tt(this.buf,Gr(c),n,r,a.side,a.top,{aoFrom:0,bottom:n>.05}),l&&c.forEach((u,h)=>{this.edge(u,c[(h+1)%4],r,r,l),this.edge(u,u,n,r,l)})}prism(e,t,n,r,s=null){if(e.length<3||n-t<1e-4)return;let o=e.map(([a,l])=>this.plan(a,l));Tt(this.buf,Gr(o),t,n,r.side,r.top,{aoFrom:Math.min(0,t),bottom:!0}),s&&o.forEach((a,l)=>this.edge(a,o[(l+1)%o.length],n,n,s))}loft(e,t,n,r,s,o=null){if(r-n<1e-4)return;let a=u=>[this.plan(u[0],u[2]),this.plan(u[0],u[3]),this.plan(u[1],u[3]),this.plan(u[1],u[2])],l=a(e),c=a(t);if(l!==Gr(l)&&(l.reverse(),c.reverse()),Gd(this.buf,l,c,n,r,s.side,s.top),o)for(let u=0;u<4;u++)this.edge(c[u],c[(u+1)%4],r,r,o),this.edge(l[u],c[u],n,r,o)}sweep(e,t,n=16,r=2.6,s=null){if(e.length<2)return;let o=e.map(a=>{let[l,c]=[Math.max(.004,(a.y1-a.y0)/2),Math.max(.004,a.hw)],u=(a.y0+a.y1)/2;return Array.from({length:n},(h,f)=>{let d=f/n*Math.PI*2,[p,g]=[Math.cos(d),Math.sin(d)],[m,x]=this.plan(a.x+c*Math.sign(p)*Math.abs(p)**(2/r),a.z);return[m,u+l*Math.sign(g)*Math.abs(g)**(2/r),x]})});if(Hd(this.buf,o,t.side,t.top),s){let a=Math.round(n/4);for(let l=0;l+1.005&&this.block({x:[s,o],y:[a+h,l-h],z:[c,u]},f,r),this.loft([s,o,c,u],[s+h,o-h,c+h,u-h],l-h,l,t)}lyingCylinder(e,t,n,r,s,o,a,l,c=12,u=null){let h=Math.min(a,s-r)/2;if(h<1e-4||o<1e-4)return;let f=(r+s)/2,[d,p]=e==="x"?[t,n]:[n,t],g=(x,b)=>e==="x"?this.plan(x,b):this.plan(b,x),m=this.buf.p.length;if(Wd(this.buf,g,d-o/2,d+o/2,p,f,h,l.side,l.top,c),this.mirrored!==(e==="z")&&Ms(this.buf,m),!!u)for(let x of[d-o/2,d+o/2])for(let b=0;bthis.plan(e+Math.cos(h/a*Math.PI*2)*n,t+Math.sin(h/a*Math.PI*2)*n));Tt(this.buf,Gr(c),r,s,o.side,o.top,{aoFrom:0,bottom:r>.05}),l&&c.forEach((u,h)=>this.edge(u,c[(h+1)%a],s,s,l))}ring(e,t,n,r,s=20,o=le){for(let a=0;a[e(-t/2-p,-n/2-p),e(t/2+p,-n/2-p),e(t/2+p,n/2+p),e(-t/2-p,n/2+p)],[u,h]=[c(0),c(s)],f=p=>[p[0],l,p[1]],d=i.p.length;i.tri(f(u[0]),f(u[1]),f(u[2]),o),i.tri(f(u[0]),f(u[2]),f(u[3]),o);for(let p=0;p<4;p++){let g=(p+1)%4;i.tri(f(u[p]),f(h[p]),f(h[g]),o,a,a),i.tri(f(u[p]),f(h[g]),f(u[g]),o,a,o)}Sb(e)&&Ms(i,d)}function Kd(i,e){if(!i)return null;if(i.startsWith("#"))return Number.parseInt(i.slice(1),16);let t=Ie;return(e?t[`${i}Top`]:void 0)??t[i]??null}function Ss(i,e,t,n,r,s,o,a=null,l=null,c=null){let u=e.colors?.length?(e.colors.find(f=>f.id===l)??e.colors[0]).hex:null,h=ta(e,t,n,r);for(let f of c===null?h:G0(h,c)){if(c===null&&f.move||a&&!a(f))continue;let d=a?{...f,glow:!0,w:f.w+.006/t,d:f.d+.006/n,y:Math.max(0,f.y-.002/r),h:f.h+.004/r}:f,p=d.glow&&o!==null,g=!!(d.paint&&u),m=g?u:d.color,x=p?o:Kd(m,!1)??Ie.body,b=p?o:Kd(g?void 0:d.top,!1)??Kd(m,!0)??ke(x,1.25).getHex(),_=et(x,b),[y,M]=[s+d.y*r,s+Math.min(r,(d.y+d.h)*r)],S=d.edges==="glow"?Li:d.edges==="faint"?Ne:d.edges?le:null,v=d.rot?i.turned(d.x*t,d.z*n,d.rot):i,[w,C]=[d.x*t,d.z*n];if(d.shape==="cyl"&&(d.axis==="x"||d.axis==="z"))v.lyingCylinder(d.axis,w,C,y,M,d.axis==="x"?d.w*t:d.d*n,d.axis==="x"?d.d*n:d.w*t,_,14,S);else if(d.shape==="cyl")v.cylinder(w,C,Math.min(d.w*t,d.d*n)/2,y,M,_,14,S);else if(d.shape==="loft"){let[A,R,N,O]=[d.tx??d.x,d.tz??d.z,d.tw??d.w,d.td??d.d];v.loft([(d.x-d.w/2)*t,(d.x+d.w/2)*t,(d.z-d.d/2)*n,(d.z+d.d/2)*n],[(A-N/2)*t,(A+N/2)*t,(R-O/2)*n,(R+O/2)*n],y,M,_,S)}else if(d.shape==="sweep"){let A=(d.stations??[]).map(([R,N,O,P])=>({x:w,z:R*n,y0:s+N*r,y1:s+O*r,hw:P*t/2}));v.sweep(A,_,d.n??16,d.exp??2.6,S)}else v.block({x:[(d.x-d.w/2)*t,(d.x+d.w/2)*t],y:[y,M],z:[(d.z-d.d/2)*n,(d.z+d.d/2)*n]},_,S)}}function ws(i){let[e,t]=[Math.cos(i.rotation*mt),Math.sin(i.rotation*mt)],n=i.mirror?-1:1;return(r,s)=>[i.x+n*r*e-s*t,i.z+n*r*t+s*e]}var Zd=i=>[Math.max(.05,i.w),Math.max(.05,i.d),Math.max(.005,i.h)];function ol(i,e,t,n,r,s=o=>!!o.glow){Ss(new Fi(i,new Wt,ws(t)),e,...Zd(t),n,r,s)}function Jd(i,e,t,n,r){let s=i.p.length;Ss(new Fi(i,new Wt,ws(t)),e,...Zd(t),n,null,null,t.variant??null,r),t.mirror&&Ms(i,s)}function al(i,e,t,n,r){Ss(new Fi(i,new Wt,ws(t)),e,...Zd(t),n,r)}function Tb(i){let e=2166136261;for(let t=0;t(e=Math.imul(e^e>>>15,2246822507),e=Math.imul(e^e>>>13,3266489909),e^=e>>>16,(e>>>0)/4294967296)}var OE=(i,e,t)=>{let[n,r]=[t[0]-e[0],t[1]-e[1]],s=n*n+r*r||1e-9,o=Math.max(0,Math.min(1,((i[0]-e[0])*n+(i[1]-e[1])*r)/s));return Math.hypot(i[0]-e[0]-n*o,i[1]-e[1]-r*o)};function DE(i,e,t=.25){if(!Ge(e,i.points))return!1;let n=i.points;for(let r=0;rGe(e,r))}function UE(i,e,t){let n=i.obstacles.filter(s=>!Ge(e,s)),r=Math.max(1,Math.ceil(Math.hypot(t[0]-e[0],t[1]-e[1])/.1));for(let s=1;s<=r;s++){let o=[e[0]+(t[0]-e[0])*s/r,e[1]+(t[1]-e[1])*s/r];if(n.some(a=>Ge(o,a)))return!1}return!0}function BE(i,e,t){let n=i.points.map(c=>c[0]),r=i.points.map(c=>c[1]),[s,o,a,l]=[Math.min(...n),Math.max(...n),Math.min(...r),Math.max(...r)];for(let c=0;c<24;c++){let u=[s+(o-s)*t(),a+(l-a)*t()];if(Math.hypot(u[0]-e[0],u[1]-e[1])>.6&&DE(i,u)&&UE(i,e,u))return u}return null}function kE(i,e,t,n){if(!i.target){if(i.rest-=t,i.rest>0)return!1;if(i.target=BE(e,i.pos,n),!i.target)return i.rest=2,!1}let[r,s]=[i.target[0]-i.pos[0],i.target[1]-i.pos[1]],o=Math.hypot(r,s),l=Math.atan2(r,s)-i.heading;for(;l>Math.PI;)l-=2*Math.PI;for(;l<-Math.PI;)l+=2*Math.PI;i.heading+=Math.max(-4*t,Math.min(4*t,l));let c=e.speed*t*(Math.abs(l)>1.2?.3:1);return o<=c?(i.pos=[i.target[0],i.target[1]],i.target=null,i.rest=2+n()*6,!0):(i.pos=[i.pos[0]+r/o*c,i.pos[1]+s/o*c],!0)}function Ab(i,e,t,n){let r=Math.min(.2,Math.max(0,t));return i.target||(i.rest-=Math.max(0,t)-r),kE(i,e,r,n)}function Eb(){let e=navigator.deviceMemory??8,t=navigator.hardwareConcurrency||8;return e<=3||t<=4||/Silk|KF[A-Z]{2,4}\b/.test(navigator.userAgent)}var Du=class{times=[];settle=30;ratio;lastDown=-1/0;slowAtFloor=0;max;min;constructor(e,t=1){this.max=e,this.min=t,this.ratio=e}get pixelRatio(){return this.ratio}frame(e,t){if(this.settle>0)return this.settle--,null;if(e<=0||e>=100||(this.times.push(e),this.times.length<45))return null;let n=[...this.times].sort((s,o)=>s-o);this.times=[];let r=1e3/n[Math.floor(n.length/2)];return r<26&&this.ratio>this.min+1e-6?(this.ratio=Math.max(this.min,Math.round((this.ratio-.25)*100)/100),this.lastDown=t,this.settle=30,{ratio:this.ratio}):r<16&&this.ratio<=this.min+1e-6?++this.slowAtFloor>=2?{low:!0}:null:(this.slowAtFloor=0,r>55&&this.ratio3e4?(this.ratio=Math.min(this.max,Math.round((this.ratio+.25)*100)/100),this.settle=30,{ratio:this.ratio}):null)}};function Rb(i){let e=i.length/3,t=new Float32Array(e);for(let n=0;n0&&(t[n]=r)}return t}function Cb(i,e,t,n){for(let r=t.start*3;rMath.tan(Math.min(80,Math.max(0,i))*Uu);function Ts(i){return{x0:Math.min(i.x0,i.x1),x1:Math.max(i.x0,i.x1),z0:Math.min(i.z0,i.z1),z1:Math.max(i.z0,i.z1)}}function Pb(i){if(!i.rotation)return null;let e=i.rotation*Uu;return{cx:(i.x0+i.x1)/2,cz:(i.z0+i.z1)/2,c:Math.cos(e),sn:Math.sin(e)}}function Ib(i,e){let t=Pb(i);if(!t)return e;let[n,r]=[e[0]-t.cx,e[1]-t.cz];return[t.cx+n*t.c-r*t.sn,t.cz+n*t.sn+r*t.c]}function jd(i,e,t){let n=Pb(i);if(!n)return[e,t];let[r,s]=[e-n.cx,t-n.cz];return[n.cx+r*n.c+s*n.sn,n.cz-r*n.sn+s*n.c]}function Lb(i,e=0){let{x0:t,x1:n,z0:r,z1:s}=Ts(i);return[[t-e,r-e],[n+e,r-e],[n+e,s+e],[t-e,s+e]].map(o=>Ib(i,o))}function Dn(i){let{x0:e,x1:t,z0:n,z1:r}=Ts(i),s=o=>Ib(i,o);return i.axis==="x"?{u0:e,u1:t,w:r-n,at:(o,a)=>s([o,i.flip?r-a:n+a])}:{u0:n,u1:r,w:t-e,at:(o,a)=>s([i.flip?t-a:e+a,o])}}function Ni(i,e,t){let{x0:n,x1:r,z0:s,z1:o}=Ts(i),[a,l]=jd(i,e,t);return i.axis==="x"?[a,i.flip?o-l:l-s]:[l,i.flip?r-a:a-n]}var ll=Math.tan(30*Uu);function cl(i,e,t,n,r){let s=Math.min(i*.3,n>1e-6?2.4/n:i*.3),o=Math.min(i*.3,r>1e-6?2.4/r:i*.3),a=e+s*n,l=t+o*r,c=Math.min(i-o,Math.max(s,(l-a+ll*(i-o+s))/(2*ll))),u=a+(c-s)*ll;return{vla:s,vlb:o,yla:a,ylb:l,vr:c,rh:u,y:f=>f<=s?e+f*n:f<=c?a+(f-s)*ll:f<=i-o?l+(i-o-f)*ll:t+(i-f)*r}}function En(i){let e=Dn(i).w,[t,n]=[i.eave_a,i.eave_b],[r,s]=[hr(i.pitch_a),hr(i.pitch_b)];switch(i.shape){case"flat":case"parapet":return{vr:e/2,rh:t,y:()=>t};case"pent":return{vr:e,rh:t+e*r,y:o=>t+o*r};case"mansard":{let o=cl(e,t,n,r,s);return{vr:o.vr,rh:o.rh,y:o.y}}default:{let o=r+s>1e-6?Math.min(e,Math.max(0,(n-t+e*s)/(r+s))):e/2;return{vr:o,rh:t+o*r,y:a=>a<=o?t+a*r:n+(e-a)*s}}}}var Qd=i=>En(i).rh;var xt=(i,e)=>[i[0]-e[0],i[1]-e[1]],Oi=(i,e)=>[i[0]+e[0],i[1]+e[1]],ui=(i,e)=>[i[0]*e,i[1]*e],yn=(i,e)=>i[0]*e[0]+i[1]*e[1],Rn=(i,e)=>i[0]*e[1]-i[1]*e[0],Kn=i=>Math.hypot(i[0],i[1]),hi=i=>{let e=Kn(i)||1;return[i[0]/e,i[1]/e]},ep=i=>[-i[1],i[0]],tp=i=>[i[1],-i[0]];function Fb(i){let e=i.heightEnd!==void 0;return{...i,a:i.b,b:i.a,left:i.right,right:i.left,roomLeft:i.roomRight,roomRight:i.roomLeft,height:e?i.heightEnd:i.height,heightEnd:e?i.height:void 0}}function zE(i,e){let t=i.map(n=>({...n}));for(let n of e){let r=t.find(s=>s.room_id===n.room_id&&s.edge===n.edge&&(Math.abs(s.t1-n.t0)<1e-6||Math.abs(n.t1-s.t0)<1e-6));r?(r.t0=Math.min(r.t0,n.t0),r.t1=Math.max(r.t1,n.t1)):t.push({...n})}return t}function VE(i,e,t){if(i.a===e.b)return!1;let n=hi(xt(t[i.b],t[i.a])),r=hi(xt(t[e.b],t[e.a]));return Math.abs(Rn(n,r))>1e-6||yn(n,r)<=0||i.free||e.free||i.heightEnd!==void 0||e.heightEnd!==void 0?!1:i.height===e.height&&i.exterior===e.exterior&&i.roomLeft===e.roomLeft&&i.roomRight===e.roomRight&&Math.abs(i.left-e.left)<=1e-9&&Math.abs(i.right-e.right)<=1e-9}function Nb(i,e,t=new Set){let n=i.slice();for(;;){let r=new Map;n.forEach((o,a)=>{for(let l of[o.a,o.b])r.set(l,[...r.get(l)??[],a])});let s=null;for(let[o,a]of r){if(a.length!==2||t.has(o))continue;let l=n[a[0]].b===o?n[a[0]]:Fb(n[a[0]]),c=n[a[1]].a===o?n[a[1]]:Fb(n[a[1]]);if(!VE(l,c,e))continue;let u={...l,b:c.b,sources:zE(l.sources,c.sources)};s=[...n.filter((h,f)=>f!==a[0]&&f!==a[1]),u];break}if(!s)return n;n=s}}function Ob(i,e){let t=new Map;i.forEach((r,s)=>{let o=hi(xt(e[r.b],e[r.a])),a=[[r.a,{key:`${s}:a`,d:o,left:r.left,right:r.right,angle:Math.atan2(o[1],o[0])}],[r.b,{key:`${s}:b`,d:ui(o,-1),left:r.right,right:r.left,angle:Math.atan2(-o[1],-o[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[r,s]of t){let o=e[r];s.sort((l,c)=>l.angle-c.angle);for(let l of s)n.set(l.key,{left:Oi(o,ui(ep(l.d),l.left)),right:Oi(o,ui(tp(l.d),l.right))});if(s.length<2)continue;let a=4*Math.max(...s.map(l=>Math.max(l.left,l.right)))+1e-9;s.forEach((l,c)=>{let u=s[(c+1)%s.length],h=Oi(o,ui(ep(l.d),l.left)),f=Oi(o,ui(tp(u.d),u.right)),d=Rn(l.d,u.d);if(Math.abs(d)<1e-4)return;let p=Oi(h,ui(l.d,Rn(xt(f,h),u.d)/d));Kn(xt(p,o))>a||(n.get(l.key).left=p,n.get(u.key).right=p)})}return n}function Db(i,e){let t=i.filter((n,r)=>Kn(xt(n,i[(r+1)%i.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((r,s)=>{let o=t[(s+t.length-1)%t.length],a=t[(s+1)%t.length],[l,c]=[xt(r,o),xt(a,r)];return Math.abs(Rn(hi(l),hi(c)))<1e-7&&yn(l,c)>0});if(n===-1)return t;t=t.filter((r,s)=>s!==n)}}function GE(i){let e=[];return{points:e,idOf(t){let n=e.findIndex(r=>Math.abs(r[0]-t[0])<=i&&Math.abs(r[1]-t[1])<=i);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function HE(i,e){let t=[];for(let n of i){let r=n.points;if(r.length<3||Math.abs(es(r))<1e-6)continue;let s=es(r)>0,o=r.map(a=>e.idOf(a));o.forEach((a,l)=>{let c=o[(l+1)%o.length];a!==c&&t.push(s?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function WE(i,e,t){let n=[];for(let r of i){let[s,o]=[e[r.u],e[r.v]],a=xt(o,s),l=Kn(a),c=ui(a,1/l),u=e.map((f,d)=>({id:d,rel:xt(f,s)})).filter(({id:f,rel:d})=>f!==r.u&&f!==r.v&&yn(d,c)>t&&yn(d,c)({t:yn(d,c),id:f})).sort((f,d)=>f.t-d.t),h=[{t:0,id:r.u},...u,{t:l,id:r.v}];for(let f=0;f+1({room_id:i.room,edge:i.edge,t0:i.t0,t1:i.t1});function XE(i,e){let t=new Map(i.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let r=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},s=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[h,f]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(f[0]-h[0],f[1]-h[1])}},o=a=>{let l=s(a);if(!l||l.length<1e-9){let u=r(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let h of a){let[f,d]=o(h),[p,g]=h===a[0]?[f,d]:[d,f];p!==null&&(l=Math.min(l,p)),g!==null&&(c=Math.min(c,g))}let u=a.map(h=>t.get(h.room)?.ceiling);if(u.every(h=>typeof h=="number"&&h>0)){let h=Math.max(...u);l===1/0&&(l=h),c===1/0&&(c=h)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.some(l=>r(l)===0)}}function Bb(i){let e=t=>Math.round(t*1e6)/1e6;return i.a===void 0||i.b===void 0?i.a!==void 0?{height:e(i.a)}:i.b!==void 0?{height:e(i.b)}:{}:Math.abs(i.a-i.b)<1e-6?{height:e(i.a)}:{height:e(i.a),heightEnd:e(i.b)}}function YE(i,e,t,n){let r=XE(e,i),s=new Map;for(let l of i){let c=l.uf!==c&&f.u===c.v&&f.v===c.u&&f.room!==c.room);for(let f of l)f!==c&&f!==u&&f.room!==c.room&&n.push(`overlap:${c.room}:${f.room}`);let h=u?[c,u]:[c];if(r.hasNoWall(h)){u&&a.push([c.room,u.room]);continue}if(u){let f=r.thicknessOf(h)??t.interior;o.push({a:c.u,b:c.v,left:f/2,right:f/2,exterior:!1,roomLeft:c.room,roomRight:u.room,sources:h.map(Ub),...Bb(r.heightsOf(h))})}else o.push({a:c.u,b:c.v,left:0,right:r.thicknessOf(h)??t.exterior,exterior:!0,roomLeft:c.room,roomRight:null,sources:[Ub(c)],...Bb(r.heightsOf(h))})}return{drafts:o,open:a}}function qE(i,e){let t=s=>hi(xt(e[s.b],e[s.a])),n=i.filter(s=>!s.exterior&&!s.free),r=new Map;for(let s of n){if(r.has(s))continue;let o=[s];r.set(s,o);for(let a=0;a1e-6||l.add(yn(o,d)>0?"left":"right")}if(l.size!==1)continue;let c=[...l][0];for(let u of s){let h=u.left+u.right,f=yn(t(u),o)>0,d=c==="left"===f;[u.left,u.right]=d?[0,h]:[h,0]}}}var $E=(i,e)=>{let t=s=>Math.round(s*100),[n,r]=i[0]Math.hypot(x.b[0]-x.a[0],x.b[1]-x.a[1])>.05),l=a.map(x=>[s.idOf(x.a),s.idOf(x.b)]),c=new Set;for(let x of i){let b=x.points;b.length<3||(x.wall_splits??[]).forEach((_,y)=>{if(!_||y>=b.length)return;let M=b[y],S=xt(b[(y+1)%b.length],M),v=Kn(S);for(let w of _)w>n&&w{let[_,y]=l[b];if(_===y)return;let M=[(x.a[0]+x.b[0])/2,(x.a[1]+x.b[1])/2],S=i.find(w=>w.points.length>=3&&Ge(M,w.points))?.id??null,v=(x.thickness??e.interior)/2;d.push({free:x.id,a:_,b:y,left:v,right:v,exterior:!1,roomLeft:S,roomRight:S,sources:[],height:typeof x.height=="number"&&x.height>0?x.height:void 0,...typeof x.height=="number"&&x.height>0&&typeof x.height_end=="number"&&x.height_end>0&&Math.abs(x.height_end-x.height)>1e-6?{heightEnd:x.height_end}:{}})});let p=Nb(d,s.points,c),g=Ob(p,s.points);return{walls:p.map((x,b)=>{let[_,y]=[s.points[x.a],s.points[x.b]],[M,S]=[g.get(`${b}:a`),g.get(`${b}:b`)],v=Db([M.right,S.left,y,S.right,M.left,_],1e-6);return{id:$E(_,y),a:[_[0],_[1]],b:[y[0],y[1]],left:x.left,right:x.right,exterior:x.exterior,roomLeft:x.roomLeft,roomRight:x.roomRight,sources:x.sources,footprint:v,...x.free?{free:x.free}:{},...x.height!==void 0?{height:x.height}:{},...x.heightEnd!==void 0?{heightEnd:x.heightEnd}:{}}}),warnings:[...new Set(r)],open:f}}function kb(i,e,t){let n=i.points[e];return Oi(n,ui(hi(xt(i.points[(e+1)%i.points.length],n)),t))}function zb(i,e,t){if(i.wall){let r=t.find(a=>a.id===i.wall);if(!r||Math.hypot(r.b[0]-r.a[0],r.b[1]-r.a[1])<.05)return null;let s=hi(xt(r.b,r.a));return{room:{id:i.room_id,name:"",area_id:null,points:[r.a,r.b,Oi(r.a,[-s[1],s[0]])]},edge:0}}let n=e.find(r=>r.id===i.room_id);return n&&i.edgeyn(xt(e,i.a),hi(xt(i.b,i.a)));function Gb(i,e,t){if(!e.wall)return KE(i,t.room,t.edge,e.offset);let n=i.find(r=>r.free===e.wall);return n?{wall:n,s:Vb(n,kb(t.room,0,e.offset))}:null}function KE(i,e,t,n){for(let r of i)if(r.sources.some(o=>o.room_id===e.id&&o.edge===t&&n>=o.t0-1e-6&&n<=o.t1+1e-6))return{wall:r,s:Vb(r,kb(e,t,n))};return null}var Hb=([i,e])=>{let t=Math.hypot(i,e)||1;return[i/t,e/t]};function ZE(i){return i.reduce((e,t,n)=>e+(t[0]*i[(n+1)%i.length][1]-i[(n+1)%i.length][0]*t[1]),0)/2}function Bu(i,e){let t=i.length;if(t<3||Math.abs(e)<1e-9)return i.map(([r,s])=>[r,s]);let n=ZE(i)>=0?1:-1;return i.map((r,s)=>{let o=i[(s+t-1)%t],a=i[(s+1)%t],[l,c]=Hb([r[0]-o[0],r[1]-o[1]]),[u,h]=Hb([a[0]-r[0],a[1]-r[1]]),f=[c*n,-l*n],d=[h*n,-u*n],p=[f[0]+d[0],f[1]+d[1]],g=Math.hypot(p[0],p[1]);if(g<1e-6)return[r[0]+f[0]*e,r[1]+f[1]*e];let m=(p[0]*f[0]+p[1]*f[1])/g,x=Math.min(4,1/Math.max(.25,m));return[r[0]+p[0]/g*e*x,r[1]+p[1]/g*e*x]})}function np(i,e){if(i.points&&i.points.length>=3)return Bu(i.points,e);if(i.rotation)return Lb(i,e);let t=Math.min(i.x0,i.x1)-e,n=Math.max(i.x0,i.x1)+e,r=Math.min(i.z0,i.z1)-e,s=Math.max(i.z0,i.z1)+e;return[[t,r],[n,r],[n,s],[t,s]]}function Hr(i,e){let t=Dn(i),n=En(i),r=t.w,[s,o]=[Math.max(0,e.a),Math.max(0,e.b)],a=t.u0-Math.max(0,e.u0),l=t.u1+Math.max(0,e.u1),c=(x,b)=>[x,b,n.y(b)],u=c(a,-s),h=c(l,-s),f=c(l,r+o),d=c(a,r+o),[p,g]=[hr(i.pitch_a),hr(i.pitch_b)],m=x=>[x,n.vr,n.rh];if(i.ends&&(i.shape==="gable"||i.shape==="hip"||i.shape==="halfhip")){let x=(t.u1-t.u0)/2,b=Math.min(x,Math.min(n.vr,r-n.vr)||r/2),_=Math.min(n.y(0),n.y(r)),y=_+(n.rh-_)*Math.min(.9,Math.max(.2,i.halfhip??.55)),M=p>1e-6?Math.min(n.vr,(y-i.eave_a)/p):n.vr,S=g>1e-6?Math.max(n.vr,r-(y-i.eave_b)/g):n.vr,v=Math.min(x-.1,(n.rh-y)/Math.max(.2,p)),w=[[0,n.y(0)],[n.vr,n.rh],[r,n.y(r)]],C=[[0,n.y(0)],[M,y],[S,y],[r,n.y(r)]],A=(F,H,B)=>{if(F==="hip")return{upA:[],upB:[],ridge:m(H===a?t.u0+b*B:t.u1-b*B),profile:null};if(F==="halfhip"){let X=m(H===a?t.u0+v:t.u1-v);return{upA:[[H,M,y]],upB:[[H,S,y]],ridge:X,profile:C}}return{upA:[],upB:[],ridge:m(H),profile:w}},R=A(i.ends[0],a,1),N=A(i.ends[1],l,1),O=[[u,h,...N.upA,N.ridge,R.ridge,...[...R.upA].reverse()],[R.ridge,N.ridge,...[...N.upB].reverse(),f,d,...R.upB]],P=[[R.ridge,N.ridge]];for(let[F,H,B]of[[R,u,d],[N,h,f]])F.profile===null?(O.push(F===R?[d,u,F.ridge]:[h,f,F.ridge]),P.push([H,F.ridge],[B,F.ridge])):F.upA.length&&(O.push(F===R?[F.upB[0],F.upA[0],F.ridge]:[F.upA[0],F.upB[0],F.ridge]),P.push([F.upA[0],F.ridge],[F.upB[0],F.ridge]));let I=F=>F.profile===null?[]:F.upA.length?[F.upA[0],F.upB[0]]:[F.ridge],D=[u,h,...I(N),f,d,...[...I(R)].reverse()];return{faces:O,rim:D,ridges:P,gable:w,endProfiles:[R.profile,N.profile]}}switch(i.shape){case"pent":return{faces:[[u,h,f,d]],rim:[u,h,f,d],ridges:[[f,d]],gable:[[0,n.y(0)],[r,n.y(r)]]};case"hip":case"pyramid":{let x=(t.u1-t.u0)/2,b=i.shape==="pyramid"?x:Math.min(x,Math.min(n.vr,r-n.vr)||r/2),_=m(t.u0+b),y=m(t.u1-b);return i.shape==="pyramid"?{faces:[[u,h,_],[h,f,_],[f,d,_],[d,u,_]],rim:[u,h,f,d],ridges:[[u,_],[d,_],[h,_],[f,_]],gable:null}:{faces:[[u,h,y,_],[_,y,f,d],[d,u,_],[h,f,y]],rim:[u,h,f,d],ridges:[[_,y],[u,_],[d,_],[h,y],[f,y]],gable:null}}case"halfhip":{let x=Math.min(n.y(0),n.y(r)),b=x+(n.rh-x)*Math.min(.9,Math.max(.2,i.halfhip??.55)),_=p>1e-6?Math.min(n.vr,(b-i.eave_a)/p):n.vr,y=g>1e-6?Math.max(n.vr,r-(b-i.eave_b)/g):n.vr,M=Math.min((t.u1-t.u0)/2-.1,(n.rh-b)/Math.max(.2,p)),S=m(t.u0+M),v=m(t.u1-M),w=[a,_,b],C=[a,y,b],A=[l,_,b],R=[l,y,b];return{faces:[[u,h,A,v,S,w],[S,v,R,f,d,C],[C,w,S],[A,R,v]],rim:[u,h,A,R,f,d,C,w],ridges:[[S,v],[w,S],[C,S],[A,v],[R,v]],gable:[[0,n.y(0)],[_,b],[y,b],[r,n.y(r)]]}}case"mansard":{let x=cl(r,i.eave_a,i.eave_b,p,g),b=[a,x.vla,x.yla],_=[l,x.vla,x.yla],y=[a,r-x.vlb,x.ylb],M=[l,r-x.vlb,x.ylb],S=[a,x.vr,x.rh],v=[l,x.vr,x.rh];return{faces:[[u,h,_,b],[b,_,v,S],[S,v,M,y],[y,M,f,d]],rim:[u,h,_,v,M,f,d,y,S,b],ridges:[[S,v],[b,_],[y,M]],gable:[[0,n.y(0)],[x.vla,x.yla],[x.vr,x.rh],[r-x.vlb,x.ylb],[r,n.y(r)]]}}default:{let x=m(a),b=m(l);return{faces:[[u,h,b,x],[x,b,f,d]],rim:[u,h,b,f,d,x],ridges:[[x,b]],gable:[[0,n.y(0)],[n.vr,n.rh],[r,n.y(r)]]}}}}function As(i,e,t){let n=null;for(let r of i.faces){if(!Ge([e,t],r.map(([f,d])=>[f,d])))continue;let[s,o]=r,a=r.slice(2).find(f=>Math.abs((o[0]-s[0])*(f[1]-s[1])-(o[1]-s[1])*(f[0]-s[0]))>1e-9);if(!a)continue;let l=[o[0]-s[0],o[2]-s[2],o[1]-s[1]],c=[a[0]-s[0],a[2]-s[2],a[1]-s[1]],u=[l[1]*c[2]-l[2]*c[1],l[2]*c[0]-l[0]*c[2],l[0]*c[1]-l[1]*c[0]];if(Math.abs(u[1])<1e-9)continue;let h=s[2]-(u[0]*(e-s[0])+u[2]*(t-s[1]))/u[1];n=n===null?h:Math.min(n,h)}return n}function Co(i,e,t,n){let r=o=>n?o[e]<=t+1e-9:o[e]>=t-1e-9,s=[];return i.forEach((o,a)=>{let l=i[(a+1)%i.length];if(r(o)&&s.push(o),r(o)!==r(l)){let c=(t-o[e])/(l[e]-o[e]);s.push([o[0]+(l[0]-o[0])*c,o[1]+(l[1]-o[1])*c,o[2]+(l[2]-o[2])*c])}}),s}function ku(i,e){let t=Co(Co(i,0,e.u0,!1),0,e.u1,!0);return[Co(i,0,e.u0,!0),Co(i,0,e.u1,!1),Co(t,1,e.v0,!0),Co(t,1,e.v1,!1)].filter(r=>r.length>=3&&Math.abs(Mr(r.map(([s,o])=>[s,o])))>1e-6)}function hl(i,e,t){let n=Dn(e),r=i.floors.flatMap(h=>h.rooms.filter(f=>f.points.length>=3&&h.elevation+h.height>e.base+.05)),s=h=>h.some(f=>r.some(d=>Ge(f,d.points))),o=.35,a=[.15,.5,.85].map(h=>n.u0+(n.u1-n.u0)*h),l=[.15,.5,.85].map(h=>n.w*h),c=h=>h?0:t,u=(h,f)=>{let d=e.overhang_sides?.[h];return typeof d=="number"&&Number.isFinite(d)?Math.min(2,Math.max(0,d)):f};return{a:u("a",c(s(a.map(h=>n.at(h,-o))))),b:u("b",c(s(a.map(h=>n.at(h,n.w+o))))),u0:u("u0",c(s(l.map(h=>n.at(n.u0-o,h))))),u1:u("u1",c(s(l.map(h=>n.at(n.u1+o,h)))))}}var Po=i=>Math.abs((i.x1-i.x0)*(i.z1-i.z0)),zu=i=>i.shape==="flat"||i.shape==="parapet";function Es(i,e){let[t,n]=[(e.x0+e.x1)/2,(e.z0+e.z1)/2];return i.filter(s=>{if(s===e||s.dormer||s.open||zu(s)||Po(s)=o.x0&&t<=o.x1&&n>=o.z0&&n<=o.z1}).reduce((s,o)=>s===null||Po(o){let[s,o]=e.at(r,e.w/2),[a,l]=Ni(i,s,o);return As(t,a,l)??n.y(l)}}function fl(i,e){if(zu(e))return e;let t=Dn(e),n=En(e).rh,r=Wb(i,t),s=r(t.u0)<=r(t.u1),[o,a]=s?[t.u0,t.u1]:[t.u1,t.u0],l=s?1:-1,c=a;for(let f=.5;f=n-.02){c=o+l*f;break}if(Math.abs(c-a)<.05)return e;let u={...e},h=a===t.u1;return e.axis==="x"?u[h?"x1":"x0"]=c:u[h?"z1":"z0"]=c,u}function Vu(i,e){let t=fl(i,e),n=Dn(t),r=En(t),s=Wb(i,n),o=s(n.u0)<=s(n.u1),a=n.u1-n.u0,l=Math.max(1,Math.ceil(a/.15)),c=[];for(let u=0;ug+.02&&(m=Math.min(m,M),x=Math.max(x,M))}if(!(x-m>.05))continue;let b=Ni(i,...n.at(d,m)),_=Ni(i,...n.at(p,x));c.push({u0:Math.min(b[0],_[0]),u1:Math.max(b[0],_[0]),v0:Math.min(b[1],_[1]),v1:Math.max(b[1],_[1])})}return c}function dl(i,e){if(e.dormer||e.open||zu(e)||Es(i,e))return null;let t=Ts(e),n=.35;for(let r of i){if(r===e||r.dormer||r.open||zu(r)||r.axis===e.axis||Po(r)a[3]+.05)continue;let l=(o[2]+o[3])/2,[c,u]=e.axis==="z"?["z0","z1"]:["x0","x1"],h;if(Math.abs(o[0]-o[3])<=n)h=[l,o[1]];else if(Math.abs(o[1]-o[2])<=n)h=[o[0],l];else continue;let f={...e,[c]:h[0],[u]:h[1]};return{parent:r,extended:fl(r,f)}}return null}var Xb=.14,JE=i=>i.shape==="flat"||i.shape==="parapet";function ip(i,e){return!i.open&&Math.min(i.base,i.eave_a,i.eave_b)l+r||fu+r||o.points&&o.points.length>=3&&!Ge([e,t],o.points))continue;let[d,p]=Ni(o,e,t),g=Math.max(0,o.overhang??n),m=JE(o)?null:As(Hr(o,{u0:g,u1:g,a:g,b:g}),d,p);s.push((m??En(o).y(p))-Xb)}return s.length?Math.max(...s):null}function sp(i,e){let t=i.floors.filter(l=>l.rooms.length>0).sort((l,c)=>l.elevation-c.elevation),n=t.filter(l=>l.elevationu.rooms.some(h=>h.points.length>=3&&l.some(f=>Ge(f,h.points))));if(c)return c}return n.at(-1)??t[0]}function op(i,e,t){let n=i.settings.roof.sections??[],r=n.filter(l=>t.includes(l.id)).map(l=>Es(n,l)??l);if(r.length===0)return e.id;let s=Math.max(...r.map(Qd)),o=l=>l.rooms.some(c=>{if(c.points.length<3)return!1;let u=c.points.reduce((f,d)=>f+d[0],0)/c.points.length,h=c.points.reduce((f,d)=>f+d[1],0)/c.points.length;return r.some(f=>u>=Math.min(f.x0,f.x1)&&u<=Math.max(f.x0,f.x1)&&h>=Math.min(f.z0,f.z1)&&h<=Math.max(f.z0,f.z1))});return i.floors.filter(l=>l.elevation>=e.elevation&&l.elevationc.elevation-l.elevation)[0]?.id??e.id}var Io=new U;function Yb(i,e,t,n=1.05){return Io.set(e[0],e[1],e[2]).project(i),{x:(Io.x+1)/2*t.w,y:(1-Io.y)/2*t.h,off:Io.z>1||Math.abs(Io.x)>n||Math.abs(Io.y)>n}}var pl=i=>`translate(${i.x}px, ${i.y}px) translate(-50%, -50%)`,qb=(i,e)=>`translate(${i}px, ${e}px) translate(0, -50%)`,Gu=class{placed=new WeakMap;place(e,t){let n=t===null;e.hidden!==n&&(e.hidden=n),!(t===null||this.placed.get(e)===t)&&(this.placed.set(e,t),e.style.transform=t)}},jE=8;function $b(i){let e=[...i].sort((t,n)=>n.rank-t.rank).map(t=>({...t}));for(let t=1;tc.xc.x>l.x?c:l),s=8+t.inset,[o,a]=[n.x-e-14,n.y];return o=.99&&i.o>=.9&&!e}function Zb(i){return i.to>0&&Math.abs(i.o-i.to)<.05}function Jb(i,e,t,n){return e===void 0?{y:t?i*2.4:0,opacity:1}:i>e?{y:5+i,opacity:0}:i===e?{y:0,opacity:1}:n==="stacked"?{y:0,opacity:1}:{y:-.4,opacity:n==="single"?0:.22}}function jb(i,e){let[t,n]=[i.ty-i.y,i.to-i.o];if(Math.abs(t)<.004&&Math.abs(n)<.004){let r=t!==0||n!==0;return r&&([i.y,i.o]=[i.ty,i.to]),{moving:!1,settled:r}}return i.y+=t*e,i.o+=n*e,{moving:!0,settled:!1}}function Qb(i,e){let t=e>.999;for(let n of[i.floor,i.wall,i.frames,i.blinds,i.lamps])n.transparent===t&&(n.transparent=!t,n.depthWrite=t,n.needsUpdate=!0),n.opacity=e;for(let n of i.ghosts)n.material.opacity=n.base*e;for(let n of[i.pattern,i.glow,i.lines,i.glass,i.glassWall,i.halos,i.cones,i.screens])n.opacity=e}var lp=i=>1-Math.exp(-i/140);var ty=["open","open2","tilt","tilt2"],cp=i=>1-Math.exp(-i/160),ey=(i,e)=>(i??null)===(e??null)||typeof i=="number"&&typeof e=="number"&&Math.abs(i-e)<.003;function up(i,e){return ty.every(t=>ey(e[t]??0,i[t]??0))&&ey(e.cover,i.cover)&&!!e.sensed==!!i.sensed&&!!e.unlocked==!!i.unlocked&&!!e.assumed==!!i.assumed}function ny(i,e,t){let n={...i,open2:i.open2??0,tilt2:i.tilt2??0,sensed:e.sensed,unlocked:e.unlocked,assumed:e.assumed},r=!1,s=(o,a)=>Math.abs(a-o)<.003?a:(r=!0,o+(a-o)*t);for(let o of ty)n[o]=s(i[o]??0,e[o]??0);return n.cover=e.cover===null||i.cover===null?e.cover:s(i.cover,e.cover),{state:n,moving:r}}var Rs={ceiling:[.4,.4,.08],downlight:[.1,.1,.02],spot:[.1,.1,.14],panel:[.6,.6,.03],uplight:[.35,.35,1.8],bollard:[.16,.16,.8],garden:[.12,.12,.3],pendant:[.4,.4,.8],fan:[1.32,1.32,.32],floor:[.42,.42,1.7],table:[.26,.26,.45],wall:[.22,.12,.2],strip:[2,.04,.03]},Hu=new Set(["ceiling","downlight","spot","panel","pendant","fan","strip"]),QE=1;function iy(i,e,t,n){switch(i){case"ceiling":return[e-.12,"ceiling"];case"downlight":return[e-.03,"spot"];case"spot":return[e-n,"spot"];case"panel":return[e-.05,"ceiling"];case"pendant":return[Math.max(.5,e-n),"pendant"];case"fan":return[Math.max(.5,e-n+.02),"ceiling"];case"floor":return[t+n-.15,"omni"];case"uplight":return[t+n,"up"];case"table":return[t+n-.1,"omni"];case"wall":return[t+.1,"wall"];case"strip":return[t+Math.max(.02,n)-.01,teR&&d=0&&p<=1&&(l=d)}return l}function ay(i,e,t){let n=i.count,r=e.wedge;if(!r)return{start:n,end:n};let s=(e.rotation??0)*mt,o=[-Math.sin(s),Math.cos(s)],a=r.angle*mt/2,l=new W(...r.color.map(d=>d*r.opacity)),c=new W(0,0,0),u=Math.max(4,Math.round(a/.15)),h=[e.x,e.z],f=(d,p)=>[e.x+(o[0]*Math.cos(d)-o[1]*Math.sin(d))*p,sy,e.z+(o[1]*Math.cos(d)+o[0]*Math.sin(d))*p];for(let d=0;d{i.positions.push(h,f,d);for(let g of t.color)i.colours.push(g*t.level*tR*p)};if(e.lamp==="strip")for(let h of[-.4,-.13,.13,.4])e.upright?u(e.x,a+r*(.5+h),e.z,.6):u(...Wu(e.x,c+Lo(e.base,r,e.rise),e.z,l,r,e.rise,h),.6);else e.lamp==="wall"?u(e.x-Math.sin(l)*(s/2+.05),c,e.z+Math.cos(l)*(s/2+.05),1):u(e.x,c,e.z,1)}function uy(i,e,t,n){let[r,,s]=e.size??Rs[e.lamp],o=ly(e.lamp,n,e.base??0,s),a=new W(...t.color.map(d=>d*.09*t.level)),l=new W(0,0,0),[c,u]=[Math.max(.03,r/2),.45+.35*t.level],h=16,f=(d,p,g)=>[e.x+Math.cos(d)*p,g,e.z+Math.sin(d)*p];for(let d=0;dHu.has(i);var fy=7,nR=.25,iR=.3,rR=2,hp=[1,.82,.55],sR=.45;function dy(i,e,t,n){return i?`${i.elevation.toFixed(1)},${i.azimuth.toFixed(1)},${e*mt},${t.toFixed(2)},${[...n].map(r=>(r.cover??0).toFixed(2)).join(",")}`:""}var Fo=(i,e)=>[Math.sin((e+i)*mt),-Math.cos((e+i)*mt)],fp=(i,e)=>Math.min(1,i/12)*(1-.8*e),oR=(i,e)=>-i.toRoom[0]*e[0]+-i.toRoom[1]*e[1];function py({floor:i,openings:e,states:t,sun:n,northDegrees:r,cloud:s}){let o=new ut;if(!n||n.elevation<=rR||s>=.97)return o;let a=fp(n.elevation,s),l=Fo(n.azimuth,r),c=1/Math.tan(n.elevation*mt);for(let u of e){if(u.opening.type!=="window"||!u.exterior)continue;let h=oR(u,l);if(h<.05)continue;let f=u.top-(t.get(u.opening.id)?.cover??0)*(u.top-u.sill);if(f-u.sill<.05)continue;let d=i.rooms.find(M=>M.id===u.opening.room_id);if(!d||d.points.length<3)continue;let p=(M,S)=>{let v=Math.min(fy,S*c);return[u.start[0]+u.axis[0]*M+u.toRoom[0]*u.faceRoom-l[0]*v,.02,u.start[1]+u.axis[1]*M+u.toRoom[1]*u.faceRoom-l[1]*v]},g=.14*a*Math.min(1,h*1.5),m=new W(hp[0]*g,hp[1]*g,hp[2]*g),x=m.clone().multiplyScalar(sR),b=Math.max(1,Math.ceil(Math.min(fy,f*c)/nR)),_=Math.max(1,Math.ceil(u.width/iR)),y=f-u.sill;for(let M=0;Me+Rn(t,i[(n+1)%i.length]),0)/2}var gy=i=>my(i)>=0?[...i]:[...i].reverse();function xy(i,e,t,n){let r=xt(e,i),s=xt(n,t),o=Rn(r,s);if(Math.abs(o)<1e-12)return null;let a=Rn(xt(t,i),s)/o,l=Rn(xt(t,i),r)/o;return a>fr&&a<1-fr&&l>-fr&&l<1+fr?a:null}function dp(i,e,t){let n=xt(t,e),r=yn(n,n);if(r<1e-12)return null;let s=yn(xt(i,e),n)/r;return s<=fr||s>=1-fr?null:Math.abs(Rn(xt(i,e),n))/Math.sqrt(r)Kn(xt(i,e))i.map((e,t)=>[e,i[(t+1)%i.length]]);function aR(i,e){for(let[t,n]of gl(i))for(let[r,s]of gl(e))if(xy(t,n,r,s)!==null||dp(r,t,n)!==null||dp(t,r,s)!==null||ml(t,r))return!0;return Ge(i[0],e)||Ge(e[0],i)}function lR(i){let e=i.map(gy),t=[];e.forEach((s,o)=>{for(let[a,l]of gl(s)){let c=[0,1];e.forEach((u,h)=>{if(h!==o)for(let[f,d]of gl(u)){let p=xy(a,l,f,d)??dp(f,a,l);p!==null&&c.push(p)}}),c.sort((u,h)=>u-h);for(let u=1;um!==o&&Ge(p,g))||t.some(([g,m])=>ml(g,h)&&ml(m,f))||t.push([h,f])}}});let n=[],r=new Set;return t.forEach(([s,o],a)=>{if(r.has(a))return;r.add(a);let l=[s],c=o;for(let u=0;u!r.has(d)&&ml(f,c,.001));if(h<0)break;r.add(h),l.push(t[h][0]),c=t[h][1]}l.length>=3&&my(l)>1e-6&&n.push(l)}),n}function dr(i){let e=i.filter(s=>s.length>=3),t=e.map((s,o)=>o),n=s=>t[s]===s?s:t[s]=n(t[s]);e.forEach((s,o)=>{for(let a=o+1;ar.set(n(o),[...r.get(n(o))??[],s])),[...r.values()].flatMap(s=>s.length===1?s:lR(s))}function cR(i,e,t){let n=xt(t,e),r=yn(n,n),s=r?Math.max(0,Math.min(1,yn(xt(i,e),n)/r)):0;return Kn(xt(i,[e[0]+n[0]*s,e[1]+n[1]*s]))}function by(i,e,t=.03){return i.every(n=>Ge(n,e)||gl(e).some(([r,s])=>cR(n,r,s)<=t))}function yy(i,e){let t=gy(i),n=(r,s)=>{let o=xt(s,r),a=Kn(o)||1;return[-o[1]/a,o[0]/a]};return t.map((r,s)=>{let o=n(t[(s-1+t.length)%t.length],r),a=n(r,t[(s+1)%t.length]),l=1+yn(o,a);return l<.1?r:[r[0]+(o[0]+a[0])/l*e,r[1]+(o[1]+a[1])/l*e]})}var uR=30,_y=i=>i.reduce((e,t,n)=>e+t[0]*i[(n+1)%i.length][1]-i[(n+1)%i.length][0]*t[1],0)/2;function hR(i,e,t,n){if(!t||t.elevation<=2||e<=0||!i.length)return[];let r=Math.min(uR,e/Math.tan(t.elevation*Math.PI/180)),[s,o]=Fo(t.azimuth,n),a=c=>[c[0]-s*r,c[1]-o*r],l=[];for(let c of i){l.push([...c],c.map(a));let u=Math.sign(_y(c))||1;c.forEach((h,f)=>{let d=c[(f+1)%c.length];if(u*((d[1]-h[1])*-s-(d[0]-h[0])*-o)<=1e-9)return;let g=[h,d,a(d),a(h)];Math.abs(_y(g))>.001&&l.push(g)})}return dr(l)}var Xu=class{mesh;material=new $e({color:0,side:ht,transparent:!0,opacity:0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});constructor(){this.mesh=new we(new Ce,this.material),this.mesh.renderOrder=1,this.mesh.visible=!1}update(e,t,n,r,s,o,a){let l=a?[]:hR(e,t,r,s),c=[];for(let h of l){let f=e.filter(p=>Ge([p.reduce((g,m)=>g+m[0],0)/p.length,p.reduce((g,m)=>g+m[1],0)/p.length],h)),d=[...h,...f.flat()];for(let[p,g,m]of Vr(h,f.map(x=>[...x])))for(let x of[d[p],d[g],d[m]])c.push(x[0],n,x[1])}this.mesh.geometry.dispose();let u=new Ce;u.setAttribute("position",new De(c,3)),this.mesh.geometry=u,this.material.opacity=r?.32*fp(r.elevation,o):0,this.mesh.visible=c.length>0&&this.material.opacity>.02}dispose(){this.mesh.geometry.dispose(),this.material.dispose()}};var xl=i=>es(i)>=0?i:[...i].reverse();function bl(i,[e,t],n,r,s,o,a){Tt(i,xl([[e-n,t-n],[e+n,t-n],[e+n,t+n],[e-n,t+n]]),r,s,o,a)}function Yu(i,e,t,n,r,s,o,a,l=0){let[c,u]=[t[0]-e[0],t[1]-e[1]],h=Math.hypot(c,u);if(h<1e-6)return;let[f,d]=[-u/h*n*.5,c/h*n*.5];if(Math.abs(l)<1e-4){Tt(i,xl([[e[0]+f,e[1]+d],[t[0]+f,t[1]+d],[t[0]-f,t[1]-d],[e[0]-f,e[1]-d]]),r,s,o,a,{aoFrom:r-1});return}let p=(y,M)=>[e[0]+f*M,y,e[1]+d*M],g=(y,M)=>[t[0]+f*M,y+l,t[1]+d*M],m=(y,M)=>{for(let[S,v,w]of[[0,1,2],[0,2,3],[0,2,1],[0,3,2]])i.tri(y[S],y[v],y[w],M,M,M,void 0,Ye)},x=new W(a),b=ke(o,.9),_=ke(o,.6);m([p(s,1),g(s,1),g(s,-1),p(s,-1)],x),m([p(r,1),g(r,1),g(r,-1),p(r,-1)],_),m([p(r,1),g(r,1),g(s,1),p(s,1)],b),m([p(r,-1),g(r,-1),g(s,-1),p(s,-1)],b),m([p(r,1),p(r,-1),p(s,-1),p(s,1)],b),m([g(r,1),g(r,-1),g(s,-1),g(s,1)],b)}function vy(i,e,t){let n=(o,a)=>Math.abs(o[0]-a[0])<1e-6&&Math.abs(o[1]-a[1])<1e-6,r=Math.hypot(t[0]-e[0],t[1]-e[1]),s=[];for(let o of i.gates??[]){let a=i.points[o.edge],l=i.points[(o.edge+1)%i.points.length];!a||!l||(n(a,e)&&n(l,t)?s.push({gate:o,offset:o.offset}):n(a,t)&&n(l,e)&&s.push({gate:o,offset:r-o.offset}))}return s.sort((o,a)=>o.offset-a.offset)}function My(i,e,t,n,r){let s=Math.hypot(e[0]-i[0],e[1]-i[1]);if(s<.3)return null;let o=Math.min(t.width,s-.1);if(o<.3)return null;let a=Math.max(.05,Math.min(s-o-.05,n-o/2)),l=a+o,[c,u]=[(e[0]-i[0])/s,(e[1]-i[1])/s],[h,f]=[-u,c],d=(x,b=0)=>[i[0]+c*x+h*b,i[1]+u*x+f*b],[p,g]=[d(a),d(l)],m=[];if(t.kind==="double"){let x=(a+l)/2;m.push(r?{a:p,b:d(a,o/2)}:{a:p,b:d(x)}),m.push(r?{a:g,b:d(l,o/2)}:{a:g,b:d(x)})}else t.kind==="sliding"?m.push(r?{a:d(l,-.12),b:d(l+o,-.12)}:{a:p,b:g}):m.push(r?{a:p,b:d(a,o)}:{a:p,b:g});return{from:a,to:l,posts:[p,g],leaves:m}}var Sy={lawn:{color:927778,side:729115,edge:4121250,edgeAlpha:.16},terrace:{color:1841968,side:1447464,edge:5995775,edgeAlpha:.32},path:{color:1778228,side:1383209,edge:5995775,edgeAlpha:.22},driveway:{color:1514796,side:1185573,edge:5995775,edgeAlpha:.18},pool:{color:736091,side:861497,edge:3662079,edgeAlpha:.6},bed:{color:1775123,side:1380623,edge:4121250,edgeAlpha:.2},wild:{color:1384987,side:1055509,edge:10146383,edgeAlpha:.14},hedge:{color:1524016,side:1126693,edge:4121250,edgeAlpha:.35},fence:{color:1976903,side:1976903,edge:5995775,edgeAlpha:.45},pergola:{color:2827065,side:2104109,edge:5995775,edgeAlpha:.5}};function pp(i,e){return jo(i)+(e.offset??0)+(Jr(e.type)?.01:Dl[e.type])}function qu(i,e){let t=i[e];return Jr(t.type)||t.type==="pool"?[]:i.filter((n,r)=>r!==e&&T0(n)&&n.points.length>=3&&n.points.every(s=>Ge(s,t.points))).map(n=>xl(n.points))}var $u=(i,e)=>i.map((t,n)=>[n,t,i[(n+1)%i.length]]).filter(([t])=>t!==e);function yl(i,e){if(i.area.outline!==!1)for(let[,t,n]of $u(i.poly,i.openEdge))i.lines.seg([t[0],e(t[0],t[1]),t[1]],[n[0],e(n[0],n[1]),n[1]],i.edge,Ye)}function fR(i){let{buf:e,poly:t,base:n,top:r,look:s}=i,o=new W(s.color);for(let[l,c,u]of Vr(t)){let[h,f,d]=[t[l],t[c],t[u]];e.tri([h[0],n+r,h[1]],[d[0],n+r,d[1]],[f[0],n+r,f[1]],o,o,o,void 0,Ye)}let a=new W(s.side);for(let[,l,c]of $u(t,-1))e.tri([c[0],n+r,c[1]],[c[0],n+.06,c[1]],[l[0],n+.06,l[1]],a,a,a,void 0,Ye),e.tri([c[0],n+r,c[1]],[l[0],n+.06,l[1]],[l[0],n+r,l[1]],a,a,a,void 0,Ye);yl(i,()=>n+.06),yl(i,()=>n+r+.005)}function dR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let[u,h,f]of $u(n,c)){let d=Math.hypot(f[0]-h[0],f[1]-h[1]),p=Math.max(1,Math.round(d/2)),g=vy(r,h,f).map(({gate:M,offset:S})=>({gate:M,layout:My(h,f,M,S,!!M.open)})).filter(M=>!!M.layout),m=M=>g.some(S=>M>S.layout.from-.15&&M=0&&u===c-1?p:p-1;for(let M=0;M<=x;M++){if(m(d*M/p))continue;let S=h[0]+(f[0]-h[0])*M/p,v=h[1]+(f[1]-h[1])*M/p,w=a(S,v);bl(e,[S,v],.04,w,w+s,o.side,o.color)}let b=[],_=0;for(let M of g)b.push([_,M.layout.from]),_=M.layout.to;b.push([_,d]);let y=M=>[h[0]+(f[0]-h[0])*M/d,h[1]+(f[1]-h[1])*M/d];for(let[M,S]of b){if(S-M<.02)continue;let[v,w]=[y(M),y(S)];for(let C of[.35,.85])t.seg([v[0],a(v[0],v[1])+C*s,v[1]],[w[0],a(w[0],w[1])+C*s,w[1]],l,Ye)}for(let{layout:M}of g){for(let S of M.posts){let v=a(S[0],S[1]);bl(e,S,.07,v,v+s*1.05,o.side,o.color)}for(let S of M.leaves)pR(i,S.a,S.b)}}}function pR(i,e,t){let{buf:n,lines:r,top:s,look:o,groundAt:a,edge:l}=i,c=Math.hypot(t[0]-e[0],t[1]-e[1]);if(c<.05)return;let[u,h]=[a(e[0],e[1]),a(t[0],t[1])],f=h-u;for(let[p,g]of[[.12,.2],[.78,.86]])Yu(n,e,t,.05,u+p*s,u+g*s,o.side,o.color,f);let d=Math.max(2,Math.round(c/.18));for(let p=0;p<=d;p++){let g=p/d,m=e[0]+(t[0]-e[0])*g,x=e[1]+(t[1]-e[1])*g,b=u+f*g;bl(n,[m,x],p===0||p===d?.03:.012,b+.1*s,b+.9*s,o.side,o.color)}r.seg([e[0],u+.2*s,e[1]],[t[0],h+.78*s,t[1]],l,Ye)}function mR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let u of n){let h=a(u[0],u[1]);bl(e,u,.06,h,h+s,o.side,o.color)}for(let[,u,h]of $u(n,c)){let[f,d]=[a(u[0],u[1]),a(h[0],h[1])];Yu(e,u,h,.12,f+s-.16,f+s,o.side,o.color,d-f),r.bracing&&(t.seg([u[0],f+.25,u[1]],[h[0],d+s-.25,h[1]],l,Ye),t.seg([h[0],d+.25,h[1]],[u[0],f+s-.25,u[1]],l,Ye))}if(O0(n)){let u=D0(n),h=u.x1-u.x0>=u.z1-u.z0,[f,d]=h?[u.x0,u.x1-u.x0]:[u.z0,u.z1-u.z0],p=Math.max(1,Math.round(d/.6));for(let g=1;ga(u,h)+s+.004)}function gR(i,e,t){let{buf:n,lines:r,poly:s,area:o,top:a,look:l,groundAt:c,base:u,edge:h}=i,f=u-(o.slope??0),d=(g,m)=>c(g,m)+a,p=qu(e,t);if(Tt(n,s,f,o.slope?d:u+a,l.side,l.color,{aoFrom:f,holes:p}),yl(i,(g,m)=>d(g,m)+.004),o.type==="hedge"&&yl(i,(g,m)=>c(g,m)+.004),o.outline!==!1)for(let g of p)g.forEach((m,x)=>{let b=g[(x+1)%g.length];r.seg([m[0],d(m[0],m[1])+.004,m[1]],[b[0],d(b[0],b[1])+.004,b[1]],h,Ye)})}function wy(i){let e=i.opacity;return e==null||!(e<1)?1:Math.max(.1,Math.round(e*20)/20)}function mp(i,e,t,n,r){let s=jo(t),o=t.outdoor??[];o.forEach((a,l)=>{if(a.points.length<3)return;let c=s+(a.offset??0),u=Sy[a.type],h=xl(a.points),f=wy(a),d=i;f<1&&n&&r&&(n.has(f)||n.set(f,r()),d=n.get(f));let p={buf:d,lines:e,area:a,poly:h,base:c,groundAt:(g,m)=>c-Kh(a,g,m),top:Jr(a.type)&&a.height?a.height:Dl[a.type],look:u,edge:ke(u.edge,u.edgeAlpha),openEdge:a.open&&(a.type==="fence"||a.type==="pergola")?h.length-1:-1};a.type==="pool"?fR(p):a.type==="fence"?dR(p):a.type==="pergola"?mR(p):gR(p,o,l)})}var Ty=.012,xR=.012;function bR(){let i=[],e=[],t=[],n=[];return{add(r,s,o,a,l,c,u){for(let h of[r,s,o,r,o,a])i.push(h[0],h[1],h[2]),e.push(l[0],l[1],l[2]),t.push(c),n.push(u)},finish:r=>({pos:new Float32Array(i),normal:new Float32Array(e),room:Int16Array.from(t),fold:new Float32Array(n),doors:r})}}function Ry(i,e){let[t,n]=[i.b[0]-i.a[0],i.b[1]-i.a[1]],r=Math.hypot(t,n)||1;return Math.abs((e.start[0]-i.a[0])*n-(e.start[1]-i.a[1])*t)/r<.02&&Math.abs((e.axis[0]*t+e.axis[1]*n)/r)>.99}function yR(i,e,t,n){let r=[];for(let s of n.filter(o=>Ry(i,o))){let o=(s.start[0]-i.a[0])*e[0]+(s.start[1]-i.a[1])*e[1],a=s.axis[0]*e[0]+s.axis[1]*e[1]>0?o:o-s.width;a>t||a+s.width<0||r.push({s0:a,s1:a+s.width,y0:s.sill-.01,y1:s.top+.01})}return r}function Ay(i,e,t){let n=[e,t,...i.filter(r=>r>e+.005&&rr-s);return n.filter((r,s)=>s===0||r>n[s-1]+.005)}function Ey(i,e,t=()=>!1){let n=i.map(u=>u[0]),r=i.map(u=>u[1]),[s,o]=[Math.min(...n),Math.min(...r)],[a,l]=[Math.max(1,Math.ceil((Math.max(...n)-s)/e)),Math.max(1,Math.ceil((Math.max(...r)-o)/e))],c=[];for(let u=0;ua.add([d,g,p],[d,g,p+r],[d+r,g,p+r],[d+r,g,p],[0,1,0],m,-1);i.rooms.forEach((d,p)=>{if(!(d.points.length<3))for(let{a:g,b:m}of Ey(d.points,r,(x,b)=>s.some(_=>Ge([x,b],_))))l(g,m,Ty,p)});let c=i.rooms.length,u=i.outdoor??[];u.forEach((d,p)=>{if(d.points.length<3||Jr(d.type))return;let g=pp(i,d)+Ty,m=qu(u,p);for(let{a:x,b}of Ey(d.points,r,(_,y)=>m.some(M=>Ge([_,y],M))))l(x,b,g,c)});let h=Math.min(i.cut_height,i.height);e.forEach((d,p)=>{let g=d.heightEnd===void 0?null:[d.height??i.height,d.heightEnd],m=g?Math.max(...g):d.height??i.height,x=Math.min(h,m-.02),[b,_]=[d.b[0]-d.a[0],d.b[1]-d.a[1]],y=Math.hypot(b,_);if(y<.05)return;let M=[b/y,_/y],S=[-M[1],M[0]],v=t[p],w=yR(d,M,y,n),C=Ay([x,(x+m)/2,...w.flatMap(R=>[R.y0+.01,R.y1-.01])],.02,m-.02),A=Ay(w.flatMap(R=>[R.s0,R.s1]),0,y);for(let R of[1,-1]){let N=R>0?d.roomLeft:d.roomRight,O=N?i.rooms.findIndex(H=>H.id===N):d.exterior?c:-1;if(O<0)continue;let P=(R>0?d.left:d.right)+xR,I=[S[0]*R,S[1]*R],D=(H,B)=>[d.a[0]+M[0]*H+I[0]*P,B,d.a[1]+M[1]*H+I[1]*P],F=H=>{let B=D(H,0),X=o?.(B[0],B[2]),V=g?g[0]+(g[1]-g[0])*H/y-.02:1/0;return Math.min(V,X==null?1/0:X-.02)};for(let H=0;H+1Se>Te.s0&&SeTe.y0&&ce=h-1e-6?v:ur+v)}}}}});let f=[];for(let d of n.filter(p=>p.opening.type==="door")){let p=e.find(x=>Ry(x,d));if(!p?.roomLeft||!p.roomRight)continue;let[g,m]=[i.rooms.findIndex(x=>x.id===p.roomLeft),i.rooms.findIndex(x=>x.id===p.roomRight)];g<0||m<0||f.push({id:d.opening.id,a:g,b:m,x:d.start[0]+d.axis[0]*(d.width/2),y:Math.min(1.1,d.top*.55),z:d.start[1]+d.axis[1]*(d.width/2)})}return a.finish(f)}function _R(i,e){let t=Math.max(0,-e),n=Math.max(0,e);switch(i){case"ceiling":return .3+.7*t;case"spot":return .06+.94*t**5;case"pendant":return .25+.85*t**2+.2*n;case"up":return .25+.75*n;case"wall":return .45+.35*Math.abs(e);default:return 1}}function vR(i){return(i.kind==="spot"?2:i.kind==="wall"?1.4:2.4)*(.55+.45*i.level)}function Cy(i,e,t){let[n,r,s]=[e[0]-i.x,e[1]-i.y,e[2]-i.z],o=n*n+r*r+s*s,a=Math.sqrt(o)||1e-6,l=vR(i),c=1/(1+o/(l*l)),u=c*Math.sqrt(c),h=Math.max(0,-(n*t[0]+r*t[1]+s*t[2])/a);return i.level*u*(.2+.8*h)*_R(i.kind,r/a)}function MR(i,e,t){let n=[];return i.doors.forEach((r,s)=>{let o=t[s]??.5;if(!(o<=.01))for(let[a,l]of[[r.a,r.b],[r.b,r.a]]){let c=[0,0,0];for(let h of e.filter(f=>f.room===a)){let f=[h.x-r.x,h.y-r.y,h.z-r.z],d=Math.hypot(...f)||1,p=Cy(h,[r.x,r.y,r.z],[f[0]/d,f[1]/d,f[2]/d]);for(let g=0;g<3;g++)c[g]+=h.color[g]*p}let u=Math.max(...c);u<.01||n.push({x:r.x,y:r.y,z:r.z,color:[c[0]/u,c[1]/u,c[2]/u],level:Math.min(1,u*.9*(.35+.65*o)),kind:"wall",room:l})}}),n}function xp(i,e,t=.7,n=[]){let r=new Map;for(let c of[...e,...MR(i,e,n)]){let u={...c,color:c.color.map(h=>h**1.5)};r.set(c.room,[...r.get(c.room)??[],u])}let{pos:s,normal:o,room:a}=i,l=new Float32Array(s.length);for(let c=0;cr.points.length>=3&&Ge([e,t],r.points));return n<0?i.rooms.length:n}var yp=(i,e)=>i&&e>=0&&e45,b=d+Lo(s.base,l,s.rise);for(let _ of TR)if(s.upright)r.push({x:s.x,y:u+l*(.5+_),z:s.z,color:p,level:g*Py,kind:"omni",room:a});else{let[y,M,S]=Wu(s.x,b,s.z,m,l,s.rise,_);r.push({x:y,y:M,z:S,color:p,level:g*Py,kind:x?"omni":f,room:a})}}return r}function Ly(i,e,t="plain"){return i.onBeforeCompile=n=>{n.uniforms.uStanding=e.standing,n.uniforms.uGlass=e.glass,n.uniforms.uSlope=e.slope??{value:{x:0,y:0,z:0,w:0}},n.uniforms.uSlopeY=e.slopeY??{value:{x:0,y:0}},n.uniforms.uGlassAlpha=e.glassAlpha??{value:.2},n.vertexShader=n.vertexShader.replace("#include ",`#include +}`,Hd=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ra(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Si({vertexShader:VE,fragmentShader:GE,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Se(new sn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Wd=class extends vi{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,p=null,x=typeof XRWebGLBinding<"u",g=new Hd,m={},y=t.getContextAttributes(),_=null,b=null,M=[],S=[],v=new Ue,w=null,R=null,T=new Jt;T.viewport=new vt;let C=new Jt;C.viewport=new vt;let L=[T,C],O=new Yc,P=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getGripSpace()},this.getHand=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getHandSpace()};function D(Y){let Q=S.indexOf(Y.inputSource);if(Q===-1)return;let se=M[Q];se!==void 0&&(se.update(Y.inputSource,Y.frame,c||o),se.dispatchEvent({type:Y.type,data:Y.inputSource}))}function F(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",H);for(let Y=0;Y=0&&(S[we]=null,M[we].disconnect(se))}for(let Q=0;Q=S.length){S.push(se),we=Ne;break}else if(S[Ne]===null){S[Ne]=se,we=Ne;break}if(we===-1)break}let le=M[we];le&&le.connect(se)}}function B(Y,Q){Q===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(Q.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let Q=Y.near,se=Y.far;g.texture!==null&&(g.depthNear>0&&(Q=g.depthNear),g.depthFar>0&&(se=g.depthFar)),O.near=C.near=T.near=Q,O.far=C.far=T.far=se,(P!==O.near||I!==O.far)&&(r.updateRenderState({depthNear:O.near,depthFar:O.far}),P=O.near,I=O.far),O.layers.mask=Y.layers.mask|6,T.layers.mask=O.layers.mask&-5,C.layers.mask=O.layers.mask&-3;let we=Y.parent,le=O.cameras;B(O,we);for(let Ne=0;Ne0&&(g.alphaTest.value=m.alphaTest);let y=e.get(m),_=y.envMap,b=y.envMapRotation;_&&(g.envMap.value=_,g.envMapRotation.value.setFromMatrix4(HE.makeRotationFromEuler(b)).transpose(),_.isCubeTexture&&_.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(Sy),g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function o(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function a(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,y,_){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*y,g.scale.value=_*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function u(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function h(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function f(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function d(g,m,y){g.ior.value=m.ior,m.diffuseRoughness>0&&(g.diffuseRoughness.value=m.diffuseRoughness,m.diffuseRoughnessMap&&(g.diffuseRoughnessMap.value=m.diffuseRoughnessMap,t(m.diffuseRoughnessMap,g.diffuseRoughnessMapTransform))),m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===un&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.retroreflectivity>0&&(g.retroreflectivity.value=m.retroreflectivity),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessMinimum,g.iridescenceThicknessMaximum.value=m.iridescenceThicknessMaximum,m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function x(g,m){let y=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function XE(i,e,t,n){let r={},s={};function o(y,_){let b=_.program;n.uniformBlockBinding(y,b,r[y.id])}function a(y,_){let b=r[y.id];b===void 0&&(p(y),b=l(y),r[y.id]=b,y.addEventListener("dispose",g));let M=_.program;n.updateUBOMapping(y,M);let S=e.render.frame;s[y.id]!==S&&(c(y),s[y.id]=S)}function l(y){let _=i.createBuffer(),b=y.__size,M=y.usage;return i.bindBuffer(i.UNIFORM_BUFFER,_),i.bufferData(i.UNIFORM_BUFFER,b,M),i.bindBuffer(i.UNIFORM_BUFFER,null),_}function c(y){let _=r[y.id],b=y.uniforms,M=y.__cache;i.bindBuffer(i.UNIFORM_BUFFER,_);for(let S=0,v=b.length;S0&&(b+=M-S),y.__size=b,y.__cache={},this}function x(y,_){let b={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(b.boundary=4,b.storage=4):y.isVector2?(b.boundary=8,b.storage=8):y.isVector3||y.isColor?(b.boundary=16,b.storage=12):y.isVector4?(b.boundary=16,b.storage=16):y.isMatrix3?(b.boundary=16,b.storage=48):y.isMatrix4?(b.boundary=16,b.storage=64):y.isTexture?Oe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(y)?(b.boundary=16,b.storage=y.byteLength):Oe("WebGLRenderer: Unsupported uniform value type.",y),_===!0&&(b.boundary=16,b.storage=Math.ceil(b.storage/16)*16),b}function g(y){let _=y.target;_.removeEventListener("dispose",g),i.deleteBuffer(r[_.id]),delete r[_.id],delete s[_.id]}function m(){for(let y in r)i.deleteBuffer(r[y]);r={},s={}}return{bind:o,update:a,dispose:m}}var YE=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Pi=null;function qE(){return Pi===null&&(Pi=new xo(YE,16,16,Br,li),Pi.name="DFG_LUT",Pi.minFilter=Ht,Pi.magFilter=Ht,Pi.wrapS=ln,Pi.wrapT=ln,Pi.generateMipmaps=!1,Pi.needsUpdate=!0),Pi}var zr=class{constructor(e={}){let{canvas:t=Fx(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:f=!1,outputBufferType:d=Nn}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=o;let x=d,g=new Set([iu,nu,tu]),m=new Set([Nn,ai,To,vs,jc,Qc]),y=new Uint32Array(4),_=new Int32Array(4),b={textures:[],min:[],max:[],resolution:[]},M=null,S=null,v=[],w=[],R=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let T=this,C=!1,L=null,O=null,P=null,I=null;this._outputColorSpace=dt;let D=0,F=0,H=null,B=-1,X=null,V=new vt,re=new vt,ye=null,Y=new W(0),Q=0,se=t.width,we=t.height,le=1,Ne=null,at=null,Ae=new vt(0,0,se,we),ft=new vt(0,0,se,we),yt=!1,nt=new Fr,Yt=new Fc,kt=!1,on=!1,Nt=new ze,xi=new U,en=new vt,Hn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Wn=!1;function Xn(){return H===null?le:1}let G=n;function Yn(E,z){return t.getContext(E,z)}let Pt,It,be,Zt,Ve,qe,N,A,K,oe,ie,he,ge,ee,te,de,k,ne,j,pe,ce,fe,De;try{let E={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"187"}`),t.addEventListener("webglcontextlost",Be,!1),t.addEventListener("webglcontextrestored",je,!1),t.addEventListener("webglcontextcreationerror",ve,!1),G===null){let z="webgl2";if(G=Yn(z,E),G===null)throw Yn(z)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Qe()}catch(E){throw t.removeEventListener("webglcontextlost",Be,!1),t.removeEventListener("webglcontextrestored",je,!1),t.removeEventListener("webglcontextcreationerror",ve,!1),We("WebGLRenderer: "+E.message),E}function Qe(){Pt=new rA(G),Pt.init(),ce=new zE(G,Pt),It=new qT(G,Pt,e,ce),be=new BE(G,Pt),It.reversedDepthBuffer&&f&&be.buffers.depth.setReversed(!0),O=G.createFramebuffer(),P=G.createFramebuffer(),I=G.createFramebuffer(),Zt=new aA(G),Ve=new wE,qe=new kE(G,Pt,be,Ve,It,ce,Zt),N=new iA(T),A=new cw(G),fe=new XT(G,A),K=new sA(G,A,Zt,fe),oe=new cA(G,K,A,fe,Zt),ne=new lA(G,It,qe),te=new $T(Ve),ie=new SE(T,N,Pt,It,fe,te),he=new WE(T,Ve),ge=new AE,ee=new LE(Pt),k=new WT(T,N,be,oe,p,l),de=new UE(T,oe,It),De=new XE(G,Zt,It,be),j=new YT(G,Pt,Zt),pe=new oA(G,Pt,Zt),Zt.programs=ie.programs,T.capabilities=It,T.extensions=Pt,T.properties=Ve,T.renderLists=ge,T.shadowMap=de,T.state=be,T.info=Zt}x!==Nn&&(R=new hA(x,t.width,t.height,a,r,s));let ae=new Wd(T,G);this.xr=ae,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){let E=Pt.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){let E=Pt.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return le},this.setPixelRatio=function(E){E!==void 0&&(le=E,this.setSize(se,we,!1))},this.getSize=function(E){return E.set(se,we)},this.setSize=function(E,z,J=!0){if(ae.isPresenting){Oe("WebGLRenderer: Can't change size while VR device is presenting.");return}se=E,we=z,t.width=Math.floor(E*le),t.height=Math.floor(z*le),J===!0&&(t.style.width=E+"px",t.style.height=z+"px"),R!==null&&R.setSize(t.width,t.height),this.setViewport(0,0,E,z)},this.getDrawingBufferSize=function(E){return E.set(se*le,we*le).floor()},this.setDrawingBufferSize=function(E,z,J){se=E,we=z,le=J,t.width=Math.floor(E*J),t.height=Math.floor(z*J),this.setViewport(0,0,E,z)},this.setEffects=function(E){if(x===Nn){We("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(E){for(let z=0;z{function xe(){if($.forEach(function(Ee){let Me=Ve.get(Ee).currentProgram;(Me===void 0||Me.isReady())&&$.delete(Ee)}),$.size===0){Z(E);return}setTimeout(xe,10)}Pt.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let sf=null;function A1(E){sf&&sf(E)}function T0(){Kr.stop()}function A0(){Kr.start()}let Kr=new dy;Kr.setAnimationLoop(A1),typeof self<"u"&&Kr.setContext(self),this.setAnimationLoop=function(E){sf=E,ae.setAnimationLoop(E),E===null?Kr.stop():Kr.start()},ae.addEventListener("sessionstart",T0),ae.addEventListener("sessionend",A0),this.render=function(E,z){if(z!==void 0&&z.isCamera!==!0){We("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;L!==null&&L.renderStart(E,z);let J=ae.enabled===!0&&ae.isPresenting===!0,$=R!==null&&(H===null||J)&&R.begin(T,H);if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),z.parent===null&&z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),ae.enabled===!0&&ae.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&(ae.cameraAutoUpdate===!0&&ae.updateCamera(z),z=ae.getCamera()),E.isScene===!0&&E.onBeforeRender(T,E,z,H),S=ee.get(E,w.length),S.init(z),S.state.textureUnits=qe.getTextureUnits(),w.push(S),Nt.multiplyMatrices(z.projectionMatrix,z.matrixWorldInverse),z.isArrayCamera?Yt.setFromArrayCamera(z):nt.setFromProjectionMatrix(Nt,$n,z.reversedDepth),on=this.localClippingEnabled,kt=te.init(this.clippingPlanes,on),M=ge.get(E,v.length),M.init(),v.push(M),this.info.render.frame++,ae.enabled===!0&&ae.isPresenting===!0){let Ee=T.xr.getDepthSensingMesh();Ee!==null&&of(Ee,z,-1/0,T.sortObjects)}of(E,z,0,T.sortObjects),M.finish(),L!==null&&L.updateLights(S.state.lightsArray),T.sortObjects===!0&&M.sort(Ne,at),Wn=ae.enabled===!1||ae.isPresenting===!1||ae.hasDepthSensing()===!1,Wn&&k.addToRenderList(M,E),this.info.autoReset===!0&&this.info.reset(),kt===!0&&te.beginShadows();let Z=S.state.shadowsArray;if(de.render(Z,E,z),kt===!0&&te.endShadows(),($&&R.hasRenderPass())===!1){let Ee=M.opaque,me=M.transmissive;if(S.setupLights(),z.isArrayCamera){let Me=z.cameras;if(me.length>0)for(let Ie=0,Ke=Me.length;Ie0&&R0(Ee,me,E,z),Wn&&k.render(E),E0(M,E,z)}H!==null&&F===0&&(qe.updateMultisampleRenderTarget(H),qe.updateRenderTargetMipmap(H)),$&&R.end(T),E.isScene===!0&&E.onAfterRender(T,E,z),fe.resetDefaultState(),B=-1,X=null,w.pop(),w.length>0?(S=w[w.length-1],qe.setTextureUnits(S.state.textureUnits),kt===!0&&te.setGlobalState(T.clippingPlanes,S.state.camera)):S=null,v.pop(),v.length>0?M=v[v.length-1]:M=null,L!==null&&L.renderEnd()};function of(E,z,J,$){if(E.visible===!1)return;if(E.layers.test(z.layers)){if(E.isGroup)J=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(z);else if(E.isLight)S.pushLight(E),E.castShadow&&S.pushShadow(E);else if(E.isSprite){let Ee=z.isArrayCamera?Yt:nt;if(!E.frustumCulled||E.intersectsFrustum(Ee)){$&&en.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Nt);let me=oe.update(E),Me=E.material;Me.visible&&M.push(E,me,Me,J,en.z,null,z)}}else if(E.isMesh||E.isLine||E.isPoints){let Ee=z.isArrayCamera?Yt:nt;if(!E.frustumCulled||E.intersectsFrustum(Ee)){let me=oe.update(E),Me=E.material;if($&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),en.copy(E.boundingSphere.center)):(me.boundingSphere===null&&me.computeBoundingSphere(),en.copy(me.boundingSphere.center)),en.applyMatrix4(E.matrixWorld).applyMatrix4(Nt)),Array.isArray(Me)){let Ie=me.groups;for(let Ke=0,lt=Ie.length;Ke0&&kl(Z,z,J),xe.length>0&&kl(xe,z,J),Ee.length>0&&kl(Ee,z,J),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function R0(E,z,J,$){if((J.isScene===!0?J.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[$.id]===void 0){let Re=Pt.has("EXT_color_buffer_half_float")||Pt.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[$.id]=new wn(1,1,{generateMipmaps:!0,type:Re?li:Nn,minFilter:Fn,samples:Math.max(4,It.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:it.workingColorSpace})}let xe=S.state.transmissionRenderTarget[$.id],Ee=$.viewport||V;xe.setSize(Ee.z*T.transmissionResolutionScale,Ee.w*T.transmissionResolutionScale);let me=T.getRenderTarget(),Me=T.getActiveCubeFace(),Ie=T.getActiveMipmapLevel();T.setRenderTarget(xe),T.getClearColor(Y),Q=T.getClearAlpha(),Q<1&&T.setClearColor(16777215,.5),T.clear(),Wn&&k.render(J);let Ke=T.toneMapping;T.toneMapping=Ri;let lt=$.viewport;if($.viewport!==void 0&&($.viewport=void 0),S.setupLightsView($),kt===!0&&te.setGlobalState(T.clippingPlanes,$),kl(E,J,$),qe.updateMultisampleRenderTarget(xe),qe.updateRenderTargetMipmap(xe),Pt.has("WEBGL_multisampled_render_to_texture")===!1){let Re=!1;for(let ct=0,qt=z.length;ct0),Re=!!J.morphAttributes.position,ct=!!J.morphAttributes.normal,qt=!!J.morphAttributes.color,Rt=Ri;$.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(Rt=T.toneMapping);let At=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,hn=At!==void 0?At.length:0,Ce=Ve.get($),vn=S.state.lights;if(kt===!0&&(on===!0||E!==X)){let Ot=E===X&&$.id===B;te.setState($,E,Ot)}let bt=!1,Zr=!1;$.version===Ce.__version?Ce.needsLights&&Ce.lightsStateVersion!==vn.state.version||Z.isBatchedMesh&&Ce.batching===!1||!Z.isBatchedMesh&&Ce.batching===!0||Z.isBatchedMesh&&Ce.batchingColor===!0&&Z._colorsTexture===null||Z.isBatchedMesh&&Ce.batchingColor===!1&&Z._colorsTexture!==null||Z.isInstancedMesh&&Ce.instancing===!1||!Z.isInstancedMesh&&Ce.instancing===!0||Z.isSkinnedMesh&&Ce.skinning===!1||!Z.isSkinnedMesh&&Ce.skinning===!0||Z.isInstancedMesh&&Ce.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&Ce.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&Ce.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&Ce.instancingMorph===!1&&Z.morphTexture!==null||Ce.envMap!==Ie||$.fog===!0&&Ce.fog!==xe||Ce.numClippingPlanes!==void 0&&(Ce.numClippingPlanes!==te.numPlanes||Ce.numIntersection!==te.numIntersection)||Ce.vertexAlphas!==Ke||Ce.vertexTangents!==lt||Ce.morphTargets!==Re||Ce.morphNormals!==ct||Ce.morphColors!==qt||Ce.morphTargetsCount!==hn||Ce.numLightProbeGrids!==P0(S.state.lightProbeGridArray)?bt=!0:(Ce.outputColorSpace!==me||Ce.toneMapping!==Rt)&&(Zr=!0):(bt=!0,Ce.__version=$.version);let fn=Ce.currentProgram;(bt===!0||Zr===!0)&&(fn=Zr===!0?E1($,z,Z,me,Rt):Qo($,z,Z),L&&$.isNodeMaterial&&L.onUpdateProgram($,fn,Ce));let zl=!1,_r=!1,Jr=!1,pt=fn.getUniforms(),an=Ce.uniforms;if(be.useProgram(fn.program)&&(zl=!0,_r=!0,Jr=!0),$.id!==B&&(B=$.id,_r=!0),zl||X!==E){be.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),pt.setValue(G,"projectionMatrix",E.projectionMatrix),pt.setValue(G,"viewMatrix",E.matrixWorldInverse);let nn=pt.map.cameraPosition;nn!==void 0&&nn.setValue(G,xi.setFromMatrixPosition(E.matrixWorld)),It.logarithmicDepthBuffer&&pt.setValue(G,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&pt.setValue(G,"isOrthographic",E.isOrthographicCamera===!0),X!==E&&(X=E,_r=!0,Jr=!0)}if(Ce.needsLights&&(vn.state.sunShadowMap.length>0&&pt.setValue(G,"sunShadowMap",vn.state.sunShadowMap,qe),vn.state.directionalShadowMap.length>0&&pt.setValue(G,"directionalShadowMap",vn.state.directionalShadowMap,qe),vn.state.spotShadowMap.length>0&&pt.setValue(G,"spotShadowMap",vn.state.spotShadowMap,qe),vn.state.pointShadowMap.length>0&&pt.setValue(G,"pointShadowMap",vn.state.pointShadowMap,qe)),Z.isSkinnedMesh){pt.setOptional(G,Z,"bindMatrix"),pt.setOptional(G,Z,"bindMatrixInverse");let Ot=Z.skeleton;Ot&&(Ot.boneTexture===null&&Ot.computeBoneTexture(),pt.setValue(G,"boneTexture",Ot.boneTexture,qe))}Z.isBatchedMesh&&(pt.setOptional(G,Z,"batchingTexture"),pt.setValue(G,"batchingTexture",Z._matricesTexture,qe),pt.setOptional(G,Z,"batchingIdTexture"),pt.setValue(G,"batchingIdTexture",Z._indirectTexture,qe),pt.setOptional(G,Z,"batchingColorTexture"),Z._colorsTexture!==null&&pt.setValue(G,"batchingColorTexture",Z._colorsTexture,qe));let ni=J.morphAttributes;if((ni.position!==void 0||ni.normal!==void 0||ni.color!==void 0)&&ne.update(Z,J,fn),(_r||Ce.receiveShadow!==Z.receiveShadow)&&(Ce.receiveShadow=Z.receiveShadow,pt.setValue(G,"receiveShadow",Z.receiveShadow)),($.isMeshStandardMaterial||$.isMeshLambertMaterial||$.isMeshPhongMaterial)&&$.envMap===null&&z.environment!==null&&(an.envMapIntensity.value=z.environmentIntensity),an.dfgLUT!==void 0&&(an.dfgLUT.value=qE()),_r){if(pt.setValue(G,"toneMappingExposure",T.toneMappingExposure),Ce.needsLights&&C1(an,Jr),xe&&$.fog===!0&&he.refreshFogUniforms(an,xe),he.refreshMaterialUniforms(an,$,le,we,S.state.transmissionRenderTarget[E.id]),Ce.needsLights&&Ce.numLightProbeGrids>0){let Ot=b,nn=0;for(let zi of S.state.lightProbeGridArray)zi.texture!==null&&(Ot.textures[nn]=zi.texture,Ot.min[nn]=zi.boundingBox.min,Ot.max[nn]=zi.boundingBox.max,Ot.resolution[nn]=zi.resolution,nn++);for(let zi in Ot)Ot[zi].length=nn;an.probesSH.value=Ot.textures,an.probesMin.value=Ot.min,an.probesMax.value=Ot.max,an.probesResolution.value=Ot.resolution}Eo.upload(G,I0(Ce),an,qe)}if($.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(Eo.upload(G,I0(Ce),an,qe),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&pt.setValue(G,"center",Z.center),pt.setValue(G,"modelViewMatrix",Z.modelViewMatrix),pt.setValue(G,"normalMatrix",Z.normalMatrix),pt.setValue(G,"modelMatrix",Z.matrixWorld),$.uniformsGroups!==void 0){let Ot=$.uniformsGroups;for(let nn=0,zi=Ot.length;nn0&&qe.useMultisampledRTT(E)===!1?$=Ve.get(E).__webglMultisampledFramebuffer:Array.isArray(Ie)?$=Ie[J]:$=Ie,V.copy(E.viewport),re.copy(E.scissor),ye=E.scissorTest}else V.copy(Ae).multiplyScalar(le).floor(),re.copy(ft).multiplyScalar(le).floor(),ye=yt;if(J!==0&&($=O),be.bindFramebuffer(G.FRAMEBUFFER,$)&&be.drawBuffers(E,$),be.viewport(V),be.scissor(re),be.setScissorTest(ye),Z){let me=Ve.get(E.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_CUBE_MAP_POSITIVE_X+z,me.__webglTexture,J)}else if(xe){let me=z;for(let Me=0;Me1&&G.readBuffer(G.COLOR_ATTACHMENT0+me);let Re=F0(Ie);if(Re.__formatReadable===!1){We("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Re.__typeReadable===!1){We("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=E.width-$&&J>=0&&J<=E.height-Z&&G.readPixels(z,J,$,Z,ce.convert(Ke),ce.convert(lt),xe)}finally{let Ie=H!==null?Ve.get(H).__webglFramebuffer:null;be.bindFramebuffer(G.FRAMEBUFFER,Ie)}}},this.readRenderTargetPixelsAsync=async function(E,z,J,$,Z,xe,Ee,me=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Me=Ve.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Ee!==void 0&&(Me=Me[Ee],Array.isArray(Me)&&(Me=Me[0])),Me)if(z>=0&&z<=E.width-$&&J>=0&&J<=E.height-Z){be.bindFramebuffer(G.FRAMEBUFFER,Me);let Ie=E.textures[me],Ke=Ie.format,lt=Ie.type;E.textures.length>1&&G.readBuffer(G.COLOR_ATTACHMENT0+me);let Re=F0(Ie);if(Re.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Re.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let ct=G.createBuffer();G.bindBuffer(G.PIXEL_PACK_BUFFER,ct),G.bufferData(G.PIXEL_PACK_BUFFER,xe.byteLength,G.STREAM_READ),G.readPixels(z,J,$,Z,ce.convert(Ke),ce.convert(lt),0),G.bindBuffer(G.PIXEL_PACK_BUFFER,null);let qt=H!==null?Ve.get(H).__webglFramebuffer:null;be.bindFramebuffer(G.FRAMEBUFFER,qt);let Rt=G.fenceSync(G.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),await Ox(G,Rt,4),G.bindBuffer(G.PIXEL_PACK_BUFFER,ct),G.getBufferSubData(G.PIXEL_PACK_BUFFER,0,xe),G.bindBuffer(G.PIXEL_PACK_BUFFER,null),G.deleteBuffer(ct),G.deleteSync(Rt),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,z=null,J=0){let $=Math.pow(2,-J),Z=Math.floor(E.image.width*$),xe=Math.floor(E.image.height*$),Ee=z!==null?z.x:0,me=z!==null?z.y:0;qe.setTexture2D(E,0),G.copyTexSubImage2D(G.TEXTURE_2D,J,0,0,Ee,me,Z,xe),be.unbindTexture()},this.copyTextureToTexture=function(E,z,J=null,$=null,Z=0,xe=0){let Ee,me,Me,Ie,Ke,lt,Re,ct,qt,Rt=E.isCompressedTexture?E.mipmaps[xe]:E.image;if(J!==null)Ee=J.max.x-J.min.x,me=J.max.y-J.min.y,Me=J.isBox3?J.max.z-J.min.z:1,Ie=J.min.x,Ke=J.min.y,lt=J.isBox3?J.min.z:0;else{let pt=Math.pow(2,-Z);Ee=Math.floor(Rt.width*pt),me=Math.floor(Rt.height*pt),E.isDataArrayTexture?Me=Rt.depth:E.isData3DTexture?Me=Math.floor(Rt.depth*pt):Me=1,Ie=0,Ke=0,lt=0}$!==null?(Re=$.x,ct=$.y,qt=$.z):(Re=0,ct=0,qt=0);let At=ce.convert(z.format),hn=ce.convert(z.type),Ce;z.isData3DTexture?(qe.setTexture3D(z,0),Ce=G.TEXTURE_3D):z.isDataArrayTexture||z.isCompressedArrayTexture?(qe.setTexture2DArray(z,0),Ce=G.TEXTURE_2D_ARRAY):(qe.setTexture2D(z,0),Ce=G.TEXTURE_2D),be.activeTexture(G.TEXTURE0),be.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,z.flipY),be.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),be.pixelStorei(G.UNPACK_ALIGNMENT,z.unpackAlignment);let vn=be.getParameter(G.UNPACK_ROW_LENGTH),bt=be.getParameter(G.UNPACK_IMAGE_HEIGHT),Zr=be.getParameter(G.UNPACK_SKIP_PIXELS),fn=be.getParameter(G.UNPACK_SKIP_ROWS),zl=be.getParameter(G.UNPACK_SKIP_IMAGES);be.pixelStorei(G.UNPACK_ROW_LENGTH,Rt.width),be.pixelStorei(G.UNPACK_IMAGE_HEIGHT,Rt.height),be.pixelStorei(G.UNPACK_SKIP_PIXELS,Ie),be.pixelStorei(G.UNPACK_SKIP_ROWS,Ke),be.pixelStorei(G.UNPACK_SKIP_IMAGES,lt);let _r=E.isDataArrayTexture||E.isData3DTexture,Jr=z.isDataArrayTexture||z.isData3DTexture;if(E.isDepthTexture){let pt=Ve.get(E),an=Ve.get(z),ni=Ve.get(pt.__renderTarget),Ot=Ve.get(an.__renderTarget);be.bindFramebuffer(G.READ_FRAMEBUFFER,ni.__webglFramebuffer),be.bindFramebuffer(G.DRAW_FRAMEBUFFER,Ot.__webglFramebuffer);for(let nn=0;nn.5+.5*Math.min(1,Math.max(0,i/1.6));function qd(i,e){let t=Math.hypot(i,e);return .8+.28*((e/t*rl[0]-i/t*rl[1]+1)/2)}var $e=-1,ol=16,hr=32,$d=48,zu=64,Kd=128,Vr=(i,e)=>new Le(i,e),ut=class{p=[];c=[];f=[];uv;tile;constructor(e=!1,t=!1){this.uv=e?[]:null,this.tile=t?[]:null}tri(e,t,n,r,s=r,o=r,a,l=$e,c=[0,1]){this.p.push(...e,...t,...n);for(let u of[r,s,o])this.c.push(u.r,u.g,u.b);this.f.push(l,l,l),this.uv?.push(...a??[.5,.5,.5,.5,.5,.5]),this.tile?.push(...c,...c,...c)}get count(){return this.p.length/9}geometry(){let e=new Pe;return e.setAttribute("position",Vr(this.p,3)),e.setAttribute("color",Vr(this.c,3)),e.setAttribute("fold",Vr(this.f,1)),this.uv&&e.setAttribute("uv",Vr(this.uv,2)),this.tile&&e.setAttribute("tile",Vr(this.tile,2)),e.computeBoundingSphere(),e}},Wt=class{p=[];c=[];f=[];seg(e,t,n=Li,r=$e){this.p.push(...e,...t),this.c.push(n.r,n.g,n.b,n.r,n.g,n.b),this.f.push(r,r)}segSplit(e,t,n,r,s){let[o,a]=e[1]<=t[1]?[e,t]:[t,e];if(a[1]<=r+1e-6||s<0)return this.seg(o,a,n,$e);if(o[1]>=r-1e-6)return this.seg(o,a,n,s);let l=(r-o[1])/(a[1]-o[1]),c=[o[0]+(a[0]-o[0])*l,r,o[2]+(a[2]-o[2])*l];this.seg(o,c,n,$e),this.seg(c,a,n,s)}geometry(){let e=new Pe;return e.setAttribute("position",Vr(this.p,3)),e.setAttribute("color",Vr(this.c,3)),e.setAttribute("fold",Vr(this.f,1)),e}};var Zd=(i,e,t)=>i.map((n,r)=>n+(e[r]-n)*t);function wy(i,e,t){let n=(t-i.p[1])/(e.p[1]-i.p[1]);return{p:Zd(i.p,e.p,n),c:Zd(i.c,e.c,n),uv:i.uv&&e.uv?Zd(i.uv,e.uv,n):null,tile:i.tile}}function $E(i,e){return{p:i.p.slice(e*3,e*3+3),c:i.c.slice(e*3,e*3+3),uv:i.uv?i.uv.slice(e*2,e*2+2):null,tile:i.tile?i.tile.slice(e*2,e*2+2):null}}function KE(i,e,t,n){t.forEach((r,s)=>{let o=e*3+s;r.p.forEach((a,l)=>i.p[o*3+l]=a),r.c.forEach((a,l)=>i.c[o*3+l]=a),i.uv&&r.uv&&r.uv.forEach((a,l)=>i.uv[o*2+l]=a),i.tile&&r.tile&&r.tile.forEach((a,l)=>i.tile[o*2+l]=a),i.f[o]=n})}function Ty(i,e,t){for(let n of e)i.p.push(...n.p),i.c.push(...n.c),i.f.push(t),i.uv?.push(...n.uv??[.5,.5]),i.tile?.push(...n.tile??[0,1])}function Jd(i,e,t,n){let r=i.count;for(let s=e;s$E(i,s*3+_)),a=o.map(_=>_.p[1]>t+1e-6),l=o.map(_=>_.p[1]=t-1e-6){i.f[s*2]=n,i.f[s*2+1]=n;continue}let u=(t-l[1])/(c[1]-l[1]),h=[l[0]+(c[0]-l[0])*u,t,l[2]+(c[2]-l[2])*u],f=i.c.slice(s*6,s*6+3);i.p.splice(s*6,6,...l,...h),i.p.push(...h,...c),i.c.push(...f,...f),i.f.push(n,n)}}var ZE=i=>i.reduce((e,t,n)=>e+t[0]*i[(n+1)%i.length][1]-i[(n+1)%i.length][0]*t[1],0),Ay=([i,e])=>new Ue(i,e);function Gr(i,e=[]){return Fa.triangulateShape(i.map(Ay),e.map(t=>t.map(Ay)))}var Po=(i,e)=>[i[0]-e[0],i[1]-e[1],i[2]-e[2]],Ey=(i,e)=>[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]],Ry=(i,e)=>i[0]*e[0]+i[1]*e[1]+i[2]*e[2],Cy=i=>{let e=Math.hypot(i[0],i[1],i[2])||1;return[i[0]/e,i[1]/e,i[2]/e]};function Qd(i,e,t,n,r,s,o){let a=new W(o);for(let f=0;f<4;f++){let[d,p]=[e[f],e[(f+1)%4]],[x,g]=[t[f],t[(f+1)%4]],[m,y]=[p[0]-d[0],p[1]-d[1]],_=Math.hypot(m,y);if(_<1e-6)continue;let b=(x[0]+g[0]-d[0]-p[0])/2*(-y/_)+(x[1]+g[1]-d[1]-p[1])/2*(m/_),M=Math.max(0,Math.min(1,b/Math.max(1e-6,Math.hypot(b,r-n)))),S=qd(m,y),v=ke(s,sl(n)*S).lerp(a,M),w=ke(s,sl(r)*S).lerp(a,M);i.tri([d[0],n,d[1]],[x[0],r,x[1]],[g[0],r,g[1]],v,w,w),i.tri([d[0],n,d[1]],[g[0],r,g[1]],[p[0],n,p[1]],v,w,v)}let[l,c,u,h]=t;Math.hypot(u[0]-l[0],u[1]-l[1])>1e-4&&(i.tri([l[0],r,l[1]],[u[0],r,u[1]],[c[0],r,c[1]],a),i.tri([l[0],r,l[1]],[h[0],r,h[1]],[u[0],r,u[1]],a))}function ep(i,e,t,n){let r=e.length;if(r<2)return;let s=e[0].length,o=new W(n),a=e.map(h=>[0,1,2].map(f=>h.reduce((d,p)=>d+p[f],0)/s)),l=e.map((h,f)=>h.map((d,p)=>{let x=Po(e[Math.min(r-1,f+1)][p],e[Math.max(0,f-1)][p]),g=Po(h[(p+1)%s],h[(p+s-1)%s]),m=Cy(Ey(x,g));return Ry(m,Po(d,a[f]))<0?m.map(y=>-y):m})),c=(h,f)=>{let d=(f[0]*rl[0]+f[2]*rl[1]+1)/2;return ke(t,sl(h[1])*(.8+.28*d)).lerp(o,Math.max(0,f[1])*.9)},u=(h,f,d,p,x,g,m)=>{Ry(Ey(Po(f,h),Po(d,h)),p)>=0?i.tri(h,f,d,x,g,m):i.tri(h,d,f,x,m,g)};for(let h=0;h+1c(M,x[S])),b=[0,1,2].map(M=>x.reduce((S,v)=>S+v[M],0));u(p[0],p[1],p[2],b,g,m,y),u(p[0],p[2],p[3],b,g,y,_)}for(let[h,f]of[[0,-1],[r-1,1]]){let d=e[h],p=Po(e[h===0?1:r-2][0],d[0]),x=Cy(p.map(m=>m*-f)),g=c(a[h],x);for(let m=0;m{let x=p/c*Math.PI*2;return{y:s+Math.cos(x)*o,across:r+Math.sin(x)*o}}),f=(d,p)=>{let{y:x,across:g}=h[p%c],[m,y]=e(d,g);return[m,x,y]};for(let d=0;dn:x=>Math.max(t+.002,n(x[0],x[1])),l=o.aoFrom??t,c=o.fold??$e,u=x=>sl(x-l),h=(o.holes??[]).map(x=>ZE(x)>0?[...x].reverse():x),f=h.length?[...e,...h.flat()]:e,d=o.topFace!==!1,p=!d&&!o.bottom?[]:Gr(e,h);if(d){let x=new W(s);for(let[g,m,y]of p){let[_,b,M]=[f[g],f[m],f[y]];i.tri([_[0],a(_),_[1]],[M[0],a(M),M[1]],[b[0],a(b),b[1]],x,x,x,void 0,o.topFold??c)}}if(o.bottom){let x=ke(r,.55);for(let[g,m,y]of p){let[_,b,M]=[f[g],f[m],f[y]];i.tri([_[0],t,_[1]],[b[0],t,b[1]],[M[0],t,M[1]],x,x,x,void 0,c)}}for(let x of[e,...h])x.forEach((g,m)=>{let y=x[(m+1)%x.length];if(Math.hypot(y[0]-g[0],y[1]-g[1])<1e-6||o.skipSide?.(g,y))return;let _=qd(y[0]-g[0],y[1]-g[1]),[b,M]=[a(g),a(y)],S=o.sideColor?o.sideColor(g,y):r,v=ke(S,u(t)*_),w=ke(S,u(b)*_),R=ke(S,u(M)*_);i.tri([g[0],t,g[1]],[g[0],b,g[1]],[y[0],M,y[1]],v,w,R,void 0,c),i.tri([g[0],t,g[1]],[y[0],M,y[1]],[y[0],t,y[1]],v,R,v,void 0,c)})}var Ms=i=>{let e=Math.hypot(i[0],i[1])||1;return[i[0]/e,i[1]/e]};function Hr(i){return i.reduce((t,n,r)=>t+n[0]*i[(r+1)%i.length][1]-i[(r+1)%i.length][0]*n[1],0)>=0?i:[...i].reverse()}function Py(i,e){let t=[];return i.forEach((n,r)=>{let s=i[(r+1)%i.length],[o,a]=[e(n),e(s)];if(o>=0&&t.push(n),o>=0!=a>=0){let l=o/(o-a);t.push([n[0]+(s[0]-n[0])*l,n[1]+(s[1]-n[1])*l])}}),t}function ip(i,e,t,n,r){let s=a=>(a[0]-e[0])*t[0]+(a[1]-e[1])*t[1],o=i;return Number.isFinite(n)&&(o=Py(o,a=>s(a)-n)),Number.isFinite(r)&&(o=Py(o,a=>r-s(a))),o}var Iy=i=>Math.round(i*1e3),al=i=>`${Iy(i[0])},${Iy(i[1])}`,np=(i,e)=>{let[t,n]=[al(i),al(e)];return t{let s=i[(r+1)%i.length],[o,a]=[s[0]-n[0],s[1]-n[1]],l=o*o+a*a;if(l<1e-8)return;let c=e.map(h=>({t:((h[0]-n[0])*o+(h[1]-n[1])*a)/l,off:Math.abs((h[0]-n[0])*a-(h[1]-n[1])*o)/Math.sqrt(l)})).filter(({t:h,off:f})=>h>1e-6&&h<1-1e-6&&f<1e-4).map(({t:h})=>h).sort((h,f)=>h-f),u=n;for(let h of c){let f=[n[0]+o*h,n[1]+a*h];al(f)!==al(u)&&t.push([u,f]),u=f}t.push([u,s])}),t}function rp(i,e){let t=i.map(l=>({wall:l,edges:JE(l.footprint,e)})),n=new Map;for(let{edges:l}of t)for(let[c,u]of l)n.set(np(c,u),(n.get(np(c,u))??0)+1);let r=[],s=new Map,o=(l,c,u)=>{let h=al(l);s.has(h)||s.set(h,{p:l,wall:c,d:[]}),s.get(h).d.push(u)};for(let{wall:l,edges:c}of t)for(let[u,h]of c){let f=Math.hypot(h[0]-u[0],h[1]-u[1]);if(n.get(np(u,h))!==1||f<1e-4)continue;r.push({a:u,b:h,wall:l});let d=[(h[0]-u[0])/f,(h[1]-u[1])/f];o(u,l,d),o(h,l,d)}let a=[...s.values()].filter(({d:l})=>l.some(c=>l.some(u=>Math.abs(c[0]*u[1]-c[1]*u[0])>.05))).map(({p:l,wall:c})=>({p:l,wall:c}));return{edges:r,corners:a}}function Io(i,e){if(e.length===0)return[[i.a,i.b]];let t=Ms([i.wall.b[0]-i.wall.a[0],i.wall.b[1]-i.wall.a[1]]),n=Ms([i.b[0]-i.a[0],i.b[1]-i.a[1]]);if(Math.abs(t[0]*n[0]+t[1]*n[1])<.99)return[[i.a,i.b]];let r=c=>(c[0]-i.wall.a[0])*t[0]+(c[1]-i.wall.a[1])*t[1],[s,o]=[r(i.a),r(i.b)],a=[[Math.min(s,o),Math.max(s,o)]];for(let c of e)a=a.flatMap(([u,h])=>{if(c.s1<=u||c.s0>=h)return[[u,h]];let f=[];return c.s0>u&&f.push([u,c.s0]),c.s1{let u=(c-s)/(o-s||1);return[i.a[0]+(i.b[0]-i.a[0])*u,i.a[1]+(i.b[1]-i.a[1])*u]};return a.filter(([c,u])=>u-c>1e-4).map(([c,u])=>s<=o?[l(c),l(u)]:[l(u),l(c)])}var Ly=["body","wood","fabric","white","metal","dark"];var Fe={body:1516088,bodyTop:1911623,fabric:1713732,fabricTop:2241114,cushion:2373217,wood:1647420,woodTop:2108747,white:1911110,whiteTop:2504542,metal:2767456,dark:725279,glass:1849938,plant:1191982,plantTop:1721664,pot:1910336,accent:2854835},He=(i,e=i)=>({side:i,top:e}),q={body:He(Fe.body,Fe.bodyTop),fabric:He(Fe.fabric,Fe.fabricTop),cushion:He(Fe.cushion),cushionSoft:He(Fe.cushion,Fe.fabricTop),wood:He(Fe.wood,Fe.woodTop),white:He(Fe.white,Fe.whiteTop),worktop:He(Fe.whiteTop),metal:He(Fe.metal),dark:He(Fe.dark),darkBody:He(Fe.dark,Fe.body),glass:He(Fe.glass),accent:He(Fe.accent),pot:He(Fe.pot),plant:He(Fe.plant,Fe.plantTop),bedding:He(Fe.white,Fe.whiteTop),pillow:He(Fe.whiteTop)};var ue=ke(5995775,.3),Te=ke(5995775,.17),Ze=ke(3662079,.45);var sp={...Fe},Fy=Object.fromEntries(Object.entries(q).map(([i,e])=>[i,{...e}])),Ny="",jE=i=>typeof i=="string"&&/^#[0-9a-f]{6}$/i.test(i)?Number.parseInt(i.slice(1),16):null;function Oy(i){let e=Object.fromEntries(Ly.map(s=>[s,jE(i?.[s])]).filter(([,s])=>s!==null)),t=JSON.stringify(e);if(t===Ny)return!1;Ny=t,Object.assign(Fe,sp);for(let[s,o]of Object.entries(Fy))Object.assign(q[s],o);let n=s=>ke(s,1.25).getHex(),r=(s,o,a,l)=>{let c=e[s];if(c===void 0)return;for(let h of o)Fe[h]=c;for(let h of a)Fe[h]=n(c);let u=new Map([...o.map(h=>[sp[h],c]),...a.map(h=>[sp[h],n(c)])]);for(let h of l){let f=Fy[h];q[h].side=u.get(f.side)??q[h].side,q[h].top=u.get(f.top)??q[h].top}};return r("body",["body"],["bodyTop"],["body","darkBody"]),r("wood",["wood"],["woodTop"],["wood"]),r("fabric",["fabric","cushion"],["fabricTop"],["fabric","cushion","cushionSoft"]),r("white",["white"],["whiteTop"],["white","worktop","bedding","pillow"]),r("metal",["metal"],[],["metal"]),r("dark",["dark"],[],["dark","darkBody"]),!0}function Dy(i){let e=i(0,0),t=i(1,0),n=i(0,1);return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])<0}function Ss(i,e){let t=(n,r,s)=>{if(n)for(let o=0;othis.plan(e+(o-e)*r-(a-t)*s,t+(o-e)*s+(a-t)*r))}seg(e,t,n,r,s,o,a=ue){this.edge(this.plan(e,n),this.plan(r,o),t,s,a)}edge(e,t,n,r,s){this.lines.seg([e[0],n,e[1]],[t[0],r,t[1]],s,$e)}block({x:[e,t],y:[n,r],z:[s,o]},a,l=null){if(t-e<1e-4||o-s<1e-4||r-n<1e-4)return;let c=[this.plan(e,s),this.plan(e,o),this.plan(t,o),this.plan(t,s)];Tt(this.buf,Hr(c),n,r,a.side,a.top,{aoFrom:0,bottom:n>.05}),l&&c.forEach((u,h)=>{this.edge(u,c[(h+1)%4],r,r,l),this.edge(u,u,n,r,l)})}prism(e,t,n,r,s=null){if(e.length<3||n-t<1e-4)return;let o=e.map(([a,l])=>this.plan(a,l));Tt(this.buf,Hr(o),t,n,r.side,r.top,{aoFrom:Math.min(0,t),bottom:!0}),s&&o.forEach((a,l)=>this.edge(a,o[(l+1)%o.length],n,n,s))}loft(e,t,n,r,s,o=null){if(r-n<1e-4)return;let a=u=>[this.plan(u[0],u[2]),this.plan(u[0],u[3]),this.plan(u[1],u[3]),this.plan(u[1],u[2])],l=a(e),c=a(t);if(l!==Hr(l)&&(l.reverse(),c.reverse()),Qd(this.buf,l,c,n,r,s.side,s.top),o)for(let u=0;u<4;u++)this.edge(c[u],c[(u+1)%4],r,r,o),this.edge(l[u],c[u],n,r,o)}sweep(e,t,n=16,r=2.6,s=null){if(e.length<2)return;let o=e.map(a=>{let[l,c]=[Math.max(.004,(a.y1-a.y0)/2),Math.max(.004,a.hw)],u=(a.y0+a.y1)/2;return Array.from({length:n},(h,f)=>{let d=f/n*Math.PI*2,[p,x]=[Math.cos(d),Math.sin(d)],[g,m]=this.plan(a.x+c*Math.sign(p)*Math.abs(p)**(2/r),a.z);return[g,u+l*Math.sign(x)*Math.abs(x)**(2/r),m]})});if(ep(this.buf,o,t.side,t.top),s){let a=Math.round(n/4);for(let l=0;l+1.005&&this.block({x:[s,o],y:[a+h,l-h],z:[c,u]},f,r),this.loft([s,o,c,u],[s+h,o-h,c+h,u-h],l-h,l,t)}lyingCylinder(e,t,n,r,s,o,a,l,c=12,u=null){let h=Math.min(a,s-r)/2;if(h<1e-4||o<1e-4)return;let f=(r+s)/2,[d,p]=e==="x"?[t,n]:[n,t],x=(m,y)=>e==="x"?this.plan(m,y):this.plan(y,m),g=this.buf.p.length;if(tp(this.buf,x,d-o/2,d+o/2,p,f,h,l.side,l.top,c),this.mirrored!==(e==="z")&&Ss(this.buf,g),!!u)for(let m of[d-o/2,d+o/2])for(let y=0;ythis.plan(e+Math.cos(h/a*Math.PI*2)*n,t+Math.sin(h/a*Math.PI*2)*n));Tt(this.buf,Hr(c),r,s,o.side,o.top,{aoFrom:0,bottom:r>.05}),l&&c.forEach((u,h)=>this.edge(u,c[(h+1)%a],s,s,l))}ring(e,t,n,r,s=20,o=ue){for(let a=0;a[e(-t/2-p,-n/2-p),e(t/2+p,-n/2-p),e(t/2+p,n/2+p),e(-t/2-p,n/2+p)],[u,h]=[c(0),c(s)],f=p=>[p[0],l,p[1]],d=i.p.length;i.tri(f(u[0]),f(u[1]),f(u[2]),o),i.tri(f(u[0]),f(u[2]),f(u[3]),o);for(let p=0;p<4;p++){let x=(p+1)%4;i.tri(f(u[p]),f(h[p]),f(h[x]),o,a,a),i.tri(f(u[p]),f(h[x]),f(u[x]),o,a,o)}Dy(e)&&Ss(i,d)}function op(i,e){if(!i)return null;if(i.startsWith("#"))return Number.parseInt(i.slice(1),16);let t=Fe;return(e?t[`${i}Top`]:void 0)??t[i]??null}function ws(i,e,t,n,r,s,o,a=null,l=null,c=null){let u=e.colors?.length?(e.colors.find(f=>f.id===l)??e.colors[0]).hex:null,h=ia(e,t,n,r);for(let f of c===null?h:tg(h,c)){if(c===null&&f.move||a&&!a(f))continue;let d=a?{...f,glow:!0,w:f.w+.006/t,d:f.d+.006/n,y:Math.max(0,f.y-.002/r),h:f.h+.004/r}:f,p=d.glow&&o!==null,x=!!(d.paint&&u),g=x?u:d.color,m=p?o:op(g,!1)??Fe.body,y=p?o:op(x?void 0:d.top,!1)??op(g,!0)??ke(m,1.25).getHex(),_=He(m,y),[b,M]=[s+d.y*r,s+Math.min(r,(d.y+d.h)*r)],S=d.edges==="glow"?Li:d.edges==="faint"?Te:d.edges?ue:null,v=d.rot?i.turned(d.x*t,d.z*n,d.rot):i,[w,R]=[d.x*t,d.z*n];if(d.shape==="cyl"&&(d.axis==="x"||d.axis==="z"))v.lyingCylinder(d.axis,w,R,b,M,d.axis==="x"?d.w*t:d.d*n,d.axis==="x"?d.d*n:d.w*t,_,14,S);else if(d.shape==="cyl")v.cylinder(w,R,Math.min(d.w*t,d.d*n)/2,b,M,_,14,S);else if(d.shape==="loft"){let[T,C,L,O]=[d.tx??d.x,d.tz??d.z,d.tw??d.w,d.td??d.d];v.loft([(d.x-d.w/2)*t,(d.x+d.w/2)*t,(d.z-d.d/2)*n,(d.z+d.d/2)*n],[(T-L/2)*t,(T+L/2)*t,(C-O/2)*n,(C+O/2)*n],b,M,_,S)}else if(d.shape==="sweep"){let T=(d.stations??[]).map(([C,L,O,P])=>({x:w,z:C*n,y0:s+L*r,y1:s+O*r,hw:P*t/2}));v.sweep(T,_,d.n??16,d.exp??2.6,S)}else v.block({x:[(d.x-d.w/2)*t,(d.x+d.w/2)*t],y:[b,M],z:[(d.z-d.d/2)*n,(d.z+d.d/2)*n]},_,S)}}function Ts(i){let[e,t]=[Math.cos(i.rotation*mt),Math.sin(i.rotation*mt)],n=i.mirror?-1:1;return(r,s)=>[i.x+n*r*e-s*t,i.z+n*r*t+s*e]}var ap=i=>[Math.max(.05,i.w),Math.max(.05,i.d),Math.max(.005,i.h)];function ll(i,e,t,n,r,s=o=>!!o.glow){ws(new Fi(i,new Wt,Ts(t)),e,...ap(t),n,r,s)}function lp(i,e,t,n,r){let s=i.p.length;ws(new Fi(i,new Wt,Ts(t)),e,...ap(t),n,null,null,t.variant??null,r),t.mirror&&Ss(i,s)}function cl(i,e,t,n,r){ws(new Fi(i,new Wt,Ts(t)),e,...ap(t),n,r)}function By(i){let e=2166136261;for(let t=0;t(e=Math.imul(e^e>>>15,2246822507),e=Math.imul(e^e>>>13,3266489909),e^=e>>>16,(e>>>0)/4294967296)}var QE=(i,e,t)=>{let[n,r]=[t[0]-e[0],t[1]-e[1]],s=n*n+r*r||1e-9,o=Math.max(0,Math.min(1,((i[0]-e[0])*n+(i[1]-e[1])*r)/s));return Math.hypot(i[0]-e[0]-n*o,i[1]-e[1]-r*o)};function eR(i,e,t=.25){if(!Ge(e,i.points))return!1;let n=i.points;for(let r=0;rGe(e,r))}function tR(i,e,t){let n=i.obstacles.filter(s=>!Ge(e,s)),r=Math.max(1,Math.ceil(Math.hypot(t[0]-e[0],t[1]-e[1])/.1));for(let s=1;s<=r;s++){let o=[e[0]+(t[0]-e[0])*s/r,e[1]+(t[1]-e[1])*s/r];if(n.some(a=>Ge(o,a)))return!1}return!0}function nR(i,e,t){let n=i.points.map(c=>c[0]),r=i.points.map(c=>c[1]),[s,o,a,l]=[Math.min(...n),Math.max(...n),Math.min(...r),Math.max(...r)];for(let c=0;c<24;c++){let u=[s+(o-s)*t(),a+(l-a)*t()];if(Math.hypot(u[0]-e[0],u[1]-e[1])>.6&&eR(i,u)&&tR(i,e,u))return u}return null}function iR(i,e,t,n){if(!i.target){if(i.rest-=t,i.rest>0)return!1;if(i.target=nR(e,i.pos,n),!i.target)return i.rest=2,!1}let[r,s]=[i.target[0]-i.pos[0],i.target[1]-i.pos[1]],o=Math.hypot(r,s),l=Math.atan2(r,s)-i.heading;for(;l>Math.PI;)l-=2*Math.PI;for(;l<-Math.PI;)l+=2*Math.PI;i.heading+=Math.max(-4*t,Math.min(4*t,l));let c=e.speed*t*(Math.abs(l)>1.2?.3:1);return o<=c?(i.pos=[i.target[0],i.target[1]],i.target=null,i.rest=2+n()*6,!0):(i.pos=[i.pos[0]+r/o*c,i.pos[1]+s/o*c],!0)}function ky(i,e,t,n){let r=Math.min(.2,Math.max(0,t));return i.target||(i.rest-=Math.max(0,t)-r),iR(i,e,r,n)}function zy(){let e=navigator.deviceMemory??8,t=navigator.hardwareConcurrency||8;return e<=3||t<=4||/Silk|KF[A-Z]{2,4}\b/.test(navigator.userAgent)}var Vu=class{times=[];settle=30;ratio;lastDown=-1/0;slowAtFloor=0;max;min;constructor(e,t=1){this.max=e,this.min=t,this.ratio=e}get pixelRatio(){return this.ratio}frame(e,t){if(this.settle>0)return this.settle--,null;if(e<=0||e>=100||(this.times.push(e),this.times.length<45))return null;let n=[...this.times].sort((s,o)=>s-o);this.times=[];let r=1e3/n[Math.floor(n.length/2)];return r<26&&this.ratio>this.min+1e-6?(this.ratio=Math.max(this.min,Math.round((this.ratio-.25)*100)/100),this.lastDown=t,this.settle=30,{ratio:this.ratio}):r<16&&this.ratio<=this.min+1e-6?++this.slowAtFloor>=2?{low:!0}:null:(this.slowAtFloor=0,r>55&&this.ratio3e4?(this.ratio=Math.min(this.max,Math.round((this.ratio+.25)*100)/100),this.settle=30,{ratio:this.ratio}):null)}};function Vy(i){let e=i.length/3,t=new Float32Array(e);for(let n=0;n0&&(t[n]=r)}return t}function Gy(i,e,t,n){for(let r=t.start*3;rMath.tan(Math.min(80,Math.max(0,i))*Gu);function As(i){return{x0:Math.min(i.x0,i.x1),x1:Math.max(i.x0,i.x1),z0:Math.min(i.z0,i.z1),z1:Math.max(i.z0,i.z1)}}function Hy(i){if(!i.rotation)return null;let e=i.rotation*Gu;return{cx:(i.x0+i.x1)/2,cz:(i.z0+i.z1)/2,c:Math.cos(e),sn:Math.sin(e)}}function Wy(i,e){let t=Hy(i);if(!t)return e;let[n,r]=[e[0]-t.cx,e[1]-t.cz];return[t.cx+n*t.c-r*t.sn,t.cz+n*t.sn+r*t.c]}function cp(i,e,t){let n=Hy(i);if(!n)return[e,t];let[r,s]=[e-n.cx,t-n.cz];return[n.cx+r*n.c+s*n.sn,n.cz-r*n.sn+s*n.c]}function Xy(i,e=0){let{x0:t,x1:n,z0:r,z1:s}=As(i);return[[t-e,r-e],[n+e,r-e],[n+e,s+e],[t-e,s+e]].map(o=>Wy(i,o))}function Dn(i){let{x0:e,x1:t,z0:n,z1:r}=As(i),s=o=>Wy(i,o);return i.axis==="x"?{u0:e,u1:t,w:r-n,at:(o,a)=>s([o,i.flip?r-a:n+a])}:{u0:n,u1:r,w:t-e,at:(o,a)=>s([i.flip?t-a:e+a,o])}}function Ni(i,e,t){let{x0:n,x1:r,z0:s,z1:o}=As(i),[a,l]=cp(i,e,t);return i.axis==="x"?[a,i.flip?o-l:l-s]:[l,i.flip?r-a:a-n]}var ul=Math.tan(30*Gu);function hl(i,e,t,n,r){let s=Math.min(i*.3,n>1e-6?2.4/n:i*.3),o=Math.min(i*.3,r>1e-6?2.4/r:i*.3),a=e+s*n,l=t+o*r,c=Math.min(i-o,Math.max(s,(l-a+ul*(i-o+s))/(2*ul))),u=a+(c-s)*ul;return{vla:s,vlb:o,yla:a,ylb:l,vr:c,rh:u,y:f=>f<=s?e+f*n:f<=c?a+(f-s)*ul:f<=i-o?l+(i-o-f)*ul:t+(i-f)*r}}function En(i){let e=Dn(i).w,[t,n]=[i.eave_a,i.eave_b],[r,s]=[fr(i.pitch_a),fr(i.pitch_b)];switch(i.shape){case"flat":case"parapet":return{vr:e/2,rh:t,y:()=>t};case"pent":return{vr:e,rh:t+e*r,y:o=>t+o*r};case"mansard":{let o=hl(e,t,n,r,s);return{vr:o.vr,rh:o.rh,y:o.y}}default:{let o=r+s>1e-6?Math.min(e,Math.max(0,(n-t+e*s)/(r+s))):e/2;return{vr:o,rh:t+o*r,y:a=>a<=o?t+a*r:n+(e-a)*s}}}}var up=i=>En(i).rh;var xt=(i,e)=>[i[0]-e[0],i[1]-e[1]],Oi=(i,e)=>[i[0]+e[0],i[1]+e[1]],hi=(i,e)=>[i[0]*e,i[1]*e],bn=(i,e)=>i[0]*e[0]+i[1]*e[1],Rn=(i,e)=>i[0]*e[1]-i[1]*e[0],Zn=i=>Math.hypot(i[0],i[1]),fi=i=>{let e=Zn(i)||1;return[i[0]/e,i[1]/e]},hp=i=>[-i[1],i[0]],fp=i=>[i[1],-i[0]];function Yy(i){let e=i.heightEnd!==void 0;return{...i,a:i.b,b:i.a,left:i.right,right:i.left,roomLeft:i.roomRight,roomRight:i.roomLeft,height:e?i.heightEnd:i.height,heightEnd:e?i.height:void 0}}function rR(i,e){let t=i.map(n=>({...n}));for(let n of e){let r=t.find(s=>s.room_id===n.room_id&&s.edge===n.edge&&(Math.abs(s.t1-n.t0)<1e-6||Math.abs(n.t1-s.t0)<1e-6));r?(r.t0=Math.min(r.t0,n.t0),r.t1=Math.max(r.t1,n.t1)):t.push({...n})}return t}function sR(i,e,t){if(i.a===e.b)return!1;let n=fi(xt(t[i.b],t[i.a])),r=fi(xt(t[e.b],t[e.a]));return Math.abs(Rn(n,r))>1e-6||bn(n,r)<=0||i.free||e.free||i.heightEnd!==void 0||e.heightEnd!==void 0?!1:i.height===e.height&&i.exterior===e.exterior&&i.roomLeft===e.roomLeft&&i.roomRight===e.roomRight&&Math.abs(i.left-e.left)<=1e-9&&Math.abs(i.right-e.right)<=1e-9}function qy(i,e,t=new Set){let n=i.slice();for(;;){let r=new Map;n.forEach((o,a)=>{for(let l of[o.a,o.b])r.set(l,[...r.get(l)??[],a])});let s=null;for(let[o,a]of r){if(a.length!==2||t.has(o))continue;let l=n[a[0]].b===o?n[a[0]]:Yy(n[a[0]]),c=n[a[1]].a===o?n[a[1]]:Yy(n[a[1]]);if(!sR(l,c,e))continue;let u={...l,b:c.b,sources:rR(l.sources,c.sources)};s=[...n.filter((h,f)=>f!==a[0]&&f!==a[1]),u];break}if(!s)return n;n=s}}function $y(i,e){let t=new Map;i.forEach((r,s)=>{let o=fi(xt(e[r.b],e[r.a])),a=[[r.a,{key:`${s}:a`,d:o,left:r.left,right:r.right,angle:Math.atan2(o[1],o[0])}],[r.b,{key:`${s}:b`,d:hi(o,-1),left:r.right,right:r.left,angle:Math.atan2(-o[1],-o[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[r,s]of t){let o=e[r];s.sort((l,c)=>l.angle-c.angle);for(let l of s)n.set(l.key,{left:Oi(o,hi(hp(l.d),l.left)),right:Oi(o,hi(fp(l.d),l.right))});if(s.length<2)continue;let a=4*Math.max(...s.map(l=>Math.max(l.left,l.right)))+1e-9;s.forEach((l,c)=>{let u=s[(c+1)%s.length],h=Oi(o,hi(hp(l.d),l.left)),f=Oi(o,hi(fp(u.d),u.right)),d=Rn(l.d,u.d);if(Math.abs(d)<1e-4)return;let p=Oi(h,hi(l.d,Rn(xt(f,h),u.d)/d));Zn(xt(p,o))>a||(n.get(l.key).left=p,n.get(u.key).right=p)})}return n}function Ky(i,e){let t=i.filter((n,r)=>Zn(xt(n,i[(r+1)%i.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((r,s)=>{let o=t[(s+t.length-1)%t.length],a=t[(s+1)%t.length],[l,c]=[xt(r,o),xt(a,r)];return Math.abs(Rn(fi(l),fi(c)))<1e-7&&bn(l,c)>0});if(n===-1)return t;t=t.filter((r,s)=>s!==n)}}function oR(i){let e=[];return{points:e,idOf(t){let n=e.findIndex(r=>Math.abs(r[0]-t[0])<=i&&Math.abs(r[1]-t[1])<=i);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function aR(i,e){let t=[];for(let n of i){let r=n.points;if(r.length<3||Math.abs(ts(r))<1e-6)continue;let s=ts(r)>0,o=r.map(a=>e.idOf(a));o.forEach((a,l)=>{let c=o[(l+1)%o.length];a!==c&&t.push(s?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function lR(i,e,t){let n=[];for(let r of i){let[s,o]=[e[r.u],e[r.v]],a=xt(o,s),l=Zn(a),c=hi(a,1/l),u=e.map((f,d)=>({id:d,rel:xt(f,s)})).filter(({id:f,rel:d})=>f!==r.u&&f!==r.v&&bn(d,c)>t&&bn(d,c)({t:bn(d,c),id:f})).sort((f,d)=>f.t-d.t),h=[{t:0,id:r.u},...u,{t:l,id:r.v}];for(let f=0;f+1({room_id:i.room,edge:i.edge,t0:i.t0,t1:i.t1});function cR(i,e){let t=new Map(i.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let r=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},s=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[h,f]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(f[0]-h[0],f[1]-h[1])}},o=a=>{let l=s(a);if(!l||l.length<1e-9){let u=r(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let h of a){let[f,d]=o(h),[p,x]=h===a[0]?[f,d]:[d,f];p!==null&&(l=Math.min(l,p)),x!==null&&(c=Math.min(c,x))}let u=a.map(h=>t.get(h.room)?.ceiling);if(u.every(h=>typeof h=="number"&&h>0)){let h=Math.max(...u);l===1/0&&(l=h),c===1/0&&(c=h)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.some(l=>r(l)===0)}}function Jy(i){let e=t=>Math.round(t*1e6)/1e6;return i.a===void 0||i.b===void 0?i.a!==void 0?{height:e(i.a)}:i.b!==void 0?{height:e(i.b)}:{}:Math.abs(i.a-i.b)<1e-6?{height:e(i.a)}:{height:e(i.a),heightEnd:e(i.b)}}function uR(i,e,t,n){let r=cR(e,i),s=new Map;for(let l of i){let c=l.uf!==c&&f.u===c.v&&f.v===c.u&&f.room!==c.room);for(let f of l)f!==c&&f!==u&&f.room!==c.room&&n.push(`overlap:${c.room}:${f.room}`);let h=u?[c,u]:[c];if(r.hasNoWall(h)){u&&a.push([c.room,u.room]);continue}if(u){let f=r.thicknessOf(h)??t.interior;o.push({a:c.u,b:c.v,left:f/2,right:f/2,exterior:!1,roomLeft:c.room,roomRight:u.room,sources:h.map(Zy),...Jy(r.heightsOf(h))})}else o.push({a:c.u,b:c.v,left:0,right:r.thicknessOf(h)??t.exterior,exterior:!0,roomLeft:c.room,roomRight:null,sources:[Zy(c)],...Jy(r.heightsOf(h))})}return{drafts:o,open:a}}function hR(i,e){let t=s=>fi(xt(e[s.b],e[s.a])),n=i.filter(s=>!s.exterior&&!s.free),r=new Map;for(let s of n){if(r.has(s))continue;let o=[s];r.set(s,o);for(let a=0;a1e-6||l.add(bn(o,d)>0?"left":"right")}if(l.size!==1)continue;let c=[...l][0];for(let u of s){let h=u.left+u.right,f=bn(t(u),o)>0,d=c==="left"===f;[u.left,u.right]=d?[0,h]:[h,0]}}}var fR=(i,e)=>{let t=s=>Math.round(s*100),[n,r]=i[0]Math.hypot(m.b[0]-m.a[0],m.b[1]-m.a[1])>.05),l=a.map(m=>[s.idOf(m.a),s.idOf(m.b)]),c=new Set;for(let m of i){let y=m.points;y.length<3||(m.wall_splits??[]).forEach((_,b)=>{if(!_||b>=y.length)return;let M=y[b],S=xt(y[(b+1)%y.length],M),v=Zn(S);for(let w of _)w>n&&w{let[_,b]=l[y];if(_===b)return;let M=[(m.a[0]+m.b[0])/2,(m.a[1]+m.b[1])/2],S=i.find(w=>w.points.length>=3&&Ge(M,w.points))?.id??null,v=(m.thickness??e.interior)/2;d.push({free:m.id,a:_,b,left:v,right:v,exterior:!1,roomLeft:S,roomRight:S,sources:[],height:typeof m.height=="number"&&m.height>0?m.height:void 0,...typeof m.height=="number"&&m.height>0&&typeof m.height_end=="number"&&m.height_end>0&&Math.abs(m.height_end-m.height)>1e-6?{heightEnd:m.height_end}:{}})});let p=qy(d,s.points,c),x=$y(p,s.points);return{walls:p.map((m,y)=>{let[_,b]=[s.points[m.a],s.points[m.b]],[M,S]=[x.get(`${y}:a`),x.get(`${y}:b`)],v=Ky([M.right,S.left,b,S.right,M.left,_],1e-6);return{id:fR(_,b),a:[_[0],_[1]],b:[b[0],b[1]],left:m.left,right:m.right,exterior:m.exterior,roomLeft:m.roomLeft,roomRight:m.roomRight,sources:m.sources,footprint:v,...m.free?{free:m.free}:{},...m.height!==void 0?{height:m.height}:{},...m.heightEnd!==void 0?{heightEnd:m.heightEnd}:{}}}),warnings:[...new Set(r)],open:f}}function jy(i,e,t){let n=i.points[e];return Oi(n,hi(fi(xt(i.points[(e+1)%i.points.length],n)),t))}function Qy(i,e,t){if(i.wall){let r=t.find(a=>a.id===i.wall);if(!r||Math.hypot(r.b[0]-r.a[0],r.b[1]-r.a[1])<.05)return null;let s=fi(xt(r.b,r.a));return{room:{id:i.room_id,name:"",area_id:null,points:[r.a,r.b,Oi(r.a,[-s[1],s[0]])]},edge:0}}let n=e.find(r=>r.id===i.room_id);return n&&i.edgebn(xt(e,i.a),fi(xt(i.b,i.a)));function tb(i,e,t){if(!e.wall)return dR(i,t.room,t.edge,e.offset);let n=i.find(r=>r.free===e.wall);return n?{wall:n,s:eb(n,jy(t.room,0,e.offset))}:null}function dR(i,e,t,n){for(let r of i)if(r.sources.some(o=>o.room_id===e.id&&o.edge===t&&n>=o.t0-1e-6&&n<=o.t1+1e-6))return{wall:r,s:eb(r,jy(e,t,n))};return null}var nb=([i,e])=>{let t=Math.hypot(i,e)||1;return[i/t,e/t]};function pR(i){return i.reduce((e,t,n)=>e+(t[0]*i[(n+1)%i.length][1]-i[(n+1)%i.length][0]*t[1]),0)/2}function Hu(i,e){let t=i.length;if(t<3||Math.abs(e)<1e-9)return i.map(([r,s])=>[r,s]);let n=pR(i)>=0?1:-1;return i.map((r,s)=>{let o=i[(s+t-1)%t],a=i[(s+1)%t],[l,c]=nb([r[0]-o[0],r[1]-o[1]]),[u,h]=nb([a[0]-r[0],a[1]-r[1]]),f=[c*n,-l*n],d=[h*n,-u*n],p=[f[0]+d[0],f[1]+d[1]],x=Math.hypot(p[0],p[1]);if(x<1e-6)return[r[0]+f[0]*e,r[1]+f[1]*e];let g=(p[0]*f[0]+p[1]*f[1])/x,m=Math.min(4,1/Math.max(.25,g));return[r[0]+p[0]/x*e*m,r[1]+p[1]/x*e*m]})}function dp(i,e){if(i.points&&i.points.length>=3)return Hu(i.points,e);if(i.rotation)return Xy(i,e);let t=Math.min(i.x0,i.x1)-e,n=Math.max(i.x0,i.x1)+e,r=Math.min(i.z0,i.z1)-e,s=Math.max(i.z0,i.z1)+e;return[[t,r],[n,r],[n,s],[t,s]]}function Wr(i,e){let t=Dn(i),n=En(i),r=t.w,[s,o]=[Math.max(0,e.a),Math.max(0,e.b)],a=t.u0-Math.max(0,e.u0),l=t.u1+Math.max(0,e.u1),c=(m,y)=>[m,y,n.y(y)],u=c(a,-s),h=c(l,-s),f=c(l,r+o),d=c(a,r+o),[p,x]=[fr(i.pitch_a),fr(i.pitch_b)],g=m=>[m,n.vr,n.rh];if(i.ends&&(i.shape==="gable"||i.shape==="hip"||i.shape==="halfhip")){let m=(t.u1-t.u0)/2,y=Math.min(m,Math.min(n.vr,r-n.vr)||r/2),_=Math.min(n.y(0),n.y(r)),b=_+(n.rh-_)*Math.min(.9,Math.max(.2,i.halfhip??.55)),M=p>1e-6?Math.min(n.vr,(b-i.eave_a)/p):n.vr,S=x>1e-6?Math.max(n.vr,r-(b-i.eave_b)/x):n.vr,v=Math.min(m-.1,(n.rh-b)/Math.max(.2,p)),w=[[0,n.y(0)],[n.vr,n.rh],[r,n.y(r)]],R=[[0,n.y(0)],[M,b],[S,b],[r,n.y(r)]],T=(F,H,B)=>{if(F==="hip")return{upA:[],upB:[],ridge:g(H===a?t.u0+y*B:t.u1-y*B),profile:null};if(F==="halfhip"){let X=g(H===a?t.u0+v:t.u1-v);return{upA:[[H,M,b]],upB:[[H,S,b]],ridge:X,profile:R}}return{upA:[],upB:[],ridge:g(H),profile:w}},C=T(i.ends[0],a,1),L=T(i.ends[1],l,1),O=[[u,h,...L.upA,L.ridge,C.ridge,...[...C.upA].reverse()],[C.ridge,L.ridge,...[...L.upB].reverse(),f,d,...C.upB]],P=[[C.ridge,L.ridge]];for(let[F,H,B]of[[C,u,d],[L,h,f]])F.profile===null?(O.push(F===C?[d,u,F.ridge]:[h,f,F.ridge]),P.push([H,F.ridge],[B,F.ridge])):F.upA.length&&(O.push(F===C?[F.upB[0],F.upA[0],F.ridge]:[F.upA[0],F.upB[0],F.ridge]),P.push([F.upA[0],F.ridge],[F.upB[0],F.ridge]));let I=F=>F.profile===null?[]:F.upA.length?[F.upA[0],F.upB[0]]:[F.ridge],D=[u,h,...I(L),f,d,...[...I(C)].reverse()];return{faces:O,rim:D,ridges:P,gable:w,endProfiles:[C.profile,L.profile]}}switch(i.shape){case"pent":return{faces:[[u,h,f,d]],rim:[u,h,f,d],ridges:[[f,d]],gable:[[0,n.y(0)],[r,n.y(r)]]};case"hip":case"pyramid":{let m=(t.u1-t.u0)/2,y=i.shape==="pyramid"?m:Math.min(m,Math.min(n.vr,r-n.vr)||r/2),_=g(t.u0+y),b=g(t.u1-y);return i.shape==="pyramid"?{faces:[[u,h,_],[h,f,_],[f,d,_],[d,u,_]],rim:[u,h,f,d],ridges:[[u,_],[d,_],[h,_],[f,_]],gable:null}:{faces:[[u,h,b,_],[_,b,f,d],[d,u,_],[h,f,b]],rim:[u,h,f,d],ridges:[[_,b],[u,_],[d,_],[h,b],[f,b]],gable:null}}case"halfhip":{let m=Math.min(n.y(0),n.y(r)),y=m+(n.rh-m)*Math.min(.9,Math.max(.2,i.halfhip??.55)),_=p>1e-6?Math.min(n.vr,(y-i.eave_a)/p):n.vr,b=x>1e-6?Math.max(n.vr,r-(y-i.eave_b)/x):n.vr,M=Math.min((t.u1-t.u0)/2-.1,(n.rh-y)/Math.max(.2,p)),S=g(t.u0+M),v=g(t.u1-M),w=[a,_,y],R=[a,b,y],T=[l,_,y],C=[l,b,y];return{faces:[[u,h,T,v,S,w],[S,v,C,f,d,R],[R,w,S],[T,C,v]],rim:[u,h,T,C,f,d,R,w],ridges:[[S,v],[w,S],[R,S],[T,v],[C,v]],gable:[[0,n.y(0)],[_,y],[b,y],[r,n.y(r)]]}}case"mansard":{let m=hl(r,i.eave_a,i.eave_b,p,x),y=[a,m.vla,m.yla],_=[l,m.vla,m.yla],b=[a,r-m.vlb,m.ylb],M=[l,r-m.vlb,m.ylb],S=[a,m.vr,m.rh],v=[l,m.vr,m.rh];return{faces:[[u,h,_,y],[y,_,v,S],[S,v,M,b],[b,M,f,d]],rim:[u,h,_,v,M,f,d,b,S,y],ridges:[[S,v],[y,_],[b,M]],gable:[[0,n.y(0)],[m.vla,m.yla],[m.vr,m.rh],[r-m.vlb,m.ylb],[r,n.y(r)]]}}default:{let m=g(a),y=g(l);return{faces:[[u,h,y,m],[m,y,f,d]],rim:[u,h,y,f,d,m],ridges:[[m,y]],gable:[[0,n.y(0)],[n.vr,n.rh],[r,n.y(r)]]}}}}function Es(i,e,t){let n=null;for(let r of i.faces){if(!Ge([e,t],r.map(([f,d])=>[f,d])))continue;let[s,o]=r,a=r.slice(2).find(f=>Math.abs((o[0]-s[0])*(f[1]-s[1])-(o[1]-s[1])*(f[0]-s[0]))>1e-9);if(!a)continue;let l=[o[0]-s[0],o[2]-s[2],o[1]-s[1]],c=[a[0]-s[0],a[2]-s[2],a[1]-s[1]],u=[l[1]*c[2]-l[2]*c[1],l[2]*c[0]-l[0]*c[2],l[0]*c[1]-l[1]*c[0]];if(Math.abs(u[1])<1e-9)continue;let h=s[2]-(u[0]*(e-s[0])+u[2]*(t-s[1]))/u[1];n=n===null?h:Math.min(n,h)}return n}function Lo(i,e,t,n){let r=o=>n?o[e]<=t+1e-9:o[e]>=t-1e-9,s=[];return i.forEach((o,a)=>{let l=i[(a+1)%i.length];if(r(o)&&s.push(o),r(o)!==r(l)){let c=(t-o[e])/(l[e]-o[e]);s.push([o[0]+(l[0]-o[0])*c,o[1]+(l[1]-o[1])*c,o[2]+(l[2]-o[2])*c])}}),s}function Wu(i,e){let t=Lo(Lo(i,0,e.u0,!1),0,e.u1,!0);return[Lo(i,0,e.u0,!0),Lo(i,0,e.u1,!1),Lo(t,1,e.v0,!0),Lo(t,1,e.v1,!1)].filter(r=>r.length>=3&&Math.abs(Sr(r.map(([s,o])=>[s,o])))>1e-6)}function dl(i,e,t){let n=Dn(e),r=i.floors.flatMap(h=>h.rooms.filter(f=>f.points.length>=3&&h.elevation+h.height>e.base+.05)),s=h=>h.some(f=>r.some(d=>Ge(f,d.points))),o=.35,a=[.15,.5,.85].map(h=>n.u0+(n.u1-n.u0)*h),l=[.15,.5,.85].map(h=>n.w*h),c=h=>h?0:t,u=(h,f)=>{let d=e.overhang_sides?.[h];return typeof d=="number"&&Number.isFinite(d)?Math.min(2,Math.max(0,d)):f};return{a:u("a",c(s(a.map(h=>n.at(h,-o))))),b:u("b",c(s(a.map(h=>n.at(h,n.w+o))))),u0:u("u0",c(s(l.map(h=>n.at(n.u0-o,h))))),u1:u("u1",c(s(l.map(h=>n.at(n.u1+o,h)))))}}var Fo=i=>Math.abs((i.x1-i.x0)*(i.z1-i.z0)),Xu=i=>i.shape==="flat"||i.shape==="parapet";function Rs(i,e){let[t,n]=[(e.x0+e.x1)/2,(e.z0+e.z1)/2];return i.filter(s=>{if(s===e||s.dormer||s.open||Xu(s)||Fo(s)=o.x0&&t<=o.x1&&n>=o.z0&&n<=o.z1}).reduce((s,o)=>s===null||Fo(o){let[s,o]=e.at(r,e.w/2),[a,l]=Ni(i,s,o);return Es(t,a,l)??n.y(l)}}function pl(i,e){if(Xu(e))return e;let t=Dn(e),n=En(e).rh,r=ib(i,t),s=r(t.u0)<=r(t.u1),[o,a]=s?[t.u0,t.u1]:[t.u1,t.u0],l=s?1:-1,c=a;for(let f=.5;f=n-.02){c=o+l*f;break}if(Math.abs(c-a)<.05)return e;let u={...e},h=a===t.u1;return e.axis==="x"?u[h?"x1":"x0"]=c:u[h?"z1":"z0"]=c,u}function Yu(i,e){let t=pl(i,e),n=Dn(t),r=En(t),s=ib(i,n),o=s(n.u0)<=s(n.u1),a=n.u1-n.u0,l=Math.max(1,Math.ceil(a/.15)),c=[];for(let u=0;ux+.02&&(g=Math.min(g,M),m=Math.max(m,M))}if(!(m-g>.05))continue;let y=Ni(i,...n.at(d,g)),_=Ni(i,...n.at(p,m));c.push({u0:Math.min(y[0],_[0]),u1:Math.max(y[0],_[0]),v0:Math.min(y[1],_[1]),v1:Math.max(y[1],_[1])})}return c}function ml(i,e){if(e.dormer||e.open||Xu(e)||Rs(i,e))return null;let t=As(e),n=.35;for(let r of i){if(r===e||r.dormer||r.open||Xu(r)||r.axis===e.axis||Fo(r)a[3]+.05)continue;let l=(o[2]+o[3])/2,[c,u]=e.axis==="z"?["z0","z1"]:["x0","x1"],h;if(Math.abs(o[0]-o[3])<=n)h=[l,o[1]];else if(Math.abs(o[1]-o[2])<=n)h=[o[0],l];else continue;let f={...e,[c]:h[0],[u]:h[1]};return{parent:r,extended:pl(r,f)}}return null}var rb=.14,mR=i=>i.shape==="flat"||i.shape==="parapet";function pp(i,e){return!i.open&&Math.min(i.base,i.eave_a,i.eave_b)l+r||fu+r||o.points&&o.points.length>=3&&!Ge([e,t],o.points))continue;let[d,p]=Ni(o,e,t),x=Math.max(0,o.overhang??n),g=mR(o)?null:Es(Wr(o,{u0:x,u1:x,a:x,b:x}),d,p);s.push((g??En(o).y(p))-rb)}return s.length?Math.max(...s):null}function gp(i,e){let t=i.floors.filter(l=>l.rooms.length>0).sort((l,c)=>l.elevation-c.elevation),n=t.filter(l=>l.elevationu.rooms.some(h=>h.points.length>=3&&l.some(f=>Ge(f,h.points))));if(c)return c}return n.at(-1)??t[0]}function xp(i,e,t){let n=i.settings.roof.sections??[],r=n.filter(l=>t.includes(l.id)).map(l=>Rs(n,l)??l);if(r.length===0)return e.id;let s=Math.max(...r.map(up)),o=l=>l.rooms.some(c=>{if(c.points.length<3)return!1;let u=c.points.reduce((f,d)=>f+d[0],0)/c.points.length,h=c.points.reduce((f,d)=>f+d[1],0)/c.points.length;return r.some(f=>u>=Math.min(f.x0,f.x1)&&u<=Math.max(f.x0,f.x1)&&h>=Math.min(f.z0,f.z1)&&h<=Math.max(f.z0,f.z1))});return i.floors.filter(l=>l.elevation>=e.elevation&&l.elevationc.elevation-l.elevation)[0]?.id??e.id}var No=new U;function sb(i,e,t,n=1.05){return No.set(e[0],e[1],e[2]).project(i),{x:(No.x+1)/2*t.w,y:(1-No.y)/2*t.h,off:No.z>1||Math.abs(No.x)>n||Math.abs(No.y)>n}}var gl=i=>`translate(${i.x}px, ${i.y}px) translate(-50%, -50%)`,ob=(i,e)=>`translate(${i}px, ${e}px) translate(0, -50%)`,qu=class{placed=new WeakMap;place(e,t){let n=t===null;e.hidden!==n&&(e.hidden=n),!(t===null||this.placed.get(e)===t)&&(this.placed.set(e,t),e.style.transform=t)}},gR=8;function ab(i){let e=[...i].sort((t,n)=>n.rank-t.rank).map(t=>({...t}));for(let t=1;tc.xc.x>l.x?c:l),s=8+t.inset,[o,a]=[n.x-e-14,n.y];return o=.99&&i.o>=.9&&!e}function cb(i){return i.to>0&&Math.abs(i.o-i.to)<.05}function ub(i,e,t,n){return e===void 0?{y:t?i*2.4:0,opacity:1}:i>e?{y:5+i,opacity:0}:i===e?{y:0,opacity:1}:n==="stacked"?{y:0,opacity:1}:{y:-.4,opacity:n==="single"?0:.22}}function hb(i,e){let[t,n]=[i.ty-i.y,i.to-i.o];if(Math.abs(t)<.004&&Math.abs(n)<.004){let r=t!==0||n!==0;return r&&([i.y,i.o]=[i.ty,i.to]),{moving:!1,settled:r}}return i.y+=t*e,i.o+=n*e,{moving:!0,settled:!1}}function fb(i,e){let t=e>.999;for(let n of[i.floor,i.wall,i.frames,i.blinds,i.lamps])n.transparent===t&&(n.transparent=!t,n.depthWrite=t,n.needsUpdate=!0),n.opacity=e;for(let n of i.ghosts)n.material.opacity=n.base*e;for(let n of[i.pattern,i.glow,i.lines,i.glass,i.glassWall,i.halos,i.cones,i.screens])n.opacity=e}var bp=i=>1-Math.exp(-i/140);var pb=["open","open2","tilt","tilt2"],vp=i=>1-Math.exp(-i/160),db=(i,e)=>(i??null)===(e??null)||typeof i=="number"&&typeof e=="number"&&Math.abs(i-e)<.003;function _p(i,e){return pb.every(t=>db(e[t]??0,i[t]??0))&&db(e.cover,i.cover)&&!!e.sensed==!!i.sensed&&!!e.unlocked==!!i.unlocked&&!!e.assumed==!!i.assumed}function mb(i,e,t){let n={...i,open2:i.open2??0,tilt2:i.tilt2??0,sensed:e.sensed,unlocked:e.unlocked,assumed:e.assumed},r=!1,s=(o,a)=>Math.abs(a-o)<.003?a:(r=!0,o+(a-o)*t);for(let o of pb)n[o]=s(i[o]??0,e[o]??0);return n.cover=e.cover===null||i.cover===null?e.cover:s(i.cover,e.cover),{state:n,moving:r}}var Cs={ceiling:[.4,.4,.08],downlight:[.1,.1,.02],spot:[.1,.1,.14],panel:[.6,.6,.03],uplight:[.35,.35,1.8],bollard:[.16,.16,.8],garden:[.12,.12,.3],pendant:[.4,.4,.8],fan:[1.32,1.32,.32],floor:[.42,.42,1.7],table:[.26,.26,.45],wall:[.22,.12,.2],strip:[2,.04,.03]},$u=new Set(["ceiling","downlight","spot","panel","pendant","fan","strip"]),xR=1;function gb(i,e,t,n){switch(i){case"ceiling":return[e-.12,"ceiling"];case"downlight":return[e-.03,"spot"];case"spot":return[e-n,"spot"];case"panel":return[e-.05,"ceiling"];case"pendant":return[Math.max(.5,e-n),"pendant"];case"fan":return[Math.max(.5,e-n+.02),"ceiling"];case"floor":return[t+n-.15,"omni"];case"uplight":return[t+n,"up"];case"table":return[t+n-.1,"omni"];case"wall":return[t+.1,"wall"];case"strip":return[t+Math.max(.02,n)-.01,tyR&&d=0&&p<=1&&(l=d)}return l}function vb(i,e,t){let n=i.count,r=e.wedge;if(!r)return{start:n,end:n};let s=(e.rotation??0)*mt,o=[-Math.sin(s),Math.cos(s)],a=r.angle*mt/2,l=new W(...r.color.map(d=>d*r.opacity)),c=new W(0,0,0),u=Math.max(4,Math.round(a/.15)),h=[e.x,e.z],f=(d,p)=>[e.x+(o[0]*Math.cos(d)-o[1]*Math.sin(d))*p,yb,e.z+(o[1]*Math.cos(d)+o[0]*Math.sin(d))*p];for(let d=0;d{i.positions.push(h,f,d);for(let x of t.color)i.colours.push(x*t.level*bR*p)};if(e.lamp==="strip")for(let h of[-.4,-.13,.13,.4])e.upright?u(e.x,a+r*(.5+h),e.z,.6):u(...Ku(e.x,c+Oo(e.base,r,e.rise),e.z,l,r,e.rise,h),.6);else e.lamp==="wall"?u(e.x-Math.sin(l)*(s/2+.05),c,e.z+Math.cos(l)*(s/2+.05),1):u(e.x,c,e.z,1)}function Sb(i,e,t,n){let[r,,s]=e.size??Cs[e.lamp],o=_b(e.lamp,n,e.base??0,s),a=new W(...t.color.map(d=>d*.09*t.level)),l=new W(0,0,0),[c,u]=[Math.max(.03,r/2),.45+.35*t.level],h=16,f=(d,p,x)=>[e.x+Math.cos(d)*p,x,e.z+Math.sin(d)*p];for(let d=0;d$u.has(i);var Tb=7,vR=.25,_R=.3,MR=2,Mp=[1,.82,.55],SR=.45;function Ab(i,e,t,n){return i?`${i.elevation.toFixed(1)},${i.azimuth.toFixed(1)},${e*mt},${t.toFixed(2)},${[...n].map(r=>(r.cover??0).toFixed(2)).join(",")}`:""}var Do=(i,e)=>[Math.sin((e+i)*mt),-Math.cos((e+i)*mt)],Sp=(i,e)=>Math.min(1,i/12)*(1-.8*e),wR=(i,e)=>-i.toRoom[0]*e[0]+-i.toRoom[1]*e[1];function Eb({floor:i,openings:e,states:t,sun:n,northDegrees:r,cloud:s}){let o=new ut;if(!n||n.elevation<=MR||s>=.97)return o;let a=Sp(n.elevation,s),l=Do(n.azimuth,r),c=1/Math.tan(n.elevation*mt);for(let u of e){if(u.opening.type!=="window"||!u.exterior)continue;let h=wR(u,l);if(h<.05)continue;let f=u.top-(t.get(u.opening.id)?.cover??0)*(u.top-u.sill);if(f-u.sill<.05)continue;let d=i.rooms.find(M=>M.id===u.opening.room_id);if(!d||d.points.length<3)continue;let p=(M,S)=>{let v=Math.min(Tb,S*c);return[u.start[0]+u.axis[0]*M+u.toRoom[0]*u.faceRoom-l[0]*v,.02,u.start[1]+u.axis[1]*M+u.toRoom[1]*u.faceRoom-l[1]*v]},x=.14*a*Math.min(1,h*1.5),g=new W(Mp[0]*x,Mp[1]*x,Mp[2]*x),m=g.clone().multiplyScalar(SR),y=Math.max(1,Math.ceil(Math.min(Tb,f*c)/vR)),_=Math.max(1,Math.ceil(u.width/_R)),b=f-u.sill;for(let M=0;Me+Rn(t,i[(n+1)%i.length]),0)/2}var Cb=i=>Rb(i)>=0?[...i]:[...i].reverse();function Pb(i,e,t,n){let r=xt(e,i),s=xt(n,t),o=Rn(r,s);if(Math.abs(o)<1e-12)return null;let a=Rn(xt(t,i),s)/o,l=Rn(xt(t,i),r)/o;return a>dr&&a<1-dr&&l>-dr&&l<1+dr?a:null}function wp(i,e,t){let n=xt(t,e),r=bn(n,n);if(r<1e-12)return null;let s=bn(xt(i,e),n)/r;return s<=dr||s>=1-dr?null:Math.abs(Rn(xt(i,e),n))/Math.sqrt(r)Zn(xt(i,e))i.map((e,t)=>[e,i[(t+1)%i.length]]);function TR(i,e){for(let[t,n]of yl(i))for(let[r,s]of yl(e))if(Pb(t,n,r,s)!==null||wp(r,t,n)!==null||wp(t,r,s)!==null||xl(t,r))return!0;return Ge(i[0],e)||Ge(e[0],i)}function AR(i){let e=i.map(Cb),t=[];e.forEach((s,o)=>{for(let[a,l]of yl(s)){let c=[0,1];e.forEach((u,h)=>{if(h!==o)for(let[f,d]of yl(u)){let p=Pb(a,l,f,d)??wp(f,a,l);p!==null&&c.push(p)}}),c.sort((u,h)=>u-h);for(let u=1;ug!==o&&Ge(p,x))||t.some(([x,g])=>xl(x,h)&&xl(g,f))||t.push([h,f])}}});let n=[],r=new Set;return t.forEach(([s,o],a)=>{if(r.has(a))return;r.add(a);let l=[s],c=o;for(let u=0;u!r.has(d)&&xl(f,c,.001));if(h<0)break;r.add(h),l.push(t[h][0]),c=t[h][1]}l.length>=3&&Rb(l)>1e-6&&n.push(l)}),n}function pr(i){let e=i.filter(s=>s.length>=3),t=e.map((s,o)=>o),n=s=>t[s]===s?s:t[s]=n(t[s]);e.forEach((s,o)=>{for(let a=o+1;ar.set(n(o),[...r.get(n(o))??[],s])),[...r.values()].flatMap(s=>s.length===1?s:AR(s))}function ER(i,e,t){let n=xt(t,e),r=bn(n,n),s=r?Math.max(0,Math.min(1,bn(xt(i,e),n)/r)):0;return Zn(xt(i,[e[0]+n[0]*s,e[1]+n[1]*s]))}function Ib(i,e,t=.03){return i.every(n=>Ge(n,e)||yl(e).some(([r,s])=>ER(n,r,s)<=t))}function Lb(i,e){let t=Cb(i),n=(r,s)=>{let o=xt(s,r),a=Zn(o)||1;return[-o[1]/a,o[0]/a]};return t.map((r,s)=>{let o=n(t[(s-1+t.length)%t.length],r),a=n(r,t[(s+1)%t.length]),l=1+bn(o,a);return l<.1?r:[r[0]+(o[0]+a[0])/l*e,r[1]+(o[1]+a[1])/l*e]})}var RR=30,Fb=i=>i.reduce((e,t,n)=>e+t[0]*i[(n+1)%i.length][1]-i[(n+1)%i.length][0]*t[1],0)/2;function CR(i,e,t,n){if(!t||t.elevation<=2||e<=0||!i.length)return[];let r=Math.min(RR,e/Math.tan(t.elevation*Math.PI/180)),[s,o]=Do(t.azimuth,n),a=c=>[c[0]-s*r,c[1]-o*r],l=[];for(let c of i){l.push([...c],c.map(a));let u=Math.sign(Fb(c))||1;c.forEach((h,f)=>{let d=c[(f+1)%c.length];if(u*((d[1]-h[1])*-s-(d[0]-h[0])*-o)<=1e-9)return;let x=[h,d,a(d),a(h)];Math.abs(Fb(x))>.001&&l.push(x)})}return pr(l)}var Zu=class{mesh;material=new Ye({color:0,side:ht,transparent:!0,opacity:0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});constructor(){this.mesh=new Se(new Pe,this.material),this.mesh.renderOrder=1,this.mesh.visible=!1}update(e,t,n,r,s,o,a){let l=a?[]:CR(e,t,r,s),c=[];for(let h of l){let f=e.filter(p=>Ge([p.reduce((x,g)=>x+g[0],0)/p.length,p.reduce((x,g)=>x+g[1],0)/p.length],h)),d=[...h,...f.flat()];for(let[p,x,g]of Gr(h,f.map(m=>[...m])))for(let m of[d[p],d[x],d[g]])c.push(m[0],n,m[1])}this.mesh.geometry.dispose();let u=new Pe;u.setAttribute("position",new Le(c,3)),this.mesh.geometry=u,this.material.opacity=r?.32*Sp(r.elevation,o):0,this.mesh.visible=c.length>0&&this.material.opacity>.02}dispose(){this.mesh.geometry.dispose(),this.material.dispose()}};var bl=i=>ts(i)>=0?i:[...i].reverse();function vl(i,[e,t],n,r,s,o,a){Tt(i,bl([[e-n,t-n],[e+n,t-n],[e+n,t+n],[e-n,t+n]]),r,s,o,a)}function Ju(i,e,t,n,r,s,o,a,l=0){let[c,u]=[t[0]-e[0],t[1]-e[1]],h=Math.hypot(c,u);if(h<1e-6)return;let[f,d]=[-u/h*n*.5,c/h*n*.5];if(Math.abs(l)<1e-4){Tt(i,bl([[e[0]+f,e[1]+d],[t[0]+f,t[1]+d],[t[0]-f,t[1]-d],[e[0]-f,e[1]-d]]),r,s,o,a,{aoFrom:r-1});return}let p=(b,M)=>[e[0]+f*M,b,e[1]+d*M],x=(b,M)=>[t[0]+f*M,b+l,t[1]+d*M],g=(b,M)=>{for(let[S,v,w]of[[0,1,2],[0,2,3],[0,2,1],[0,3,2]])i.tri(b[S],b[v],b[w],M,M,M,void 0,$e)},m=new W(a),y=ke(o,.9),_=ke(o,.6);g([p(s,1),x(s,1),x(s,-1),p(s,-1)],m),g([p(r,1),x(r,1),x(r,-1),p(r,-1)],_),g([p(r,1),x(r,1),x(s,1),p(s,1)],y),g([p(r,-1),x(r,-1),x(s,-1),p(s,-1)],y),g([p(r,1),p(r,-1),p(s,-1),p(s,1)],y),g([x(r,1),x(r,-1),x(s,-1),x(s,1)],y)}function Nb(i,e,t){let n=(o,a)=>Math.abs(o[0]-a[0])<1e-6&&Math.abs(o[1]-a[1])<1e-6,r=Math.hypot(t[0]-e[0],t[1]-e[1]),s=[];for(let o of i.gates??[]){let a=i.points[o.edge],l=i.points[(o.edge+1)%i.points.length];!a||!l||(n(a,e)&&n(l,t)?s.push({gate:o,offset:o.offset}):n(a,t)&&n(l,e)&&s.push({gate:o,offset:r-o.offset}))}return s.sort((o,a)=>o.offset-a.offset)}function Ob(i,e,t,n,r){let s=Math.hypot(e[0]-i[0],e[1]-i[1]);if(s<.3)return null;let o=Math.min(t.width,s-.1);if(o<.3)return null;let a=Math.max(.05,Math.min(s-o-.05,n-o/2)),l=a+o,[c,u]=[(e[0]-i[0])/s,(e[1]-i[1])/s],[h,f]=[-u,c],d=(m,y=0)=>[i[0]+c*m+h*y,i[1]+u*m+f*y],[p,x]=[d(a),d(l)],g=[];if(t.kind==="double"){let m=(a+l)/2;g.push(r?{a:p,b:d(a,o/2)}:{a:p,b:d(m)}),g.push(r?{a:x,b:d(l,o/2)}:{a:x,b:d(m)})}else t.kind==="sliding"?g.push(r?{a:d(l,-.12),b:d(l+o,-.12)}:{a:p,b:x}):g.push(r?{a:p,b:d(a,o)}:{a:p,b:x});return{from:a,to:l,posts:[p,x],leaves:g}}var Db={lawn:{color:927778,side:729115,edge:4121250,edgeAlpha:.16},terrace:{color:1841968,side:1447464,edge:5995775,edgeAlpha:.32},path:{color:1778228,side:1383209,edge:5995775,edgeAlpha:.22},driveway:{color:1514796,side:1185573,edge:5995775,edgeAlpha:.18},pool:{color:736091,side:861497,edge:3662079,edgeAlpha:.6},bed:{color:1775123,side:1380623,edge:4121250,edgeAlpha:.2},wild:{color:1384987,side:1055509,edge:10146383,edgeAlpha:.14},hedge:{color:1524016,side:1126693,edge:4121250,edgeAlpha:.35},fence:{color:1976903,side:1976903,edge:5995775,edgeAlpha:.45},pergola:{color:2827065,side:2104109,edge:5995775,edgeAlpha:.5}};function Tp(i,e){return ea(i)+(e.offset??0)+(jr(e.type)?.01:Vl[e.type])}function ju(i,e){let t=i[e];return jr(t.type)||t.type==="pool"?[]:i.filter((n,r)=>r!==e&&B0(n)&&n.points.length>=3&&n.points.every(s=>Ge(s,t.points))).map(n=>bl(n.points))}var Qu=(i,e)=>i.map((t,n)=>[n,t,i[(n+1)%i.length]]).filter(([t])=>t!==e);function _l(i,e){if(i.area.outline!==!1)for(let[,t,n]of Qu(i.poly,i.openEdge))i.lines.seg([t[0],e(t[0],t[1]),t[1]],[n[0],e(n[0],n[1]),n[1]],i.edge,$e)}function PR(i){let{buf:e,poly:t,base:n,top:r,look:s}=i,o=new W(s.color);for(let[l,c,u]of Gr(t)){let[h,f,d]=[t[l],t[c],t[u]];e.tri([h[0],n+r,h[1]],[d[0],n+r,d[1]],[f[0],n+r,f[1]],o,o,o,void 0,$e)}let a=new W(s.side);for(let[,l,c]of Qu(t,-1))e.tri([c[0],n+r,c[1]],[c[0],n+.06,c[1]],[l[0],n+.06,l[1]],a,a,a,void 0,$e),e.tri([c[0],n+r,c[1]],[l[0],n+.06,l[1]],[l[0],n+r,l[1]],a,a,a,void 0,$e);_l(i,()=>n+.06),_l(i,()=>n+r+.005)}function IR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let[u,h,f]of Qu(n,c)){let d=Math.hypot(f[0]-h[0],f[1]-h[1]),p=Math.max(1,Math.round(d/2)),x=Nb(r,h,f).map(({gate:M,offset:S})=>({gate:M,layout:Ob(h,f,M,S,!!M.open)})).filter(M=>!!M.layout),g=M=>x.some(S=>M>S.layout.from-.15&&M=0&&u===c-1?p:p-1;for(let M=0;M<=m;M++){if(g(d*M/p))continue;let S=h[0]+(f[0]-h[0])*M/p,v=h[1]+(f[1]-h[1])*M/p,w=a(S,v);vl(e,[S,v],.04,w,w+s,o.side,o.color)}let y=[],_=0;for(let M of x)y.push([_,M.layout.from]),_=M.layout.to;y.push([_,d]);let b=M=>[h[0]+(f[0]-h[0])*M/d,h[1]+(f[1]-h[1])*M/d];for(let[M,S]of y){if(S-M<.02)continue;let[v,w]=[b(M),b(S)];for(let R of[.35,.85])t.seg([v[0],a(v[0],v[1])+R*s,v[1]],[w[0],a(w[0],w[1])+R*s,w[1]],l,$e)}for(let{layout:M}of x){for(let S of M.posts){let v=a(S[0],S[1]);vl(e,S,.07,v,v+s*1.05,o.side,o.color)}for(let S of M.leaves)LR(i,S.a,S.b)}}}function LR(i,e,t){let{buf:n,lines:r,top:s,look:o,groundAt:a,edge:l}=i,c=Math.hypot(t[0]-e[0],t[1]-e[1]);if(c<.05)return;let[u,h]=[a(e[0],e[1]),a(t[0],t[1])],f=h-u;for(let[p,x]of[[.12,.2],[.78,.86]])Ju(n,e,t,.05,u+p*s,u+x*s,o.side,o.color,f);let d=Math.max(2,Math.round(c/.18));for(let p=0;p<=d;p++){let x=p/d,g=e[0]+(t[0]-e[0])*x,m=e[1]+(t[1]-e[1])*x,y=u+f*x;vl(n,[g,m],p===0||p===d?.03:.012,y+.1*s,y+.9*s,o.side,o.color)}r.seg([e[0],u+.2*s,e[1]],[t[0],h+.78*s,t[1]],l,$e)}function FR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let u of n){let h=a(u[0],u[1]);vl(e,u,.06,h,h+s,o.side,o.color)}for(let[,u,h]of Qu(n,c)){let[f,d]=[a(u[0],u[1]),a(h[0],h[1])];Ju(e,u,h,.12,f+s-.16,f+s,o.side,o.color,d-f),r.bracing&&(t.seg([u[0],f+.25,u[1]],[h[0],d+s-.25,h[1]],l,$e),t.seg([h[0],d+.25,h[1]],[u[0],f+s-.25,u[1]],l,$e))}if($0(n)){let u=K0(n),h=u.x1-u.x0>=u.z1-u.z0,[f,d]=h?[u.x0,u.x1-u.x0]:[u.z0,u.z1-u.z0],p=Math.max(1,Math.round(d/.6));for(let x=1;xa(u,h)+s+.004)}function NR(i,e,t){let{buf:n,lines:r,poly:s,area:o,top:a,look:l,groundAt:c,base:u,edge:h}=i,f=u-(o.slope??0),d=(x,g)=>c(x,g)+a,p=ju(e,t);if(Tt(n,s,f,o.slope?d:u+a,l.side,l.color,{aoFrom:f,holes:p}),_l(i,(x,g)=>d(x,g)+.004),o.type==="hedge"&&_l(i,(x,g)=>c(x,g)+.004),o.outline!==!1)for(let x of p)x.forEach((g,m)=>{let y=x[(m+1)%x.length];r.seg([g[0],d(g[0],g[1])+.004,g[1]],[y[0],d(y[0],y[1])+.004,y[1]],h,$e)})}function Ub(i){let e=i.opacity;return e==null||!(e<1)?1:Math.max(.1,Math.round(e*20)/20)}function Ap(i,e,t,n,r){let s=ea(t),o=t.outdoor??[];o.forEach((a,l)=>{if(a.points.length<3)return;let c=s+(a.offset??0),u=Db[a.type],h=bl(a.points),f=Ub(a),d=i;f<1&&n&&r&&(n.has(f)||n.set(f,r()),d=n.get(f));let p={buf:d,lines:e,area:a,poly:h,base:c,groundAt:(x,g)=>c-af(a,x,g),top:jr(a.type)&&a.height?a.height:Vl[a.type],look:u,edge:ke(u.edge,u.edgeAlpha),openEdge:a.open&&(a.type==="fence"||a.type==="pergola")?h.length-1:-1};a.type==="pool"?PR(p):a.type==="fence"?IR(p):a.type==="pergola"?FR(p):NR(p,o,l)})}var Bb=.012,OR=.012;function DR(){let i=[],e=[],t=[],n=[];return{add(r,s,o,a,l,c,u){for(let h of[r,s,o,r,o,a])i.push(h[0],h[1],h[2]),e.push(l[0],l[1],l[2]),t.push(c),n.push(u)},finish:r=>({pos:new Float32Array(i),normal:new Float32Array(e),room:Int16Array.from(t),fold:new Float32Array(n),doors:r})}}function Vb(i,e){let[t,n]=[i.b[0]-i.a[0],i.b[1]-i.a[1]],r=Math.hypot(t,n)||1;return Math.abs((e.start[0]-i.a[0])*n-(e.start[1]-i.a[1])*t)/r<.02&&Math.abs((e.axis[0]*t+e.axis[1]*n)/r)>.99}function UR(i,e,t,n){let r=[];for(let s of n.filter(o=>Vb(i,o))){let o=(s.start[0]-i.a[0])*e[0]+(s.start[1]-i.a[1])*e[1],a=s.axis[0]*e[0]+s.axis[1]*e[1]>0?o:o-s.width;a>t||a+s.width<0||r.push({s0:a,s1:a+s.width,y0:s.sill-.01,y1:s.top+.01})}return r}function kb(i,e,t){let n=[e,t,...i.filter(r=>r>e+.005&&rr-s);return n.filter((r,s)=>s===0||r>n[s-1]+.005)}function zb(i,e,t=()=>!1){let n=i.map(u=>u[0]),r=i.map(u=>u[1]),[s,o]=[Math.min(...n),Math.min(...r)],[a,l]=[Math.max(1,Math.ceil((Math.max(...n)-s)/e)),Math.max(1,Math.ceil((Math.max(...r)-o)/e))],c=[];for(let u=0;ua.add([d,x,p],[d,x,p+r],[d+r,x,p+r],[d+r,x,p],[0,1,0],g,-1);i.rooms.forEach((d,p)=>{if(!(d.points.length<3))for(let{a:x,b:g}of zb(d.points,r,(m,y)=>s.some(_=>Ge([m,y],_))))l(x,g,Bb,p)});let c=i.rooms.length,u=i.outdoor??[];u.forEach((d,p)=>{if(d.points.length<3||jr(d.type))return;let x=Tp(i,d)+Bb,g=ju(u,p);for(let{a:m,b:y}of zb(d.points,r,(_,b)=>g.some(M=>Ge([_,b],M))))l(m,y,x,c)});let h=Math.min(i.cut_height,i.height);e.forEach((d,p)=>{let x=d.heightEnd===void 0?null:[d.height??i.height,d.heightEnd],g=x?Math.max(...x):d.height??i.height,m=Math.min(h,g-.02),[y,_]=[d.b[0]-d.a[0],d.b[1]-d.a[1]],b=Math.hypot(y,_);if(b<.05)return;let M=[y/b,_/b],S=[-M[1],M[0]],v=t[p],w=UR(d,M,b,n),R=kb([m,(m+g)/2,...w.flatMap(C=>[C.y0+.01,C.y1-.01])],.02,g-.02),T=kb(w.flatMap(C=>[C.s0,C.s1]),0,b);for(let C of[1,-1]){let L=C>0?d.roomLeft:d.roomRight,O=L?i.rooms.findIndex(H=>H.id===L):d.exterior?c:-1;if(O<0)continue;let P=(C>0?d.left:d.right)+OR,I=[S[0]*C,S[1]*C],D=(H,B)=>[d.a[0]+M[0]*H+I[0]*P,B,d.a[1]+M[1]*H+I[1]*P],F=H=>{let B=D(H,0),X=o?.(B[0],B[2]),V=x?x[0]+(x[1]-x[0])*H/b-.02:1/0;return Math.min(V,X==null?1/0:X-.02)};for(let H=0;H+1we>Ae.s0&&weAe.y0&&le=h-1e-6?v:hr+v)}}}}});let f=[];for(let d of n.filter(p=>p.opening.type==="door")){let p=e.find(m=>Vb(m,d));if(!p?.roomLeft||!p.roomRight)continue;let[x,g]=[i.rooms.findIndex(m=>m.id===p.roomLeft),i.rooms.findIndex(m=>m.id===p.roomRight)];x<0||g<0||f.push({id:d.opening.id,a:x,b:g,x:d.start[0]+d.axis[0]*(d.width/2),y:Math.min(1.1,d.top*.55),z:d.start[1]+d.axis[1]*(d.width/2)})}return a.finish(f)}function BR(i,e){let t=Math.max(0,-e),n=Math.max(0,e);switch(i){case"ceiling":return .3+.7*t;case"spot":return .06+.94*t**5;case"pendant":return .25+.85*t**2+.2*n;case"up":return .25+.75*n;case"wall":return .45+.35*Math.abs(e);default:return 1}}function kR(i){return(i.kind==="spot"?2:i.kind==="wall"?1.4:2.4)*(.55+.45*i.level)}function Gb(i,e,t){let[n,r,s]=[e[0]-i.x,e[1]-i.y,e[2]-i.z],o=n*n+r*r+s*s,a=Math.sqrt(o)||1e-6,l=kR(i),c=1/(1+o/(l*l)),u=c*Math.sqrt(c),h=Math.max(0,-(n*t[0]+r*t[1]+s*t[2])/a);return i.level*u*(.2+.8*h)*BR(i.kind,r/a)}function zR(i,e,t){let n=[];return i.doors.forEach((r,s)=>{let o=t[s]??.5;if(!(o<=.01))for(let[a,l]of[[r.a,r.b],[r.b,r.a]]){let c=[0,0,0];for(let h of e.filter(f=>f.room===a)){let f=[h.x-r.x,h.y-r.y,h.z-r.z],d=Math.hypot(...f)||1,p=Gb(h,[r.x,r.y,r.z],[f[0]/d,f[1]/d,f[2]/d]);for(let x=0;x<3;x++)c[x]+=h.color[x]*p}let u=Math.max(...c);u<.01||n.push({x:r.x,y:r.y,z:r.z,color:[c[0]/u,c[1]/u,c[2]/u],level:Math.min(1,u*.9*(.35+.65*o)),kind:"wall",room:l})}}),n}function Rp(i,e,t=.7,n=[]){let r=new Map;for(let c of[...e,...zR(i,e,n)]){let u={...c,color:c.color.map(h=>h**1.5)};r.set(c.room,[...r.get(c.room)??[],u])}let{pos:s,normal:o,room:a}=i,l=new Float32Array(s.length);for(let c=0;cr.points.length>=3&&Ge([e,t],r.points));return n<0?i.rooms.length:n}var Pp=(i,e)=>i&&e>=0&&e45,y=d+Oo(s.base,l,s.rise);for(let _ of HR)if(s.upright)r.push({x:s.x,y:u+l*(.5+_),z:s.z,color:p,level:x*Hb,kind:"omni",room:a});else{let[b,M,S]=Ku(s.x,y,s.z,g,l,s.rise,_);r.push({x:b,y:M,z:S,color:p,level:x*Hb,kind:m?"omni":f,room:a})}}return r}function Xb(i,e,t="plain"){return i.onBeforeCompile=n=>{n.uniforms.uStanding=e.standing,n.uniforms.uGlass=e.glass,n.uniforms.uSlope=e.slope??{value:{x:0,y:0,z:0,w:0}},n.uniforms.uSlopeY=e.slopeY??{value:{x:0,y:0}},n.uniforms.uGlassAlpha=e.glassAlpha??{value:.2},n.vertexShader=n.vertexShader.replace("#include ",`#include attribute float fold; uniform int uStanding; uniform int uGlass; @@ -4257,7 +4257,7 @@ uniform float uGlassAlpha;`),t!=="glass"&&(n.fragmentShader=n.fragmentShader.rep if (vNfPaint > 0.5) diffuseColor.rgb = vColor.rgb; #endif`)),t==="glass"&&(n.fragmentShader=n.fragmentShader.replace("#include ",`#include diffuseColor.rgb = diffuseColor.rgb * 1.7 + vec3(0.015, 0.05, 0.075); - diffuseColor.a *= uGlassAlpha;`))},i.customProgramCacheKey=()=>`nf-fold-${t}`,i}var _p=["neon","blueprint","day"],gO=["auto",..._p];var Fy=i=>_p.indexOf(i),Ku={value:new U(.22,.88,1)},Zu={value:0};function Ny(i){let e=/^#?([0-9a-f]{6})$/i.exec(i?.trim()??"");if(!e)return null;let t=Number.parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}var AR=` + diffuseColor.a *= uGlassAlpha;`))},i.customProgramCacheKey=()=>`nf-fold-${t}`,i}var Ip=["neon","blueprint","day"],kO=["auto",...Ip];var Yb=i=>Ip.indexOf(i),eh={value:new U(.22,.88,1)},th={value:0};function qb(i){let e=/^#?([0-9a-f]{6})$/i.exec(i?.trim()??"");if(!e)return null;let t=Number.parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}var WR=` uniform int uTheme; uniform vec3 uAccent; uniform int uAccentOn; @@ -4284,19 +4284,19 @@ vec3 nfThemed(vec3 c, bool isLine) { vec3 grey = vec3(clamp(0.66 + luma * 2.6, 0.0, 0.96)); return mix(grey, grey * (c / max(strongest, 0.001)), 0.1); } -`;function Zn(i,e,t=!1){let n=i.onBeforeCompile.bind(i),r=i.customProgramCacheKey.bind(i);return i.onBeforeCompile=(s,o)=>{n(s,o),Object.assign(s.uniforms,{uTheme:e,uAccent:Ku,uAccentOn:Zu}),s.fragmentShader=s.fragmentShader.replace("#include ",`#include -${AR}`).replace("#include ",`#include - diffuseColor.rgb = nfThemed(diffuseColor.rgb, ${t});`)},i.customProgramCacheKey=()=>`${r()}-themed-${t?"l":"s"}`,i}var _l=i=>i==="day"?Ei:Ft;var ER=`#include +`;function Jn(i,e,t=!1){let n=i.onBeforeCompile.bind(i),r=i.customProgramCacheKey.bind(i);return i.onBeforeCompile=(s,o)=>{n(s,o),Object.assign(s.uniforms,{uTheme:e,uAccent:eh,uAccentOn:th}),s.fragmentShader=s.fragmentShader.replace("#include ",`#include +${WR}`).replace("#include ",`#include + diffuseColor.rgb = nfThemed(diffuseColor.rgb, ${t});`)},i.customProgramCacheKey=()=>`${r()}-themed-${t?"l":"s"}`,i}var Ml=i=>i==="day"?Ei:Ft;var XR=`#include attribute vec2 tile; -varying vec2 vNfTile;`,RR=`#include -vNfTile = tile;`,CR=`#ifdef USE_MAP +varying vec2 vNfTile;`,YR=`#include +vNfTile = tile;`,qR=`#ifdef USE_MAP vec2 nfCell = fract(vMapUv); vec2 nfUv = (vNfTile + 0.004 + nfCell * 0.992) / vec2(3.0, 2.0); // gradients of the unwrapped coordinates avoid mip seams at the tile borders vec4 sampledDiffuseColor = textureGrad(map, nfUv, dFdx(vMapUv) / vec2(3.0, 2.0), dFdy(vMapUv) / vec2(3.0, 2.0)); diffuseColor *= sampledDiffuseColor; - #endif`;function PR(i){let e=new $e({map:i,transparent:!0,blending:Ft,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2});return e.onBeforeCompile=t=>{t.vertexShader=t.vertexShader.replace("#include ",ER).replace("#include ",RR),t.fragmentShader=t.fragmentShader.replace("#include ",`#include -varying vec2 vNfTile;`).replace("#include ",CR)},e.customProgramCacheKey=()=>"nf-pattern",e}var Ju=(i={})=>new $e({vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1,...i});function Oy({mask:i,look:e,theme:t,textures:n}){let r=(o={})=>new $e({vertexColors:!0,...o}),s=(o,a)=>Ly(o,i,a);return{floor:Zn(r(),e),pattern:PR(n.pattern),wall:Zn(s(r(),"solid"),e),glassWall:s(r({transparent:!0,depthWrite:!1}),"glass"),shadow:r({blending:Ha,premultipliedAlpha:!0,transparent:!0,depthWrite:!1,side:ht,polygonOffset:!0,polygonOffsetFactor:-1}),lines:Zn(s(new Lt({vertexColors:!0,transparent:!0,blending:_l(t),depthWrite:!1})),e,!0),glow:s(Ju({side:ht,polygonOffset:!0,polygonOffsetFactor:-3}),"solid"),frames:Zn(s(r({side:ht})),e),glass:s(Ju({side:ht})),blinds:Zn(s(r({map:n.blinds,side:ht})),e),lamps:Zn(r(),e),halos:new cn({map:n.halo,size:.9,sizeAttenuation:!0,vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1}),cones:Ju({side:ht}),screens:Ju({side:ht}),ghosts:[]}}var ju=i=>Object.assign(document.createElement("span"),{className:i});function Dy(i,e){let t=Object.assign(document.createElement("button"),{className:"nf-dev"});t.dataset.entity=i,t.append(ju("nf-dev-icon"),ju("nf-dev-text"),ju("nf-dev-watt"),ju("nf-dev-name"));let n,r=!1,s=a=>{let{x:l,y:c}=e.centre(t);a(i,l,c)},o=()=>clearTimeout(n);t.addEventListener("pointerdown",a=>{if(e.furnishing())return e.pressedWhileFurnishing(i);a.stopPropagation(),r=!1,o(),n=setTimeout(()=>{r=!0,s(e.hold)},500)});for(let a of["pointerleave","pointercancel","pointerup"])t.addEventListener(a,o);return t.addEventListener("contextmenu",a=>a.preventDefault()),t.addEventListener("click",a=>{if(a.stopPropagation(),e.furnishing())return e.selectWhileFurnishing(i);r||s(e.tap)}),t.addEventListener("keydown",a=>{(a.key==="Enter"&&a.shiftKey||a.key==="ContextMenu")&&(a.preventDefault(),s(e.hold))}),t}function Uy(i,e=10,t="NextFloor"){let n=[];for(let{positions:o,lift:a}of i)for(let l=0;l+8[o[l+g]*e,-o[l+g+2]*e,(o[l+g+1]+a)*e]),[u,h,f]=c,d=[(h[1]-u[1])*(f[2]-u[2])-(h[2]-u[2])*(f[1]-u[1]),(h[2]-u[2])*(f[0]-u[0])-(h[0]-u[0])*(f[2]-u[2]),(h[0]-u[0])*(f[1]-u[1])-(h[1]-u[1])*(f[0]-u[0])],p=Math.hypot(d[0],d[1],d[2]);p<1e-9||n.push([d[0]/p,d[1]/p,d[2]/p,...u,...h,...f])}let r=new Uint8Array(84+n.length*50),s=new DataView(r.buffer);return r.set(new TextEncoder().encode(`${t} STL`.slice(0,79)),0),s.setUint32(80,n.length,!0),n.forEach((o,a)=>{let l=84+a*50;o.forEach((c,u)=>s.setFloat32(l+u*4,c,!0))}),r}var Cs=Math.PI/180;function By(i,e,t){let n=i.getTime()/864e5-10957.5,r=(357.529+.98560028*n)*Cs,o=(280.459+.98564736*n+1.915*Math.sin(r)+.02*Math.sin(2*r))*Cs,a=(23.439-36e-8*n)*Cs,l=Math.atan2(Math.cos(a)*Math.sin(o),Math.cos(o)),c=Math.asin(Math.sin(a)*Math.sin(o)),h=(((18.697374558+24.06570982441908*n)%24+24)%24*15+t)*Cs-l,f=e*Cs,d=Math.asin(Math.sin(f)*Math.sin(c)+Math.cos(f)*Math.cos(c)*Math.cos(h)),p=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(f)-Math.tan(c)*Math.cos(f))/Cs+180;return{elevation:d/Cs,azimuth:(p%360+360)%360}}function vp(i,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(i)).map(n=>[n.type,Number(n.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function ky(i,e,t=new Date){let[n,r]=[Math.floor(i),Math.round(i%1*60)];if(e)try{let o=new Date(vp(t.getTime(),e)),a=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),n,r),l=a-(vp(a,e)-a);return l=a-(vp(l,e)-l),new Date(l)}catch{}let s=new Date(t);return s.setHours(n,r,0,0),s}function IR(i,e=new Date){let t=[];for(let n=0;n<=24;n+=.25){let r=By(ky(Math.min(n,23.99),i.zone,e),i.latitude,i.longitude);r.elevation<0||t.push(zy(i,r))}return t}function zy(i,e){let[t,n]=Fo(e.azimuth,i.north),r=Math.max(0,e.elevation)*Math.PI/180;return[i.centre[0]+t*i.radius*Math.cos(r),Math.sin(r)*i.radius*.9,i.centre[1]+n*i.radius*Math.cos(r)]}function LR(i,e){let t=document.createElement("canvas");t.width=t.height=64;let n=t.getContext("2d");n&&(n.font="bold 44px system-ui, sans-serif",n.fillStyle=e,n.textAlign="center",n.textBaseline="middle",n.fillText(i,32,34));let r=new Qi(new vi({map:new zt(t),transparent:!0,depthWrite:!1,depthTest:!1}));return r.renderOrder=20,r}var Qu=class{group=new rt;key="";constructor(){this.group.visible=!1,this.group.renderOrder=15}update(e,t,n){let r=e?`${e.centre},${e.radius.toFixed(1)},${e.north},${e.latitude.toFixed(2)},${e.longitude.toFixed(2)},${new Date().toDateString()},${n},${t?`${t.elevation.toFixed(0)},${t.azimuth.toFixed(0)}`:"-"}`:"off";if(r===this.key)return;if(this.key=r,this.clear(),!e){this.group.visible=!1;return}this.group.visible=!0;let s=n+.05,o=[];for(let h=0;h<=96;h++){let f=h/96*Math.PI*2;o.push(e.centre[0]+Math.cos(f)*e.radius,s,e.centre[1]+Math.sin(f)*e.radius)}let a=new Ce;a.setAttribute("position",new De(o,3)),this.group.add(new Pn(a,new Lt({color:7311304,transparent:!0,opacity:.55,depthWrite:!1})));let l=[];[["N",0],["E",90],["S",180],["W",270]].forEach(([h,f])=>{let[d,p]=Fo(f,e.north);l.push(e.centre[0]+d*e.radius*.94,s,e.centre[1]+p*e.radius*.94,e.centre[0]+d*e.radius*1.04,s,e.centre[1]+p*e.radius*1.04);let g=LR(h,h==="N"?"#ff6b6b":"#9fb4d8");g.position.set(e.centre[0]+d*e.radius*1.12,s+.4,e.centre[1]+p*e.radius*1.12),g.scale.setScalar(Math.max(1.2,e.radius*.12)),this.group.add(g)});let c=new Ce;c.setAttribute("position",new De(l,3)),this.group.add(new gn(c,new Lt({color:10466520,transparent:!0,opacity:.8,depthWrite:!1})));let u=IR(e).map(([h,f,d])=>[h,n+f,d]);if(u.length>1){let h=new Ce;h.setAttribute("position",new De(u.flat(),3)),this.group.add(new Pn(h,new Lt({color:16761415,transparent:!0,opacity:.85,depthWrite:!1})))}if(t&&t.elevation>0){let[h,f,d]=zy(e,t),p=new we(new ds(Math.max(.35,e.radius*.035),12,8),new $e({color:16765530}));p.position.set(h,n+f,d),this.group.add(p)}}clear(){for(let e of[...this.group.children]){this.group.remove(e);let t=e;t.geometry?.dispose();let n=t.material;n?.map?.dispose(),n?.dispose()}}dispose(){this.clear()}};var FR=["straight","quarter","l","half","u","spiral"],NR=["solid","stringer","mono","cantilever"],OR=["none","left","right","both"],DR=["headroom","full","none"],eh={shape:"straight",turn:"right",build:"solid",risers:!0,steps:null,run_width:null,down:!1,rail:"none",opening:"headroom",landing_after:null};var Xy=2,Yy=40,UR=2.2,th=(i,e)=>typeof e=="string"&&i.includes(e);function Mp(i){let e=i.stair??{},t=typeof e.steps=="number"&&Number.isFinite(e.steps)?Math.round(Math.min(Yy,Math.max(Xy,e.steps))):null,n=typeof e.run_width=="number"&&Number.isFinite(e.run_width)&&e.run_width>.2?e.run_width:null;return{shape:th(FR,e.shape)?e.shape:eh.shape,turn:e.turn==="left"?"left":"right",build:th(NR,e.build)?e.build:eh.build,risers:e.risers!==!1,steps:t,run_width:n,down:e.down===!0,rail:th(OR,e.rail)?e.rail:eh.rail,opening:th(DR,e.opening)?e.opening:eh.opening,landing_after:typeof e.landing_after=="number"&&Number.isFinite(e.landing_after)?Math.max(1,Math.round(e.landing_after)):null}}var ih=i=>i.type==="stairs"&&!!i.stair,Ml=(i,e,t)=>[i[0]+(e[0]-i[0])*t,i[1]+(e[1]-i[1])*t],Vy=(i,e)=>Math.abs(i[0]-e[0])<1e-6&&Math.abs(i[1]-e[1])<1e-6;function qy(i){let e=[];for(let t of i)(!e.length||!Vy(e[e.length-1],t))&&e.push(t);for(;e.length>1&&Vy(e[0],e[e.length-1]);)e.pop();return e}function Sl(i,e,t=!1){return{poly:qy([...i,...[...e].reverse()]),landing:t,left:i,right:e}}function vl(i,e,t,n,r){let s=[];for(let o=0;oe+1e-6&&ri.reduce((e,t,n)=>n?e+Math.hypot(t[0]-i[n-1][0],t[1]-i[n-1][1]):e,0);function Hy(i,e,t,n,r){let s=kR(i),o=[];for(let a=0;a=8?3:2),[f,d]=i.shape==="l"?Wy(i,n)??nh(n-h,t-l,e-l):nh(n-h,t-l,e-l),p=vl([r,a],[r+l,a],[r,o+l],c,f),g=i.shape==="l"?[Sl(u,[c],!0)]:Hy(u,c,c,c,h),m=vl([r+l,o],c,[s,o],[s,o+l],d);return{treads:[...p,...g,...m],flight:l,column:0}}case"half":case"u":{let l=Math.min(i.run_width??Math.min(1.1,(e-.1)/2),(e-.02)/2),c=o+l,u=[[r,c],[r,o],[s,o],[s,c]],[h,f]=[[r+l,c],[s-l,c]],d=i.shape==="u"?1:Math.min(n,n>=12?6:n>=8?4:2),[p,g]=i.shape==="u"?Wy(i,n)??nh(n-d,t-l,t-l):nh(n-d,t-l,t-l),m=vl([r,a],[r+l,a],[r,c],h,p),x=i.shape==="u"?[Sl(u,[h,f],!0)]:Hy(u,h,[0,c],f,d),b=vl([s,c],f,[s,a],[s-l,a],g);return{treads:[...m,...x,...b],flight:l,column:0}}case"spiral":{let l=Math.min(e,t)/2,c=Math.min(.08,l*.12),u=Math.min(.75,Math.max(.3,.22/(l*.6))),h=(d,p)=>[Math.cos(p)*d,Math.sin(p)*d],f=[];for(let d=0;dh(l,p+(g-p)*x));f.push(Sl(m,[h(c,p),h(c,g)]))}return{treads:f,flight:l-c,column:c}}default:return{treads:vl([r,a],[s,a],[r,o],[s,o],n),flight:e,column:0}}}var VR=(i,e)=>i.steps??Math.min(Yy,Math.max(Xy,Math.round(Math.abs(e)/.18)));function Sp(i,e,t,n){let r=VR(i,n),s=Math.abs(n)/r,o=zR(i,Math.max(.3,e),Math.max(.3,t),r),a=c=>[-c[0],c[1]];return{treads:o.treads.map((c,u)=>{let h=i.down?-s*(u+1):s*(u+1);return i.turn==="right"?{...c,top:h}:{poly:c.poly.map(a).reverse(),top:h,landing:c.landing,left:c.right.map(a),right:c.left.map(a)}}),rise:s,steps:r,column:o.column,flight:o.flight}}function $y(i){let e=i.poly.reduce((t,n)=>[t[0]+n[0],t[1]+n[1]],[0,0]);return[e[0]/i.poly.length,e[1]/i.poly.length]}function GR(i,e,t,n="headroom"){if(n==="none")return[];let r=t?0:Math.abs(e),s=n==="full"?i.treads:i.treads.filter((o,a)=>o.top>r-UR||!t&&a===i.treads.length-1||t&&a===0);return dr(s.map(o=>o.poly).filter(o=>o.length>=3))}function wp(i){let e=Mp(i),t=GR(Sp(e,i.w,i.d,i.h),i.h,e.down,e.opening),n=i.rotation*Math.PI/180,[r,s]=[Math.cos(n),Math.sin(n)],o=i.mirror?-1:1;return t.map(a=>a.map(([l,c])=>[i.x+o*l*r-c*s,i.z+o*l*s+c*r]))}function Di(i,e,t,n,r,s,o=Ie.metal,a=!1){let[l,c]=[e/2-s-r,t/2-s-r],u=et(o);for(let h of[-1,1])for(let f of[-1,1]){let[d,p]=[h*l,f*c];a?i.loft([d-r*.3,d+r*.3,p-r*.3,p+r*.3],[d-r/2,d+r/2,p-r/2,p+r/2],0,n,u):i.block({x:[d-r/2,d+r/2],y:[0,n],z:[p-r/2,p+r/2]},u)}}function Ps(i,e,t,n,r,s,o,a=null,l=!1){let c=(t-e)/o;for(let u=1;u1?h+(u%2?-c/2+.06:c/2-.06):h+c/2-.06;i.seg(d,f-.08,s+.012,d,f+.08,s+.012,Ke)}}}function fi(i,e,t,n,r,s=null,o=!1,a=q.body){i.block({x:[-e/2,e/2],y:[.02,n],z:[-t/2,t/2-.02]},a,le),i.block({x:[-e/2+.02,e/2-.02],y:[0,.08],z:[-t/2+.02,t/2-.06]},et(Ie.dark)),Ps(i,-e/2,e/2,.08,n,t/2-.02,r,s,o)}function Tp(i,e,t,n,r){let[s,o,a,l]=[-e/2,e/2,-t/2,t/2],c=Math.min(.2,e*.12),u=n*.5,h=Math.min(.24,t*.28);Di(i,e,t,.07,.05,.05,Ie.wood,!0),i.pad({x:[s,o],y:[.07,u-.08],z:[a+.02,l]},q.fabric,.04,le),i.loft([s,o,a,a+h],[s+.01,o-.01,a,a+h*.5],u-.08,n,q.fabric,le);for(let[d,p]of[[s,s+c],[o-c,o]])i.pad({x:[d,p],y:[u-.08,n*.72],z:[a+.02,l-.02]},q.fabric,.04,le);let f=(o-c-(s+c))/r;for(let d=0;d1.2?2:1,f=(e-.2)/h;for(let d=0;d0?.05:0),o*(e/2)+(o<0?.05:0)],y:[0,n],z:[a*(t/2)-(a>0?.05:0),a*(t/2)+(a<0?.05:0)]},q.wood);for(let o of[.25,n-.55])i.block({x:[-e/2,e/2],y:[o,o+.08],z:[-t/2,t/2]},q.wood,le),i.block({x:[-e/2+.04,e/2-.04],y:[o+.08,o+.24],z:[-t/2+.05,t/2-.05]},q.bedding,Ne),i.block({x:[-e/2+.05,e/2-.05],y:[o+.24,o+.33],z:[-t/2+.08,-t/2+.4]},q.pillow);i.block({x:[-e/2,e/2],y:[n-.2,n-.15],z:[t/2-.05,t/2]},q.wood);let s=e/2-.35;for(let o of[s-.18,s+.18])i.seg(o,0,t/2+.02,o,n-.15,t/2+.02,le);for(let o=.3;oi.block({x:[-e/2,e/2],y:[n-.04,n],z:[-t/2,t/2]},q.worktop,le);function n_(i,e,t,n){fi(i,e,t-.02,n-.04,Math.max(1,Math.round(e/.6)),n-.2),Rp(i,e,t,n)}function i_(i,e,t,n){i.block({x:[-e/2,e/2],y:[Math.max(0,n-.04),n],z:[-t/2,t/2]},q.worktop,le)}function r_(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,n],z:[-t/2,t/2]},q.white,le);let r=n*.62;i.seg(-e/2,r,t/2,e/2,r,t/2,Ne);let s=e/2-.06;i.seg(s,r+.08,t/2+.015,s,r+.4,t/2+.015,Ke),i.seg(s,r-.4,t/2+.015,s,r-.08,t/2+.015,Ke)}var Cp=.06;function s_(i,e,t,n){let r=t/2-Cp;i.block({x:[-e/2,e/2],y:[.02,n],z:[-t/2,r]},q.body,le),i.block({x:[-e/2+.05,e/2-.05],y:[0,.02],z:[-t/2+.05,r-.05]},q.dark);for(let s of[.35,.7,1.05,1.4])s>n-.15||(i.seg(-e/2+.03,s,r+.001,-.03,s,r+.001,Ne),i.seg(.03,s,r+.001,e/2-.03,s,r+.001,Ne))}var Ep=1.83;function HR(i,e,t,n,r){let[s,o]=[Math.cos(e.rotation*mt),Math.sin(e.rotation*mt)],a=e.mirror?-1:1,l=(b,_)=>[e.x+a*b*s-_*o,e.z+a*b*o+_*s],[c,u]=[t+.05,t+e.h-.02],h=new W(.75,.1,.14),f=new W(Ie.dark),d=new W(Ie.accent),p=e.w/2-.006,g=(b,_,y)=>{let M=y/Ep,S=new W(2043212).lerp(h,M),v=new W(Ie.body).lerp(h,M*.8),[w,C]=[Math.cos(y),Math.sin(y)],A=(O,P)=>l(b+_*(O*w-P*C),e.d/2+O*C+P*w),R=(O,P,I,D)=>{let[F,H,B,X]=O;i.tri([F[0],P,F[1]],[H[0],P,H[1]],[B[0],I,B[1]],D),i.tri([F[0],P,F[1]],[B[0],I,B[1]],[X[0],I,X[1]],D)},N=(O,P,I,D,F,H,B,X=B)=>{let V=[A(O,H),A(P,H),A(P,F),A(O,F)];R([V[0],V[1],V[1],V[0]],I,D,X),R([V[3],V[2],V[2],V[3]],I,D,B),R([V[0],V[3],V[3],V[0]],I,D,B),R([V[1],V[2],V[2],V[1]],I,D,B),R([V[0],V[1],V[2],V[3]],D,D,B),R([V[3],V[2],V[1],V[0]],I,I,B)};return N(0,p,c,u,-Cp,0,v,S),N(p-.05,p-.03,t+e.h*.45,t+e.h*.75,.005,.025,d),N};g(-e.w/2,1,n*Ep)(.12,.3,t+e.h*.5,t+e.h*.68,.001,.005,f),g(e.w/2,-1,r*Ep)(.06,p-.06,t+e.h*.52,t+e.h*.86,.001,.005,f)}function Pp(i,e,t,n,r){let s=i.p.length;HR(i,e,t,n,r),e.mirror&&Ms(i,s)}function o_(i,e,t,n){fi(i,e,t-.02,n-.04,1,n-.24,!0),i.block({x:[-e/2,e/2],y:[n-.04,n],z:[-t/2,t/2]},q.dark,le);let r=[[-.14,-.13,.09],[.14,-.13,.07],[-.14,.13,.07],[.14,.13,.09]];for(let[s,o,a]of r)i.cylinder(s*e/.6,o*t/.62,a,n,n+.004,et(Ie.dark,1451583),12,Ke)}function a_(i,e,t,n){fi(i,e,t-.02,n-.04,Math.max(1,Math.round(e/.45)),n-.2);let r=Math.min(.5,e-.2),s=(o,a,l,c,u=!1)=>i.block({x:[o,a],y:[n-.04,n],z:[l,c]},q.worktop,u?le:null);s(-e/2,-r/2,-t/2,t/2,!0),s(r/2,e/2,-t/2,t/2,!0),s(-r/2,r/2,-t/2,-t/2+.1),s(-r/2,r/2,t/2-.08,t/2),i.block({x:[-r/2,r/2],y:[n-.2,n-.17],z:[-t/2+.1,t/2-.08]},q.metal,Ke),i.cylinder(0,-t/2+.05,.02,n,n+.28,q.metal,8),i.block({x:[-.015,.015],y:[n+.24,n+.28],z:[-t/2+.05,-t/2+.22]},q.metal)}function l_(i,e,t,n){i.block({x:[-e/2,e/2],y:[1.45,1.45+n],z:[-t/2,t/2-.02]},q.body,le),Ps(i,-e/2,e/2,1.45,1.45+n,t/2-.02,Math.max(1,Math.round(e/.5)),1.45+.08)}function c_(i,e,t,n){i.block({x:[-e/2,e/2],y:[.02,n],z:[-t/2,t/2-.02]},q.body,le),i.block({x:[-e/2+.02,e/2-.02],y:[0,.08],z:[-t/2+.02,t/2-.06]},q.dark);let r=t/2-.02;i.block({x:[-e/2+.03,e/2-.03],y:[.85,1.45],z:[r,r+.01]},q.dark,Ke),i.seg(-e/2+.08,1.4,r+.02,e/2-.08,1.4,r+.02,Ke);for(let s of[.85,1.45])i.seg(-e/2,s,r,e/2,s,r,Ne);i.seg(e/2-.06,.5,r+.012,e/2-.06,.7,r+.012,Ke),i.seg(e/2-.06,1.6,r+.012,e/2-.06,1.8,r+.012,Ke)}function u_(i,e,t,n){let r=t-.3;i.block({x:[-e/2+.05,e/2-.05],y:[.08,n-.04],z:[-t/2+.02,-t/2+r]},q.body,le),i.block({x:[-e/2+.07,e/2-.07],y:[0,.08],z:[-t/2+.04,-t/2+r-.04]},q.dark),Ps(i,-e/2+.05,e/2-.05,.08,n-.04,-t/2+r,Math.max(2,Math.round(e/.6)),n-.2),Rp(i,e,t,n)}function h_(i,e,t,n){i.block({x:[-e/2,e/2],y:[.02,n-.04],z:[-t/2,t/2-.02]},q.body,le),i.block({x:[-e/2+.02,e/2-.02],y:[0,.08],z:[-t/2+.02,t/2-.06]},q.dark),i.seg(-e/2+.08,n-.12,t/2-.008,e/2-.08,n-.12,t/2-.008,Ke),Rp(i,e,t,n)}function Ip(i,e,t,n,r){i.block({x:[-e/2,e/2],y:[0,n],z:[-t/2,t/2-.02]},q.white,le);let s=t/2-.012;i.seg(-e/2,n-.14,s,e/2,n-.14,s,Ne),i.seg(e/2-.16,n-.07,s,e/2-.08,n-.07,s,Ke);let o=(n-.14)/2+.04,a=Math.min(e*.36,(n-.2)*.42),l=20;for(let c=0;ci.seg(Math.cos(u)*a*d,o+Math.sin(u)*a*d,s,Math.cos(h)*a*d,o+Math.sin(h)*a*d,s,p);f(1,Ke),r||f(.72,Ne)}}function f_(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,n-.02],z:[-t/2,t/2]},q.white,le);let s=(o,a,l,c)=>i.block({x:[o,a],y:[n-.02,n],z:[l,c]},q.worktop);s(-e/2,e/2,-t/2,-t/2+.07),s(-e/2,e/2,t/2-.07,t/2),s(-e/2,-e/2+.07,-t/2+.07,t/2-.07),s(e/2-.07,e/2,-t/2+.07,t/2-.07),i.block({x:[-e/2+.07,e/2-.07],y:[n-.03,n-.02],z:[-t/2+.07,t/2-.07]},q.glass,Ke),i.cylinder(-e/2+.04,0,.02,n,n+.12,q.metal,8)}function d_(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,.05],z:[-t/2,t/2]},q.worktop,le),i.cylinder(0,0,.04,.05,.052,q.metal,8);for(let[r,s,o,a]of[[-e/2,t/2,e/2,t/2],[e/2,-t/2,e/2,t/2]])i.seg(r,.05,s,o,.05,a,Ke),i.seg(r,n,s,o,n,a,Ke),i.seg(o,.05,a,o,n,a,Ke);i.cylinder(-e/2+.06,-t/2+.06,.015,.05,n-.05,q.metal,6),i.cylinder(-e/2+.2,-t/2+.2,.1,n-.08,n-.06,q.metal,12,Ke)}function p_(i,e,t,n){let r=Math.min(.18,t*.3);i.block({x:[-e/2,e/2],y:[.45,n],z:[-t/2,-t/2+r]},q.white,le),i.block({x:[-e*.3,e*.3],y:[0,.36],z:[-t/2+r-.02,t/2-.12]},q.white),i.cylinder(0,t/2-.26,Math.min(e/2,.19),.36,.41,q.white,12,le),i.block({x:[-e/2+.02,e/2-.02],y:[.41,.43],z:[-t/2+r,-t/2+r+.05]},q.worktop)}function m_(i,e,t,n){fi(i,e,t-.02,n-.12,e>.8?2:1,n-.3),i.block({x:[-e/2,e/2],y:[n-.12,n],z:[-t/2,t/2]},q.white,le),i.block({x:[-e/2+.07,e/2-.07],y:[n-.005,n],z:[-t/2+.12,t/2-.06]},q.glass,Ke),i.cylinder(0,-t/2+.06,.018,n,n+.2,q.metal,8),i.block({x:[-e/2+.04,e/2-.04],y:[n+.35,n+1],z:[-t/2,-t/2+.02]},q.glass,Ke)}var wl=.12;function g_(i,e,t,n){let r=wl;i.block({x:[-e/2+.05,-e/2+.08],y:[0,r],z:[-t/2,-t/2+.03]},q.metal),i.block({x:[e/2-.08,e/2-.05],y:[0,r],z:[-t/2,-t/2+.03]},q.metal),i.block({x:[-e/2,e/2],y:[r,r+n],z:[-t/2+.02,t/2]},q.white,le);let s=Math.max(3,Math.round(e/.1));for(let o=1;oi.block({x:[-e/2,e/2],y:[1.1,1.1+n],z:[-t/2,t/2]},l,le);if(r==="slim"){a(q.darkBody),i.seg(-e*.25,1.1+n*.15,o+.004,-e*.25,1.1+n*.85,o+.004,Ke),i.block({x:[-e*.1,e*.3],y:[1.1+n*.7,1.1+n*.85],z:[o,o+.005]},q.dark);return}if(a(q.white),r==="hybrid"){i.ring(0,1.1+n*.66,Math.min(e,n)*.22,o+.004,20,Ke),i.seg(-e*.08,1.1+n*.66,o+.005,e*.08,1.1+n*.66,o+.005,Ke);for(let l of[-1,1])i.ring(l*e*.22,1.1+n*.2,Math.min(e,n)*.1,-t/2-.002,12,Ke);return}i.block({x:[-e*.28,e*.28],y:[1.1+n*.58,1.1+n*.82],z:[t/2,t/2+.006]},q.dark),i.seg(-e*.3,1.1+n*.45,t/2+.004,e*.3,1.1+n*.45,t/2+.004,Ke);for(let l of[-1,1])for(let c=1;c<6;c++)i.seg(l*e/2+l*.002,1.1+n*c/6,-t/2+.03,l*e/2+l*.002,1.1+n*c/6,t/2-.03,Ne)}function L_(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,n],z:[-t/2,t/2]},q.darkBody,le),i.block({x:[-e/2-.01,e/2+.01],y:[n,n+.03],z:[-t/2-.01,t/2+.01]},q.darkBody),i.seg(-e/2,n+.032,t/2+.01,e/2,n+.032,t/2+.01,Ke),i.seg(-e*.3,n*.55,t/2+.003,e*.3,n*.55,t/2+.003,Ne)}function F_(i,e,t,n){i.block({x:[-e/2,e/2],y:[1,1+n],z:[-t/2,t/2]},q.darkBody,le),i.ring(0,1+n*.58,Math.min(e,n)*.28,t/2+.003,16,Ke),i.block({x:[-.015,.015],y:[1-.35,1],z:[t/2-.03,t/2]},q.dark),i.block({x:[-.06,.06],y:[1-.42,1-.35],z:[t/2-.05,t/2]},q.darkBody)}function N_(i,e,t,n){i.block({x:[-e/2,e/2],y:[.4,.4+n],z:[-t/2,t/2]},q.white,le),i.seg(-e/2+.025,.4+.025,t/2+.003,-e/2+.025,.4+n-.025,t/2+.003,Ne),i.seg(-e/2+.025,.4+n-.025,t/2+.003,e/2-.025,.4+n-.025,t/2+.003,Ne),i.block({x:[e/2-.06,e/2-.035],y:[.4+n*.5-.05,.4+n*.5+.05],z:[t/2,t/2+.012]},q.dark),i.block({x:[-e*.3,e*.3],y:[.4+n*.6,.4+n*.8],z:[t/2,t/2+.005]},q.dark),i.seg(-e*.22,.4+n*.7,t/2+.008,e*.22,.4+n*.7,t/2+.008,Ke)}function O_(i,e,t,n,r){if(r==="wall"){i.block({x:[-e/2,e/2],y:[.5,.5+n],z:[-t/2,t/2]},q.white,le),i.seg(-e*.3,.5+n*.9,t/2+.004,e*.3,.5+n*.9,t/2+.004,Ke),i.seg(-e*.3,.5+n*.08,t/2+.003,e*.3,.5+n*.08,t/2+.003,Ne);return}if(r==="cube"){i.block({x:[-e/2+.01,e/2-.01],y:[0,.03],z:[-t/2+.01,t/2-.01]},q.dark),i.block({x:[-e/2,e/2],y:[.03,n],z:[-t/2,t/2]},q.darkBody,le),i.seg(-e*.35,n*.85,t/2+.004,e*.35,n*.85,t/2+.004,Ke),i.block({x:[-e*.15,e*.15],y:[n,n+.025],z:[-.012,.012]},q.dark);return}i.block({x:[-e/2+.02,e/2-.02],y:[0,.06],z:[-t/2+.02,t/2-.02]},q.dark);let s=Math.max(2,Math.round((n-.06)/.3)),o=(n-.06)/s;for(let a=0;a[g[0]+h*m,g[1]+f*m];i.prism([e,t,p(t,o),p(e,o)],r,s,a,Ne)}var WR=i=>i.slice(1).map((e,t)=>[i[t],e]).filter(([e,t])=>Math.hypot(t[0]-e[0],t[1]-e[1])>.01);function XR(i,e,t,n,r){let s=e.build==="cantilever"?.07:.05;t.forEach((o,a)=>{let l=$y(o),c=a===0?0:t[a-1].top;if(e.build==="solid"){i.prism(o.poly,Math.min(r,o.top),o.top,q.body,le);return}if(i.prism(o.poly,o.top-s,o.top,q.wood,le),e.risers&&!o.landing){let[u,h]=[Math.min(c,o.top),Math.max(c,o.top)-s];D_(i,o.left[0],o.right[0],l,u,h,.02)}if(e.build==="stringer")for(let u of[o.left,o.right])for(let[h,f]of WR(u))D_(i,h,f,l,o.top-n-.2,o.top+.05,.04);else e.build==="mono"&&i.block({x:[l[0]-.07,l[0]+.07],y:[o.top-n-.12,o.top-s],z:[l[1]-.07,l[1]+.07]},q.metal)})}function YR(i,e,t){let n=e.rail==="both"?["left","right"]:e.rail==="none"?[]:[e.rail];for(let r of n){let s=[];for(let o of t)for(let a of o[r])s.push([a[0],o.top+rh,a[1]]);for(let[o,a]of t.entries()){if(o%2&&o!==t.length-1)continue;let l=a[r][0];i.cylinder(l[0],l[1],.012,a.top,a.top+rh,q.metal,6)}for(let o=1;o0&&i.cylinder(0,0,o.column,Math.min(0,a),s.down?0:r,q.metal,12,le),XR(i,s,o.treads,o.rise,a),YR(i,s,o.treads)}var qR=(i,e="Heizkreis")=>({id:i,name:e,kind:"heating",has_pump:!0,has_valve:!0});function $R(i){return{card:!0,...i==="heating_manifold"?{circuits:[qR("c1","Heizkreis 1")]}:{},...i==="buffer_tank"?{sensors:Array.from({length:7},(e,t)=>({id:`s${t+1}`,name:`F\xFChler ${t+1}`,entity:null,level:1-t/6}))}:{}}}function sh(i){return{...$R(i.type),...i.hydronic}}var oh=i=>i.has_pump!==!1,No=i=>i.kind!=="pump"&&i.has_valve!==!1,B_=(i,e)=>-.4+.8*(i+.5)/Math.max(1,e);function ah(i,e,t,n){let r=Math.min(i.w*.8/Math.max(1,n),i.h*.5),s=i.w*B_(t,n),o=s-r*.22,a=s+r*.22,l=i.d*.16,c=-i.d*.14,u=i.h*.15,h=i.h*.07,f=i.h*.24,d=i.h*.34,p=i.h*.55,g=i.h*.73,m=i.h*.87,x=Math.min(r*.04,i.h*.018,i.d*.08),b=Math.min(r*.13,i.h*.055,i.d*.28),_=Math.min(r*.09,i.h*.04,i.d*.18),y=Math.min(r*.06,i.h*.025,i.d*.14),M=l+Math.min(i.d*.28,b*.8),S=l+Math.min(i.d*.24,_*.9),v=l+x+y*.65,w=o-r*.13,C=a+r*.13,A=No(e)&&e.valve_type!=="two_way",R=Math.min(r*.23,i.h*.115),N=l+Math.min(i.d*.22,R*.4),O=e.kind==="pump"?i.h*.93:m,P=[{from:[o,u,c],to:[o,f,c],kind:"flow"},{from:[o,f,c],to:[o,f,l],kind:"flow"},{from:[o,f,l],to:[o,O,l],kind:"flow"},{from:[a,h,l],to:[a,O,l],kind:"return"}];return A&&P.push({from:[o,d,l],to:[a,d,l],kind:"mix"}),e.kind!=="pump"&&(P.push({from:[o,m,l],to:[s-R,m,l],kind:"flow"}),P.push({from:[s+R,m,l],to:[a,m,l],kind:"return"})),{x:s,column:r,flowX:o,returnX:a,frontZ:l,backZ:c,flowHeaderY:u,returnHeaderY:h,valveY:d,pumpY:p,temperatureY:g,loadY:m,loadR:R,loadFront:N,pipeR:x,pumpR:b,valveR:_,gaugeR:y,pumpFront:M,valveFront:S,gaugeFront:v,flowGaugeX:w,returnGaugeX:C,mixing:A,topY:O,pipes:P}}var Oo=et(10305854,13134678),lh=et(2645893,5151165),Tl=et(9597515,13215082),Lp=et(6909808,9607060),KR=et(3423294,5265755),ZR=et(10792104,13225663);function k_(i,e,t,n,r){let s=sh(e),o=n*.3,a=(c,u,h,f,d=Oo)=>i.cylinder(c,o,f,u,h,d,10,Ne),l=(c,u,h,f=q.dark)=>i.lyingCylinder("z",c,o,u-h,u+h,n*.5,h*2,f,16,le);if(e.type==="buffer_tank"){let c=Math.min(t,n)*.46;i.cylinder(0,0,c,r*.06,r*.94,q.darkBody,24,le),i.cylinder(0,0,c*.96,r*.94,r*.99,q.metal,24,Ne),i.cylinder(0,0,c*.98,r*.035,r*.06,q.metal,24,Ne);for(let u of[.12,.88])i.lyingCylinder("x",c*.95,0,r*u-.025,r*u+.025,t*.14,.05,u>.5?Oo:lh,12,le);for(let u of s.sensors??[]){let h=r*(.1+.8*u.level);i.lyingCylinder("z",0,c,h-.018,h+.018,.035,.036,Tl,10,Ne),i.ring(0,h,.025,c+.022,12,Ne)}for(let u of[-1,1])for(let h of[-1,1])i.cylinder(u*c*.52,h*c*.52,.025,0,r*.05,q.metal);return}if(i.block({x:[-t*.49,t*.49],y:[r*.02,r*.98],z:[-n*.48,-n*.35]},q.darkBody,le),e.type==="heating_manifold"){let c=s.circuits??[],u=Math.min(r*.025,n*.12);for(let[d,p,g]of[[r*.15,-n*.14,Oo],[r*.07,n*.16,lh]])i.lyingCylinder("x",0,p,d-u,d+u,t*.94,u*2,g,16,Ne);let h=(d,p,g,m=Oo)=>{let[x,b,_]=d,[y,M,S]=p;Math.abs(y-x)>1e-6?i.lyingCylinder("x",(x+y)/2,_,b-g,b+g,Math.abs(y-x),g*2,m,12,Ne):Math.abs(S-_)>1e-6?i.lyingCylinder("z",x,(_+S)/2,b-g,b+g,Math.abs(S-_),g*2,m,12,Ne):i.cylinder(x,_,g,Math.min(b,M),Math.max(b,M),m,12,Ne)},f=(d,p,g,m,x,b=Lp)=>i.lyingCylinder("z",d,(m+x)/2,p-g,p+g,x-m,g*2,b,24,Ne);c.forEach((d,p)=>{let g=ah(e,d,p,c.length);for(let m of g.pipes)h(m.from,m.to,g.pipeR,m.kind==="flow"?Oo:lh);if(d.kind!=="pump"){f(g.x,g.loadY,g.loadR,g.frontZ,g.loadFront,KR),i.ring(g.x,g.loadY,g.loadR*.55,g.loadFront+.001,24,Ne);let m=g.loadR*.45;for(let x=0;x<4;x++)i.seg(g.x-m+x*m/2,g.loadY-m*.3,g.loadFront+.002,g.x-m+(x+.5)*m/2,g.loadY+m*.3,g.loadFront+.002,le)}if(oh(d)){f(g.flowX,g.pumpY,g.pumpR,g.frontZ-g.pipeR,g.pumpFront,q.darkBody);for(let m of[-1,1])i.cylinder(g.flowX,g.frontZ,g.pipeR*1.65,g.pumpY+m*g.pumpR-g.pipeR*.5,g.pumpY+m*g.pumpR+g.pipeR*.5,Lp,12,Ne)}if(No(d)){f(g.flowX,g.valveY,g.valveR,g.frontZ-g.pipeR,g.valveFront,Tl);for(let m of[-1,1])i.cylinder(g.flowX,g.frontZ,g.pipeR*1.5,g.valveY+m*g.valveR-g.pipeR*.4,g.valveY+m*g.valveR+g.pipeR*.4,Tl,12,Ne);g.mixing&&h([g.flowX+g.valveR*.6,g.valveY,g.frontZ],[g.flowX+g.valveR*1.3,g.valveY,g.frontZ],g.pipeR*1.5,Tl),i.block({x:[g.flowX-g.valveR*.65,g.flowX+g.valveR*.65],y:[g.valveY-g.valveR*.65,g.valveY+g.valveR*.65],z:[g.frontZ,g.frontZ+(g.valveFront-g.frontZ)*.9]},q.darkBody,Ne)}for(let[m,x]of[[g.flowX,g.flowGaugeX],[g.returnX,g.returnGaugeX]])h([m,g.temperatureY,g.frontZ],[x,g.temperatureY,g.frontZ],g.pipeR*.5,Lp),f(x,g.temperatureY,g.gaugeR,g.frontZ,g.gaugeFront,ZR),i.ring(x,g.temperatureY,g.gaugeR*.8,g.gaugeFront+.001,16,Ne)})}else{i.block({x:[-t*.24,t*.24],y:[r*.35,r*.84],z:[-n*.2,n*.12]},Tl,le);for(let c=0;c<9;c++)i.seg(-t*.22+c*t*.055,r*.38,n*.13,-t*.22+c*t*.055,r*.81,n*.13,Ne);for(let[c,u]of[-.36,-.12,.12,.36].entries())a(t*u,0,r*(c<2?.9:.35),.018,c===1?lh:Oo),l(t*u,r*.28,.028,q.white);l(-t*.3,r*.55,Math.min(t,r)*.085,q.dark),l(t*.3,r*.55,Math.min(t,r)*.085,q.dark)}}function JR(i,e,t,n,r,s){switch(e.type){case"heating_manifold":case"buffer_tank":case"freshwater_station":return k_(i,e,t,n,r),"yes";case"sofa":return e.variant==="l"||e.variant==="u"?Ky(i,t,n,r,e.variant):Tp(i,t,n,r,Math.max(1,Math.round((t-.4)/.62))),"yes";case"armchair":return Tp(i,t,n,r,1),"yes";case"bed":return Zy(i,t,n,r),"yes";case"chair":return Jy(i,t,n,r),"yes";case"table":return x_(i,t,n,r),"yes";case"desk":return __(i,t,n,r),"yes";case"nightstand":return v_(i,t,n,r),"yes";case"wardrobe":return fi(i,t,n,r,Math.max(2,Math.round(t/.5)),r*.5),"yes";case"tall_cabinet":return fi(i,t,n,r,1,r*.5),"yes";case"shelf":return M_(i,t,n,r),"yes";case"kitchen":return n_(i,t,n,r),"yes";case"fridge":return r_(i,t,n,r),"yes";case"fridge_smart":return s_(i,t,n,r),"yes";case"stove":return o_(i,t,n,r),"yes";case"sink":return a_(i,t,n,r),"yes";case"bathtub":return f_(i,t,n,r),"yes";case"shower":return d_(i,t,n,r),"yes";case"wc":return p_(i,t,n,r),"yes";case"washbasin":return m_(i,t,n,r),"yes";case"tv_board":return C_(i,t,n,r,e.ambilight===0?le:void 0),"yes";case"plant":return A_(i,t,n,r),"yes";case"rug":return E_(i,t,n),"no";case"stairs":return e.stair?(U_(i,e,t,n,r),e.stair.down?"no":"yes"):(R_(i,t,n,r),"yes");case"stairwell":return"no";case"sideboard":return S_(i,t,n,r),"yes";case"dresser":return w_(i,t,n,r),"yes";case"coat_rack":return T_(i,t,n,r),"yes";case"bench":return Ap(i,t,n,r,!1),"yes";case"corner_bench":return Ap(i,t,n,r,!0),"yes";case"bar_stool":return jy(i,t,n,r),"yes";case"office_chair":return Qy(i,t,n,r),"yes";case"stool":return e_(i,t,n,r),"yes";case"kitchen_wall":return l_(i,t,n,r),"no";case"kitchen_tall":return c_(i,t,n,r),"yes";case"island":return u_(i,t,n,r),"yes";case"worktop":return i_(i,t,n,r),"no";case"dishwasher":return h_(i,t,n,r),"yes";case"washer":return Ip(i,t,n,r,!1),"yes";case"dryer":return Ip(i,t,n,r,!0),"yes";case"bunk_bed":return t_(i,t,n,r),"yes";case"table_round":return b_(i,t,n,r),"yes";case"coffee_table":return y_(i,t,n,r),"yes";case"tv_wall":return P_(i,t,n,r,e.ambilight===0?le:void 0),"no";case"parking":{let a=[[-t/2,-n/2],[t/2,-n/2],[t/2,n/2],[-t/2,n/2]];return a.forEach(([l,c],u)=>i.seg(l,.012,c,a[(u+1)%4][0],.012,a[(u+1)%4][1],Ne)),i.seg(-t*.15,.012,n/2-.45,0,.012,n/2-.2,le),i.seg(0,.012,n/2-.2,t*.15,.012,n/2-.45,le),"no"}case"robot_vacuum":return i.block({x:[-t*.45,t*.45],y:[0,r],z:[-n/2,-n/2+n*.3]},q.white,le),i.block({x:[-t*.2,t*.2],y:[r*.5,r*.62],z:[-n/2+n*.3,-n/2+n*.31]},q.accent),"no";case"radiator":return g_(i,t,n,r),"no";case"inverter":return I_(i,t,n,r,e.variant??null),"no";case"grid_point":return L_(i,t,n,r),"yes";case"wallbox":return F_(i,t,n,r),"no";case"meter":return N_(i,t,n,r),"no";case"home_battery":return O_(i,t,n,r,e.variant??null),e.variant==="wall"?"no":"yes";default:{let o=vt(e.type);return o?o.pet?"no":(Ss(i,o,t,n,r,s,null,null,e.variant??null),s>.05?"no":"yes"):(i.block({x:[-t/2,t/2],y:[0,r],z:[-n/2,n/2]},q.body,le),"yes")}}}function z_(i,e,t,n,r){let s=ws(n),o=new Fi(i,e,s),[a,l,c]=[Math.max(.05,n.w),Math.max(.05,n.d),Math.max(.005,n.h)];JR(o,n,a,l,c,r)==="yes"&&wb(t,s,a,l,n.type==="plant"?.35:.5)}function V_(i,e,t){let[n,r]=[Math.cos(t),Math.sin(t)],s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],o=[e[1]*i[2]-e[2]*i[1],e[2]*i[0]-e[0]*i[2],e[0]*i[1]-e[1]*i[0]];return[i[0]*n+o[0]*r+e[0]*s*(1-n),i[1]*n+o[1]*r+e[1]*s*(1-n),i[2]*n+o[2]*r+e[2]*s*(1-n)]}function jR(i,e,t,n,r){let[s,o]=[n.tilt_x??0,n.tilt_z??0];if(!s&&!o)return;let a=n.rotation*Math.PI/180,l=[Math.cos(a),0,Math.sin(a)],c=[-Math.sin(a),0,Math.cos(a)],u=(h,f)=>{for(let d=f;d+2c.screen);if(o){let c=e?Gt(e,i):0,[u,h]=[(o.x-o.w/2)*t,(o.x+o.w/2)*t],f=Math.min(.02,(h-u)*.05);return{x0:u+f,x1:h-f,y0:c+o.y*r+f,y1:c+(o.y+o.h)*r-f,z:(o.z+o.d/2)*n}}let a=e&&i.type!=="fridge_smart"?Gt(e,i)-jr(i):0,l=eC(i,t,n,r,e);return l&&{...l,y0:l.y0+a,y1:l.y1+a}}function ch(i,e){let t=tC(i,e);return t&&i.mirror?{...t,x0:-t.x1,x1:-t.x0}:t}function Fp(i,e){let[t,n,r]=[Math.max(.05,i.w),Math.max(.05,i.d),Math.max(.005,i.h)],s=vt(i.type),o=s&&ta(s,t,n,r).find(h=>h.picture);if(!o)return null;let a=e?Gt(e,i):0,[l,c]=[(o.x-o.w/2)*t,(o.x+o.w/2)*t],u={x0:l,x1:c,y0:a+o.y*r,y1:a+(o.y+o.h)*r,z:(o.z+o.d/2)*n};return i.mirror?{...u,x0:-u.x1,x1:-u.x0}:u}function Np(i,e){if(i.type!=="home_battery")return null;let[t,n,r]=[Math.max(.05,i.w),Math.max(.05,i.d),Math.max(.05,i.h)],s=e?Gt(e,i)-jr(i):0,o=n/2+.005;return i.variant==="wall"?{rect:{x0:-t*.3,x1:t*.3,y0:s+.5+r*.84,y1:s+.5+r*.9,z:o},vertical:!1}:i.variant==="cube"?{rect:{x0:-t*.35,x1:t*.35,y0:s+r*.8,y1:s+r*.86,z:o},vertical:!1}:{rect:{x0:-t*.05,x1:t*.05,y0:s+.06+r*.16,y1:s+r-.12,z:o},vertical:!0}}var Jn=Math.PI/180,pr=(i,e)=>[i[0]-e[0],i[1]-e[1],i[2]-e[2]];var Do=i=>Math.hypot(i[0],i[1],i[2]),Is=i=>{let e=Do(i)||1;return[i[0]/e,i[1]/e,i[2]/e]},G_=(i,e)=>[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]];var W_=.25;function X_(i,e,t,n,r,s,o){let a=r-t>=s-n,l=a?r-t:s-n;return{key:`${i}:top`,section:e,side:"top",flat:!0,o:[t,o,n],eu:a?[1,0,0]:[0,0,1],es:a?[0,0,1]:[1,0,0],n:[0,1,0],lu:l,ls:a?s-n:r-t,pitch:0,span:()=>[0,l],facing:a?[0,1]:[1,0]}}function Y_(i,e){let t=Is(G_(i,e));return t[1]<0?[-t[0],-t[1],-t[2]]:t}var q_=i=>{let e=Is([-i[0],0,-i[2]]);return[e[0],e[2]]};function mr(i,e,t,n,r,s,o,a){let l=Is(pr(r,n)),c=Is(pr(s,n));return{key:i,section:e,side:t,flat:!1,o:n,eu:l,es:c,n:Y_(l,c),lu:Do(pr(r,n)),ls:Do(pr(s,n)),pitch:o,span:a,facing:q_(c)}}function H_(i,e,t,n,r,s){let o=Do(pr(r,n));if(o<.3)return null;let a=Is(pr(r,n)),l=pr(s,n),c=l[0]*a[0]+l[1]*a[1]+l[2]*a[2],u=[l[0]-a[0]*c,l[1]-a[1]*c,l[2]-a[2]*c],h=Do(u);if(h<.3)return null;let f=Is(u),d=p=>{let g=Math.min(1,Math.max(0,p/h));return[c*g,o-(o-c)*g]};return{key:i,section:e,side:t,flat:!1,o:n,eu:a,es:f,n:Y_(a,f),lu:o,ls:h,pitch:Math.atan2(f[1],Math.hypot(f[0],f[2]))/Jn,span:d,facing:q_(f)}}function nC(i,e){let t=Dn(i),n=En(i),r=(b,_,y)=>{let[M,S]=t.at(b,_);return[M,y,S]},[s,o]=[Math.max(0,e.a),Math.max(0,e.b)],a=t.u0-Math.max(0,e.u0),l=t.u1+Math.max(0,e.u1),c=l-a,u=n.y(-s),h=n.y(t.w+o);if(i.shape==="flat"||i.shape==="parapet"){let[b,_]=[t.at(a,-s),t.at(l,t.w+o)];return[X_(i.id,i.id,Math.min(b[0],_[0]),Math.min(b[1],_[1]),Math.max(b[0],_[0]),Math.max(b[1],_[1]),i.eave_a+W_)]}if(i.shape==="pent")return[mr(`${i.id}:a`,i.id,"a",r(a,-s,u),r(l,-s,u),r(a,t.w+o,h),i.pitch_a,()=>[0,c])];if(i.shape==="mansard")return iC(i,t,a,l,s,o);let f=i.shape==="hip"||i.shape==="pyramid",d=(t.u1-t.u0)/2,p=i.shape==="pyramid"?d:f?Math.min(d,Math.min(n.vr,t.w-n.vr)||t.w/2):0,g=f?t.u0+p-a:0,m=f?l-(t.u1-p):0,x=[];if(n.vr>.3){let b=Math.hypot(n.vr+s,n.rh-u);x.push(mr(`${i.id}:a`,i.id,"a",r(a,-s,u),r(l,-s,u),r(a,n.vr,n.rh),i.pitch_a,_=>[g*(_/b),c-m*(_/b)]))}if(t.w-n.vr>.3){let b=Math.hypot(t.w+o-n.vr,n.rh-h);x.push(mr(`${i.id}:b`,i.id,"b",r(l,t.w+o,h),r(a,t.w+o,h),r(l,n.vr,n.rh),i.pitch_b,_=>[m*(_/b),c-g*(_/b)]))}if(f){let b=H_(`${i.id}:c`,i.id,"c",r(a,t.w+o,h),r(a,-s,u),r(t.u0+p,n.vr,n.rh)),_=H_(`${i.id}:d`,i.id,"d",r(l,-s,u),r(l,t.w+o,h),r(t.u1-p,n.vr,n.rh));x.push(...[b,_].filter(y=>y!==null))}return x}function iC(i,e,t,n,r,s){let o=cl(e.w,i.eave_a,i.eave_b,hr(i.pitch_a),hr(i.pitch_b)),a=(p,g)=>{let[m,x]=e.at(p,g);return[m,o.y(g),x]},l=n-t,c=()=>[0,l],u=(p,g)=>Math.atan2(p,g)/Jn,h=[],[f,d]=[e.w+s,e.w-o.vlb];return o.vla+r>.3&&h.push(mr(`${i.id}:a`,i.id,"a",a(t,-r),a(n,-r),a(t,o.vla),i.pitch_a,c)),o.vr-o.vla>.3&&h.push(mr(`${i.id}:au`,i.id,"a",a(t,o.vla),a(n,o.vla),a(t,o.vr),u(o.rh-o.yla,o.vr-o.vla),c)),o.vlb+s>.3&&h.push(mr(`${i.id}:b`,i.id,"b",a(n,f),a(t,f),a(n,d),i.pitch_b,c)),d-o.vr>.3&&h.push(mr(`${i.id}:bu`,i.id,"b",a(n,d),a(t,d),a(n,o.vr),u(o.rh-o.ylb,d-o.vr),c)),h}function $_(i){return i.floors.filter(t=>t.rooms.some(n=>n.points.length>=3)).sort((t,n)=>n.elevation-t.elevation)[0]??null}function Ls(i){let e=i.settings.roof;if(!e||e.type==="none")return[];if(e.type==="custom")return(e.sections??[]).flatMap(_=>nC(_,hl(i,_,_.overhang??e.overhang)));let t=$_(i);if(!t)return[];let n=t.rooms.flatMap(_=>_.points.map(y=>y[0])),r=t.rooms.flatMap(_=>_.points.map(y=>y[1])),s=i.settings.wall_exterior+e.overhang,[o,a]=[Math.min(...n)-s,Math.max(...n)+s],[l,c]=[Math.min(...r)-s,Math.max(...r)+s],u=t.elevation+t.height;if(e.type==="flat")return[X_("main",null,o,l,a,c,u+W_)];let h=a-o>=c-l,f=e.ridge==="short"?!h:h,d=(f?c-l:a-o)/2,p=d*Math.tan(e.pitch*Jn),g=(_,y,M)=>f?[_,u+M,(l+c)/2+y]:[(o+a)/2+y,u+M,_],[m,x]=f?[o,a]:[l,c],b=()=>[0,x-m];return[mr("main:a",null,"a",g(m,-d,0),g(x,-d,0),g(m,0,p),e.pitch,b),mr("main:b",null,"b",g(m,d,0),g(x,d,0),g(m,0,p),e.pitch,b)]}function uh(i,e){let t=[];for(let n of i.floors.filter(r=>!e||r.id===e)){let{walls:r}=ul(n.rooms,{exterior:i.settings.wall_exterior,interior:i.settings.wall_interior},n.walls??[]);for(let s of r){if(!s.exterior&&!s.free)continue;let[o,a]=[s.b[0]-s.a[0],s.b[1]-s.a[1]],l=Math.hypot(o,a);if(l<1.2)continue;let[c,u]=[a/l,-o/l],h=Math.min(n.height,s.height??n.height,s.heightEnd??1/0),f=(d,p,g,m)=>t.push({key:d,section:null,side:"top",flat:!1,o:p,eu:g,es:[0,1,0],n:m,lu:l,ls:h,pitch:90,span:()=>[0,l],facing:[m[0],m[2]],wall:{floorId:n.id}});f(`wall:${n.id}:${s.id}`,[s.a[0]+c*s.right,n.elevation,s.a[1]+u*s.right],[o/l,0,a/l],[c,0,u]),s.free&&f(`wall:${n.id}:${s.id}:back`,[s.b[0]-c*s.left,n.elevation,s.b[1]-u*s.left],[-o/l,0,-a/l],[-c,0,-u])}}return t}var El="ground";function hh(i){let e=i.floors.filter(t=>t.rooms.some(n=>n.points.length>=3)).sort((t,n)=>t.elevation-n.elevation);return e.find(t=>t.elevation>-.5)??e[0]??i.floors[0]??null}function fh(i,e){let t=(e.rotation??0)*Jn,n=[Math.cos(t),0,Math.sin(t)],r=[-Math.sin(t),0,Math.cos(t)],s=hh(i),o=n[0]*e.u+r[0]*e.v,a=n[2]*e.u+r[2]*e.v,l=s?s.elevation+(e.base!=null?e.base:w0(s,o,a)):e.base??0;return{key:El,section:null,side:"top",flat:!0,o:[0,l,0],eu:n,es:r,n:[0,1,0],lu:1e4,ls:1e4,pitch:0,span:()=>[-1e4,1e4],facing:[r[0],r[2]],unbounded:!0}}var Op=1.13,Dp=1.72,Uo=.025,di=.07;function Rl(i){let e=i.module_w||Op,t=i.module_h||Dp;return i.portrait===!1?[t,e]:[e,t]}function Up(i){return i.layout?.length?i.layout.map(e=>Math.max(0,Math.min(60,Math.round(e)))):Array.from({length:Math.max(1,i.rows)},()=>Math.max(1,i.cols))}function Bp(i,e){return i.flat?Math.min(45,Math.max(0,e.tilt??15))*Jn:i.wall?Math.min(90,Math.max(0,e.tilt??0))*Jn:Math.min(45,Math.max(0,e.tilt??0))*Jn}function ph(i,e){let[,t]=Rl(e),n=Bp(i,e);return i.wall?t*Math.cos(n)+Uo:!i.flat&&n<.001?t+Uo:i.flat&&e.rack==="ew"?t*Math.cos(n)+.08:t*Math.cos(n)+Math.max(.3,2*t*Math.sin(n))}function kp(i,e){let[t,n]=Rl(e),r=Up(e),s=Math.max(1,...r);return[s*t+(s-1)*Uo,(r.length-1)*ph(i,e)+n*Math.cos(Bp(i,e))]}var rC=i=>i.flat&&!i.unbounded&&!i.wall;function sC(i,e){if(!rC(i)||!e.rotation)return null;let t=e.rotation*Jn,[n,r]=kp(i,e);return{cos:Math.cos(t),sin:Math.sin(t),u:e.u+n/2,s:e.v+r/2}}function Bo(i,e,t=!1){let[n,r]=Rl(e),s=Bp(i,e),o=r*Math.cos(s),a=ph(i,e),l=Up(e),c=Math.max(1,...l),u=new Set(e.skip??[]),h=sC(i,e),f=(m,x)=>h?[h.u+(m-h.u)*h.cos-(x-h.s)*h.sin,h.s+(m-h.u)*h.sin+(x-h.s)*h.cos]:[m,x],d=(m,x,b)=>{let[_,y]=f(m,x);return[0,1,2].map(M=>i.o[M]+i.eu[M]*_+i.es[M]*y+i.n[M]*b)},p=(m,x)=>{let[b,_]=f(m,x);if(i.unbounded)return!0;if(_<-1e-6||_>i.ls+1e-6)return!1;let[y,M]=i.span(_);return b>=y-1e-6&&b<=M+1e-6},g=[];return l.forEach((m,x)=>{let b=e.align==="right"?c-m:e.align==="center"?(c-m)/2:0;for(let _=0;_.001?o:r);if([[S,w],[v,w],[v,C],[S,C]].every(([A,R])=>p(A,R)))if(i.wall&&s>.001){let A=di+r*Math.sin(s),[R,N]=e.flip?[A,di]:[di,A],O=[d(S,w,R),d(v,w,R),d(v,C,N),d(S,C,N)],P=e.flip?w:C;g.push({corners:O,posts:[S+.05,v-.05].map(I=>[d(I,P,0),d(I,P,A)]),cell:y,skipped:M})}else if(!i.flat&&s>.001){let A=di+r*Math.sin(s),R=[d(S,w,di),d(v,w,di),d(v,C,A),d(S,C,A)];g.push({corners:R,posts:[S+.05,v-.05].map(N=>[d(N,C,0),d(N,C,A)]),cell:y,skipped:M})}else if(!i.flat)g.push({corners:[d(S,w,di),d(v,w,di),d(v,C,di),d(S,C,di)],posts:[],cell:y,skipped:M});else{let R=.15+r*Math.sin(s),N=e.rack==="ew"&&x%2===1?!e.flip:!!e.flip,[O,P]=N?[C,w]:[w,C],I=[d(S,O,.15),d(v,O,.15),d(v,P,R),d(S,P,R)],D=[S+.05,v-.05].flatMap(F=>[[d(F,O,0),d(F,O,.15)],[d(F,P,0),d(F,P,R)]]);g.push({corners:I,posts:D,cell:y,skipped:M})}}}),g}var zp=.78,Vp=1.18,K_=i=>({id:i.id,face:i.face,u:i.u,v:i.v,rows:1,cols:1,portrait:!0,module_w:i.w||zp,module_h:i.h||Vp});function Cl(i,e){let t=Bo(i,K_(e))[0];if(!t)return null;let n=r=>[r[0]-i.n[0]*.05,r[1]-i.n[1]*.05,r[2]-i.n[2]*.05];return t.corners.map(n)}var dh={brick:{w:.5,d:.5,h:1},round:{w:.4,d:.4,h:1},wide:{w:1,d:.5,h:1},steel:{w:.2,d:.2,h:1.2}};function mh(i){let e=i.shape??"brick",t=dh[e]??dh.brick;return{shape:e,w:i.w||t.w,d:i.d||t.d,h:i.h||t.h}}function Gp(i,e){let{w:t,d:n}=mh(i),r=e&&!e.flat?Math.cos(e.pitch*Jn):1;return{id:i.id,face:i.face,u:i.u,v:i.v,rows:1,cols:1,portrait:!0,module_w:t,module_h:n/Math.max(.2,r),tilt:0}}function Hp(i,e){let t=Gp(e,i),[n,r]=[t.module_w,t.module_h],s=(u,h)=>[i.o[0]+i.eu[0]*u+i.es[0]*h,i.o[1]+i.eu[1]*u+i.es[1]*h,i.o[2]+i.eu[2]*u+i.es[2]*h],[o,a]=[s(e.u+n/2,e.v),s(e.u+n/2,e.v+r)],l=s(e.u+n/2,e.v+r/2),c=u=>{let h=Math.hypot(u[0],u[2])||1;return[u[0]/h,u[2]/h]};return{center:[l[0],l[2]],along:c(i.eu),across:c(i.es),low:Math.min(o[1],a[1]),high:Math.max(o[1],a[1])}}var Fs=1712952,Ns=2239816,gh=1318193,gr=ke(3662079,.9),xr=ke(5995775,.45),Xt=.14,Z_=9427199,J_=13226982,j_=14936565,Q_={black:{glass:new W(329483),edge:ke(9082544,.32),cells:ke(2766160,.22)},blue:{glass:new W(1386842),edge:ke(10467583,.55),cells:ke(4025599,.35)}},ev=ke(13226982,.5),tv=ke(13226982,.85),nv=ke(16757575,.95),Wp=new W(2845583),Xp=new W(3818072),Yp=3812144,qp=4864064,xh=2765896,ko=329483,bh=9148333,yh=11845844,iv=ke(5995775,.4);var zo=(i,e,t)=>[i[0]+(e[0]-i[0])*t,i[1]+(e[1]-i[1])*t,i[2]+(e[2]-i[2])*t],_h=(i,e,t)=>[i[0]+e[0]*t,i[1]+e[1]*t,i[2]+e[2]*t],$p=(i,e)=>e.section?i.find(t=>t.sections?.includes(e.section)):i[0];function rv(i,e,t){let n=i.settings.roof?.windows??[];if(n.length===0||e.length===0)return;let r=new Map(Ls(i).map(s=>[s.key,s]));for(let s of n){let o=r.get(s.face),a=o?Cl(o,s):null,l=o&&a?$p(e,o):void 0;if(!o||!a||!l)continue;let c=l.floor.elevation+l.base,[u,h,f,d]=a.map(C=>[C[0],C[1]-c,C[2]]),p=t.get(s.id)??{open:0,tilt:0,cover:0},g=(C,A)=>_h(C,o.n,A),m=p.open>.02||p.tilt>.02?nv:tv,x=[u,h,f,d].map(C=>g(C,.06));x.forEach((C,A)=>l.lines.seg(C,x[(A+1)%4],m));let b=(p.open>.02?30*Math.min(1,p.open):p.tilt>.5?12:0)*mt,_=Math.hypot(f[0]-h[0],f[1]-h[1],f[2]-h[2]),y=C=>_h(_h(C,o.es,-_*Math.cos(b)),o.n,_*Math.sin(b)),[M,S]=[g(d,.065),g(f,.065)],[v,w]=[y(M),y(S)];l.solid.tri(v,w,S,Wp),l.solid.tri(v,S,M,Wp);for(let[C,A]of[[v,w],[w,S],[S,M],[M,v]])l.lines.seg(C,A,m);if(p.cover>.02){let C=Math.min(1,p.cover),[A,R]=[g(zo(M,v,C),.01),g(zo(S,w,C),.01)],[N,O]=[g(M,.01),g(S,.01)];l.solid.tri(A,R,O,Xp),l.solid.tri(A,O,N,Xp)}}}function vh(i,e,t,n,r){let s=c=>[c[0],c[1]-r,c[2]],o=Q_[n.look==="blue"?"blue":"black"],[a,l]=n.portrait===!1?[10,6]:[6,10];for(let c of Bo(t,n)){let[u,h,f,d]=c.corners.map(s);for(let[m,x,b]of[[u,h,f],[u,f,d],[u,f,h],[u,d,f]])i.tri(m,x,b,o.glass);let p=m=>_h(m,t.n,.004),g=[u,h,f,d].map(p);g.forEach((m,x)=>e.seg(m,g[(x+1)%4],o.edge));for(let m=1;m[r.key,r]));for(let r of t){let s=n.get(r.face),o=s?$p(e,s):void 0;s&&o&&vh(o.solid,o.lines,s,r,o.floor.elevation+o.base)}}function ov(i,e){let t=i.settings.roof?.chimneys??[];if(t.length===0||e.length===0)return;let n=new Map(Ls(i).map(r=>[r.key,r]));for(let r of t){let s=n.get(r.face),o=s?$p(e,s):void 0;if(!s||!o)continue;let a=o.floor.elevation+o.base,{shape:l,w:c,d:u,h}=mh(r),f=Hp(s,r),[d,p]=[f.low-a-.1,f.high-a+h],g=(v,w)=>{let{center:C,along:A,across:R}=f,N=(O,P)=>[C[0]+A[0]*v*O+R[0]*w*P,C[1]+A[1]*v*O+R[1]*w*P];return[N(-1,-1),N(1,-1),N(1,1),N(-1,1)]},m=(v,w=16)=>Array.from({length:w},(C,A)=>[f.center[0]+Math.cos(A/w*2*Math.PI)*v,f.center[1]+Math.sin(A/w*2*Math.PI)*v]),x=(v,w)=>v.forEach((C,A)=>o.lines.seg([C[0],w,C[1]],[v[(A+1)%v.length][0],w,v[(A+1)%v.length][1]],iv)),b=(v,w,C,A,R)=>Tt(o.solid,lC(v),w,C,A,R);if(l==="steel"){let v=Math.min(c,u)/2;b(m(v,12),d,p,bh,yh),b(m(v*.75,12),p,p+.001,ko,ko),b(m(v*.25,6),p,p+.1,bh,yh);let w=m(v*1.9,12);b(w,p+.1,p+.13,bh,yh),x(w,p+.13);continue}if(l==="round"){let v=Math.min(c,u)/2,w=m(v);b(w,d,p,Yp,qp),b(m(v*.55),p,p+.002,ko,ko),x(w,p);continue}let _=g(c/2,u/2);b(_,d,p,Yp,qp);let y=g(c/2+.04,u/2+.04);b(y,p,p+.06,xh,xh),x(y,p+.06),x(_,p-.25);let M=Math.min(c,u)*.25,S=l==="wide"?[-c/4,c/4]:[0];for(let v of S){let w=[f.center[0]+f.along[0]*v,f.center[1]+f.along[1]*v],C=[[-1,-1],[1,-1],[1,1],[-1,1]].map(([A,R])=>[w[0]+f.along[0]*M*A+f.across[0]*M*R,w[1]+f.along[1]*M*A+f.across[1]*M*R]);b(C,p+.06,p+.16,xh,ko)}}}function lC(i){let e=0;for(let t=0;t0,r.b>0,r.u0>0,r.u1>0],f=(p,g,m,x,b,_)=>{let y=[t.at(p,m),t.at(g,m),t.at(g,x),t.at(p,x)],M=(y[1][0]-y[0][0])*(y[2][1]-y[0][1])-(y[2][0]-y[0][0])*(y[1][1]-y[0][1]);Tt(i,M<0?[...y].reverse():y,b-o,_-o,J_,j_,{bottom:!0})};for(let[p,g]of[[0,l],[a,c]]){if(!g)continue;let m=n.y(p)-.03,x=p===0?0:a-jn;f(t.u0,t.u1,x,x+jn,m-Pl,m),e.seg(s(t.u0,p,m-Pl),s(t.u1,p,m-Pl),xr)}for(let[p,g]of[[t.u0,u],[t.u1-jn,h]])if(g)for(let m=0;m<6;m++){let[x,b]=[a*m/6,a*(m+1)/6],_=Math.min(n.y(x),n.y(b))-.03;f(p,p+jn,x,b,_-Pl,_)}let d=[];for(let[p,g]of[[0,l],[a-jn,c]]){if(!g)continue;let m=t.u1-t.u0-jn,x=Math.max(1,Math.ceil(m/3.5));for(let b=0;b<=x;b++)b===0&&!u||b===x&&!h||d.push([t.u0+m*b/x,p])}!l&&!c&&(u&&d.push([t.u0,a/2-jn/2]),h&&d.push([t.u1-jn,a/2-jn/2]));for(let[p,g]of d)f(p,p+jn,g,g+jn,o,n.y(g+jn/2)-.03-Pl)}function cC(i,e){let t=[];if(i.forEach(([s,o],a)=>{o>=e&&t.push([s,o]);let l=i[a+1];if(l&&(o-e)*(l[1]-e)<0){let c=(e-o)/(l[1]-o);t.push([s+(l[0]-s)*c,e])}}),t.length<2)return[];let[n,r]=[t[0],t[t.length-1]];return r[1]>e&&t.push([r[0],e]),n[1]>e&&t.unshift([n[0],e]),t}var lv=i=>Mr(i)>=0?i:[...i].reverse();function cv(i,e,t,n,r,s=i,o=!1,a=[],l=null){let c=Dn(t),u=En(t),h=typeof n=="number"?{u0:n,u1:n,a:n,b:n}:n,[f,d]=[Math.max(0,h.a),Math.max(0,h.b)],p=c.w,g=c.u0-Math.max(0,h.u0),m=c.u1+Math.max(0,h.u1),x=(I,D,F)=>{let[H,B]=c.at(I,D);return[H,F-r,B]},b=new W(Ns),_=new W(Fs),y=new W(gh),M=(I,D)=>{for(let F=1;F+1x(I,D,F-H),v=[],w=[],C=[],A=null,R=null;if(t.shape==="flat"||t.shape==="parapet"){let I=t.eave_a-r,D=t.shape==="parapet",F=t.points&&t.points.length>=3?np(t,D?0:Math.max(0,Math.min(h.a,h.b,h.u0,h.u1))):D?[c.at(c.u0,0),c.at(c.u1,0),c.at(c.u1,p),c.at(c.u0,p)]:[c.at(g,-f),c.at(m,-f),c.at(m,p+d),c.at(g,p+d)];if(Tt(i,F,I,I+.25,Fs,Ns,{bottom:!0}),F.forEach((H,B)=>{let X=F[(B+1)%F.length];e.seg([H[0],I+.252,H[1]],[X[0],I+.252,X[1]],gr),e.seg([H[0],I,H[1]],[X[0],I,X[1]],xr)}),D){let H=lv(F),B=Bu(H,-.2);H.forEach((X,V)=>{let re=(V+1)%H.length;Tt(i,lv([X,H[re],B[re],B[V]]),I+.25,I+.65,Fs,Ns),e.seg([X[0],I+.652,X[1]],[H[re][0],I+.652,H[re][1]],gr),e.seg([B[V][0],I+.652,B[V][1]],[B[re][0],I+.652,B[re][1]],gr)})}}else{let I=Hr(t,h);v=a.reduce((D,F)=>D.flatMap(H=>ku(H,F)),I.faces),w=I.rim,C=I.ridges,A=I.gable,R=I.endProfiles??null}let N=!!t.open,O=new W(Z_);for(let I of v)if(N)for(let D=1;D+1S(D)),b),M(I.map(D=>S(D,Xt)),_);if(w.forEach((I,D)=>{let F=w[(D+1)%w.length];N||M([S(I),S(F),S(F,Xt),S(I,Xt)],_),e.seg(S(I),S(F),N?gr:xr)}),N){av(i,e,c,u,h,(I,D,F)=>x(I,D,F),r);return}for(let[I,D]of C)e.seg(S([I[0],I[1],I[2]+.004]),S([D[0],D[1],D[2]+.004]),gr);let P=t.base;if(!o){if(A){let I=l===null?[c.u0,c.u1]:[l===0?c.u0:c.u1];for(let D of I){let F=R?R[D===c.u0?0:1]:A,H=F?cC(F,P-Xt):[];H.length>=3&&M(H.map(([B,X])=>x(D,B,X)),y)}}if(t.shape!=="flat"&&t.shape!=="parapet")for(let I of[0,p]){let D=u.y(I)-Xt;D>P+.02&&M([x(c.u0,I,P),x(c.u1,I,P),x(c.u1,I,D),x(c.u0,I,D)],y)}else if(t.eave_a>P+.02){let I=[[c.u0,0],[c.u1,0],[c.u1,p],[c.u0,p]];I.forEach(([D,F],H)=>{let[B,X]=I[(H+1)%4];M([x(D,F,P),x(B,X,P),x(B,X,t.eave_a),x(D,F,t.eave_a)],y)})}}}function uv(i,e,t){let n=i.floors.filter(o=>o.rooms.length>0).sort((o,a)=>o.elevation-a.elevation);if(n.length===0)return[];let r=new Map,s=new Map(Ls(i).map(o=>[o.key,o]));for(let o of e){if(Math.abs(o.x1-o.x0)<.1||Math.abs(o.z1-o.z0)<.1)continue;let a=sp(i,o)??n[0],l=o.open?`${a.id}:open`:a.id,c=r.get(l);c||r.set(l,c={floor:a,base:0,solid:new ut,lines:new Wt,glass:new ut,sections:[],lift:!o.open}),c.sections.push(o.id);let u=dl(e,o),h=Es(e,o)??u?.parent??null,f=a.elevation+a.height>o.base+.05&&!o.dormer&&!h,d=e.filter(m=>m!==o).flatMap(m=>Es(e,m)===o?Vu(o,m):dl(e,m)?.parent===o?Vu(o,dl(e,m).extended):[]);for(let m of i.settings.roof.windows??[]){let x=s.get(m.face),b=x&&x.section===o.id?Cl(x,m):null;if(!b)continue;let _=b.map(y=>Ni(o,y[0],y[2]));d.push({u0:Math.min(..._.map(y=>y[0])),u1:Math.max(..._.map(y=>y[0])),v0:Math.min(..._.map(y=>y[1])),v1:Math.max(..._.map(y=>y[1]))})}let p=u?u.extended:h?fl(h,o):o,g=null;if(h){let m=Dn(p),x=Hr(h,{u0:0,u1:0,a:0,b:0}),b=_=>{let[y,M]=m.at(_,m.w/2),[S,v]=Ni(h,y,M);return As(x,S,v)??En(h).y(v)};g=b(m.u0)<=b(m.u1)?0:1}cv(c.solid,c.lines,p,hl(i,p,p.overhang??t),a.elevation,c.glass,f,d,g)}return[...r.values()].sort((o,a)=>+(o.lift===!1)-+(a.lift===!1))}function hv(i){return i.floors.filter(e=>e.rooms.some(t=>t.points.length>=3)).sort((e,t)=>t.elevation-e.elevation)[0]??null}function fv(i){let e=i.settings.roof,t=hv(i);if(!t||!e||e.type==="none"||e.type==="custom")return null;let n=t.rooms.flatMap(N=>N.points.map(O=>O[0])),r=t.rooms.flatMap(N=>N.points.map(O=>O[1])),s=i.settings.wall_exterior+e.overhang,[o,a]=[Math.min(...n)-s,Math.max(...n)+s],[l,c]=[Math.min(...r)-s,Math.max(...r)+s],u=new ut,h=new Wt,f={floor:t,base:t.height,solid:u,lines:h,glass:new ut};if(e.type==="flat"){let N=[[o,l],[a,l],[a,c],[o,c]];return Tt(u,N,0,.25,Fs,Ns,{bottom:!0}),N.forEach(([O,P],I)=>{let[D,F]=N[(I+1)%4];h.seg([O,.252,P],[D,.252,F],gr),h.seg([O,0,P],[D,0,F],xr)}),f}let d=a-o>=c-l,p=e.ridge==="short"?!d:d,g=(p?c-l:a-o)/2,m=Math.tan(e.pitch*mt),x=g*m,b=(N,O,P)=>p?[N,P,(l+c)/2+O]:[(o+a)/2+O,P,N],[_,y]=p?[o,a]:[l,c],M=new W(Ns),S=new W(Fs),v=(N,O,P,I,D)=>{u.tri(N,O,P,D),u.tri(N,P,I,D)};for(let N of[-1,1]){v(b(_,N*g,0),b(y,N*g,0),b(y,0,x),b(_,0,x),M),v(b(_,N*g,-Xt),b(_,0,x-Xt),b(y,0,x-Xt),b(y,N*g,-Xt),S),v(b(_,N*g,-Xt),b(y,N*g,-Xt),b(y,N*g,0),b(_,N*g,0),S);for(let O of[_,y])v(b(O,N*g,-Xt),b(O,N*g,0),b(O,0,x),b(O,0,x-Xt),S);h.seg(b(_,N*g,0),b(y,N*g,0),xr);for(let O of[_,y])h.seg(b(O,N*g,0),b(O,0,x),xr)}let w=e.overhang,C=new W(gh),A=g-w,R=A*m;for(let N of[_+w,y-w])u.tri(b(N,-A,-Xt),b(N,A,-Xt),b(N,0,R-Xt),C),u.tri(b(N,A,-Xt),b(N,-A,-Xt),b(N,0,R-Xt),C);return h.seg(b(_,0,x+.004),b(y,0,x+.004),gr),f}function Kp(i,e=new Map){let t=i.settings.roof,n=t?.type==="custom"?null:fv(i),r=t?.type==="custom"?uv(i,t.sections??[],t.overhang):n?[n]:[];return sv(i,r),rv(i,r,e),ov(i,r),r}function Mh(i){let{start:e,axis:t,width:n}=i.info;return[[e[0],e[1]],[e[0]+t[0]*n,e[1]+t[1]*n]]}var dv=(i,e)=>`${i}|${Math.round(e[0]*50)},${Math.round(e[1]*50)}`;function pv(i,e){let t=[];for(let n of i){let r=n.info.opening.front;if(!r)continue;let[s,o]=Mh(n);e.at(r,s)&&t.push(n.s0),e.at(r,o)&&t.push(n.s1)}return t}function mv(i,e){let t=Math.hypot(i.b[0]-i.a[0],i.b[1]-i.a[1])||1;return((e[0]-i.a[0])*(i.b[0]-i.a[0])+(e[1]-i.a[1])*(i.b[1]-i.a[1]))/t}function Sh(i){let e=new Map,t=new Map;for(let r of i)for(let s of r){let o=s.info.opening.front;if(o)for(let a of Mh(s)){let l=dv(o,a);e.set(l,(e.get(l)??0)+1),t.has(l)||t.set(l,[a[0],a[1]])}}return{points:[...e].filter(([,r])=>r>1).map(([r])=>t.get(r)).filter(r=>!!r),at:(r,s)=>(e.get(dv(r,s))??0)>1}}var Os={floor:923177,slab:659744,wall:1252657,wallTop:1323071,edge:3662079,edgeSoft:5995775},wh={wood:{color:1120814,tile:[0,0]},oak:{color:1252141,tile:[1,0]},tiles:{color:923695,tile:[2,0]},carpet:{color:1053995,tile:[0,1]},stone:{color:988971,tile:[1,1]},concrete:{color:1120295,tile:[2,1]}},pi=.2,Vo=8;var gv=(i,e)=>i.heightEnd===void 0?i.height??e:Math.max(i.height??e,i.heightEnd);function xv(i){let e=new Map,t=[],n=new Map;for(let r of i){let s="interior",o=null;if(r.exterior){let[a,l]=[r.b[0]-r.a[0],r.b[1]-r.a[1]],c=Math.hypot(a,l)||1,u=[l/c,-a/c],h=(Math.round(Math.atan2(u[1],u[0])/(2*Math.PI)*Vo)%Vo+Vo)%Vo;s=`s${h}`;let f=h/Vo*2*Math.PI;o=[Math.cos(f),Math.sin(f)]}e.has(s)||(e.set(s,t.length),t.push(o)),n.set(r,e.get(s))}return{buckets:t,wallBucket:n}}function bv(i){let e=(n,r,s)=>{let o=i?i(n,r):null;return o===null?s:Math.max(.05,Math.min(s,o))};return{topAt:e,lowestTop:(n,r,s,o,a)=>{if(!i)return a;let l=Math.max(2,Math.ceil((o-s)/.25)+1),c=a;for(let u=0;ut.topAt(h,f,n),lowestTop:(h,f)=>t.lowestTop(i.a,s,h,f,n)};let[o,a]=[i.height??e,i.heightEnd],l=(h,f)=>{let d=r>1e-9?((h-i.a[0])*s[0]+(f-i.a[1])*s[1])/r:0;return o+(a-o)*Math.max(0,Math.min(1,d))},c=(h,f)=>t.topAt(h,f,l(h,f));return{H:n,varies:!0,topAt:c,lowestTop:(h,f)=>{let d=Math.max(2,Math.ceil((f-h)/.25)+1),p=1/0;for(let g=0;g0:c.roomLeft===o.room_id,x=[-h[1],h[0]],b=m?x:[-x[0],-x[1]],_=Qr(i.rooms.find(C=>C.id===o.room_id)),y=Math.min(Go(c,i.height,n).lowestTop(p,p+d)-.02,_+o.sill+o.height),M=Math.max(Math.min(0,_),Math.min(_+o.sill,y-.1)),S=[b[1],-b[0]],v=h[0]*S[0]+h[1]*S[1]>0,w={opening:o,bucket:t.get(c),start:[c.a[0]+h[0]*p,c.a[1]+h[1]*p],axis:h,width:d,toRoom:b,faceRoom:m?c.left:c.right,faceOut:m?c.right:c.left,sill:M,top:y,hingeAtStart:o.hinge==="left"===v,exterior:c.exterior};s.push(w),r.set(c,[...r.get(c)??[],{s0:p,s1:p+d,sill:M,top:y,info:w}])}return{openings:s,spans:r}}var _v=i=>`${Math.round(i[0]*50)},${Math.round(i[1]*50)}`;function uC(i,e,t,n=!1,r=!1){let{info:s}=e,o=s.bucket,a=(u,h,f)=>[s.start[0]+s.axis[0]*(u-e.s0)+s.toRoom[0]*h,f,s.start[1]+s.axis[1]*(u-e.s0)+s.toRoom[1]*h],l=u=>u>t+1e-6?o:Ye,c=e.sill<0?e.sill+.004:Math.max(e.sill,.004);for(let u of[s.faceRoom,-s.faceOut])n||i.segSplit(a(e.s0,u,c),a(e.s0,u,e.top),ci,t,o),r||i.segSplit(a(e.s1,u,c),a(e.s1,u,e.top),ci,t,o),i.seg(a(e.s0,u,e.top),a(e.s1,u,e.top),ci,l(e.top)),e.sill>.01&&i.seg(a(e.s0,u,e.sill),a(e.s1,u,e.sill),ci,l(e.sill));for(let[u,h]of[[e.s0,n],[e.s1,r]])h||(i.seg(a(u,s.faceRoom,e.top),a(u,-s.faceOut,e.top),ci,l(e.top)),e.sill>.01&&i.seg(a(u,s.faceRoom,e.sill),a(u,-s.faceOut,e.sill),ci,l(e.sill)),e.sillt&&i.seg(a(u,s.faceRoom,t),a(u,-s.faceOut,t),Nu,rl+o))}function vv(i,e,t,n,r,s,o){let a=Math.min(e.cut_height,e.height),l=(f,d)=>(r.get(f)??[]).filter(d);for(let f of t.edges){let d=n.get(f.wall);for(let[x,b]of Ro(f,l(f.wall,_=>_.sill<=.005)))i.seg([x[0],.004,x[1]],[b[0],.004,b[1]],Od);for(let[x,b]of Ro(f,l(f.wall,_=>_.silla)))i.seg([x[0],a,x[1]],[b[0],a,b[1]],Nu,rl+d);let p=Go(f.wall,e.height,s),{H:g,topAt:m}=p;for(let[x,b]of Ro(f,l(f.wall,_=>_.top>=g-.021))){if(!o&&!p.varies){i.seg([x[0],g,x[1]],[b[0],g,b[1]],Li,g<=a+1e-6?ur+d:d);continue}let _=Math.max(1,Math.ceil(Math.hypot(b[0]-x[0],b[1]-x[1])/.3)),y=M=>[x[0]+(b[0]-x[0])*M/_,x[1]+(b[1]-x[1])*M/_];for(let M=0;M<_;M++){let[S,v]=[y(M),y(M+1)],[w,C]=[m(S[0],S[1]),m(v[0],v[1])];i.seg([S[0],w,S[1]],[v[0],C,v[1]],Li,Math.max(w,C)<=a+1e-6?ur+d:d)}}}let c=Sh(r.values()),u=new Set(c.points.map(_v)),h=new Map;for(let[f,d]of r)h.set(f,pv(d,c));for(let f of t.corners){let d=mv(f.wall,f.p),g=(r.get(f.wall)??[]).some(b=>!!b.info.opening.front&&d>b.s0+.05&&dMath.abs(b-d)<.06);if(g||m||u.has(_v(f.p)))continue;let x=Go(f.wall,e.height,s).topAt(f.p[0],f.p[1]);i.segSplit([f.p[0],.004,f.p[1]],[f.p[0],x,f.p[1]],ci,Math.min(a,x),n.get(f.wall))}for(let f of r.values())for(let d of f){let p=d.info.opening.front,[g,m]=Mh(d);uC(i,d,a,p?c.at(p,g):!1,p?c.at(p,m):!1)}}function Mv(i,e){let t=new ut(!0,!0),n=[],r=new Wt,s=[],o=new W(Os.slab),a=(l,c=0,u=c-pi)=>{l.forEach((h,f)=>{let d=l[(f+1)%l.length];t.tri([h[0],u,h[1]],[h[0],c,h[1]],[d[0],c,d[1]],o),t.tri([h[0],u,h[1]],[d[0],c,d[1]],[d[0],u,d[1]],o)})};for(let l of i.rooms){if(l.points.length<3)continue;let c=Gr(l.points),u=wh[l.floor_material]??wh.wood,h=new W(u.color),f=e.filter(m=>by(m,c)).map(m=>yy(m,.003));s.push(...f);let d=[...c,...f.flat()],p=t.count,g=Qr(l);for(let[m,x,b]of Vr(c,f)){let[_,y,M]=[d[m],d[x],d[b]];t.tri([_[0],g,_[1]],[M[0],g,M[1]],[y[0],g,y[1]],h,h,h,[_[0],_[1],M[0],M[1],y[0],y[1]],Ye,u.tile)}n.push({roomId:l.id,start:p,end:t.count,color:u.color}),a(c,g),Math.abs(g)>.005&&(a(c,Math.max(0,g),Math.min(0,g)),a([...c].reverse(),Math.max(0,g),Math.min(0,g)));for(let m of f)a([...Gr(m)].reverse()),m.forEach((x,b)=>{let _=m[(b+1)%m.length];r.seg([x[0],g+.006,x[1]],[_[0],g+.006,_[1]],Li),r.seg([x[0],g-pi,x[1]],[_[0],g-pi,_[1]],ci)})}return{buffer:t,roomTris:n,holeLines:r,cutHoles:s}}var Th=.42,Zp=.42;function Sv(i,e,t){let n=new ut,r=new W(Zp,Zp,Zp),s=new W(1,1,1),o=.002;for(let a of i)for(let[l,c]of Ro(a,(t.get(a.wall)??[]).filter(u=>u.sill<=.005))){let[u,h]=[c[0]-l[0],c[1]-l[1]],f=Math.hypot(u,h);if(f<.05)continue;let d=[h/f,-u/f],p=[(l[0]+c[0])/2+d[0]*.05,(l[1]+c[1])/2+d[1]*.05];if(!e.some(x=>x.points.length>=3&&Ge(p,x.points)))continue;let g=[l[0]+d[0]*Th,l[1]+d[1]*Th],m=[c[0]+d[0]*Th,c[1]+d[1]*Th];n.tri([l[0],o,l[1]],[g[0],o,g[1]],[m[0],o,m[1]],r,s,s),n.tri([l[0],o,l[1]],[m[0],o,m[1]],[c[0],o,c[1]],r,s,r)}return n}var Jp=(i,e)=>Number.parseInt(/^#?([0-9a-f]{6})$/i.exec(i?.trim()??"")?.[1]??e.slice(1),16),hC=i=>/^#?[0-9a-f]{6}$/i.test(i?.trim()??"");function jp(i,e){return{outside:Jp(hC(e.wall_paint_outside)?e.wall_paint_outside:i.wall_paint_outside,A0),inside:Jp(i.wall_paint_inside,Zh),rooms:e.rooms.filter(t=>t.wall_paint&&t.points.length>=3).map(t=>({points:t.points,color:Jp(t.wall_paint,Zh)}))}}var fC=14276045;function dC(i,e,t,n,r){let s=Math.hypot(t[0]-e[0],t[1]-e[1])||1,o=[(e[0]+t[0])/2,(e[1]+t[1])/2],a=[(t[1]-e[1])/s,-(t[0]-e[0])/s];Ge([o[0]+a[0]*.01,o[1]+a[1]*.01],i)&&(a=[-a[0],-a[1]]);let l=[o[0]+a[0]*.06,o[1]+a[1]*.06],c=n.rooms.find(u=>Ge(l,u.points));return c?c.color:r.some(u=>u.points.length>=3&&Ge(l,u.points))?n.inside:n.outside}function pC(i,e,t=-pi){let n=[-1/0,...new Set(i.flatMap(s=>[s.s0,s.s1])).values(),1/0].sort((s,o)=>s-o),r=[];for(let s=0;s+1f.s0l).map(f=>[f.sill,f.top]).sort((f,d)=>f[0]-d[0]),u=[],h=t;for(let[f,d]of c)f>h+1e-4&&u.push([h,f]),h=Math.max(h,d);e>h+1e-4&&u.push([h,e]),r.push({t0:o,t1:a,ranges:u})}return r}function wv(i,e,t,n,r,s,o,a){let l=Math.min(e.cut_height,e.height),c=a?Bd:0,u=a?m=>(x,b)=>dC(m,x,b,a,e.rooms):null,h=a?fC:Os.wallTop,f=Sh(r.values()),d=m=>f.points.some(x=>Math.hypot(x[0]-m[0],x[1]-m[1])<.03),p=m=>m&&m.info.opening.front?[m.sill,m.top]:null,g=(m,x)=>{let b=[];for(let[_,y]of m)x[0]>_+1e-4&&b.push([_,Math.min(y,x[0])]),y>x[1]+1e-4&&b.push([Math.max(_,x[1]),y]);return b};for(let m of t){let x=n.get(m),b=vs([m.b[0]-m.a[0],m.b[1]-m.a[1]]),_=(r.get(m)??[]).sort((I,D)=>I.s0-D.s0),y=Go(m,e.height,s),{H:M,topAt:S}=y,v=Math.min(0,...[m.roomLeft,m.roomRight].map(I=>Qr(e.rooms.find(D=>D.id===I)))),w=pC(_,M,v-pi),C=Math.hypot(m.b[0]-m.a[0],m.b[1]-m.a[1]),A=(o||y.varies)&&y.lowestTop(0,C){let D=Math.max(I.t0,-.5),F=Math.min(I.t1,C+.5),H=Math.max(1,Math.ceil((F-D)/.3));return Array.from({length:H},(B,X)=>({t0:X===0?I.t0:D+(F-D)*X/H,t1:X===H-1?I.t1:D+(F-D)*(X+1)/H,ranges:I.ranges,inner0:X>0,inner1:X({...I,inner0:!1,inner1:!1})),N=I=>(I[0]-m.a[0])*b[0]+(I[1]-m.a[1])*b[1],O=d(m.a)?p(_[0]):null,P=d(m.b)?p(_[_.length-1]):null;for(let I of R){let D=Yd(m.footprint,m.a,b,I.t0,I.t1);if(D.length<3)continue;let F=I.t1<=1e-6&&I.t0<0?O:I.t0>=C-1e-6?P:null,H=F?g(I.ranges,F):I.ranges,B=(Y,Q)=>Math.abs(N(Y)-Q)<1e-4,X=(Y,Q)=>I.inner0&&B(Y,I.t0)&&B(Q,I.t0)||I.inner1&&B(Y,I.t1)&&B(Q,I.t1),V=(Y,Q)=>!f.points.length||Math.hypot(Y[0]-Q[0],Y[1]-Q[1])>.5?!1:f.points.some(se=>Math.min(Math.hypot(se[0]-Y[0],se[1]-Y[1]),Math.hypot(se[0]-Q[0],se[1]-Q[1]))<.05),re=(Y,Q)=>X(Y,Q)||V(Y,Q),be=A?Math.min(...D.map(([Y,Q])=>S(Y,Q))):M;for(let[Y,Q]of H){let se=Math.min(Q,A?Math.max(...D.map(([at,Te])=>S(at,Te))):Q);if(se-Y<1e-4||be-Y<.01)continue;let Se=Y>.01,ce=A&&Q>be,Le=(at,Te)=>Math.min(Q,S(at,Te));if(Yl+1e-6?Ud+x:ur+x,Te=ce&&beMath.min(l,Le(ft,bt)):Math.min(se,l);Tt(i,D,Y,Te,Os.wall,h,{aoFrom:0,bottom:Se,fold:c+ur+x,topFold:c+at,skipSide:re,sideColor:u?.(D)})}se>l+1e-6&&be>l+1e-6&&Tt(i,D,Math.max(Y,l),ce?Le:se,Os.wall,h,{aoFrom:0,fold:c+x,bottom:Se&&Y>=l,skipSide:re,sideColor:u?.(D)})}}}}function Qp(i,e,t,n=[],r=[],s,o){let{walls:a,open:l}=ul(i.rooms,{exterior:e,interior:t},i.walls??[]),c=bv(s),u=!!s,h=Mv(i,n),{buckets:f,wallBucket:d}=xv(a),{openings:p,spans:g}=yv(i,a,d,c),m=new ut;wv(m,i,a,d,g,c,u,o);let x=qd(a,a.flatMap(v=>v.footprint)),b=new Wt;b.p.push(...h.holeLines.p),b.c.push(...h.holeLines.c),b.f.push(...h.holeLines.f),vv(b,i,x,d,g,c,u);let _=Sv(x.edges,i.rooms,g),y=new Map;mp(m,b,i,y,()=>new ut);for(let v of r)vh(m,b,v.face,v.field,i.elevation);let M=Math.min(i.cut_height,i.height),S=[];for(let v of i.furniture.filter(w=>!R0(w.type))){let w=m.count,C=b.p.length/6,A=Gt(i,v);zl(v.type)||Al(m,b,_,v,A),A+v.h>M+.05&&(zd(m,w,M,Ou),Vd(b,C,M,Ou)),S.push({id:v.id,start:w,end:m.count})}return{floor:h.buffer.geometry(),roomTris:h.roomTris,holes:h.cutHoles,walls:m.geometry(),ghosts:[...y].map(([v,w])=>({opacity:v,geometry:w.geometry()})),lines:b.geometry(),shadow:_.geometry(),buckets:f,openings:p,walls2d:a,openRooms:l,wallBuckets:a.map(v=>d.get(v)),furnitureTris:S,roofUnder:s}}function em(i,e){let t=P0(i,e),n=[...e.furniture.filter(a=>a.type==="stairwell").map(ts),...e.furniture.filter(a=>ih(a)&&a.stair?.down).flatMap(wp)].filter(a=>a.length>=3),r=i.filter(a=>a.elevationl.elevation-a.elevation)[0];if(!r)return dr([...n,...t]);let o=r.furniture.filter(a=>(a.type==="stairs"||vt(a.type)?.hole)&&!(ih(a)&&a.stair?.down)&&r.elevation+a.h>=e.elevation-.3).flatMap(a=>ih(a)?wp(a):[ts(a)]).filter(a=>a.length>=3);return dr([...n,...o,...t])}var Tv=.12,Av=1.35,Ui=(i,e,t)=>Math.min(t,Math.max(e,i)),mC=i=>i<.5?4*i*i*i:1-(-2*i+2)**3/2,Ev=i=>({...i,target:i.target.clone()});function Rv({target:i,radius:e,theta:t,phi:n}){return new U(i.x+e*Math.sin(n)*Math.sin(t),i.y+e*Math.cos(n),i.z+e*Math.sin(n)*Math.cos(t))}function Cv(i,e,t){let n=mC(t);return{target:new U().lerpVectors(i.target,e.target,n),radius:i.radius+(e.radius-i.radius)*n,theta:i.theta+(e.theta-i.theta)*n,phi:i.phi+(e.phi-i.phi)*n}}function Pv(i,e){let t=e.theta??i.theta;for(;t-i.theta>Math.PI;)t-=2*Math.PI;for(;t-i.theta<-Math.PI;)t+=2*Math.PI;return{target:(e.target??i.target).clone(),radius:e.radius??i.radius,theta:t,phi:e.phi??i.phi}}function tm(i,e,t,n,r){let s=2*i.radius*Math.tan(r*Math.PI/360)/(n||1),o=new U(Math.cos(i.theta),0,-Math.sin(i.theta)),a=new U(-Math.sin(i.theta),0,-Math.cos(i.theta));i.target.addScaledVector(o,-e*s),i.target.addScaledVector(a,t*s/Math.max(.35,Math.cos(i.phi)))}function Iv(i,e,t,n){let r=n||1,s={theta:-e/r*3.2,phi:-t/r*2.4};return i.theta+=s.theta,i.phi=Ui(i.phi+s.phi,Tv,Av),s}function Lv(i,e){return Math.abs(e.theta)<=1e-4&&Math.abs(e.phi)<=1e-4?!1:(i.theta+=e.theta,i.phi=Ui(i.phi+e.phi,Tv,Av),e.theta*=.9,e.phi*=.9,!0)}var gC={KeyW:"w",KeyA:"a",KeyS:"s",KeyD:"d",KeyQ:"q",KeyE:"e"},xC=new Set(["w","a","s","d","q","e","arrowup","arrowdown","arrowleft","arrowright"]);function bC(i){let e=i.code?.startsWith("Key")?gC[i.code]??null:i.key.toLowerCase();return e&&xC.has(e)?e:null}var yC=500,_C=400,vC=320,MC=6,Fv=1.5,SC=1.8;function wC(i,e){let t=i.keys,n=(t.has("w")||t.has("arrowup")?1:0)-(t.has("s")||t.has("arrowdown")?1:0)-i.stick[1],r=(t.has("d")?1:0)-(t.has("a")?1:0),s=(t.has("arrowleft")||t.has("q")?1:0)-(t.has("arrowright")||t.has("e")?1:0)-i.stick[0];if(!n&&!r&&!s)return!1;let o=e/1e3;i.yaw+=s*SC*o;let[a,l]=[-Math.sin(i.yaw),-Math.cos(i.yaw)],[c,u]=[Math.cos(i.yaw),-Math.sin(i.yaw)];return i.eye.x=Ui(i.eye.x+(a*n+c*r)*Fv*o,i.bounds.x0,i.bounds.x1),i.eye.z=Ui(i.eye.z+(l*n+u*r)*Fv*o,i.bounds.z0,i.bounds.z1),!0}var Il=class{view={target:new U,radius:16,theta:-.6,phi:.85};minRadius=2;maxRadius=80;locked=!1;walk=null;pointers=new Map;velocity={theta:0,phi:0};flight=null;press=null;lastTap=0;holdTimer;held=!1;grabbing=!1;swiping=null;pinch=null;listeners=[];el;camera;events;constructor(e,t,n){this.el=e,this.camera=t,this.events=n;let r=(l,c,u)=>{e.addEventListener(l,c,u),this.listeners.push([l,c])};r("pointerdown",l=>this.onDown(l)),r("pointermove",l=>this.onMove(l)),r("pointerup",l=>this.onUp(l)),r("pointercancel",l=>this.onUp(l)),r("wheel",l=>this.onWheel(l),{passive:!1}),r("contextmenu",l=>l.preventDefault());let s=l=>c=>{if(!this.walk||c.target?.closest?.("input, textarea, select"))return;let u=bC(c);u&&(c.preventDefault(),l?this.walk.keys.add(u):this.walk.keys.delete(u),this.events.change())},o=s(!0),a=s(!1);window.addEventListener("keydown",o),window.addEventListener("keyup",a),this.listeners.push(["__window_keydown",o],["__window_keyup",a])}dispose(){clearTimeout(this.holdTimer);for(let[e,t]of this.listeners)e.startsWith("__window_")?window.removeEventListener(e.slice(9),t):this.el.removeEventListener(e,t)}get active(){return this.pointers.size>0||this.flight!==null}get busy(){return this.active}update(e){if(this.walk){let n=this.walk,r=wC(n,n.last?Math.min(100,e-n.last):16);n.last=r?e:0;let s=new U(-Math.sin(n.yaw)*Math.cos(n.pitch),Math.sin(n.pitch),-Math.cos(n.yaw)*Math.cos(n.pitch));return this.view.target.copy(n.eye).add(s),this.camera.position.copy(n.eye),this.camera.lookAt(this.view.target),r}let t=!1;if(this.flight){let{from:n,to:r,start:s,duration:o}=this.flight,a=Math.min(1,(e-s)/o);this.view=Cv(n,r,a),a>=1&&(this.flight=null),t=!0}else this.pointers.size===0&&(t=Lv(this.view,this.velocity));return this.camera.position.copy(Rv(this.view)),this.camera.lookAt(this.view.target),t}flyTo(e,t=700){let n=Pv(this.view,e),r=Ev(this.view);this.velocity={theta:0,phi:0},t<=0||matchMedia("(prefers-reduced-motion: reduce)").matches?(this.view=n,this.flight=null):this.flight={from:r,to:n,start:performance.now(),duration:t},this.events.change()}local(e){let t=this.el.getBoundingClientRect();return[e.clientX-t.left,e.clientY-t.top]}stopMotion(){this.flight=null,this.velocity={theta:0,phi:0}}onDown(e){this.el.setPointerCapture(e.pointerId);let t=this.pointers.size===0;if(this.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY,button:e.button}),this.stopMotion(),t&&e.button===0&&this.events.grab?.(...this.local(e))){this.grabbing=!0;return}if(clearTimeout(this.holdTimer),this.held=!1,this.pointers.size===1){this.press={x:e.clientX,y:e.clientY,time:performance.now(),moved:!1};let[n,r]=this.local(e);this.holdTimer=setTimeout(()=>{!this.press||this.press.moved||this.pointers.size!==1||(this.held=!0,this.events.hold(n,r))},yC)}else this.press=null,this.pinch=this.pinchState()}onMove(e){let t=this.pointers.get(e.pointerId);if(!t)return;if(this.grabbing)return void this.events.drag?.(...this.local(e));if(this.swiping)return void this.events.swipeMove?.(e.clientY-this.swiping.startY);let[n,r]=[e.clientX-t.x,e.clientY-t.y];if(this.press&&!this.press.moved&&Math.hypot(e.clientX-this.press.x,e.clientY-this.press.y)>MC){this.press.moved=!0,clearTimeout(this.holdTimer);let[s,o]=this.local({clientX:this.press.x,clientY:this.press.y});if(this.pointers.size===1&&t.button===0&&!e.shiftKey&&this.events.swipeStart?.(s,o,e.clientX-this.press.x,e.clientY-this.press.y))return this.swiping={startY:this.press.y},this.velocity={theta:0,phi:0},void this.events.swipeMove?.(e.clientY-this.press.y)}if(this.locked){[t.x,t.y]=[e.clientX,e.clientY];return}if(this.walk){if(!(this.press&&!this.press.moved)&&this.pointers.size===1){let s=this.el.clientHeight||1;this.walk.yaw+=n/s*2.4,this.walk.pitch=Ui(this.walk.pitch+r/s*1.8,-1.1,1.1),this.events.change()}[t.x,t.y]=[e.clientX,e.clientY];return}if(this.pointers.size===1)this.press&&!this.press.moved||(t.button===1||t.button===2||e.shiftKey?tm(this.view,n,r,this.el.clientHeight,this.camera.fov):this.velocity=Iv(this.view,n,r,this.el.clientHeight)),[t.x,t.y]=[e.clientX,e.clientY];else{[t.x,t.y]=[e.clientX,e.clientY];let s=this.pinchState();this.pinch&&s&&(this.zoom(this.pinch.dist/Math.max(1,s.dist)),tm(this.view,s.mid[0]-this.pinch.mid[0],s.mid[1]-this.pinch.mid[1],this.el.clientHeight,this.camera.fov)),this.pinch=s}this.pointers.size===1&&this.press&&!this.press.moved||this.events.change()}onUp(e){if(this.pointers.has(e.pointerId)){if(this.pointers.delete(e.pointerId),this.grabbing)return this.grabbing=!1,void this.events.drop?.();if(this.swiping)return this.swiping=null,this.press=null,void this.events.swipeEnd?.();if(this.pointers.size<2&&(this.pinch=null),clearTimeout(this.holdTimer),this.held)this.held=!1,this.press=null;else if(this.press&&!this.press.moved&&e.type==="pointerup"&&performance.now()-this.press.time<_C){let[t,n]=this.local(e),r=performance.now(),s=r-this.lastTapa*n);return{id:`${i.id}:vehicle`,type:e,x:i.x,z:i.z,rotation:i.rotation,w:r,d:s,h:o,variant:i.variant??null,entity:null,power:null}}function Ah(i,e){let t=[],n=!1;for(let r of i.furniture){t.push(r);let s=r.type==="parking"?e.get(r.id):void 0,o=s?TC(r,s):null;o&&(t.push(o),n=!0)}return n?{...i,furniture:t}:i}var AC="https://tile.openstreetmap.org/{z}/{x}/{y}.png";var EC=40075016686e-3,Eh=Math.PI/180,RC=18,CC=.5,PC=160;function IC(i,e,t){let n=2**t,r=(e+180)/360*n,s=(1-Math.log(Math.tan(i*Eh)+1/Math.cos(i*Eh))/Math.PI)/2*n;return[r,s]}var LC=(i,e)=>EC*Math.cos(i*Eh)/2**e;function Nv(i,e,t,n=PC){let[r,s]=IC(i,e,t),o=LC(i,t),a=n/o,l=2**t-1,c=[];for(let u=Math.floor(s-a);u<=Math.floor(s+a);u++)for(let h=Math.floor(r-a);h<=Math.floor(r+a);h++){if(u<0||u>l)continue;let f=(h%(l+1)+l+1)%(l+1);c.push({x:f,y:u,z:t,east:(h-r)*o,north:-(u-s)*o,size:o})}return c}function Ov(i,e){return i.replace("{z}",String(e.z)).replace("{x}",String(e.x)).replace("{y}",String(e.y)).replace("{s}","abc"[(e.x+e.y)%3])}var Dv=i=>i.url&&i.url.startsWith("https://")?i.url:AC;function Uv(i,e,t,n){let r=t*Eh;return[n.x+i*Math.cos(r)+e*Math.sin(r),n.z+i*Math.sin(r)-e*Math.cos(r)]}var Bv=i=>!!i&&i.on===!0&&Number.isFinite(i.lat)&&Number.isFinite(i.lon),kv=i=>({x:i.x??0,z:i.z??0,opacity:i.opacity??CC,zoom:i.zoom??RC});var FC="strict-origin-when-cross-origin",nm=new Map;function zv(i){let e=nm.get(i);return e||(e=fetch(i,{referrerPolicy:FC,mode:"cors",credentials:"omit"}).then(async t=>t.ok&&(t.headers.get("content-type")??"").startsWith("image/")?await t.blob():null).catch(()=>null).then(t=>(t||setTimeout(()=>nm.delete(i),6e4),t)),nm.set(i,e)),e}var Ho=256,NC=Math.PI/180,Rh=class{mesh=new we(new sn(1,1),new $e({transparent:!0,depthWrite:!1,side:ht}));canvas=null;texture=null;key="";generation=0;centre=[0,0];onChange=()=>{};scene;constructor(e){this.scene=e,this.mesh.rotation.order="YXZ",this.mesh.renderOrder=-2,this.mesh.visible=!1,this.mesh.name="live-map",e.add(this.mesh)}set(e,t,n,r=1){if(!Bv(e)){this.mesh.visible=!1,this.generation++,this.key="";return}let s=kv(e),o=Dv(e),a=`${e.lat},${e.lon},${s.zoom},${o}`;a!==this.key&&this.load(a,e,s.zoom,o);let[l,c]=this.centre,[u,h]=Uv(l,c,t,s);this.mesh.position.set(u,n,h),this.mesh.rotation.set(-Math.PI/2,-t*NC,0);let f=this.mesh.material;f.opacity=s.opacity,f.color.setScalar(r),this.mesh.visible=this.canvas!==null}load(e,t,n,r){this.key=e;let s=++this.generation,o=Nv(t.lat,t.lon,n);if(!o.length)return;let a=o[0].size,l=Math.min(...o.map(g=>g.east)),c=Math.max(...o.map(g=>g.north)),u=Math.round((Math.max(...o.map(g=>g.east))-l)/a)+1,h=Math.round((c-Math.min(...o.map(g=>g.north)))/a)+1,f=document.createElement("canvas");f.width=u*Ho,f.height=h*Ho,this.canvas=f,this.texture?.dispose(),this.texture=new zt(f),this.texture.colorSpace=dt,this.texture.anisotropy=4;let d=this.mesh.material;d.map=this.texture,d.needsUpdate=!0,this.mesh.geometry.dispose(),this.mesh.geometry=new sn(u*a,h*a),this.centre=[l+u*a/2,c-h*a/2];let p=f.getContext("2d");if(p)for(let g of o)this.draw(p,g,r,s,Math.round((g.east-l)/a),Math.round((c-g.north)/a))}draw(e,t,n,r,s,o){zv(Ov(n,t)).then(a=>a?createImageBitmap(a):null).then(a=>{!a||r!==this.generation||(e.drawImage(a,s*Ho,o*Ho,Ho,Ho),this.texture&&(this.texture.needsUpdate=!0),this.onChange())})}dispose(){this.generation++,this.scene.remove(this.mesh),this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.texture?.dispose()}};var OC=globalThis,Vv=OC.__nextfloorPluginStore??={plugins:new Map,listeners:new Set},DC=Vv.plugins,xk=Vv.listeners;var UC=5;function BC(i,e){i.errors.lengthNumber.isFinite(a))&&Number.isFinite(r.level)))return i;let o=a=>Math.max(0,Math.min(1,a));return{color:[o(r.color[0]),o(r.color[1]),o(r.color[2])],level:o(r.level)}}catch(r){return BC(n.status,r),i}}var Hv={rainbow:(i,e)=>{let t=(e*.08%1+1)%1,n=r=>Math.max(0,Math.min(1,Math.abs((t*6+r)%6-3)-1));return{color:[n(0),n(4),n(2)],level:i.level}},flicker:(i,e)=>({...i,level:i.level*(.75+.15*Math.sin(e*17)+.1*Math.sin(e*31+1))}),pulse:(i,e)=>({...i,level:i.level*(.65+.35*Math.sin(e*Math.PI))})};function Wv(i,e,t){return!i||!e?i:Object.prototype.hasOwnProperty.call(Hv,e)?Hv[e]?.(i,t)??i:Gv(i,e,t)}var Wo=2043986,Wr=2769520,Xv=2242399,Ch=1845831,Yv=1450554,mi=16758087,qv=1846349,$v=2572395,Kv=1120816,Zv=1845831,Jv=3662079,jv=5995775,Qv=9085695,Xr=ke(3662079,.08),eM=1.2,tM=1.5,nM=.2,iM=.52;function Ph(i,e,t,n,r,s){let o=(g,m,x)=>e(g,m,x),{x0:a,x1:l,n0:c,n1:u,y0:h,y1:f}=t,d=g=>ke(n.getHex(),g),p=[[o(a,c,f),o(l,c,f),o(l,u,f),o(a,u,f),r],[o(a,c,h),o(l,c,h),o(l,u,h),o(a,u,h),d(.6)],[o(a,u,h),o(l,u,h),o(l,u,f),o(a,u,f),n],[o(a,c,h),o(l,c,h),o(l,c,f),o(a,c,f),d(.85)],[o(a,c,h),o(a,u,h),o(a,u,f),o(a,c,f),d(.92)],[o(l,c,h),o(l,u,h),o(l,u,f),o(l,c,f),d(.92)]];for(let[g,m,x,b,_]of p)i.tri(g,m,x,_,_,_,void 0,s),i.tri(g,x,b,_,_,_,void 0,s)}function Vt(i,e,t,n,r,{cut:s,bucket:o}){if(t.y1<=s+1e-6)return Ph(i,e,t,n,r,Ye);if(t.y0>=s-1e-6)return Ph(i,e,t,n,r,o);Ph(i,e,{...t,y1:s},n,r,Ye),Ph(i,e,{...t,y0:s},n,r,o)}function Qn(i,e,t,n,r,s,o,a,{cut:l,bucket:c},u=0){let h=(f,d,p)=>{let g=y=>u?(o-y)/u:.5,[m,x,b,_]=[e(t,r,f),e(n,r,f),e(n,r,d),e(t,r,d)];i.tri(m,x,b,a,a,a,[0,g(f),1,g(f),1,g(d)],p),i.tri(m,b,_,a,a,a,[0,g(f),1,g(d),0,g(d)],p)};o<=l+1e-6?h(s,o,Ye):s>=l-1e-6?h(s,o,c):(h(s,l,Ye),h(l,o,c))}function rM(i,e,t,n,r,s,o,a,l,c){let[u,h,f,d]=[e(t,r,o),e(n,r,o),e(n,s,o),e(t,s,o)],p=(s-r)/c;i.tri(u,h,f,a,a,a,[0,0,1,0,1,p],l),i.tri(u,f,d,a,a,a,[0,0,1,p,0,p],l)}var zC=16777215,VC=13225686,GC=15722456,sM=.08,oM=.085;function aM(i){let{info:e,state:t,frame:n,fold:r}=i;if(t.cover===null)return;let[s,o,a]=[e.width,e.sill,e.top],l=e.opening.blind??"roller",c=-e.faceOut,u=e.faceRoom;l==="inside"?Vt(i.frames,n,{x0:-.03,x1:s+.03,n0:u,n1:u+.07,y0:a-.02,y1:a+.07},new W(15921906),new W(16250871),r):Vt(i.frames,n,{x0:-.05,x1:s+.05,n0:c-.15,n1:c,y0:a,y1:a+.2},new W(Yv),new W(Wr),r);let h=t.cover2!=null?[[0,s/2,t.cover,t.slats??0],[s/2,s,t.cover2,t.slats2??t.slats??0]]:[[0,s,t.cover,t.slats??0]];for(let[f,d,p,g]of h){let m=Math.min(1,Math.max(0,p));if(m<=.01)continue;let x=a-m*(a-o);l==="inside"?Qn(i.blinds,n,f+.01,d-.01,u+.04,x,a-.02,new W(GC),r):l==="venetian"?HC(i,f,d,c-.07,x,a,g):Qn(i.blinds,n,f,d,c-.07,x,a,new W(zC),r,.045)}}function HC(i,e,t,n,r,s,o){let{frame:a,fold:l}=i,c=new W(VC),u=Math.PI/2*(.12+.88*Math.min(1,Math.max(0,o))),h=Math.sin(u)*oM/2,f=Math.cos(u)*oM/2;for(let d=s-sM/2;d>r;d-=sM){let p=d>=l.cut?l.bucket:Ye,[g,m,x,b]=[a(e,n-h,d+f),a(t,n-h,d+f),a(t,n+h,d-f),a(e,n+h,d-f)];i.blinds.tri(g,m,x,c,c,c,[0,.5,1,.5,1,.5],p),i.blinds.tri(g,x,b,c,c,c,[0,.5,1,.5,0,.5],p)}}function lM(i){let{info:e,state:t,frame:n,fold:r}=i,[s,o,a]=[e.width,e.top,Math.min(0,e.sill)],l=e.opening.type==="garage"&&(i.markClosed?!!t.sensed&&(t.cover??1)>=.95:(t.cover??1)<.95),c=l?ke(mi,.8):new W(Wo),u=l?ke(mi,1):new W(Wr),[h,f]=[-e.faceOut-.012,e.faceRoom+.012],d=(p,g,m)=>Vt(i.frames,n,{x0:p,x1:g,n0:h,n1:f,y0:m,y1:o+.045},c,u,r);d(-.045,.02,a),d(s-.02,s+.045,a),d(.02,s-.02,o-.02)}function cM(i){let{info:e,state:t,frame:n,fold:r,mid:s}=i,[o,a,l]=[e.width,e.top,Math.min(0,e.sill)],c=a-l,u=vr(e.opening,e.exterior),h=u==="passage",f=N0(u),d=e.opening.swing==="out"?-1:1,p=d>0?e.faceRoom:-e.faceOut,g=e.opening.leaves===2,m=new W(Wo),x=new W(Wr),b=.02,_=o-.02,y=F0(o,u,e.hingeAtStart,e.opening);if(y){for(let[C,A]of y.panels){let R=(N,O,P,I)=>Vt(i.frames,n,{x0:N,x1:O,n0:s-.03,n1:s+.03,y0:P,y1:I},m,x,r);R(C,C+.04,l+.02,a-.02),R(A-.04,A,l+.02,a-.02),R(C,A,l+.02,l+.1),Qn(i.glass,n,C+.04,A-.04,s,l+.1,a-.02,Xr,r)}b=y.x0,_=y.x1}let M=g?(_-b)/2-.004:_-b,S=f?.06:.04;f&&(Vt(i.frames,n,{x0:.02,x1:o-.02,n0:-e.faceOut-.02,n1:e.faceRoom,y0:l,y1:l+.02},new W(Ch),x,r),e.exterior&&Vt(i.frames,n,{x0:o/2-.08,x1:o/2+.08,n0:-e.faceOut-.1,n1:-e.faceOut,y0:a+.1,y1:a+.17},ke(mi,.55),ke(mi,.85),{cut:r.cut,bucket:Ye}));let v=e.opening.open_angle?Math.min(180,Math.max(5,e.opening.open_angle))*mt:tM,w=h?[]:[[e.hingeAtStart,t.open]];g&&!h&&w.push([!e.hingeAtStart,t.open2??0]);for(let[C,A]of w){let R=Math.min(1,Math.max(0,A)),N=u==="sliding"?0:R*v,O=u==="sliding"?R*M:0,P=(Q,se,Se)=>{let ce=Q*Math.cos(N)-se*Math.sin(N)-O,Le=p+d*(se*Math.cos(N)+Q*Math.sin(N)+(O?.05:0));return n(C?b+ce:_-ce,Le,Se)},I={cut:r.cut,bucket:R>.05?Ye:r.bucket},D=i.markClosed?!!t.sensed&&R<.05:R>.9&&!(C===e.hingeAtStart&&t.assumed),F=D?ke(mi,.7):new W(f?Kv:qv),H=D?ke(mi,.9):new W(f?Zv:$v),B=(Q,se,Se,ce,Le=-S,at=0)=>Vt(i.frames,P,{x0:Q,x1:se,n0:Le,n1:at,y0:Se,y1:ce},F,H,I);u==="glass"?(B(0,.05,l+.01,a-.01),B(M-.05,M,l+.01,a-.01),B(.05,M-.05,l+.01,l+.12),B(.05,M-.05,a-.08,a-.01),Qn(i.glass,P,.05,M-.05,-S/2,l+.12,a-.08,Xr,I)):B(0,M,l+.01,a-.01),u==="front_glass"?Qn(i.glass,P,.12,M-.12,.001,l+c*.55,a-.18,Xr,I):f&&Qn(i.glass,P,.1,.18,.001,l+.3,a-.3,Xr,I);let X=l+Math.min(1.05,c*.5),V=f?.3:.012,[re,be]=f?[M-.11,M-.08]:[M-.16,M-.05],Y=(Q,se)=>Vt(i.frames,P,{x0:re,x1:be,n0:Q,n1:se,y0:X-V,y1:X+V},new W(jv),new W(Qv),I);if(Y(.004,.05),Y(-S-.05,-S-.004),t.unlocked){let Q=new W(Jv);Vt(i.frames,P,{x0:M-.012,x1:M+.004,n0:-S-.004,n1:.004,y0:l+.06,y1:a-.06},Q,Q,{cut:r.cut,bucket:Ye})}}}function uM(i){let{info:e,state:t,frame:n,fold:r}=i,[s,o,a]=[e.width,e.top,Math.min(0,e.sill)],l=Math.min(1,Math.max(0,t.cover??1)),c=new W(13951231),u=e.faceRoom-.03;l>.01&&Qn(i.blinds,n,.02,s-.02,u,a+(o-a)*(1-l),o,c,r,.5);let h=(1-l)*(o-a);h>.01&&rM(i.blinds,n,.02,s-.02,u,u+h,o+.03,c,r.bucket,.5)}var WC=4936290,XC=7041926,hM=2764860,fM=9082024;function dM(i,e){let{info:t}=i;return t.opening.type!=="window"||!t.exterior||t.opening.light_well===!1?!1:t.opening.light_well===!0||t.sillVt(i.frames,n,{x0:x,x1:b,n0:_,n1:y,y0:c,y1:u},h,f,r);p(s-d,s,a-l,a),p(o,o+d,a-l,a),p(s-d,o+d,a-l-d,a-l),Vt(i.frames,n,{x0:s,x1:o,n0:a-l,n1:a,y0:c-d,y1:c},h,f,r);let g=(x,b)=>Vt(i.frames,n,{x0:x,x1:b,n0:a-l,n1:a,y0:u-.025,y1:u},new W(hM),new W(fM),r),m=Math.max(3,Math.round((o-s)/.06));for(let x=0;x<=m;x++){let b=s+(o-s)*x/m;g(b-.008,b+.008)}Vt(i.frames,n,{x0:s,x1:o,n0:a-l-.01,n1:a-l+.02,y0:u-.03,y1:u},new W(hM),new W(fM),r)}var Ds={open:0,open2:0,tilt:0,tilt2:0,cover:null};function mM(i){let{info:e,frame:t,fold:n,mid:r}=i,[s,o,a]=[e.width,e.sill,e.top],[l,c]=[.04,.025],u=new W(Wo),h=new W(Wr),f=(b,_,y,M)=>Vt(i.frames,t,{x0:b,x1:_,n0:r-c,n1:r+c,y0:y,y1:M},u,h,n);i.first&&f(0,l,o,a),i.last&&f(s-l,s,o,a);let[d,p]=[i.first?l:-i.over[0],i.last?s-l:s+i.over[1]];f(d,p,o,o+.03),f(d,p,a-l,a);let g=e.opening.front?0:e.opening.panes,m=Math.max(1,g==null?Math.max(1,Math.round((p-d)/.9)):Math.round(g)),x=(p-d)/m;for(let b=1;bVt(i.frames,n,{x0:A,x1:R,n0:s-u,n1:s+u,y0:N,y1:O},h,f,r),g=a+(a>.05?c:.03);p(0,c,a,l),p(o-c,o,a,l),p(c,o-c,a,g),p(c,o-c,l-c,l);let m=e.opening.sill_boards??"auto";m!=="none"&&(m!=="auto"||a>.3)&&(m!=="outside"&&Vt(i.frames,n,{x0:-.04,x1:o+.04,n0:s+u,n1:e.faceRoom+.07,y0:a-.03,y1:a},d,f,r),e.exterior&&m!=="inside"&&Vt(i.frames,n,{x0:-.03,x1:o+.03,n0:-e.faceOut-.06,n1:s-u,y0:a-.04,y1:a-.02},d,f,r));let x=.055,[b,_]=[g,l-c],[y,M]=[s+u,s+u+.06],S=e.hingeAtStart,v=e.opening.opens??"turn",w=v==="slide"?YC(o,c,S,e.opening.leaves,t.open,t.open2??0):e.opening.leaves===2?[{atStart:S,x0:S?c:o/2,x1:S?o/2:o-c,open:t.open,tilt:t.tilt},{atStart:!S,x0:S?o/2:c,x1:S?o-c:o/2,open:t.open2??0,tilt:t.tilt2??0}]:[{atStart:S,x0:c,x1:o-c,open:t.open,tilt:t.tilt}],C=vr(e.opening,e.exterior);for(let A of w){let R=v==="top"?Math.max(A.open,A.tilt)*iM:0,O=(v!=="slide"||!!A.slide)&&(A.open>.02||A.tilt>.02),P=i.markClosed?!!t.sensed&&!O:O,I=P?ke(mi,.75):new W(Xv),D=P?ke(mi,.95):f,F=A.x1-A.x0,H=v==="turn",B=H?A.open*eM:0,X=H?A.tilt*nM:0,V=(A.slide??0)*A.open,re=v==="slide"&&A.track===0?-.065:0,be=(se,Se,ce)=>{if(R>0){let[tt,Yt]=[Se-y,ce-_],[kt,on]=[Math.cos(R),Math.sin(R)];return n(A.atStart?A.x0+se:A.x1-se,y+tt*kt+Yt*on,_-tt*on+Yt*kt)}let Le=ce-b,at=Se+Le*Math.sin(X)+re,Te=b+Le*Math.cos(X),ft=se*Math.cos(B)-(at-y)*Math.sin(B),bt=y+(at-y)*Math.cos(B)+se*Math.sin(B);return n((A.atStart?A.x0+ft:A.x1-ft)+V,bt,Te)},Y={cut:r.cut,bucket:B>.05||R>.05?Ye:r.bucket},Q=(se,Se,ce,Le,at=y,Te=M)=>Vt(i.frames,be,{x0:se,x1:Se,n0:at,n1:Te,y0:ce,y1:Le},I,D,Y);if(Q(0,x,b,_),Q(F-x,F,b,_),Q(x,F-x,b,b+x),Q(x,F-x,_-x,_),Qn(i.glass,be,x,F-x,(y+M)/2,b+x,_-x,P?ke(mi,.16):Xr,Y),C==="bars"){let[se,Se]=[(b+_)/2,(y+M)/2];Q(x,F-x,se-.012,se+.012,Se-.012,Se+.012),Q(F/2-.012,F/2+.012,b+x,_-x,Se-.012,Se+.012)}}}var im=i=>i.opening.front??i.opening.id;function rm(i,e,t,n=-1/0){let r=new ut,s=new ut,o=new ut(!0),a=[],l=[],c=[],u=new Map;i.forEach((g,m)=>{let x=im(g);u.set(x,[...u.get(x)??[],m])});let h=g=>[[g.start[0],g.start[1]],[g.start[0]+g.axis[0]*g.width,g.start[1]+g.axis[1]*g.width]],f=g=>`${Math.round(g[0]*50)},${Math.round(g[1]*50)}`,d=new Map,p=new Map;for(let g of u.values()){let m=new Map,x=new Map;for(let _ of g){let[y,M]=h(i[_]);m.set(f(y),[...m.get(f(y))??[],_]),x.set(f(M),[...x.get(f(M))??[],_])}let b=(_,y)=>{if(y==null||y===_)return 0;let M=Math.abs((i[_].faceRoom-i[_].faceOut)/2),[S,v]=[i[_].axis,i[y].axis],w=Math.max(-1,Math.min(1,S[0]*v[0]+S[1]*v[1])),C=Math.acos(w);return Cw!==_),v=(m.get(f(M))??[]).find(w=>w!==_);d.set(_,[S==null,v==null]),p.set(_,[b(_,S),b(_,v)])}}for(let g=0;g[m.start[0]+m.axis[0]*w+m.toRoom[0]*C,A,m.start[1]+m.axis[1]*w+m.toRoom[1]*C],mid:(m.faceRoom-m.faceOut)/2,markClosed:m.opening.mark==="closed",fold:{cut:t,bucket:m.bucket},frames:r,glass:s,blinds:o,first:y,last:M,over:p.get(g)??[0,0]};(b==="door"&&_!=="passage"||b==="garage")&&lM(S),b==="door"?cM(S):b==="garage"?uM(S):_==="glass_wall"?mM(S):gM(S),dM(S,n)&&pM(S,n),b!=="garage"&&aM(S);let v=im(m);a.push({id:v,start:x.frames,end:r.count}),l.push({id:v,start:x.glass,end:s.count}),c.push({id:v,start:x.blinds,end:o.count})}return{frames:r.geometry(),glass:s.geometry(),blinds:o.geometry(),frameTris:a,glassTris:l,blindTris:c}}var sm=Math.PI/180,Ll=2400,Xo=1600,om=9,xM=360;function Ih(i,e=64){let t=document.createElement("canvas");t.width=t.height=e;let n=t.getContext("2d"),r=n.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);for(let[s,o]of i)r.addColorStop(s,o);return n.fillStyle=r,n.fillRect(0,0,e,e),new zt(t)}function qC(i){let t=document.createElement("canvas");t.width=128,t.height=128/2;let n=t.getContext("2d"),r=i*9301+49297,s=()=>(r=(r*9301+49297)%233280)/233280;for(let o=0;o<7;o++){let a=128*(.2+.6*s()),l=128/2*(.45+.25*s()),c=128*(.12+.14*s()),u=n.createRadialGradient(a,l,0,a,l,c);u.addColorStop(0,"rgba(255,255,255,0.9)"),u.addColorStop(.6,"rgba(255,255,255,0.45)"),u.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=u,n.fillRect(0,0,128,128/2)}return new zt(t)}var Lh=class{group=new rt;scene;bounds={x0:-10,x1:10,z0:-10,z1:10,y0:0,y1:8};view=null;rain;rainVel=new Float32Array(Ll*3);snow;snowPhase=new Float32Array(Xo);hail;clouds=[];bolt;disc;halo;stars;cover;last=0;nextBolt=0;boltUntil=0;onFlash=null;constructor(e){this.scene=e,this.group.name="live-weather",this.group.renderOrder=5;let t=new Ce;t.setAttribute("position",new De(new Float32Array(Ll*6),3)),this.rain=new gn(t,new Lt({color:11128309,transparent:!0,opacity:.5,depthWrite:!1}));let n=Ih([[0,"rgba(255,255,255,1)"],[.5,"rgba(255,255,255,0.6)"],[1,"rgba(255,255,255,0)"]],32),r=new Ce;r.setAttribute("position",new De(new Float32Array(Xo*3),3)),this.snow=new xn(r,new cn({color:16185855,size:.16,map:n,transparent:!0,opacity:.9,depthWrite:!1}));for(let h=0;h.02,this.stars.position.set((n.x0+n.x1)/2,n.y0,(n.z0+n.z1)/2),this.stars.scale.setScalar(r*3);let a=this.cover.material,l=(t?.snow??0)+(t?.hail??0)*.5,c=t?.rain??0;a.color.setHex(l>.05?16054527:1848656),a.opacity=l>.05?.3+.45*Math.min(1,l):c>.1?.25*Math.min(1,c):0,this.cover.visible=a.opacity>.02,this.cover.position.set((n.x0+n.x1)/2,n.y0-.18,(n.z0+n.z1)/2),this.cover.scale.set(n.x1-n.x0,n.z1-n.z0,1)}set(e){let t=this.view;this.view=e,this.group.visible=!!e;let n=e?.weather??null;if(e&&n&&n.fog>.02&&!e.low){let r=new W(e.sky[0]/255,e.sky[1]/255,e.sky[2]/255);this.scene.fog=new ls(r,.008+.04*n.fog)}else this.scene.fog instanceof ls&&(this.scene.fog=null);(!t||t.low!==e?.low||!!t.weather!=!!n)&&this.seed(),this.placeDisc(),this.placeNight(),n?.lightning||this.endBolt()}windVector(){let e=this.view?.weather;if(!e)return[0,0];let n=((e.windFrom??270)+(this.view?.north??0)+180)*sm,r=.4+7*e.wind;return[Math.sin(n)*r,-Math.cos(n)*r]}count(e,t){let n=this.view?.low??!1;return Math.round(Math.min(1,e)*t*(n?.3:1))}seed(){let e=this.bounds,t=this.view?.weather,n=()=>e.x0+Math.random()*(e.x1-e.x0),r=()=>e.z0+Math.random()*(e.z1-e.z0),s=()=>e.y0+Math.random()*(e.y1-e.y0),o=this.rain.geometry.getAttribute("position");for(let c=0;c.01,this.snow.visible=!!t&&t.snow>.01,this.hail.visible=!!t&&t.hail>.01,this.clouds.forEach((c,u)=>{c.angle=u/om*Math.PI*2+Math.random()*.5,c.ring=1.7+Math.random()*.9,c.lift=.35+Math.random()*.35,c.scale=.55+Math.random()*.45,c.sx=e.x0+Math.random()*(e.x1-e.x0),c.sz=e.z0+Math.random()*(e.z1-e.z0)}),this.placeClouds(0)}placeClouds(e){let t=this.view,n=t?.weather,r=n?.cloud??0,s=this.bounds,o=(s.x0+s.x1)/2,a=(s.z0+s.z1)/2,l=Math.max(s.x1-s.x0,s.z1-s.z0),[c,u]=this.windVector(),h=Math.round(r*om),f=t?.sky??[20,28,44],d=(f[0]+f[1]+f[2])/765,p=n?.rain||n?.lightning?.3:0,g=Math.max(.12,Math.min(1,.28+d*.9-p-.25*Math.max(0,r-.6))),m=Math.hypot(c,u)/Math.max(20,l*4)*e*Math.sign(c||1);this.clouds.forEach((x,b)=>{let _=bs.x1+S&&(x.sx=s.x0-S),x.sxs.z1+S&&(x.sz=s.z0-S),x.sz.9||!r&&t.elevation<.5){this.disc.visible=this.halo.visible=!1;return}let s=this.bounds,o=new U((s.x0+s.x1)/2,s.y0,(s.z0+s.z1)/2),a=Math.max(70,Math.max(s.x1-s.x0,s.z1-s.z0)*3.5),l=((r?t.azimuth+180:t.azimuth)+e.north)*sm,c=Math.max(8,Math.abs(t.elevation))*sm,u=new U(Math.sin(l)*Math.cos(c),Math.sin(c),-Math.cos(l)*Math.cos(c)),h=o.addScaledVector(u,a),f=a*(r?.07:.1);this.disc.position.copy(h),this.halo.position.copy(h),this.disc.scale.setScalar(f),this.halo.scale.setScalar(f*3.2);let d=this.disc.material,p=this.halo.material,g=r?0:Math.max(0,1-t.elevation/20);d.color.set(r?14016242:new W(1,.9-.25*g,.6-.35*g)),p.color.copy(d.color),d.opacity=(r?.7:.95)*(1-n),p.opacity=(r?.35:.6)*(1-n),this.disc.visible=this.halo.visible=!0}endBolt(){this.bolt.visible&&(this.bolt.visible=!1,this.onFlash?.(!1))}strike(e){let t=this.bounds,r=(Math.random()<.5?-1:1)<0?t.x0-2-Math.random()*6:t.x1+2+Math.random()*6,s=t.z0+Math.random()*(t.z1-t.z0),o=t.y1+4,a=this.bolt.geometry.getAttribute("position"),l=24,c=o;for(let u=0;u.01&&this.placeClouds(r),n.lightning&&!t.low?(this.nextBolt||(this.nextBolt=e+2500+Math.random()*6e3),e>=this.nextBolt&&(this.strike(e),this.nextBolt=e+3500+Math.random()*9e3),this.bolt.visible&&e>this.boltUntil&&this.endBolt()):this.nextBolt=0,this.rain.visible||this.snow.visible||this.hail.visible||n.cloud>.01||n.lightning}dispose(){this.endBolt(),this.group.traverse(e=>{let t=e;t.geometry?.dispose();let n=t.material;n?.map?.dispose(),n?.dispose()}),this.scene.remove(this.group),this.scene.fog instanceof ls&&(this.scene.fog=null)}};var Fh=46,Nh=33,Us=900;function am(){let i=document.createElement("canvas");i.width=i.height=32;let e=i.getContext("2d"),t=e.createRadialGradient(16,16,0,16,16,16);return t.addColorStop(0,"rgba(255,255,255,1)"),t.addColorStop(.35,"rgba(255,255,255,0.7)"),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.fillRect(0,0,32,32),new zt(i)}var Oh=class{group=new rt;scene;lift;tex=am();arcs=new Map;sparkFields=[];sparks;sparkBase=new Float32Array(Us*3);sparkField=new Int16Array(Us);sparkPhase=new Float32Array(Us);sparkCount=0;last=0;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-energy";let n=new Ce;n.setAttribute("position",new De(new Float32Array(Us*3),3)),n.setAttribute("color",new De(new Float32Array(Us*3),3)),this.sparks=new xn(n,new cn({size:.4,map:this.tex,vertexColors:!0,transparent:!0,depthWrite:!1,blending:Ft})),this.sparks.frustumCulled=!1,this.group.add(this.sparks),e.add(this.group)}get active(){return this.arcs.size>0||this.sparkCount>0}setArcs(e){let t=new Set(e.map(n=>n.key));for(let[n,r]of this.arcs)t.has(n)||(this.group.remove(r.line,r.points),r.line.geometry.dispose(),r.line.material.dispose(),r.points.geometry.dispose(),r.points.material.dispose(),this.arcs.delete(n));for(let n of e){let r=this.arcs.get(n.key);if(!r){let o=new Ce;o.setAttribute("position",new De(new Float32Array(Nh*3),3));let a=new Pn(o,new Lt({transparent:!0,opacity:.4,depthWrite:!1,blending:Ft})),l=new Ce;l.setAttribute("position",new De(new Float32Array(Fh*3),3));let c=new xn(l,new cn({size:.55,map:this.tex,transparent:!0,depthWrite:!1,blending:Ft}));a.frustumCulled=c.frustumCulled=!1;let u=new Float32Array(Fh);for(let h=0;hnew U):null,r.points.material.color.copy(s),r.count=n.power<=0?0:Math.max(3,Math.min(Fh,Math.round(3+Math.sqrt(n.power)/2.2))),r.speed=.18+Math.min(.5,Math.log10(1+n.power)*.1),r.points.geometry.setDrawRange(0,r.count)}this.place()}setSparks(e){this.sparkFields=e;let t=e.reduce((r,s)=>r+s.quads.length*s.level,0),n=0;t>0&&e.forEach((r,s)=>{if(r.level<=0)return;let o=Math.round(Us*r.quads.length*r.level/Math.max(t,e.reduce((a,l)=>a+l.quads.length,0)));for(let a=0;a0}world(e,t){let n=this.lift(e.floorId);return t.set(e.x,n.y+e.y,e.z),n.visible}place(){for(let e of this.arcs.values()){if(e.path){this.placeRoute(e,e.path);continue}let t=this.world(e.arc.from,e.a),n=this.world(e.arc.to,e.b),r=e.a.distanceTo(e.b);e.c.copy(e.a).add(e.b).multiplyScalar(.5),e.c.y=Math.max(e.a.y,e.b.y)+.6+r*.22;let s=t&&n;e.line.visible=e.points.visible=s;let o=e.line.geometry.getAttribute("position");for(let a=0;ar=this.world(o,t[a])&&r),e.line.visible=e.points.visible=r,e.along=[0];for(let o=1;os.setXYZ(a,o.x,o.y,o.z)),e.line.geometry.setDrawRange(0,t.length),s.needsUpdate=!0}at(e,t){if(!e.path)return this.bezier(e,t);let n=e.along[e.along.length-1]||1,r=t*n,s=1;for(;s0}set(e,t){let n=new Set(e.map(r=>r.id));for(let[r,s]of this.spots)if(!n.has(r)){for(let o of s.rings)this.group.remove(o),o.material.dispose();this.spots.delete(r)}for(let r of e){let s=this.spots.get(r.id);if(!s){let a=Array.from({length:bM},()=>{let l=new we(this.ringGeo,new $e({transparent:!0,opacity:0,depthWrite:!1,blending:Ft,side:ht}));return l.rotation.x=-Math.PI/2,l.frustumCulled=!1,this.group.add(l),l});s={spot:r,rings:a},this.spots.set(r.id,s)}s.spot=r;let o=new W(r.color[0]/255,r.color[1]/255,r.color[2]/255);for(let a of s.rings)a.material.color.copy(o)}for(let r of this.links)this.group.remove(r.line),r.line.geometry.dispose(),r.line.material.dispose();this.links=t.map(([r,s])=>{let o=new Ce;o.setAttribute("position",new De(new Float32Array(51),3));let a=new Pn(o,new Lt({color:12616956,transparent:!0,opacity:.55,depthWrite:!1,blending:Ft}));return a.frustumCulled=!1,this.group.add(a),{a:r,b:s,line:a}})}step(e){if(!this.spots.size&&!this.links.length)return!1;let t=e/1e3;for(let n of this.spots.values()){let r=this.lift(n.spot.at.floorId),s=.9+1.6*n.spot.level;n.rings.forEach((o,a)=>{let l=(t*.55+a/bM)%1;o.visible=r.visible,o.position.set(n.spot.at.x,r.y+n.spot.at.y,n.spot.at.z),o.scale.setScalar((.25+l*s)*(n.spot.size??1)),o.material.opacity=(1-l)*(.35+.5*n.spot.level)})}for(let n of this.links){let r=this.lift(n.a.floorId),s=this.lift(n.b.floorId);n.line.visible=r.visible&&s.visible;let o=n.line.geometry.getAttribute("position"),a=r.y+n.a.y,l=s.y+n.b.y,c=Math.hypot(n.a.x-n.b.x,n.a.z-n.b.z);for(let u=0;u<=16;u++){let h=u/16,f=Math.sin(Math.PI*h)*(.3+c*.12)+Math.sin(t*3+h*12)*.03;o.setXYZ(u,n.a.x+(n.b.x-n.a.x)*h,a+(l-a)*h+f,n.a.z+(n.b.z-n.a.z)*h)}o.needsUpdate=!0}return!0}dispose(){this.set([],[]),this.ringGeo.dispose(),this.scene.remove(this.group)}};var Uh=6,_M=24,yM=Uh*_M;function $C(i,e,t){let n=i%Uh,r=Math.floor(i/Uh),s=(r/_M+e*.7)%1,o=n/Uh*Math.PI*2+e*.35+(r*7%5-2)*.012,a=s*t,l=Math.min(1.2,t/3);return[Math.cos(o)*a,4*l*s*(1-s),Math.sin(o)*a]}var Bh=class{group=new rt;scene;lift;tex=am();material=new cn({color:11068159,size:.09,map:this.tex,transparent:!0,opacity:.9,depthWrite:!1});sprays=new Map;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-water",e.add(this.group)}get active(){return this.sprays.size>0}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.sprays)t.has(n)||(this.group.remove(r.points),r.points.geometry.dispose(),this.sprays.delete(n));for(let n of e){let r=this.sprays.get(n.id);if(r){r.spot=n;continue}let s=new Ce;s.setAttribute("position",new De(new Float32Array(yM*3),3));let o=new xn(s,this.material);o.frustumCulled=!1,this.group.add(o),this.sprays.set(n.id,{spot:n,points:o})}}step(e){if(!this.sprays.size)return!1;let t=e/1e3;for(let n of this.sprays.values()){let r=this.lift(n.spot.at.floorId);n.points.visible=r.visible,n.points.position.set(n.spot.at.x,r.y+n.spot.at.y,n.spot.at.z);let s=n.points.geometry.getAttribute("position");for(let o=0;oi===null?new W(6910332):new W().setHSL((1-Math.max(0,Math.min(1,i/85)))*.62,.8,.55),kh=class{group=new rt;views=new Map;scene;lift;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-hydronics",e.add(this.group)}remove(e){e.group.traverse(t=>{t instanceof we&&(t.geometry.dispose(),t.material.dispose())}),this.group.remove(e.group)}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.views)t.has(n)||(this.remove(r),this.views.delete(n));for(let n of e){let r=this.views.get(n.id);r?.spot.item!==n.item&&(r&&this.remove(r),r=this.build(n),this.views.set(n.id,r)),r.spot=n}}build(e){let t=new rt,n=[],r=e.item,s=sh(r),o=(a,l,c,u,h,f={},d)=>{let p=new we(d??(h==="temperature"?new ds(u,10,6):new Mi(u*1.6,u*.3,.012)),new $e({color:6910332,depthWrite:!0}));p.name=`hydronic-${h}-${f.circulation?"circulation":f.circuit??f.probe??f.temp??0}`,p.position.set(a,l,c),t.add(p),n.push({mesh:p,kind:h,...f})};if(r.type==="heating_manifold"){let a=s.circuits??[];a.forEach((l,c)=>{let u=ah(r,l,c,a.length);if(oh(l)){o(u.flowX,u.pumpY,u.pumpFront+.001,u.pumpR*.84,"pumpState",{circuit:c},new Ea(u.pumpR*.84,24));let h=[];for(let f=0;f<3;f++)for(let[d,p]of[[0,.1],[.28,.18],[0,.73]]){let g=f*Math.PI*2/3;h.push(u.pumpR*(d*Math.cos(g)-p*Math.sin(g)),u.pumpR*(d*Math.sin(g)+p*Math.cos(g)),0)}o(u.flowX,u.pumpY,u.pumpFront+.002,u.pumpR,"pump",{circuit:c},new Ce().setAttribute("position",new De(h,3)))}No(l)&&o(u.flowX,u.valveY,u.valveFront+.003,u.valveR*.8,"valve",{circuit:c}),o(u.flowGaugeX,u.temperatureY,u.gaugeFront+.001,u.gaugeR*.45,"temperature",{circuit:c,temp:0}),o(u.returnGaugeX,u.temperatureY,u.gaugeFront+.001,u.gaugeR*.45,"temperature",{circuit:c,temp:1})})}else if(r.type==="buffer_tank")(s.sensors??[]).forEach((a,l)=>o(0,r.h*(.1+.8*a.level),Math.min(r.w,r.d)*.46+.025,.021,"temperature",{probe:l}));else{for(let[a,l]of[-.36,-.12,.12,.36].entries())o(l*r.w,r.h*.28,r.d*.57,.02,"temperature",{temp:a});for(let[a,l]of[-.3,.3].entries())for(let c of[0,Math.PI/2])o(l*r.w,r.h*.55,r.d*.57,Math.min(r.w,r.h)*.065,"pump",{circulation:a===1}),n.at(-1).mesh.userData.angle=c}return t.rotation.set((r.tilt_x??0)*Math.PI/180,-r.rotation*Math.PI/180,(r.tilt_z??0)*Math.PI/180,"YZX"),t.scale.x=r.mirror?-1:1,t.name=`hydronic-${r.id}`,this.group.add(t),{spot:e,group:t,parts:n}}step(e){let t=!1;for(let n of this.views.values()){let{spot:r}=n,s=this.lift(r.floorId);n.group.visible=s.visible,n.group.position.set(r.item.x,s.y+r.base,r.item.z);for(let o of n.parts){let a=o.circuit===void 0?void 0:r.circuits[o.circuit];if(o.kind==="temperature"){let l=o.probe!==void 0?r.probes[o.probe]?.value:a?o.temp===0?a.flow:a.return:r.temperatures[o.temp??0];o.mesh.material.color.copy(KC(l??null))}else if(o.kind==="pump"||o.kind==="pumpState"){let l=a?a.pump:o.circulation?r.circulation:r.pump;if(o.kind==="pumpState"){o.mesh.material.color.set(l===null?7501950:l?4953657:11019832);continue}o.mesh.material.color.set(a?l===null?11712441:14739417:l===null?9015450:l?7332258:4608865),o.mesh.rotation.z=Number(o.mesh.userData.angle??0)+(l&&r.animate!==!1?e/350:0),t||=s.visible&&l===!0&&r.animate!==!1}else o.mesh.rotation.z=a?.valve===null||a?.valve===void 0?0:a.valve/100*Math.PI/2,o.mesh.material.color.set(a?.valve===null?9015450:a?.cooling?5290239:9357674)}}return t}dispose(){for(let e of this.views.values())this.remove(e);this.views.clear(),this.scene.remove(this.group)}};var ZC=Math.PI/180;function JC(){let i=document.createElement("canvas");i.width=i.height=64;let e=i.getContext("2d"),t=e.createRadialGradient(32,32,4,32,32,32);return t.addColorStop(0,"rgba(255,255,255,0.9)"),t.addColorStop(.5,"rgba(255,255,255,0.35)"),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.fillRect(0,0,64,64),new zt(i)}var zh=class{group=new rt;scene;lift;glowTex=JC();views=new Map;onChange=null;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-screens",e.add(this.group)}get active(){return[...this.views.values()].some(e=>e.s.playing)}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.views)t.has(n)||this.drop(n,r);for(let n of e){let r=this.views.get(n.id);if(!r){let o=document.createElement("canvas");o.width=512,o.height=288;let a=new zt(o);a.colorSpace=dt;let l=new we(new sn(1,1),new $e({map:a,transparent:!0,toneMapped:!1}));l.renderOrder=6;let c=new we(new sn(1,1),new $e({map:this.glowTex,transparent:!0,depthWrite:!1,blending:Ft,side:ht}));c.renderOrder=2,this.group.add(l,c),r={s:n,sig:"",screen:l,glow:c,canvas:o,texture:a,image:null},this.views.set(n.id,r)}r.s=n;let s=[n.title,n.subtitle,n.app,n.picture,n.color.join(","),n.playing].join("|");if(s!==r.sig){let o=r.sig.split("|")[3]!==(n.picture??"");r.sig=s,o&&this.loadPicture(r),this.draw(r)}this.place(r)}}loadPicture(e){e.image=null;let t=e.s.picture;if(!t)return;let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{e.s.picture!==t||!this.views.has(e.s.id)||(e.image=n,this.draw(e),this.onChange?.())},n.src=t}draw(e){let t=e.s,n=e.canvas.getContext("2d"),r=e.canvas.width,s=e.canvas.height,[o,a,l]=t.color,c=n.createLinearGradient(0,0,r,s);c.addColorStop(0,`rgb(${Math.round(o*.35)},${Math.round(a*.35)},${Math.round(l*.35)})`),c.addColorStop(1,"rgb(6,9,18)"),n.fillStyle=c,n.fillRect(0,0,r,s);let u=22,h=u;if(e.image){let f=s-u*2-30;n.save(),n.shadowColor=`rgba(${o},${a},${l},0.7)`,n.shadowBlur=24;let d=e.image.naturalWidth||1,p=e.image.naturalHeight||1,g=Math.max(f/d,f/p),m=f/g,x=f/g;n.drawImage(e.image,(d-m)/2,(p-x)/2,m,x,u,u,f,f),n.restore(),h=u*2+f}n.fillStyle="#ffffff",n.font="600 34px Figtree, Roboto, sans-serif",this.text(n,t.title||t.app||"",h,s/2-18,r-h-u),n.fillStyle="rgba(230,240,255,0.75)",n.font="26px Figtree, Roboto, sans-serif",this.text(n,t.subtitle,h,s/2+22,r-h-u),t.app&&(n.fillStyle=`rgb(${o},${a},${l})`,n.font="700 22px Figtree, Roboto, sans-serif",this.text(n,(t.playing?"\u25B6 ":"\u275A\u275A ")+t.app,h,s-u-14,r-h-u)),n.fillStyle=`rgba(${o},${a},${l},0.9)`,n.fillRect(0,s-6,r*(t.playing?1:.4),6),e.texture.needsUpdate=!0}text(e,t,n,r,s){let o=t;for(;o.length>1&&e.measureText(o).width>s;)o=o.slice(0,-2);e.fillText(o===t?o:`${o}\u2026`,n,r)}place(e){let t=e.s,n=t.rect,r=t.rotation*ZC,s=this.lift(t.floorId),o=(n.x0+n.x1)/2,a=(p,g)=>[t.x+p*Math.cos(r)-g*Math.sin(r),t.z+p*Math.sin(r)+g*Math.cos(r)],l=n.x1-n.x0,c=n.y1-n.y0,[u,h]=a(o,n.z+.012);e.screen.position.set(u,s.y+(n.y0+n.y1)/2,h),e.screen.rotation.set(0,-r,0),e.screen.scale.set(l,c,1);let[f,d]=a(o,n.z-.18);e.glow.position.set(f,s.y+(n.y0+n.y1)/2,d),e.glow.rotation.set(0,-r,0),e.glow.scale.set(l*2.4,c*2.6,1),e.glow.material.color=new W(t.color[0]/255,t.color[1]/255,t.color[2]/255),e.screen.visible=s.visible,e.glow.visible=s.visible&&(t.ambilight??1)>0}step(e){let t=!1;for(let n of this.views.values()){this.place(n);let r=n.glow.material;r.opacity=(n.s.playing?.55+.25*Math.sin(e/900+n.s.x):.25)*Math.min(1.5,n.s.ambilight??1),t||=n.s.playing}return t}drop(e,t){this.group.remove(t.screen,t.glow),t.screen.geometry.dispose(),t.screen.material.dispose(),t.texture.dispose(),t.glow.geometry.dispose(),t.glow.material.dispose(),this.views.delete(e)}dispose(){for(let[e,t]of this.views)this.drop(e,t);this.glowTex.dispose(),this.scene.remove(this.group)}};var jC=Math.PI/180,QC="#f4f1ea",Vh=class{group=new rt;scene;lift;views=new Map;onChange=null;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-pictures",e.add(this.group)}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.views)t.has(n)||this.drop(n,r);for(let n of e){let r=this.views.get(n.id);if(!r){let c=document.createElement("canvas"),u=new zt(c);u.colorSpace=dt;let h=new we(new sn(1,1),new $e({map:u,toneMapped:!1}));h.renderOrder=5,this.group.add(h),r={p:n,sig:"",mesh:h,canvas:c,texture:u,image:null},this.views.set(n.id,r)}let s=r.p.url!==n.url||!r.sig;r.p=n;let o=n.rect.x1-n.rect.x0,a=n.rect.y1-n.rect.y0,l=[n.url,n.border,n.fit,o.toFixed(3),a.toFixed(3)].join("|");l!==r.sig&&(r.sig=l,s&&this.load(r),this.draw(r)),this.place(r)}}load(e){e.image=null;let t=e.p.url,n=new Image;n.crossOrigin="anonymous",n.onload=()=>{e.p.url!==t||!this.views.has(e.p.id)||(e.image=n,this.draw(e),this.onChange?.())},n.src=t}draw(e){let t=e.p,n=Math.max(.01,t.rect.x1-t.rect.x0),r=Math.max(.01,t.rect.y1-t.rect.y0),s=600/Math.max(n,r),o=e.canvas.width=Math.max(16,Math.round(n*s)),a=e.canvas.height=Math.max(16,Math.round(r*s)),l=e.canvas.getContext("2d");l.fillStyle=t.border>0?QC:"#20242c",l.fillRect(0,0,o,a);let c=Math.round(Math.min(o,a)*Math.min(40,Math.max(0,t.border))/100),[u,h,f,d]=[c,c,o-2*c,a-2*c];if(e.image&&f>4&&d>4){let p=e.image.naturalWidth||1,g=e.image.naturalHeight||1;if(t.fit==="contain"){let m=Math.min(f/p,d/g);l.drawImage(e.image,u+(f-p*m)/2,h+(d-g*m)/2,p*m,g*m)}else{let m=Math.max(f/p,d/g),x=f/m,b=d/m;l.drawImage(e.image,(p-x)/2,(g-b)/2,x,b,u,h,f,d)}c>0&&(l.strokeStyle="rgba(0,0,0,0.25)",l.lineWidth=Math.max(1,c*.04),l.strokeRect(u,h,f,d))}else f>4&&d>4&&(l.fillStyle="#3a4250",l.fillRect(u,h,f,d));e.texture.needsUpdate=!0}place(e){let t=e.p,n=t.rect,r=t.rotation*jC,s=this.lift(t.floorId),o=(n.x0+n.x1)/2,a=n.z+.004;e.mesh.position.set(t.x+o*Math.cos(r)-a*Math.sin(r),s.y+(n.y0+n.y1)/2,t.z+o*Math.sin(r)+a*Math.cos(r)),e.mesh.rotation.set(0,-r,0),e.mesh.scale.set(n.x1-n.x0,n.y1-n.y0,1),e.mesh.visible=s.visible}step(){for(let e of this.views.values())this.place(e);return!1}drop(e,t){this.group.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.views.delete(e)}dispose(){for(let[e,t]of this.views)this.drop(e,t);this.scene.remove(this.group)}};var Gh=class extends Tn{constructor(){super(),this.name="RoomEnvironment",this.position.y=-3.5;let e=new Mi;e.deleteAttribute("uv");let t=new In({side:un}),n=new In,r=new ms(16777215,900,28,2);r.position.set(.418,16.199,.3),this.add(r);let s=new we(e,t);s.position.set(-.757,13.219,.717),s.scale.set(31.713,28.305,28.591),this.add(s);let o=new hs(e,n,6),a=new Et;a.position.set(-10.906,2.009,1.846),a.rotation.set(0,-.195,0),a.scale.set(2.328,7.905,4.651),a.updateMatrix(),o.setMatrixAt(0,a.matrix),a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),a.updateMatrix(),o.setMatrixAt(1,a.matrix),a.position.set(6.167,.857,7.803),a.rotation.set(0,.561,0),a.scale.set(3.927,6.285,3.687),a.updateMatrix(),o.setMatrixAt(2,a.matrix),a.position.set(-2.017,.018,6.124),a.rotation.set(0,.333,0),a.scale.set(2.002,4.566,2.064),a.updateMatrix(),o.setMatrixAt(3,a.matrix),a.position.set(2.291,-.756,-2.621),a.rotation.set(0,-.286,0),a.scale.set(1.546,1.552,1.496),a.updateMatrix(),o.setMatrixAt(4,a.matrix),a.position.set(-2.193,-.369,-5.547),a.rotation.set(0,.516,0),a.scale.set(3.875,3.487,2.986),a.updateMatrix(),o.setMatrixAt(5,a.matrix),this.add(o);let l=new we(e,Yo(50));l.position.set(-16.116,14.37,8.208),l.scale.set(.1,2.428,2.739),this.add(l);let c=new we(e,Yo(50));c.position.set(-16.109,18.021,-8.207),c.scale.set(.1,2.425,2.751),this.add(c);let u=new we(e,Yo(17));u.position.set(14.904,12.198,-1.832),u.scale.set(.15,4.265,6.331),this.add(u);let h=new we(e,Yo(43));h.position.set(-.462,8.89,14.52),h.scale.set(4.38,5.441,.088),this.add(h);let f=new we(e,Yo(20));f.position.set(3.235,11.486,-12.541),f.scale.set(2.5,2,.1),this.add(f);let d=new we(e,Yo(100));d.position.set(0,20,0),d.scale.set(1,.1,1),this.add(d)}dispose(){let e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function Yo(i){return new Fa({color:0,emissive:16777215,emissiveIntensity:i})}function lm(i,e){if(e===rd)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===So||e===Za){let t=i.getIndex();if(t===null){let s=[],o=i.getAttribute("position");if(o!==void 0){for(let a=0;ao&&(N+=B,O+=X,P+=V)}let I=1/(Math.sqrt(N*N+O*O+P*P)||1);_[3*A+0]=N*I,_[3*A+1]=O*I,_[3*A+2]=P*I}}return t.setAttribute("normal",new wt(_,3,!1)),t}function MM(i){let e=new Map,t=new Map,n=i.clone();return SM(i,n,function(r,s){e.set(s,r),t.set(r,s)}),n.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=e.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(l){return t.get(l)}),s.bind(s.skeleton,s.bindMatrix)}),n}function SM(i,e,t){t(i,e);for(let n=0;n=2.0 are supported."));return}let c=new Um(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,s){n.parse(e,t,r,s)})}};function eP(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}function Bt(i,e,t){let n=i.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var it={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DIFFUSE_ROUGHNESS:"KHR_materials_diffuse_roughness",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},fm=class{constructor(e){this.parser=e,this.name=it.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}},Em=class{constructor(e){this.parser=e,this.name=it.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=r.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(e,o.source,l)}},Rm=class{constructor(e){this.parser=e,this.name=it.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=r.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(e,o.source,l)}},Hh=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let r=n.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){let l=r.byteOffset||0,c=r.byteLength||0,u=r.count,h=r.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,f,r.mode,r.filter).then(function(d){return d.buffer}):o.ready.then(function(){let d=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(d),u,h,f,r.mode,r.filter),d})})}else return null}},Cm=class{constructor(e){this.name=it.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let c of r.primitives)if(c.mode!==ei.TRIANGLES&&c.mode!==ei.TRIANGLE_STRIP&&c.mode!==ei.TRIANGLE_FAN&&c.mode!==void 0)return null;let o=n.extensions[this.name].attributes,a=[],l={};for(let c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{let u=c.pop(),h=u.isGroup?u.children:[u],f=c[0].count,d=[];for(let p of h){let g=new ze,m=new U,x=new Sn,b=new U(1,1,1),_=new hs(p.geometry,p.material,f);for(let M=0;M0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var lP=new ze,Um=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new eP,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let l=a.match(/Version\/(\d+)/);r=n&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&r<17||s&&o<98?(this.textureLoader=new Da(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)):(this.textureLoader=new za(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new go(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType("arraybuffer"),(this.options.withCredentials||this.options.crossOrigin==="use-credentials")&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){let a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:n,userData:{}};return Bs(s,a,r),Bi(a,r),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(let l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let r=0,s=t.length;r{let l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(let[c,u]of o.children.entries())s(u,a.children[c])};return s(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&m.setY(C,S[v*l+1]),l>=3&&m.setZ(C,S[v*l+2]),l>=4&&m.setW(C,S[v*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(e){let t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s],a=this.textureLoader;if(o.uri){let l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){let r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];let c=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);let f=(s.samplers||{})[o.sampler]||{};return u.magFilter=TM[f.magFilter]||Ht,u.minFilter=TM[f.minFilter]||Fn,u.wrapS=AM[f.wrapS]||kn,u.wrapT=AM[f.wrapT]||kn,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Ut&&u.minFilter!==Ht,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){let n=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());let o=r.images[e],a=self.URL||self.webkitURL,l=o.uri||"",c=!1,u;if(t.isKTX2Loader===!0&&o.bufferView!==void 0)u=n.getDependency("bufferView",o.bufferView).then(function(f){return new Promise(function(d,p){t.parse(f,d,p)})});else{if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(f){c=!0;let d=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");u=Promise.resolve(l).then(function(f){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(m){let x=new Kt(m);x.needsUpdate=!0,d(x)}),t.load(ar.resolveURL(f,s.path),g,void 0,p)})})}let h=u.then(function(f){return c===!0&&a.revokeObjectURL(l),Bi(f,o),f.userData.mimeType=o.mimeType||aP(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=h,h}assignTexture(e,t,n,r){let s=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[it.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[it.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let l=s.associations.get(o);o=s.extensions[it.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new cn,mn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){let a="LineBasicMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new Lt,mn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(r||s||o){let a="ClonedMaterial:"+n.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return In}loadMaterial(e){let t=this,n=this.json,r=this.extensions,s=n.materials[e],o,a={},l=s.extensions||{},c=[];if(l[it.KHR_MATERIALS_UNLIT]){let h=r[it.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{let h=s.pbrMetallicRoughness||{};if(a.color=new W(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){let f=h.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Mn),a.opacity=f[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,dt)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ht);let u=s.alphaMode||um.OPAQUE;if(u===um.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===um.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==$e&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Be(1,1),s.normalTexture.scale!==void 0)){let h=s.normalTexture.scale;a.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&o!==$e&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==$e){let h=s.emissiveFactor;a.emissive=new W().setRGB(h[0],h[1],h[2],Mn)}return s.emissiveTexture!==void 0&&o!==$e&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,dt)),Promise.all(c).then(function(){let h=new o(a);return s.name&&(h.name=s.name),Bi(h,s),t.associations.set(h,{materials:e}),s.extensions&&Bs(r,h,s),h})}createUniqueName(e){let t=gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function s(a){return n[it.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return EM(l,a,t)})}let o=[];for(let a=0,l=e.length;alm(d,Za)):c.mode===ei.TRIANGLE_FAN&&(f=f.then(d=>lm(d,So))),r[u]={primitive:c,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){let t=this,n=this.json,r=this.extensions,s=n.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l0&&sP(x,s),x.name=t.createUniqueName(s.name||"mesh_"+e),Bi(x,s),m.extensions&&Bs(r,x,m),t.assignFinalMaterial(x),h.push(x)}for(let d=0,p=h.length;d0){let d=u.userData.pivot,p=h[0];u.pivot=new U().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new fo:c.length>1?u=new rt:c.length===1?u=c[0]:u=new Et,u!==c[0])for(let h=0,f=c.length;h1){let h=r.associations.get(u);r.associations.set(u,{...h})}return r.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,s=new rt;n.name&&(s.name=r.createUniqueName(n.name)),Bi(s,n),n.extensions&&Bs(t,s,n);let o=n.nodes||[],a=[];for(let l=0,c=o.length;l{let h=new Map;for(let[f,d]of r.associations)(f instanceof mn||f instanceof Kt)&&h.set(f,d);return u.traverse(f=>{let d=r.associations.get(f);d!=null&&h.set(f,d)}),h};return r.associations=c(s),s})}_createAnimationTracks(e,t,n,r,s){let o=[],a=e.name?e.name:e.uuid,l=[];function c(d){d.morphTargetInfluences&&l.push(d.name?d.name:d.uuid)}Yr[s.path]===Yr.weights?(c(e),e.isGroup&&e.children.forEach(c)):l.push(a);let u;switch(Yr[s.path]){case Yr.weights:u=ir;break;case Yr.rotation:u=rr;break;case Yr.translation:case Yr.scale:u=Nr;break;default:n.itemSize===1?u=ir:u=Nr;break}let h=r.interpolation!==void 0?nP[r.interpolation]:Ji,f=this._getArrayFromAccessor(n);for(let d=0,p=l.length;d{let t=e;if(!t.isMesh)return;let n=t.geometry,r=t.material,s=r.name??"";t.userData.paint=!!r.userData?.paint||/^Paint/.test(s),n.getAttribute("normal")||(t.userData.paint?n.computeVertexNormals():t.geometry=vM(n,uP)),r.flatShading=!1;let o=/glass/i.test(s);r.metalness=t.userData.paint?.55:o?0:Math.min(r.metalness??0,.4),r.roughness=t.userData.paint?.28:o?.05:Math.max(r.roughness??.6,.45),o&&(r.transparent=!0,r.depthWrite=!1,r.opacity=Math.max(r.opacity,.9))})}function IM(i){let e=CM.get(i);if(!e){let t=Y0();if(!t)return Promise.resolve(!1);e=t(i).then(n=>n&&new Promise(r=>{new $o().parse(n,"",s=>{hP(s.scene);let o=new Ct().setFromObject(s.scene),a=[o.max.x-o.min.x,o.max.y-o.min.y,o.max.z-o.min.z];s.scene.position.set(-(o.max.x+o.min.x)/2,-o.min.y,-(o.max.z+o.min.z)/2);let l=new rt;l.add(s.scene),PM.set(i,{root:l,size:a}),q0(i),r({root:l,size:a})},()=>r(null))})).catch(()=>null),CM.set(i,e)}return e.then(t=>!!t)}function LM(i,e){let t=PM.get(i);if(!t)return null;let n=t.root.clone(!0),r=[];n.traverse(o=>{let a=o;if(!a.isMesh)return;let l=a.material.clone();a.userData.paint&&e.paint&&(l.color=new W(e.paint)),a.material=l,r.push(l)});let s=new rt;return s.add(n),s.scale.set((e.mirror?-1:1)*(e.w/t.size[0]),e.h/t.size[1],e.d/t.size[2]),s.position.set(e.x,e.y,e.z),s.rotation.y=-e.rotation*Math.PI/180,s.userData.own=r,s}function Bm(i){for(let e of i.userData.own??[])e.dispose()}function FM(i,e){let t=new To(e),n=t.fromScene(new Gh,.04).texture;t.dispose();let r=new ps(16777215,9081766,.9),s=new or(16777215,1.6);return s.position.set(-4,9,6),i.add(r,s),{env:n,dispose:()=>{n.dispose(),r.removeFromParent(),s.removeFromParent()}}}function NM(i,e){for(let t of i.userData.own??[])t.envMap=e,t.envMapIntensity=.9}var fP=.3,OM=2.6,Xh=.05;function dP(i,e,t,n){let r=n*.7071,s=[i,[i[0]+n,i[1]],[i[0]-n,i[1]],[i[0],i[1]+n],[i[0],i[1]-n]],o=[[i[0]+r,i[1]+r],[i[0]-r,i[1]+r],[i[0]+r,i[1]-r],[i[0]-r,i[1]-r]];return s.every(a=>Ge(a,e))&&!t.some(a=>[...s,...o].some(l=>Ge(l,a)))}function DM(i,e,t){let n=Math.ceil(Math.hypot(e[0]-i[0],e[1]-i[1])/Xh);for(let r=1;rt+1e-6)&&r!==null){let a=o?s:s-Xh;(!n||a-r>n[1]-n[0])&&(n=[r,a]),r=null}}return n}function UM(i,e=.32,t=.22,n=[]){let r=i.map(_=>_[0]),s=i.map(_=>_[1]),[o,a,l,c]=[Math.min(...r),Math.max(...r),Math.min(...s),Math.max(...s)],u=c-l>=a-o,h=_=>dP(_,i,n,t),f=(_,y)=>u?[_,y]:[y,_],[d,p,g,m]=u?[o,a,l,c]:[l,c,o,a],x=[],b=!0;for(let _=d+t;_<=p-t+1e-6;_+=e){let y=pP(w=>h(f(_,w)),g,m);if(!y||y[1]-y[0]<.2)continue;let M=w=>w?[f(_,y[0]),f(_,y[1])]:[f(_,y[1]),f(_,y[0])],S=M(b),v=x[x.length-1];if(v&&n.length>0&&!DM(v,S[0],h)){let w=M(!b);if(!DM(v,w[0],h))continue;S=w,b=!b}x.push(...S),b=!b}return x}function zm(i,e=.7,t=12){return Array.from({length:t},(n,r)=>[i[0]+Math.cos(r/t*Math.PI*2)*e,i[1]+Math.sin(r/t*Math.PI*2)*e])}var km=i=>Math.atan2(Math.sin(i),Math.cos(i));function BM(i,e,t){let n;if(e.mode==="cleaning"){if(i.path.length===0)return!1;n=i.path[i.next%i.path.length]}else if(e.mode==="returning"||e.mode==="docked")n=e.rest;else return!1;let[r,s]=[n[0]-i.pos[0],n[1]-i.pos[1]],o=Math.hypot(r,s);if(o<.02){if(e.mode==="cleaning")return i.next=(i.next+1)%i.path.length,!0;let l=km(e.restHeading-i.heading);return Math.abs(l)<.02?!1:(i.heading+=Math.sign(l)*Math.min(Math.abs(l),OM*t),!0)}let a=km(Math.atan2(r,s)-i.heading);if(i.heading=km(i.heading+Math.sign(a)*Math.min(Math.abs(a),OM*t)),Math.abs(a)<.35){let l=Math.min(o,fP*t);i.pos=[i.pos[0]+r/o*l,i.pos[1]+s/o*l]}return!0}var Yh=600*1e3,mP=3e3;function kM(i,e){if(i==null)return 1;let t=e-i;return t>Yh?Math.max(0,1-(t-Yh)/mP):1}function Vm(i,e,t){let n=e/2,r=[],s=(a,l,c)=>r.push(a[0],t,a[1],l[0],t,l[1],c[0],t,c[1]);for(let a of i){for(let c=0;c+14?o=i.array[r*i.itemSize+s]:(s===0?o=i.getX(r):s===1?o=i.getY(r):s===2?o=i.getZ(r):s===3&&(o=i.getW(r)),i.normalized===!0&&(o=Br.normalize(o,i.array))),n.min[s]=Math.min(n.min[s],o),n.max[s]=Math.max(n.max[s],o)}return n}function XM(i){return Math.ceil(i/4)*4}function Hm(i,e=0){let t=XM(i.byteLength);if(t!==i.byteLength){let n=new Uint8Array(t);if(n.set(new Uint8Array(i)),e!==0)for(let r=i.byteLength;r"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function wP(i,e){if(typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas){let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),i.convertToBlob({type:e,quality:t})}else return new Promise(t=>i.toBlob(t,e))}var Xm=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r187"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map,normalMaps:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1,copyright:null},n),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);let r=this,s=r.buffers,o=r.json;n=r.options;let a=r.extensionsUsed,l=r.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),u=Object.keys(a),h=Object.keys(l);if(u.length>0&&(o.extensionsUsed=u),h.length>0&&(o.extensionsRequired=h),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),n.copyright&&(o.asset.copyright=n.copyright),n.binary===!0){let f=new FileReader;f.readAsArrayBuffer(c),f.onloadend=function(){let d=Hm(f.result),p=new DataView(new ArrayBuffer(WM));p.setUint32(0,d.byteLength,!0),p.setUint32(4,_P,!0);let g=Hm(vP(JSON.stringify(o)),32),m=new DataView(new ArrayBuffer(WM));m.setUint32(0,g.byteLength,!0),m.setUint32(4,yP,!0);let x=new ArrayBuffer(HM),b=new DataView(x);b.setUint32(0,xP,!0),b.setUint32(4,bP,!0);let _=HM+m.byteLength+g.byteLength+p.byteLength+d.byteLength;b.setUint32(8,_,!0);let y=new Blob([x,m,g,p,d],{type:"application/octet-stream"}),M=new FileReader;M.readAsArrayBuffer(y),M.onloadend=function(){t(M.result)}}}else if(o.buffers&&o.buffers.length>0){let f=new FileReader;f.readAsDataURL(c),f.onloadend=function(){let d=f.result;o.buffers[0].uri=d,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;let n=this.options,r=this.extensionsUsed;try{let s=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],r[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){let r=new Map;r.set(!0,this.uid++),r.set(!1,this.uid++),this.uids.set(e,r)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let n=new U;for(let r=0,s=e.count;r5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let n=e.clone(),r=new U;for(let s=0,o=n.count;s4?m=e.array[p*e.itemSize+g]:(g===0?m=e.getX(p):g===1?m=e.getY(p):g===2?m=e.getZ(p):g===3&&(m=e.getW(p)),e.normalized===!0&&(m=Br.normalize(m,e.array))),t===ot.FLOAT?u.setFloat32(h,m,!0):t===ot.INT?u.setInt32(h,m,!0):t===ot.UNSIGNED_INT?u.setUint32(h,m,!0):t===ot.SHORT?u.setInt16(h,m,!0):t===ot.UNSIGNED_SHORT?u.setUint16(h,m,!0):t===ot.BYTE?u.setInt8(h,m):t===ot.UNSIGNED_BYTE&&u.setUint8(h,m),h+=a}h%l!==0&&(h+=l-h%l)}let f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(f.target=s),s===ot.ARRAY_BUFFER&&(f.byteStride=l),this.byteOffset+=c,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(r){let s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){let o=Hm(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,r(n.bufferViews.push(a)-1)}})}processAccessor(e,t,n,r){let s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"},a;if(e.array.constructor===Float32Array)a=ot.FLOAT;else if(e.array.constructor===Int32Array)a=ot.INT;else if(e.array.constructor===Uint32Array)a=ot.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=ot.SHORT;else if(e.array.constructor===Uint16Array)a=ot.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=ot.BYTE;else if(e.array.constructor===Uint8Array)a=ot.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(r===void 0||r===1/0)&&(r=e.count),r===0)return null;let l=SP(e,n,r),c;t!==void 0&&(c=e===t.index?ot.ELEMENT_ARRAY_BUFFER:ot.ARRAY_BUFFER);let u=this.processBufferView(e,a,n,r,c),h={bufferView:u.id,byteOffset:u.byteOffset,componentType:a,count:r,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(h)-1}processImage(e,t,n,r="image/png"){if(e!==null){let s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});let u=o.images.get(e),h=r+":flipY/"+n.toString();if(u[h]!==void 0)return u[h];a.images||(a.images=[]);let f={mimeType:r},d=Wm();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);let p=d.getContext("2d",{willReadFrequently:!0});if(n===!0&&(p.translate(0,d.height),p.scale(1,-1)),e.data!==void 0){t!==On&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let m=new Uint8ClampedArray(e.height*e.width*4);for(let x=0;xs.processBufferViewImage(m)).then(m=>{f.bufferView=m})):f.uri=co.getDataURL(d,r);let g=a.images.push(f)-1;return u[h]=g,g}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let n={magFilter:Gn[e.magFilter],minFilter:Gn[e.minFilter],wrapS:Gn[e.wrapS],wrapT:Gn[e.wrapT]};return t.samplers.push(n)-1}async processTextureAsync(e){let n=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof Fr&&(e=await this.decompressTextureAsync(e,n.maxTextureSize));let o=e.userData.mimeType,a=this.processImage(e.image,e.format,e.flipY,o),l={sampler:this.processSampler(e)};o==="image/webp"?(l.extensions=l.extensions||{},l.extensions.EXT_texture_webp={source:a},this.extensionsUsed.EXT_texture_webp=!0,this.extensionsRequired.EXT_texture_webp=!0):l.source=a,e.name&&(l.name=e.name),await this._invokeAllAsync(async function(u){u.writeTexture&&await u.writeTexture(e,l)});let c=s.textures.push(l)-1;return r.textures.set(e,c),c}async processMaterialAsync(e,t){let n=this.cache,r=this.json,s=t!==void 0&&t.hasAttribute("tangent"),o=e.normalMap?e.uuid+":"+s:e.uuid;if(n.materials.has(o))return n.materials.get(o);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);let a={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let l=e.color.toArray().concat([e.opacity]);if(br(l,[1,1,1,1])||(a.pbrMetallicRoughness.baseColorFactor=l),e.isMeshStandardMaterial?(a.pbrMetallicRoughness.metallicFactor=e.metalness,a.pbrMetallicRoughness.roughnessFactor=e.roughness):(a.pbrMetallicRoughness.metallicFactor=0,a.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){let u=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),h={index:await this.processTextureAsync(u),texCoord:u.channel};this.applyTextureTransform(h,u),a.pbrMetallicRoughness.metallicRoughnessTexture=h}if(e.map){let u={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(u,e.map),a.pbrMetallicRoughness.baseColorTexture=u}if(e.emissive){let u=e.emissive;if(Math.max(u.r,u.g,u.b)>0&&(a.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let f={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(f,e.emissiveMap),a.emissiveTexture=f}}if(e.normalMap){let u=e.normalScale,h=u.x<0,f=s?u.y<0:u.y>0,d=e.normalMap;if(h||f){n.normalMaps.has(e.normalMap)===!1&&n.normalMaps.set(e.normalMap,{});let g=n.normalMaps.get(e.normalMap),m=`${h}:${f}`;g[m]===void 0&&(g[m]=await this.buildNormalMapTextureAsync(e.normalMap,h,f)),d=g[m]}let p={index:await this.processTextureAsync(d),texCoord:e.normalMap.channel};Math.abs(u.x)!==1&&(p.scale=Math.abs(u.x)),this.applyTextureTransform(p,e.normalMap),a.normalTexture=p}if(e.aoMap){let u={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(u.strength=e.aoMapIntensity),this.applyTextureTransform(u,e.aoMap),a.occlusionTexture=u}e.transparent?a.alphaMode="BLEND":e.alphaTest>0&&(a.alphaMode="MASK",a.alphaCutoff=e.alphaTest),e.side===ht&&(a.doubleSided=!0),e.name!==""&&(a.name=e.name),this.serializeUserData(e,a),await this._invokeAllAsync(async function(u){u.writeMaterialAsync&&await u.writeMaterialAsync(e,a)});let c=r.materials.push(a)-1;return n.materials.set(o,c),c}async processMeshAsync(e){let t=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let y=0,M=e.material.length;y0){let y=[],M=[],S={};if(e.morphTargetDictionary!==void 0)for(let v in e.morphTargetDictionary)S[e.morphTargetDictionary[v]]=v;for(let v=0;v0&&(l.extras={},l.extras.targetNames=M)}let g=Array.isArray(e.material);if(g&&o.groups.length===0)return null;let m=!1;if(g&&o.index===null){let y=[];for(let M=0,S=o.attributes.position.count;M0&&(S.targets=h),o.index!==null){let w=this.getUID(o.index);(b[y].start!==void 0||b[y].count!==void 0)&&(w+=":"+b[y].start+":"+b[y].count),t.attributes.has(w)?S.indices=t.attributes.get(w):(S.indices=this.processAccessor(o.index,o,b[y].start,b[y].count),t.attributes.set(w,S.indices)),S.indices===null&&delete S.indices}let v=await this.processMaterialAsync(x[b[y].materialIndex],o);v!==null&&(S.material=v),u.push(S)}m===!0&&o.setIndex(null),l.primitives=u,n.meshes||(n.meshes=[]),await this._invokeAllAsync(function(y){y.writeMesh&&y.writeMesh(e,l)});let _=n.meshes.push(l)-1;return t.meshes.set(s,_),_}detectMeshQuantization(e,t){if(this.extensionsUsed[Gm])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");let r=e.split("_",1)[0];VM[r]&&VM[r].includes(n)&&(this.extensionsUsed[Gm]=!0,this.extensionsRequired[Gm]=!0)}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let n=e.isOrthographicCamera,r={type:n?"orthographic":"perspective"};return n?r.orthographic={xmag:e.right,ymag:e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:Br.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){let n=this.json,r=this.nodeMap;n.animations||(n.animations=[]),e=qr.Utils.mergeMorphTargetTracks(e.clone(),t);let s=e.tracks,o=[],a=[];for(let c=0;c0){let a=[];for(let l=0,c=e.children.length;l0&&(s.children=a)}return await this._invokeAllAsync(function(a){a.writeNode&&a.writeNode(e,s)}),o}async _processNodeWithPivotAsync(e){let t=this.json,n=this.options,r=this.nodeMap,s=e.pivot,o={},a=e.quaternion.toArray(),l=[e.position.x+s.x,e.position.y+s.y,e.position.z+s.z],c=e.scale.toArray();br(a,[0,0,0,1])||(o.rotation=a),br(l,[0,0,0])||(o.translation=l),br(c,[1,1,1])||(o.scale=c),o.extras={pivot:s.toArray()},e.name!==""&&(o.name=String(e.name)),this.serializeUserData(e,o);let u=t.nodes.push(o)-1;r.set(e,u);let h={},f=[-s.x,-s.y,-s.z];if(br(f,[0,0,0])||(h.translation=f),e.isMesh||e.isLine||e.isPoints){let g=await this.processMeshAsync(e);g!==null&&(h.mesh=g)}else e.isCamera&&(h.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);let p=[t.nodes.push(h)-1];if(e.children.length>0){let g=[];for(let m=0,x=e.children.length;m0&&(h.children=g)}return o.children=p,await this._invokeAllAsync(function(g){g.writeNode&&g.writeNode(e,o)}),u}async processSceneAsync(e){let t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);let r={};e.name!==""&&(r.name=e.name),t.scenes.push(r);let s=[];for(let o=0,a=e.children.length;o0&&(r.nodes=s),this.serializeUserData(e,r)}async processObjectsAsync(e){let t=new Tn;t.name="AuxScene";for(let n=0;n0&&await this.processObjectsAsync(n);for(let r=0;r0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},s[this.name]=!0);let a=r.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}},qm=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;let r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},$m=class{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){let o={index:await n.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let o={index:await n.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){let o={index:await n.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},Km=class{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;let r=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},Zm=class{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){let o={index:await n.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,s.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,e.iridescenceThicknessMap){let o={index:await n.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},Jm=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){let o={index:await n.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},jm=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){let o={index:await n.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},Qm=class{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;let r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},e0=class{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(gP)&&!e.specularIntensityMap&&!e.specularColorMap)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.specularIntensityMap){let o={index:await n.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){let o={index:await n.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},t0=class{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.sheenRoughnessMap){let o={index:await n.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){let o={index:await n.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},n0=class{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.anisotropyMap){let o={index:await n.processTextureAsync(e.anisotropyMap)};n.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},i0=class{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;let r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},r0=class{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.bumpMap){let o={index:await n.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},s0=class{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;let n=this.writer,r=e,s=new Float32Array(r.count*3),o=new Float32Array(r.count*4),a=new Float32Array(r.count*3),l=new ze,c=new U,u=new Sn,h=new U;for(let d=0;di.times[i.times.length-1]){if(Math.abs(i.times[i.times.length-1]-e)<.001)return i.times.length-1;r[r.length-1]=e,r.set(i.times,0),s.set(i.values,0),s.set(o.evaluate(e),i.values.length),a=r.length-1}else for(let l=0;le){r.set(i.times.slice(0,l+1),0),r[l+1]=e,r.set(i.times.slice(l+1),l+2),s.set(i.values.slice(0,(l+1)*n),0),s.set(o.evaluate(e),(l+1)*n),s.set(i.values.slice((l+1)*n),(l+2)*n),a=l+1;break}}return i.times=r,i.values=s,a},mergeMorphTargetTracks:function(i,e){let t=[],n={},r=i.tracks;for(let s=0;sTP.test(r.name)).map(r=>r.name);if(e.length>0)return e;let n=[...i.filter(r=>r.opacity>=.9&&r.lightness>.12&&!/glass|window|light|lamp/i.test(r.name))].sort((r,s)=>s.area-r.area)[0];return n?[n.name]:[]}function qM(i,e){let t=i.reduce((r,s)=>r+s,0);if(t<=e)return[...i];let n=e/t;return i.map(r=>Math.max(1,Math.floor(r*n)))}var $M=i=>/^Paint/.test(i)?i:`Paint_${i||"body"}`;var Ko=i=>i.indices.length/3;function AP(i){let e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let n=0;nMath.floor(o/t)+1),s=new Float64Array(n);for(let o=0;oe?r=l:(s=l,o=c)}return RP(i,o)}var ki=class extends Error{reason;constructor(e,t){super(t),this.reason=e}},CP=1179937895;function PP(i){if(i.byteLength<20||new DataView(i).getUint32(0,!0)!==CP)throw new ki("not_glb","not a binary glTF (.glb) file")}async function o0(i){return PP(i),new Promise((e,t)=>{new $o().parse(i,"",n=>e(n.scene),n=>{let r=String(n?.message??n);t(/draco|meshopt|ktx/i.test(r)?new ki("compressed",r):new ki("unreadable",r))})})}var IP=i=>i instanceof In?i:Object.assign(new In,{color:i.color?.clone()??new W(8947848),name:i.name,opacity:i.opacity,transparent:i.transparent});function JM(i,e){i.updateMatrixWorld(!0);let t=new Map;return i.traverse(n=>{let r=n;if(!r.isMesh)return;let s=r.geometry,o=s.getAttribute("position");if(!o)return;let a=IP(Array.isArray(r.material)?r.material[0]:r.material),l=t.get(a)??{positions:[],indices:[]};t.set(a,l);let c=new ze().multiplyMatrices(e,r.matrixWorld),u=l.positions.length/3,h=new U;for(let p=0;p({material:n,mesh:{positions:Float32Array.from(r.positions),indices:Uint32Array.from(r.indices)}}))}var LP=i=>{let e=0,[t,n,r]=[new U,new U,new U];for(let s=0;s.299*i.r+.587*i.g+.114*i.b;async function NP(i){let e=JM(await o0(i),new ze);if(e.length===0)throw new ki("empty","the file has no 3D parts");let t=new Ct;for(let s of e)t.union(new Ct().setFromArray(s.mesh.positions));let n=t.getSize(new U),r=e.map(s=>({name:s.material.name||"material",area:LP(s.mesh),opacity:s.material.opacity,lightness:FP(s.material.color)}));return{triangles:e.reduce((s,o)=>s+Ko(o.mesh),0),size:[n.x,n.y,n.z],materials:r,paint:YM(r)}}async function OP(i,e){let t=new ze().makeRotationY(e.turns*Math.PI/2),n=JM(await o0(i),t);if(n.length===0)throw new ki("empty","the file has no 3D parts");let r=qM(n.map(l=>Ko(l.mesh)),e.maxTriangles),s=new Tn,o=0;return n.forEach((l,c)=>{let u=ZM(l.mesh,r[c]);if(Ko(u)===0)return;o+=Ko(u);let h=new Ce;h.setAttribute("position",new wt(u.positions,3)),h.setIndex(new wt(u.indices,1));let f=l.material.name||"material",d=e.paint.includes(f),p=new In({color:l.material.color.clone(),name:d?$M(f):f,metalness:l.material.metalness,roughness:l.material.roughness,opacity:l.material.opacity,transparent:l.material.opacity<1});d&&(p.userData.paint=!0),s.add(new we(h,p))}),{glb:await new Promise((l,c)=>{new qr().parse(s,u=>u instanceof ArrayBuffer?l(u):c(new ki("unreadable","export gave no binary")),u=>c(new ki("unreadable",String(u))),{binary:!0})}),triangles:o}}async function DP(i,e,t=220){let n=await o0(i),r=new Ct().setFromObject(n),s=r.getCenter(new U),o=r.getSize(new U);n.traverse(d=>{let p=d;if(!p.isMesh)return;let g=p.material;(g.userData?.paint||/^Paint/.test(g.name))&&g.color.set(e),g.metalness=Math.min(g.metalness??0,.5)});let a=new Tn,l=new or(16777215,1.6);l.position.set(-4,9,6),a.add(n,new ka(16777215,.5),new ps(16777215,6713480,1.1),l);let c=Math.max(o.x,o.y,o.z)*.75,u=new zn(-c,c,c,-c,.01,100);u.position.copy(s).add(new U(.9,.7,1.2).normalize().multiplyScalar(20)),u.lookAt(s);let h=new kr({alpha:!0,antialias:!0,preserveDrawingBuffer:!0});h.setSize(t,t,!1),h.render(a,u);let f=h.domElement.toDataURL("image/png");return h.dispose(),a.traverse(d=>{let p=d;p.isMesh&&p.geometry.dispose()}),f}var Zo=null,jM=new Map,QM=16758087;function UP(i,e,t){let n=vt(i.type);if(n?.light)al(e,n,{x:0,z:0,rotation:0,w:i.w,d:i.d,h:i.h},0,QM);else if(i.lamp)a0(e,{x:0,z:0,size:[i.w,i.d,i.h],base:0,rotation:0,variant:i.variant??null,lamp:i.lamp},Math.max(i.h+.15,.6),QM);else{let r={id:"preview",type:i.type,x:0,z:0,rotation:0,w:i.w,d:i.d,h:i.h,variant:i.variant??null,entity:null,power:null};Al(e,t,new ut,r)}}function BP(i){let e=i.getCenter(new U),t=new zn(-1,1,1,-1,.01,100);t.position.copy(e).add(new U(.9,.75,1.3).normalize().multiplyScalar(20)),t.lookAt(e),t.updateMatrixWorld();let n=.05;for(let s of[i.min.x,i.max.x])for(let o of[i.min.y,i.max.y])for(let a of[i.min.z,i.max.z]){let l=new U(s,o,a).applyMatrix4(t.matrixWorldInverse);n=Math.max(n,Math.abs(l.x),Math.abs(l.y))}let r=n*1.12;return Object.assign(t,{left:-r,right:r,top:r,bottom:-r}),t.updateProjectionMatrix(),t}function kP(i,e=180,t,n=1.3){let r=[i.type,i.w,i.d,i.h,i.variant??"",e,n].join("|"),s=jM.get(r);if(s)return s;t&&kl(t),Zo??=new kr({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),Zo.setPixelRatio(Math.min(2,window.devicePixelRatio||1)),Zo.setSize(e,e,!1),Zo.setClearColor(0,0);let[o,a]=[new ut,new Wt];UP(i,o,a);let l=new we(o.geometry(),new $e({vertexColors:!0,color:new W(n,n,n)})),c=new gn(a.geometry(),new Lt({vertexColors:!0,color:new W(n*1.8,n*1.8,n*1.8)})),u=new Tn;u.add(l,c),Zo.render(u,BP(new Ct().setFromObject(l)));let h=Zo.domElement.toDataURL("image/png");for(let f of[l,c])f.geometry.dispose(),f.material.dispose();return jM.set(r,h),h}var t1={cleaning:3662079,returning:16758087,docked:4310123,idle:5995775,error:16726863},zP=1.4,c0=32,Ze=2767456,n1=4873352,VP=1911110,l0=450,i1=125,GP=1.6,r1=3e4,o1=5,a1=360/o1,HP=new W(1714765),s1=.94;var u0=class{host;options;renderer;scene=new Tn;camera=new Jt(38,1,.1,400);controls;labels;root=new rt;patternTexture;blindTexture;openingTargets=new Map;fridges=new Map;covers=new Map;screens=new Map;pickFurniture=new Map;pickOpenings=new Map;pickOpenings2=new Map;flashes=new Map;surfaceGrab=null;surfaceDragging=!1;furnishTypes=null;roofWindows=new Map;roofWindowsKey="";persons=[];personPins=new Map;floorInfo=new Map;roomInfo=new Map;groundTexture=null;devices=[];devicePins=new Map;ground;floors=[];building=null;furnitureColors=null;notePhoto=null;floorId=null;roomId=null;wallMode="auto";painted=!1;explode;frame=0;lastFrame=0;qualityMode="auto";governor=null;disposed=!1;resizeObserver;fpsFrames=0;worstFrame=0;lastStatsFrame=0;lowQuality=!1;highQuality=!1;effectTime=0;effectTick=!1;tintTick=!1;effectTimer;awakeUntil=0;deviceLook="";haloTexture;roof=null;roofO=0;keepRoof=!1;robots=new Map;pets=new Map;petMat=null;petTimer;robotGeo=null;robotTrails=new Map;trailTimers=new Map;robotMat=null;mowerMat=null;robotLedGeo=null;robotLast=0;petLast=0;meshes=[];meshLight=null;meshAsked=new Set;robotTimer;floorStack="dim";floorMap=new Map;labelsDirty=!0;viewKey=new Float64Array(6);pinMode=new WeakMap;size={w:1,h:1};labelInset=0;effectFloors=new Set;deviceFloor=new Map;statsOn=!1;parked=new Map;parkedSig="";plain=!1;rightBack=!1;rightDown=null;gateOpen=new Map;gateSig="";orbitSpeed=0;orbitLast=0;orbitTimer;onScreen=!0;intersection=null;swipe=null;furnish=!1;selectedFurniture=null;selectedDevice=null;pendingDevice=null;labelPlacer=new Gu;pinHooks={furnishing:()=>this.furnish,pressedWhileFurnishing:e=>this.pendingDevice=e,selectWhileFurnishing:e=>{this.selectDevice(e),this.options.onDeviceSelect?.(e)},centre:e=>{let[t,n]=[e.getBoundingClientRect(),this.host.getBoundingClientRect()];return{x:t.left+t.width/2-n.left,y:t.top+t.height/2-n.top}},tap:(e,t,n)=>{let r=this.tapInRoom?this.devices.find(s=>s.id===e):void 0;if(r&&!this.deviceInReach(r.floorId,r.roomId))return this.options.onRoomTap?.(r.floorId,r.roomId);this.options.onDeviceTap?.(e,t,n)},hold:(e,t,n)=>this.options.onDeviceHold?.(e,t,n)};tapInRoom=!1;deviceGrab=null;grab=null;ghost=null;theme="neon";themeUniform={value:0};sun=null;weatherLayer;houseShadow=new Xu;sunArc=new Qu;sunArcLocation=null;shadowKey="";footprint={key:"",rings:[]};mapLayer;mapSettings=null;mapNorth=0;groundY=0;skyView=null;weatherTimer;energyLayer;soundLayer;waterLayer;hydronicLayer;glassAlpha={value:.2};screenLayer;pictureLayer;liveAnchors=[];liveAnchorCb=null;roomTint=null;houseRadius=20;startView=null;fpsStart=0;constructor(e,t={}){this.host=e,this.options=t,this.explode=t.explode??!0,this.qualityMode=t.quality??"auto",this.renderer=this.makeRenderer(this.qualityMode),this.labels=document.createElement("div"),this.labels.className="nf-labels",e.append(this.labels),this.patternTexture=WP(),this.blindTexture=XP(),this.haloTexture=qP(),this.ground=new we(new sn(1,1),new $e({transparent:!0,blending:Ft,depthWrite:!1})),this.ground.rotation.x=-Math.PI/2,this.ground.renderOrder=-1,this.scene.add(this.ground,this.root),this.weatherLayer=new Lh(this.scene),this.scene.add(this.houseShadow.mesh),this.scene.add(this.sunArc.group),this.mapLayer=new Rh(this.scene),this.mapLayer.onChange=()=>this.invalidate(),this.energyLayer=new Oh(this.scene,this.liftOf),this.soundLayer=new Dh(this.scene,this.liftOf),this.waterLayer=new Bh(this.scene,this.liftOf),this.hydronicLayer=new kh(this.scene,this.liftOf),this.screenLayer=new zh(this.scene,this.liftOf),this.screenLayer.onChange=()=>this.invalidate(),this.pictureLayer=new Vh(this.scene,this.liftOf),this.pictureLayer.onChange=()=>this.invalidate(),this.weatherLayer.onFlash=n=>this.host.classList.toggle("live-flash",n),this.controls=this.makeControls(),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(e),document.addEventListener("visibilitychange",this.onVisibility),this.host.addEventListener("pointerdown",this.onTouch,{passive:!0}),this.renderer.domElement.addEventListener("pointerdown",this.onRightDown),this.renderer.domElement.addEventListener("pointerup",this.onRightUp),this.renderer.domElement.addEventListener("contextmenu",this.onContext),this.awakeUntil=performance.now()+r1,typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{let r=n.some(s=>s.isIntersecting);r!==this.onScreen&&(this.onScreen=r,r||(clearTimeout(this.effectTimer),this.effectTimer=void 0),r&&this.invalidate())}),this.intersection.observe(e)),this.resize()}get low(){return this.lowQuality}setRightBack(e){this.rightBack=e}onRightDown=e=>{this.rightDown=this.rightBack&&e.button===2?{x:e.clientX,y:e.clientY,at:performance.now()}:null};onRightUp=e=>{let t=this.rightDown;this.rightDown=null,!(!this.rightBack||!t||e.button!==2)&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6&&performance.now()-t.at<400&&this.options.onBack?.()};onContext=e=>{this.rightBack&&e.preventDefault()};setPlain(e){e!==this.plain&&(this.plain=e,this.building&&(this.rebuild(),this.invalidate()))}exportStl(e=10){let t=[];for(let n of this.floors)for(let r of[n.wallMesh,n.floorMesh]){let s=r.geometry.getAttribute("position");s&&t.push({positions:s.array,lift:n.floor.elevation})}return Uy(t,e)}setGateStates(e){let t=[...e].map(([n,r])=>`${n}=${r?1:0}`).sort().join("|");t!==this.gateSig&&(this.gateSig=t,this.gateOpen=e,this.building&&(this.rebuild(),this.invalidate()))}setParked(e){let t=[...e].map(([n,r])=>`${n}=${r}`).sort().join("|");t!==this.parkedSig&&(this.parkedSig=t,this.parked=e,this.building&&(this.rebuild(),this.invalidate()))}setStats(e){this.statsOn=e}setLabelInset(e){this.labelInset!==e&&(this.labelInset=e,this.labelsDirty=!0,this.invalidate())}setAutoOrbit(e){this.orbitSpeed=e,this.orbitLast=0,this.invalidate()}setQuality(e){this.qualityMode=e,this.swapRenderer(e)}dropToLow(){this.disposed||this.lowQuality||this.swapRenderer("low")}swapRenderer(e){let t=this.renderer.domElement,n=this.makeRenderer(e);this.rebuildTier(),this.applyTierFlags(),t.replaceWith(n.domElement),this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer=n;let{view:r,locked:s}=this.controls;this.controls.dispose(),this.controls=this.makeControls(),this.controls.view=r,this.controls.locked=s,this.resize()}setMeshSource(e){X0(e)}setPacks(e){kl(e),this.building&&(this.rebuild(),this.invalidate())}setBuilding(e){let t=this.building===null;this.building=e,this.rebuild(),t&&this.fit(0),this.invalidate()}get walking(){return this.controls.walk!==null}startWalk(){let e=this.floors.filter(l=>l.floor.rooms.some(c=>c.points.length>=3)),t=(this.floorId?this.floorMap.get(this.floorId):void 0)??[...e].sort((l,c)=>Math.abs(l.floor.elevation)-Math.abs(c.floor.elevation))[0];if(!t||!t.bbox)return null;let n=t.floor.rooms.filter(l=>l.points.length>=3),r=n.find(l=>l.id===this.roomId)??[...n].sort((l,c)=>Mr(c.points)-Mr(l.points))[0],[s,o]=r?ks(r.points):[(t.bbox.x0+t.bbox.x1)/2,(t.bbox.z0+t.bbox.z1)/2];this.floorId!==t.floor.id&&this.setFloor(t.floor.id,!1);let a=.3;return this.controls.walk={eye:new U(s,t.floor.elevation+t.ty+GP,o),yaw:this.controls.view.theta,pitch:-.05,stick:[0,0],keys:new Set,bounds:{x0:t.bbox.x0-a,x1:t.bbox.x1+a,z0:t.bbox.z0-a,z1:t.bbox.z1+a},last:0},this.labelsDirty=!0,this.wake(),t.floor.id}stopWalk(){this.controls.walk&&(this.controls.walk=null,this.labelsDirty=!0,this.fit(700))}setWalkStick(e,t){this.controls.walk&&(this.controls.walk.stick=[e,t],this.wake())}setFloor(e,t=!0){let n=this.keepCamera&&this.floorId!==null&&e!==null&&e!==this.floorId?{theta:this.controls.view.theta,phi:this.controls.view.phi,radius:this.controls.view.radius}:null;this.floorId=e,this.roomId=null,this.labelsDirty=!0,this.applyTargets(!t),this.applyHighlight(),this.fit(t?700:0,n)}setKeepCamera(e){this.keepCamera=e}setZoom(e){let t=Math.min(3,Math.max(.5,e||1));t!==this.zoom&&(this.zoom=t,this.building&&this.fit(400))}setFloorStack(e){e!==this.floorStack&&(this.floorStack=e,this.applyTargets(!1))}setKeepRoof(e){e!==this.keepRoof&&(this.keepRoof=e,this.invalidate())}setExplode(e){e!==this.explode&&(this.explode=e,this.applyTargets(!1),this.floorId===null&&this.fit(700))}selectRoom(e){if(this.roomId=e,this.labelsDirty=!0,this.applyHighlight(),!e){this.fit(700);return}let t=this.floors.find(u=>u.floor.rooms.some(h=>h.id===e)),n=t?.floor.rooms.find(u=>u.id===e);if(!t||!n)return;let r=n.start_view;if(r){let u=t.floor.elevation+t.ty,[h,f]=ks(n.points),d=r.target??{x:h,y:.3,z:f};this.controls.flyTo({target:new U(d.x,d.y+u,d.z),radius:r.radius,phi:r.phi,theta:r.theta});return}let[s,o]=ks(n.points),a=n.points.map(u=>u[0]),l=n.points.map(u=>u[1]),c=new U(Math.max(...a)-Math.min(...a),t.floor.cut_height,Math.max(...l)-Math.min(...l));this.controls.flyTo({target:new U(s,t.floor.elevation+t.ty+.3,o),radius:Math.max(4,this.distanceFor(c)*1.05),phi:.72})}get lowered(){return this.wallMode!=="auto"}setPaintedWalls(e){e!==this.painted&&(this.painted=e,this.rebuild(),this.invalidate())}wallPaint(e){return this.painted&&this.building?jp(this.building.settings,e):void 0}setWallMode(e){this.wallMode=e;for(let t of this.floors)this.buildLamps(t);this.invalidate()}setDevices(e){let t=e.map(r=>`${r.id}:${r.active?1:0}:${r.glow?r.glow.level.toFixed(1):"-"}`).join(";");t!==this.deviceLook&&(this.deviceLook=t,this.wake()),this.devices=e,this.labelsDirty=!0,this.effectFloors=new Set(e.filter(r=>r.effect&&r.glow||(r.spin??0)>0).map(r=>r.floorId)),this.deviceFloor=new Map(e.map(r=>[r.id,r.floorId]));let n=new Set;for(let r of e){n.add(r.id);let s=this.devicePins.get(r.id);s||(s={el:Dy(r.id,this.pinHooks),icon:"",text:"",watt:"",label:"",active:!1,unavailable:!1,glow:"",caption:""},this.devicePins.set(r.id,s),this.labels.append(s.el));let o=s.el;s.icon!==r.icon&&(s.icon=r.icon,o.querySelector(".nf-dev-icon").innerHTML=r.icon),s.text!==r.text&&(s.text=r.text,o.querySelector(".nf-dev-text").textContent=r.text);let a=r.caption??"";s.caption!==a&&(s.caption=a,o.querySelector(".nf-dev-name").textContent=a);let l=r.power!==null&&r.power!==void 0&&r.power>=1?r.powerText??`${Math.round(r.power)} W`:"";s.watt!==l&&(s.watt=l,o.querySelector(".nf-dev-watt").textContent=l);let c=`${r.name}: ${r.text}`;s.label!==c&&(s.label=c,o.title=r.name,o.setAttribute("aria-label",c)),s.active!==r.active&&(s.active=r.active,o.classList.toggle("nf-dev-on",r.active)),s.unavailable!==r.unavailable&&(s.unavailable=r.unavailable,o.classList.toggle("nf-dev-na",r.unavailable));let u=r.glow?`rgb(${r.glow.color.map(h=>Math.round(h*255)).join(", ")})`:"";s.glow!==u&&(s.glow=u,u?o.style.setProperty("--nf-glow",u):o.style.removeProperty("--nf-glow"))}for(let[r,s]of this.devicePins)n.has(r)||(s.el.remove(),this.devicePins.delete(r));for(let r of this.floors)this.buildGlow(r),this.buildLamps(r);this.invalidate()}setRoofWindows(e){let t=JSON.stringify([...e]);t!==this.roofWindowsKey&&(this.roofWindowsKey=t,this.roofWindows=e,this.buildRoofMesh(),this.invalidate())}setPersons(e){this.labelsDirty=!0,this.persons=e;let t=new Set;for(let n of e){t.add(n.id);let r=this.personPins.get(n.id);if(r||(r=document.createElement("div"),r.className="nf-person",r.dataset.entity=n.id,this.personPins.set(n.id,r),this.labels.append(r)),r.title=n.name,r.setAttribute("aria-label",n.name),r.dataset.picture!==(n.picture??"")||r.dataset.initials!==n.initials)if(r.dataset.picture=n.picture??"",r.dataset.initials=n.initials,r.replaceChildren(),n.picture){let s=document.createElement("img");s.src=n.picture,s.alt="",s.addEventListener("error",()=>s.replaceWith(document.createTextNode(n.initials))),r.append(s)}else r.textContent=n.initials}for(let[n,r]of this.personPins)t.has(n)||(r.remove(),this.personPins.delete(n));this.invalidate()}setNavigationLocked(e){this.controls.locked=e}setPickTargets(e,t,n=new Map){this.pickFurniture=e,this.pickOpenings=t,this.pickOpenings2=n}setNotePhotos(e){this.notePhoto=e}setFurnitureColors(e){JSON.stringify(e??{})!==JSON.stringify(this.furnitureColors??{})&&(this.furnitureColors=e,this.building&&(this.rebuild(),this.invalidate()))}setAccent(e){let t=Ny(e),n=t?1:0;n===Zu.value&&(!t||Ku.value.equals(new U(...t)))||(Zu.value=n,t&&Ku.value.set(...t),this.invalidate())}setTheme(e){if(e===this.theme)return;this.theme=e,this.placeMap(),this.themeUniform.value=Fy(e);let t=_l(e),n=[...this.floors.map(r=>r.materials.lines),...this.roof?[this.roof.lines]:[]];for(let r of n)r.blending=t,r.needsUpdate=!0;this.placeGround(),this.invalidate()}setFurnishMode(e){this.furnish=e,e||this.selectFurniture(null),this.invalidate()}selectFurniture(e){e&&this.selectedDevice&&this.selectDevice(null),this.selectedFurniture=e,this.updateGhost(),this.invalidate()}setSun(e){this.sun=e;for(let t of this.floors)this.buildSun(t);this.buildHouseShadow(),this.buildSunArc(),this.invalidate()}setLocation(e){this.sunArcLocation=e,this.buildSunArc(),this.invalidate()}buildSunArc(){let e=this.building,t=this.sunArcLocation,n=(e?.floors??[]).flatMap(c=>[...c.rooms.flatMap(u=>u.points),...(c.outdoor??[]).flatMap(u=>u.points)]);if(!e||!e.settings.sun_arc||!t||!n.length)return void this.sunArc.update(null,null,0);let r=n.map(c=>c[0]),s=n.map(c=>c[1]),o=[(Math.min(...r)+Math.max(...r))/2,(Math.min(...s)+Math.max(...s))/2],a=Math.max(6,Math.hypot(Math.max(...r)-Math.min(...r),Math.max(...s)-Math.min(...s))/2+3),l=Math.min(0,...e.floors.map(c=>c.elevation));this.sunArc.update({centre:o,radius:a,north:e.settings.north??0,...t},this.sun,l)}buildHouseShadow(){if(!this.houseShadow)return;let e=this.building,t=(e?.floors??[]).filter(u=>u.elevation>=-.01&&u.rooms.length),n=!e||!t.length||e.settings.sun_patches===!1||this.lowQuality,r=this.weatherLayer?.cloud??0,s=e?.settings.north??0,o=t.map(u=>`${u.elevation}:${u.height}:${JSON.stringify(u.rooms.map(h=>h.points))}`).join("|"),a=n?"off":`${this.sun?.elevation.toFixed(1)},${this.sun?.azimuth.toFixed(1)},${s},${r.toFixed(2)},${o}`;if(a===this.shadowKey)return;if(this.shadowKey=a,n){this.houseShadow.update([],0,0,null,0,0,!0);return}let l=Math.min(...t.map(u=>u.elevation)),c=Math.max(...t.map(u=>u.elevation+u.height));this.footprint.key!==o&&(this.footprint={key:o,rings:dr(t.flatMap(u=>u.rooms.map(h=>h.points)))}),this.houseShadow.update(this.footprint.rings,c-l,l+.03,this.sun,s,r,!1)}liftOf=e=>{if(!e)return{y:0,dy:0,visible:!0};let t=this.floorMap.get(e);return t?{y:t.floor.elevation+t.y,dy:t.y,visible:t.group.visible}:{y:0,dy:0,visible:!1}};setLiveEnergy(e,t){this.energyLayer.setArcs(e),this.energyLayer.setSparks(t),this.invalidate()}setLiveSound(e,t){this.soundLayer.set(e,t),this.invalidate()}setGlassWalls(e){let t=Math.min(1,Math.max(0,e));t!==this.glassAlpha.value&&(this.glassAlpha.value=t,this.invalidate())}setLiveWater(e){this.waterLayer.set(e),this.invalidate()}setHydronics(e){this.hydronicLayer.set(e),this.invalidate()}setLiveScreens(e){let t=[];for(let n of e){let r=this.building?.floors.find(a=>a.id===n.floorId),s=r?.furniture.find(a=>a.id===n.furnitureId),o=s&&r?ch(s,r):null;!s||!o||t.push({...n,x:s.x,z:s.z,rotation:s.rotation,rect:o})}this.screenLayer.set(t),this.invalidate()}setPictures(e){let t=[];for(let n of e){let r=this.building?.floors.find(a=>a.id===n.floorId),s=r?.furniture.find(a=>a.id===n.furnitureId),o=s&&r?Fp(s,r):null;!s||!o||t.push({id:n.furnitureId,floorId:n.floorId,url:n.url,border:n.border,fit:n.fit,x:s.x,z:s.z,rotation:s.rotation,rect:o})}this.pictureLayer.set(t),this.invalidate()}setLiveAnchors(e,t){this.liveAnchors=e,this.liveAnchorCb=t,this.invalidate()}placeLhAnchors(){let e=this.liveAnchorCb;if(!e||!this.liveAnchors.length)return;let t=new U,n=this.camera.matrixWorldInverse.elements,r=this.size.h*this.camera.projectionMatrix.elements[5]/2;this.liveAnchors.forEach((s,o)=>{let a=this.liftOf(s.floorId);t.set(s.x,a.y+s.y,s.z);let l=-(n[2]*t.x+n[6]*t.y+n[10]*t.z+n[14]);t.project(this.camera);let c=a.visible&&t.z>-1&&t.z<1&&Math.abs(t.x)<1.15&&Math.abs(t.y)<1.15;e(o,(t.x+1)/2*this.size.w,(1-t.y)/2*this.size.h,c,l>0?r/l:0)})}setSky(e){this.skyView=e,this.weatherLayer.set(e?{...e,low:e.low||this.lowQuality}:null),this.buildHouseShadow();for(let t of this.floors)this.buildSun(t);this.invalidate()}setRoomTint(e){let t=!!e!=!!this.roomTint;if(this.roomTint=e,this.tintTick=!0,this.applyHighlight(),t)for(let n of this.floors)n.glowSig="",this.buildGlow(n)}setScreens(e){this.screens=e;for(let t of this.floors)this.buildScreens(t);this.invalidate()}fillRoomPin(e,t,n){if(e.textContent=t||"\u2013",n){let r=document.createElement("small");r.textContent=n,e.append(r),e.classList.add("nf-pin-info")}else e.classList.remove("nf-pin-info")}setRoomInfo(e){if(!(e.size===this.roomInfo.size&&[...e].every(([n,r])=>this.roomInfo.get(n)===r))){this.roomInfo=e;for(let n of this.floors)for(let r of n.roomPins)this.fillRoomPin(r.pin,r.room.name,e.get(r.room.id))}}setFloorInfo(e){this.floorInfo=e;for(let t of this.floors){let n=t.label.querySelector("span"),r=e.get(t.floor.id)??this.options.floorInfo?.(t.floor)??"";n&&n.textContent!==r&&(n.textContent=r,t.labelSize=null,this.labelsDirty=!0)}this.invalidate()}setOpeningStates(e){let t=this.openingTargets;this.openingTargets=e,[...e].some(([n,r])=>!up(t.get(n)??Ds,r))&&this.wake(),this.invalidate()}wake(){this.awakeUntil=performance.now()+r1,this.invalidate()}get resting(){return this.lowQuality&&performance.now()>this.awakeUntil}setFridgeDoors(e){for(let[t,n]of e){let r=this.fridges.get(t)??{l:n.left?1:0,r:n.right?1:0,tl:0,tr:0};r.tl=n.left?1:0,r.tr=n.right?1:0,this.fridges.set(t,r)}for(let t of[...this.fridges.keys()])e.has(t)||this.fridges.delete(t);this.invalidate()}setCovers(e){let t=!1;for(let[n,r]of e){let s=this.covers.get(n);s?s.t!==r&&(s.t=r,t=!0):(this.covers.set(n,{k:r,t:r}),t=!0)}for(let n of[...this.covers.keys()])e.has(n)||this.covers.delete(n);if(t){for(let n of this.floors)this.buildFridges(n);this.wake()}}stepCovers(e){let t=Math.min(1,e/4e3),n=!1;for(let r of this.covers.values()){if(r.k===r.t)continue;let s=r.t-r.k;r.k=Math.abs(s)<=t?r.t:r.k+Math.sign(s)*t,n=!0}if(n)for(let r of this.floors)this.buildFridges(r);return n}stepFridges(e){let t=cp(e),n=new Set;for(let[r,s]of this.fridges)for(let[o,a]of[["l","tl"],["r","tr"]]){let l=s[a]-s[o];if(Math.abs(l)<.004){l!==0&&(s[o]=s[a],n.add(r));continue}s[o]+=l*t,n.add(r)}if(!n.size)return!1;for(let r of this.floors)r.floor.furniture.some(s=>n.has(s.id))&&this.buildFridges(r);return!0}buildFridges(e){let t=new ut;for(let n of e.floor.furniture){let r=vt(n.type);if(r&&z0(r)){Jd(t,r,n,Gt(e.floor,n),this.covers.get(n.id)?.k??V0(r,null));continue}if(n.type!=="fridge_smart")continue;let s=this.fridges.get(n.id);Pp(t,n,Gt(e.floor,n),s?.l??0,s?.r??0)}e.fridgeMesh.geometry.dispose(),e.fridgeMesh.geometry=t.geometry(),e.fridgeMesh.visible=t.count>0}resetView(){this.fit(700)}setStartView(e){this.startView=e}currentView(){let e=this.controls.view,t=this.floorBase(this.floorId);return{theta:e.theta,phi:e.phi,radius:e.radius,target:{x:e.target.x,y:e.target.y-t,z:e.target.z}}}floorBase(e){let t=e===null?void 0:this.floorMap.get(e);return t?t.floor.elevation+t.ty:0}dispose(){this.disposed=!0,cancelAnimationFrame(this.frame),clearTimeout(this.effectTimer),clearTimeout(this.robotTimer),clearTimeout(this.orbitTimer),clearTimeout(this.weatherTimer),this.weatherLayer.dispose(),this.sunArc?.dispose(),this.houseShadow?.dispose(),this.mapLayer.dispose(),this.energyLayer.dispose(),this.soundLayer.dispose(),this.waterLayer.dispose(),this.hydronicLayer.dispose(),this.screenLayer.dispose(),this.pictureLayer.dispose(),this.resizeObserver.disconnect(),this.intersection?.disconnect(),document.removeEventListener("visibilitychange",this.onVisibility),this.host?.removeEventListener("pointerdown",this.onTouch),this.renderer?.domElement?.removeEventListener?.("pointerdown",this.onRightDown),this.renderer?.domElement?.removeEventListener?.("pointerup",this.onRightUp),this.renderer?.domElement?.removeEventListener?.("contextmenu",this.onContext),clearTimeout(this.petTimer),this.controls.dispose(),this.clear(),this.building=null,this.buildRoofMesh(),this.ground.geometry.dispose(),this.ground.material.dispose(),this.patternTexture.dispose(),this.blindTexture.dispose(),this.groundTexture?.dispose(),this.haloTexture.dispose();for(let e of this.robots.values())e.led.dispose();this.robots.clear();for(let e of this.robotTrails.values())e.removeFromParent(),e.geometry.dispose(),e.material.dispose();this.robotTrails.clear();for(let e of this.trailTimers.values())clearTimeout(e);this.trailTimers.clear(),this.robotGeo?.dispose(),this.robotLedGeo?.dispose(),this.robotMat?.dispose(),this.mowerMat?.dispose(),this.meshLight?.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),this.labels.remove()}invalidate(){this.frame||this.disposed||document.hidden||!this.onScreen||(this.frame=requestAnimationFrame(e=>this.render(e)))}makeRenderer(e){let t=e==="low"||e==="auto"&&Eb();this.lowQuality=t,this.weatherLayer&&this.skyView&&this.weatherLayer.set({...this.skyView,low:this.skyView.low||t}),this.weatherLayer&&this.buildHouseShadow(),this.highQuality=e==="high";let n=new kr({antialias:!t,alpha:!0,powerPreference:t?"low-power":"default"}),r=Math.min(window.devicePixelRatio||1,t?1:e==="high"?2.5:2);return n.setPixelRatio(r),this.governor=e==="auto"&&!t?new Du(r,Math.min(1,r)):null,n.setClearColor(0,0),n.outputColorSpace=dt,n.domElement.className="nf-canvas",this.host.prepend(n.domElement),n}makeControls(){return new Il(this.renderer.domElement,this.camera,{change:()=>this.wake(),tap:(e,t)=>this.onTap(e,t),hold:(e,t)=>this.onHold(e,t),swipeStart:(e,t,n,r)=>this.swipeStart(e,t,n,r),swipeMove:e=>this.swipe&&this.options.onDeviceSwipe?.(this.swipe.entity,"move",e,this.swipe.x,this.swipe.y),swipeEnd:()=>{this.swipe&&this.options.onDeviceSwipe?.(this.swipe.entity,"end",0,this.swipe.x,this.swipe.y),this.swipe=null},grab:(e,t)=>this.grabFurniture(e,t),drag:(e,t)=>this.dragFurniture(e,t),drop:()=>this.dropFurniture(),doubleTap:(e,t)=>{let n=this.floorId&&this.options.onRoomDoubleTap?this.pick(e,t):null;n&&!("entity"in n)&&n.roomId?this.options.onRoomDoubleTap(n.floorId,n.roomId):this.options.onBack?.()}})}onTouch=()=>this.wake();onVisibility=()=>{document.hidden&&(clearTimeout(this.effectTimer),this.effectTimer=void 0),document.hidden||this.invalidate()};scheduleEffects(){if(!this.hasVisibleEffects(document.hidden)||this.resting){clearTimeout(this.effectTimer),this.effectTimer=void 0;return}if(this.effectTimer!==void 0)return;let e=this.lowQuality?2*i1:i1;this.effectTimer=setTimeout(()=>{if(this.effectTimer=void 0,!!this.hasVisibleEffects(document.hidden)){this.effectTime=performance.now()/1e3,this.effectTick=!0;for(let t of this.floors)t.o<.02||!this.effectFloors.has(t.floor.id)||(this.buildLamps(t),this.buildGlow(t));this.invalidate()}},e)}hasVisibleEffects(e){return!e&&!this.disposed&&this.onScreen&&this.floors.some(t=>t.o>=.02&&this.effectFloors.has(t.floor.id))}resize(){let e=this.host.clientWidth||1,t=this.host.clientHeight||1;this.size={w:e,h:t},this.labelsDirty=!0,this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.invalidate()}clear(){for(let e of this.robots.values())e.group.removeFromParent();for(let e of this.meshes)e.group.removeFromParent(),Bm(e.group);this.meshes=[];for(let e of this.floors){e.group.traverse(t=>{t.geometry?.dispose()});for(let t of Object.values(e.materials))Array.isArray(t)||t.dispose();for(let t of e.materials.ghosts)t.material.dispose();this.root.remove(e.group)}this.floors=[],this.floorMap=new Map;for(let e of[...this.labels.children])e.dataset.entity||e.remove()}buildLightSurface(e){let t=this.lowQuality?.5:.25,n=gp(e.floor,e.geo.walls2d,e.geo.wallBuckets,e.geo.openings,t,e.geo.holes,e.geo.roofUnder),r=YP(e.floor,e.geo.openRooms);if(e.lightZones=r.some((a,l)=>a!==l)?r:null,e.lightZones){for(let a=0;a=0&&l=0&&a.a=0&&a.bthis.glowOf(h)),r=t.doors.map(h=>{let f=e.geo.openings.find(p=>p.opening.id===h.id);if(f&&vr(f.opening,f.exterior)==="passage")return 1;let d=e.openings.get(h.id);return d?Math.max(d.open,d.open2??0):.5}),s=n.map(h=>`${h.x.toFixed(2)},${h.y.toFixed(2)},${h.z.toFixed(2)},${h.kind},${h.level.toFixed(3)},${h.color.map(f=>f.toFixed(3)).join("/")}`).join(";")+"|"+r.map(h=>h.toFixed(1)).join(",");if(s===e.glowSig)return;e.glowSig=s;let o=e.glowMesh.geometry,a=o.getAttribute("color");if(!n.length){e.glowMesh.visible=!1,o.setDrawRange(0,0);return}let l=xp(t,n,.42,r);if(this.roomTint){let h=e.floor.rooms.length;for(let f=0;f.004;if(f)for(let d=0;d<6;d++)c[u++]=h*6+d}o.index.needsUpdate=!0,o.setDrawRange(0,u),e.glowMesh.visible=u>0}withoutFurniture(e){if(this.gateOpen.size&&(e.outdoor??[]).some(n=>n.gates?.length)&&(e={...e,outdoor:e.outdoor.map(n=>n.gates?.length?{...n,gates:n.gates.map(r=>({...r,open:this.gateOpen.get(r.id)??!1}))}:n)}),!this.plain)return e;let t=n=>n.type==="stairs"||n.type==="stairwell"||!!vt(n.type)?.hole;return{...e,furniture:e.furniture.filter(t)}}rebuild(){let e=new Map(this.floors.map(s=>[s.floor.id,{y:s.y,o:s.o}])),t=new Map(this.floors.map(s=>[s.floor.id,s.openings]));this.clear();let n=this.building;if(!n)return;Mb({...n.settings.furniture_colors,...this.furnitureColors});let r=[...n.floors].sort((s,o)=>s.elevation-o.elevation);for(let s of n.floors){let o=n.settings.roof?.solar??[],a=hh(n)?.id===s.id?o.filter(V=>V.face===El).map(V=>({field:V,face:fh(n,V)})):[],l=o.filter(V=>V.face.startsWith(`wall:${s.id}:`));if(l.length){let V=new Map(uh(n,s.id).map(re=>[re.key,re]));for(let re of l){let be=V.get(re.face);be&&a.push({field:re,face:be})}}let u=(n.settings.roof.sections??[]).some(V=>ip(V,s.elevation+s.height))?(V,re)=>{let be=rp(n,V,re);return be===null?null:be-s.elevation}:void 0,h=Qp(this.withoutFurniture(Ah(s,this.parked)),n.settings.wall_exterior,n.settings.wall_interior,em(n.floors,s),a,u,this.wallPaint(s)),f={standing:{value:65535},glass:{value:0},slope:{value:new _t},slopeY:{value:new Be},glassAlpha:this.glassAlpha},d=Oy({mask:f,look:this.themeUniform,theme:this.theme,textures:{pattern:this.patternTexture,blinds:this.blindTexture,halo:this.haloTexture}}),p=new rt,g=new we(h.floor,d.floor),m=new we(h.shadow,d.shadow);m.renderOrder=1;let x=new we(h.floor,d.pattern);x.renderOrder=2;let b=new we(new Ce,d.glow);b.renderOrder=3,b.visible=!1;let _=new we(new Ce,d.frames),y=new we(new Ce,d.blinds),M=new we(new Ce,d.glass);M.renderOrder=4;let S=new we(new Ce,d.lamps);S.visible=!1;let v=new we(new Ce,d.cones);v.visible=!1,v.renderOrder=3;let w=new xn(new Ce,d.halos);w.visible=!1,w.renderOrder=7;let C=new we(new Ce,d.cones);C.visible=!1,C.renderOrder=7;let A=new we(new Ce,d.lamps);A.visible=!1;let R=new we(new Ce,d.screens);R.visible=!1,R.renderOrder=5;for(let V of[_,y,M])V.frustumCulled=!1;let N=new we(h.walls,d.glassWall),O=new we(h.walls,d.wall);N.renderOrder=6,p.add(g,m,x,b,O,new gn(h.lines,d.lines),_,y,M,S,v,w,C,A,R,N);for(let V of h.ghosts){let re=Zn(new $e({vertexColors:!0,transparent:!0,opacity:V.opacity,depthWrite:!1,side:ht}),this.themeUniform);d.ghosts.push({material:re,base:V.opacity});let be=new we(V.geometry,re);be.renderOrder=2,p.add(be)}this.root.add(p);let P=document.createElement("button");P.className="nf-pin nf-pin-floor",P.dataset.floor=s.id;let I=document.createElement("b");I.textContent=s.name||"\u2013";let D=document.createElement("span");D.textContent=this.floorInfo.get(s.id)??this.options.floorInfo?.(s)??"",P.append(I,D),P.addEventListener("click",()=>this.options.onFloorTap?.(s.id)),this.labels.append(P);let F=e.get(s.id),H=[],B=null;for(let V of s.rooms){let re=document.createElement("button");re.className="nf-pin",re.dataset.room=V.id,re.dataset.floor=s.id,this.fillRoomPin(re,V.name,this.roomInfo.get(V.id)),re.addEventListener("click",()=>this.options.onRoomTap?.(s.id,V.id)),this.labels.append(re);let[be,Y]=ks(V.points);H.push({pin:re,room:V,cx:be,cz:Y});for(let[Q,se]of V.points)B??={x0:Q,x1:Q,z0:se,z1:se},B.x0=Math.min(B.x0,Q),B.x1=Math.max(B.x1,Q),B.z0=Math.min(B.z0,se),B.z1=Math.max(B.z1,se)}let X=[];for(let V of s.notes??[]){if(!V.text)continue;let re=document.createElement("button");re.className=`nf-pin nf-note-pin${S0(V)?" nf-note-due":""}`,re.title=V.text;let be=V.text.length>28?`${V.text.slice(0,27)}\u2026`:V.text;re.textContent=`${V.photo?"\u{1F4F7} ":"\u270E "}${be}`,re.addEventListener("click",()=>{let Y=re.classList.toggle("nf-note-open");re.textContent=`${V.photo?"\u{1F4F7} ":"\u270E "}${Y?V.text:be}`;let Q=Y&&V.photo?this.notePhoto?.(V.photo):null;if(Q){let se=document.createElement("img");se.className="nf-note-photo",se.alt="",se.src=Q,se.addEventListener("load",()=>{this.labelsDirty=!0,this.invalidate()}),re.append(se)}this.labelsDirty=!0,this.invalidate()}),this.labels.append(re),X.push({pin:re,note:V})}this.floors.push({floor:s,rank:r.indexOf(s),group:p,geo:h,floorMesh:g,shadowMesh:m,patternMesh:x,glowMesh:b,lightSurface:null,lightZones:null,framesMesh:_,glassMesh:M,blindsMesh:y,lampMesh:S,sunMesh:v,sunSig:"",haloMesh:w,coneMesh:C,wedgeTris:[],fridgeMesh:A,lampTris:[],lampFurnTris:[],frameTris:[],glassTris:[],blindTris:[],wallMesh:O,screenMesh:R,screenSig:"",flowLayout:"",glowSig:"",lampShapeSig:"",lampColorSig:"",lampShade:new Float32Array(0),lampRanges:new Map,bbox:B,roomPins:H,notePins:X,labelSize:null,materials:d,mask:f,openings:new Map,y:F?.y??0,o:F?.o??1,ty:0,to:1,appliedO:-1,label:P})}this.floorMap=new Map(this.floors.map(s=>[s.floor.id,s])),this.buildPets();for(let s of this.floors)this.buildFridges(s);this.labelsDirty=!0,this.floorId&&!n.floors.some(s=>s.id===this.floorId)&&(this.floorId=null);for(let s of this.floors){this.buildLamps(s),this.buildScreens(s);let o=t.get(s.floor.id);for(let a of s.geo.openings)s.openings.set(a.opening.id,o?.get(a.opening.id)??this.openingTargets.get(a.opening.id)??Ds);this.buildOpenings(s),this.buildLightSurface(s),this.buildSun(s)}this.applyTargets(e.size===0),this.applyHighlight(),this.applyTierFlags(),this.buildRoofMesh(),this.updateGhost(),this.placeMeshes()}placeMeshes(){for(let e of this.meshes)e.group.removeFromParent(),Bm(e.group);this.meshes=[];for(let e of this.floors)for(let t of Ah(e.floor,this.parked).furniture){let n=vt(t.type);if(!n?.mesh)continue;let r=n.mesh;if(!zl(t.type)){this.meshAsked.has(r)||(this.meshAsked.add(r),IM(r).then(a=>{a&&!this.disposed&&this.rebuild()}));continue}let s=n.colors?.length?(n.colors.find(a=>a.id===t.variant)??n.colors[0]).hex:null,o=LM(r,{x:t.x,z:t.z,y:Gt(e.floor,t),rotation:t.rotation,mirror:t.mirror,w:t.w,d:t.d,h:t.h,paint:s});o&&(this.meshLight||(this.meshLight=FM(this.root,this.renderer)),NM(o,this.meshLight.env),e.group.add(o),this.meshes.push({group:o,furnitureId:t.id}))}this.invalidate()}buildRoofMesh(){this.roof&&(this.roof.group.traverse(a=>a.geometry?.dispose()),this.roof.solid.dispose(),this.roof.lines.dispose(),this.roof.glass.dispose(),this.scene.remove(this.roof.group),this.roof=null);let e=this.building?Kp(this.building,this.roofWindows):[];if(!e.length)return;let t=new rt,n=Zn(new $e({vertexColors:!0,transparent:!0,side:ht}),this.themeUniform),r=Zn(new Lt({vertexColors:!0,transparent:!0,blending:_l(this.theme),depthWrite:!1}),this.themeUniform,!0),s=Zn(new $e({vertexColors:!0,transparent:!0,side:ht,depthWrite:!1}),this.themeUniform),o=e.map(a=>{let l=new rt;return l.add(new we(a.solid.geometry(),n),new gn(a.lines.geometry(),r)),a.glass.count&&l.add(new we(a.glass.geometry(),s)),l.renderOrder=8,t.add(l),{group:l,floorId:a.floor.id,rideId:op(this.building,a.floor,a.sections??[]),base:a.base,lift:a.lift!==!1}});t.renderOrder=8,this.scene.add(t),this.roof={group:t,parts:o,solid:n,lines:r,glass:s},this.placeRoof()}placeRoof(e=1e3){let t=this.roof;if(!t)return!1;let n=this.keepRoof?1:Math.min(1,Math.max(0,(this.controls.view.radius/this.houseRadius-.62)/.3)),s=(this.floorId===null||this.floors.length===1)&&!this.lowered?s1*n:0,o=lp(e),a=this.roofO;this.roofO+=(s-this.roofO)*o,Math.abs(s-this.roofO)<.004&&(this.roofO=s),t.group.visible=this.roofO>.02;for(let l of t.parts){let c=this.floorMap.get(l.floorId);if(!c)continue;let u=this.floorMap.get(l.rideId)??c,h=u.ty>0?Math.min(1,u.y/u.ty):this.explode&&this.floorId===null?1:0,f=Math.max(0,1-this.roofO/s1);l.group.position.y=c.floor.elevation+u.y+l.base+f*2.2+(l.lift?h*zP:0)}return t.solid.opacity=this.roofO,t.solid.depthWrite=this.roofO>.5,t.lines.opacity=this.roofO,t.glass.opacity=this.roofO*.28,this.roofO!==a&&this.roofO!==s}applyTierFlags(){let e=this.lowQuality;this.ground.visible=!e&&this.theme!=="day"&&this.floors.some(t=>t.floor.rooms.length>0);for(let t of this.floors)t.patternMesh.visible=!e,t.shadowMesh.visible=!e&&t.o>.98;this.invalidate()}rebuildTier(){for(let e of this.floors)e.flowLayout="",this.buildLightSurface(e),e.lampShapeSig="",this.buildLamps(e)}get houseView(){return this.floorId===null&&this.floors.length>1}applyTargets(e){let t=this.floorId?this.floorMap.get(this.floorId):void 0;for(let n of this.floors){let r=Jb(n.rank,t?.rank,this.explode,this.floorStack);[n.ty,n.to]=[r.y,r.opacity],e&&([n.y,n.o]=[r.y,r.opacity]),this.applyFloor(n)}this.invalidate()}applyFloor(e){e.group.position.y=e.floor.elevation+e.y,e.group.visible=e.o>.02,e.shadowMesh.visible=e.o>.98&&!this.lowQuality,!(Math.abs(e.appliedO-e.o)<.001)&&(e.appliedO=e.o,Qb(e.materials,e.o))}stepFloors(e){let t=!1,n=lp(e);for(let r of this.floors){let s=jb(r,n);s.settled&&(this.labelsDirty=!0),(s.moving||s.settled)&&this.applyFloor(r),t||=s.moving}return t}stepOpenings(e){let t=!1,n=cp(e);for(let r of this.floors){let s=!1;for(let[o,a]of r.openings){let l=this.openingTargets.get(o)??Ds;if(up(a,l))continue;let c=ny(a,l,n);r.openings.set(o,c.state),s=!0,t||=c.moving}s&&(this.buildOpenings(r),this.buildGlow(r),this.buildSun(r))}return t}fanPhase(e){return e.lamp!=="fan"||!e.spin?0:Math.round(this.effectTime*e.spin*360%a1*10)/10}glowOf(e){return Wv(e.glow,e.effect,this.effectTime)}buildLamps(e){let t=performance.now(),n=h=>{let f=this.flashes.get(h);if(!f||f<=t)return 0;let d=f-t,p=d>l0?.5+.5*Math.sin(d/140):d/l0;return Math.round(p*10)/10},r=this.devices.filter(h=>h.floorId===e.floor.id&&h.lamp),s=this.wallMode+(this.lowQuality?"L":this.highQuality?"H":"M")+r.map(h=>`${h.id},${h.lamp},${h.variant},${h.x},${h.z},${h.y},${h.rotation??0},${h.roll??0},${h.upright?1:0},${h.rise??0},${h.size?.join("/")},${h.base??0},${h.pack??""},${h.mirror?1:0},${h.ceiling??""},${this.fanPhase(h)}`).join(";"),o=r.map(h=>this.glowOf(h)),a=this.devices.filter(h=>h.floorId===e.floor.id&&h.wedge),l=r.map((h,f)=>`${n(h.id)},${o[f]?`${o[f].level.toFixed(3)},${o[f].color.map(d=>d.toFixed(3)).join("/")}`:"off"}`).join(";")+"|"+a.map(h=>`${h.id},${h.x},${h.z},${h.rotation??0},${JSON.stringify(h.wedge)}`).join(";");if(s!==e.lampShapeSig||!e.lampMesh.geometry.getAttribute("position")){e.lampShapeSig=s,e.lampColorSig="";let h=new ut,f=[],d=[],p=new Map,g=e.floor.height;for(let m of r){let x=m.lamp==="strip"?(m.base??g)>Math.min(e.floor.cut_height,m.ceiling??g):m.lamp?Hu.has(m.lamp):!1;if(!m.lamp||x&&this.lowered)continue;let b=h.count,_=m.pack?vt(m.pack):void 0,[y,M,S]=m.size??[.3,.3,.3];_?al(h,_,{x:m.x,z:m.z,rotation:m.rotation??0,w:y,d:M,h:S,mirror:m.mirror},m.base??0,65280):a0(h,{...m,lamp:m.lamp,phase:this.fanPhase(m)},m.ceiling??g,65280),p.set(m.furnitureId??m.id,{start:b,end:h.count}),m.pickable!==!1&&f.push({id:m.id,start:b,end:h.count}),m.furnitureId&&d.push({id:m.furnitureId,start:b,end:h.count})}e.lampTris=f,e.lampFurnTris=d,e.lampRanges=p,e.lampShade=Rb(h.c),e.lampMesh.geometry.dispose(),e.lampMesh.geometry=h.geometry(),e.lampMesh.visible=h.count>0}if(l===e.lampColorSig)return;e.lampColorSig=l;let c=e.lampMesh.geometry.getAttribute("color"),u=c.array;r.forEach((h,f)=>{let d=e.lampRanges.get(h.furnitureId??h.id);if(!d)return;let p=o[f],g=p?.55+.45*p.level:0,m=p?new W(...p.color.map(_=>Math.min(1,_*g))):new W(VP),x=n(h.id);x>0&&m.lerp(new W(1,1,1),.7*x);let b=new W(m.getHex());Cb(u,e.lampShade,d,[b.r,b.g,b.b])}),c.needsUpdate=!0,this.buildHalos(e)}buildSun(e){let t=this.building?.settings.sun_patches===!1?null:this.sun,n=this.building?.settings.north??0,r=this.weatherLayer?.cloud??0,s=dy(t,n,r,e.openings.values());if(s===e.sunSig)return;e.sunSig=s;let o=py({floor:e.floor,openings:e.geo.openings,states:e.openings,sun:t,northDegrees:n,cloud:r});e.sunMesh.geometry.dispose(),e.sunMesh.geometry=o.geometry(),e.sunMesh.visible=o.count>0}buildHalos(e){let t={positions:[],colours:[]},n=new ut,r=[];for(let a of this.devices)if(a.floorId===e.floor.id&&a.wedge){let l=ay(n,a,e.geo.walls2d);a.wedge.through||r.push({id:a.id,...l})}e.wedgeTris=r;let s=this.lowered;for(let a of this.lowQuality?[]:this.devices){let l=this.glowOf(a);if(a.floorId!==e.floor.id||!a.lamp||!l||s&&hy(a.lamp))continue;let c=a;cy(t,c,l,a.ceiling??e.floor.height),this.highQuality&&(a.lamp==="downlight"||a.lamp==="spot")&&uy(n,c,l,a.ceiling??e.floor.height)}let o=new Ce;o.setAttribute("position",new De(t.positions,3)),o.setAttribute("color",new De(t.colours,3)),e.haloMesh.geometry.dispose(),e.haloMesh.geometry=o,e.haloMesh.visible=!this.lowQuality&&t.positions.length>0,e.coneMesh.geometry.dispose(),e.coneMesh.geometry=n.geometry(),e.coneMesh.visible=n.count>0}buildScreens(e){let t=Ah(e.floor,this.parked).furniture.filter(s=>this.screens.has(s.id)),n=t.map(s=>`${s.id}:${s.x},${s.z},${s.rotation},${s.w},${s.d},${s.h},${s.mount_y??""},${s.mirror?1:0}:${JSON.stringify(this.screens.get(s.id))}`).join(";");if(n===e.screenSig&&e.screenMesh.geometry.getAttribute("position"))return;e.screenSig=n;let r=new ut;for(let s of t){let o=this.screens.get(s.id),a=s.rotation*mt,l=Math.cos(a),c=Math.sin(a),u=(y,M,S)=>[s.x+y*l-S*c,M,s.z+y*c+S*l];if(o.gangs){let y=vt(s.type);if(!y)continue;for(let M of o.gangs){let S=new W(...M.color.map(v=>Math.min(1,v*(.45+.55*M.level))));ol(r,y,s,Gt(e.floor,s),S.getHex(),v=>v.gang===M.gang)}continue}if(o.print!==void 0){let y=Gt(e.floor,s)+s.h*.2,M=Math.min(s.w,s.d)*.16,S=y+s.h*.38*Math.min(1,Math.max(0,o.print)),v=new W(...o.color.map(R=>Math.min(1,R*(.35+.65*o.level)))),w=v.clone().multiplyScalar(.7),C=[u(-M,y,-M),u(M,y,-M),u(M,y,M),u(-M,y,M)],A=[u(-M,S,-M),u(M,S,-M),u(M,S,M),u(-M,S,M)];r.tri(A[0],A[2],A[1],v),r.tri(A[0],A[3],A[2],v);for(let R=0;R<4;R++){let N=(R+1)%4;r.tri(C[R],C[N],A[N],w),r.tri(C[R],A[N],A[R],w)}continue}if(o.fill!==void 0){let y=Np(s,e.floor);if(!y)continue;let M=y.rect,S=Math.min(1,Math.max(0,o.fill)),v=new W(...o.color.map(R=>Math.min(1,R*(.35+.65*o.level)))),w=new W(.08,.1,.13),C=M.z,A=(R,N,O,P,I)=>{r.tri(u(R,O,C),u(N,O,C),u(N,P,C),I),r.tri(u(R,O,C),u(N,P,C),u(R,P,C),I)};if(y.vertical){let R=M.y0+(M.y1-M.y0)*S;S>0&&A(M.x0,M.x1,M.y0,R,v),S<1&&A(M.x0,M.x1,R,M.y1,w)}else{let R=M.x0+(M.x1-M.x0)*S;S>0&&A(M.x0,R,M.y0,M.y1,v),S<1&&A(R,M.x1,M.y0,M.y1,w)}continue}if(o.leds){let y=vt(s.type);if(!y)continue;let M=new W(...o.color.map(S=>Math.min(1,S*(.35+.65*o.level))));ol(r,y,s,Gt(e.floor,s),M.getHex(),S=>!!S.glow||!!S.screen);continue}if(o.heat){let y=vt(s.type);if(!y)continue;let M=new W(...o.color.map(S=>Math.min(1,S*(.35+.65*o.level))));ol(r,y,s,Gt(e.floor,s),M.getHex(),()=>!0);continue}if(o.faces){let y=Math.max(.05,s.w)*(s.mirror?-1:1),M=Math.max(.05,s.d),S=Math.max(.005,s.h),v=Gt(e.floor,s);for(let w of o.faces){let C=w.part==="right"?.03:-Math.abs(y)/2+.03,A=w.part==="left"?-.03:Math.abs(y)/2-.03,R=v+(w.part==="bottom"?S*.45:S)+.006,N=new W(...w.color.map(B=>Math.min(1,B*(.35+.65*w.level)))),O=new W(0,0,0),P=(B,X,V=R)=>u(B*Math.sign(y),V,X),I=[P(C,-M/2+.03),P(A,-M/2+.03),P(A,M/2-.03),P(C,M/2-.03)];r.tri(I[0],I[2],I[1],N),r.tri(I[0],I[3],I[2],N);let D=.12+.1*w.level,F=N.clone().multiplyScalar(.5),H=[P(C-D,-M/2-D,R+.004),P(A+D,-M/2-D,R+.004),P(A+D,M/2+D,R+.004),P(C-D,M/2+D,R+.004)];for(let B=0;B<4;B++){let X=(B+1)%4;r.tri(I[B],H[X],H[B],F,O,O),r.tri(I[B],I[X],H[X],F,F,O)}}continue}let h=ch(s,e.floor);if(!h)continue;let f=new W(...o.color.map(y=>Math.min(1,y*(.35+.65*o.level)))),d=new W(0,0,0),p=h.z+.004;r.tri(u(h.x0,h.y0,p),u(h.x1,h.y0,p),u(h.x1,h.y1,p),f),r.tri(u(h.x0,h.y0,p),u(h.x1,h.y1,p),u(h.x0,h.y1,p),f);let g=Math.min(1.5,o.halo??1);if(g<=0)continue;let m=(.18+.12*o.level)*Math.min(1,g),x=f.clone().multiplyScalar(.5*g),b=[u(h.x0,h.y0,p),u(h.x1,h.y0,p),u(h.x1,h.y1,p),u(h.x0,h.y1,p)],_=[u(h.x0-m,h.y0-m,p+.01),u(h.x1+m,h.y0-m,p+.01),u(h.x1+m,h.y1+m,p+.01),u(h.x0-m,h.y1+m,p+.01)];for(let y=0;y<4;y++){let M=(y+1)%4;r.tri(b[y],_[y],_[M],x,d,d),r.tri(b[y],_[M],b[M],x,d,x)}}e.screenMesh.geometry.dispose(),e.screenMesh.geometry=r.geometry(),e.screenMesh.visible=r.count>0}buildOpenings(e){let t=rm(e.geo.openings,e.openings,Math.min(e.floor.cut_height,e.floor.height),-.2-e.floor.elevation);e.frameTris=t.frameTris,e.glassTris=t.glassTris,e.blindTris=t.blindTris;for(let[n,r]of[[e.framesMesh,t.frames],[e.glassMesh,t.glass],[e.blindsMesh,t.blinds]])n.geometry.dispose(),n.geometry=r,n.visible=r.getAttribute("position").count>0}activeFloors(){return this.floors.filter(e=>e.to>.99)}applyHighlight(){for(let e of this.floors){let t=e.geo.floor.getAttribute("color");for(let n of e.geo.roomTris){let r=new W(n.color),s=this.roomTint?.get(n.roomId);s&&r.lerp(new W(...s).multiplyScalar(.6),.9),n.roomId===this.roomId&&r.lerp(HP,s?.3:.75);for(let o=n.start*3;oc.group),!0)[0];if(l){let c=l.object;for(;c&&!this.meshes.some(h=>h.group===c);)c=c.parent;let u=c?this.pickFurniture.get(this.meshes.find(h=>h.group===c).furnitureId):void 0;if(u)return{entity:u}}}let o=s.flatMap(l=>[l.lampMesh,l.coneMesh,l.framesMesh,l.glassMesh,l.blindsMesh,l.wallMesh,l.floorMesh].filter(c=>c.visible)),a=(l,c)=>l.find(u=>c>=u.start&&ch.group===l.object.parent);if(!(!n&&(l.object===u.lampMesh||l.object===u.coneMesh||l.object===u.framesMesh||l.object===u.blindsMesh||l.object===u.glassMesh))){if(l.object===u.lampMesh||l.object===u.coneMesh){let h=a(l.object===u.lampMesh?u.lampTris:u.wedgeTris,c);if(h)return{entity:h}}else if(l.object===u.framesMesh||l.object===u.blindsMesh||l.object===u.glassMesh){if(this.lowered&&l.face){let g=l.object.geometry.getAttribute("fold")?.getX(l.face.a)??Ye;if(g!==Ye&&Math.floor(g/16)%8===0)continue}let h=a(l.object===u.framesMesh?u.frameTris:l.object===u.glassMesh?u.glassTris:u.blindTris,c),f=h?this.pickOpenings.get(h):void 0,d=h?this.pickOpenings2.get(h):void 0,p=d?u.geo.openings.find(g=>g.opening.id===h):void 0;if(d&&p&&(l.point.x-p.start[0])*p.axis[0]+(l.point.z-p.start[1])*p.axis[1]>p.width/2&&(f=d),f)return{entity:f}}else if(l.object===u.wallMesh){let h=a(u.geo.furnitureTris,c),f=h&&n?this.pickFurniture.get(h):void 0;if(f)return{entity:f};if(l.face&&!h){let d=u.wallMesh.geometry.getAttribute("fold")?.getX(l.face.a)??32,p=Math.floor(d/16)%8,g=d%16,m=this.lowered&&p===0,x=(u.mask.glass.value&1<S.points.length>=3&&Ge(y,S.points))?.id??null;if(this.roomId!==null){if(M===this.roomId)return{floorId:u.floor.id,roomId:M}}else if(!x&&M)return{floorId:u.floor.id,roomId:M}}}}else if(l.object===u.floorMesh)return{floorId:u.floor.id,roomId:a(u.geo.roomTris.map(h=>({id:h.roomId,start:h.start,end:h.end})),c)??null}}}return null}onTap(e,t){let n=this.furnish?this.pick(e,t):this.pickInReach(e,t);if(n&&"entity"in n&&this.furnish){this.selectDevice(n.entity),this.options.onDeviceSelect?.(n.entity);return}if(n&&"entity"in n){this.flashes.set(n.entity,performance.now()+l0),this.invalidate(),this.options.onDeviceTap?.(n.entity,e,t);return}this.options.onRoomTap?.(n?.floorId??this.floorId??"",n?.roomId??null)}furnitureAt(e,t){let n=this.rayAt(e,t),r=this.activeFloors(),s=r.flatMap(o=>[o.lampMesh,o.wallMesh].filter(a=>a.visible));for(let o of n.intersectObjects(s,!1)){if(o.faceIndex==null)continue;let a=r.find(u=>u.group===o.object.parent),c=(o.object===a.lampMesh?a.lampFurnTris:a.geo.furnitureTris).find(u=>o.faceIndex>=u.start&&o.faceIndexh.id===n)?.furnitureId:void 0,a=o?null:this.furnitureAt(e,t),l=o??a?.id,c=l?this.floors.find(h=>h.floor.furniture.some(f=>f.id===l)):void 0,u=c?.floor.furniture.find(h=>h.id===l)?.type;return!!(c&&l&&u&&r.has(u))&&this.grabItem(c,l,e,t)}if(n){let o=this.devices.find(l=>l.id===n)?.furnitureId,a=o?this.floors.find(l=>l.floor.furniture.some(c=>c.id===o)):void 0;return!o||!a?this.grabDevice(n,e,t):this.grabItem(a,o,e,t)}let s=this.furnitureAt(e,t);if(!s){let o=this.pick(e,t);return o&&"entity"in o?this.grabDevice(o.entity,e,t):(this.selectedFurniture&&(this.selectFurniture(null),this.options.onFurnitureSelect?.(null)),this.selectedDevice&&(this.selectDevice(null),this.options.onDeviceSelect?.(null)),!1)}return this.grabItem(s.fv,s.id,e,t)}grabItem(e,t,n,r){let s=e.floor.furniture.find(a=>a.id===t),o=this.floorPoint(e,n,r);return!s||!o?!1:s.locked?(this.selectFurniture(s.id),this.options.onFurnitureSelect?.(s.id),!1):(this.grab={floorId:e.floor.id,id:s.id,offset:[s.x-o[0],s.z-o[1]],x:s.x,z:s.z,moved:!1},this.selectFurniture(s.id),this.options.onFurnitureSelect?.(s.id),!0)}grabDevice(e,t,n){let r=this.devices.find(a=>a.id===e),s=r&&this.floorMap.get(r.floorId),o=s&&this.floorPoint(s,t,n);return!r||!s||!o?!1:r.fixed?(this.selectDevice(e),this.options.onDeviceSelect?.(e),!1):(this.deviceGrab={id:e,floorId:s.floor.id,offset:[r.x-o[0],r.z-o[1]],x:r.x,z:r.z,moved:!1},this.selectDevice(e),this.options.onDeviceSelect?.(e),!0)}setSelectedDevice(e){e!==this.selectedDevice&&this.selectDevice(e)}selectDevice(e){e&&this.selectedFurniture&&(this.selectFurniture(null),this.options.onFurnitureSelect?.(null)),this.selectedDevice=e;for(let[t,n]of this.devicePins)n.el.classList.toggle("nf-dev-sel",t===e)}dragFurniture(e,t){if(this.surfaceDragging){this.surfaceGrab?.move(this.surfaceRay(e,t));return}let n=this.deviceGrab;if(n){let l=this.floorMap.get(n.floorId),c=this.devices.find(f=>f.id===n.id),u=l&&this.floorPoint(l,e,t);if(!l||!c||!u)return;let h=this.building?.settings.grid??.05;n.x=c.x=Math.round((u[0]+n.offset[0])/h)*h,n.z=c.z=Math.round((u[1]+n.offset[1])/h)*h,n.moved=!0,this.labelsDirty=!0,this.invalidate();return}let r=this.grab,s=r&&this.floorMap.get(r.floorId);if(!r||!s)return;let o=this.floorPoint(s,e,t);if(!o)return;let a=this.building?.settings.grid??.05;r.x=Math.round((o[0]+r.offset[0])/a)*a,r.z=Math.round((o[1]+r.offset[1])/a)*a,r.moved=!0,this.updateGhost(),this.invalidate()}dropFurniture(){if(this.surfaceDragging){this.surfaceDragging=!1,this.surfaceGrab?.end();return}let e=this.deviceGrab;this.deviceGrab=null,e?.moved&&this.options.onDeviceMove?.(e.id,Math.round(e.x*1e3)/1e3,Math.round(e.z*1e3)/1e3);let t=this.grab;this.grab=null,t?.moved&&this.options.onFurnitureMove?.(t.id,Math.round(t.x*1e3)/1e3,Math.round(t.z*1e3)/1e3),this.updateGhost()}updateGhost(){this.ghost&&(this.ghost.geometry.dispose(),this.ghost.material.dispose(),this.scene.remove(this.ghost),this.ghost=null);let e=this.selectedFurniture,t=e?this.floors.find(x=>x.floor.furniture.some(b=>b.id===e)):void 0,n=t?.floor.furniture.find(x=>x.id===e);if(!t||!n)return;let r=this.grab?.id===n.id?this.grab.x:n.x,s=this.grab?.id===n.id?this.grab.z:n.z,o=Bl(t.floor,{...n,x:r,z:s}),a=C0.has(n.type),l=Math.max(.1,n.type==="lamp_pendant"?.3:n.h),c=vt(n.type)||n.type==="lamp_wall"||n.type==="led_strip"?Gt(t.floor,n):a?n.type==="lamp_pendant"||n.type==="ceiling_fan"?o-n.h-.1:o-l:Gt(t.floor,n),u=n.rotation*mt,h=Math.cos(u),f=Math.sin(u),d=(x,b,_)=>[r+x*h-b*f,_,s+x*f+b*h],p=new Wt,g=[[-n.w/2,-n.d/2],[n.w/2,-n.d/2],[n.w/2,n.d/2],[-n.w/2,n.d/2]],m=new W(.25,.9,1);for(let x=0;x<4;x++){let[b,_]=g[x],[y,M]=g[(x+1)%4];p.seg(d(b,_,c+.01),d(y,M,c+.01),m),p.seg(d(b,_,c+l),d(y,M,c+l),m),p.seg(d(b,_,c+.01),d(b,_,c+l),m)}p.seg(d(-n.w/2,n.d/2+.03,c+.02),d(n.w/2,n.d/2+.03,c+.02),new W(1,1,1)),this.ghost=new gn(p.geometry(),new Lt({vertexColors:!0,depthTest:!1,transparent:!0})),this.ghost.position.y=t.floor.elevation+t.y,this.ghost.renderOrder=20,this.scene.add(this.ghost)}onHold(e,t){let n=this.pick(e,t);n&&"entity"in n&&this.options.onDeviceHold?.(n.entity,e,t)}swipeStart(e,t,n,r){if(this.furnish||Math.abs(r)x.floor.rooms.some(b=>b.points.length>=3));if(!n.length)return[];let r=this.lowQuality?1:Math.min(2,window.devicePixelRatio||1),s=Math.round(e*r),o=Math.round(t*r),a=new wn(s,o);a.texture.colorSpace=dt;let l=new zn(-1,1,1,-1,.1,400),c=this.floors.map(x=>({fv:x,visible:x.group.visible,y:x.y,o:x.o,standing:x.mask.standing.value,glass:x.mask.glass.value})),u=this.roof?.group.visible??!1,h=this.ghost?.visible??!1,f=this.renderer.getClearAlpha(),d=new Uint8Array(s*o*4),p=document.createElement("canvas");p.width=s,p.height=o;let g=p.getContext("2d"),m=[];try{this.roof&&(this.roof.group.visible=!1),this.ghost&&(this.ghost.visible=!1),this.renderer.setClearAlpha(0);for(let x of n){for(let O of this.floors)O.group.visible=O===x;x.y=0,x.o=1,this.applyFloor(x),x.group.visible=!0,x.mask.standing.value=0,x.mask.glass.value=0;let b=x.floor.rooms.flatMap(O=>O.points),_=x.floor.elevation,y=new Ct(new U(Math.min(...b.map(O=>O[0]))-.3,_,Math.min(...b.map(O=>O[1]))-.3),new U(Math.max(...b.map(O=>O[0]))+.3,_+Math.min(x.floor.cut_height,x.floor.height),Math.max(...b.map(O=>O[1]))+.3)),M=y.getCenter(new U),S=-.6,v=.8,w=new U(Math.sin(v)*Math.sin(S),Math.cos(v),Math.sin(v)*Math.cos(S));l.position.copy(M).addScaledVector(w,100),l.lookAt(M),l.updateMatrixWorld();let C=.5,A=.5;for(let O of[y.min.x,y.max.x])for(let P of[y.min.y,y.max.y])for(let I of[y.min.z,y.max.z]){let D=new U(O,P,I).applyMatrix4(l.matrixWorldInverse);C=Math.max(C,Math.abs(D.x)),A=Math.max(A,Math.abs(D.y))}let R=s/o;C/A>R?A=C/R:C=A*R,l.left=-C*1.05,l.right=C*1.05,l.top=A*1.05,l.bottom=-A*1.05,l.updateProjectionMatrix(),this.renderer.setRenderTarget(a),this.renderer.clear(),this.renderer.render(this.scene,l),this.renderer.readRenderTargetPixels(a,0,0,s,o,d);let N=g.createImageData(s,o);for(let O=0;O{Math.hypot(u[0]-r.motion.pos[0],u[1]-r.motion.pos[1])o.length?`${o.length}:${o[0].map(a=>a.toFixed(2))}/${o[o.length-1].map(a=>a.toFixed(2))}`:"").join("|"),r=this.robotTrails.get(e.id);if(r&&r.userData.key===n){this.showRobotTrail(e);return}let s=r;if(!s){let o=new $e({color:3590399,transparent:!0,opacity:.34,depthWrite:!1,side:ht});s=new we(Vm([],.16,0),o),s.renderOrder=3,s.name=`robot-trail:${e.id}`,this.robotTrails.set(e.id,s);let a=this.robots.get(e.id)?.group.parent;a&&a.add(s)}s.geometry.dispose(),s.geometry=Vm(t,.16,(e.y??0)+.012),s.userData.key=n,this.showRobotTrail(e)}showRobotTrail(e){let t=this.robotTrails.get(e.id);if(!t)return;let n=this.trailTimers.get(e.id);n!==void 0&&(clearTimeout(n),this.trailTimers.delete(e.id));let r=Date.now(),s=kM(e.settledAt,r);if(t.material.opacity=.34*s,t.visible=(e.track?.length??0)>0&&s>.01,s<=0||s>=1&&e.settledAt==null)return;let o=s>=1?Math.max(0,(e.settledAt??r)+Yh-r):250;this.trailTimers.set(e.id,setTimeout(()=>{this.showRobotTrail(e),this.invalidate()},o))}makeRobot(e){if(!this.robotGeo){let s=new ut,o=(l,c,u,h,f)=>{let d=[];for(let p=0;p<20;p++)d.push([Math.cos(p/20*Math.PI*2)*l,Math.sin(p/20*Math.PI*2)*l]);Tt(s,d,c,u,h,f,{aoFrom:0,bottom:!1})};o(.17,.012,.08,2371657,3424863),o(.055,.08,.1,3820138,5070726),this.robotGeo=s.geometry(),this.robotMat=new $e({vertexColors:!0});let a=new ut;Tt(a,[[-.05,.1],[.05,.1],[.05,.14],[-.05,.14]],.08,.085,16777215,16777215,{aoFrom:0,bottom:!1}),this.robotLedGeo=a.geometry()}let t=new rt,n=new $e({color:t1[e.mode]}),r=e.mower?this.mowerMat??=new $e({color:4164170}):this.robotMat;return t.add(new we(this.robotGeo,r),new we(this.robotLedGeo,n)),e.mower&&t.scale.set(1.7,1.6,1.7),{info:e,motion:{pos:[...e.rest],heading:e.restHeading,path:[],next:0},group:t,led:n}}buildPets(){let e=new Map(this.pets);this.pets.clear(),this.petMat??=new $e({vertexColors:!0});for(let t of this.floors)for(let n of t.floor.furniture){let r=vt(n.type);if(!r?.pet)continue;let s=t.floor.rooms.find(f=>f.points.length>=3&&Ge([n.x,n.z],f.points)),o=e.get(n.id),a=new ut;Ss(new Fi(a,new Wt,ws({x:0,z:0,rotation:0,mirror:n.mirror})),r,Math.max(.05,n.w),Math.max(.05,n.d),Math.max(.05,n.h),0,null,null,n.variant??null),o?.group.removeFromParent();let l=new rt;l.add(new we(a.geometry(),this.petMat));let c=s?t.floor.furniture.filter(f=>f.id!==n.id&&!vt(f.type)?.pet&&f.type!=="rug"&&Gt(t.floor,f)<.5&&Ge([f.x,f.z],s.points)).map(f=>ts(f)):[],u={points:s?.points??[[n.x-.5,n.z-.5],[n.x+.5,n.z-.5],[n.x+.5,n.z+.5],[n.x-.5,n.z+.5]],obstacles:c,speed:n.type.endsWith(":pet_dog")?.7:.45},h=o&&s&&Ge(o.motion.pos,s.points)?o.motion:{pos:[n.x,n.z],heading:n.rotation*Math.PI/180,target:null,rest:1};this.pets.set(n.id,{motion:h,room:u,random:Tb(n.id),group:l,floorId:t.floor.id})}for(let[t,n]of e)this.pets.has(t)||n.group.removeFromParent()}setPetRooms(e){for(let[t,n]of this.pets){let r=this.floorMap.get(n.floorId),s=e.get(t);if(!r||s===void 0)continue;let o=s?r.floor.rooms.find(l=>l.id===s&&l.points.length>=3):void 0;if(!o||n.room.points===o.points)continue;let a=r.floor.furniture.filter(l=>!vt(l.type)?.pet&&l.type!=="rug"&&Gt(r.floor,l)<.5&&Ge([l.x,l.z],o.points)).map(l=>ts(l));n.room={...n.room,points:o.points,obstacles:a},Ge(n.motion.pos,o.points)||(n.motion={...n.motion,pos:ks(o.points),target:null,rest:.5})}this.invalidate()}stepRobots(e){if(!this.robots.size&&!this.pets.size)return!1;let t=this.robotLast?Math.min(.2,(e-this.robotLast)/1e3):0;this.robotLast=e;let n=!1,r=1/0,s=this.petLast?(e-this.petLast)/1e3:0;this.petLast=e;for(let o of this.pets.values()){let a=this.floorMap.get(o.floorId);if(!a)continue;o.group.parent!==a.group&&a.group.add(o.group),Ab(o.motion,o.room,s,o.random)||!!o.motion.target?n=!0:r=Math.min(r,Math.max(0,o.motion.rest)),o.group.position.set(o.motion.pos[0],0,o.motion.pos[1]),o.group.rotation.y=o.motion.heading}clearTimeout(this.petTimer),!n&&Number.isFinite(r)&&(this.petTimer=setTimeout(()=>this.invalidate(),r*1e3+50));for(let o of this.robots.values()){let a=this.floorMap.get(o.info.floorId);if(!a)continue;o.group.parent!==a.group&&a.group.add(o.group);let l=this.robotTrails.get(o.info.id);l&&l.parent!==a.group&&a.group.add(l),t>0?n=BM(o.motion,o.info,t)||n:n||=o.info.mode==="cleaning"||o.info.mode==="returning",o.group.position.set(o.motion.pos[0],o.info.y??0,o.motion.pos[1]),o.group.rotation.y=o.motion.heading}return n||(this.robotLast=0),n}getView(){return{...this.controls.view,target:this.controls.view.target.clone()}}showView(e,t=900){let n=e.target??{x:0,y:0,z:0};this.controls.maxRadius=Math.max(this.controls.maxRadius,e.radius*1.5),this.controls.flyTo({target:new U(n.x,n.y,n.z),radius:e.radius,phi:e.phi,theta:e.theta},t)}flyTo(e,t=900){this.controls.flyTo(e,t)}focus(e,t,n,r,s){let o=this.floorMap.get(e);if(o){if(this.controls.flyTo({target:new U(t,o.floor.elevation+o.ty+r,n),radius:5.5,phi:.78},900),s){this.flashes.set(s,performance.now()+2400);let a=this.host.querySelector(`.nf-dev[data-entity="${CSS.escape(s)}"]`);a?.classList.add("nf-dev-found"),setTimeout(()=>a?.classList.remove("nf-dev-found"),2600)}this.invalidate()}}render(e){if(this.frame=0,this.disposed)return;let t=this.lastFrame?Math.min(100,e-this.lastFrame):16,n=!1;this.orbitSpeed&&!this.controls.active?(this.orbitLast&&(this.controls.view.theta+=this.orbitSpeed*Math.min(100,e-this.orbitLast)/1e3),this.orbitLast=e,n=!0):this.orbitLast=0;let r=this.controls.update(e),s=this.stepFloors(t),a=[this.stepOpenings(t),this.stepFridges(t),this.stepCovers(t)].some(Boolean),l=!1;if(this.flashes.size){let m=new Set;for(let[x,b]of this.flashes){let _=this.deviceFloor.get(x);_&&m.add(_),b<=e&&this.flashes.delete(x)}l=this.flashes.size>0;for(let x of this.floors)m.has(x.floor.id)&&this.buildLamps(x)}let c=this.placeRoof(t),u=this.stepRobots(e);this.pictureLayer.step();let f=[this.weatherLayer,this.energyLayer,this.soundLayer,this.screenLayer,this.waterLayer,this.hydronicLayer].map(m=>m.step(e)).some(Boolean),d=r||s||a||l||c,p=[];if(r&&p.push("camera"),s&&p.push("floors"),a&&p.push("openings"),l&&p.push("flash"),c&&p.push("roof"),this.effectTick&&p.push("effect"),u&&p.push("robot"),n&&p.push("orbit"),this.tintTick&&p.push("tint"),this.effectTick=this.tintTick=!1,this.lastFrame=d?e:0,d&&this.governor){let m=this.governor.frame(t,e);m&&"ratio"in m?(this.renderer.setPixelRatio(m.ratio),this.resize()):m&&setTimeout(()=>this.dropToLow(),0)}this.updateWalls(),this.renderer.render(this.scene,this.camera),this.placeLhAnchors(),(this.viewChanged()||s||this.labelsDirty)&&(this.labelsDirty=!1,this.updateLabels()),this.reportStats(e,p),d&&this.invalidate(),this.scheduleEffects(),!d&&n&&!this.orbitTimer&&(this.orbitTimer=setTimeout(()=>{this.orbitTimer=void 0,this.invalidate()},this.lowQuality?66:33));let g=this.resting;!d&&f&&!this.weatherTimer&&!g&&(this.weatherTimer=setTimeout(()=>{this.weatherTimer=void 0,this.invalidate()},33)),!d&&u&&!this.robotTimer&&!g&&(this.robotTimer=setTimeout(()=>{this.robotTimer=void 0,this.invalidate()},this.lowQuality?66:33))}updateWalls(){if(this.controls.walk){for(let o of this.floors)o.mask.standing.value=65535,o.mask.glass.value=0,o.mask.slope?.value.set(0,0,0,0);return}let e=this.camera.position,t=this.controls.view.target,n=e.x-t.x,r=e.z-t.z,s=Math.hypot(n,r)||1;for(let o of this.floors){let a=this.roomId!==null&&o.floor.rooms.some(h=>h.id===this.roomId),l=this.wallMode==="cut",c=0,u=0;o.geo.buckets.forEach((h,f)=>{let d=h?h[0]*n/s+h[1]*r/s>=.25:a;this.wallMode!=="auto"||!d||(this.painted?a&&(u|=1<.5&&r)){this.labelPlacer.place(n.label,null);continue}let s=n.floor.elevation+n.y+n.floor.cut_height*.5,o=[r.x0,r.x1].flatMap(l=>[r.z0,r.z1].map(c=>this.screenPoint([l,s,c],1/0)));n.label.hidden&&(n.label.hidden=!1),n.labelSize??={w:n.label.offsetWidth,h:n.label.offsetHeight};let a=Kb(o,n.labelSize.w,{width:this.size.w,inset:this.labelInset});t.push({fv:n,rank:n.rank,left:a.left,y:a.y,height:n.labelSize.h})}for(let n of $b(t))this.labelPlacer.place(n.fv.label,qb(n.left,n.y));this.updateDevicePins();for(let n of this.floors){let r=n.to<.99||n.o<.9||e||this.roomId!==null||this.otherFloor(n),s=n.floor.elevation+n.y+.05;for(let a of n.roomPins){let l=r?null:this.screenPoint([a.cx,s,a.cz],1.1);this.labelPlacer.place(a.pin,l&&!l.off?pl(l):null)}let o=e||n.o<.9||this.otherFloor(n);for(let{pin:a,note:l}of n.notePins){let c=o?null:this.screenPoint([l.x,n.floor.elevation+n.y+(l.y??M0),l.z]);this.labelPlacer.place(a,c&&!c.off?pl(c):null)}}}otherFloor(e){return this.floorId!==null&&e.floor.id!==this.floorId}updateDevicePins(){let e=this.houseView;for(let t of this.persons){let n=this.personPins.get(t.id),r=this.floorMap.get(t.floorId);if(!n)continue;let s=r&&!e&&ap(r,this.otherFloor(r))?this.screenPoint([t.x,r.floor.elevation+r.y+.9,t.z]):null;this.labelPlacer.place(n,s&&!s.off?pl(s):null)}for(let t of this.devices){let n=this.devicePins.get(t.id)?.el;if(!n)continue;let r=this.floorMap.get(t.floorId),s=t.id.startsWith("detect:"),o=!!t.full&&t.roomId===null,a=!!r&&(o?Zb(r):(!e||s)&&ap(r,this.otherFloor(r))),c=!!r&&a&&t.pin!==!1?this.screenPoint([t.x,r.floor.elevation+r.y+t.y,t.z]):null;if(!c||c.off){this.labelPlacer.place(n,null);continue}let u=this.roomId===null?t.full?"full":"":t.roomId===this.roomId?"full":"dim";this.pinMode.get(n)!==u&&(this.pinMode.set(n,u),n.classList.toggle("nf-dev-full",u==="full"),n.classList.toggle("nf-dev-dim",u==="dim")),this.labelPlacer.place(n,pl(c))}}reportStats(e,t){if(!this.statsOn||!this.options.onStats)return;let n=t.length>0;this.fpsStart||(this.fpsStart=e),this.lastStatsFrame&&n&&(this.worstFrame=Math.max(this.worstFrame,e-this.lastStatsFrame)),this.lastStatsFrame=n?e:0,this.fpsFrames++;let r=e-this.fpsStart;if(r>500||!n){let s=this.renderer.info.render;this.options.onStats({fps:n?Math.round(this.fpsFrames*1e3/r):0,busy:t,worstMs:Math.round(this.worstFrame),calls:s.calls,triangles:s.triangles,low:this.lowQuality,pixelRatio:this.renderer.getPixelRatio()}),this.fpsFrames=0,this.fpsStart=e,this.worstFrame=0}}};function WP(){let e=document.createElement("canvas");e.width=256*3,e.height=256*2;let t=e.getContext("2d"),n=(o,a,l,c,u)=>{t.strokeStyle=`rgba(55,224,255,${u})`,t.beginPath(),t.moveTo(o,a),t.lineTo(l,c),t.stroke()};t.lineWidth=1.5;let r=(o,a,l)=>{t.save(),t.beginPath(),t.rect(o*256,a*256,256,256),t.clip(),l(o*256,a*256),t.restore()};r(0,0,(o,a)=>{for(let l=0;l<5;l++){let c=a+l*256/5+.75;n(o,c,o+256,c,.09);let u=o+l*.37%1*256;n(u,c,u,c+256/5,.07)}}),r(1,0,(o,a)=>{for(let l=0;l<7;l++){let c=o+l*256/7+.75;n(c,a,c,a+256,.08);let u=a+l*.53%1*256;n(c,u,c+256/7,u,.06)}}),r(2,0,(o,a)=>{for(let l=0;l<4;l++){let c=l*256/4+.75;n(o+c,a,o+c,a+256,.1),n(o,a+c,o+256,a+c,.1)}}),r(1,1,(o,a)=>{for(let l=0;l<2;l++){let c=a+l*256/2+.75;n(o,c,o+256,c,.09);let u=l?256/4:0;for(let h of[u,u+256/2])n(o+h+.75,c,o+h+.75,c+256/2,.09)}}),r(2,1,(o,a)=>{n(o+.75,a,o+.75,a+256,.08),n(o,a+.75,o+256,a+.75,.08),t.fillStyle="rgba(55,224,255,0.05)";for(let l=0;l<90;l++)t.fillRect(o+l*97%256,a+(l*61+l*l%37)%256,2,2)});let s=new zt(e);return s.flipY=!1,s.wrapS=ln,s.wrapT=ln,s.anisotropy=4,s.colorSpace=dt,s}function XP(){let i=document.createElement("canvas");i.width=8,i.height=32;let e=i.getContext("2d");e.fillStyle="#1a2742",e.fillRect(0,0,8,32),e.fillStyle="#223556",e.fillRect(0,4,8,14),e.fillStyle="rgba(55,224,255,0.45)",e.fillRect(0,29,8,2);let t=new zt(i);return t.wrapS=kn,t.wrapT=kn,t.colorSpace=dt,t}function YP(i,e){let t=i.rooms.map((r,s)=>s),n=r=>t[r]===r?r:t[r]=n(t[r]);for(let[r,s]of e){let o=i.rooms.findIndex(u=>u.id===r),a=i.rooms.findIndex(u=>u.id===s);if(o<0||a<0)continue;let l=n(o),c=n(a);l!==c&&(t[Math.max(l,c)]=Math.min(l,c))}return t.map((r,s)=>n(s))}function qP(){let e=document.createElement("canvas");e.width=64,e.height=64;let t=e.getContext("2d"),n=t.createRadialGradient(64/2,64/2,0,64/2,64/2,64/2);n.addColorStop(0,"rgba(255,255,255,0.9)"),n.addColorStop(.2,"rgba(255,255,255,0.45)"),n.addColorStop(.55,"rgba(255,255,255,0.1)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,64,64);let r=new zt(e);return r.colorSpace=dt,r}function $P(){let e=c0,t=document.createElement("canvas");t.width=1024,t.height=1024;let n=t.getContext("2d");n.strokeStyle="rgba(91,124,255,0.16)",n.lineWidth=1;for(let o=0;o<=e;o++){let a=Math.round(o/e*1024)+.5;n.beginPath(),n.moveTo(a,0),n.lineTo(a,1024),n.moveTo(0,a),n.lineTo(1024,a),n.stroke()}n.globalCompositeOperation="destination-in";let r=n.createRadialGradient(1024/2,1024/2,1024*.12,1024/2,1024/2,1024/2);r.addColorStop(0,"rgba(0,0,0,1)"),r.addColorStop(1,"rgba(0,0,0,0)"),n.fillStyle=r,n.fillRect(0,0,1024,1024);let s=new zt(t);return s.anisotropy=4,s.colorSpace=dt,s}function tV(i,e){return new u0(i,e)}function a0(i,e,t,n){let[r,s,o]=e.size??Rs[e.lamp],a=e.base??0,l=(e.rotation??0)*mt,c=Math.cos(l),u=Math.sin(l),h=(g,m)=>[e.x+g*c-m*u,e.z+g*u+m*c],f=(g,m,x,b,_,y=14)=>{let M=[];for(let S=0;STt(i,[h(g,x),h(m,x),h(m,b),h(g,b)],_,y,M,S,{aoFrom:0,bottom:!0}),p=Math.max(.05,Math.min(r,s)/2);switch(e.lamp){case"ceiling":f(p*.25,t-.04,t,Ze,Ze,8),f(p,t-Math.max(.04,o)-.035,t-.04,n,n);break;case"pendant":{let g=Math.max(.4,t-o);f(.06,t-.02,t,Ze,Ze,8);let m=e.variant==="globe"?g+2*p:e.variant==="drum"?g+.24:g+.2;if(f(.008,m,t-.02,Ze,Ze,5),e.variant==="globe")for(let b=0;b<7;b++){let _=Math.PI*(b/7),y=Math.PI*((b+1)/7);f(p*Math.max(.2,Math.sin((_+y)/2)),g+p-p*Math.cos(_),g+p-p*Math.cos(y),n,n,14)}else if(e.variant==="cone")for(let b=0;b<4;b++)f(p*(.25+.75*(4-b)/4),g+.06*b,g+.06*(b+1),n,n,16);else e.variant==="drum"?f(p,g,g+.24,n,n,18):(f(p*.35,g+.14,g+.2,n,n,12),f(p,g,g+.14,n,n,16));break}case"fan":{let g=Math.max(.05,t-Math.max(.22,o)),m=g+.16;f(.07,t-.05,t,Ze,Ze,10),m[e.x+w*M-C*S,e.z+w*S+C*M];Tt(i,[v(.1,-.035),v(x,-.075),v(x,.075),v(.1,.035)],b,b+.012,n1,n1,{aoFrom:0,bottom:!0})}break}case"downlight":f(p,t-.012,t,Ze,Ze,12),f(p*.7,t-.02,t-.012,n,n,12);break;case"spot":f(p*.6,t-.02,t,Ze,Ze,10),f(p,t-Math.max(.06,o),t-.02,Ze,Ze,12),f(p*.8,t-Math.max(.06,o)-.008,t-Math.max(.06,o),n,n,12);break;case"panel":d(-r/2,r/2,-s/2,s/2,t-Math.max(.015,o),t,Ze,Ze),d(-r/2+.02,r/2-.02,-s/2+.02,s/2-.02,t-Math.max(.015,o)-.004,t-Math.max(.015,o),n);break;case"uplight":f(Math.max(.1,p*.6),a,a+.03,Ze,Ze),f(.014,a+.03,a+o-.12,Ze,Ze,6),f(p,a+o-.14,a+o-.02,Ze,Ze),f(p*.92,a+o-.02,a+o,n,n);break;case"bollard":f(p,a,a+o-.14,Ze,Ze,10),f(p*.9,a+o-.14,a+o-.03,n,n,10),f(p*1.1,a+o-.03,a+o,Ze,Ze,10);break;case"garden":f(.012,a,a+o-.08,Ze,Ze,5),f(p,a+o-.08,a+o-.01,Ze,Ze,10),f(p*.8,a+o-.01,a+o,n,n,10);break;case"floor":f(Math.max(.1,p*.7),a,a+.03,Ze,Ze),f(.014,a+.03,a+o-.28,Ze,Ze,6),f(p,a+o-.3,a+o,n,n);break;case"table":f(Math.max(.05,p*.55),a,a+.03,Ze,Ze),f(.012,a+.03,a+o-.16,Ze,Ze,6),f(p,a+o-.18,a+o,n,n);break;case"wall":{let g=e.base??Ul;d(-r/2+.03,r/2-.03,-s/2,-s/2+.02,g,g+o,Ze),d(-r/2,r/2,-s/2+.02,s/2,g+o*.15,g+o*.85,n);break}case"strip":{let g=Math.max(.02,o),m=e.base!=null?e.base+g:t-.04,x=e.upright?0:(e.rise??0)*mt;if(!e.roll&&!e.upright&&!x){d(-r/2,r/2,-s/2,s/2,m-g,m,n);break}let b=(e.roll??0)*mt,_=Math.cos(b),y=Math.sin(b),[M,S]=[Math.cos(x),Math.sin(x)],v=e.upright?a+r/2:m-g/2+Lo(e.base,r,e.rise),w=(O,P,I)=>{let D=O,F=P*_-I*y,H=P*y+I*_;return e.upright?[D,F]=[-F,D]:x&&([D,F]=[D*M-F*S,D*S+F*M]),[e.x+D*c-H*u,v+F,e.z+D*u+H*c]},C=[w(-r/2,-g/2,-s/2),w(r/2,-g/2,-s/2),w(r/2,-g/2,s/2),w(-r/2,-g/2,s/2),w(-r/2,g/2,-s/2),w(r/2,g/2,-s/2),w(r/2,g/2,s/2),w(-r/2,g/2,s/2)],A=new W(n),R=[e.x,v,e.z],N=(O,P,I,D)=>{let[F,H,B]=[C[O],C[P],C[I]],X=[(H[1]-F[1])*(B[2]-F[2])-(H[2]-F[2])*(B[1]-F[1]),(H[2]-F[2])*(B[0]-F[0])-(H[0]-F[0])*(B[2]-F[2]),(H[0]-F[0])*(B[1]-F[1])-(H[1]-F[1])*(B[0]-F[0])],V=[F[0]-R[0],F[1]-R[1],F[2]-R[2]],re=X[0]*V[0]+X[1]*V[1]+X[2]*V[2]<0,[be,Y,Q,se]=re?[C[D],C[I],C[P],C[O]]:[C[O],C[P],C[I],C[D]];i.tri(be,Y,Q,A,A,A),i.tri(be,Q,se,A,A,A)};N(0,1,2,3),N(4,5,6,7),N(0,1,5,4),N(1,2,6,5),N(2,3,7,6),N(3,0,4,7);break}}}export{ki as ModelError,u0 as NextFloorViewer,tV as createViewer,kP as furniturePreview,NP as inspectModel,Eb as isLowEnd,OP as prepareModel,DP as previewModel,a0 as pushLampModel}; + #endif`;function $R(i){let e=new Ye({map:i,transparent:!0,blending:Ft,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2});return e.onBeforeCompile=t=>{t.vertexShader=t.vertexShader.replace("#include ",XR).replace("#include ",YR),t.fragmentShader=t.fragmentShader.replace("#include ",`#include +varying vec2 vNfTile;`).replace("#include ",qR)},e.customProgramCacheKey=()=>"nf-pattern",e}var nh=(i={})=>new Ye({vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1,...i});function $b({mask:i,look:e,theme:t,textures:n}){let r=(o={})=>new Ye({vertexColors:!0,...o}),s=(o,a)=>Xb(o,i,a);return{floor:Jn(r(),e),pattern:$R(n.pattern),wall:Jn(s(r(),"solid"),e),glassWall:s(r({transparent:!0,depthWrite:!1}),"glass"),shadow:r({blending:Xa,premultipliedAlpha:!0,transparent:!0,depthWrite:!1,side:ht,polygonOffset:!0,polygonOffsetFactor:-1}),lines:Jn(s(new Lt({vertexColors:!0,transparent:!0,blending:Ml(t),depthWrite:!1})),e,!0),glow:s(nh({side:ht,polygonOffset:!0,polygonOffsetFactor:-3}),"solid"),frames:Jn(s(r({side:ht})),e),glass:s(nh({side:ht})),blinds:Jn(s(r({map:n.blinds,side:ht})),e),lamps:Jn(r(),e),halos:new cn({map:n.halo,size:.9,sizeAttenuation:!0,vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1}),cones:nh({side:ht}),screens:nh({side:ht}),ghosts:[]}}var ih=i=>Object.assign(document.createElement("span"),{className:i});function Kb(i,e){let t=Object.assign(document.createElement("button"),{className:"nf-dev"});t.dataset.entity=i,t.append(ih("nf-dev-icon"),ih("nf-dev-text"),ih("nf-dev-watt"),ih("nf-dev-name"));let n,r=!1,s=a=>{let{x:l,y:c}=e.centre(t);a(i,l,c)},o=()=>clearTimeout(n);t.addEventListener("pointerdown",a=>{if(e.furnishing())return e.pressedWhileFurnishing(i);a.stopPropagation(),r=!1,o(),n=setTimeout(()=>{r=!0,s(e.hold)},500)});for(let a of["pointerleave","pointercancel","pointerup"])t.addEventListener(a,o);return t.addEventListener("contextmenu",a=>a.preventDefault()),t.addEventListener("click",a=>{if(a.stopPropagation(),e.furnishing())return e.selectWhileFurnishing(i);r||s(e.tap)}),t.addEventListener("keydown",a=>{(a.key==="Enter"&&a.shiftKey||a.key==="ContextMenu")&&(a.preventDefault(),s(e.hold))}),t}function Zb(i,e=10,t="NextFloor"){let n=[];for(let{positions:o,lift:a}of i)for(let l=0;l+8[o[l+x]*e,-o[l+x+2]*e,(o[l+x+1]+a)*e]),[u,h,f]=c,d=[(h[1]-u[1])*(f[2]-u[2])-(h[2]-u[2])*(f[1]-u[1]),(h[2]-u[2])*(f[0]-u[0])-(h[0]-u[0])*(f[2]-u[2]),(h[0]-u[0])*(f[1]-u[1])-(h[1]-u[1])*(f[0]-u[0])],p=Math.hypot(d[0],d[1],d[2]);p<1e-9||n.push([d[0]/p,d[1]/p,d[2]/p,...u,...h,...f])}let r=new Uint8Array(84+n.length*50),s=new DataView(r.buffer);return r.set(new TextEncoder().encode(`${t} STL`.slice(0,79)),0),s.setUint32(80,n.length,!0),n.forEach((o,a)=>{let l=84+a*50;o.forEach((c,u)=>s.setFloat32(l+u*4,c,!0))}),r}var Ps=Math.PI/180;function Jb(i,e,t){let n=i.getTime()/864e5-10957.5,r=(357.529+.98560028*n)*Ps,o=(280.459+.98564736*n+1.915*Math.sin(r)+.02*Math.sin(2*r))*Ps,a=(23.439-36e-8*n)*Ps,l=Math.atan2(Math.cos(a)*Math.sin(o),Math.cos(o)),c=Math.asin(Math.sin(a)*Math.sin(o)),h=(((18.697374558+24.06570982441908*n)%24+24)%24*15+t)*Ps-l,f=e*Ps,d=Math.asin(Math.sin(f)*Math.sin(c)+Math.cos(f)*Math.cos(c)*Math.cos(h)),p=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(f)-Math.tan(c)*Math.cos(f))/Ps+180;return{elevation:d/Ps,azimuth:(p%360+360)%360}}function Lp(i,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(i)).map(n=>[n.type,Number(n.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function jb(i,e,t=new Date){let[n,r]=[Math.floor(i),Math.round(i%1*60)];if(e)try{let o=new Date(Lp(t.getTime(),e)),a=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),n,r),l=a-(Lp(a,e)-a);return l=a-(Lp(l,e)-l),new Date(l)}catch{}let s=new Date(t);return s.setHours(n,r,0,0),s}function KR(i,e=new Date){let t=[];for(let n=0;n<=24;n+=.25){let r=Jb(jb(Math.min(n,23.99),i.zone,e),i.latitude,i.longitude);r.elevation<0||t.push(Qb(i,r))}return t}function Qb(i,e){let[t,n]=Do(e.azimuth,i.north),r=Math.max(0,e.elevation)*Math.PI/180;return[i.centre[0]+t*i.radius*Math.cos(r),Math.sin(r)*i.radius*.9,i.centre[1]+n*i.radius*Math.cos(r)]}function ZR(i,e){let t=document.createElement("canvas");t.width=t.height=64;let n=t.getContext("2d");n&&(n.font="bold 44px system-ui, sans-serif",n.fillStyle=e,n.textAlign="center",n.textBaseline="middle",n.fillText(i,32,34));let r=new Qi(new _i({map:new zt(t),transparent:!0,depthWrite:!1,depthTest:!1}));return r.renderOrder=20,r}var rh=class{group=new et;key="";constructor(){this.group.visible=!1,this.group.renderOrder=15}update(e,t,n){let r=e?`${e.centre},${e.radius.toFixed(1)},${e.north},${e.latitude.toFixed(2)},${e.longitude.toFixed(2)},${new Date().toDateString()},${n},${t?`${t.elevation.toFixed(0)},${t.azimuth.toFixed(0)}`:"-"}`:"off";if(r===this.key)return;if(this.key=r,this.clear(),!e){this.group.visible=!1;return}this.group.visible=!0;let s=n+.05,o=[];for(let h=0;h<=96;h++){let f=h/96*Math.PI*2;o.push(e.centre[0]+Math.cos(f)*e.radius,s,e.centre[1]+Math.sin(f)*e.radius)}let a=new Pe;a.setAttribute("position",new Le(o,3)),this.group.add(new Pn(a,new Lt({color:7311304,transparent:!0,opacity:.55,depthWrite:!1})));let l=[];[["N",0],["E",90],["S",180],["W",270]].forEach(([h,f])=>{let[d,p]=Do(f,e.north);l.push(e.centre[0]+d*e.radius*.94,s,e.centre[1]+p*e.radius*.94,e.centre[0]+d*e.radius*1.04,s,e.centre[1]+p*e.radius*1.04);let x=ZR(h,h==="N"?"#ff6b6b":"#9fb4d8");x.position.set(e.centre[0]+d*e.radius*1.12,s+.4,e.centre[1]+p*e.radius*1.12),x.scale.setScalar(Math.max(1.2,e.radius*.12)),this.group.add(x)});let c=new Pe;c.setAttribute("position",new Le(l,3)),this.group.add(new gn(c,new Lt({color:10466520,transparent:!0,opacity:.8,depthWrite:!1})));let u=KR(e).map(([h,f,d])=>[h,n+f,d]);if(u.length>1){let h=new Pe;h.setAttribute("position",new Le(u.flat(),3)),this.group.add(new Pn(h,new Lt({color:16761415,transparent:!0,opacity:.85,depthWrite:!1})))}if(t&&t.elevation>0){let[h,f,d]=Qb(e,t),p=new Se(new nr(Math.max(.35,e.radius*.035),12,8),new Ye({color:16765530}));p.position.set(h,n+f,d),this.group.add(p)}}clear(){for(let e of[...this.group.children]){this.group.remove(e);let t=e;t.geometry?.dispose();let n=t.material;n?.map?.dispose(),n?.dispose()}}dispose(){this.clear()}};var JR=["straight","quarter","l","half","u","spiral"],jR=["solid","stringer","mono","cantilever"],QR=["none","left","right","both"],eC=["headroom","full","none"],sh={shape:"straight",turn:"right",build:"solid",risers:!0,steps:null,run_width:null,down:!1,rail:"none",opening:"headroom",landing_after:null};var rv=2,sv=40,tC=2.2,oh=(i,e)=>typeof e=="string"&&i.includes(e);function Fp(i){let e=i.stair??{},t=typeof e.steps=="number"&&Number.isFinite(e.steps)?Math.round(Math.min(sv,Math.max(rv,e.steps))):null,n=typeof e.run_width=="number"&&Number.isFinite(e.run_width)&&e.run_width>.2?e.run_width:null;return{shape:oh(JR,e.shape)?e.shape:sh.shape,turn:e.turn==="left"?"left":"right",build:oh(jR,e.build)?e.build:sh.build,risers:e.risers!==!1,steps:t,run_width:n,down:e.down===!0,rail:oh(QR,e.rail)?e.rail:sh.rail,opening:oh(eC,e.opening)?e.opening:sh.opening,landing_after:typeof e.landing_after=="number"&&Number.isFinite(e.landing_after)?Math.max(1,Math.round(e.landing_after)):null}}var lh=i=>i.type==="stairs"&&!!i.stair,wl=(i,e,t)=>[i[0]+(e[0]-i[0])*t,i[1]+(e[1]-i[1])*t],ev=(i,e)=>Math.abs(i[0]-e[0])<1e-6&&Math.abs(i[1]-e[1])<1e-6;function ov(i){let e=[];for(let t of i)(!e.length||!ev(e[e.length-1],t))&&e.push(t);for(;e.length>1&&ev(e[0],e[e.length-1]);)e.pop();return e}function Tl(i,e,t=!1){return{poly:ov([...i,...[...e].reverse()]),landing:t,left:i,right:e}}function Sl(i,e,t,n,r){let s=[];for(let o=0;oe+1e-6&&ri.reduce((e,t,n)=>n?e+Math.hypot(t[0]-i[n-1][0],t[1]-i[n-1][1]):e,0);function nv(i,e,t,n,r){let s=iC(i),o=[];for(let a=0;a=8?3:2),[f,d]=i.shape==="l"?iv(i,n)??ah(n-h,t-l,e-l):ah(n-h,t-l,e-l),p=Sl([r,a],[r+l,a],[r,o+l],c,f),x=i.shape==="l"?[Tl(u,[c],!0)]:nv(u,c,c,c,h),g=Sl([r+l,o],c,[s,o],[s,o+l],d);return{treads:[...p,...x,...g],flight:l,column:0}}case"half":case"u":{let l=Math.min(i.run_width??Math.min(1.1,(e-.1)/2),(e-.02)/2),c=o+l,u=[[r,c],[r,o],[s,o],[s,c]],[h,f]=[[r+l,c],[s-l,c]],d=i.shape==="u"?1:Math.min(n,n>=12?6:n>=8?4:2),[p,x]=i.shape==="u"?iv(i,n)??ah(n-d,t-l,t-l):ah(n-d,t-l,t-l),g=Sl([r,a],[r+l,a],[r,c],h,p),m=i.shape==="u"?[Tl(u,[h,f],!0)]:nv(u,h,[0,c],f,d),y=Sl([s,c],f,[s,a],[s-l,a],x);return{treads:[...g,...m,...y],flight:l,column:0}}case"spiral":{let l=Math.min(e,t)/2,c=Math.min(.08,l*.12),u=Math.min(.75,Math.max(.3,.22/(l*.6))),h=(d,p)=>[Math.cos(p)*d,Math.sin(p)*d],f=[];for(let d=0;dh(l,p+(x-p)*m));f.push(Tl(g,[h(c,p),h(c,x)]))}return{treads:f,flight:l-c,column:c}}default:return{treads:Sl([r,a],[s,a],[r,o],[s,o],n),flight:e,column:0}}}var sC=(i,e)=>i.steps??Math.min(sv,Math.max(rv,Math.round(Math.abs(e)/.18)));function Np(i,e,t,n){let r=sC(i,n),s=Math.abs(n)/r,o=rC(i,Math.max(.3,e),Math.max(.3,t),r),a=c=>[-c[0],c[1]];return{treads:o.treads.map((c,u)=>{let h=i.down?-s*(u+1):s*(u+1);return i.turn==="right"?{...c,top:h}:{poly:c.poly.map(a).reverse(),top:h,landing:c.landing,left:c.right.map(a),right:c.left.map(a)}}),rise:s,steps:r,column:o.column,flight:o.flight}}function av(i){let e=i.poly.reduce((t,n)=>[t[0]+n[0],t[1]+n[1]],[0,0]);return[e[0]/i.poly.length,e[1]/i.poly.length]}function oC(i,e,t,n="headroom"){if(n==="none")return[];let r=t?0:Math.abs(e),s=n==="full"?i.treads:i.treads.filter((o,a)=>o.top>r-tC||!t&&a===i.treads.length-1||t&&a===0);return pr(s.map(o=>o.poly).filter(o=>o.length>=3))}function Op(i){let e=Fp(i),t=oC(Np(e,i.w,i.d,i.h),i.h,e.down,e.opening),n=i.rotation*Math.PI/180,[r,s]=[Math.cos(n),Math.sin(n)],o=i.mirror?-1:1;return t.map(a=>a.map(([l,c])=>[i.x+o*l*r-c*s,i.z+o*l*s+c*r]))}function Di(i,e,t,n,r,s,o=Fe.metal,a=!1){let[l,c]=[e/2-s-r,t/2-s-r],u=He(o);for(let h of[-1,1])for(let f of[-1,1]){let[d,p]=[h*l,f*c];a?i.loft([d-r*.3,d+r*.3,p-r*.3,p+r*.3],[d-r/2,d+r/2,p-r/2,p+r/2],0,n,u):i.block({x:[d-r/2,d+r/2],y:[0,n],z:[p-r/2,p+r/2]},u)}}function Is(i,e,t,n,r,s,o,a=null,l=!1){let c=(t-e)/o;for(let u=1;u1?h+(u%2?-c/2+.06:c/2-.06):h+c/2-.06;i.seg(d,f-.08,s+.012,d,f+.08,s+.012,Ze)}}}function di(i,e,t,n,r,s=null,o=!1,a=q.body){i.block({x:[-e/2,e/2],y:[.02,n],z:[-t/2,t/2-.02]},a,ue),i.block({x:[-e/2+.02,e/2-.02],y:[0,.08],z:[-t/2+.02,t/2-.06]},He(Fe.dark)),Is(i,-e/2,e/2,.08,n,t/2-.02,r,s,o)}function Dp(i,e,t,n,r){let[s,o,a,l]=[-e/2,e/2,-t/2,t/2],c=Math.min(.2,e*.12),u=n*.5,h=Math.min(.24,t*.28);Di(i,e,t,.07,.05,.05,Fe.wood,!0),i.pad({x:[s,o],y:[.07,u-.08],z:[a+.02,l]},q.fabric,.04,ue),i.loft([s,o,a,a+h],[s+.01,o-.01,a,a+h*.5],u-.08,n,q.fabric,ue);for(let[d,p]of[[s,s+c],[o-c,o]])i.pad({x:[d,p],y:[u-.08,n*.72],z:[a+.02,l-.02]},q.fabric,.04,ue);let f=(o-c-(s+c))/r;for(let d=0;d1.2?2:1,f=(e-.2)/h;for(let d=0;d0?.05:0),o*(e/2)+(o<0?.05:0)],y:[0,n],z:[a*(t/2)-(a>0?.05:0),a*(t/2)+(a<0?.05:0)]},q.wood);for(let o of[.25,n-.55])i.block({x:[-e/2,e/2],y:[o,o+.08],z:[-t/2,t/2]},q.wood,ue),i.block({x:[-e/2+.04,e/2-.04],y:[o+.08,o+.24],z:[-t/2+.05,t/2-.05]},q.bedding,Te),i.block({x:[-e/2+.05,e/2-.05],y:[o+.24,o+.33],z:[-t/2+.08,-t/2+.4]},q.pillow);i.block({x:[-e/2,e/2],y:[n-.2,n-.15],z:[t/2-.05,t/2]},q.wood);let s=e/2-.35;for(let o of[s-.18,s+.18])i.seg(o,0,t/2+.02,o,n-.15,t/2+.02,ue);for(let o=.3;oi.block({x:[-e/2,e/2],y:[n-.04,n],z:[-t/2,t/2]},q.worktop,ue);function mv(i,e,t,n){di(i,e,t-.02,n-.04,Math.max(1,Math.round(e/.6)),n-.2),kp(i,e,t,n)}function gv(i,e,t,n){i.block({x:[-e/2,e/2],y:[Math.max(0,n-.04),n],z:[-t/2,t/2]},q.worktop,ue)}function xv(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,n],z:[-t/2,t/2]},q.white,ue);let r=n*.62;i.seg(-e/2,r,t/2,e/2,r,t/2,Te);let s=e/2-.06;i.seg(s,r+.08,t/2+.015,s,r+.4,t/2+.015,Ze),i.seg(s,r-.4,t/2+.015,s,r-.08,t/2+.015,Ze)}var zp=.06;function yv(i,e,t,n){let r=t/2-zp;i.block({x:[-e/2,e/2],y:[.02,n],z:[-t/2,r]},q.body,ue),i.block({x:[-e/2+.05,e/2-.05],y:[0,.02],z:[-t/2+.05,r-.05]},q.dark);for(let s of[.35,.7,1.05,1.4])s>n-.15||(i.seg(-e/2+.03,s,r+.001,-.03,s,r+.001,Te),i.seg(.03,s,r+.001,e/2-.03,s,r+.001,Te))}var Bp=1.83;function aC(i,e,t,n,r){let[s,o]=[Math.cos(e.rotation*mt),Math.sin(e.rotation*mt)],a=e.mirror?-1:1,l=(y,_)=>[e.x+a*y*s-_*o,e.z+a*y*o+_*s],[c,u]=[t+.05,t+e.h-.02],h=new W(.75,.1,.14),f=new W(Fe.dark),d=new W(Fe.accent),p=e.w/2-.006,x=(y,_,b)=>{let M=b/Bp,S=new W(2043212).lerp(h,M),v=new W(Fe.body).lerp(h,M*.8),[w,R]=[Math.cos(b),Math.sin(b)],T=(O,P)=>l(y+_*(O*w-P*R),e.d/2+O*R+P*w),C=(O,P,I,D)=>{let[F,H,B,X]=O;i.tri([F[0],P,F[1]],[H[0],P,H[1]],[B[0],I,B[1]],D),i.tri([F[0],P,F[1]],[B[0],I,B[1]],[X[0],I,X[1]],D)},L=(O,P,I,D,F,H,B,X=B)=>{let V=[T(O,H),T(P,H),T(P,F),T(O,F)];C([V[0],V[1],V[1],V[0]],I,D,X),C([V[3],V[2],V[2],V[3]],I,D,B),C([V[0],V[3],V[3],V[0]],I,D,B),C([V[1],V[2],V[2],V[1]],I,D,B),C([V[0],V[1],V[2],V[3]],D,D,B),C([V[3],V[2],V[1],V[0]],I,I,B)};return L(0,p,c,u,-zp,0,v,S),L(p-.05,p-.03,t+e.h*.45,t+e.h*.75,.005,.025,d),L};x(-e.w/2,1,n*Bp)(.12,.3,t+e.h*.5,t+e.h*.68,.001,.005,f),x(e.w/2,-1,r*Bp)(.06,p-.06,t+e.h*.52,t+e.h*.86,.001,.005,f)}function Vp(i,e,t,n,r){let s=i.p.length;aC(i,e,t,n,r),e.mirror&&Ss(i,s)}function bv(i,e,t,n){di(i,e,t-.02,n-.04,1,n-.24,!0),i.block({x:[-e/2,e/2],y:[n-.04,n],z:[-t/2,t/2]},q.dark,ue);let r=[[-.14,-.13,.09],[.14,-.13,.07],[-.14,.13,.07],[.14,.13,.09]];for(let[s,o,a]of r)i.cylinder(s*e/.6,o*t/.62,a,n,n+.004,He(Fe.dark,1451583),12,Ze)}function vv(i,e,t,n){di(i,e,t-.02,n-.04,Math.max(1,Math.round(e/.45)),n-.2);let r=Math.min(.5,e-.2),s=(o,a,l,c,u=!1)=>i.block({x:[o,a],y:[n-.04,n],z:[l,c]},q.worktop,u?ue:null);s(-e/2,-r/2,-t/2,t/2,!0),s(r/2,e/2,-t/2,t/2,!0),s(-r/2,r/2,-t/2,-t/2+.1),s(-r/2,r/2,t/2-.08,t/2),i.block({x:[-r/2,r/2],y:[n-.2,n-.17],z:[-t/2+.1,t/2-.08]},q.metal,Ze),i.cylinder(0,-t/2+.05,.02,n,n+.28,q.metal,8),i.block({x:[-.015,.015],y:[n+.24,n+.28],z:[-t/2+.05,-t/2+.22]},q.metal)}function _v(i,e,t,n){i.block({x:[-e/2,e/2],y:[1.45,1.45+n],z:[-t/2,t/2-.02]},q.body,ue),Is(i,-e/2,e/2,1.45,1.45+n,t/2-.02,Math.max(1,Math.round(e/.5)),1.45+.08)}function Mv(i,e,t,n){i.block({x:[-e/2,e/2],y:[.02,n],z:[-t/2,t/2-.02]},q.body,ue),i.block({x:[-e/2+.02,e/2-.02],y:[0,.08],z:[-t/2+.02,t/2-.06]},q.dark);let r=t/2-.02;i.block({x:[-e/2+.03,e/2-.03],y:[.85,1.45],z:[r,r+.01]},q.dark,Ze),i.seg(-e/2+.08,1.4,r+.02,e/2-.08,1.4,r+.02,Ze);for(let s of[.85,1.45])i.seg(-e/2,s,r,e/2,s,r,Te);i.seg(e/2-.06,.5,r+.012,e/2-.06,.7,r+.012,Ze),i.seg(e/2-.06,1.6,r+.012,e/2-.06,1.8,r+.012,Ze)}function Sv(i,e,t,n){let r=t-.3;i.block({x:[-e/2+.05,e/2-.05],y:[.08,n-.04],z:[-t/2+.02,-t/2+r]},q.body,ue),i.block({x:[-e/2+.07,e/2-.07],y:[0,.08],z:[-t/2+.04,-t/2+r-.04]},q.dark),Is(i,-e/2+.05,e/2-.05,.08,n-.04,-t/2+r,Math.max(2,Math.round(e/.6)),n-.2),kp(i,e,t,n)}function wv(i,e,t,n){i.block({x:[-e/2,e/2],y:[.02,n-.04],z:[-t/2,t/2-.02]},q.body,ue),i.block({x:[-e/2+.02,e/2-.02],y:[0,.08],z:[-t/2+.02,t/2-.06]},q.dark),i.seg(-e/2+.08,n-.12,t/2-.008,e/2-.08,n-.12,t/2-.008,Ze),kp(i,e,t,n)}function Gp(i,e,t,n,r){i.block({x:[-e/2,e/2],y:[0,n],z:[-t/2,t/2-.02]},q.white,ue);let s=t/2-.012;i.seg(-e/2,n-.14,s,e/2,n-.14,s,Te),i.seg(e/2-.16,n-.07,s,e/2-.08,n-.07,s,Ze);let o=(n-.14)/2+.04,a=Math.min(e*.36,(n-.2)*.42),l=20;for(let c=0;ci.seg(Math.cos(u)*a*d,o+Math.sin(u)*a*d,s,Math.cos(h)*a*d,o+Math.sin(h)*a*d,s,p);f(1,Ze),r||f(.72,Te)}}function Tv(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,n-.02],z:[-t/2,t/2]},q.white,ue);let s=(o,a,l,c)=>i.block({x:[o,a],y:[n-.02,n],z:[l,c]},q.worktop);s(-e/2,e/2,-t/2,-t/2+.07),s(-e/2,e/2,t/2-.07,t/2),s(-e/2,-e/2+.07,-t/2+.07,t/2-.07),s(e/2-.07,e/2,-t/2+.07,t/2-.07),i.block({x:[-e/2+.07,e/2-.07],y:[n-.03,n-.02],z:[-t/2+.07,t/2-.07]},q.glass,Ze),i.cylinder(-e/2+.04,0,.02,n,n+.12,q.metal,8)}function Av(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,.05],z:[-t/2,t/2]},q.worktop,ue),i.cylinder(0,0,.04,.05,.052,q.metal,8);for(let[r,s,o,a]of[[-e/2,t/2,e/2,t/2],[e/2,-t/2,e/2,t/2]])i.seg(r,.05,s,o,.05,a,Ze),i.seg(r,n,s,o,n,a,Ze),i.seg(o,.05,a,o,n,a,Ze);i.cylinder(-e/2+.06,-t/2+.06,.015,.05,n-.05,q.metal,6),i.cylinder(-e/2+.2,-t/2+.2,.1,n-.08,n-.06,q.metal,12,Ze)}function Ev(i,e,t,n){let r=Math.min(.18,t*.3);i.block({x:[-e/2,e/2],y:[.45,n],z:[-t/2,-t/2+r]},q.white,ue),i.block({x:[-e*.3,e*.3],y:[0,.36],z:[-t/2+r-.02,t/2-.12]},q.white),i.cylinder(0,t/2-.26,Math.min(e/2,.19),.36,.41,q.white,12,ue),i.block({x:[-e/2+.02,e/2-.02],y:[.41,.43],z:[-t/2+r,-t/2+r+.05]},q.worktop)}function Rv(i,e,t,n){di(i,e,t-.02,n-.12,e>.8?2:1,n-.3),i.block({x:[-e/2,e/2],y:[n-.12,n],z:[-t/2,t/2]},q.white,ue),i.block({x:[-e/2+.07,e/2-.07],y:[n-.005,n],z:[-t/2+.12,t/2-.06]},q.glass,Ze),i.cylinder(0,-t/2+.06,.018,n,n+.2,q.metal,8),i.block({x:[-e/2+.04,e/2-.04],y:[n+.35,n+1],z:[-t/2,-t/2+.02]},q.glass,Ze)}var Al=.12;function Cv(i,e,t,n){let r=Al;i.block({x:[-e/2+.05,-e/2+.08],y:[0,r],z:[-t/2,-t/2+.03]},q.metal),i.block({x:[e/2-.08,e/2-.05],y:[0,r],z:[-t/2,-t/2+.03]},q.metal),i.block({x:[-e/2,e/2],y:[r,r+n],z:[-t/2+.02,t/2]},q.white,ue);let s=Math.max(3,Math.round(e/.1));for(let o=1;oi.block({x:[-e/2,e/2],y:[1.1,1.1+n],z:[-t/2,t/2]},l,ue);if(r==="slim"){a(q.darkBody),i.seg(-e*.25,1.1+n*.15,o+.004,-e*.25,1.1+n*.85,o+.004,Ze),i.block({x:[-e*.1,e*.3],y:[1.1+n*.7,1.1+n*.85],z:[o,o+.005]},q.dark);return}if(a(q.white),r==="hybrid"){i.ring(0,1.1+n*.66,Math.min(e,n)*.22,o+.004,20,Ze),i.seg(-e*.08,1.1+n*.66,o+.005,e*.08,1.1+n*.66,o+.005,Ze);for(let l of[-1,1])i.ring(l*e*.22,1.1+n*.2,Math.min(e,n)*.1,-t/2-.002,12,Ze);return}i.block({x:[-e*.28,e*.28],y:[1.1+n*.58,1.1+n*.82],z:[t/2,t/2+.006]},q.dark),i.seg(-e*.3,1.1+n*.45,t/2+.004,e*.3,1.1+n*.45,t/2+.004,Ze);for(let l of[-1,1])for(let c=1;c<6;c++)i.seg(l*e/2+l*.002,1.1+n*c/6,-t/2+.03,l*e/2+l*.002,1.1+n*c/6,t/2-.03,Te)}function Xv(i,e,t,n){i.block({x:[-e/2,e/2],y:[0,n],z:[-t/2,t/2]},q.darkBody,ue),i.block({x:[-e/2-.01,e/2+.01],y:[n,n+.03],z:[-t/2-.01,t/2+.01]},q.darkBody),i.seg(-e/2,n+.032,t/2+.01,e/2,n+.032,t/2+.01,Ze),i.seg(-e*.3,n*.55,t/2+.003,e*.3,n*.55,t/2+.003,Te)}function Yv(i,e,t,n){i.block({x:[-e/2,e/2],y:[1,1+n],z:[-t/2,t/2]},q.darkBody,ue),i.ring(0,1+n*.58,Math.min(e,n)*.28,t/2+.003,16,Ze),i.block({x:[-.015,.015],y:[1-.35,1],z:[t/2-.03,t/2]},q.dark),i.block({x:[-.06,.06],y:[1-.42,1-.35],z:[t/2-.05,t/2]},q.darkBody)}function qv(i,e,t,n){i.block({x:[-e/2,e/2],y:[.4,.4+n],z:[-t/2,t/2]},q.white,ue),i.seg(-e/2+.025,.4+.025,t/2+.003,-e/2+.025,.4+n-.025,t/2+.003,Te),i.seg(-e/2+.025,.4+n-.025,t/2+.003,e/2-.025,.4+n-.025,t/2+.003,Te),i.block({x:[e/2-.06,e/2-.035],y:[.4+n*.5-.05,.4+n*.5+.05],z:[t/2,t/2+.012]},q.dark),i.block({x:[-e*.3,e*.3],y:[.4+n*.6,.4+n*.8],z:[t/2,t/2+.005]},q.dark),i.seg(-e*.22,.4+n*.7,t/2+.008,e*.22,.4+n*.7,t/2+.008,Ze)}function $v(i,e,t,n,r){if(r==="wall"){i.block({x:[-e/2,e/2],y:[.5,.5+n],z:[-t/2,t/2]},q.white,ue),i.seg(-e*.3,.5+n*.9,t/2+.004,e*.3,.5+n*.9,t/2+.004,Ze),i.seg(-e*.3,.5+n*.08,t/2+.003,e*.3,.5+n*.08,t/2+.003,Te);return}if(r==="cube"){i.block({x:[-e/2+.01,e/2-.01],y:[0,.03],z:[-t/2+.01,t/2-.01]},q.dark),i.block({x:[-e/2,e/2],y:[.03,n],z:[-t/2,t/2]},q.darkBody,ue),i.seg(-e*.35,n*.85,t/2+.004,e*.35,n*.85,t/2+.004,Ze),i.block({x:[-e*.15,e*.15],y:[n,n+.025],z:[-.012,.012]},q.dark);return}i.block({x:[-e/2+.02,e/2-.02],y:[0,.06],z:[-t/2+.02,t/2-.02]},q.dark);let s=Math.max(2,Math.round((n-.06)/.3)),o=(n-.06)/s;for(let a=0;a[x[0]+h*g,x[1]+f*g];i.prism([e,t,p(t,o),p(e,o)],r,s,a,Te)}var lC=i=>i.slice(1).map((e,t)=>[i[t],e]).filter(([e,t])=>Math.hypot(t[0]-e[0],t[1]-e[1])>.01);function cC(i,e,t,n,r){let s=e.build==="cantilever"?.07:.05;t.forEach((o,a)=>{let l=av(o),c=a===0?0:t[a-1].top;if(e.build==="solid"){i.prism(o.poly,Math.min(r,o.top),o.top,q.body,ue);return}if(i.prism(o.poly,o.top-s,o.top,q.wood,ue),e.risers&&!o.landing){let[u,h]=[Math.min(c,o.top),Math.max(c,o.top)-s];Kv(i,o.left[0],o.right[0],l,u,h,.02)}if(e.build==="stringer")for(let u of[o.left,o.right])for(let[h,f]of lC(u))Kv(i,h,f,l,o.top-n-.2,o.top+.05,.04);else e.build==="mono"&&i.block({x:[l[0]-.07,l[0]+.07],y:[o.top-n-.12,o.top-s],z:[l[1]-.07,l[1]+.07]},q.metal)})}function uC(i,e,t){let n=e.rail==="both"?["left","right"]:e.rail==="none"?[]:[e.rail];for(let r of n){let s=[];for(let o of t)for(let a of o[r])s.push([a[0],o.top+ch,a[1]]);for(let[o,a]of t.entries()){if(o%2&&o!==t.length-1)continue;let l=a[r][0];i.cylinder(l[0],l[1],.012,a.top,a.top+ch,q.metal,6)}for(let o=1;o0&&i.cylinder(0,0,o.column,Math.min(0,a),s.down?0:r,q.metal,12,ue),cC(i,s,o.treads,o.rise,a),uC(i,s,o.treads)}var hC=(i,e="Station 1")=>({id:i,name:e,has_valve:!0}),uh=i=>i.has_valve!==!1;function hh(i){let e=i.hydronic??{};return e.stations?.length?e.stations.slice(0,16):[{...hC("station-1"),flow:e.flow,return:e.return,hot_water:e.hot_water,cold_water:e.cold_water,pump:e.pump}]}var fC=(i,e="Heizkreis")=>({id:i,name:e,kind:"heating",has_pump:!0,has_valve:!0});function dC(i){return{card:!0,...i==="heating_manifold"?{circuits:[fC("c1","Heizkreis 1")]}:{},...i==="buffer_tank"?{sensors:Array.from({length:7},(e,t)=>({id:`s${t+1}`,name:`F\xFChler ${t+1}`,entity:null,level:1-t/6}))}:{}}}function El(i){return{...dC(i.type),...i.hydronic}}var Rl=i=>i.has_pump!==!1,Ls=i=>i.kind!=="pump"&&i.has_valve!==!1,Jv=(i,e)=>-.4+.8*(i+.5)/Math.max(1,e),Hp=i=>!!i&&i!=="none";function fh(i,e,t,n){let r=Math.min(i.w*.8/Math.max(1,n),i.h*.5),s=i.w*Jv(t,n),o=s-r*.22,a=s+r*.22,l=i.d*.16,c=-i.d*.14,u=i.h*.15,h=i.h*.07,f=i.h*.24,d=i.h*.34,p=i.h*.55,x=i.h*.73,g=i.h*.87,m=Math.min(r*.04,i.h*.018,i.d*.08),y=Math.min(r*.13,i.h*.055,i.d*.28),_=Math.min(r*.09,i.h*.04,i.d*.18),b=Math.min(r*.06,i.h*.025,i.d*.14),M=l+Math.min(i.d*.28,y*.8),S=l+Math.min(i.d*.24,_*.9),v=l+m+b*.65,w=o-r*.13,R=a+r*.13,T=Ls(e)&&e.valve_type!=="two_way",C=Math.min(r*.23,i.h*.115),L=l+Math.min(i.d*.22,C*.4),O=e.kind==="pump"?i.h*.93:g,P=[{from:[o,u,c],to:[o,f,c],kind:"flow"},{from:[o,f,c],to:[o,f,l],kind:"flow"},{from:[o,f,l],to:[o,O,l],kind:"flow"},{from:[a,h,l],to:[a,O,l],kind:"return"}];return T&&P.push({from:[o,d,l],to:[a,d,l],kind:"mix"}),e.kind!=="pump"&&(P.push({from:[o,g,l],to:[s-C,g,l],kind:"flow"}),P.push({from:[s+C,g,l],to:[a,g,l],kind:"return"})),{x:s,column:r,flowX:o,returnX:a,frontZ:l,backZ:c,flowHeaderY:u,returnHeaderY:h,valveY:d,pumpY:p,temperatureY:x,loadY:g,loadR:C,loadFront:L,pipeR:m,pumpR:y,valveR:_,gaugeR:b,pumpFront:M,valveFront:S,gaugeFront:v,flowGaugeX:w,returnGaugeX:R,mixing:T,topY:O,pipes:P}}function Uo(i){let{w:e,d:t,h:n}=i,r=hh(i),s=Math.min(e*.2,n*.25),o=(e-s)/r.length,a=t*.24,l=-t*.03,c=-t*.25,u={flow:n*.98,back:n*.9,hot:n*.82,cold:n*.06},h=Math.min(n*.012,t*.065,o*.04),f=Math.min(n*.009,t*.045,o*.025),d=[{from:[-e*.49,u.flow,l],to:[e*.49,u.flow,l],medium:"primary_flow"},{from:[-e*.49,u.back,c],to:[e*.49,u.back,c],medium:"primary_return"},{from:[-e*.49,u.hot,a],to:[e*.49,u.hot,a],medium:"hot_water"},{from:[-e*.49,u.cold,a],to:[e*.49,u.cold,a],medium:"cold_water"}],p=(M,S,v)=>({x:M,y:S,z:a,front:a+Math.min(t*.22,v*.85),r:v}),x=r.map((M,S)=>{let v=-e/2+s+o*(S+.5),w=v-o*.33,R=v+o*.4,T=v+o*.23,C=o*.18,L=[],O=(H,B)=>{for(let X=1;X1e-6?i.lyingCylinder("x",(s+l)/2,a,o-n,o+n,Math.abs(l-s),n*2,r,12,Te):Math.abs(u-a)>1e-6?i.lyingCylinder("z",s,(a+u)/2,o-n,o+n,Math.abs(u-a),n*2,r,12,Te):i.cylinder(s,a,n,Math.min(o,c),Math.max(o,c),r,12,Te)}function Cl(i,e,t,n,r,s,o=dh){i.lyingCylinder("z",e,(r+s)/2,t-n,t+n,s-r,n*2,o,24,Te)}var Pl={primary_flow:He(11088437,14109762),primary_return:He(2383516,5019861),hot_water:He(11957285,15639884),cold_water:He(3242318,7192440),circulation:He(7950748,11895505)},pC=He(9597515,13215082),mC=He(8293780,11582912),mh=new W(10859712);function jv(i,e){let t=Uo(e);for(let n of t.headers)ph(i,n.from,n.to,t.headerR,Pl[n.medium]);for(let n of t.circulationPipes)ph(i,n.from,n.to,t.pipeR,Pl[n.medium]);if(t.circulationPipes.length){let n=t.circPump;Cl(i,n.x,n.y,n.r,n.z-t.pipeR,n.front,q.darkBody);let r=t.circProbe;Cl(i,r.x,r.y,r.r,r.z,r.front,dh)}t.units.forEach((n,r)=>{let s=n.pitch*.45;i.block({x:[n.x-s,n.x+s],y:[e.h*.18,e.h*.76],z:[-e.d*.46,-e.d*.34]},q.darkBody,Te);for(let d of n.pipes)ph(i,d.from,d.to,t.pipeR,Pl[d.medium]);i.block({x:[n.plate.x0,n.plate.x1],y:[n.plate.y0,n.plate.y1],z:[n.plate.back,n.plate.front]},mC,Te);for(let d=1;d<7;d++){let p=n.plate.x0+(n.plate.x1-n.plate.x0)*d/7;i.seg(p,n.plate.y0+e.h*.015,n.plate.front+.001,p+n.pitch*.045,n.plate.y1-e.h*.015,n.plate.front+.001,Te)}for(let[d,p]of[[n.plate.x0,Pl.primary_flow],[n.plate.x1,Pl.hot_water]])i.block({x:[d-n.pitch*.016,d+n.pitch*.016],y:[n.plate.y0,n.plate.y1],z:[n.plate.front,n.plate.front+e.d*.015]},p);for(let d of[n.pump,...n.valve?[n.valve]:[]])Cl(i,d.x,d.y,d.r,d.z-t.pipeR,d.front,d===n.valve?pC:q.darkBody);for(let d of n.probes)Cl(i,d.x,d.y,d.r,d.z,d.front,dh);let o=Math.min(n.pitch*.055,e.h*.022),a=n.x-s+o*.6,l=e.h*.72,c=e.d*.31;i.seg(a,l-o,c,a,l+o,c,mh),i.seg(a,l,c,a+o,l+o,c,mh),i.seg(a,l,c,a+o,l-o,c,mh);let u=String(r+1),h=["abcdef","bc","abdeg","abcdg","bcfg","acdfg","acdefg","abc","abcdefg","abcdfg"],f={a:[0,1,1,1],b:[1,1,1,0],c:[1,0,1,-1],d:[0,-1,1,-1],e:[0,0,0,-1],f:[0,1,0,0],g:[0,0,1,0]};for(let d=0;d.5?xh:Wp,12,Te)}for(let a of s.sensors??[]){let l=r*(.1+.8*a.level);i.lyingCylinder("z",0,o,l-.018,l+.018,.035,.036,yh,10,Te),i.ring(0,l,.025,o+.022,12,Te)}for(let a of[-1,1])for(let l of[-1,1])i.cylinder(a*o*.52,l*o*.52,.025,0,r*.05,q.metal);return}if(i.block({x:[-t*.49,t*.49],y:[r*.02,r*.98],z:[-n*.48,-n*.35]},q.darkBody,ue),e.type==="heating_manifold"){let o=s.circuits??[],a=Math.min(r*.025,n*.12);for(let[u,h,f]of[[r*.15,-n*.14,xh],[r*.07,n*.16,Wp]])i.lyingCylinder("x",0,h,u-a,u+a,t*.94,a*2,f,16,Te);let l=(u,h,f,d=xh)=>{let[p,x,g]=u,[m,y,_]=h;Math.abs(m-p)>1e-6?i.lyingCylinder("x",(p+m)/2,g,x-f,x+f,Math.abs(m-p),f*2,d,12,Te):Math.abs(_-g)>1e-6?i.lyingCylinder("z",p,(g+_)/2,x-f,x+f,Math.abs(_-g),f*2,d,12,Te):i.cylinder(p,g,f,Math.min(x,y),Math.max(x,y),d,12,Te)},c=(u,h,f,d,p,x=Xp)=>i.lyingCylinder("z",u,(d+p)/2,h-f,h+f,p-d,f*2,x,24,Te);o.forEach((u,h)=>{let f=fh(e,u,h,o.length);for(let d of f.pipes)l(d.from,d.to,f.pipeR,d.kind==="flow"?xh:Wp);if(u.kind!=="pump"){c(f.x,f.loadY,f.loadR,f.frontZ,f.loadFront,gC),i.ring(f.x,f.loadY,f.loadR*.55,f.loadFront+.001,24,Te);let d=f.loadR*.45;for(let p=0;p<4;p++)i.seg(f.x-d+p*d/2,f.loadY-d*.3,f.loadFront+.002,f.x-d+(p+.5)*d/2,f.loadY+d*.3,f.loadFront+.002,ue)}if(Rl(u)){c(f.flowX,f.pumpY,f.pumpR,f.frontZ-f.pipeR,f.pumpFront,q.darkBody);for(let d of[-1,1])i.cylinder(f.flowX,f.frontZ,f.pipeR*1.65,f.pumpY+d*f.pumpR-f.pipeR*.5,f.pumpY+d*f.pumpR+f.pipeR*.5,Xp,12,Te)}if(Ls(u)){c(f.flowX,f.valveY,f.valveR,f.frontZ-f.pipeR,f.valveFront,yh);for(let d of[-1,1])i.cylinder(f.flowX,f.frontZ,f.pipeR*1.5,f.valveY+d*f.valveR-f.pipeR*.4,f.valveY+d*f.valveR+f.pipeR*.4,yh,12,Te);f.mixing&&l([f.flowX+f.valveR*.6,f.valveY,f.frontZ],[f.flowX+f.valveR*1.3,f.valveY,f.frontZ],f.pipeR*1.5,yh),i.block({x:[f.flowX-f.valveR*.65,f.flowX+f.valveR*.65],y:[f.valveY-f.valveR*.65,f.valveY+f.valveR*.65],z:[f.frontZ,f.frontZ+(f.valveFront-f.frontZ)*.9]},q.darkBody,Te)}for(let[d,p]of[[f.flowX,f.flowGaugeX],[f.returnX,f.returnGaugeX]])l([d,f.temperatureY,f.frontZ],[p,f.temperatureY,f.frontZ],f.pipeR*.5,Xp),c(p,f.temperatureY,f.gaugeR,f.frontZ,f.gaugeFront,xC),i.ring(p,f.temperatureY,f.gaugeR*.8,f.gaugeFront+.001,16,Te)})}}function yC(i,e,t,n,r,s){switch(e.type){case"heating_manifold":case"buffer_tank":case"freshwater_station":return Qv(i,e,t,n,r),"yes";case"sofa":return e.variant==="l"||e.variant==="u"?lv(i,t,n,r,e.variant):Dp(i,t,n,r,Math.max(1,Math.round((t-.4)/.62))),"yes";case"armchair":return Dp(i,t,n,r,1),"yes";case"bed":return cv(i,t,n,r),"yes";case"chair":return uv(i,t,n,r),"yes";case"table":return Pv(i,t,n,r),"yes";case"desk":return Fv(i,t,n,r),"yes";case"nightstand":return Nv(i,t,n,r),"yes";case"wardrobe":return di(i,t,n,r,Math.max(2,Math.round(t/.5)),r*.5),"yes";case"tall_cabinet":return di(i,t,n,r,1,r*.5),"yes";case"shelf":return Ov(i,t,n,r),"yes";case"kitchen":return mv(i,t,n,r),"yes";case"fridge":return xv(i,t,n,r),"yes";case"fridge_smart":return yv(i,t,n,r),"yes";case"stove":return bv(i,t,n,r),"yes";case"sink":return vv(i,t,n,r),"yes";case"bathtub":return Tv(i,t,n,r),"yes";case"shower":return Av(i,t,n,r),"yes";case"wc":return Ev(i,t,n,r),"yes";case"washbasin":return Rv(i,t,n,r),"yes";case"tv_board":return Gv(i,t,n,r,e.ambilight===0?ue:void 0),"yes";case"plant":return kv(i,t,n,r),"yes";case"rug":return zv(i,t,n),"no";case"stairs":return e.stair?(Zv(i,e,t,n,r),e.stair.down?"no":"yes"):(Vv(i,t,n,r),"yes");case"stairwell":return"no";case"sideboard":return Dv(i,t,n,r),"yes";case"dresser":return Uv(i,t,n,r),"yes";case"coat_rack":return Bv(i,t,n,r),"yes";case"bench":return Up(i,t,n,r,!1),"yes";case"corner_bench":return Up(i,t,n,r,!0),"yes";case"bar_stool":return hv(i,t,n,r),"yes";case"office_chair":return fv(i,t,n,r),"yes";case"stool":return dv(i,t,n,r),"yes";case"kitchen_wall":return _v(i,t,n,r),"no";case"kitchen_tall":return Mv(i,t,n,r),"yes";case"island":return Sv(i,t,n,r),"yes";case"worktop":return gv(i,t,n,r),"no";case"dishwasher":return wv(i,t,n,r),"yes";case"washer":return Gp(i,t,n,r,!1),"yes";case"dryer":return Gp(i,t,n,r,!0),"yes";case"bunk_bed":return pv(i,t,n,r),"yes";case"table_round":return Iv(i,t,n,r),"yes";case"coffee_table":return Lv(i,t,n,r),"yes";case"tv_wall":return Hv(i,t,n,r,e.ambilight===0?ue:void 0),"no";case"parking":{let a=[[-t/2,-n/2],[t/2,-n/2],[t/2,n/2],[-t/2,n/2]];return a.forEach(([l,c],u)=>i.seg(l,.012,c,a[(u+1)%4][0],.012,a[(u+1)%4][1],Te)),i.seg(-t*.15,.012,n/2-.45,0,.012,n/2-.2,ue),i.seg(0,.012,n/2-.2,t*.15,.012,n/2-.45,ue),"no"}case"robot_vacuum":return i.block({x:[-t*.45,t*.45],y:[0,r],z:[-n/2,-n/2+n*.3]},q.white,ue),i.block({x:[-t*.2,t*.2],y:[r*.5,r*.62],z:[-n/2+n*.3,-n/2+n*.31]},q.accent),"no";case"radiator":return Cv(i,t,n,r),"no";case"inverter":return Wv(i,t,n,r,e.variant??null),"no";case"grid_point":return Xv(i,t,n,r),"yes";case"wallbox":return Yv(i,t,n,r),"no";case"meter":return qv(i,t,n,r),"no";case"home_battery":return $v(i,t,n,r,e.variant??null),e.variant==="wall"?"no":"yes";default:{let o=_t(e.type);return o?o.pet?"no":(ws(i,o,t,n,r,s,null,null,e.variant??null),s>.05?"no":"yes"):(i.block({x:[-t/2,t/2],y:[0,r],z:[-n/2,n/2]},q.body,ue),"yes")}}}function e_(i,e,t,n,r){let s=Ts(n),o=new Fi(i,e,s),[a,l,c]=[Math.max(.05,n.w),Math.max(.05,n.d),Math.max(.005,n.h)];yC(o,n,a,l,c,r)==="yes"&&Uy(t,s,a,l,n.type==="plant"?.35:.5)}function t_(i,e,t){let[n,r]=[Math.cos(t),Math.sin(t)],s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],o=[e[1]*i[2]-e[2]*i[1],e[2]*i[0]-e[0]*i[2],e[0]*i[1]-e[1]*i[0]];return[i[0]*n+o[0]*r+e[0]*s*(1-n),i[1]*n+o[1]*r+e[1]*s*(1-n),i[2]*n+o[2]*r+e[2]*s*(1-n)]}function bC(i,e,t,n,r){let[s,o]=[n.tilt_x??0,n.tilt_z??0];if(!s&&!o)return;let a=n.rotation*Math.PI/180,l=[Math.cos(a),0,Math.sin(a)],c=[-Math.sin(a),0,Math.cos(a)],u=(h,f)=>{for(let d=f;d+2c.screen);if(o){let c=e?Gt(e,i):0,[u,h]=[(o.x-o.w/2)*t,(o.x+o.w/2)*t],f=Math.min(.02,(h-u)*.05);return{x0:u+f,x1:h-f,y0:c+o.y*r+f,y1:c+(o.y+o.h)*r-f,z:(o.z+o.d/2)*n}}let a=e&&i.type!=="fridge_smart"?Gt(e,i)-Qr(i):0,l=_C(i,t,n,r,e);return l&&{...l,y0:l.y0+a,y1:l.y1+a}}function bh(i,e){let t=MC(i,e);return t&&i.mirror?{...t,x0:-t.x1,x1:-t.x0}:t}function Yp(i,e){let[t,n,r]=[Math.max(.05,i.w),Math.max(.05,i.d),Math.max(.005,i.h)],s=_t(i.type),o=s&&ia(s,t,n,r).find(h=>h.picture);if(!o)return null;let a=e?Gt(e,i):0,[l,c]=[(o.x-o.w/2)*t,(o.x+o.w/2)*t],u={x0:l,x1:c,y0:a+o.y*r,y1:a+(o.y+o.h)*r,z:(o.z+o.d/2)*n};return i.mirror?{...u,x0:-u.x1,x1:-u.x0}:u}function qp(i,e){if(i.type!=="home_battery")return null;let[t,n,r]=[Math.max(.05,i.w),Math.max(.05,i.d),Math.max(.05,i.h)],s=e?Gt(e,i)-Qr(i):0,o=n/2+.005;return i.variant==="wall"?{rect:{x0:-t*.3,x1:t*.3,y0:s+.5+r*.84,y1:s+.5+r*.9,z:o},vertical:!1}:i.variant==="cube"?{rect:{x0:-t*.35,x1:t*.35,y0:s+r*.8,y1:s+r*.86,z:o},vertical:!1}:{rect:{x0:-t*.05,x1:t*.05,y0:s+.06+r*.16,y1:s+r-.12,z:o},vertical:!0}}var jn=Math.PI/180,mr=(i,e)=>[i[0]-e[0],i[1]-e[1],i[2]-e[2]];var Bo=i=>Math.hypot(i[0],i[1],i[2]),Fs=i=>{let e=Bo(i)||1;return[i[0]/e,i[1]/e,i[2]/e]},n_=(i,e)=>[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]];var r_=.25;function s_(i,e,t,n,r,s,o){let a=r-t>=s-n,l=a?r-t:s-n;return{key:`${i}:top`,section:e,side:"top",flat:!0,o:[t,o,n],eu:a?[1,0,0]:[0,0,1],es:a?[0,0,1]:[1,0,0],n:[0,1,0],lu:l,ls:a?s-n:r-t,pitch:0,span:()=>[0,l],facing:a?[0,1]:[1,0]}}function o_(i,e){let t=Fs(n_(i,e));return t[1]<0?[-t[0],-t[1],-t[2]]:t}var a_=i=>{let e=Fs([-i[0],0,-i[2]]);return[e[0],e[2]]};function gr(i,e,t,n,r,s,o,a){let l=Fs(mr(r,n)),c=Fs(mr(s,n));return{key:i,section:e,side:t,flat:!1,o:n,eu:l,es:c,n:o_(l,c),lu:Bo(mr(r,n)),ls:Bo(mr(s,n)),pitch:o,span:a,facing:a_(c)}}function i_(i,e,t,n,r,s){let o=Bo(mr(r,n));if(o<.3)return null;let a=Fs(mr(r,n)),l=mr(s,n),c=l[0]*a[0]+l[1]*a[1]+l[2]*a[2],u=[l[0]-a[0]*c,l[1]-a[1]*c,l[2]-a[2]*c],h=Bo(u);if(h<.3)return null;let f=Fs(u),d=p=>{let x=Math.min(1,Math.max(0,p/h));return[c*x,o-(o-c)*x]};return{key:i,section:e,side:t,flat:!1,o:n,eu:a,es:f,n:o_(a,f),lu:o,ls:h,pitch:Math.atan2(f[1],Math.hypot(f[0],f[2]))/jn,span:d,facing:a_(f)}}function SC(i,e){let t=Dn(i),n=En(i),r=(y,_,b)=>{let[M,S]=t.at(y,_);return[M,b,S]},[s,o]=[Math.max(0,e.a),Math.max(0,e.b)],a=t.u0-Math.max(0,e.u0),l=t.u1+Math.max(0,e.u1),c=l-a,u=n.y(-s),h=n.y(t.w+o);if(i.shape==="flat"||i.shape==="parapet"){let[y,_]=[t.at(a,-s),t.at(l,t.w+o)];return[s_(i.id,i.id,Math.min(y[0],_[0]),Math.min(y[1],_[1]),Math.max(y[0],_[0]),Math.max(y[1],_[1]),i.eave_a+r_)]}if(i.shape==="pent")return[gr(`${i.id}:a`,i.id,"a",r(a,-s,u),r(l,-s,u),r(a,t.w+o,h),i.pitch_a,()=>[0,c])];if(i.shape==="mansard")return wC(i,t,a,l,s,o);let f=i.shape==="hip"||i.shape==="pyramid",d=(t.u1-t.u0)/2,p=i.shape==="pyramid"?d:f?Math.min(d,Math.min(n.vr,t.w-n.vr)||t.w/2):0,x=f?t.u0+p-a:0,g=f?l-(t.u1-p):0,m=[];if(n.vr>.3){let y=Math.hypot(n.vr+s,n.rh-u);m.push(gr(`${i.id}:a`,i.id,"a",r(a,-s,u),r(l,-s,u),r(a,n.vr,n.rh),i.pitch_a,_=>[x*(_/y),c-g*(_/y)]))}if(t.w-n.vr>.3){let y=Math.hypot(t.w+o-n.vr,n.rh-h);m.push(gr(`${i.id}:b`,i.id,"b",r(l,t.w+o,h),r(a,t.w+o,h),r(l,n.vr,n.rh),i.pitch_b,_=>[g*(_/y),c-x*(_/y)]))}if(f){let y=i_(`${i.id}:c`,i.id,"c",r(a,t.w+o,h),r(a,-s,u),r(t.u0+p,n.vr,n.rh)),_=i_(`${i.id}:d`,i.id,"d",r(l,-s,u),r(l,t.w+o,h),r(t.u1-p,n.vr,n.rh));m.push(...[y,_].filter(b=>b!==null))}return m}function wC(i,e,t,n,r,s){let o=hl(e.w,i.eave_a,i.eave_b,fr(i.pitch_a),fr(i.pitch_b)),a=(p,x)=>{let[g,m]=e.at(p,x);return[g,o.y(x),m]},l=n-t,c=()=>[0,l],u=(p,x)=>Math.atan2(p,x)/jn,h=[],[f,d]=[e.w+s,e.w-o.vlb];return o.vla+r>.3&&h.push(gr(`${i.id}:a`,i.id,"a",a(t,-r),a(n,-r),a(t,o.vla),i.pitch_a,c)),o.vr-o.vla>.3&&h.push(gr(`${i.id}:au`,i.id,"a",a(t,o.vla),a(n,o.vla),a(t,o.vr),u(o.rh-o.yla,o.vr-o.vla),c)),o.vlb+s>.3&&h.push(gr(`${i.id}:b`,i.id,"b",a(n,f),a(t,f),a(n,d),i.pitch_b,c)),d-o.vr>.3&&h.push(gr(`${i.id}:bu`,i.id,"b",a(n,d),a(t,d),a(n,o.vr),u(o.rh-o.ylb,d-o.vr),c)),h}function l_(i){return i.floors.filter(t=>t.rooms.some(n=>n.points.length>=3)).sort((t,n)=>n.elevation-t.elevation)[0]??null}function Ns(i){let e=i.settings.roof;if(!e||e.type==="none")return[];if(e.type==="custom")return(e.sections??[]).flatMap(_=>SC(_,dl(i,_,_.overhang??e.overhang)));let t=l_(i);if(!t)return[];let n=t.rooms.flatMap(_=>_.points.map(b=>b[0])),r=t.rooms.flatMap(_=>_.points.map(b=>b[1])),s=i.settings.wall_exterior+e.overhang,[o,a]=[Math.min(...n)-s,Math.max(...n)+s],[l,c]=[Math.min(...r)-s,Math.max(...r)+s],u=t.elevation+t.height;if(e.type==="flat")return[s_("main",null,o,l,a,c,u+r_)];let h=a-o>=c-l,f=e.ridge==="short"?!h:h,d=(f?c-l:a-o)/2,p=d*Math.tan(e.pitch*jn),x=(_,b,M)=>f?[_,u+M,(l+c)/2+b]:[(o+a)/2+b,u+M,_],[g,m]=f?[o,a]:[l,c],y=()=>[0,m-g];return[gr("main:a",null,"a",x(g,-d,0),x(m,-d,0),x(g,0,p),e.pitch,y),gr("main:b",null,"b",x(g,d,0),x(m,d,0),x(g,0,p),e.pitch,y)]}function vh(i,e){let t=[];for(let n of i.floors.filter(r=>!e||r.id===e)){let{walls:r}=fl(n.rooms,{exterior:i.settings.wall_exterior,interior:i.settings.wall_interior},n.walls??[]);for(let s of r){if(!s.exterior&&!s.free)continue;let[o,a]=[s.b[0]-s.a[0],s.b[1]-s.a[1]],l=Math.hypot(o,a);if(l<1.2)continue;let[c,u]=[a/l,-o/l],h=Math.min(n.height,s.height??n.height,s.heightEnd??1/0),f=(d,p,x,g)=>t.push({key:d,section:null,side:"top",flat:!1,o:p,eu:x,es:[0,1,0],n:g,lu:l,ls:h,pitch:90,span:()=>[0,l],facing:[g[0],g[2]],wall:{floorId:n.id}});f(`wall:${n.id}:${s.id}`,[s.a[0]+c*s.right,n.elevation,s.a[1]+u*s.right],[o/l,0,a/l],[c,0,u]),s.free&&f(`wall:${n.id}:${s.id}:back`,[s.b[0]-c*s.left,n.elevation,s.b[1]-u*s.left],[-o/l,0,-a/l],[-c,0,-u])}}return t}var Ll="ground";function _h(i){let e=i.floors.filter(t=>t.rooms.some(n=>n.points.length>=3)).sort((t,n)=>t.elevation-n.elevation);return e.find(t=>t.elevation>-.5)??e[0]??i.floors[0]??null}function Mh(i,e){let t=(e.rotation??0)*jn,n=[Math.cos(t),0,Math.sin(t)],r=[-Math.sin(t),0,Math.cos(t)],s=_h(i),o=n[0]*e.u+r[0]*e.v,a=n[2]*e.u+r[2]*e.v,l=s?s.elevation+(e.base!=null?e.base:U0(s,o,a)):e.base??0;return{key:Ll,section:null,side:"top",flat:!0,o:[0,l,0],eu:n,es:r,n:[0,1,0],lu:1e4,ls:1e4,pitch:0,span:()=>[-1e4,1e4],facing:[r[0],r[2]],unbounded:!0}}var $p=1.13,Kp=1.72,ko=.025,pi=.07;function Fl(i){let e=i.module_w||$p,t=i.module_h||Kp;return i.portrait===!1?[t,e]:[e,t]}function Zp(i){return i.layout?.length?i.layout.map(e=>Math.max(0,Math.min(60,Math.round(e)))):Array.from({length:Math.max(1,i.rows)},()=>Math.max(1,i.cols))}function Jp(i,e){return i.flat?Math.min(45,Math.max(0,e.tilt??15))*jn:i.wall?Math.min(90,Math.max(0,e.tilt??0))*jn:Math.min(45,Math.max(0,e.tilt??0))*jn}function wh(i,e){let[,t]=Fl(e),n=Jp(i,e);return i.wall?t*Math.cos(n)+ko:!i.flat&&n<.001?t+ko:i.flat&&e.rack==="ew"?t*Math.cos(n)+.08:t*Math.cos(n)+Math.max(.3,2*t*Math.sin(n))}function jp(i,e){let[t,n]=Fl(e),r=Zp(e),s=Math.max(1,...r);return[s*t+(s-1)*ko,(r.length-1)*wh(i,e)+n*Math.cos(Jp(i,e))]}var TC=i=>i.flat&&!i.unbounded&&!i.wall;function AC(i,e){if(!TC(i)||!e.rotation)return null;let t=e.rotation*jn,[n,r]=jp(i,e);return{cos:Math.cos(t),sin:Math.sin(t),u:e.u+n/2,s:e.v+r/2}}function zo(i,e,t=!1){let[n,r]=Fl(e),s=Jp(i,e),o=r*Math.cos(s),a=wh(i,e),l=Zp(e),c=Math.max(1,...l),u=new Set(e.skip??[]),h=AC(i,e),f=(g,m)=>h?[h.u+(g-h.u)*h.cos-(m-h.s)*h.sin,h.s+(g-h.u)*h.sin+(m-h.s)*h.cos]:[g,m],d=(g,m,y)=>{let[_,b]=f(g,m);return[0,1,2].map(M=>i.o[M]+i.eu[M]*_+i.es[M]*b+i.n[M]*y)},p=(g,m)=>{let[y,_]=f(g,m);if(i.unbounded)return!0;if(_<-1e-6||_>i.ls+1e-6)return!1;let[b,M]=i.span(_);return y>=b-1e-6&&y<=M+1e-6},x=[];return l.forEach((g,m)=>{let y=e.align==="right"?c-g:e.align==="center"?(c-g)/2:0;for(let _=0;_.001?o:r);if([[S,w],[v,w],[v,R],[S,R]].every(([T,C])=>p(T,C)))if(i.wall&&s>.001){let T=pi+r*Math.sin(s),[C,L]=e.flip?[T,pi]:[pi,T],O=[d(S,w,C),d(v,w,C),d(v,R,L),d(S,R,L)],P=e.flip?w:R;x.push({corners:O,posts:[S+.05,v-.05].map(I=>[d(I,P,0),d(I,P,T)]),cell:b,skipped:M})}else if(!i.flat&&s>.001){let T=pi+r*Math.sin(s),C=[d(S,w,pi),d(v,w,pi),d(v,R,T),d(S,R,T)];x.push({corners:C,posts:[S+.05,v-.05].map(L=>[d(L,R,0),d(L,R,T)]),cell:b,skipped:M})}else if(!i.flat)x.push({corners:[d(S,w,pi),d(v,w,pi),d(v,R,pi),d(S,R,pi)],posts:[],cell:b,skipped:M});else{let C=.15+r*Math.sin(s),L=e.rack==="ew"&&m%2===1?!e.flip:!!e.flip,[O,P]=L?[R,w]:[w,R],I=[d(S,O,.15),d(v,O,.15),d(v,P,C),d(S,P,C)],D=[S+.05,v-.05].flatMap(F=>[[d(F,O,0),d(F,O,.15)],[d(F,P,0),d(F,P,C)]]);x.push({corners:I,posts:D,cell:b,skipped:M})}}}),x}var Qp=.78,em=1.18,c_=i=>({id:i.id,face:i.face,u:i.u,v:i.v,rows:1,cols:1,portrait:!0,module_w:i.w||Qp,module_h:i.h||em});function Nl(i,e){let t=zo(i,c_(e))[0];if(!t)return null;let n=r=>[r[0]-i.n[0]*.05,r[1]-i.n[1]*.05,r[2]-i.n[2]*.05];return t.corners.map(n)}var Sh={brick:{w:.5,d:.5,h:1},round:{w:.4,d:.4,h:1},wide:{w:1,d:.5,h:1},steel:{w:.2,d:.2,h:1.2}};function Th(i){let e=i.shape??"brick",t=Sh[e]??Sh.brick;return{shape:e,w:i.w||t.w,d:i.d||t.d,h:i.h||t.h}}function tm(i,e){let{w:t,d:n}=Th(i),r=e&&!e.flat?Math.cos(e.pitch*jn):1;return{id:i.id,face:i.face,u:i.u,v:i.v,rows:1,cols:1,portrait:!0,module_w:t,module_h:n/Math.max(.2,r),tilt:0}}function nm(i,e){let t=tm(e,i),[n,r]=[t.module_w,t.module_h],s=(u,h)=>[i.o[0]+i.eu[0]*u+i.es[0]*h,i.o[1]+i.eu[1]*u+i.es[1]*h,i.o[2]+i.eu[2]*u+i.es[2]*h],[o,a]=[s(e.u+n/2,e.v),s(e.u+n/2,e.v+r)],l=s(e.u+n/2,e.v+r/2),c=u=>{let h=Math.hypot(u[0],u[2])||1;return[u[0]/h,u[2]/h]};return{center:[l[0],l[2]],along:c(i.eu),across:c(i.es),low:Math.min(o[1],a[1]),high:Math.max(o[1],a[1])}}var Os=1712952,Ds=2239816,Ah=1318193,xr=ke(3662079,.9),yr=ke(5995775,.45),Xt=.14,u_=9427199,h_=13226982,f_=14936565,d_={black:{glass:new W(329483),edge:ke(9082544,.32),cells:ke(2766160,.22)},blue:{glass:new W(1386842),edge:ke(10467583,.55),cells:ke(4025599,.35)}},p_=ke(13226982,.5),m_=ke(13226982,.85),g_=ke(16757575,.95),im=new W(2845583),rm=new W(3818072),sm=3812144,om=4864064,Eh=2765896,Vo=329483,Rh=9148333,Ch=11845844,x_=ke(5995775,.4);var Go=(i,e,t)=>[i[0]+(e[0]-i[0])*t,i[1]+(e[1]-i[1])*t,i[2]+(e[2]-i[2])*t],Ph=(i,e,t)=>[i[0]+e[0]*t,i[1]+e[1]*t,i[2]+e[2]*t],am=(i,e)=>e.section?i.find(t=>t.sections?.includes(e.section)):i[0];function y_(i,e,t){let n=i.settings.roof?.windows??[];if(n.length===0||e.length===0)return;let r=new Map(Ns(i).map(s=>[s.key,s]));for(let s of n){let o=r.get(s.face),a=o?Nl(o,s):null,l=o&&a?am(e,o):void 0;if(!o||!a||!l)continue;let c=l.floor.elevation+l.base,[u,h,f,d]=a.map(R=>[R[0],R[1]-c,R[2]]),p=t.get(s.id)??{open:0,tilt:0,cover:0},x=(R,T)=>Ph(R,o.n,T),g=p.open>.02||p.tilt>.02?g_:m_,m=[u,h,f,d].map(R=>x(R,.06));m.forEach((R,T)=>l.lines.seg(R,m[(T+1)%4],g));let y=(p.open>.02?30*Math.min(1,p.open):p.tilt>.5?12:0)*mt,_=Math.hypot(f[0]-h[0],f[1]-h[1],f[2]-h[2]),b=R=>Ph(Ph(R,o.es,-_*Math.cos(y)),o.n,_*Math.sin(y)),[M,S]=[x(d,.065),x(f,.065)],[v,w]=[b(M),b(S)];l.solid.tri(v,w,S,im),l.solid.tri(v,S,M,im);for(let[R,T]of[[v,w],[w,S],[S,M],[M,v]])l.lines.seg(R,T,g);if(p.cover>.02){let R=Math.min(1,p.cover),[T,C]=[x(Go(M,v,R),.01),x(Go(S,w,R),.01)],[L,O]=[x(M,.01),x(S,.01)];l.solid.tri(T,C,O,rm),l.solid.tri(T,O,L,rm)}}}function Ih(i,e,t,n,r){let s=c=>[c[0],c[1]-r,c[2]],o=d_[n.look==="blue"?"blue":"black"],[a,l]=n.portrait===!1?[10,6]:[6,10];for(let c of zo(t,n)){let[u,h,f,d]=c.corners.map(s);for(let[g,m,y]of[[u,h,f],[u,f,d],[u,f,h],[u,d,f]])i.tri(g,m,y,o.glass);let p=g=>Ph(g,t.n,.004),x=[u,h,f,d].map(p);x.forEach((g,m)=>e.seg(g,x[(m+1)%4],o.edge));for(let g=1;g[r.key,r]));for(let r of t){let s=n.get(r.face),o=s?am(e,s):void 0;s&&o&&Ih(o.solid,o.lines,s,r,o.floor.elevation+o.base)}}function v_(i,e){let t=i.settings.roof?.chimneys??[];if(t.length===0||e.length===0)return;let n=new Map(Ns(i).map(r=>[r.key,r]));for(let r of t){let s=n.get(r.face),o=s?am(e,s):void 0;if(!s||!o)continue;let a=o.floor.elevation+o.base,{shape:l,w:c,d:u,h}=Th(r),f=nm(s,r),[d,p]=[f.low-a-.1,f.high-a+h],x=(v,w)=>{let{center:R,along:T,across:C}=f,L=(O,P)=>[R[0]+T[0]*v*O+C[0]*w*P,R[1]+T[1]*v*O+C[1]*w*P];return[L(-1,-1),L(1,-1),L(1,1),L(-1,1)]},g=(v,w=16)=>Array.from({length:w},(R,T)=>[f.center[0]+Math.cos(T/w*2*Math.PI)*v,f.center[1]+Math.sin(T/w*2*Math.PI)*v]),m=(v,w)=>v.forEach((R,T)=>o.lines.seg([R[0],w,R[1]],[v[(T+1)%v.length][0],w,v[(T+1)%v.length][1]],x_)),y=(v,w,R,T,C)=>Tt(o.solid,CC(v),w,R,T,C);if(l==="steel"){let v=Math.min(c,u)/2;y(g(v,12),d,p,Rh,Ch),y(g(v*.75,12),p,p+.001,Vo,Vo),y(g(v*.25,6),p,p+.1,Rh,Ch);let w=g(v*1.9,12);y(w,p+.1,p+.13,Rh,Ch),m(w,p+.13);continue}if(l==="round"){let v=Math.min(c,u)/2,w=g(v);y(w,d,p,sm,om),y(g(v*.55),p,p+.002,Vo,Vo),m(w,p);continue}let _=x(c/2,u/2);y(_,d,p,sm,om);let b=x(c/2+.04,u/2+.04);y(b,p,p+.06,Eh,Eh),m(b,p+.06),m(_,p-.25);let M=Math.min(c,u)*.25,S=l==="wide"?[-c/4,c/4]:[0];for(let v of S){let w=[f.center[0]+f.along[0]*v,f.center[1]+f.along[1]*v],R=[[-1,-1],[1,-1],[1,1],[-1,1]].map(([T,C])=>[w[0]+f.along[0]*M*T+f.across[0]*M*C,w[1]+f.along[1]*M*T+f.across[1]*M*C]);y(R,p+.06,p+.16,Eh,Vo)}}}function CC(i){let e=0;for(let t=0;t0,r.b>0,r.u0>0,r.u1>0],f=(p,x,g,m,y,_)=>{let b=[t.at(p,g),t.at(x,g),t.at(x,m),t.at(p,m)],M=(b[1][0]-b[0][0])*(b[2][1]-b[0][1])-(b[2][0]-b[0][0])*(b[1][1]-b[0][1]);Tt(i,M<0?[...b].reverse():b,y-o,_-o,h_,f_,{bottom:!0})};for(let[p,x]of[[0,l],[a,c]]){if(!x)continue;let g=n.y(p)-.03,m=p===0?0:a-Qn;f(t.u0,t.u1,m,m+Qn,g-Ol,g),e.seg(s(t.u0,p,g-Ol),s(t.u1,p,g-Ol),yr)}for(let[p,x]of[[t.u0,u],[t.u1-Qn,h]])if(x)for(let g=0;g<6;g++){let[m,y]=[a*g/6,a*(g+1)/6],_=Math.min(n.y(m),n.y(y))-.03;f(p,p+Qn,m,y,_-Ol,_)}let d=[];for(let[p,x]of[[0,l],[a-Qn,c]]){if(!x)continue;let g=t.u1-t.u0-Qn,m=Math.max(1,Math.ceil(g/3.5));for(let y=0;y<=m;y++)y===0&&!u||y===m&&!h||d.push([t.u0+g*y/m,p])}!l&&!c&&(u&&d.push([t.u0,a/2-Qn/2]),h&&d.push([t.u1-Qn,a/2-Qn/2]));for(let[p,x]of d)f(p,p+Qn,x,x+Qn,o,n.y(x+Qn/2)-.03-Ol)}function PC(i,e){let t=[];if(i.forEach(([s,o],a)=>{o>=e&&t.push([s,o]);let l=i[a+1];if(l&&(o-e)*(l[1]-e)<0){let c=(e-o)/(l[1]-o);t.push([s+(l[0]-s)*c,e])}}),t.length<2)return[];let[n,r]=[t[0],t[t.length-1]];return r[1]>e&&t.push([r[0],e]),n[1]>e&&t.unshift([n[0],e]),t}var M_=i=>Sr(i)>=0?i:[...i].reverse();function S_(i,e,t,n,r,s=i,o=!1,a=[],l=null){let c=Dn(t),u=En(t),h=typeof n=="number"?{u0:n,u1:n,a:n,b:n}:n,[f,d]=[Math.max(0,h.a),Math.max(0,h.b)],p=c.w,x=c.u0-Math.max(0,h.u0),g=c.u1+Math.max(0,h.u1),m=(I,D,F)=>{let[H,B]=c.at(I,D);return[H,F-r,B]},y=new W(Ds),_=new W(Os),b=new W(Ah),M=(I,D)=>{for(let F=1;F+1m(I,D,F-H),v=[],w=[],R=[],T=null,C=null;if(t.shape==="flat"||t.shape==="parapet"){let I=t.eave_a-r,D=t.shape==="parapet",F=t.points&&t.points.length>=3?dp(t,D?0:Math.max(0,Math.min(h.a,h.b,h.u0,h.u1))):D?[c.at(c.u0,0),c.at(c.u1,0),c.at(c.u1,p),c.at(c.u0,p)]:[c.at(x,-f),c.at(g,-f),c.at(g,p+d),c.at(x,p+d)];if(Tt(i,F,I,I+.25,Os,Ds,{bottom:!0}),F.forEach((H,B)=>{let X=F[(B+1)%F.length];e.seg([H[0],I+.252,H[1]],[X[0],I+.252,X[1]],xr),e.seg([H[0],I,H[1]],[X[0],I,X[1]],yr)}),D){let H=M_(F),B=Hu(H,-.2);H.forEach((X,V)=>{let re=(V+1)%H.length;Tt(i,M_([X,H[re],B[re],B[V]]),I+.25,I+.65,Os,Ds),e.seg([X[0],I+.652,X[1]],[H[re][0],I+.652,H[re][1]],xr),e.seg([B[V][0],I+.652,B[V][1]],[B[re][0],I+.652,B[re][1]],xr)})}}else{let I=Wr(t,h);v=a.reduce((D,F)=>D.flatMap(H=>Wu(H,F)),I.faces),w=I.rim,R=I.ridges,T=I.gable,C=I.endProfiles??null}let L=!!t.open,O=new W(u_);for(let I of v)if(L)for(let D=1;D+1S(D)),y),M(I.map(D=>S(D,Xt)),_);if(w.forEach((I,D)=>{let F=w[(D+1)%w.length];L||M([S(I),S(F),S(F,Xt),S(I,Xt)],_),e.seg(S(I),S(F),L?xr:yr)}),L){__(i,e,c,u,h,(I,D,F)=>m(I,D,F),r);return}for(let[I,D]of R)e.seg(S([I[0],I[1],I[2]+.004]),S([D[0],D[1],D[2]+.004]),xr);let P=t.base;if(!o){if(T){let I=l===null?[c.u0,c.u1]:[l===0?c.u0:c.u1];for(let D of I){let F=C?C[D===c.u0?0:1]:T,H=F?PC(F,P-Xt):[];H.length>=3&&M(H.map(([B,X])=>m(D,B,X)),b)}}if(t.shape!=="flat"&&t.shape!=="parapet")for(let I of[0,p]){let D=u.y(I)-Xt;D>P+.02&&M([m(c.u0,I,P),m(c.u1,I,P),m(c.u1,I,D),m(c.u0,I,D)],b)}else if(t.eave_a>P+.02){let I=[[c.u0,0],[c.u1,0],[c.u1,p],[c.u0,p]];I.forEach(([D,F],H)=>{let[B,X]=I[(H+1)%4];M([m(D,F,P),m(B,X,P),m(B,X,t.eave_a),m(D,F,t.eave_a)],b)})}}}function w_(i,e,t){let n=i.floors.filter(o=>o.rooms.length>0).sort((o,a)=>o.elevation-a.elevation);if(n.length===0)return[];let r=new Map,s=new Map(Ns(i).map(o=>[o.key,o]));for(let o of e){if(Math.abs(o.x1-o.x0)<.1||Math.abs(o.z1-o.z0)<.1)continue;let a=gp(i,o)??n[0],l=o.open?`${a.id}:open`:a.id,c=r.get(l);c||r.set(l,c={floor:a,base:0,solid:new ut,lines:new Wt,glass:new ut,sections:[],lift:!o.open}),c.sections.push(o.id);let u=ml(e,o),h=Rs(e,o)??u?.parent??null,f=a.elevation+a.height>o.base+.05&&!o.dormer&&!h,d=e.filter(g=>g!==o).flatMap(g=>Rs(e,g)===o?Yu(o,g):ml(e,g)?.parent===o?Yu(o,ml(e,g).extended):[]);for(let g of i.settings.roof.windows??[]){let m=s.get(g.face),y=m&&m.section===o.id?Nl(m,g):null;if(!y)continue;let _=y.map(b=>Ni(o,b[0],b[2]));d.push({u0:Math.min(..._.map(b=>b[0])),u1:Math.max(..._.map(b=>b[0])),v0:Math.min(..._.map(b=>b[1])),v1:Math.max(..._.map(b=>b[1]))})}let p=u?u.extended:h?pl(h,o):o,x=null;if(h){let g=Dn(p),m=Wr(h,{u0:0,u1:0,a:0,b:0}),y=_=>{let[b,M]=g.at(_,g.w/2),[S,v]=Ni(h,b,M);return Es(m,S,v)??En(h).y(v)};x=y(g.u0)<=y(g.u1)?0:1}S_(c.solid,c.lines,p,dl(i,p,p.overhang??t),a.elevation,c.glass,f,d,x)}return[...r.values()].sort((o,a)=>+(o.lift===!1)-+(a.lift===!1))}function T_(i){return i.floors.filter(e=>e.rooms.some(t=>t.points.length>=3)).sort((e,t)=>t.elevation-e.elevation)[0]??null}function A_(i){let e=i.settings.roof,t=T_(i);if(!t||!e||e.type==="none"||e.type==="custom")return null;let n=t.rooms.flatMap(L=>L.points.map(O=>O[0])),r=t.rooms.flatMap(L=>L.points.map(O=>O[1])),s=i.settings.wall_exterior+e.overhang,[o,a]=[Math.min(...n)-s,Math.max(...n)+s],[l,c]=[Math.min(...r)-s,Math.max(...r)+s],u=new ut,h=new Wt,f={floor:t,base:t.height,solid:u,lines:h,glass:new ut};if(e.type==="flat"){let L=[[o,l],[a,l],[a,c],[o,c]];return Tt(u,L,0,.25,Os,Ds,{bottom:!0}),L.forEach(([O,P],I)=>{let[D,F]=L[(I+1)%4];h.seg([O,.252,P],[D,.252,F],xr),h.seg([O,0,P],[D,0,F],yr)}),f}let d=a-o>=c-l,p=e.ridge==="short"?!d:d,x=(p?c-l:a-o)/2,g=Math.tan(e.pitch*mt),m=x*g,y=(L,O,P)=>p?[L,P,(l+c)/2+O]:[(o+a)/2+O,P,L],[_,b]=p?[o,a]:[l,c],M=new W(Ds),S=new W(Os),v=(L,O,P,I,D)=>{u.tri(L,O,P,D),u.tri(L,P,I,D)};for(let L of[-1,1]){v(y(_,L*x,0),y(b,L*x,0),y(b,0,m),y(_,0,m),M),v(y(_,L*x,-Xt),y(_,0,m-Xt),y(b,0,m-Xt),y(b,L*x,-Xt),S),v(y(_,L*x,-Xt),y(b,L*x,-Xt),y(b,L*x,0),y(_,L*x,0),S);for(let O of[_,b])v(y(O,L*x,-Xt),y(O,L*x,0),y(O,0,m),y(O,0,m-Xt),S);h.seg(y(_,L*x,0),y(b,L*x,0),yr);for(let O of[_,b])h.seg(y(O,L*x,0),y(O,0,m),yr)}let w=e.overhang,R=new W(Ah),T=x-w,C=T*g;for(let L of[_+w,b-w])u.tri(y(L,-T,-Xt),y(L,T,-Xt),y(L,0,C-Xt),R),u.tri(y(L,T,-Xt),y(L,-T,-Xt),y(L,0,C-Xt),R);return h.seg(y(_,0,m+.004),y(b,0,m+.004),xr),f}function lm(i,e=new Map){let t=i.settings.roof,n=t?.type==="custom"?null:A_(i),r=t?.type==="custom"?w_(i,t.sections??[],t.overhang):n?[n]:[];return b_(i,r),y_(i,r,e),v_(i,r),r}function Lh(i){let{start:e,axis:t,width:n}=i.info;return[[e[0],e[1]],[e[0]+t[0]*n,e[1]+t[1]*n]]}var E_=(i,e)=>`${i}|${Math.round(e[0]*50)},${Math.round(e[1]*50)}`;function R_(i,e){let t=[];for(let n of i){let r=n.info.opening.front;if(!r)continue;let[s,o]=Lh(n);e.at(r,s)&&t.push(n.s0),e.at(r,o)&&t.push(n.s1)}return t}function C_(i,e){let t=Math.hypot(i.b[0]-i.a[0],i.b[1]-i.a[1])||1;return((e[0]-i.a[0])*(i.b[0]-i.a[0])+(e[1]-i.a[1])*(i.b[1]-i.a[1]))/t}function Fh(i){let e=new Map,t=new Map;for(let r of i)for(let s of r){let o=s.info.opening.front;if(o)for(let a of Lh(s)){let l=E_(o,a);e.set(l,(e.get(l)??0)+1),t.has(l)||t.set(l,[a[0],a[1]])}}return{points:[...e].filter(([,r])=>r>1).map(([r])=>t.get(r)).filter(r=>!!r),at:(r,s)=>(e.get(E_(r,s))??0)>1}}var Us={floor:923177,slab:659744,wall:1252657,wallTop:1323071,edge:3662079,edgeSoft:5995775},Nh={wood:{color:1120814,tile:[0,0]},oak:{color:1252141,tile:[1,0]},tiles:{color:923695,tile:[2,0]},carpet:{color:1053995,tile:[0,1]},stone:{color:988971,tile:[1,1]},concrete:{color:1120295,tile:[2,1]}},mi=.2,Ho=8;var P_=(i,e)=>i.heightEnd===void 0?i.height??e:Math.max(i.height??e,i.heightEnd);function I_(i){let e=new Map,t=[],n=new Map;for(let r of i){let s="interior",o=null;if(r.exterior){let[a,l]=[r.b[0]-r.a[0],r.b[1]-r.a[1]],c=Math.hypot(a,l)||1,u=[l/c,-a/c],h=(Math.round(Math.atan2(u[1],u[0])/(2*Math.PI)*Ho)%Ho+Ho)%Ho;s=`s${h}`;let f=h/Ho*2*Math.PI;o=[Math.cos(f),Math.sin(f)]}e.has(s)||(e.set(s,t.length),t.push(o)),n.set(r,e.get(s))}return{buckets:t,wallBucket:n}}function L_(i){let e=(n,r,s)=>{let o=i?i(n,r):null;return o===null?s:Math.max(.05,Math.min(s,o))};return{topAt:e,lowestTop:(n,r,s,o,a)=>{if(!i)return a;let l=Math.max(2,Math.ceil((o-s)/.25)+1),c=a;for(let u=0;ut.topAt(h,f,n),lowestTop:(h,f)=>t.lowestTop(i.a,s,h,f,n)};let[o,a]=[i.height??e,i.heightEnd],l=(h,f)=>{let d=r>1e-9?((h-i.a[0])*s[0]+(f-i.a[1])*s[1])/r:0;return o+(a-o)*Math.max(0,Math.min(1,d))},c=(h,f)=>t.topAt(h,f,l(h,f));return{H:n,varies:!0,topAt:c,lowestTop:(h,f)=>{let d=Math.max(2,Math.ceil((f-h)/.25)+1),p=1/0;for(let x=0;x0:c.roomLeft===o.room_id,m=[-h[1],h[0]],y=g?m:[-m[0],-m[1]],_=es(i.rooms.find(R=>R.id===o.room_id)),b=Math.min(Wo(c,i.height,n).lowestTop(p,p+d)-.02,_+o.sill+o.height),M=Math.max(Math.min(0,_),Math.min(_+o.sill,b-.1)),S=[y[1],-y[0]],v=h[0]*S[0]+h[1]*S[1]>0,w={opening:o,bucket:t.get(c),start:[c.a[0]+h[0]*p,c.a[1]+h[1]*p],axis:h,width:d,toRoom:y,faceRoom:g?c.left:c.right,faceOut:g?c.right:c.left,sill:M,top:b,hingeAtStart:o.hinge==="left"===v,exterior:c.exterior};s.push(w),r.set(c,[...r.get(c)??[],{s0:p,s1:p+d,sill:M,top:b,info:w}])}return{openings:s,spans:r}}var N_=i=>`${Math.round(i[0]*50)},${Math.round(i[1]*50)}`;function IC(i,e,t,n=!1,r=!1){let{info:s}=e,o=s.bucket,a=(u,h,f)=>[s.start[0]+s.axis[0]*(u-e.s0)+s.toRoom[0]*h,f,s.start[1]+s.axis[1]*(u-e.s0)+s.toRoom[1]*h],l=u=>u>t+1e-6?o:$e,c=e.sill<0?e.sill+.004:Math.max(e.sill,.004);for(let u of[s.faceRoom,-s.faceOut])n||i.segSplit(a(e.s0,u,c),a(e.s0,u,e.top),ui,t,o),r||i.segSplit(a(e.s1,u,c),a(e.s1,u,e.top),ui,t,o),i.seg(a(e.s0,u,e.top),a(e.s1,u,e.top),ui,l(e.top)),e.sill>.01&&i.seg(a(e.s0,u,e.sill),a(e.s1,u,e.sill),ui,l(e.sill));for(let[u,h]of[[e.s0,n],[e.s1,r]])h||(i.seg(a(u,s.faceRoom,e.top),a(u,-s.faceOut,e.top),ui,l(e.top)),e.sill>.01&&i.seg(a(u,s.faceRoom,e.sill),a(u,-s.faceOut,e.sill),ui,l(e.sill)),e.sillt&&i.seg(a(u,s.faceRoom,t),a(u,-s.faceOut,t),ku,ol+o))}function O_(i,e,t,n,r,s,o){let a=Math.min(e.cut_height,e.height),l=(f,d)=>(r.get(f)??[]).filter(d);for(let f of t.edges){let d=n.get(f.wall);for(let[m,y]of Io(f,l(f.wall,_=>_.sill<=.005)))i.seg([m[0],.004,m[1]],[y[0],.004,y[1]],Yd);for(let[m,y]of Io(f,l(f.wall,_=>_.silla)))i.seg([m[0],a,m[1]],[y[0],a,y[1]],ku,ol+d);let p=Wo(f.wall,e.height,s),{H:x,topAt:g}=p;for(let[m,y]of Io(f,l(f.wall,_=>_.top>=x-.021))){if(!o&&!p.varies){i.seg([m[0],x,m[1]],[y[0],x,y[1]],Li,x<=a+1e-6?hr+d:d);continue}let _=Math.max(1,Math.ceil(Math.hypot(y[0]-m[0],y[1]-m[1])/.3)),b=M=>[m[0]+(y[0]-m[0])*M/_,m[1]+(y[1]-m[1])*M/_];for(let M=0;M<_;M++){let[S,v]=[b(M),b(M+1)],[w,R]=[g(S[0],S[1]),g(v[0],v[1])];i.seg([S[0],w,S[1]],[v[0],R,v[1]],Li,Math.max(w,R)<=a+1e-6?hr+d:d)}}}let c=Fh(r.values()),u=new Set(c.points.map(N_)),h=new Map;for(let[f,d]of r)h.set(f,R_(d,c));for(let f of t.corners){let d=C_(f.wall,f.p),x=(r.get(f.wall)??[]).some(y=>!!y.info.opening.front&&d>y.s0+.05&&dMath.abs(y-d)<.06);if(x||g||u.has(N_(f.p)))continue;let m=Wo(f.wall,e.height,s).topAt(f.p[0],f.p[1]);i.segSplit([f.p[0],.004,f.p[1]],[f.p[0],m,f.p[1]],ui,Math.min(a,m),n.get(f.wall))}for(let f of r.values())for(let d of f){let p=d.info.opening.front,[x,g]=Lh(d);IC(i,d,a,p?c.at(p,x):!1,p?c.at(p,g):!1)}}function D_(i,e){let t=new ut(!0,!0),n=[],r=new Wt,s=[],o=new W(Us.slab),a=(l,c=0,u=c-mi)=>{l.forEach((h,f)=>{let d=l[(f+1)%l.length];t.tri([h[0],u,h[1]],[h[0],c,h[1]],[d[0],c,d[1]],o),t.tri([h[0],u,h[1]],[d[0],c,d[1]],[d[0],u,d[1]],o)})};for(let l of i.rooms){if(l.points.length<3)continue;let c=Hr(l.points),u=Nh[l.floor_material]??Nh.wood,h=new W(u.color),f=e.filter(g=>Ib(g,c)).map(g=>Lb(g,.003));s.push(...f);let d=[...c,...f.flat()],p=t.count,x=es(l);for(let[g,m,y]of Gr(c,f)){let[_,b,M]=[d[g],d[m],d[y]];t.tri([_[0],x,_[1]],[M[0],x,M[1]],[b[0],x,b[1]],h,h,h,[_[0],_[1],M[0],M[1],b[0],b[1]],$e,u.tile)}n.push({roomId:l.id,start:p,end:t.count,color:u.color}),a(c,x),Math.abs(x)>.005&&(a(c,Math.max(0,x),Math.min(0,x)),a([...c].reverse(),Math.max(0,x),Math.min(0,x)));for(let g of f)a([...Hr(g)].reverse()),g.forEach((m,y)=>{let _=g[(y+1)%g.length];r.seg([m[0],x+.006,m[1]],[_[0],x+.006,_[1]],Li),r.seg([m[0],x-mi,m[1]],[_[0],x-mi,_[1]],ui)})}return{buffer:t,roomTris:n,holeLines:r,cutHoles:s}}var Oh=.42,cm=.42;function U_(i,e,t){let n=new ut,r=new W(cm,cm,cm),s=new W(1,1,1),o=.002;for(let a of i)for(let[l,c]of Io(a,(t.get(a.wall)??[]).filter(u=>u.sill<=.005))){let[u,h]=[c[0]-l[0],c[1]-l[1]],f=Math.hypot(u,h);if(f<.05)continue;let d=[h/f,-u/f],p=[(l[0]+c[0])/2+d[0]*.05,(l[1]+c[1])/2+d[1]*.05];if(!e.some(m=>m.points.length>=3&&Ge(p,m.points)))continue;let x=[l[0]+d[0]*Oh,l[1]+d[1]*Oh],g=[c[0]+d[0]*Oh,c[1]+d[1]*Oh];n.tri([l[0],o,l[1]],[x[0],o,x[1]],[g[0],o,g[1]],r,s,s),n.tri([l[0],o,l[1]],[g[0],o,g[1]],[c[0],o,c[1]],r,s,r)}return n}var um=(i,e)=>Number.parseInt(/^#?([0-9a-f]{6})$/i.exec(i?.trim()??"")?.[1]??e.slice(1),16),LC=i=>/^#?[0-9a-f]{6}$/i.test(i?.trim()??"");function hm(i,e){return{outside:um(LC(e.wall_paint_outside)?e.wall_paint_outside:i.wall_paint_outside,k0),inside:um(i.wall_paint_inside,lf),rooms:e.rooms.filter(t=>t.wall_paint&&t.points.length>=3).map(t=>({points:t.points,color:um(t.wall_paint,lf)}))}}var FC=14276045;function NC(i,e,t,n,r){let s=Math.hypot(t[0]-e[0],t[1]-e[1])||1,o=[(e[0]+t[0])/2,(e[1]+t[1])/2],a=[(t[1]-e[1])/s,-(t[0]-e[0])/s];Ge([o[0]+a[0]*.01,o[1]+a[1]*.01],i)&&(a=[-a[0],-a[1]]);let l=[o[0]+a[0]*.06,o[1]+a[1]*.06],c=n.rooms.find(u=>Ge(l,u.points));return c?c.color:r.some(u=>u.points.length>=3&&Ge(l,u.points))?n.inside:n.outside}function OC(i,e,t=-mi){let n=[-1/0,...new Set(i.flatMap(s=>[s.s0,s.s1])).values(),1/0].sort((s,o)=>s-o),r=[];for(let s=0;s+1f.s0l).map(f=>[f.sill,f.top]).sort((f,d)=>f[0]-d[0]),u=[],h=t;for(let[f,d]of c)f>h+1e-4&&u.push([h,f]),h=Math.max(h,d);e>h+1e-4&&u.push([h,e]),r.push({t0:o,t1:a,ranges:u})}return r}function B_(i,e,t,n,r,s,o,a){let l=Math.min(e.cut_height,e.height),c=a?Kd:0,u=a?g=>(m,y)=>NC(g,m,y,a,e.rooms):null,h=a?FC:Us.wallTop,f=Fh(r.values()),d=g=>f.points.some(m=>Math.hypot(m[0]-g[0],m[1]-g[1])<.03),p=g=>g&&g.info.opening.front?[g.sill,g.top]:null,x=(g,m)=>{let y=[];for(let[_,b]of g)m[0]>_+1e-4&&y.push([_,Math.min(b,m[0])]),b>m[1]+1e-4&&y.push([Math.max(_,m[1]),b]);return y};for(let g of t){let m=n.get(g),y=Ms([g.b[0]-g.a[0],g.b[1]-g.a[1]]),_=(r.get(g)??[]).sort((I,D)=>I.s0-D.s0),b=Wo(g,e.height,s),{H:M,topAt:S}=b,v=Math.min(0,...[g.roomLeft,g.roomRight].map(I=>es(e.rooms.find(D=>D.id===I)))),w=OC(_,M,v-mi),R=Math.hypot(g.b[0]-g.a[0],g.b[1]-g.a[1]),T=(o||b.varies)&&b.lowestTop(0,R){let D=Math.max(I.t0,-.5),F=Math.min(I.t1,R+.5),H=Math.max(1,Math.ceil((F-D)/.3));return Array.from({length:H},(B,X)=>({t0:X===0?I.t0:D+(F-D)*X/H,t1:X===H-1?I.t1:D+(F-D)*(X+1)/H,ranges:I.ranges,inner0:X>0,inner1:X({...I,inner0:!1,inner1:!1})),L=I=>(I[0]-g.a[0])*y[0]+(I[1]-g.a[1])*y[1],O=d(g.a)?p(_[0]):null,P=d(g.b)?p(_[_.length-1]):null;for(let I of C){let D=ip(g.footprint,g.a,y,I.t0,I.t1);if(D.length<3)continue;let F=I.t1<=1e-6&&I.t0<0?O:I.t0>=R-1e-6?P:null,H=F?x(I.ranges,F):I.ranges,B=(Y,Q)=>Math.abs(L(Y)-Q)<1e-4,X=(Y,Q)=>I.inner0&&B(Y,I.t0)&&B(Q,I.t0)||I.inner1&&B(Y,I.t1)&&B(Q,I.t1),V=(Y,Q)=>!f.points.length||Math.hypot(Y[0]-Q[0],Y[1]-Q[1])>.5?!1:f.points.some(se=>Math.min(Math.hypot(se[0]-Y[0],se[1]-Y[1]),Math.hypot(se[0]-Q[0],se[1]-Q[1]))<.05),re=(Y,Q)=>X(Y,Q)||V(Y,Q),ye=T?Math.min(...D.map(([Y,Q])=>S(Y,Q))):M;for(let[Y,Q]of H){let se=Math.min(Q,T?Math.max(...D.map(([at,Ae])=>S(at,Ae))):Q);if(se-Y<1e-4||ye-Y<.01)continue;let we=Y>.01,le=T&&Q>ye,Ne=(at,Ae)=>Math.min(Q,S(at,Ae));if(Yl+1e-6?$d+m:hr+m,Ae=le&&yeMath.min(l,Ne(ft,yt)):Math.min(se,l);Tt(i,D,Y,Ae,Us.wall,h,{aoFrom:0,bottom:we,fold:c+hr+m,topFold:c+at,skipSide:re,sideColor:u?.(D)})}se>l+1e-6&&ye>l+1e-6&&Tt(i,D,Math.max(Y,l),le?Ne:se,Us.wall,h,{aoFrom:0,fold:c+m,bottom:we&&Y>=l,skipSide:re,sideColor:u?.(D)})}}}}function fm(i,e,t,n=[],r=[],s,o){let{walls:a,open:l}=fl(i.rooms,{exterior:e,interior:t},i.walls??[]),c=L_(s),u=!!s,h=D_(i,n),{buckets:f,wallBucket:d}=I_(a),{openings:p,spans:x}=F_(i,a,d,c),g=new ut;B_(g,i,a,d,x,c,u,o);let m=rp(a,a.flatMap(v=>v.footprint)),y=new Wt;y.p.push(...h.holeLines.p),y.c.push(...h.holeLines.c),y.f.push(...h.holeLines.f),O_(y,i,m,d,x,c,u);let _=U_(m.edges,i.rooms,x),b=new Map;Ap(g,y,i,b,()=>new ut);for(let v of r)Ih(g,y,v.face,v.field,i.elevation);let M=Math.min(i.cut_height,i.height),S=[];for(let v of i.furniture.filter(w=>!V0(w.type))){let w=g.count,R=y.p.length/6,T=Gt(i,v);Xl(v.type)||Il(g,y,_,v,T),T+v.h>M+.05&&(Jd(g,w,M,zu),jd(y,R,M,zu)),S.push({id:v.id,start:w,end:g.count})}return{floor:h.buffer.geometry(),roomTris:h.roomTris,holes:h.cutHoles,walls:g.geometry(),ghosts:[...b].map(([v,w])=>({opacity:v,geometry:w.geometry()})),lines:y.geometry(),shadow:_.geometry(),buckets:f,openings:p,walls2d:a,openRooms:l,wallBuckets:a.map(v=>d.get(v)),furnitureTris:S,roofUnder:s}}function dm(i,e){let t=H0(i,e),n=[...e.furniture.filter(a=>a.type==="stairwell").map(ns),...e.furniture.filter(a=>lh(a)&&a.stair?.down).flatMap(Op)].filter(a=>a.length>=3),r=i.filter(a=>a.elevationl.elevation-a.elevation)[0];if(!r)return pr([...n,...t]);let o=r.furniture.filter(a=>(a.type==="stairs"||_t(a.type)?.hole)&&!(lh(a)&&a.stair?.down)&&r.elevation+a.h>=e.elevation-.3).flatMap(a=>lh(a)?Op(a):[ns(a)]).filter(a=>a.length>=3);return pr([...n,...o,...t])}var k_=.12,z_=1.35,Ui=(i,e,t)=>Math.min(t,Math.max(e,i)),DC=i=>i<.5?4*i*i*i:1-(-2*i+2)**3/2,V_=i=>({...i,target:i.target.clone()});function G_({target:i,radius:e,theta:t,phi:n}){return new U(i.x+e*Math.sin(n)*Math.sin(t),i.y+e*Math.cos(n),i.z+e*Math.sin(n)*Math.cos(t))}function H_(i,e,t){let n=DC(t);return{target:new U().lerpVectors(i.target,e.target,n),radius:i.radius+(e.radius-i.radius)*n,theta:i.theta+(e.theta-i.theta)*n,phi:i.phi+(e.phi-i.phi)*n}}function W_(i,e){let t=e.theta??i.theta;for(;t-i.theta>Math.PI;)t-=2*Math.PI;for(;t-i.theta<-Math.PI;)t+=2*Math.PI;return{target:(e.target??i.target).clone(),radius:e.radius??i.radius,theta:t,phi:e.phi??i.phi}}function pm(i,e,t,n,r){let s=2*i.radius*Math.tan(r*Math.PI/360)/(n||1),o=new U(Math.cos(i.theta),0,-Math.sin(i.theta)),a=new U(-Math.sin(i.theta),0,-Math.cos(i.theta));i.target.addScaledVector(o,-e*s),i.target.addScaledVector(a,t*s/Math.max(.35,Math.cos(i.phi)))}function X_(i,e,t,n){let r=n||1,s={theta:-e/r*3.2,phi:-t/r*2.4};return i.theta+=s.theta,i.phi=Ui(i.phi+s.phi,k_,z_),s}function Y_(i,e){return Math.abs(e.theta)<=1e-4&&Math.abs(e.phi)<=1e-4?!1:(i.theta+=e.theta,i.phi=Ui(i.phi+e.phi,k_,z_),e.theta*=.9,e.phi*=.9,!0)}var UC={KeyW:"w",KeyA:"a",KeyS:"s",KeyD:"d",KeyQ:"q",KeyE:"e"},BC=new Set(["w","a","s","d","q","e","arrowup","arrowdown","arrowleft","arrowright"]);function kC(i){let e=i.code?.startsWith("Key")?UC[i.code]??null:i.key.toLowerCase();return e&&BC.has(e)?e:null}var zC=500,VC=400,GC=320,HC=6,q_=1.5,WC=1.8;function XC(i,e){let t=i.keys,n=(t.has("w")||t.has("arrowup")?1:0)-(t.has("s")||t.has("arrowdown")?1:0)-i.stick[1],r=(t.has("d")?1:0)-(t.has("a")?1:0),s=(t.has("arrowleft")||t.has("q")?1:0)-(t.has("arrowright")||t.has("e")?1:0)-i.stick[0];if(!n&&!r&&!s)return!1;let o=e/1e3;i.yaw+=s*WC*o;let[a,l]=[-Math.sin(i.yaw),-Math.cos(i.yaw)],[c,u]=[Math.cos(i.yaw),-Math.sin(i.yaw)];return i.eye.x=Ui(i.eye.x+(a*n+c*r)*q_*o,i.bounds.x0,i.bounds.x1),i.eye.z=Ui(i.eye.z+(l*n+u*r)*q_*o,i.bounds.z0,i.bounds.z1),!0}var Dl=class{view={target:new U,radius:16,theta:-.6,phi:.85};minRadius=2;maxRadius=80;locked=!1;walk=null;pointers=new Map;velocity={theta:0,phi:0};flight=null;press=null;lastTap=0;holdTimer;held=!1;grabbing=!1;swiping=null;pinch=null;listeners=[];el;camera;events;constructor(e,t,n){this.el=e,this.camera=t,this.events=n;let r=(l,c,u)=>{e.addEventListener(l,c,u),this.listeners.push([l,c])};r("pointerdown",l=>this.onDown(l)),r("pointermove",l=>this.onMove(l)),r("pointerup",l=>this.onUp(l)),r("pointercancel",l=>this.onUp(l)),r("wheel",l=>this.onWheel(l),{passive:!1}),r("contextmenu",l=>l.preventDefault());let s=l=>c=>{if(!this.walk||c.target?.closest?.("input, textarea, select"))return;let u=kC(c);u&&(c.preventDefault(),l?this.walk.keys.add(u):this.walk.keys.delete(u),this.events.change())},o=s(!0),a=s(!1);window.addEventListener("keydown",o),window.addEventListener("keyup",a),this.listeners.push(["__window_keydown",o],["__window_keyup",a])}dispose(){clearTimeout(this.holdTimer);for(let[e,t]of this.listeners)e.startsWith("__window_")?window.removeEventListener(e.slice(9),t):this.el.removeEventListener(e,t)}get active(){return this.pointers.size>0||this.flight!==null}get busy(){return this.active}update(e){if(this.walk){let n=this.walk,r=XC(n,n.last?Math.min(100,e-n.last):16);n.last=r?e:0;let s=new U(-Math.sin(n.yaw)*Math.cos(n.pitch),Math.sin(n.pitch),-Math.cos(n.yaw)*Math.cos(n.pitch));return this.view.target.copy(n.eye).add(s),this.camera.position.copy(n.eye),this.camera.lookAt(this.view.target),r}let t=!1;if(this.flight){let{from:n,to:r,start:s,duration:o}=this.flight,a=Math.min(1,(e-s)/o);this.view=H_(n,r,a),a>=1&&(this.flight=null),t=!0}else this.pointers.size===0&&(t=Y_(this.view,this.velocity));return this.camera.position.copy(G_(this.view)),this.camera.lookAt(this.view.target),t}flyTo(e,t=700){let n=W_(this.view,e),r=V_(this.view);this.velocity={theta:0,phi:0},t<=0||matchMedia("(prefers-reduced-motion: reduce)").matches?(this.view=n,this.flight=null):this.flight={from:r,to:n,start:performance.now(),duration:t},this.events.change()}local(e){let t=this.el.getBoundingClientRect();return[e.clientX-t.left,e.clientY-t.top]}stopMotion(){this.flight=null,this.velocity={theta:0,phi:0}}onDown(e){this.el.setPointerCapture(e.pointerId);let t=this.pointers.size===0;if(this.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY,button:e.button}),this.stopMotion(),t&&e.button===0&&this.events.grab?.(...this.local(e))){this.grabbing=!0;return}if(clearTimeout(this.holdTimer),this.held=!1,this.pointers.size===1){this.press={x:e.clientX,y:e.clientY,time:performance.now(),moved:!1};let[n,r]=this.local(e);this.holdTimer=setTimeout(()=>{!this.press||this.press.moved||this.pointers.size!==1||(this.held=!0,this.events.hold(n,r))},zC)}else this.press=null,this.pinch=this.pinchState()}onMove(e){let t=this.pointers.get(e.pointerId);if(!t)return;if(this.grabbing)return void this.events.drag?.(...this.local(e));if(this.swiping)return void this.events.swipeMove?.(e.clientY-this.swiping.startY);let[n,r]=[e.clientX-t.x,e.clientY-t.y];if(this.press&&!this.press.moved&&Math.hypot(e.clientX-this.press.x,e.clientY-this.press.y)>HC){this.press.moved=!0,clearTimeout(this.holdTimer);let[s,o]=this.local({clientX:this.press.x,clientY:this.press.y});if(this.pointers.size===1&&t.button===0&&!e.shiftKey&&this.events.swipeStart?.(s,o,e.clientX-this.press.x,e.clientY-this.press.y))return this.swiping={startY:this.press.y},this.velocity={theta:0,phi:0},void this.events.swipeMove?.(e.clientY-this.press.y)}if(this.locked){[t.x,t.y]=[e.clientX,e.clientY];return}if(this.walk){if(!(this.press&&!this.press.moved)&&this.pointers.size===1){let s=this.el.clientHeight||1;this.walk.yaw+=n/s*2.4,this.walk.pitch=Ui(this.walk.pitch+r/s*1.8,-1.1,1.1),this.events.change()}[t.x,t.y]=[e.clientX,e.clientY];return}if(this.pointers.size===1)this.press&&!this.press.moved||(t.button===1||t.button===2||e.shiftKey?pm(this.view,n,r,this.el.clientHeight,this.camera.fov):this.velocity=X_(this.view,n,r,this.el.clientHeight)),[t.x,t.y]=[e.clientX,e.clientY];else{[t.x,t.y]=[e.clientX,e.clientY];let s=this.pinchState();this.pinch&&s&&(this.zoom(this.pinch.dist/Math.max(1,s.dist)),pm(this.view,s.mid[0]-this.pinch.mid[0],s.mid[1]-this.pinch.mid[1],this.el.clientHeight,this.camera.fov)),this.pinch=s}this.pointers.size===1&&this.press&&!this.press.moved||this.events.change()}onUp(e){if(this.pointers.has(e.pointerId)){if(this.pointers.delete(e.pointerId),this.grabbing)return this.grabbing=!1,void this.events.drop?.();if(this.swiping)return this.swiping=null,this.press=null,void this.events.swipeEnd?.();if(this.pointers.size<2&&(this.pinch=null),clearTimeout(this.holdTimer),this.held)this.held=!1,this.press=null;else if(this.press&&!this.press.moved&&e.type==="pointerup"&&performance.now()-this.press.timea*n);return{id:`${i.id}:vehicle`,type:e,x:i.x,z:i.z,rotation:i.rotation,w:r,d:s,h:o,variant:i.variant??null,entity:null,power:null}}function Dh(i,e){let t=[],n=!1;for(let r of i.furniture){t.push(r);let s=r.type==="parking"?e.get(r.id):void 0,o=s?YC(r,s):null;o&&(t.push(o),n=!0)}return n?{...i,furniture:t}:i}var qC="https://tile.openstreetmap.org/{z}/{x}/{y}.png";var $C=40075016686e-3,Uh=Math.PI/180,KC=18,ZC=.5,JC=160;function jC(i,e,t){let n=2**t,r=(e+180)/360*n,s=(1-Math.log(Math.tan(i*Uh)+1/Math.cos(i*Uh))/Math.PI)/2*n;return[r,s]}var QC=(i,e)=>$C*Math.cos(i*Uh)/2**e;function $_(i,e,t,n=JC){let[r,s]=jC(i,e,t),o=QC(i,t),a=n/o,l=2**t-1,c=[];for(let u=Math.floor(s-a);u<=Math.floor(s+a);u++)for(let h=Math.floor(r-a);h<=Math.floor(r+a);h++){if(u<0||u>l)continue;let f=(h%(l+1)+l+1)%(l+1);c.push({x:f,y:u,z:t,east:(h-r)*o,north:-(u-s)*o,size:o})}return c}function K_(i,e){return i.replace("{z}",String(e.z)).replace("{x}",String(e.x)).replace("{y}",String(e.y)).replace("{s}","abc"[(e.x+e.y)%3])}var Z_=i=>i.url&&i.url.startsWith("https://")?i.url:qC;function J_(i,e,t,n){let r=t*Uh;return[n.x+i*Math.cos(r)+e*Math.sin(r),n.z+i*Math.sin(r)-e*Math.cos(r)]}var j_=i=>!!i&&i.on===!0&&Number.isFinite(i.lat)&&Number.isFinite(i.lon),Q_=i=>({x:i.x??0,z:i.z??0,opacity:i.opacity??ZC,zoom:i.zoom??KC});var eP="strict-origin-when-cross-origin",mm=new Map;function eM(i){let e=mm.get(i);return e||(e=fetch(i,{referrerPolicy:eP,mode:"cors",credentials:"omit"}).then(async t=>t.ok&&(t.headers.get("content-type")??"").startsWith("image/")?await t.blob():null).catch(()=>null).then(t=>(t||setTimeout(()=>mm.delete(i),6e4),t)),mm.set(i,e)),e}var Xo=256,tP=Math.PI/180,Bh=class{mesh=new Se(new sn(1,1),new Ye({transparent:!0,depthWrite:!1,side:ht}));canvas=null;texture=null;key="";generation=0;centre=[0,0];onChange=()=>{};scene;constructor(e){this.scene=e,this.mesh.rotation.order="YXZ",this.mesh.renderOrder=-2,this.mesh.visible=!1,this.mesh.name="live-map",e.add(this.mesh)}set(e,t,n,r=1){if(!j_(e)){this.mesh.visible=!1,this.generation++,this.key="";return}let s=Q_(e),o=Z_(e),a=`${e.lat},${e.lon},${s.zoom},${o}`;a!==this.key&&this.load(a,e,s.zoom,o);let[l,c]=this.centre,[u,h]=J_(l,c,t,s);this.mesh.position.set(u,n,h),this.mesh.rotation.set(-Math.PI/2,-t*tP,0);let f=this.mesh.material;f.opacity=s.opacity,f.color.setScalar(r),this.mesh.visible=this.canvas!==null}load(e,t,n,r){this.key=e;let s=++this.generation,o=$_(t.lat,t.lon,n);if(!o.length)return;let a=o[0].size,l=Math.min(...o.map(x=>x.east)),c=Math.max(...o.map(x=>x.north)),u=Math.round((Math.max(...o.map(x=>x.east))-l)/a)+1,h=Math.round((c-Math.min(...o.map(x=>x.north)))/a)+1,f=document.createElement("canvas");f.width=u*Xo,f.height=h*Xo,this.canvas=f,this.texture?.dispose(),this.texture=new zt(f),this.texture.colorSpace=dt,this.texture.anisotropy=4;let d=this.mesh.material;d.map=this.texture,d.needsUpdate=!0,this.mesh.geometry.dispose(),this.mesh.geometry=new sn(u*a,h*a),this.centre=[l+u*a/2,c-h*a/2];let p=f.getContext("2d");if(p)for(let x of o)this.draw(p,x,r,s,Math.round((x.east-l)/a),Math.round((c-x.north)/a))}draw(e,t,n,r,s,o){eM(K_(n,t)).then(a=>a?createImageBitmap(a):null).then(a=>{!a||r!==this.generation||(e.drawImage(a,s*Xo,o*Xo,Xo,Xo),this.texture&&(this.texture.needsUpdate=!0),this.onChange())})}dispose(){this.generation++,this.scene.remove(this.mesh),this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.texture?.dispose()}};var nP=globalThis,tM=nP.__nextfloorPluginStore??={plugins:new Map,listeners:new Set},iP=tM.plugins,tz=tM.listeners;var rP=5;function sP(i,e){i.errors.lengthNumber.isFinite(a))&&Number.isFinite(r.level)))return i;let o=a=>Math.max(0,Math.min(1,a));return{color:[o(r.color[0]),o(r.color[1]),o(r.color[2])],level:o(r.level)}}catch(r){return sP(n.status,r),i}}var iM={rainbow:(i,e)=>{let t=(e*.08%1+1)%1,n=r=>Math.max(0,Math.min(1,Math.abs((t*6+r)%6-3)-1));return{color:[n(0),n(4),n(2)],level:i.level}},flicker:(i,e)=>({...i,level:i.level*(.75+.15*Math.sin(e*17)+.1*Math.sin(e*31+1))}),pulse:(i,e)=>({...i,level:i.level*(.65+.35*Math.sin(e*Math.PI))})};function rM(i,e,t){return!i||!e?i:Object.prototype.hasOwnProperty.call(iM,e)?iM[e]?.(i,t)??i:nM(i,e,t)}var Yo=2043986,Xr=2769520,sM=2242399,kh=1845831,oM=1450554,gi=16758087,aM=1846349,lM=2572395,cM=1120816,uM=1845831,hM=3662079,fM=5995775,dM=9085695,Yr=ke(3662079,.08),pM=1.2,mM=1.5,gM=.2,xM=.52;function zh(i,e,t,n,r,s){let o=(x,g,m)=>e(x,g,m),{x0:a,x1:l,n0:c,n1:u,y0:h,y1:f}=t,d=x=>ke(n.getHex(),x),p=[[o(a,c,f),o(l,c,f),o(l,u,f),o(a,u,f),r],[o(a,c,h),o(l,c,h),o(l,u,h),o(a,u,h),d(.6)],[o(a,u,h),o(l,u,h),o(l,u,f),o(a,u,f),n],[o(a,c,h),o(l,c,h),o(l,c,f),o(a,c,f),d(.85)],[o(a,c,h),o(a,u,h),o(a,u,f),o(a,c,f),d(.92)],[o(l,c,h),o(l,u,h),o(l,u,f),o(l,c,f),d(.92)]];for(let[x,g,m,y,_]of p)i.tri(x,g,m,_,_,_,void 0,s),i.tri(x,m,y,_,_,_,void 0,s)}function Vt(i,e,t,n,r,{cut:s,bucket:o}){if(t.y1<=s+1e-6)return zh(i,e,t,n,r,$e);if(t.y0>=s-1e-6)return zh(i,e,t,n,r,o);zh(i,e,{...t,y1:s},n,r,$e),zh(i,e,{...t,y0:s},n,r,o)}function ei(i,e,t,n,r,s,o,a,{cut:l,bucket:c},u=0){let h=(f,d,p)=>{let x=b=>u?(o-b)/u:.5,[g,m,y,_]=[e(t,r,f),e(n,r,f),e(n,r,d),e(t,r,d)];i.tri(g,m,y,a,a,a,[0,x(f),1,x(f),1,x(d)],p),i.tri(g,y,_,a,a,a,[0,x(f),1,x(d),0,x(d)],p)};o<=l+1e-6?h(s,o,$e):s>=l-1e-6?h(s,o,c):(h(s,l,$e),h(l,o,c))}function yM(i,e,t,n,r,s,o,a,l,c){let[u,h,f,d]=[e(t,r,o),e(n,r,o),e(n,s,o),e(t,s,o)],p=(s-r)/c;i.tri(u,h,f,a,a,a,[0,0,1,0,1,p],l),i.tri(u,f,d,a,a,a,[0,0,1,p,0,p],l)}var aP=16777215,lP=13225686,cP=15722456,bM=.08,vM=.085;function _M(i){let{info:e,state:t,frame:n,fold:r}=i;if(t.cover===null)return;let[s,o,a]=[e.width,e.sill,e.top],l=e.opening.blind??"roller",c=-e.faceOut,u=e.faceRoom;l==="inside"?Vt(i.frames,n,{x0:-.03,x1:s+.03,n0:u,n1:u+.07,y0:a-.02,y1:a+.07},new W(15921906),new W(16250871),r):Vt(i.frames,n,{x0:-.05,x1:s+.05,n0:c-.15,n1:c,y0:a,y1:a+.2},new W(oM),new W(Xr),r);let h=t.cover2!=null?[[0,s/2,t.cover,t.slats??0],[s/2,s,t.cover2,t.slats2??t.slats??0]]:[[0,s,t.cover,t.slats??0]];for(let[f,d,p,x]of h){let g=Math.min(1,Math.max(0,p));if(g<=.01)continue;let m=a-g*(a-o);l==="inside"?ei(i.blinds,n,f+.01,d-.01,u+.04,m,a-.02,new W(cP),r):l==="venetian"?uP(i,f,d,c-.07,m,a,x):ei(i.blinds,n,f,d,c-.07,m,a,new W(aP),r,.045)}}function uP(i,e,t,n,r,s,o){let{frame:a,fold:l}=i,c=new W(lP),u=Math.PI/2*(.12+.88*Math.min(1,Math.max(0,o))),h=Math.sin(u)*vM/2,f=Math.cos(u)*vM/2;for(let d=s-bM/2;d>r;d-=bM){let p=d>=l.cut?l.bucket:$e,[x,g,m,y]=[a(e,n-h,d+f),a(t,n-h,d+f),a(t,n+h,d-f),a(e,n+h,d-f)];i.blinds.tri(x,g,m,c,c,c,[0,.5,1,.5,1,.5],p),i.blinds.tri(x,m,y,c,c,c,[0,.5,1,.5,0,.5],p)}}function MM(i){let{info:e,state:t,frame:n,fold:r}=i,[s,o,a]=[e.width,e.top,Math.min(0,e.sill)],l=e.opening.type==="garage"&&(i.markClosed?!!t.sensed&&(t.cover??1)>=.95:(t.cover??1)<.95),c=l?ke(gi,.8):new W(Yo),u=l?ke(gi,1):new W(Xr),[h,f]=[-e.faceOut-.012,e.faceRoom+.012],d=(p,x,g)=>Vt(i.frames,n,{x0:p,x1:x,n0:h,n1:f,y0:g,y1:o+.045},c,u,r);d(-.045,.02,a),d(s-.02,s+.045,a),d(.02,s-.02,o-.02)}function SM(i){let{info:e,state:t,frame:n,fold:r,mid:s}=i,[o,a,l]=[e.width,e.top,Math.min(0,e.sill)],c=a-l,u=Mr(e.opening,e.exterior),h=u==="passage",f=q0(u),d=e.opening.swing==="out"?-1:1,p=d>0?e.faceRoom:-e.faceOut,x=e.opening.leaves===2,g=new W(Yo),m=new W(Xr),y=.02,_=o-.02,b=Y0(o,u,e.hingeAtStart,e.opening);if(b){for(let[R,T]of b.panels){let C=(L,O,P,I)=>Vt(i.frames,n,{x0:L,x1:O,n0:s-.03,n1:s+.03,y0:P,y1:I},g,m,r);C(R,R+.04,l+.02,a-.02),C(T-.04,T,l+.02,a-.02),C(R,T,l+.02,l+.1),ei(i.glass,n,R+.04,T-.04,s,l+.1,a-.02,Yr,r)}y=b.x0,_=b.x1}let M=x?(_-y)/2-.004:_-y,S=f?.06:.04;f&&(Vt(i.frames,n,{x0:.02,x1:o-.02,n0:-e.faceOut-.02,n1:e.faceRoom,y0:l,y1:l+.02},new W(kh),m,r),e.exterior&&Vt(i.frames,n,{x0:o/2-.08,x1:o/2+.08,n0:-e.faceOut-.1,n1:-e.faceOut,y0:a+.1,y1:a+.17},ke(gi,.55),ke(gi,.85),{cut:r.cut,bucket:$e}));let v=e.opening.open_angle?Math.min(180,Math.max(5,e.opening.open_angle))*mt:mM,w=h?[]:[[e.hingeAtStart,t.open]];x&&!h&&w.push([!e.hingeAtStart,t.open2??0]);for(let[R,T]of w){let C=Math.min(1,Math.max(0,T)),L=u==="sliding"?0:C*v,O=u==="sliding"?C*M:0,P=(Q,se,we)=>{let le=Q*Math.cos(L)-se*Math.sin(L)-O,Ne=p+d*(se*Math.cos(L)+Q*Math.sin(L)+(O?.05:0));return n(R?y+le:_-le,Ne,we)},I={cut:r.cut,bucket:C>.05?$e:r.bucket},D=i.markClosed?!!t.sensed&&C<.05:C>.9&&!(R===e.hingeAtStart&&t.assumed),F=D?ke(gi,.7):new W(f?cM:aM),H=D?ke(gi,.9):new W(f?uM:lM),B=(Q,se,we,le,Ne=-S,at=0)=>Vt(i.frames,P,{x0:Q,x1:se,n0:Ne,n1:at,y0:we,y1:le},F,H,I);u==="glass"?(B(0,.05,l+.01,a-.01),B(M-.05,M,l+.01,a-.01),B(.05,M-.05,l+.01,l+.12),B(.05,M-.05,a-.08,a-.01),ei(i.glass,P,.05,M-.05,-S/2,l+.12,a-.08,Yr,I)):B(0,M,l+.01,a-.01),u==="front_glass"?ei(i.glass,P,.12,M-.12,.001,l+c*.55,a-.18,Yr,I):f&&ei(i.glass,P,.1,.18,.001,l+.3,a-.3,Yr,I);let X=l+Math.min(1.05,c*.5),V=f?.3:.012,[re,ye]=f?[M-.11,M-.08]:[M-.16,M-.05],Y=(Q,se)=>Vt(i.frames,P,{x0:re,x1:ye,n0:Q,n1:se,y0:X-V,y1:X+V},new W(fM),new W(dM),I);if(Y(.004,.05),Y(-S-.05,-S-.004),t.unlocked){let Q=new W(hM);Vt(i.frames,P,{x0:M-.012,x1:M+.004,n0:-S-.004,n1:.004,y0:l+.06,y1:a-.06},Q,Q,{cut:r.cut,bucket:$e})}}}function wM(i){let{info:e,state:t,frame:n,fold:r}=i,[s,o,a]=[e.width,e.top,Math.min(0,e.sill)],l=Math.min(1,Math.max(0,t.cover??1)),c=new W(13951231),u=e.faceRoom-.03;l>.01&&ei(i.blinds,n,.02,s-.02,u,a+(o-a)*(1-l),o,c,r,.5);let h=(1-l)*(o-a);h>.01&&yM(i.blinds,n,.02,s-.02,u,u+h,o+.03,c,r.bucket,.5)}var hP=4936290,fP=7041926,TM=2764860,AM=9082024;function EM(i,e){let{info:t}=i;return t.opening.type!=="window"||!t.exterior||t.opening.light_well===!1?!1:t.opening.light_well===!0||t.sillVt(i.frames,n,{x0:m,x1:y,n0:_,n1:b,y0:c,y1:u},h,f,r);p(s-d,s,a-l,a),p(o,o+d,a-l,a),p(s-d,o+d,a-l-d,a-l),Vt(i.frames,n,{x0:s,x1:o,n0:a-l,n1:a,y0:c-d,y1:c},h,f,r);let x=(m,y)=>Vt(i.frames,n,{x0:m,x1:y,n0:a-l,n1:a,y0:u-.025,y1:u},new W(TM),new W(AM),r),g=Math.max(3,Math.round((o-s)/.06));for(let m=0;m<=g;m++){let y=s+(o-s)*m/g;x(y-.008,y+.008)}Vt(i.frames,n,{x0:s,x1:o,n0:a-l-.01,n1:a-l+.02,y0:u-.03,y1:u},new W(TM),new W(AM),r)}var Bs={open:0,open2:0,tilt:0,tilt2:0,cover:null};function CM(i){let{info:e,frame:t,fold:n,mid:r}=i,[s,o,a]=[e.width,e.sill,e.top],[l,c]=[.04,.025],u=new W(Yo),h=new W(Xr),f=(y,_,b,M)=>Vt(i.frames,t,{x0:y,x1:_,n0:r-c,n1:r+c,y0:b,y1:M},u,h,n);i.first&&f(0,l,o,a),i.last&&f(s-l,s,o,a);let[d,p]=[i.first?l:-i.over[0],i.last?s-l:s+i.over[1]];f(d,p,o,o+.03),f(d,p,a-l,a);let x=e.opening.front?0:e.opening.panes,g=Math.max(1,x==null?Math.max(1,Math.round((p-d)/.9)):Math.round(x)),m=(p-d)/g;for(let y=1;yVt(i.frames,n,{x0:T,x1:C,n0:s-u,n1:s+u,y0:L,y1:O},h,f,r),x=a+(a>.05?c:.03);p(0,c,a,l),p(o-c,o,a,l),p(c,o-c,a,x),p(c,o-c,l-c,l);let g=e.opening.sill_boards??"auto";g!=="none"&&(g!=="auto"||a>.3)&&(g!=="outside"&&Vt(i.frames,n,{x0:-.04,x1:o+.04,n0:s+u,n1:e.faceRoom+.07,y0:a-.03,y1:a},d,f,r),e.exterior&&g!=="inside"&&Vt(i.frames,n,{x0:-.03,x1:o+.03,n0:-e.faceOut-.06,n1:s-u,y0:a-.04,y1:a-.02},d,f,r));let m=.055,[y,_]=[x,l-c],[b,M]=[s+u,s+u+.06],S=e.hingeAtStart,v=e.opening.opens??"turn",w=v==="slide"?dP(o,c,S,e.opening.leaves,t.open,t.open2??0):e.opening.leaves===2?[{atStart:S,x0:S?c:o/2,x1:S?o/2:o-c,open:t.open,tilt:t.tilt},{atStart:!S,x0:S?o/2:c,x1:S?o-c:o/2,open:t.open2??0,tilt:t.tilt2??0}]:[{atStart:S,x0:c,x1:o-c,open:t.open,tilt:t.tilt}],R=Mr(e.opening,e.exterior);for(let T of w){let C=v==="top"?Math.max(T.open,T.tilt)*xM:0,O=(v!=="slide"||!!T.slide)&&(T.open>.02||T.tilt>.02),P=i.markClosed?!!t.sensed&&!O:O,I=P?ke(gi,.75):new W(sM),D=P?ke(gi,.95):f,F=T.x1-T.x0,H=v==="turn",B=H?T.open*pM:0,X=H?T.tilt*gM:0,V=(T.slide??0)*T.open,re=v==="slide"&&T.track===0?-.065:0,ye=(se,we,le)=>{if(C>0){let[nt,Yt]=[we-b,le-_],[kt,on]=[Math.cos(C),Math.sin(C)];return n(T.atStart?T.x0+se:T.x1-se,b+nt*kt+Yt*on,_-nt*on+Yt*kt)}let Ne=le-y,at=we+Ne*Math.sin(X)+re,Ae=y+Ne*Math.cos(X),ft=se*Math.cos(B)-(at-b)*Math.sin(B),yt=b+(at-b)*Math.cos(B)+se*Math.sin(B);return n((T.atStart?T.x0+ft:T.x1-ft)+V,yt,Ae)},Y={cut:r.cut,bucket:B>.05||C>.05?$e:r.bucket},Q=(se,we,le,Ne,at=b,Ae=M)=>Vt(i.frames,ye,{x0:se,x1:we,n0:at,n1:Ae,y0:le,y1:Ne},I,D,Y);if(Q(0,m,y,_),Q(F-m,F,y,_),Q(m,F-m,y,y+m),Q(m,F-m,_-m,_),ei(i.glass,ye,m,F-m,(b+M)/2,y+m,_-m,P?ke(gi,.16):Yr,Y),R==="bars"){let[se,we]=[(y+_)/2,(b+M)/2];Q(m,F-m,se-.012,se+.012,we-.012,we+.012),Q(F/2-.012,F/2+.012,y+m,_-m,we-.012,we+.012)}}}var gm=i=>i.opening.front??i.opening.id;function xm(i,e,t,n=-1/0){let r=new ut,s=new ut,o=new ut(!0),a=[],l=[],c=[],u=new Map;i.forEach((x,g)=>{let m=gm(x);u.set(m,[...u.get(m)??[],g])});let h=x=>[[x.start[0],x.start[1]],[x.start[0]+x.axis[0]*x.width,x.start[1]+x.axis[1]*x.width]],f=x=>`${Math.round(x[0]*50)},${Math.round(x[1]*50)}`,d=new Map,p=new Map;for(let x of u.values()){let g=new Map,m=new Map;for(let _ of x){let[b,M]=h(i[_]);g.set(f(b),[...g.get(f(b))??[],_]),m.set(f(M),[...m.get(f(M))??[],_])}let y=(_,b)=>{if(b==null||b===_)return 0;let M=Math.abs((i[_].faceRoom-i[_].faceOut)/2),[S,v]=[i[_].axis,i[b].axis],w=Math.max(-1,Math.min(1,S[0]*v[0]+S[1]*v[1])),R=Math.acos(w);return Rw!==_),v=(g.get(f(M))??[]).find(w=>w!==_);d.set(_,[S==null,v==null]),p.set(_,[y(_,S),y(_,v)])}}for(let x=0;x[g.start[0]+g.axis[0]*w+g.toRoom[0]*R,T,g.start[1]+g.axis[1]*w+g.toRoom[1]*R],mid:(g.faceRoom-g.faceOut)/2,markClosed:g.opening.mark==="closed",fold:{cut:t,bucket:g.bucket},frames:r,glass:s,blinds:o,first:b,last:M,over:p.get(x)??[0,0]};(y==="door"&&_!=="passage"||y==="garage")&&MM(S),y==="door"?SM(S):y==="garage"?wM(S):_==="glass_wall"?CM(S):PM(S),EM(S,n)&&RM(S,n),y!=="garage"&&_M(S);let v=gm(g);a.push({id:v,start:m.frames,end:r.count}),l.push({id:v,start:m.glass,end:s.count}),c.push({id:v,start:m.blinds,end:o.count})}return{frames:r.geometry(),glass:s.geometry(),blinds:o.geometry(),frameTris:a,glassTris:l,blindTris:c}}var ym=Math.PI/180,Ul=2400,qo=1600,bm=9,IM=360;function Vh(i,e=64){let t=document.createElement("canvas");t.width=t.height=e;let n=t.getContext("2d"),r=n.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);for(let[s,o]of i)r.addColorStop(s,o);return n.fillStyle=r,n.fillRect(0,0,e,e),new zt(t)}function pP(i){let t=document.createElement("canvas");t.width=128,t.height=128/2;let n=t.getContext("2d"),r=i*9301+49297,s=()=>(r=(r*9301+49297)%233280)/233280;for(let o=0;o<7;o++){let a=128*(.2+.6*s()),l=128/2*(.45+.25*s()),c=128*(.12+.14*s()),u=n.createRadialGradient(a,l,0,a,l,c);u.addColorStop(0,"rgba(255,255,255,0.9)"),u.addColorStop(.6,"rgba(255,255,255,0.45)"),u.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=u,n.fillRect(0,0,128,128/2)}return new zt(t)}var Gh=class{group=new et;scene;bounds={x0:-10,x1:10,z0:-10,z1:10,y0:0,y1:8};view=null;rain;rainVel=new Float32Array(Ul*3);snow;snowPhase=new Float32Array(qo);hail;clouds=[];bolt;disc;halo;stars;cover;last=0;nextBolt=0;boltUntil=0;onFlash=null;constructor(e){this.scene=e,this.group.name="live-weather",this.group.renderOrder=5;let t=new Pe;t.setAttribute("position",new Le(new Float32Array(Ul*6),3)),this.rain=new gn(t,new Lt({color:11128309,transparent:!0,opacity:.5,depthWrite:!1}));let n=Vh([[0,"rgba(255,255,255,1)"],[.5,"rgba(255,255,255,0.6)"],[1,"rgba(255,255,255,0)"]],32),r=new Pe;r.setAttribute("position",new Le(new Float32Array(qo*3),3)),this.snow=new xn(r,new cn({color:16185855,size:.16,map:n,transparent:!0,opacity:.9,depthWrite:!1}));for(let h=0;h.02,this.stars.position.set((n.x0+n.x1)/2,n.y0,(n.z0+n.z1)/2),this.stars.scale.setScalar(r*3);let a=this.cover.material,l=(t?.snow??0)+(t?.hail??0)*.5,c=t?.rain??0;a.color.setHex(l>.05?16054527:1848656),a.opacity=l>.05?.3+.45*Math.min(1,l):c>.1?.25*Math.min(1,c):0,this.cover.visible=a.opacity>.02,this.cover.position.set((n.x0+n.x1)/2,n.y0-.18,(n.z0+n.z1)/2),this.cover.scale.set(n.x1-n.x0,n.z1-n.z0,1)}set(e){let t=this.view;this.view=e,this.group.visible=!!e;let n=e?.weather??null;if(e&&n&&n.fog>.02&&!e.low){let r=new W(e.sky[0]/255,e.sky[1]/255,e.sky[2]/255);this.scene.fog=new cs(r,.008+.04*n.fog)}else this.scene.fog instanceof cs&&(this.scene.fog=null);(!t||t.low!==e?.low||!!t.weather!=!!n)&&this.seed(),this.placeDisc(),this.placeNight(),n?.lightning||this.endBolt()}windVector(){let e=this.view?.weather;if(!e)return[0,0];let n=((e.windFrom??270)+(this.view?.north??0)+180)*ym,r=.4+7*e.wind;return[Math.sin(n)*r,-Math.cos(n)*r]}count(e,t){let n=this.view?.low??!1;return Math.round(Math.min(1,e)*t*(n?.3:1))}seed(){let e=this.bounds,t=this.view?.weather,n=()=>e.x0+Math.random()*(e.x1-e.x0),r=()=>e.z0+Math.random()*(e.z1-e.z0),s=()=>e.y0+Math.random()*(e.y1-e.y0),o=this.rain.geometry.getAttribute("position");for(let c=0;c.01,this.snow.visible=!!t&&t.snow>.01,this.hail.visible=!!t&&t.hail>.01,this.clouds.forEach((c,u)=>{c.angle=u/bm*Math.PI*2+Math.random()*.5,c.ring=1.7+Math.random()*.9,c.lift=.35+Math.random()*.35,c.scale=.55+Math.random()*.45,c.sx=e.x0+Math.random()*(e.x1-e.x0),c.sz=e.z0+Math.random()*(e.z1-e.z0)}),this.placeClouds(0)}placeClouds(e){let t=this.view,n=t?.weather,r=n?.cloud??0,s=this.bounds,o=(s.x0+s.x1)/2,a=(s.z0+s.z1)/2,l=Math.max(s.x1-s.x0,s.z1-s.z0),[c,u]=this.windVector(),h=Math.round(r*bm),f=t?.sky??[20,28,44],d=(f[0]+f[1]+f[2])/765,p=n?.rain||n?.lightning?.3:0,x=Math.max(.12,Math.min(1,.28+d*.9-p-.25*Math.max(0,r-.6))),g=Math.hypot(c,u)/Math.max(20,l*4)*e*Math.sign(c||1);this.clouds.forEach((m,y)=>{let _=ys.x1+S&&(m.sx=s.x0-S),m.sxs.z1+S&&(m.sz=s.z0-S),m.sz.9||!r&&t.elevation<.5){this.disc.visible=this.halo.visible=!1;return}let s=this.bounds,o=new U((s.x0+s.x1)/2,s.y0,(s.z0+s.z1)/2),a=Math.max(70,Math.max(s.x1-s.x0,s.z1-s.z0)*3.5),l=((r?t.azimuth+180:t.azimuth)+e.north)*ym,c=Math.max(8,Math.abs(t.elevation))*ym,u=new U(Math.sin(l)*Math.cos(c),Math.sin(c),-Math.cos(l)*Math.cos(c)),h=o.addScaledVector(u,a),f=a*(r?.07:.1);this.disc.position.copy(h),this.halo.position.copy(h),this.disc.scale.setScalar(f),this.halo.scale.setScalar(f*3.2);let d=this.disc.material,p=this.halo.material,x=r?0:Math.max(0,1-t.elevation/20);d.color.set(r?14016242:new W(1,.9-.25*x,.6-.35*x)),p.color.copy(d.color),d.opacity=(r?.7:.95)*(1-n),p.opacity=(r?.35:.6)*(1-n),this.disc.visible=this.halo.visible=!0}endBolt(){this.bolt.visible&&(this.bolt.visible=!1,this.onFlash?.(!1))}strike(e){let t=this.bounds,r=(Math.random()<.5?-1:1)<0?t.x0-2-Math.random()*6:t.x1+2+Math.random()*6,s=t.z0+Math.random()*(t.z1-t.z0),o=t.y1+4,a=this.bolt.geometry.getAttribute("position"),l=24,c=o;for(let u=0;u.01&&this.placeClouds(r),n.lightning&&!t.low?(this.nextBolt||(this.nextBolt=e+2500+Math.random()*6e3),e>=this.nextBolt&&(this.strike(e),this.nextBolt=e+3500+Math.random()*9e3),this.bolt.visible&&e>this.boltUntil&&this.endBolt()):this.nextBolt=0,this.rain.visible||this.snow.visible||this.hail.visible||n.cloud>.01||n.lightning}dispose(){this.endBolt(),this.group.traverse(e=>{let t=e;t.geometry?.dispose();let n=t.material;n?.map?.dispose(),n?.dispose()}),this.scene.remove(this.group),this.scene.fog instanceof cs&&(this.scene.fog=null)}};var Hh=46,Wh=33,ks=900;function vm(){let i=document.createElement("canvas");i.width=i.height=32;let e=i.getContext("2d"),t=e.createRadialGradient(16,16,0,16,16,16);return t.addColorStop(0,"rgba(255,255,255,1)"),t.addColorStop(.35,"rgba(255,255,255,0.7)"),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.fillRect(0,0,32,32),new zt(i)}var Xh=class{group=new et;scene;lift;tex=vm();arcs=new Map;sparkFields=[];sparks;sparkBase=new Float32Array(ks*3);sparkField=new Int16Array(ks);sparkPhase=new Float32Array(ks);sparkCount=0;last=0;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-energy";let n=new Pe;n.setAttribute("position",new Le(new Float32Array(ks*3),3)),n.setAttribute("color",new Le(new Float32Array(ks*3),3)),this.sparks=new xn(n,new cn({size:.4,map:this.tex,vertexColors:!0,transparent:!0,depthWrite:!1,blending:Ft})),this.sparks.frustumCulled=!1,this.group.add(this.sparks),e.add(this.group)}get active(){return this.arcs.size>0||this.sparkCount>0}setArcs(e){let t=new Set(e.map(n=>n.key));for(let[n,r]of this.arcs)t.has(n)||(this.group.remove(r.line,r.points),r.line.geometry.dispose(),r.line.material.dispose(),r.points.geometry.dispose(),r.points.material.dispose(),this.arcs.delete(n));for(let n of e){let r=this.arcs.get(n.key);if(!r){let o=new Pe;o.setAttribute("position",new Le(new Float32Array(Wh*3),3));let a=new Pn(o,new Lt({transparent:!0,opacity:.4,depthWrite:!1,blending:Ft})),l=new Pe;l.setAttribute("position",new Le(new Float32Array(Hh*3),3));let c=new xn(l,new cn({size:.55,map:this.tex,transparent:!0,depthWrite:!1,blending:Ft}));a.frustumCulled=c.frustumCulled=!1;let u=new Float32Array(Hh);for(let h=0;hnew U):null,r.points.material.color.copy(s),r.count=n.power<=0?0:Math.max(3,Math.min(Hh,Math.round(3+Math.sqrt(n.power)/2.2))),r.speed=.18+Math.min(.5,Math.log10(1+n.power)*.1),r.points.geometry.setDrawRange(0,r.count)}this.place()}setSparks(e){this.sparkFields=e;let t=e.reduce((r,s)=>r+s.quads.length*s.level,0),n=0;t>0&&e.forEach((r,s)=>{if(r.level<=0)return;let o=Math.round(ks*r.quads.length*r.level/Math.max(t,e.reduce((a,l)=>a+l.quads.length,0)));for(let a=0;a0}world(e,t){let n=this.lift(e.floorId);return t.set(e.x,n.y+e.y,e.z),n.visible}place(){for(let e of this.arcs.values()){if(e.path){this.placeRoute(e,e.path);continue}let t=this.world(e.arc.from,e.a),n=this.world(e.arc.to,e.b),r=e.a.distanceTo(e.b);e.c.copy(e.a).add(e.b).multiplyScalar(.5),e.c.y=Math.max(e.a.y,e.b.y)+.6+r*.22;let s=t&&n;e.line.visible=e.points.visible=s;let o=e.line.geometry.getAttribute("position");for(let a=0;ar=this.world(o,t[a])&&r),e.line.visible=e.points.visible=r,e.along=[0];for(let o=1;os.setXYZ(a,o.x,o.y,o.z)),e.line.geometry.setDrawRange(0,t.length),s.needsUpdate=!0}at(e,t){if(!e.path)return this.bezier(e,t);let n=e.along[e.along.length-1]||1,r=t*n,s=1;for(;s0}set(e,t){let n=new Set(e.map(r=>r.id));for(let[r,s]of this.spots)if(!n.has(r)){for(let o of s.rings)this.group.remove(o),o.material.dispose();this.spots.delete(r)}for(let r of e){let s=this.spots.get(r.id);if(!s){let a=Array.from({length:LM},()=>{let l=new Se(this.ringGeo,new Ye({transparent:!0,opacity:0,depthWrite:!1,blending:Ft,side:ht}));return l.rotation.x=-Math.PI/2,l.frustumCulled=!1,this.group.add(l),l});s={spot:r,rings:a},this.spots.set(r.id,s)}s.spot=r;let o=new W(r.color[0]/255,r.color[1]/255,r.color[2]/255);for(let a of s.rings)a.material.color.copy(o)}for(let r of this.links)this.group.remove(r.line),r.line.geometry.dispose(),r.line.material.dispose();this.links=t.map(([r,s])=>{let o=new Pe;o.setAttribute("position",new Le(new Float32Array(51),3));let a=new Pn(o,new Lt({color:12616956,transparent:!0,opacity:.55,depthWrite:!1,blending:Ft}));return a.frustumCulled=!1,this.group.add(a),{a:r,b:s,line:a}})}step(e){if(!this.spots.size&&!this.links.length)return!1;let t=e/1e3;for(let n of this.spots.values()){let r=this.lift(n.spot.at.floorId),s=.9+1.6*n.spot.level;n.rings.forEach((o,a)=>{let l=(t*.55+a/LM)%1;o.visible=r.visible,o.position.set(n.spot.at.x,r.y+n.spot.at.y,n.spot.at.z),o.scale.setScalar((.25+l*s)*(n.spot.size??1)),o.material.opacity=(1-l)*(.35+.5*n.spot.level)})}for(let n of this.links){let r=this.lift(n.a.floorId),s=this.lift(n.b.floorId);n.line.visible=r.visible&&s.visible;let o=n.line.geometry.getAttribute("position"),a=r.y+n.a.y,l=s.y+n.b.y,c=Math.hypot(n.a.x-n.b.x,n.a.z-n.b.z);for(let u=0;u<=16;u++){let h=u/16,f=Math.sin(Math.PI*h)*(.3+c*.12)+Math.sin(t*3+h*12)*.03;o.setXYZ(u,n.a.x+(n.b.x-n.a.x)*h,a+(l-a)*h+f,n.a.z+(n.b.z-n.a.z)*h)}o.needsUpdate=!0}return!0}dispose(){this.set([],[]),this.ringGeo.dispose(),this.scene.remove(this.group)}};var qh=6,NM=24,FM=qh*NM;function mP(i,e,t){let n=i%qh,r=Math.floor(i/qh),s=(r/NM+e*.7)%1,o=n/qh*Math.PI*2+e*.35+(r*7%5-2)*.012,a=s*t,l=Math.min(1.2,t/3);return[Math.cos(o)*a,4*l*s*(1-s),Math.sin(o)*a]}var $h=class{group=new et;scene;lift;tex=vm();material=new cn({color:11068159,size:.09,map:this.tex,transparent:!0,opacity:.9,depthWrite:!1});sprays=new Map;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-water",e.add(this.group)}get active(){return this.sprays.size>0}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.sprays)t.has(n)||(this.group.remove(r.points),r.points.geometry.dispose(),this.sprays.delete(n));for(let n of e){let r=this.sprays.get(n.id);if(r){r.spot=n;continue}let s=new Pe;s.setAttribute("position",new Le(new Float32Array(FM*3),3));let o=new xn(s,this.material);o.frustumCulled=!1,this.group.add(o),this.sprays.set(n.id,{spot:n,points:o})}}step(e){if(!this.sprays.size)return!1;let t=e/1e3;for(let n of this.sprays.values()){let r=this.lift(n.spot.at.floorId);n.points.visible=r.visible,n.points.position.set(n.spot.at.x,r.y+n.spot.at.y,n.spot.at.z);let s=n.points.geometry.getAttribute("position");for(let o=0;on.value!==null&&Number.isFinite(n.value)&&Number.isFinite(n.level)).slice().sort((n,r)=>n.level-r.level);return Array.from({length:e},(n,r)=>{if(!t.length)return null;let s=(r+.5)/e;if(s<=t[0].level)return t[0].value;let o=t.findIndex(u=>u.level>=s);if(o<0)return t.at(-1).value;let a=t[o-1],l=t[o],c=l.level-a.level;return c>0?a.value+(l.value-a.value)*(s-a.level)/c:l.value})}function zs(i,e){let t=i.item;return new U(e[0]*(t.mirror?-1:1),e[1],e[2]).applyEuler(new Kn((t.tilt_x??0)*Math.PI/180,-t.rotation*Math.PI/180,(t.tilt_z??0)*Math.PI/180,"YZX")).add(new U(t.x,i.base,t.z))}var DM=i=>zs(i,[1,0,0]).sub(zs(i,[0,0,0]));function gP(i,e){let t=i.item,n=e.item,r=Uo(t),s=zs(i,[0,t.h/2,0]),o=zs(e,[0,n.h/2,0]),a=DM(i),l=DM(e),c=o.clone().sub(s).dot(a)>=0?1:-1,u=s.clone().sub(o).dot(l)>=0?1:-1,h=-1/0;for(let f of[i,e])for(let d of[-f.item.w/2,f.item.w/2])for(let p of[-f.item.d/2,f.item.d/2])for(let x of[0,f.item.h])h=Math.max(h,zs(f,[d,x,p]).z);return["primary_flow","primary_return"].map((f,d)=>{let p=zs(i,[c*t.w*.49,d?r.ys.back:r.ys.flow,d?r.blueZ:r.redZ]),x=zs(e,gh(n,u,d?.12:.88).end),g=p.clone().addScaledVector(a,c*.15),m=x.clone().addScaledVector(l,u*.15),y=h+.24+d*.07;return{medium:f,points:[p,g,new U(g.x,g.y,y),new U(m.x,g.y,y),new U(m.x,m.y,y),m,x]}})}var UM=i=>{let e=i.item;return[i.floorId,i.base,e.id,e.x,e.z,e.w,e.d,e.h,e.rotation,e.tilt_x??0,e.tilt_z??0,!!e.mirror].join("|")},Kh=class{views=new Map;parent;lift;constructor(e,t){this.parent=e,this.lift=t}remove(e){let t=new Set;e.group.traverse(n=>{n instanceof Se&&(n.geometry.dispose(),Array.isArray(n.material)?n.material.forEach(r=>t.add(r)):t.add(n.material))}),t.forEach(n=>n.dispose()),this.parent.remove(e.group)}set(e){let t=new Set;for(let n of e){if(n.item.type!=="freshwater_station"||!n.item.hydronic?.buffer_id)continue;let r=e.find(u=>u.id===n.item.hydronic.buffer_id&&u.floorId===n.floorId&&u.item.type==="buffer_tank");if(!r)continue;t.add(n.id);let s=this.views.get(n.id),o=UM(n)+"/"+UM(r);if(s?.key===o){s.station=n,s.buffer=r;continue}s&&this.remove(s);let a=new et;a.name=`hydronic-connection-${n.id}`;let l=Math.min(n.item.d*.05,.018),c=new U(0,1,0);for(let u of gP(n,r)){let h=new Ye({color:u.medium==="primary_flow"?12140088:3308718});for(let f=1;fi===null?new W(6910332):new W().setHSL((1-Math.max(0,Math.min(1,i/85)))*.62,.8,.55),yP=new W(1342650),BM=new W(12379625),bP=new W(13642552),Zh=class{group=new et;views=new Map;scene;lift;connections;constructor(e,t){this.scene=e,this.lift=t,this.connections=new Kh(this.group,t),this.group.name="live-hydronics",e.add(this.group)}remove(e){e.group.traverse(t=>{t instanceof Se&&(t.geometry.dispose(),t.material.dispose())}),this.group.remove(e.group)}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.views)t.has(n)||(this.remove(r),this.views.delete(n));for(let n of e){let r=this.views.get(n.id);r?.spot.item!==n.item&&(r&&this.remove(r),r=this.build(n),this.views.set(n.id,r)),r.spot=n,r.bands=n.item.type==="buffer_tank"?OM(n.probes):[]}this.connections.set(e)}build(e){let t=new et,n=[],r=e.item,s=El(r),o=(l,c,u,h,f,d={},p)=>{let x=new Se(p??(f==="temperature"?new nr(h,10,6):new Mi(h*1.6,h*.3,.012)),new Ye({color:6910332,depthWrite:!0}));x.name=`hydronic-${f}-${d.circulation?"circulation":d.station!==void 0?`station-${d.station}${f==="temperature"?`-${d.temp??0}`:""}`:d.circuit??d.probe??d.temp??0}`,x.position.set(l,c,u),t.add(x),n.push({mesh:x,kind:f,...d})},a=(l,c,u,h,f)=>{o(l,c,u+.001,h*.84,"pumpState",f,new Ca(h*.84,24));let d=[];for(let p=0;p<3;p++)for(let[x,g]of[[0,.1],[.28,.18],[0,.73]]){let m=p*Math.PI*2/3;d.push(h*(x*Math.cos(m)-g*Math.sin(m)),h*(x*Math.sin(m)+g*Math.cos(m)),0)}o(l,c,u+.002,h,"pump",f,new Pe().setAttribute("position",new Le(d,3)))};if(r.type==="heating_manifold"){let l=s.circuits??[];l.forEach((c,u)=>{let h=fh(r,c,u,l.length);Rl(c)&&a(h.flowX,h.pumpY,h.pumpFront,h.pumpR,{circuit:u}),Ls(c)&&o(h.flowX,h.valveY,h.valveFront+.003,h.valveR*.8,"valve",{circuit:u}),o(h.flowGaugeX,h.temperatureY,h.gaugeFront+.001,h.gaugeR*.45,"temperature",{circuit:u,temp:0}),o(h.returnGaugeX,h.temperatureY,h.gaugeFront+.001,h.gaugeR*.45,"temperature",{circuit:u,temp:1})})}else if(r.type==="buffer_tank"){(s.sensors??[]).forEach((l,c)=>o(0,r.h*(.1+.8*l.level),Math.min(r.w,r.d)*.46+.025,.021,"temperature",{probe:c}));for(let l=0;l<24;l++){let c=Math.min(r.w,r.d)*.464;o(0,r.h*(.1+.8*(l+.5)/24),0,c,"bufferBand",{band:l},new ds(c,c,r.h*.8/24,32,1,!0));let u=n.at(-1).mesh.material;u.transparent=!0,u.opacity=.8,u.depthWrite=!1}}else{let l=Uo(r);if(l.units.forEach((c,u)=>{let h=c.pump;if(a(h.x,h.y,h.front,h.r,{station:u}),c.valve){let f=c.valve;o(f.x,f.y,f.front+.003,f.r*.8,"valve",{station:u})}c.probes.forEach((f,d)=>o(f.x,f.y,f.front+.001,f.r*.5,"temperature",{station:u,temp:d}))}),l.circulationPipes.length){let c=l.circPump;a(c.x,c.y,c.front,c.r,{circulation:!0});let u=l.circProbe;o(u.x,u.y,u.front+.001,u.r*.5,"temperature",{temp:2})}}return t.rotation.set((r.tilt_x??0)*Math.PI/180,-r.rotation*Math.PI/180,(r.tilt_z??0)*Math.PI/180,"YZX"),t.scale.x=r.mirror?-1:1,t.name=`hydronic-${r.id}`,this.group.add(t),{spot:e,group:t,parts:n,bands:[]}}step(e){let t=!1;this.connections.step();for(let n of this.views.values()){let{spot:r}=n,s=this.lift(r.floorId);n.group.visible=s.visible,n.group.position.set(r.item.x,s.y+r.base,r.item.z);for(let o of n.parts){let a=o.circuit===void 0?void 0:r.circuits[o.circuit],l=o.station===void 0?void 0:r.stations?.[o.station];if(o.kind==="bufferBand"){let c=n.bands[o.band??0];if(o.mesh.visible=c!=null,c!=null){let u=Math.max(0,Math.min(1,(c-20)/45));o.mesh.material.color.copy(u<.5?yP:BM).lerp(u<.5?BM:bP,u<.5?u*2:(u-.5)*2)}}else if(o.kind==="temperature"){let c=o.station!==void 0?l?.temperatures[o.temp??0]:o.probe!==void 0?r.probes[o.probe]?.value:a?o.temp===0?a.flow:a.return:r.temperatures[o.temp??0];o.mesh.material.color.copy(xP(c??null))}else if(o.kind==="pump"||o.kind==="pumpState"){let c=o.station!==void 0?l?.pump??null:a?a.pump:o.circulation?r.circulation:r.pump;if(o.kind==="pumpState"){o.mesh.material.color.set(c===null?7501950:c?4953657:11019832);continue}o.mesh.material.color.set(c===null?11712441:14739417),o.mesh.rotation.z=Number(o.mesh.userData.angle??0)+(c&&r.animate!==!1?e/350:0),t||=s.visible&&c===!0&&r.animate!==!1}else{let c=o.station!==void 0?l?.valve:a?.valve;o.mesh.rotation.z=c==null?0:c/100*Math.PI/2,o.mesh.material.color.set(c==null?9015450:a?.cooling?5290239:9357674)}}}return t}dispose(){this.connections.dispose();for(let e of this.views.values())this.remove(e);this.views.clear(),this.scene.remove(this.group)}};var vP=Math.PI/180;function _P(){let i=document.createElement("canvas");i.width=i.height=64;let e=i.getContext("2d"),t=e.createRadialGradient(32,32,4,32,32,32);return t.addColorStop(0,"rgba(255,255,255,0.9)"),t.addColorStop(.5,"rgba(255,255,255,0.35)"),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.fillRect(0,0,64,64),new zt(i)}var Jh=class{group=new et;scene;lift;glowTex=_P();views=new Map;onChange=null;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-screens",e.add(this.group)}get active(){return[...this.views.values()].some(e=>e.s.playing)}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.views)t.has(n)||this.drop(n,r);for(let n of e){let r=this.views.get(n.id);if(!r){let o=document.createElement("canvas");o.width=512,o.height=288;let a=new zt(o);a.colorSpace=dt;let l=new Se(new sn(1,1),new Ye({map:a,transparent:!0,toneMapped:!1}));l.renderOrder=6;let c=new Se(new sn(1,1),new Ye({map:this.glowTex,transparent:!0,depthWrite:!1,blending:Ft,side:ht}));c.renderOrder=2,this.group.add(l,c),r={s:n,sig:"",screen:l,glow:c,canvas:o,texture:a,image:null},this.views.set(n.id,r)}r.s=n;let s=[n.title,n.subtitle,n.app,n.picture,n.color.join(","),n.playing].join("|");if(s!==r.sig){let o=r.sig.split("|")[3]!==(n.picture??"");r.sig=s,o&&this.loadPicture(r),this.draw(r)}this.place(r)}}loadPicture(e){e.image=null;let t=e.s.picture;if(!t)return;let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{e.s.picture!==t||!this.views.has(e.s.id)||(e.image=n,this.draw(e),this.onChange?.())},n.src=t}draw(e){let t=e.s,n=e.canvas.getContext("2d"),r=e.canvas.width,s=e.canvas.height,[o,a,l]=t.color,c=n.createLinearGradient(0,0,r,s);c.addColorStop(0,`rgb(${Math.round(o*.35)},${Math.round(a*.35)},${Math.round(l*.35)})`),c.addColorStop(1,"rgb(6,9,18)"),n.fillStyle=c,n.fillRect(0,0,r,s);let u=22,h=u;if(e.image){let f=s-u*2-30;n.save(),n.shadowColor=`rgba(${o},${a},${l},0.7)`,n.shadowBlur=24;let d=e.image.naturalWidth||1,p=e.image.naturalHeight||1,x=Math.max(f/d,f/p),g=f/x,m=f/x;n.drawImage(e.image,(d-g)/2,(p-m)/2,g,m,u,u,f,f),n.restore(),h=u*2+f}n.fillStyle="#ffffff",n.font="600 34px Figtree, Roboto, sans-serif",this.text(n,t.title||t.app||"",h,s/2-18,r-h-u),n.fillStyle="rgba(230,240,255,0.75)",n.font="26px Figtree, Roboto, sans-serif",this.text(n,t.subtitle,h,s/2+22,r-h-u),t.app&&(n.fillStyle=`rgb(${o},${a},${l})`,n.font="700 22px Figtree, Roboto, sans-serif",this.text(n,(t.playing?"\u25B6 ":"\u275A\u275A ")+t.app,h,s-u-14,r-h-u)),n.fillStyle=`rgba(${o},${a},${l},0.9)`,n.fillRect(0,s-6,r*(t.playing?1:.4),6),e.texture.needsUpdate=!0}text(e,t,n,r,s){let o=t;for(;o.length>1&&e.measureText(o).width>s;)o=o.slice(0,-2);e.fillText(o===t?o:`${o}\u2026`,n,r)}place(e){let t=e.s,n=t.rect,r=t.rotation*vP,s=this.lift(t.floorId),o=(n.x0+n.x1)/2,a=(p,x)=>[t.x+p*Math.cos(r)-x*Math.sin(r),t.z+p*Math.sin(r)+x*Math.cos(r)],l=n.x1-n.x0,c=n.y1-n.y0,[u,h]=a(o,n.z+.012);e.screen.position.set(u,s.y+(n.y0+n.y1)/2,h),e.screen.rotation.set(0,-r,0),e.screen.scale.set(l,c,1);let[f,d]=a(o,n.z-.18);e.glow.position.set(f,s.y+(n.y0+n.y1)/2,d),e.glow.rotation.set(0,-r,0),e.glow.scale.set(l*2.4,c*2.6,1),e.glow.material.color=new W(t.color[0]/255,t.color[1]/255,t.color[2]/255),e.screen.visible=s.visible,e.glow.visible=s.visible&&(t.ambilight??1)>0}step(e){let t=!1;for(let n of this.views.values()){this.place(n);let r=n.glow.material;r.opacity=(n.s.playing?.55+.25*Math.sin(e/900+n.s.x):.25)*Math.min(1.5,n.s.ambilight??1),t||=n.s.playing}return t}drop(e,t){this.group.remove(t.screen,t.glow),t.screen.geometry.dispose(),t.screen.material.dispose(),t.texture.dispose(),t.glow.geometry.dispose(),t.glow.material.dispose(),this.views.delete(e)}dispose(){for(let[e,t]of this.views)this.drop(e,t);this.glowTex.dispose(),this.scene.remove(this.group)}};var MP=Math.PI/180,SP="#f4f1ea",jh=class{group=new et;scene;lift;views=new Map;onChange=null;constructor(e,t){this.scene=e,this.lift=t,this.group.name="live-pictures",e.add(this.group)}set(e){let t=new Set(e.map(n=>n.id));for(let[n,r]of this.views)t.has(n)||this.drop(n,r);for(let n of e){let r=this.views.get(n.id);if(!r){let c=document.createElement("canvas"),u=new zt(c);u.colorSpace=dt;let h=new Se(new sn(1,1),new Ye({map:u,toneMapped:!1}));h.renderOrder=5,this.group.add(h),r={p:n,sig:"",mesh:h,canvas:c,texture:u,image:null},this.views.set(n.id,r)}let s=r.p.url!==n.url||!r.sig;r.p=n;let o=n.rect.x1-n.rect.x0,a=n.rect.y1-n.rect.y0,l=[n.url,n.border,n.fit,o.toFixed(3),a.toFixed(3)].join("|");l!==r.sig&&(r.sig=l,s&&this.load(r),this.draw(r)),this.place(r)}}load(e){e.image=null;let t=e.p.url,n=new Image;n.crossOrigin="anonymous",n.onload=()=>{e.p.url!==t||!this.views.has(e.p.id)||(e.image=n,this.draw(e),this.onChange?.())},n.src=t}draw(e){let t=e.p,n=Math.max(.01,t.rect.x1-t.rect.x0),r=Math.max(.01,t.rect.y1-t.rect.y0),s=600/Math.max(n,r),o=e.canvas.width=Math.max(16,Math.round(n*s)),a=e.canvas.height=Math.max(16,Math.round(r*s)),l=e.canvas.getContext("2d");l.fillStyle=t.border>0?SP:"#20242c",l.fillRect(0,0,o,a);let c=Math.round(Math.min(o,a)*Math.min(40,Math.max(0,t.border))/100),[u,h,f,d]=[c,c,o-2*c,a-2*c];if(e.image&&f>4&&d>4){let p=e.image.naturalWidth||1,x=e.image.naturalHeight||1;if(t.fit==="contain"){let g=Math.min(f/p,d/x);l.drawImage(e.image,u+(f-p*g)/2,h+(d-x*g)/2,p*g,x*g)}else{let g=Math.max(f/p,d/x),m=f/g,y=d/g;l.drawImage(e.image,(p-m)/2,(x-y)/2,m,y,u,h,f,d)}c>0&&(l.strokeStyle="rgba(0,0,0,0.25)",l.lineWidth=Math.max(1,c*.04),l.strokeRect(u,h,f,d))}else f>4&&d>4&&(l.fillStyle="#3a4250",l.fillRect(u,h,f,d));e.texture.needsUpdate=!0}place(e){let t=e.p,n=t.rect,r=t.rotation*MP,s=this.lift(t.floorId),o=(n.x0+n.x1)/2,a=n.z+.004;e.mesh.position.set(t.x+o*Math.cos(r)-a*Math.sin(r),s.y+(n.y0+n.y1)/2,t.z+o*Math.sin(r)+a*Math.cos(r)),e.mesh.rotation.set(0,-r,0),e.mesh.scale.set(n.x1-n.x0,n.y1-n.y0,1),e.mesh.visible=s.visible}step(){for(let e of this.views.values())this.place(e);return!1}drop(e,t){this.group.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.views.delete(e)}dispose(){for(let[e,t]of this.views)this.drop(e,t);this.scene.remove(this.group)}};var Qh=class extends Tn{constructor(){super(),this.name="RoomEnvironment",this.position.y=-3.5;let e=new Mi;e.deleteAttribute("uv");let t=new In({side:un}),n=new In,r=new gs(16777215,900,28,2);r.position.set(.418,16.199,.3),this.add(r);let s=new Se(e,t);s.position.set(-.757,13.219,.717),s.scale.set(31.713,28.305,28.591),this.add(s);let o=new fs(e,n,6),a=new Et;a.position.set(-10.906,2.009,1.846),a.rotation.set(0,-.195,0),a.scale.set(2.328,7.905,4.651),a.updateMatrix(),o.setMatrixAt(0,a.matrix),a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),a.updateMatrix(),o.setMatrixAt(1,a.matrix),a.position.set(6.167,.857,7.803),a.rotation.set(0,.561,0),a.scale.set(3.927,6.285,3.687),a.updateMatrix(),o.setMatrixAt(2,a.matrix),a.position.set(-2.017,.018,6.124),a.rotation.set(0,.333,0),a.scale.set(2.002,4.566,2.064),a.updateMatrix(),o.setMatrixAt(3,a.matrix),a.position.set(2.291,-.756,-2.621),a.rotation.set(0,-.286,0),a.scale.set(1.546,1.552,1.496),a.updateMatrix(),o.setMatrixAt(4,a.matrix),a.position.set(-2.193,-.369,-5.547),a.rotation.set(0,.516,0),a.scale.set(3.875,3.487,2.986),a.updateMatrix(),o.setMatrixAt(5,a.matrix),this.add(o);let l=new Se(e,$o(50));l.position.set(-16.116,14.37,8.208),l.scale.set(.1,2.428,2.739),this.add(l);let c=new Se(e,$o(50));c.position.set(-16.109,18.021,-8.207),c.scale.set(.1,2.425,2.751),this.add(c);let u=new Se(e,$o(17));u.position.set(14.904,12.198,-1.832),u.scale.set(.15,4.265,6.331),this.add(u);let h=new Se(e,$o(43));h.position.set(-.462,8.89,14.52),h.scale.set(4.38,5.441,.088),this.add(h);let f=new Se(e,$o(20));f.position.set(3.235,11.486,-12.541),f.scale.set(2.5,2,.1),this.add(f);let d=new Se(e,$o(100));d.position.set(0,20,0),d.scale.set(1,.1,1),this.add(d)}dispose(){let e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function $o(i){return new Oa({color:0,emissive:16777215,emissiveIntensity:i})}function _m(i,e){if(e===md)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Ao||e===ja){let t=i.getIndex();if(t===null){let s=[],o=i.getAttribute("position");if(o!==void 0){for(let a=0;ao&&(L+=B,O+=X,P+=V)}let I=1/(Math.sqrt(L*L+O*O+P*P)||1);_[3*T+0]=L*I,_[3*T+1]=O*I,_[3*T+2]=P*I}}return t.setAttribute("normal",new wt(_,3,!1)),t}function zM(i){let e=new Map,t=new Map,n=i.clone();return VM(i,n,function(r,s){e.set(s,r),t.set(r,s)}),n.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=e.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(l){return t.get(l)}),s.bind(s.skeleton,s.bindMatrix)}),n}function VM(i,e,t){t(i,e);for(let n=0;n=2.0 are supported."));return}let c=new Zm(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,s){n.parse(e,t,r,s)})}};function wP(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}function Bt(i,e,t){let n=i.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var rt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DIFFUSE_ROUGHNESS:"KHR_materials_diffuse_roughness",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Tm=class{constructor(e){this.parser=e,this.name=rt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}},zm=class{constructor(e){this.parser=e,this.name=rt.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=r.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(e,o.source,l)}},Vm=class{constructor(e){this.parser=e,this.name=rt.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=r.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(e,o.source,l)}},ef=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let r=n.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){let l=r.byteOffset||0,c=r.byteLength||0,u=r.count,h=r.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,f,r.mode,r.filter).then(function(d){return d.buffer}):o.ready.then(function(){let d=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(d),u,h,f,r.mode,r.filter),d})})}else return null}},Gm=class{constructor(e){this.name=rt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let c of r.primitives)if(c.mode!==ti.TRIANGLES&&c.mode!==ti.TRIANGLE_STRIP&&c.mode!==ti.TRIANGLE_FAN&&c.mode!==void 0)return null;let o=n.extensions[this.name].attributes,a=[],l={};for(let c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{let u=c.pop(),h=u.isGroup?u.children:[u],f=c[0].count,d=[];for(let p of h){let x=new ze,g=new U,m=new Sn,y=new U(1,1,1),_=new fs(p.geometry,p.material,f);for(let M=0;M0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var LP=new ze,Zm=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new wP,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let l=a.match(/Version\/(\d+)/);r=n&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&r<17||s&&o<98?(this.textureLoader=new Ba(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)):(this.textureLoader=new Ga(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new bo(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType("arraybuffer"),(this.options.withCredentials||this.options.crossOrigin==="use-credentials")&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){let a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:n,userData:{}};return Vs(s,a,r),Bi(a,r),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(let l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let r=0,s=t.length;r{let l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(let[c,u]of o.children.entries())s(u,a.children[c])};return s(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&g.setY(R,S[v*l+1]),l>=3&&g.setZ(R,S[v*l+2]),l>=4&&g.setW(R,S[v*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=p}return g})}loadTexture(e){let t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s],a=this.textureLoader;if(o.uri){let l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){let r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];let c=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);let f=(s.samplers||{})[o.sampler]||{};return u.magFilter=HM[f.magFilter]||Ht,u.minFilter=HM[f.minFilter]||Fn,u.wrapS=WM[f.wrapS]||kn,u.wrapT=WM[f.wrapT]||kn,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Ut&&u.minFilter!==Ht,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){let n=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());let o=r.images[e],a=self.URL||self.webkitURL,l=o.uri||"",c=!1,u;if(t.isKTX2Loader===!0&&o.bufferView!==void 0)u=n.getDependency("bufferView",o.bufferView).then(function(f){return new Promise(function(d,p){t.parse(f,d,p)})});else{if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(f){c=!0;let d=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");u=Promise.resolve(l).then(function(f){return new Promise(function(d,p){let x=d;t.isImageBitmapLoader===!0&&(x=function(g){let m=new Kt(g);m.needsUpdate=!0,d(m)}),t.load(lr.resolveURL(f,s.path),x,void 0,p)})})}let h=u.then(function(f){return c===!0&&a.revokeObjectURL(l),Bi(f,o),f.userData.mimeType=o.mimeType||IP(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=h,h}assignTexture(e,t,n,r){let s=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[rt.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[rt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let l=s.associations.get(o);o=s.extensions[rt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new cn,mn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){let a="LineBasicMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new Lt,mn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(r||s||o){let a="ClonedMaterial:"+n.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return In}loadMaterial(e){let t=this,n=this.json,r=this.extensions,s=n.materials[e],o,a={},l=s.extensions||{},c=[];if(l[rt.KHR_MATERIALS_UNLIT]){let h=r[rt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{let h=s.pbrMetallicRoughness||{};if(a.color=new W(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){let f=h.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Mn),a.opacity=f[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,dt)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ht);let u=s.alphaMode||Sm.OPAQUE;if(u===Sm.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Sm.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ye&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ue(1,1),s.normalTexture.scale!==void 0)){let h=s.normalTexture.scale;a.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&o!==Ye&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ye){let h=s.emissiveFactor;a.emissive=new W().setRGB(h[0],h[1],h[2],Mn)}return s.emissiveTexture!==void 0&&o!==Ye&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,dt)),Promise.all(c).then(function(){let h=new o(a);return s.name&&(h.name=s.name),Bi(h,s),t.associations.set(h,{materials:e}),s.extensions&&Vs(r,h,s),h})}createUniqueName(e){let t=gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function s(a){return n[rt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return XM(l,a,t)})}let o=[];for(let a=0,l=e.length;a_m(d,ja)):c.mode===ti.TRIANGLE_FAN&&(f=f.then(d=>_m(d,Ao))),r[u]={primitive:c,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){let t=this,n=this.json,r=this.extensions,s=n.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l0&&CP(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Bi(m,s),g.extensions&&Vs(r,m,g),t.assignFinalMaterial(m),h.push(m)}for(let d=0,p=h.length;d0){let d=u.userData.pivot,p=h[0];u.pivot=new U().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new go:c.length>1?u=new et:c.length===1?u=c[0]:u=new Et,u!==c[0])for(let h=0,f=c.length;h1){let h=r.associations.get(u);r.associations.set(u,{...h})}return r.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,s=new et;n.name&&(s.name=r.createUniqueName(n.name)),Bi(s,n),n.extensions&&Vs(t,s,n);let o=n.nodes||[],a=[];for(let l=0,c=o.length;l{let h=new Map;for(let[f,d]of r.associations)(f instanceof mn||f instanceof Kt)&&h.set(f,d);return u.traverse(f=>{let d=r.associations.get(f);d!=null&&h.set(f,d)}),h};return r.associations=c(s),s})}_createAnimationTracks(e,t,n,r,s){let o=[],a=e.name?e.name:e.uuid,l=[];function c(d){d.morphTargetInfluences&&l.push(d.name?d.name:d.uuid)}qr[s.path]===qr.weights?(c(e),e.isGroup&&e.children.forEach(c)):l.push(a);let u;switch(qr[s.path]){case qr.weights:u=rr;break;case qr.rotation:u=sr;break;case qr.translation:case qr.scale:u=Or;break;default:n.itemSize===1?u=rr:u=Or;break}let h=r.interpolation!==void 0?AP[r.interpolation]:Ji,f=this._getArrayFromAccessor(n);for(let d=0,p=l.length;d{let t=e;if(!t.isMesh)return;let n=t.geometry,r=t.material,s=r.name??"";t.userData.paint=!!r.userData?.paint||/^Paint/.test(s),n.getAttribute("normal")||(t.userData.paint?n.computeVertexNormals():t.geometry=kM(n,NP)),r.flatShading=!1;let o=/glass/i.test(s);r.metalness=t.userData.paint?.55:o?0:Math.min(r.metalness??0,.4),r.roughness=t.userData.paint?.28:o?.05:Math.max(r.roughness??.6,.45),o&&(r.transparent=!0,r.depthWrite=!1,r.opacity=Math.max(r.opacity,.9))})}function KM(i){let e=qM.get(i);if(!e){let t=sg();if(!t)return Promise.resolve(!1);e=t(i).then(n=>n&&new Promise(r=>{new Zo().parse(n,"",s=>{OP(s.scene);let o=new Ct().setFromObject(s.scene),a=[o.max.x-o.min.x,o.max.y-o.min.y,o.max.z-o.min.z];s.scene.position.set(-(o.max.x+o.min.x)/2,-o.min.y,-(o.max.z+o.min.z)/2);let l=new et;l.add(s.scene),$M.set(i,{root:l,size:a}),og(i),r({root:l,size:a})},()=>r(null))})).catch(()=>null),qM.set(i,e)}return e.then(t=>!!t)}function ZM(i,e){let t=$M.get(i);if(!t)return null;let n=t.root.clone(!0),r=[];n.traverse(o=>{let a=o;if(!a.isMesh)return;let l=a.material.clone();a.userData.paint&&e.paint&&(l.color=new W(e.paint)),a.material=l,r.push(l)});let s=new et;return s.add(n),s.scale.set((e.mirror?-1:1)*(e.w/t.size[0]),e.h/t.size[1],e.d/t.size[2]),s.position.set(e.x,e.y,e.z),s.rotation.y=-e.rotation*Math.PI/180,s.userData.own=r,s}function Jm(i){for(let e of i.userData.own??[])e.dispose()}function JM(i,e){let t=new Ro(e),n=t.fromScene(new Qh,.04).texture;t.dispose();let r=new ms(16777215,9081766,.9),s=new ar(16777215,1.6);return s.position.set(-4,9,6),i.add(r,s),{env:n,dispose:()=>{n.dispose(),r.removeFromParent(),s.removeFromParent()}}}function jM(i,e){for(let t of i.userData.own??[])t.envMap=e,t.envMapIntensity=.9}var DP=.3,QM=2.6,nf=.05;function UP(i,e,t,n){let r=n*.7071,s=[i,[i[0]+n,i[1]],[i[0]-n,i[1]],[i[0],i[1]+n],[i[0],i[1]-n]],o=[[i[0]+r,i[1]+r],[i[0]-r,i[1]+r],[i[0]+r,i[1]-r],[i[0]-r,i[1]-r]];return s.every(a=>Ge(a,e))&&!t.some(a=>[...s,...o].some(l=>Ge(l,a)))}function e1(i,e,t){let n=Math.ceil(Math.hypot(e[0]-i[0],e[1]-i[1])/nf);for(let r=1;rt+1e-6)&&r!==null){let a=o?s:s-nf;(!n||a-r>n[1]-n[0])&&(n=[r,a]),r=null}}return n}function t1(i,e=.32,t=.22,n=[]){let r=i.map(_=>_[0]),s=i.map(_=>_[1]),[o,a,l,c]=[Math.min(...r),Math.max(...r),Math.min(...s),Math.max(...s)],u=c-l>=a-o,h=_=>UP(_,i,n,t),f=(_,b)=>u?[_,b]:[b,_],[d,p,x,g]=u?[o,a,l,c]:[l,c,o,a],m=[],y=!0;for(let _=d+t;_<=p-t+1e-6;_+=e){let b=BP(w=>h(f(_,w)),x,g);if(!b||b[1]-b[0]<.2)continue;let M=w=>w?[f(_,b[0]),f(_,b[1])]:[f(_,b[1]),f(_,b[0])],S=M(y),v=m[m.length-1];if(v&&n.length>0&&!e1(v,S[0],h)){let w=M(!y);if(!e1(v,w[0],h))continue;S=w,y=!y}m.push(...S),y=!y}return m}function Qm(i,e=.7,t=12){return Array.from({length:t},(n,r)=>[i[0]+Math.cos(r/t*Math.PI*2)*e,i[1]+Math.sin(r/t*Math.PI*2)*e])}var jm=i=>Math.atan2(Math.sin(i),Math.cos(i));function n1(i,e,t){let n;if(e.mode==="cleaning"){if(i.path.length===0)return!1;n=i.path[i.next%i.path.length]}else if(e.mode==="returning"||e.mode==="docked")n=e.rest;else return!1;let[r,s]=[n[0]-i.pos[0],n[1]-i.pos[1]],o=Math.hypot(r,s);if(o<.02){if(e.mode==="cleaning")return i.next=(i.next+1)%i.path.length,!0;let l=jm(e.restHeading-i.heading);return Math.abs(l)<.02?!1:(i.heading+=Math.sign(l)*Math.min(Math.abs(l),QM*t),!0)}let a=jm(Math.atan2(r,s)-i.heading);if(i.heading=jm(i.heading+Math.sign(a)*Math.min(Math.abs(a),QM*t)),Math.abs(a)<.35){let l=Math.min(o,DP*t);i.pos=[i.pos[0]+r/o*l,i.pos[1]+s/o*l]}return!0}var rf=600*1e3,kP=3e3;function i1(i,e){if(i==null)return 1;let t=e-i;return t>rf?Math.max(0,1-(t-rf)/kP):1}function e0(i,e,t){let n=e/2,r=[],s=(a,l,c)=>r.push(a[0],t,a[1],l[0],t,l[1],c[0],t,c[1]);for(let a of i){for(let c=0;c+14?o=i.array[r*i.itemSize+s]:(s===0?o=i.getX(r):s===1?o=i.getY(r):s===2?o=i.getZ(r):s===3&&(o=i.getW(r)),i.normalized===!0&&(o=kr.normalize(o,i.array))),n.min[s]=Math.min(n.min[s],o),n.max[s]=Math.max(n.max[s],o)}return n}function c1(i){return Math.ceil(i/4)*4}function n0(i,e=0){let t=c1(i.byteLength);if(t!==i.byteLength){let n=new Uint8Array(t);if(n.set(new Uint8Array(i)),e!==0)for(let r=i.byteLength;r"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function $P(i,e){if(typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas){let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),i.convertToBlob({type:e,quality:t})}else return new Promise(t=>i.toBlob(t,e))}var r0=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r187"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map,normalMaps:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1,copyright:null},n),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);let r=this,s=r.buffers,o=r.json;n=r.options;let a=r.extensionsUsed,l=r.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),u=Object.keys(a),h=Object.keys(l);if(u.length>0&&(o.extensionsUsed=u),h.length>0&&(o.extensionsRequired=h),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),n.copyright&&(o.asset.copyright=n.copyright),n.binary===!0){let f=new FileReader;f.readAsArrayBuffer(c),f.onloadend=function(){let d=n0(f.result),p=new DataView(new ArrayBuffer(l1));p.setUint32(0,d.byteLength,!0),p.setUint32(4,WP,!0);let x=n0(XP(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(l1));g.setUint32(0,x.byteLength,!0),g.setUint32(4,HP,!0);let m=new ArrayBuffer(a1),y=new DataView(m);y.setUint32(0,VP,!0),y.setUint32(4,GP,!0);let _=a1+g.byteLength+x.byteLength+p.byteLength+d.byteLength;y.setUint32(8,_,!0);let b=new Blob([m,g,x,p,d],{type:"application/octet-stream"}),M=new FileReader;M.readAsArrayBuffer(b),M.onloadend=function(){t(M.result)}}}else if(o.buffers&&o.buffers.length>0){let f=new FileReader;f.readAsDataURL(c),f.onloadend=function(){let d=f.result;o.buffers[0].uri=d,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;let n=this.options,r=this.extensionsUsed;try{let s=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],r[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){let r=new Map;r.set(!0,this.uid++),r.set(!1,this.uid++),this.uids.set(e,r)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let n=new U;for(let r=0,s=e.count;r5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let n=e.clone(),r=new U;for(let s=0,o=n.count;s4?g=e.array[p*e.itemSize+x]:(x===0?g=e.getX(p):x===1?g=e.getY(p):x===2?g=e.getZ(p):x===3&&(g=e.getW(p)),e.normalized===!0&&(g=kr.normalize(g,e.array))),t===ot.FLOAT?u.setFloat32(h,g,!0):t===ot.INT?u.setInt32(h,g,!0):t===ot.UNSIGNED_INT?u.setUint32(h,g,!0):t===ot.SHORT?u.setInt16(h,g,!0):t===ot.UNSIGNED_SHORT?u.setUint16(h,g,!0):t===ot.BYTE?u.setInt8(h,g):t===ot.UNSIGNED_BYTE&&u.setUint8(h,g),h+=a}h%l!==0&&(h+=l-h%l)}let f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(f.target=s),s===ot.ARRAY_BUFFER&&(f.byteStride=l),this.byteOffset+=c,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(r){let s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){let o=n0(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,r(n.bufferViews.push(a)-1)}})}processAccessor(e,t,n,r){let s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"},a;if(e.array.constructor===Float32Array)a=ot.FLOAT;else if(e.array.constructor===Int32Array)a=ot.INT;else if(e.array.constructor===Uint32Array)a=ot.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=ot.SHORT;else if(e.array.constructor===Uint16Array)a=ot.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=ot.BYTE;else if(e.array.constructor===Uint8Array)a=ot.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(r===void 0||r===1/0)&&(r=e.count),r===0)return null;let l=qP(e,n,r),c;t!==void 0&&(c=e===t.index?ot.ELEMENT_ARRAY_BUFFER:ot.ARRAY_BUFFER);let u=this.processBufferView(e,a,n,r,c),h={bufferView:u.id,byteOffset:u.byteOffset,componentType:a,count:r,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(h)-1}processImage(e,t,n,r="image/png"){if(e!==null){let s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});let u=o.images.get(e),h=r+":flipY/"+n.toString();if(u[h]!==void 0)return u[h];a.images||(a.images=[]);let f={mimeType:r},d=i0();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);let p=d.getContext("2d",{willReadFrequently:!0});if(n===!0&&(p.translate(0,d.height),p.scale(1,-1)),e.data!==void 0){t!==On&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let g=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;ms.processBufferViewImage(g)).then(g=>{f.bufferView=g})):f.uri=fo.getDataURL(d,r);let x=a.images.push(f)-1;return u[h]=x,x}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let n={magFilter:Gn[e.magFilter],minFilter:Gn[e.minFilter],wrapS:Gn[e.wrapS],wrapT:Gn[e.wrapT]};return t.samplers.push(n)-1}async processTextureAsync(e){let n=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof Nr&&(e=await this.decompressTextureAsync(e,n.maxTextureSize));let o=e.userData.mimeType,a=this.processImage(e.image,e.format,e.flipY,o),l={sampler:this.processSampler(e)};o==="image/webp"?(l.extensions=l.extensions||{},l.extensions.EXT_texture_webp={source:a},this.extensionsUsed.EXT_texture_webp=!0,this.extensionsRequired.EXT_texture_webp=!0):l.source=a,e.name&&(l.name=e.name),await this._invokeAllAsync(async function(u){u.writeTexture&&await u.writeTexture(e,l)});let c=s.textures.push(l)-1;return r.textures.set(e,c),c}async processMaterialAsync(e,t){let n=this.cache,r=this.json,s=t!==void 0&&t.hasAttribute("tangent"),o=e.normalMap?e.uuid+":"+s:e.uuid;if(n.materials.has(o))return n.materials.get(o);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);let a={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let l=e.color.toArray().concat([e.opacity]);if(br(l,[1,1,1,1])||(a.pbrMetallicRoughness.baseColorFactor=l),e.isMeshStandardMaterial?(a.pbrMetallicRoughness.metallicFactor=e.metalness,a.pbrMetallicRoughness.roughnessFactor=e.roughness):(a.pbrMetallicRoughness.metallicFactor=0,a.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){let u=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),h={index:await this.processTextureAsync(u),texCoord:u.channel};this.applyTextureTransform(h,u),a.pbrMetallicRoughness.metallicRoughnessTexture=h}if(e.map){let u={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(u,e.map),a.pbrMetallicRoughness.baseColorTexture=u}if(e.emissive){let u=e.emissive;if(Math.max(u.r,u.g,u.b)>0&&(a.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let f={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(f,e.emissiveMap),a.emissiveTexture=f}}if(e.normalMap){let u=e.normalScale,h=u.x<0,f=s?u.y<0:u.y>0,d=e.normalMap;if(h||f){n.normalMaps.has(e.normalMap)===!1&&n.normalMaps.set(e.normalMap,{});let x=n.normalMaps.get(e.normalMap),g=`${h}:${f}`;x[g]===void 0&&(x[g]=await this.buildNormalMapTextureAsync(e.normalMap,h,f)),d=x[g]}let p={index:await this.processTextureAsync(d),texCoord:e.normalMap.channel};Math.abs(u.x)!==1&&(p.scale=Math.abs(u.x)),this.applyTextureTransform(p,e.normalMap),a.normalTexture=p}if(e.aoMap){let u={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(u.strength=e.aoMapIntensity),this.applyTextureTransform(u,e.aoMap),a.occlusionTexture=u}e.transparent?a.alphaMode="BLEND":e.alphaTest>0&&(a.alphaMode="MASK",a.alphaCutoff=e.alphaTest),e.side===ht&&(a.doubleSided=!0),e.name!==""&&(a.name=e.name),this.serializeUserData(e,a),await this._invokeAllAsync(async function(u){u.writeMaterialAsync&&await u.writeMaterialAsync(e,a)});let c=r.materials.push(a)-1;return n.materials.set(o,c),c}async processMeshAsync(e){let t=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let b=0,M=e.material.length;b0){let b=[],M=[],S={};if(e.morphTargetDictionary!==void 0)for(let v in e.morphTargetDictionary)S[e.morphTargetDictionary[v]]=v;for(let v=0;v0&&(l.extras={},l.extras.targetNames=M)}let x=Array.isArray(e.material);if(x&&o.groups.length===0)return null;let g=!1;if(x&&o.index===null){let b=[];for(let M=0,S=o.attributes.position.count;M0&&(S.targets=h),o.index!==null){let w=this.getUID(o.index);(y[b].start!==void 0||y[b].count!==void 0)&&(w+=":"+y[b].start+":"+y[b].count),t.attributes.has(w)?S.indices=t.attributes.get(w):(S.indices=this.processAccessor(o.index,o,y[b].start,y[b].count),t.attributes.set(w,S.indices)),S.indices===null&&delete S.indices}let v=await this.processMaterialAsync(m[y[b].materialIndex],o);v!==null&&(S.material=v),u.push(S)}g===!0&&o.setIndex(null),l.primitives=u,n.meshes||(n.meshes=[]),await this._invokeAllAsync(function(b){b.writeMesh&&b.writeMesh(e,l)});let _=n.meshes.push(l)-1;return t.meshes.set(s,_),_}detectMeshQuantization(e,t){if(this.extensionsUsed[t0])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");let r=e.split("_",1)[0];s1[r]&&s1[r].includes(n)&&(this.extensionsUsed[t0]=!0,this.extensionsRequired[t0]=!0)}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let n=e.isOrthographicCamera,r={type:n?"orthographic":"perspective"};return n?r.orthographic={xmag:e.right,ymag:e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:kr.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){let n=this.json,r=this.nodeMap;n.animations||(n.animations=[]),e=$r.Utils.mergeMorphTargetTracks(e.clone(),t);let s=e.tracks,o=[],a=[];for(let c=0;c0){let a=[];for(let l=0,c=e.children.length;l0&&(s.children=a)}return await this._invokeAllAsync(function(a){a.writeNode&&a.writeNode(e,s)}),o}async _processNodeWithPivotAsync(e){let t=this.json,n=this.options,r=this.nodeMap,s=e.pivot,o={},a=e.quaternion.toArray(),l=[e.position.x+s.x,e.position.y+s.y,e.position.z+s.z],c=e.scale.toArray();br(a,[0,0,0,1])||(o.rotation=a),br(l,[0,0,0])||(o.translation=l),br(c,[1,1,1])||(o.scale=c),o.extras={pivot:s.toArray()},e.name!==""&&(o.name=String(e.name)),this.serializeUserData(e,o);let u=t.nodes.push(o)-1;r.set(e,u);let h={},f=[-s.x,-s.y,-s.z];if(br(f,[0,0,0])||(h.translation=f),e.isMesh||e.isLine||e.isPoints){let x=await this.processMeshAsync(e);x!==null&&(h.mesh=x)}else e.isCamera&&(h.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);let p=[t.nodes.push(h)-1];if(e.children.length>0){let x=[];for(let g=0,m=e.children.length;g0&&(h.children=x)}return o.children=p,await this._invokeAllAsync(function(x){x.writeNode&&x.writeNode(e,o)}),u}async processSceneAsync(e){let t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);let r={};e.name!==""&&(r.name=e.name),t.scenes.push(r);let s=[];for(let o=0,a=e.children.length;o0&&(r.nodes=s),this.serializeUserData(e,r)}async processObjectsAsync(e){let t=new Tn;t.name="AuxScene";for(let n=0;n0&&await this.processObjectsAsync(n);for(let r=0;r0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},s[this.name]=!0);let a=r.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}},o0=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;let r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},a0=class{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){let o={index:await n.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let o={index:await n.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){let o={index:await n.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},l0=class{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;let r=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},c0=class{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){let o={index:await n.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,s.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,e.iridescenceThicknessMap){let o={index:await n.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},u0=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){let o={index:await n.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},h0=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let n=this.writer,r=n.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){let o={index:await n.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},f0=class{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;let r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},d0=class{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(zP)&&!e.specularIntensityMap&&!e.specularColorMap)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.specularIntensityMap){let o={index:await n.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){let o={index:await n.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},p0=class{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.sheenRoughnessMap){let o={index:await n.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){let o={index:await n.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},m0=class{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.anisotropyMap){let o={index:await n.processTextureAsync(e.anisotropyMap)};n.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},g0=class{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;let r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},x0=class{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;let n=this.writer,r=n.extensionsUsed,s={};if(e.bumpMap){let o={index:await n.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}},y0=class{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;let n=this.writer,r=e,s=new Float32Array(r.count*3),o=new Float32Array(r.count*4),a=new Float32Array(r.count*3),l=new ze,c=new U,u=new Sn,h=new U;for(let d=0;di.times[i.times.length-1]){if(Math.abs(i.times[i.times.length-1]-e)<.001)return i.times.length-1;r[r.length-1]=e,r.set(i.times,0),s.set(i.values,0),s.set(o.evaluate(e),i.values.length),a=r.length-1}else for(let l=0;le){r.set(i.times.slice(0,l+1),0),r[l+1]=e,r.set(i.times.slice(l+1),l+2),s.set(i.values.slice(0,(l+1)*n),0),s.set(o.evaluate(e),(l+1)*n),s.set(i.values.slice((l+1)*n),(l+2)*n),a=l+1;break}}return i.times=r,i.values=s,a},mergeMorphTargetTracks:function(i,e){let t=[],n={},r=i.tracks;for(let s=0;sKP.test(r.name)).map(r=>r.name);if(e.length>0)return e;let n=[...i.filter(r=>r.opacity>=.9&&r.lightness>.12&&!/glass|window|light|lamp/i.test(r.name))].sort((r,s)=>s.area-r.area)[0];return n?[n.name]:[]}function h1(i,e){let t=i.reduce((r,s)=>r+s,0);if(t<=e)return[...i];let n=e/t;return i.map(r=>Math.max(1,Math.floor(r*n)))}var f1=i=>/^Paint/.test(i)?i:`Paint_${i||"body"}`;var Jo=i=>i.indices.length/3;function ZP(i){let e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let n=0;nMath.floor(o/t)+1),s=new Float64Array(n);for(let o=0;oe?r=l:(s=l,o=c)}return jP(i,o)}var ki=class extends Error{reason;constructor(e,t){super(t),this.reason=e}},QP=1179937895;function eI(i){if(i.byteLength<20||new DataView(i).getUint32(0,!0)!==QP)throw new ki("not_glb","not a binary glTF (.glb) file")}async function b0(i){return eI(i),new Promise((e,t)=>{new Zo().parse(i,"",n=>e(n.scene),n=>{let r=String(n?.message??n);t(/draco|meshopt|ktx/i.test(r)?new ki("compressed",r):new ki("unreadable",r))})})}var tI=i=>i instanceof In?i:Object.assign(new In,{color:i.color?.clone()??new W(8947848),name:i.name,opacity:i.opacity,transparent:i.transparent});function m1(i,e){i.updateMatrixWorld(!0);let t=new Map;return i.traverse(n=>{let r=n;if(!r.isMesh)return;let s=r.geometry,o=s.getAttribute("position");if(!o)return;let a=tI(Array.isArray(r.material)?r.material[0]:r.material),l=t.get(a)??{positions:[],indices:[]};t.set(a,l);let c=new ze().multiplyMatrices(e,r.matrixWorld),u=l.positions.length/3,h=new U;for(let p=0;p({material:n,mesh:{positions:Float32Array.from(r.positions),indices:Uint32Array.from(r.indices)}}))}var nI=i=>{let e=0,[t,n,r]=[new U,new U,new U];for(let s=0;s.299*i.r+.587*i.g+.114*i.b;async function rI(i){let e=m1(await b0(i),new ze);if(e.length===0)throw new ki("empty","the file has no 3D parts");let t=new Ct;for(let s of e)t.union(new Ct().setFromArray(s.mesh.positions));let n=t.getSize(new U),r=e.map(s=>({name:s.material.name||"material",area:nI(s.mesh),opacity:s.material.opacity,lightness:iI(s.material.color)}));return{triangles:e.reduce((s,o)=>s+Jo(o.mesh),0),size:[n.x,n.y,n.z],materials:r,paint:u1(r)}}async function sI(i,e){let t=new ze().makeRotationY(e.turns*Math.PI/2),n=m1(await b0(i),t);if(n.length===0)throw new ki("empty","the file has no 3D parts");let r=h1(n.map(l=>Jo(l.mesh)),e.maxTriangles),s=new Tn,o=0;return n.forEach((l,c)=>{let u=p1(l.mesh,r[c]);if(Jo(u)===0)return;o+=Jo(u);let h=new Pe;h.setAttribute("position",new wt(u.positions,3)),h.setIndex(new wt(u.indices,1));let f=l.material.name||"material",d=e.paint.includes(f),p=new In({color:l.material.color.clone(),name:d?f1(f):f,metalness:l.material.metalness,roughness:l.material.roughness,opacity:l.material.opacity,transparent:l.material.opacity<1});d&&(p.userData.paint=!0),s.add(new Se(h,p))}),{glb:await new Promise((l,c)=>{new $r().parse(s,u=>u instanceof ArrayBuffer?l(u):c(new ki("unreadable","export gave no binary")),u=>c(new ki("unreadable",String(u))),{binary:!0})}),triangles:o}}async function oI(i,e,t=220){let n=await b0(i),r=new Ct().setFromObject(n),s=r.getCenter(new U),o=r.getSize(new U);n.traverse(d=>{let p=d;if(!p.isMesh)return;let x=p.material;(x.userData?.paint||/^Paint/.test(x.name))&&x.color.set(e),x.metalness=Math.min(x.metalness??0,.5)});let a=new Tn,l=new ar(16777215,1.6);l.position.set(-4,9,6),a.add(n,new Va(16777215,.5),new ms(16777215,6713480,1.1),l);let c=Math.max(o.x,o.y,o.z)*.75,u=new zn(-c,c,c,-c,.01,100);u.position.copy(s).add(new U(.9,.7,1.2).normalize().multiplyScalar(20)),u.lookAt(s);let h=new zr({alpha:!0,antialias:!0,preserveDrawingBuffer:!0});h.setSize(t,t,!1),h.render(a,u);let f=h.domElement.toDataURL("image/png");return h.dispose(),a.traverse(d=>{let p=d;p.isMesh&&p.geometry.dispose()}),f}var jo=null,g1=new Map,x1=16758087;function aI(i,e,t){let n=_t(i.type);if(n?.light)cl(e,n,{x:0,z:0,rotation:0,w:i.w,d:i.d,h:i.h},0,x1);else if(i.lamp)v0(e,{x:0,z:0,size:[i.w,i.d,i.h],base:0,rotation:0,variant:i.variant??null,lamp:i.lamp},Math.max(i.h+.15,.6),x1);else{let r={id:"preview",type:i.type,x:0,z:0,rotation:0,w:i.w,d:i.d,h:i.h,variant:i.variant??null,entity:null,power:null};Il(e,t,new ut,r)}}function lI(i){let e=i.getCenter(new U),t=new zn(-1,1,1,-1,.01,100);t.position.copy(e).add(new U(.9,.75,1.3).normalize().multiplyScalar(20)),t.lookAt(e),t.updateMatrixWorld();let n=.05;for(let s of[i.min.x,i.max.x])for(let o of[i.min.y,i.max.y])for(let a of[i.min.z,i.max.z]){let l=new U(s,o,a).applyMatrix4(t.matrixWorldInverse);n=Math.max(n,Math.abs(l.x),Math.abs(l.y))}let r=n*1.12;return Object.assign(t,{left:-r,right:r,top:r,bottom:-r}),t.updateProjectionMatrix(),t}function cI(i,e=180,t,n=1.3){let r=[i.type,i.w,i.d,i.h,i.variant??"",e,n].join("|"),s=g1.get(r);if(s)return s;t&&Wl(t),jo??=new zr({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),jo.setPixelRatio(Math.min(2,window.devicePixelRatio||1)),jo.setSize(e,e,!1),jo.setClearColor(0,0);let[o,a]=[new ut,new Wt];aI(i,o,a);let l=new Se(o.geometry(),new Ye({vertexColors:!0,color:new W(n,n,n)})),c=new gn(a.geometry(),new Lt({vertexColors:!0,color:new W(n*1.8,n*1.8,n*1.8)})),u=new Tn;u.add(l,c),jo.render(u,lI(new Ct().setFromObject(l)));let h=jo.domElement.toDataURL("image/png");for(let f of[l,c])f.geometry.dispose(),f.material.dispose();return g1.set(r,h),h}var b1={cleaning:3662079,returning:16758087,docked:4310123,idle:5995775,error:16726863},uI=1.4,M0=32,Je=2767456,v1=4873352,hI=1911110,_0=450,_1=125,fI=1.6,M1=3e4,w1=5,T1=360/w1,dI=new W(1714765),S1=.94;var S0=class{host;options;renderer;scene=new Tn;camera=new Jt(38,1,.1,400);controls;labels;root=new et;patternTexture;blindTexture;openingTargets=new Map;fridges=new Map;covers=new Map;screens=new Map;pickFurniture=new Map;pickOpenings=new Map;pickOpenings2=new Map;flashes=new Map;surfaceGrab=null;surfaceDragging=!1;furnishTypes=null;roofWindows=new Map;roofWindowsKey="";persons=[];personPins=new Map;floorInfo=new Map;roomInfo=new Map;groundTexture=null;devices=[];devicePins=new Map;ground;floors=[];building=null;furnitureColors=null;notePhoto=null;floorId=null;roomId=null;wallMode="auto";painted=!1;explode;frame=0;lastFrame=0;qualityMode="auto";governor=null;disposed=!1;resizeObserver;fpsFrames=0;worstFrame=0;lastStatsFrame=0;lowQuality=!1;highQuality=!1;effectTime=0;effectTick=!1;tintTick=!1;effectTimer;awakeUntil=0;deviceLook="";haloTexture;roof=null;roofO=0;keepRoof=!1;robots=new Map;pets=new Map;petMat=null;petTimer;robotGeo=null;robotTrails=new Map;trailTimers=new Map;robotMat=null;mowerMat=null;robotLedGeo=null;robotLast=0;petLast=0;meshes=[];meshLight=null;meshAsked=new Set;robotTimer;floorStack="dim";floorMap=new Map;labelsDirty=!0;viewKey=new Float64Array(6);pinMode=new WeakMap;size={w:1,h:1};labelInset=0;effectFloors=new Set;deviceFloor=new Map;statsOn=!1;parked=new Map;parkedSig="";plain=!1;rightBack=!1;rightDown=null;gateOpen=new Map;gateSig="";orbitSpeed=0;orbitLast=0;orbitTimer;onScreen=!0;intersection=null;swipe=null;furnish=!1;selectedFurniture=null;selectedDevice=null;pendingDevice=null;labelPlacer=new qu;pinHooks={furnishing:()=>this.furnish,pressedWhileFurnishing:e=>this.pendingDevice=e,selectWhileFurnishing:e=>{this.selectDevice(e),this.options.onDeviceSelect?.(e)},centre:e=>{let[t,n]=[e.getBoundingClientRect(),this.host.getBoundingClientRect()];return{x:t.left+t.width/2-n.left,y:t.top+t.height/2-n.top}},tap:(e,t,n)=>{let r=this.tapInRoom?this.devices.find(s=>s.id===e):void 0;if(r&&!this.deviceInReach(r.floorId,r.roomId))return this.options.onRoomTap?.(r.floorId,r.roomId);this.options.onDeviceTap?.(e,t,n)},hold:(e,t,n)=>this.options.onDeviceHold?.(e,t,n)};tapInRoom=!1;deviceGrab=null;grab=null;ghost=null;theme="neon";themeUniform={value:0};sun=null;weatherLayer;houseShadow=new Zu;sunArc=new rh;sunArcLocation=null;shadowKey="";footprint={key:"",rings:[]};mapLayer;mapSettings=null;mapNorth=0;groundY=0;skyView=null;weatherTimer;energyLayer;soundLayer;waterLayer;hydronicLayer;glassAlpha={value:.2};screenLayer;pictureLayer;liveAnchors=[];liveAnchorCb=null;roomTint=null;houseRadius=20;startView=null;fpsStart=0;constructor(e,t={}){this.host=e,this.options=t,this.explode=t.explode??!0,this.qualityMode=t.quality??"auto",this.renderer=this.makeRenderer(this.qualityMode),this.labels=document.createElement("div"),this.labels.className="nf-labels",e.append(this.labels),this.patternTexture=pI(),this.blindTexture=mI(),this.haloTexture=xI(),this.ground=new Se(new sn(1,1),new Ye({transparent:!0,blending:Ft,depthWrite:!1})),this.ground.rotation.x=-Math.PI/2,this.ground.renderOrder=-1,this.scene.add(this.ground,this.root),this.weatherLayer=new Gh(this.scene),this.scene.add(this.houseShadow.mesh),this.scene.add(this.sunArc.group),this.mapLayer=new Bh(this.scene),this.mapLayer.onChange=()=>this.invalidate(),this.energyLayer=new Xh(this.scene,this.liftOf),this.soundLayer=new Yh(this.scene,this.liftOf),this.waterLayer=new $h(this.scene,this.liftOf),this.hydronicLayer=new Zh(this.scene,this.liftOf),this.screenLayer=new Jh(this.scene,this.liftOf),this.screenLayer.onChange=()=>this.invalidate(),this.pictureLayer=new jh(this.scene,this.liftOf),this.pictureLayer.onChange=()=>this.invalidate(),this.weatherLayer.onFlash=n=>this.host.classList.toggle("live-flash",n),this.controls=this.makeControls(),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(e),document.addEventListener("visibilitychange",this.onVisibility),this.host.addEventListener("pointerdown",this.onTouch,{passive:!0}),this.renderer.domElement.addEventListener("pointerdown",this.onRightDown),this.renderer.domElement.addEventListener("pointerup",this.onRightUp),this.renderer.domElement.addEventListener("contextmenu",this.onContext),this.awakeUntil=performance.now()+M1,typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{let r=n.some(s=>s.isIntersecting);r!==this.onScreen&&(this.onScreen=r,r||(clearTimeout(this.effectTimer),this.effectTimer=void 0),r&&this.invalidate())}),this.intersection.observe(e)),this.resize()}get low(){return this.lowQuality}setRightBack(e){this.rightBack=e}onRightDown=e=>{this.rightDown=this.rightBack&&e.button===2?{x:e.clientX,y:e.clientY,at:performance.now()}:null};onRightUp=e=>{let t=this.rightDown;this.rightDown=null,!(!this.rightBack||!t||e.button!==2)&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6&&performance.now()-t.at<400&&this.options.onBack?.()};onContext=e=>{this.rightBack&&e.preventDefault()};setPlain(e){e!==this.plain&&(this.plain=e,this.building&&(this.rebuild(),this.invalidate()))}exportStl(e=10){let t=[];for(let n of this.floors)for(let r of[n.wallMesh,n.floorMesh]){let s=r.geometry.getAttribute("position");s&&t.push({positions:s.array,lift:n.floor.elevation})}return Zb(t,e)}setGateStates(e){let t=[...e].map(([n,r])=>`${n}=${r?1:0}`).sort().join("|");t!==this.gateSig&&(this.gateSig=t,this.gateOpen=e,this.building&&(this.rebuild(),this.invalidate()))}setParked(e){let t=[...e].map(([n,r])=>`${n}=${r}`).sort().join("|");t!==this.parkedSig&&(this.parkedSig=t,this.parked=e,this.building&&(this.rebuild(),this.invalidate()))}setStats(e){this.statsOn=e}setLabelInset(e){this.labelInset!==e&&(this.labelInset=e,this.labelsDirty=!0,this.invalidate())}setAutoOrbit(e){this.orbitSpeed=e,this.orbitLast=0,this.invalidate()}setQuality(e){this.qualityMode=e,this.swapRenderer(e)}dropToLow(){this.disposed||this.lowQuality||this.swapRenderer("low")}swapRenderer(e){let t=this.renderer.domElement,n=this.makeRenderer(e);this.rebuildTier(),this.applyTierFlags(),t.replaceWith(n.domElement),this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer=n;let{view:r,locked:s}=this.controls;this.controls.dispose(),this.controls=this.makeControls(),this.controls.view=r,this.controls.locked=s,this.resize()}setMeshSource(e){rg(e)}setPacks(e){Wl(e),this.building&&(this.rebuild(),this.invalidate())}setBuilding(e){let t=this.building===null;this.building=e,this.rebuild(),t&&this.fit(0),this.invalidate()}get walking(){return this.controls.walk!==null}startWalk(){let e=this.floors.filter(l=>l.floor.rooms.some(c=>c.points.length>=3)),t=(this.floorId?this.floorMap.get(this.floorId):void 0)??[...e].sort((l,c)=>Math.abs(l.floor.elevation)-Math.abs(c.floor.elevation))[0];if(!t||!t.bbox)return null;let n=t.floor.rooms.filter(l=>l.points.length>=3),r=n.find(l=>l.id===this.roomId)??[...n].sort((l,c)=>Sr(c.points)-Sr(l.points))[0],[s,o]=r?Gs(r.points):[(t.bbox.x0+t.bbox.x1)/2,(t.bbox.z0+t.bbox.z1)/2];this.floorId!==t.floor.id&&this.setFloor(t.floor.id,!1);let a=.3;return this.controls.walk={eye:new U(s,t.floor.elevation+t.ty+fI,o),yaw:this.controls.view.theta,pitch:-.05,stick:[0,0],keys:new Set,bounds:{x0:t.bbox.x0-a,x1:t.bbox.x1+a,z0:t.bbox.z0-a,z1:t.bbox.z1+a},last:0},this.labelsDirty=!0,this.wake(),t.floor.id}stopWalk(){this.controls.walk&&(this.controls.walk=null,this.labelsDirty=!0,this.fit(700))}setWalkStick(e,t){this.controls.walk&&(this.controls.walk.stick=[e,t],this.wake())}setFloor(e,t=!0){let n=this.keepCamera&&this.floorId!==null&&e!==null&&e!==this.floorId?{theta:this.controls.view.theta,phi:this.controls.view.phi,radius:this.controls.view.radius}:null;this.floorId=e,this.roomId=null,this.labelsDirty=!0,this.applyTargets(!t),this.applyHighlight(),this.fit(t?700:0,n)}setKeepCamera(e){this.keepCamera=e}setZoom(e){let t=Math.min(3,Math.max(.5,e||1));t!==this.zoom&&(this.zoom=t,this.building&&this.fit(400))}setFloorStack(e){e!==this.floorStack&&(this.floorStack=e,this.applyTargets(!1))}setKeepRoof(e){e!==this.keepRoof&&(this.keepRoof=e,this.invalidate())}setExplode(e){e!==this.explode&&(this.explode=e,this.applyTargets(!1),this.floorId===null&&this.fit(700))}selectRoom(e){if(this.roomId=e,this.labelsDirty=!0,this.applyHighlight(),!e){this.fit(700);return}let t=this.floors.find(u=>u.floor.rooms.some(h=>h.id===e)),n=t?.floor.rooms.find(u=>u.id===e);if(!t||!n)return;let r=n.start_view;if(r){let u=t.floor.elevation+t.ty,[h,f]=Gs(n.points),d=r.target??{x:h,y:.3,z:f};this.controls.flyTo({target:new U(d.x,d.y+u,d.z),radius:r.radius,phi:r.phi,theta:r.theta});return}let[s,o]=Gs(n.points),a=n.points.map(u=>u[0]),l=n.points.map(u=>u[1]),c=new U(Math.max(...a)-Math.min(...a),t.floor.cut_height,Math.max(...l)-Math.min(...l));this.controls.flyTo({target:new U(s,t.floor.elevation+t.ty+.3,o),radius:Math.max(4,this.distanceFor(c)*1.05),phi:.72})}get lowered(){return this.wallMode!=="auto"}setPaintedWalls(e){e!==this.painted&&(this.painted=e,this.rebuild(),this.invalidate())}wallPaint(e){return this.painted&&this.building?hm(this.building.settings,e):void 0}setWallMode(e){this.wallMode=e;for(let t of this.floors)this.buildLamps(t);this.invalidate()}setDevices(e){let t=e.map(r=>`${r.id}:${r.active?1:0}:${r.glow?r.glow.level.toFixed(1):"-"}`).join(";");t!==this.deviceLook&&(this.deviceLook=t,this.wake()),this.devices=e,this.labelsDirty=!0,this.effectFloors=new Set(e.filter(r=>r.effect&&r.glow||(r.spin??0)>0).map(r=>r.floorId)),this.deviceFloor=new Map(e.map(r=>[r.id,r.floorId]));let n=new Set;for(let r of e){n.add(r.id);let s=this.devicePins.get(r.id);s||(s={el:Kb(r.id,this.pinHooks),icon:"",text:"",watt:"",label:"",active:!1,unavailable:!1,glow:"",caption:""},this.devicePins.set(r.id,s),this.labels.append(s.el));let o=s.el;s.icon!==r.icon&&(s.icon=r.icon,o.querySelector(".nf-dev-icon").innerHTML=r.icon),s.text!==r.text&&(s.text=r.text,o.querySelector(".nf-dev-text").textContent=r.text);let a=r.caption??"";s.caption!==a&&(s.caption=a,o.querySelector(".nf-dev-name").textContent=a);let l=r.power!==null&&r.power!==void 0&&r.power>=1?r.powerText??`${Math.round(r.power)} W`:"";s.watt!==l&&(s.watt=l,o.querySelector(".nf-dev-watt").textContent=l);let c=`${r.name}: ${r.text}`;s.label!==c&&(s.label=c,o.title=r.name,o.setAttribute("aria-label",c)),s.active!==r.active&&(s.active=r.active,o.classList.toggle("nf-dev-on",r.active)),s.unavailable!==r.unavailable&&(s.unavailable=r.unavailable,o.classList.toggle("nf-dev-na",r.unavailable));let u=r.glow?`rgb(${r.glow.color.map(h=>Math.round(h*255)).join(", ")})`:"";s.glow!==u&&(s.glow=u,u?o.style.setProperty("--nf-glow",u):o.style.removeProperty("--nf-glow"))}for(let[r,s]of this.devicePins)n.has(r)||(s.el.remove(),this.devicePins.delete(r));for(let r of this.floors)this.buildGlow(r),this.buildLamps(r);this.invalidate()}setRoofWindows(e){let t=JSON.stringify([...e]);t!==this.roofWindowsKey&&(this.roofWindowsKey=t,this.roofWindows=e,this.buildRoofMesh(),this.invalidate())}setPersons(e){this.labelsDirty=!0,this.persons=e;let t=new Set;for(let n of e){t.add(n.id);let r=this.personPins.get(n.id);if(r||(r=document.createElement("div"),r.className="nf-person",r.dataset.entity=n.id,this.personPins.set(n.id,r),this.labels.append(r)),r.title=n.name,r.setAttribute("aria-label",n.name),r.dataset.picture!==(n.picture??"")||r.dataset.initials!==n.initials)if(r.dataset.picture=n.picture??"",r.dataset.initials=n.initials,r.replaceChildren(),n.picture){let s=document.createElement("img");s.src=n.picture,s.alt="",s.addEventListener("error",()=>s.replaceWith(document.createTextNode(n.initials))),r.append(s)}else r.textContent=n.initials}for(let[n,r]of this.personPins)t.has(n)||(r.remove(),this.personPins.delete(n));this.invalidate()}setNavigationLocked(e){this.controls.locked=e}setPickTargets(e,t,n=new Map){this.pickFurniture=e,this.pickOpenings=t,this.pickOpenings2=n}setNotePhotos(e){this.notePhoto=e}setFurnitureColors(e){JSON.stringify(e??{})!==JSON.stringify(this.furnitureColors??{})&&(this.furnitureColors=e,this.building&&(this.rebuild(),this.invalidate()))}setAccent(e){let t=qb(e),n=t?1:0;n===th.value&&(!t||eh.value.equals(new U(...t)))||(th.value=n,t&&eh.value.set(...t),this.invalidate())}setTheme(e){if(e===this.theme)return;this.theme=e,this.placeMap(),this.themeUniform.value=Yb(e);let t=Ml(e),n=[...this.floors.map(r=>r.materials.lines),...this.roof?[this.roof.lines]:[]];for(let r of n)r.blending=t,r.needsUpdate=!0;this.placeGround(),this.invalidate()}setFurnishMode(e){this.furnish=e,e||this.selectFurniture(null),this.invalidate()}selectFurniture(e){e&&this.selectedDevice&&this.selectDevice(null),this.selectedFurniture=e,this.updateGhost(),this.invalidate()}setSun(e){this.sun=e;for(let t of this.floors)this.buildSun(t);this.buildHouseShadow(),this.buildSunArc(),this.invalidate()}setLocation(e){this.sunArcLocation=e,this.buildSunArc(),this.invalidate()}buildSunArc(){let e=this.building,t=this.sunArcLocation,n=(e?.floors??[]).flatMap(c=>[...c.rooms.flatMap(u=>u.points),...(c.outdoor??[]).flatMap(u=>u.points)]);if(!e||!e.settings.sun_arc||!t||!n.length)return void this.sunArc.update(null,null,0);let r=n.map(c=>c[0]),s=n.map(c=>c[1]),o=[(Math.min(...r)+Math.max(...r))/2,(Math.min(...s)+Math.max(...s))/2],a=Math.max(6,Math.hypot(Math.max(...r)-Math.min(...r),Math.max(...s)-Math.min(...s))/2+3),l=Math.min(0,...e.floors.map(c=>c.elevation));this.sunArc.update({centre:o,radius:a,north:e.settings.north??0,...t},this.sun,l)}buildHouseShadow(){if(!this.houseShadow)return;let e=this.building,t=(e?.floors??[]).filter(u=>u.elevation>=-.01&&u.rooms.length),n=!e||!t.length||e.settings.sun_patches===!1||this.lowQuality,r=this.weatherLayer?.cloud??0,s=e?.settings.north??0,o=t.map(u=>`${u.elevation}:${u.height}:${JSON.stringify(u.rooms.map(h=>h.points))}`).join("|"),a=n?"off":`${this.sun?.elevation.toFixed(1)},${this.sun?.azimuth.toFixed(1)},${s},${r.toFixed(2)},${o}`;if(a===this.shadowKey)return;if(this.shadowKey=a,n){this.houseShadow.update([],0,0,null,0,0,!0);return}let l=Math.min(...t.map(u=>u.elevation)),c=Math.max(...t.map(u=>u.elevation+u.height));this.footprint.key!==o&&(this.footprint={key:o,rings:pr(t.flatMap(u=>u.rooms.map(h=>h.points)))}),this.houseShadow.update(this.footprint.rings,c-l,l+.03,this.sun,s,r,!1)}liftOf=e=>{if(!e)return{y:0,dy:0,visible:!0};let t=this.floorMap.get(e);return t?{y:t.floor.elevation+t.y,dy:t.y,visible:t.group.visible}:{y:0,dy:0,visible:!1}};setLiveEnergy(e,t){this.energyLayer.setArcs(e),this.energyLayer.setSparks(t),this.invalidate()}setLiveSound(e,t){this.soundLayer.set(e,t),this.invalidate()}setGlassWalls(e){let t=Math.min(1,Math.max(0,e));t!==this.glassAlpha.value&&(this.glassAlpha.value=t,this.invalidate())}setLiveWater(e){this.waterLayer.set(e),this.invalidate()}setHydronics(e){this.hydronicLayer.set(e),this.invalidate()}setLiveScreens(e){let t=[];for(let n of e){let r=this.building?.floors.find(a=>a.id===n.floorId),s=r?.furniture.find(a=>a.id===n.furnitureId),o=s&&r?bh(s,r):null;!s||!o||t.push({...n,x:s.x,z:s.z,rotation:s.rotation,rect:o})}this.screenLayer.set(t),this.invalidate()}setPictures(e){let t=[];for(let n of e){let r=this.building?.floors.find(a=>a.id===n.floorId),s=r?.furniture.find(a=>a.id===n.furnitureId),o=s&&r?Yp(s,r):null;!s||!o||t.push({id:n.furnitureId,floorId:n.floorId,url:n.url,border:n.border,fit:n.fit,x:s.x,z:s.z,rotation:s.rotation,rect:o})}this.pictureLayer.set(t),this.invalidate()}setLiveAnchors(e,t){this.liveAnchors=e,this.liveAnchorCb=t,this.invalidate()}placeLhAnchors(){let e=this.liveAnchorCb;if(!e||!this.liveAnchors.length)return;let t=new U,n=this.camera.matrixWorldInverse.elements,r=this.size.h*this.camera.projectionMatrix.elements[5]/2;this.liveAnchors.forEach((s,o)=>{let a=this.liftOf(s.floorId);t.set(s.x,a.y+s.y,s.z);let l=-(n[2]*t.x+n[6]*t.y+n[10]*t.z+n[14]);t.project(this.camera);let c=a.visible&&t.z>-1&&t.z<1&&Math.abs(t.x)<1.15&&Math.abs(t.y)<1.15;e(o,(t.x+1)/2*this.size.w,(1-t.y)/2*this.size.h,c,l>0?r/l:0)})}setSky(e){this.skyView=e,this.weatherLayer.set(e?{...e,low:e.low||this.lowQuality}:null),this.buildHouseShadow();for(let t of this.floors)this.buildSun(t);this.invalidate()}setRoomTint(e){let t=!!e!=!!this.roomTint;if(this.roomTint=e,this.tintTick=!0,this.applyHighlight(),t)for(let n of this.floors)n.glowSig="",this.buildGlow(n)}setScreens(e){this.screens=e;for(let t of this.floors)this.buildScreens(t);this.invalidate()}fillRoomPin(e,t,n){if(e.textContent=t||"\u2013",n){let r=document.createElement("small");r.textContent=n,e.append(r),e.classList.add("nf-pin-info")}else e.classList.remove("nf-pin-info")}setRoomInfo(e){if(!(e.size===this.roomInfo.size&&[...e].every(([n,r])=>this.roomInfo.get(n)===r))){this.roomInfo=e;for(let n of this.floors)for(let r of n.roomPins)this.fillRoomPin(r.pin,r.room.name,e.get(r.room.id))}}setFloorInfo(e){this.floorInfo=e;for(let t of this.floors){let n=t.label.querySelector("span"),r=e.get(t.floor.id)??this.options.floorInfo?.(t.floor)??"";n&&n.textContent!==r&&(n.textContent=r,t.labelSize=null,this.labelsDirty=!0)}this.invalidate()}setOpeningStates(e){let t=this.openingTargets;this.openingTargets=e,[...e].some(([n,r])=>!_p(t.get(n)??Bs,r))&&this.wake(),this.invalidate()}wake(){this.awakeUntil=performance.now()+M1,this.invalidate()}get resting(){return this.lowQuality&&performance.now()>this.awakeUntil}setFridgeDoors(e){for(let[t,n]of e){let r=this.fridges.get(t)??{l:n.left?1:0,r:n.right?1:0,tl:0,tr:0};r.tl=n.left?1:0,r.tr=n.right?1:0,this.fridges.set(t,r)}for(let t of[...this.fridges.keys()])e.has(t)||this.fridges.delete(t);this.invalidate()}setCovers(e){let t=!1;for(let[n,r]of e){let s=this.covers.get(n);s?s.t!==r&&(s.t=r,t=!0):(this.covers.set(n,{k:r,t:r}),t=!0)}for(let n of[...this.covers.keys()])e.has(n)||this.covers.delete(n);if(t){for(let n of this.floors)this.buildFridges(n);this.wake()}}stepCovers(e){let t=Math.min(1,e/4e3),n=!1;for(let r of this.covers.values()){if(r.k===r.t)continue;let s=r.t-r.k;r.k=Math.abs(s)<=t?r.t:r.k+Math.sign(s)*t,n=!0}if(n)for(let r of this.floors)this.buildFridges(r);return n}stepFridges(e){let t=vp(e),n=new Set;for(let[r,s]of this.fridges)for(let[o,a]of[["l","tl"],["r","tr"]]){let l=s[a]-s[o];if(Math.abs(l)<.004){l!==0&&(s[o]=s[a],n.add(r));continue}s[o]+=l*t,n.add(r)}if(!n.size)return!1;for(let r of this.floors)r.floor.furniture.some(s=>n.has(s.id))&&this.buildFridges(r);return!0}buildFridges(e){let t=new ut;for(let n of e.floor.furniture){let r=_t(n.type);if(r&&Q0(r)){lp(t,r,n,Gt(e.floor,n),this.covers.get(n.id)?.k??eg(r,null));continue}if(n.type!=="fridge_smart")continue;let s=this.fridges.get(n.id);Vp(t,n,Gt(e.floor,n),s?.l??0,s?.r??0)}e.fridgeMesh.geometry.dispose(),e.fridgeMesh.geometry=t.geometry(),e.fridgeMesh.visible=t.count>0}resetView(){this.fit(700)}setStartView(e){this.startView=e}currentView(){let e=this.controls.view,t=this.floorBase(this.floorId);return{theta:e.theta,phi:e.phi,radius:e.radius,target:{x:e.target.x,y:e.target.y-t,z:e.target.z}}}floorBase(e){let t=e===null?void 0:this.floorMap.get(e);return t?t.floor.elevation+t.ty:0}dispose(){this.disposed=!0,cancelAnimationFrame(this.frame),clearTimeout(this.effectTimer),clearTimeout(this.robotTimer),clearTimeout(this.orbitTimer),clearTimeout(this.weatherTimer),this.weatherLayer.dispose(),this.sunArc?.dispose(),this.houseShadow?.dispose(),this.mapLayer.dispose(),this.energyLayer.dispose(),this.soundLayer.dispose(),this.waterLayer.dispose(),this.hydronicLayer.dispose(),this.screenLayer.dispose(),this.pictureLayer.dispose(),this.resizeObserver.disconnect(),this.intersection?.disconnect(),document.removeEventListener("visibilitychange",this.onVisibility),this.host?.removeEventListener("pointerdown",this.onTouch),this.renderer?.domElement?.removeEventListener?.("pointerdown",this.onRightDown),this.renderer?.domElement?.removeEventListener?.("pointerup",this.onRightUp),this.renderer?.domElement?.removeEventListener?.("contextmenu",this.onContext),clearTimeout(this.petTimer),this.controls.dispose(),this.clear(),this.building=null,this.buildRoofMesh(),this.ground.geometry.dispose(),this.ground.material.dispose(),this.patternTexture.dispose(),this.blindTexture.dispose(),this.groundTexture?.dispose(),this.haloTexture.dispose();for(let e of this.robots.values())e.led.dispose();this.robots.clear();for(let e of this.robotTrails.values())e.removeFromParent(),e.geometry.dispose(),e.material.dispose();this.robotTrails.clear();for(let e of this.trailTimers.values())clearTimeout(e);this.trailTimers.clear(),this.robotGeo?.dispose(),this.robotLedGeo?.dispose(),this.robotMat?.dispose(),this.mowerMat?.dispose(),this.meshLight?.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),this.labels.remove()}invalidate(){this.frame||this.disposed||document.hidden||!this.onScreen||(this.frame=requestAnimationFrame(e=>this.render(e)))}makeRenderer(e){let t=e==="low"||e==="auto"&&zy();this.lowQuality=t,this.weatherLayer&&this.skyView&&this.weatherLayer.set({...this.skyView,low:this.skyView.low||t}),this.weatherLayer&&this.buildHouseShadow(),this.highQuality=e==="high";let n=new zr({antialias:!t,alpha:!0,powerPreference:t?"low-power":"default"}),r=Math.min(window.devicePixelRatio||1,t?1:e==="high"?2.5:2);return n.setPixelRatio(r),this.governor=e==="auto"&&!t?new Vu(r,Math.min(1,r)):null,n.setClearColor(0,0),n.outputColorSpace=dt,n.domElement.className="nf-canvas",this.host.prepend(n.domElement),n}makeControls(){return new Dl(this.renderer.domElement,this.camera,{change:()=>this.wake(),tap:(e,t)=>this.onTap(e,t),hold:(e,t)=>this.onHold(e,t),swipeStart:(e,t,n,r)=>this.swipeStart(e,t,n,r),swipeMove:e=>this.swipe&&this.options.onDeviceSwipe?.(this.swipe.entity,"move",e,this.swipe.x,this.swipe.y),swipeEnd:()=>{this.swipe&&this.options.onDeviceSwipe?.(this.swipe.entity,"end",0,this.swipe.x,this.swipe.y),this.swipe=null},grab:(e,t)=>this.grabFurniture(e,t),drag:(e,t)=>this.dragFurniture(e,t),drop:()=>this.dropFurniture(),doubleTap:(e,t)=>{let n=this.floorId&&this.options.onRoomDoubleTap?this.pick(e,t):null;n&&!("entity"in n)&&n.roomId?this.options.onRoomDoubleTap(n.floorId,n.roomId):this.options.onBack?.()}})}onTouch=()=>this.wake();onVisibility=()=>{document.hidden&&(clearTimeout(this.effectTimer),this.effectTimer=void 0),document.hidden||this.invalidate()};scheduleEffects(){if(!this.hasVisibleEffects(document.hidden)||this.resting){clearTimeout(this.effectTimer),this.effectTimer=void 0;return}if(this.effectTimer!==void 0)return;let e=this.lowQuality?2*_1:_1;this.effectTimer=setTimeout(()=>{if(this.effectTimer=void 0,!!this.hasVisibleEffects(document.hidden)){this.effectTime=performance.now()/1e3,this.effectTick=!0;for(let t of this.floors)t.o<.02||!this.effectFloors.has(t.floor.id)||(this.buildLamps(t),this.buildGlow(t));this.invalidate()}},e)}hasVisibleEffects(e){return!e&&!this.disposed&&this.onScreen&&this.floors.some(t=>t.o>=.02&&this.effectFloors.has(t.floor.id))}resize(){let e=this.host.clientWidth||1,t=this.host.clientHeight||1;this.size={w:e,h:t},this.labelsDirty=!0,this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.invalidate()}clear(){for(let e of this.robots.values())e.group.removeFromParent();for(let e of this.meshes)e.group.removeFromParent(),Jm(e.group);this.meshes=[];for(let e of this.floors){e.group.traverse(t=>{t.geometry?.dispose()});for(let t of Object.values(e.materials))Array.isArray(t)||t.dispose();for(let t of e.materials.ghosts)t.material.dispose();this.root.remove(e.group)}this.floors=[],this.floorMap=new Map;for(let e of[...this.labels.children])e.dataset.entity||e.remove()}buildLightSurface(e){let t=this.lowQuality?.5:.25,n=Ep(e.floor,e.geo.walls2d,e.geo.wallBuckets,e.geo.openings,t,e.geo.holes,e.geo.roofUnder),r=gI(e.floor,e.geo.openRooms);if(e.lightZones=r.some((a,l)=>a!==l)?r:null,e.lightZones){for(let a=0;a=0&&l=0&&a.a=0&&a.bthis.glowOf(h)),r=t.doors.map(h=>{let f=e.geo.openings.find(p=>p.opening.id===h.id);if(f&&Mr(f.opening,f.exterior)==="passage")return 1;let d=e.openings.get(h.id);return d?Math.max(d.open,d.open2??0):.5}),s=n.map(h=>`${h.x.toFixed(2)},${h.y.toFixed(2)},${h.z.toFixed(2)},${h.kind},${h.level.toFixed(3)},${h.color.map(f=>f.toFixed(3)).join("/")}`).join(";")+"|"+r.map(h=>h.toFixed(1)).join(",");if(s===e.glowSig)return;e.glowSig=s;let o=e.glowMesh.geometry,a=o.getAttribute("color");if(!n.length){e.glowMesh.visible=!1,o.setDrawRange(0,0);return}let l=Rp(t,n,.42,r);if(this.roomTint){let h=e.floor.rooms.length;for(let f=0;f.004;if(f)for(let d=0;d<6;d++)c[u++]=h*6+d}o.index.needsUpdate=!0,o.setDrawRange(0,u),e.glowMesh.visible=u>0}withoutFurniture(e){if(this.gateOpen.size&&(e.outdoor??[]).some(n=>n.gates?.length)&&(e={...e,outdoor:e.outdoor.map(n=>n.gates?.length?{...n,gates:n.gates.map(r=>({...r,open:this.gateOpen.get(r.id)??!1}))}:n)}),!this.plain)return e;let t=n=>n.type==="stairs"||n.type==="stairwell"||!!_t(n.type)?.hole;return{...e,furniture:e.furniture.filter(t)}}rebuild(){let e=new Map(this.floors.map(s=>[s.floor.id,{y:s.y,o:s.o}])),t=new Map(this.floors.map(s=>[s.floor.id,s.openings]));this.clear();let n=this.building;if(!n)return;Oy({...n.settings.furniture_colors,...this.furnitureColors});let r=[...n.floors].sort((s,o)=>s.elevation-o.elevation);for(let s of n.floors){let o=n.settings.roof?.solar??[],a=_h(n)?.id===s.id?o.filter(V=>V.face===Ll).map(V=>({field:V,face:Mh(n,V)})):[],l=o.filter(V=>V.face.startsWith(`wall:${s.id}:`));if(l.length){let V=new Map(vh(n,s.id).map(re=>[re.key,re]));for(let re of l){let ye=V.get(re.face);ye&&a.push({field:re,face:ye})}}let u=(n.settings.roof.sections??[]).some(V=>pp(V,s.elevation+s.height))?(V,re)=>{let ye=mp(n,V,re);return ye===null?null:ye-s.elevation}:void 0,h=fm(this.withoutFurniture(Dh(s,this.parked)),n.settings.wall_exterior,n.settings.wall_interior,dm(n.floors,s),a,u,this.wallPaint(s)),f={standing:{value:65535},glass:{value:0},slope:{value:new vt},slopeY:{value:new Ue},glassAlpha:this.glassAlpha},d=$b({mask:f,look:this.themeUniform,theme:this.theme,textures:{pattern:this.patternTexture,blinds:this.blindTexture,halo:this.haloTexture}}),p=new et,x=new Se(h.floor,d.floor),g=new Se(h.shadow,d.shadow);g.renderOrder=1;let m=new Se(h.floor,d.pattern);m.renderOrder=2;let y=new Se(new Pe,d.glow);y.renderOrder=3,y.visible=!1;let _=new Se(new Pe,d.frames),b=new Se(new Pe,d.blinds),M=new Se(new Pe,d.glass);M.renderOrder=4;let S=new Se(new Pe,d.lamps);S.visible=!1;let v=new Se(new Pe,d.cones);v.visible=!1,v.renderOrder=3;let w=new xn(new Pe,d.halos);w.visible=!1,w.renderOrder=7;let R=new Se(new Pe,d.cones);R.visible=!1,R.renderOrder=7;let T=new Se(new Pe,d.lamps);T.visible=!1;let C=new Se(new Pe,d.screens);C.visible=!1,C.renderOrder=5;for(let V of[_,b,M])V.frustumCulled=!1;let L=new Se(h.walls,d.glassWall),O=new Se(h.walls,d.wall);L.renderOrder=6,p.add(x,g,m,y,O,new gn(h.lines,d.lines),_,b,M,S,v,w,R,T,C,L);for(let V of h.ghosts){let re=Jn(new Ye({vertexColors:!0,transparent:!0,opacity:V.opacity,depthWrite:!1,side:ht}),this.themeUniform);d.ghosts.push({material:re,base:V.opacity});let ye=new Se(V.geometry,re);ye.renderOrder=2,p.add(ye)}this.root.add(p);let P=document.createElement("button");P.className="nf-pin nf-pin-floor",P.dataset.floor=s.id;let I=document.createElement("b");I.textContent=s.name||"\u2013";let D=document.createElement("span");D.textContent=this.floorInfo.get(s.id)??this.options.floorInfo?.(s)??"",P.append(I,D),P.addEventListener("click",()=>this.options.onFloorTap?.(s.id)),this.labels.append(P);let F=e.get(s.id),H=[],B=null;for(let V of s.rooms){let re=document.createElement("button");re.className="nf-pin",re.dataset.room=V.id,re.dataset.floor=s.id,this.fillRoomPin(re,V.name,this.roomInfo.get(V.id)),re.addEventListener("click",()=>this.options.onRoomTap?.(s.id,V.id)),this.labels.append(re);let[ye,Y]=Gs(V.points);H.push({pin:re,room:V,cx:ye,cz:Y});for(let[Q,se]of V.points)B??={x0:Q,x1:Q,z0:se,z1:se},B.x0=Math.min(B.x0,Q),B.x1=Math.max(B.x1,Q),B.z0=Math.min(B.z0,se),B.z1=Math.max(B.z1,se)}let X=[];for(let V of s.notes??[]){if(!V.text)continue;let re=document.createElement("button");re.className=`nf-pin nf-note-pin${D0(V)?" nf-note-due":""}`,re.title=V.text;let ye=V.text.length>28?`${V.text.slice(0,27)}\u2026`:V.text;re.textContent=`${V.photo?"\u{1F4F7} ":"\u270E "}${ye}`,re.addEventListener("click",()=>{let Y=re.classList.toggle("nf-note-open");re.textContent=`${V.photo?"\u{1F4F7} ":"\u270E "}${Y?V.text:ye}`;let Q=Y&&V.photo?this.notePhoto?.(V.photo):null;if(Q){let se=document.createElement("img");se.className="nf-note-photo",se.alt="",se.src=Q,se.addEventListener("load",()=>{this.labelsDirty=!0,this.invalidate()}),re.append(se)}this.labelsDirty=!0,this.invalidate()}),this.labels.append(re),X.push({pin:re,note:V})}this.floors.push({floor:s,rank:r.indexOf(s),group:p,geo:h,floorMesh:x,shadowMesh:g,patternMesh:m,glowMesh:y,lightSurface:null,lightZones:null,framesMesh:_,glassMesh:M,blindsMesh:b,lampMesh:S,sunMesh:v,sunSig:"",haloMesh:w,coneMesh:R,wedgeTris:[],fridgeMesh:T,lampTris:[],lampFurnTris:[],frameTris:[],glassTris:[],blindTris:[],wallMesh:O,screenMesh:C,screenSig:"",flowLayout:"",glowSig:"",lampShapeSig:"",lampColorSig:"",lampShade:new Float32Array(0),lampRanges:new Map,bbox:B,roomPins:H,notePins:X,labelSize:null,materials:d,mask:f,openings:new Map,y:F?.y??0,o:F?.o??1,ty:0,to:1,appliedO:-1,label:P})}this.floorMap=new Map(this.floors.map(s=>[s.floor.id,s])),this.buildPets();for(let s of this.floors)this.buildFridges(s);this.labelsDirty=!0,this.floorId&&!n.floors.some(s=>s.id===this.floorId)&&(this.floorId=null);for(let s of this.floors){this.buildLamps(s),this.buildScreens(s);let o=t.get(s.floor.id);for(let a of s.geo.openings)s.openings.set(a.opening.id,o?.get(a.opening.id)??this.openingTargets.get(a.opening.id)??Bs);this.buildOpenings(s),this.buildLightSurface(s),this.buildSun(s)}this.applyTargets(e.size===0),this.applyHighlight(),this.applyTierFlags(),this.buildRoofMesh(),this.updateGhost(),this.placeMeshes()}placeMeshes(){for(let e of this.meshes)e.group.removeFromParent(),Jm(e.group);this.meshes=[];for(let e of this.floors)for(let t of Dh(e.floor,this.parked).furniture){let n=_t(t.type);if(!n?.mesh)continue;let r=n.mesh;if(!Xl(t.type)){this.meshAsked.has(r)||(this.meshAsked.add(r),KM(r).then(a=>{a&&!this.disposed&&this.rebuild()}));continue}let s=n.colors?.length?(n.colors.find(a=>a.id===t.variant)??n.colors[0]).hex:null,o=ZM(r,{x:t.x,z:t.z,y:Gt(e.floor,t),rotation:t.rotation,mirror:t.mirror,w:t.w,d:t.d,h:t.h,paint:s});o&&(this.meshLight||(this.meshLight=JM(this.root,this.renderer)),jM(o,this.meshLight.env),e.group.add(o),this.meshes.push({group:o,furnitureId:t.id}))}this.invalidate()}buildRoofMesh(){this.roof&&(this.roof.group.traverse(a=>a.geometry?.dispose()),this.roof.solid.dispose(),this.roof.lines.dispose(),this.roof.glass.dispose(),this.scene.remove(this.roof.group),this.roof=null);let e=this.building?lm(this.building,this.roofWindows):[];if(!e.length)return;let t=new et,n=Jn(new Ye({vertexColors:!0,transparent:!0,side:ht}),this.themeUniform),r=Jn(new Lt({vertexColors:!0,transparent:!0,blending:Ml(this.theme),depthWrite:!1}),this.themeUniform,!0),s=Jn(new Ye({vertexColors:!0,transparent:!0,side:ht,depthWrite:!1}),this.themeUniform),o=e.map(a=>{let l=new et;return l.add(new Se(a.solid.geometry(),n),new gn(a.lines.geometry(),r)),a.glass.count&&l.add(new Se(a.glass.geometry(),s)),l.renderOrder=8,t.add(l),{group:l,floorId:a.floor.id,rideId:xp(this.building,a.floor,a.sections??[]),base:a.base,lift:a.lift!==!1}});t.renderOrder=8,this.scene.add(t),this.roof={group:t,parts:o,solid:n,lines:r,glass:s},this.placeRoof()}placeRoof(e=1e3){let t=this.roof;if(!t)return!1;let n=this.keepRoof?1:Math.min(1,Math.max(0,(this.controls.view.radius/this.houseRadius-.62)/.3)),s=(this.floorId===null||this.floors.length===1)&&!this.lowered?S1*n:0,o=bp(e),a=this.roofO;this.roofO+=(s-this.roofO)*o,Math.abs(s-this.roofO)<.004&&(this.roofO=s),t.group.visible=this.roofO>.02;for(let l of t.parts){let c=this.floorMap.get(l.floorId);if(!c)continue;let u=this.floorMap.get(l.rideId)??c,h=u.ty>0?Math.min(1,u.y/u.ty):this.explode&&this.floorId===null?1:0,f=Math.max(0,1-this.roofO/S1);l.group.position.y=c.floor.elevation+u.y+l.base+f*2.2+(l.lift?h*uI:0)}return t.solid.opacity=this.roofO,t.solid.depthWrite=this.roofO>.5,t.lines.opacity=this.roofO,t.glass.opacity=this.roofO*.28,this.roofO!==a&&this.roofO!==s}applyTierFlags(){let e=this.lowQuality;this.ground.visible=!e&&this.theme!=="day"&&this.floors.some(t=>t.floor.rooms.length>0);for(let t of this.floors)t.patternMesh.visible=!e,t.shadowMesh.visible=!e&&t.o>.98;this.invalidate()}rebuildTier(){for(let e of this.floors)e.flowLayout="",this.buildLightSurface(e),e.lampShapeSig="",this.buildLamps(e)}get houseView(){return this.floorId===null&&this.floors.length>1}applyTargets(e){let t=this.floorId?this.floorMap.get(this.floorId):void 0;for(let n of this.floors){let r=ub(n.rank,t?.rank,this.explode,this.floorStack);[n.ty,n.to]=[r.y,r.opacity],e&&([n.y,n.o]=[r.y,r.opacity]),this.applyFloor(n)}this.invalidate()}applyFloor(e){e.group.position.y=e.floor.elevation+e.y,e.group.visible=e.o>.02,e.shadowMesh.visible=e.o>.98&&!this.lowQuality,!(Math.abs(e.appliedO-e.o)<.001)&&(e.appliedO=e.o,fb(e.materials,e.o))}stepFloors(e){let t=!1,n=bp(e);for(let r of this.floors){let s=hb(r,n);s.settled&&(this.labelsDirty=!0),(s.moving||s.settled)&&this.applyFloor(r),t||=s.moving}return t}stepOpenings(e){let t=!1,n=vp(e);for(let r of this.floors){let s=!1;for(let[o,a]of r.openings){let l=this.openingTargets.get(o)??Bs;if(_p(a,l))continue;let c=mb(a,l,n);r.openings.set(o,c.state),s=!0,t||=c.moving}s&&(this.buildOpenings(r),this.buildGlow(r),this.buildSun(r))}return t}fanPhase(e){return e.lamp!=="fan"||!e.spin?0:Math.round(this.effectTime*e.spin*360%T1*10)/10}glowOf(e){return rM(e.glow,e.effect,this.effectTime)}buildLamps(e){let t=performance.now(),n=h=>{let f=this.flashes.get(h);if(!f||f<=t)return 0;let d=f-t,p=d>_0?.5+.5*Math.sin(d/140):d/_0;return Math.round(p*10)/10},r=this.devices.filter(h=>h.floorId===e.floor.id&&h.lamp),s=this.wallMode+(this.lowQuality?"L":this.highQuality?"H":"M")+r.map(h=>`${h.id},${h.lamp},${h.variant},${h.x},${h.z},${h.y},${h.rotation??0},${h.roll??0},${h.upright?1:0},${h.rise??0},${h.size?.join("/")},${h.base??0},${h.pack??""},${h.mirror?1:0},${h.ceiling??""},${this.fanPhase(h)}`).join(";"),o=r.map(h=>this.glowOf(h)),a=this.devices.filter(h=>h.floorId===e.floor.id&&h.wedge),l=r.map((h,f)=>`${n(h.id)},${o[f]?`${o[f].level.toFixed(3)},${o[f].color.map(d=>d.toFixed(3)).join("/")}`:"off"}`).join(";")+"|"+a.map(h=>`${h.id},${h.x},${h.z},${h.rotation??0},${JSON.stringify(h.wedge)}`).join(";");if(s!==e.lampShapeSig||!e.lampMesh.geometry.getAttribute("position")){e.lampShapeSig=s,e.lampColorSig="";let h=new ut,f=[],d=[],p=new Map,x=e.floor.height;for(let g of r){let m=g.lamp==="strip"?(g.base??x)>Math.min(e.floor.cut_height,g.ceiling??x):g.lamp?$u.has(g.lamp):!1;if(!g.lamp||m&&this.lowered)continue;let y=h.count,_=g.pack?_t(g.pack):void 0,[b,M,S]=g.size??[.3,.3,.3];_?cl(h,_,{x:g.x,z:g.z,rotation:g.rotation??0,w:b,d:M,h:S,mirror:g.mirror},g.base??0,65280):v0(h,{...g,lamp:g.lamp,phase:this.fanPhase(g)},g.ceiling??x,65280),p.set(g.furnitureId??g.id,{start:y,end:h.count}),g.pickable!==!1&&f.push({id:g.id,start:y,end:h.count}),g.furnitureId&&d.push({id:g.furnitureId,start:y,end:h.count})}e.lampTris=f,e.lampFurnTris=d,e.lampRanges=p,e.lampShade=Vy(h.c),e.lampMesh.geometry.dispose(),e.lampMesh.geometry=h.geometry(),e.lampMesh.visible=h.count>0}if(l===e.lampColorSig)return;e.lampColorSig=l;let c=e.lampMesh.geometry.getAttribute("color"),u=c.array;r.forEach((h,f)=>{let d=e.lampRanges.get(h.furnitureId??h.id);if(!d)return;let p=o[f],x=p?.55+.45*p.level:0,g=p?new W(...p.color.map(_=>Math.min(1,_*x))):new W(hI),m=n(h.id);m>0&&g.lerp(new W(1,1,1),.7*m);let y=new W(g.getHex());Gy(u,e.lampShade,d,[y.r,y.g,y.b])}),c.needsUpdate=!0,this.buildHalos(e)}buildSun(e){let t=this.building?.settings.sun_patches===!1?null:this.sun,n=this.building?.settings.north??0,r=this.weatherLayer?.cloud??0,s=Ab(t,n,r,e.openings.values());if(s===e.sunSig)return;e.sunSig=s;let o=Eb({floor:e.floor,openings:e.geo.openings,states:e.openings,sun:t,northDegrees:n,cloud:r});e.sunMesh.geometry.dispose(),e.sunMesh.geometry=o.geometry(),e.sunMesh.visible=o.count>0}buildHalos(e){let t={positions:[],colours:[]},n=new ut,r=[];for(let a of this.devices)if(a.floorId===e.floor.id&&a.wedge){let l=vb(n,a,e.geo.walls2d);a.wedge.through||r.push({id:a.id,...l})}e.wedgeTris=r;let s=this.lowered;for(let a of this.lowQuality?[]:this.devices){let l=this.glowOf(a);if(a.floorId!==e.floor.id||!a.lamp||!l||s&&wb(a.lamp))continue;let c=a;Mb(t,c,l,a.ceiling??e.floor.height),this.highQuality&&(a.lamp==="downlight"||a.lamp==="spot")&&Sb(n,c,l,a.ceiling??e.floor.height)}let o=new Pe;o.setAttribute("position",new Le(t.positions,3)),o.setAttribute("color",new Le(t.colours,3)),e.haloMesh.geometry.dispose(),e.haloMesh.geometry=o,e.haloMesh.visible=!this.lowQuality&&t.positions.length>0,e.coneMesh.geometry.dispose(),e.coneMesh.geometry=n.geometry(),e.coneMesh.visible=n.count>0}buildScreens(e){let t=Dh(e.floor,this.parked).furniture.filter(s=>this.screens.has(s.id)),n=t.map(s=>`${s.id}:${s.x},${s.z},${s.rotation},${s.w},${s.d},${s.h},${s.mount_y??""},${s.mirror?1:0}:${JSON.stringify(this.screens.get(s.id))}`).join(";");if(n===e.screenSig&&e.screenMesh.geometry.getAttribute("position"))return;e.screenSig=n;let r=new ut;for(let s of t){let o=this.screens.get(s.id),a=s.rotation*mt,l=Math.cos(a),c=Math.sin(a),u=(b,M,S)=>[s.x+b*l-S*c,M,s.z+b*c+S*l];if(o.gangs){let b=_t(s.type);if(!b)continue;for(let M of o.gangs){let S=new W(...M.color.map(v=>Math.min(1,v*(.45+.55*M.level))));ll(r,b,s,Gt(e.floor,s),S.getHex(),v=>v.gang===M.gang)}continue}if(o.print!==void 0){let b=Gt(e.floor,s)+s.h*.2,M=Math.min(s.w,s.d)*.16,S=b+s.h*.38*Math.min(1,Math.max(0,o.print)),v=new W(...o.color.map(C=>Math.min(1,C*(.35+.65*o.level)))),w=v.clone().multiplyScalar(.7),R=[u(-M,b,-M),u(M,b,-M),u(M,b,M),u(-M,b,M)],T=[u(-M,S,-M),u(M,S,-M),u(M,S,M),u(-M,S,M)];r.tri(T[0],T[2],T[1],v),r.tri(T[0],T[3],T[2],v);for(let C=0;C<4;C++){let L=(C+1)%4;r.tri(R[C],R[L],T[L],w),r.tri(R[C],T[L],T[C],w)}continue}if(o.fill!==void 0){let b=qp(s,e.floor);if(!b)continue;let M=b.rect,S=Math.min(1,Math.max(0,o.fill)),v=new W(...o.color.map(C=>Math.min(1,C*(.35+.65*o.level)))),w=new W(.08,.1,.13),R=M.z,T=(C,L,O,P,I)=>{r.tri(u(C,O,R),u(L,O,R),u(L,P,R),I),r.tri(u(C,O,R),u(L,P,R),u(C,P,R),I)};if(b.vertical){let C=M.y0+(M.y1-M.y0)*S;S>0&&T(M.x0,M.x1,M.y0,C,v),S<1&&T(M.x0,M.x1,C,M.y1,w)}else{let C=M.x0+(M.x1-M.x0)*S;S>0&&T(M.x0,C,M.y0,M.y1,v),S<1&&T(C,M.x1,M.y0,M.y1,w)}continue}if(o.leds){let b=_t(s.type);if(!b)continue;let M=new W(...o.color.map(S=>Math.min(1,S*(.35+.65*o.level))));ll(r,b,s,Gt(e.floor,s),M.getHex(),S=>!!S.glow||!!S.screen);continue}if(o.heat){let b=_t(s.type);if(!b)continue;let M=new W(...o.color.map(S=>Math.min(1,S*(.35+.65*o.level))));ll(r,b,s,Gt(e.floor,s),M.getHex(),()=>!0);continue}if(o.faces){let b=Math.max(.05,s.w)*(s.mirror?-1:1),M=Math.max(.05,s.d),S=Math.max(.005,s.h),v=Gt(e.floor,s);for(let w of o.faces){let R=w.part==="right"?.03:-Math.abs(b)/2+.03,T=w.part==="left"?-.03:Math.abs(b)/2-.03,C=v+(w.part==="bottom"?S*.45:S)+.006,L=new W(...w.color.map(B=>Math.min(1,B*(.35+.65*w.level)))),O=new W(0,0,0),P=(B,X,V=C)=>u(B*Math.sign(b),V,X),I=[P(R,-M/2+.03),P(T,-M/2+.03),P(T,M/2-.03),P(R,M/2-.03)];r.tri(I[0],I[2],I[1],L),r.tri(I[0],I[3],I[2],L);let D=.12+.1*w.level,F=L.clone().multiplyScalar(.5),H=[P(R-D,-M/2-D,C+.004),P(T+D,-M/2-D,C+.004),P(T+D,M/2+D,C+.004),P(R-D,M/2+D,C+.004)];for(let B=0;B<4;B++){let X=(B+1)%4;r.tri(I[B],H[X],H[B],F,O,O),r.tri(I[B],I[X],H[X],F,F,O)}}continue}let h=bh(s,e.floor);if(!h)continue;let f=new W(...o.color.map(b=>Math.min(1,b*(.35+.65*o.level)))),d=new W(0,0,0),p=h.z+.004;r.tri(u(h.x0,h.y0,p),u(h.x1,h.y0,p),u(h.x1,h.y1,p),f),r.tri(u(h.x0,h.y0,p),u(h.x1,h.y1,p),u(h.x0,h.y1,p),f);let x=Math.min(1.5,o.halo??1);if(x<=0)continue;let g=(.18+.12*o.level)*Math.min(1,x),m=f.clone().multiplyScalar(.5*x),y=[u(h.x0,h.y0,p),u(h.x1,h.y0,p),u(h.x1,h.y1,p),u(h.x0,h.y1,p)],_=[u(h.x0-g,h.y0-g,p+.01),u(h.x1+g,h.y0-g,p+.01),u(h.x1+g,h.y1+g,p+.01),u(h.x0-g,h.y1+g,p+.01)];for(let b=0;b<4;b++){let M=(b+1)%4;r.tri(y[b],_[b],_[M],m,d,d),r.tri(y[b],_[M],y[M],m,d,m)}}e.screenMesh.geometry.dispose(),e.screenMesh.geometry=r.geometry(),e.screenMesh.visible=r.count>0}buildOpenings(e){let t=xm(e.geo.openings,e.openings,Math.min(e.floor.cut_height,e.floor.height),-.2-e.floor.elevation);e.frameTris=t.frameTris,e.glassTris=t.glassTris,e.blindTris=t.blindTris;for(let[n,r]of[[e.framesMesh,t.frames],[e.glassMesh,t.glass],[e.blindsMesh,t.blinds]])n.geometry.dispose(),n.geometry=r,n.visible=r.getAttribute("position").count>0}activeFloors(){return this.floors.filter(e=>e.to>.99)}applyHighlight(){for(let e of this.floors){let t=e.geo.floor.getAttribute("color");for(let n of e.geo.roomTris){let r=new W(n.color),s=this.roomTint?.get(n.roomId);s&&r.lerp(new W(...s).multiplyScalar(.6),.9),n.roomId===this.roomId&&r.lerp(dI,s?.3:.75);for(let o=n.start*3;oc.group),!0)[0];if(l){let c=l.object;for(;c&&!this.meshes.some(h=>h.group===c);)c=c.parent;let u=c?this.pickFurniture.get(this.meshes.find(h=>h.group===c).furnitureId):void 0;if(u)return{entity:u}}}let o=s.flatMap(l=>[l.lampMesh,l.coneMesh,l.framesMesh,l.glassMesh,l.blindsMesh,l.wallMesh,l.floorMesh].filter(c=>c.visible)),a=(l,c)=>l.find(u=>c>=u.start&&ch.group===l.object.parent);if(!(!n&&(l.object===u.lampMesh||l.object===u.coneMesh||l.object===u.framesMesh||l.object===u.blindsMesh||l.object===u.glassMesh))){if(l.object===u.lampMesh||l.object===u.coneMesh){let h=a(l.object===u.lampMesh?u.lampTris:u.wedgeTris,c);if(h)return{entity:h}}else if(l.object===u.framesMesh||l.object===u.blindsMesh||l.object===u.glassMesh){if(this.lowered&&l.face){let x=l.object.geometry.getAttribute("fold")?.getX(l.face.a)??$e;if(x!==$e&&Math.floor(x/16)%8===0)continue}let h=a(l.object===u.framesMesh?u.frameTris:l.object===u.glassMesh?u.glassTris:u.blindTris,c),f=h?this.pickOpenings.get(h):void 0,d=h?this.pickOpenings2.get(h):void 0,p=d?u.geo.openings.find(x=>x.opening.id===h):void 0;if(d&&p&&(l.point.x-p.start[0])*p.axis[0]+(l.point.z-p.start[1])*p.axis[1]>p.width/2&&(f=d),f)return{entity:f}}else if(l.object===u.wallMesh){let h=a(u.geo.furnitureTris,c),f=h&&n?this.pickFurniture.get(h):void 0;if(f)return{entity:f};if(l.face&&!h){let d=u.wallMesh.geometry.getAttribute("fold")?.getX(l.face.a)??32,p=Math.floor(d/16)%8,x=d%16,g=this.lowered&&p===0,m=(u.mask.glass.value&1<S.points.length>=3&&Ge(b,S.points))?.id??null;if(this.roomId!==null){if(M===this.roomId)return{floorId:u.floor.id,roomId:M}}else if(!m&&M)return{floorId:u.floor.id,roomId:M}}}}else if(l.object===u.floorMesh)return{floorId:u.floor.id,roomId:a(u.geo.roomTris.map(h=>({id:h.roomId,start:h.start,end:h.end})),c)??null}}}return null}onTap(e,t){let n=this.furnish?this.pick(e,t):this.pickInReach(e,t);if(n&&"entity"in n&&this.furnish){this.selectDevice(n.entity),this.options.onDeviceSelect?.(n.entity);return}if(n&&"entity"in n){this.flashes.set(n.entity,performance.now()+_0),this.invalidate(),this.options.onDeviceTap?.(n.entity,e,t);return}this.options.onRoomTap?.(n?.floorId??this.floorId??"",n?.roomId??null)}furnitureAt(e,t){let n=this.rayAt(e,t),r=this.activeFloors(),s=r.flatMap(o=>[o.lampMesh,o.wallMesh].filter(a=>a.visible));for(let o of n.intersectObjects(s,!1)){if(o.faceIndex==null)continue;let a=r.find(u=>u.group===o.object.parent),c=(o.object===a.lampMesh?a.lampFurnTris:a.geo.furnitureTris).find(u=>o.faceIndex>=u.start&&o.faceIndexh.id===n)?.furnitureId:void 0,a=o?null:this.furnitureAt(e,t),l=o??a?.id,c=l?this.floors.find(h=>h.floor.furniture.some(f=>f.id===l)):void 0,u=c?.floor.furniture.find(h=>h.id===l)?.type;return!!(c&&l&&u&&r.has(u))&&this.grabItem(c,l,e,t)}if(n){let o=this.devices.find(l=>l.id===n)?.furnitureId,a=o?this.floors.find(l=>l.floor.furniture.some(c=>c.id===o)):void 0;return!o||!a?this.grabDevice(n,e,t):this.grabItem(a,o,e,t)}let s=this.furnitureAt(e,t);if(!s){let o=this.pick(e,t);return o&&"entity"in o?this.grabDevice(o.entity,e,t):(this.selectedFurniture&&(this.selectFurniture(null),this.options.onFurnitureSelect?.(null)),this.selectedDevice&&(this.selectDevice(null),this.options.onDeviceSelect?.(null)),!1)}return this.grabItem(s.fv,s.id,e,t)}grabItem(e,t,n,r){let s=e.floor.furniture.find(a=>a.id===t),o=this.floorPoint(e,n,r);return!s||!o?!1:s.locked?(this.selectFurniture(s.id),this.options.onFurnitureSelect?.(s.id),!1):(this.grab={floorId:e.floor.id,id:s.id,offset:[s.x-o[0],s.z-o[1]],x:s.x,z:s.z,moved:!1},this.selectFurniture(s.id),this.options.onFurnitureSelect?.(s.id),!0)}grabDevice(e,t,n){let r=this.devices.find(a=>a.id===e),s=r&&this.floorMap.get(r.floorId),o=s&&this.floorPoint(s,t,n);return!r||!s||!o?!1:r.fixed?(this.selectDevice(e),this.options.onDeviceSelect?.(e),!1):(this.deviceGrab={id:e,floorId:s.floor.id,offset:[r.x-o[0],r.z-o[1]],x:r.x,z:r.z,moved:!1},this.selectDevice(e),this.options.onDeviceSelect?.(e),!0)}setSelectedDevice(e){e!==this.selectedDevice&&this.selectDevice(e)}selectDevice(e){e&&this.selectedFurniture&&(this.selectFurniture(null),this.options.onFurnitureSelect?.(null)),this.selectedDevice=e;for(let[t,n]of this.devicePins)n.el.classList.toggle("nf-dev-sel",t===e)}dragFurniture(e,t){if(this.surfaceDragging){this.surfaceGrab?.move(this.surfaceRay(e,t));return}let n=this.deviceGrab;if(n){let l=this.floorMap.get(n.floorId),c=this.devices.find(f=>f.id===n.id),u=l&&this.floorPoint(l,e,t);if(!l||!c||!u)return;let h=this.building?.settings.grid??.05;n.x=c.x=Math.round((u[0]+n.offset[0])/h)*h,n.z=c.z=Math.round((u[1]+n.offset[1])/h)*h,n.moved=!0,this.labelsDirty=!0,this.invalidate();return}let r=this.grab,s=r&&this.floorMap.get(r.floorId);if(!r||!s)return;let o=this.floorPoint(s,e,t);if(!o)return;let a=this.building?.settings.grid??.05;r.x=Math.round((o[0]+r.offset[0])/a)*a,r.z=Math.round((o[1]+r.offset[1])/a)*a,r.moved=!0,this.updateGhost(),this.invalidate()}dropFurniture(){if(this.surfaceDragging){this.surfaceDragging=!1,this.surfaceGrab?.end();return}let e=this.deviceGrab;this.deviceGrab=null,e?.moved&&this.options.onDeviceMove?.(e.id,Math.round(e.x*1e3)/1e3,Math.round(e.z*1e3)/1e3);let t=this.grab;this.grab=null,t?.moved&&this.options.onFurnitureMove?.(t.id,Math.round(t.x*1e3)/1e3,Math.round(t.z*1e3)/1e3),this.updateGhost()}updateGhost(){this.ghost&&(this.ghost.geometry.dispose(),this.ghost.material.dispose(),this.scene.remove(this.ghost),this.ghost=null);let e=this.selectedFurniture,t=e?this.floors.find(m=>m.floor.furniture.some(y=>y.id===e)):void 0,n=t?.floor.furniture.find(m=>m.id===e);if(!t||!n)return;let r=this.grab?.id===n.id?this.grab.x:n.x,s=this.grab?.id===n.id?this.grab.z:n.z,o=Hl(t.floor,{...n,x:r,z:s}),a=G0.has(n.type),l=Math.max(.1,n.type==="lamp_pendant"?.3:n.h),c=_t(n.type)||n.type==="lamp_wall"||n.type==="led_strip"?Gt(t.floor,n):a?n.type==="lamp_pendant"||n.type==="ceiling_fan"?o-n.h-.1:o-l:Gt(t.floor,n),u=n.rotation*mt,h=Math.cos(u),f=Math.sin(u),d=(m,y,_)=>[r+m*h-y*f,_,s+m*f+y*h],p=new Wt,x=[[-n.w/2,-n.d/2],[n.w/2,-n.d/2],[n.w/2,n.d/2],[-n.w/2,n.d/2]],g=new W(.25,.9,1);for(let m=0;m<4;m++){let[y,_]=x[m],[b,M]=x[(m+1)%4];p.seg(d(y,_,c+.01),d(b,M,c+.01),g),p.seg(d(y,_,c+l),d(b,M,c+l),g),p.seg(d(y,_,c+.01),d(y,_,c+l),g)}p.seg(d(-n.w/2,n.d/2+.03,c+.02),d(n.w/2,n.d/2+.03,c+.02),new W(1,1,1)),this.ghost=new gn(p.geometry(),new Lt({vertexColors:!0,depthTest:!1,transparent:!0})),this.ghost.position.y=t.floor.elevation+t.y,this.ghost.renderOrder=20,this.scene.add(this.ghost)}onHold(e,t){let n=this.pick(e,t);n&&"entity"in n&&this.options.onDeviceHold?.(n.entity,e,t)}swipeStart(e,t,n,r){if(this.furnish||Math.abs(r)m.floor.rooms.some(y=>y.points.length>=3));if(!n.length)return[];let r=this.lowQuality?1:Math.min(2,window.devicePixelRatio||1),s=Math.round(e*r),o=Math.round(t*r),a=new wn(s,o);a.texture.colorSpace=dt;let l=new zn(-1,1,1,-1,.1,400),c=this.floors.map(m=>({fv:m,visible:m.group.visible,y:m.y,o:m.o,standing:m.mask.standing.value,glass:m.mask.glass.value})),u=this.roof?.group.visible??!1,h=this.ghost?.visible??!1,f=this.renderer.getClearAlpha(),d=new Uint8Array(s*o*4),p=document.createElement("canvas");p.width=s,p.height=o;let x=p.getContext("2d"),g=[];try{this.roof&&(this.roof.group.visible=!1),this.ghost&&(this.ghost.visible=!1),this.renderer.setClearAlpha(0);for(let m of n){for(let O of this.floors)O.group.visible=O===m;m.y=0,m.o=1,this.applyFloor(m),m.group.visible=!0,m.mask.standing.value=0,m.mask.glass.value=0;let y=m.floor.rooms.flatMap(O=>O.points),_=m.floor.elevation,b=new Ct(new U(Math.min(...y.map(O=>O[0]))-.3,_,Math.min(...y.map(O=>O[1]))-.3),new U(Math.max(...y.map(O=>O[0]))+.3,_+Math.min(m.floor.cut_height,m.floor.height),Math.max(...y.map(O=>O[1]))+.3)),M=b.getCenter(new U),S=-.6,v=.8,w=new U(Math.sin(v)*Math.sin(S),Math.cos(v),Math.sin(v)*Math.cos(S));l.position.copy(M).addScaledVector(w,100),l.lookAt(M),l.updateMatrixWorld();let R=.5,T=.5;for(let O of[b.min.x,b.max.x])for(let P of[b.min.y,b.max.y])for(let I of[b.min.z,b.max.z]){let D=new U(O,P,I).applyMatrix4(l.matrixWorldInverse);R=Math.max(R,Math.abs(D.x)),T=Math.max(T,Math.abs(D.y))}let C=s/o;R/T>C?T=R/C:R=T*C,l.left=-R*1.05,l.right=R*1.05,l.top=T*1.05,l.bottom=-T*1.05,l.updateProjectionMatrix(),this.renderer.setRenderTarget(a),this.renderer.clear(),this.renderer.render(this.scene,l),this.renderer.readRenderTargetPixels(a,0,0,s,o,d);let L=x.createImageData(s,o);for(let O=0;O{Math.hypot(u[0]-r.motion.pos[0],u[1]-r.motion.pos[1])o.length?`${o.length}:${o[0].map(a=>a.toFixed(2))}/${o[o.length-1].map(a=>a.toFixed(2))}`:"").join("|"),r=this.robotTrails.get(e.id);if(r&&r.userData.key===n){this.showRobotTrail(e);return}let s=r;if(!s){let o=new Ye({color:3590399,transparent:!0,opacity:.34,depthWrite:!1,side:ht});s=new Se(e0([],.16,0),o),s.renderOrder=3,s.name=`robot-trail:${e.id}`,this.robotTrails.set(e.id,s);let a=this.robots.get(e.id)?.group.parent;a&&a.add(s)}s.geometry.dispose(),s.geometry=e0(t,.16,(e.y??0)+.012),s.userData.key=n,this.showRobotTrail(e)}showRobotTrail(e){let t=this.robotTrails.get(e.id);if(!t)return;let n=this.trailTimers.get(e.id);n!==void 0&&(clearTimeout(n),this.trailTimers.delete(e.id));let r=Date.now(),s=i1(e.settledAt,r);if(t.material.opacity=.34*s,t.visible=(e.track?.length??0)>0&&s>.01,s<=0||s>=1&&e.settledAt==null)return;let o=s>=1?Math.max(0,(e.settledAt??r)+rf-r):250;this.trailTimers.set(e.id,setTimeout(()=>{this.showRobotTrail(e),this.invalidate()},o))}makeRobot(e){if(!this.robotGeo){let s=new ut,o=(l,c,u,h,f)=>{let d=[];for(let p=0;p<20;p++)d.push([Math.cos(p/20*Math.PI*2)*l,Math.sin(p/20*Math.PI*2)*l]);Tt(s,d,c,u,h,f,{aoFrom:0,bottom:!1})};o(.17,.012,.08,2371657,3424863),o(.055,.08,.1,3820138,5070726),this.robotGeo=s.geometry(),this.robotMat=new Ye({vertexColors:!0});let a=new ut;Tt(a,[[-.05,.1],[.05,.1],[.05,.14],[-.05,.14]],.08,.085,16777215,16777215,{aoFrom:0,bottom:!1}),this.robotLedGeo=a.geometry()}let t=new et,n=new Ye({color:b1[e.mode]}),r=e.mower?this.mowerMat??=new Ye({color:4164170}):this.robotMat;return t.add(new Se(this.robotGeo,r),new Se(this.robotLedGeo,n)),e.mower&&t.scale.set(1.7,1.6,1.7),{info:e,motion:{pos:[...e.rest],heading:e.restHeading,path:[],next:0},group:t,led:n}}buildPets(){let e=new Map(this.pets);this.pets.clear(),this.petMat??=new Ye({vertexColors:!0});for(let t of this.floors)for(let n of t.floor.furniture){let r=_t(n.type);if(!r?.pet)continue;let s=t.floor.rooms.find(f=>f.points.length>=3&&Ge([n.x,n.z],f.points)),o=e.get(n.id),a=new ut;ws(new Fi(a,new Wt,Ts({x:0,z:0,rotation:0,mirror:n.mirror})),r,Math.max(.05,n.w),Math.max(.05,n.d),Math.max(.05,n.h),0,null,null,n.variant??null),o?.group.removeFromParent();let l=new et;l.add(new Se(a.geometry(),this.petMat));let c=s?t.floor.furniture.filter(f=>f.id!==n.id&&!_t(f.type)?.pet&&f.type!=="rug"&&Gt(t.floor,f)<.5&&Ge([f.x,f.z],s.points)).map(f=>ns(f)):[],u={points:s?.points??[[n.x-.5,n.z-.5],[n.x+.5,n.z-.5],[n.x+.5,n.z+.5],[n.x-.5,n.z+.5]],obstacles:c,speed:n.type.endsWith(":pet_dog")?.7:.45},h=o&&s&&Ge(o.motion.pos,s.points)?o.motion:{pos:[n.x,n.z],heading:n.rotation*Math.PI/180,target:null,rest:1};this.pets.set(n.id,{motion:h,room:u,random:By(n.id),group:l,floorId:t.floor.id})}for(let[t,n]of e)this.pets.has(t)||n.group.removeFromParent()}setPetRooms(e){for(let[t,n]of this.pets){let r=this.floorMap.get(n.floorId),s=e.get(t);if(!r||s===void 0)continue;let o=s?r.floor.rooms.find(l=>l.id===s&&l.points.length>=3):void 0;if(!o||n.room.points===o.points)continue;let a=r.floor.furniture.filter(l=>!_t(l.type)?.pet&&l.type!=="rug"&&Gt(r.floor,l)<.5&&Ge([l.x,l.z],o.points)).map(l=>ns(l));n.room={...n.room,points:o.points,obstacles:a},Ge(n.motion.pos,o.points)||(n.motion={...n.motion,pos:Gs(o.points),target:null,rest:.5})}this.invalidate()}stepRobots(e){if(!this.robots.size&&!this.pets.size)return!1;let t=this.robotLast?Math.min(.2,(e-this.robotLast)/1e3):0;this.robotLast=e;let n=!1,r=1/0,s=this.petLast?(e-this.petLast)/1e3:0;this.petLast=e;for(let o of this.pets.values()){let a=this.floorMap.get(o.floorId);if(!a)continue;o.group.parent!==a.group&&a.group.add(o.group),ky(o.motion,o.room,s,o.random)||!!o.motion.target?n=!0:r=Math.min(r,Math.max(0,o.motion.rest)),o.group.position.set(o.motion.pos[0],0,o.motion.pos[1]),o.group.rotation.y=o.motion.heading}clearTimeout(this.petTimer),!n&&Number.isFinite(r)&&(this.petTimer=setTimeout(()=>this.invalidate(),r*1e3+50));for(let o of this.robots.values()){let a=this.floorMap.get(o.info.floorId);if(!a)continue;o.group.parent!==a.group&&a.group.add(o.group);let l=this.robotTrails.get(o.info.id);l&&l.parent!==a.group&&a.group.add(l),t>0?n=n1(o.motion,o.info,t)||n:n||=o.info.mode==="cleaning"||o.info.mode==="returning",o.group.position.set(o.motion.pos[0],o.info.y??0,o.motion.pos[1]),o.group.rotation.y=o.motion.heading}return n||(this.robotLast=0),n}getView(){return{...this.controls.view,target:this.controls.view.target.clone()}}showView(e,t=900){let n=e.target??{x:0,y:0,z:0};this.controls.maxRadius=Math.max(this.controls.maxRadius,e.radius*1.5),this.controls.flyTo({target:new U(n.x,n.y,n.z),radius:e.radius,phi:e.phi,theta:e.theta},t)}flyTo(e,t=900){this.controls.flyTo(e,t)}focus(e,t,n,r,s){let o=this.floorMap.get(e);if(o){if(this.controls.flyTo({target:new U(t,o.floor.elevation+o.ty+r,n),radius:5.5,phi:.78},900),s){this.flashes.set(s,performance.now()+2400);let a=this.host.querySelector(`.nf-dev[data-entity="${CSS.escape(s)}"]`);a?.classList.add("nf-dev-found"),setTimeout(()=>a?.classList.remove("nf-dev-found"),2600)}this.invalidate()}}render(e){if(this.frame=0,this.disposed)return;let t=this.lastFrame?Math.min(100,e-this.lastFrame):16,n=!1;this.orbitSpeed&&!this.controls.active?(this.orbitLast&&(this.controls.view.theta+=this.orbitSpeed*Math.min(100,e-this.orbitLast)/1e3),this.orbitLast=e,n=!0):this.orbitLast=0;let r=this.controls.update(e),s=this.stepFloors(t),a=[this.stepOpenings(t),this.stepFridges(t),this.stepCovers(t)].some(Boolean),l=!1;if(this.flashes.size){let g=new Set;for(let[m,y]of this.flashes){let _=this.deviceFloor.get(m);_&&g.add(_),y<=e&&this.flashes.delete(m)}l=this.flashes.size>0;for(let m of this.floors)g.has(m.floor.id)&&this.buildLamps(m)}let c=this.placeRoof(t),u=this.stepRobots(e);this.pictureLayer.step();let f=[this.weatherLayer,this.energyLayer,this.soundLayer,this.screenLayer,this.waterLayer,this.hydronicLayer].map(g=>g.step(e)).some(Boolean),d=r||s||a||l||c,p=[];if(r&&p.push("camera"),s&&p.push("floors"),a&&p.push("openings"),l&&p.push("flash"),c&&p.push("roof"),this.effectTick&&p.push("effect"),u&&p.push("robot"),n&&p.push("orbit"),this.tintTick&&p.push("tint"),this.effectTick=this.tintTick=!1,this.lastFrame=d?e:0,d&&this.governor){let g=this.governor.frame(t,e);g&&"ratio"in g?(this.renderer.setPixelRatio(g.ratio),this.resize()):g&&setTimeout(()=>this.dropToLow(),0)}this.updateWalls(),this.renderer.render(this.scene,this.camera),this.placeLhAnchors(),(this.viewChanged()||s||this.labelsDirty)&&(this.labelsDirty=!1,this.updateLabels()),this.reportStats(e,p),d&&this.invalidate(),this.scheduleEffects(),!d&&n&&!this.orbitTimer&&(this.orbitTimer=setTimeout(()=>{this.orbitTimer=void 0,this.invalidate()},this.lowQuality?66:33));let x=this.resting;!d&&f&&!this.weatherTimer&&!x&&(this.weatherTimer=setTimeout(()=>{this.weatherTimer=void 0,this.invalidate()},33)),!d&&u&&!this.robotTimer&&!x&&(this.robotTimer=setTimeout(()=>{this.robotTimer=void 0,this.invalidate()},this.lowQuality?66:33))}updateWalls(){if(this.controls.walk){for(let o of this.floors)o.mask.standing.value=65535,o.mask.glass.value=0,o.mask.slope?.value.set(0,0,0,0);return}let e=this.camera.position,t=this.controls.view.target,n=e.x-t.x,r=e.z-t.z,s=Math.hypot(n,r)||1;for(let o of this.floors){let a=this.roomId!==null&&o.floor.rooms.some(h=>h.id===this.roomId),l=this.wallMode==="cut",c=0,u=0;o.geo.buckets.forEach((h,f)=>{let d=h?h[0]*n/s+h[1]*r/s>=.25:a;this.wallMode!=="auto"||!d||(this.painted?a&&(u|=1<.5&&r)){this.labelPlacer.place(n.label,null);continue}let s=n.floor.elevation+n.y+n.floor.cut_height*.5,o=[r.x0,r.x1].flatMap(l=>[r.z0,r.z1].map(c=>this.screenPoint([l,s,c],1/0)));n.label.hidden&&(n.label.hidden=!1),n.labelSize??={w:n.label.offsetWidth,h:n.label.offsetHeight};let a=lb(o,n.labelSize.w,{width:this.size.w,inset:this.labelInset});t.push({fv:n,rank:n.rank,left:a.left,y:a.y,height:n.labelSize.h})}for(let n of ab(t))this.labelPlacer.place(n.fv.label,ob(n.left,n.y));this.updateDevicePins();for(let n of this.floors){let r=n.to<.99||n.o<.9||e||this.roomId!==null||this.otherFloor(n),s=n.floor.elevation+n.y+.05;for(let a of n.roomPins){let l=r?null:this.screenPoint([a.cx,s,a.cz],1.1);this.labelPlacer.place(a.pin,l&&!l.off?gl(l):null)}let o=e||n.o<.9||this.otherFloor(n);for(let{pin:a,note:l}of n.notePins){let c=o?null:this.screenPoint([l.x,n.floor.elevation+n.y+(l.y??O0),l.z]);this.labelPlacer.place(a,c&&!c.off?gl(c):null)}}}otherFloor(e){return this.floorId!==null&&e.floor.id!==this.floorId}updateDevicePins(){let e=this.houseView;for(let t of this.persons){let n=this.personPins.get(t.id),r=this.floorMap.get(t.floorId);if(!n)continue;let s=r&&!e&&yp(r,this.otherFloor(r))?this.screenPoint([t.x,r.floor.elevation+r.y+.9,t.z]):null;this.labelPlacer.place(n,s&&!s.off?gl(s):null)}for(let t of this.devices){let n=this.devicePins.get(t.id)?.el;if(!n)continue;let r=this.floorMap.get(t.floorId),s=t.id.startsWith("detect:"),o=!!t.full&&t.roomId===null,a=!!r&&(o?cb(r):(!e||s)&&yp(r,this.otherFloor(r))),c=!!r&&a&&t.pin!==!1?this.screenPoint([t.x,r.floor.elevation+r.y+t.y,t.z]):null;if(!c||c.off){this.labelPlacer.place(n,null);continue}let u=this.roomId===null?t.full?"full":"":t.roomId===this.roomId?"full":"dim";this.pinMode.get(n)!==u&&(this.pinMode.set(n,u),n.classList.toggle("nf-dev-full",u==="full"),n.classList.toggle("nf-dev-dim",u==="dim")),this.labelPlacer.place(n,gl(c))}}reportStats(e,t){if(!this.statsOn||!this.options.onStats)return;let n=t.length>0;this.fpsStart||(this.fpsStart=e),this.lastStatsFrame&&n&&(this.worstFrame=Math.max(this.worstFrame,e-this.lastStatsFrame)),this.lastStatsFrame=n?e:0,this.fpsFrames++;let r=e-this.fpsStart;if(r>500||!n){let s=this.renderer.info.render;this.options.onStats({fps:n?Math.round(this.fpsFrames*1e3/r):0,busy:t,worstMs:Math.round(this.worstFrame),calls:s.calls,triangles:s.triangles,low:this.lowQuality,pixelRatio:this.renderer.getPixelRatio()}),this.fpsFrames=0,this.fpsStart=e,this.worstFrame=0}}};function pI(){let e=document.createElement("canvas");e.width=256*3,e.height=256*2;let t=e.getContext("2d"),n=(o,a,l,c,u)=>{t.strokeStyle=`rgba(55,224,255,${u})`,t.beginPath(),t.moveTo(o,a),t.lineTo(l,c),t.stroke()};t.lineWidth=1.5;let r=(o,a,l)=>{t.save(),t.beginPath(),t.rect(o*256,a*256,256,256),t.clip(),l(o*256,a*256),t.restore()};r(0,0,(o,a)=>{for(let l=0;l<5;l++){let c=a+l*256/5+.75;n(o,c,o+256,c,.09);let u=o+l*.37%1*256;n(u,c,u,c+256/5,.07)}}),r(1,0,(o,a)=>{for(let l=0;l<7;l++){let c=o+l*256/7+.75;n(c,a,c,a+256,.08);let u=a+l*.53%1*256;n(c,u,c+256/7,u,.06)}}),r(2,0,(o,a)=>{for(let l=0;l<4;l++){let c=l*256/4+.75;n(o+c,a,o+c,a+256,.1),n(o,a+c,o+256,a+c,.1)}}),r(1,1,(o,a)=>{for(let l=0;l<2;l++){let c=a+l*256/2+.75;n(o,c,o+256,c,.09);let u=l?256/4:0;for(let h of[u,u+256/2])n(o+h+.75,c,o+h+.75,c+256/2,.09)}}),r(2,1,(o,a)=>{n(o+.75,a,o+.75,a+256,.08),n(o,a+.75,o+256,a+.75,.08),t.fillStyle="rgba(55,224,255,0.05)";for(let l=0;l<90;l++)t.fillRect(o+l*97%256,a+(l*61+l*l%37)%256,2,2)});let s=new zt(e);return s.flipY=!1,s.wrapS=ln,s.wrapT=ln,s.anisotropy=4,s.colorSpace=dt,s}function mI(){let i=document.createElement("canvas");i.width=8,i.height=32;let e=i.getContext("2d");e.fillStyle="#1a2742",e.fillRect(0,0,8,32),e.fillStyle="#223556",e.fillRect(0,4,8,14),e.fillStyle="rgba(55,224,255,0.45)",e.fillRect(0,29,8,2);let t=new zt(i);return t.wrapS=kn,t.wrapT=kn,t.colorSpace=dt,t}function gI(i,e){let t=i.rooms.map((r,s)=>s),n=r=>t[r]===r?r:t[r]=n(t[r]);for(let[r,s]of e){let o=i.rooms.findIndex(u=>u.id===r),a=i.rooms.findIndex(u=>u.id===s);if(o<0||a<0)continue;let l=n(o),c=n(a);l!==c&&(t[Math.max(l,c)]=Math.min(l,c))}return t.map((r,s)=>n(s))}function xI(){let e=document.createElement("canvas");e.width=64,e.height=64;let t=e.getContext("2d"),n=t.createRadialGradient(64/2,64/2,0,64/2,64/2,64/2);n.addColorStop(0,"rgba(255,255,255,0.9)"),n.addColorStop(.2,"rgba(255,255,255,0.45)"),n.addColorStop(.55,"rgba(255,255,255,0.1)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,64,64);let r=new zt(e);return r.colorSpace=dt,r}function yI(){let e=M0,t=document.createElement("canvas");t.width=1024,t.height=1024;let n=t.getContext("2d");n.strokeStyle="rgba(91,124,255,0.16)",n.lineWidth=1;for(let o=0;o<=e;o++){let a=Math.round(o/e*1024)+.5;n.beginPath(),n.moveTo(a,0),n.lineTo(a,1024),n.moveTo(0,a),n.lineTo(1024,a),n.stroke()}n.globalCompositeOperation="destination-in";let r=n.createRadialGradient(1024/2,1024/2,1024*.12,1024/2,1024/2,1024/2);r.addColorStop(0,"rgba(0,0,0,1)"),r.addColorStop(1,"rgba(0,0,0,0)"),n.fillStyle=r,n.fillRect(0,0,1024,1024);let s=new zt(t);return s.anisotropy=4,s.colorSpace=dt,s}function t4(i,e){return new S0(i,e)}function v0(i,e,t,n){let[r,s,o]=e.size??Cs[e.lamp],a=e.base??0,l=(e.rotation??0)*mt,c=Math.cos(l),u=Math.sin(l),h=(x,g)=>[e.x+x*c-g*u,e.z+x*u+g*c],f=(x,g,m,y,_,b=14)=>{let M=[];for(let S=0;STt(i,[h(x,m),h(g,m),h(g,y),h(x,y)],_,b,M,S,{aoFrom:0,bottom:!0}),p=Math.max(.05,Math.min(r,s)/2);switch(e.lamp){case"ceiling":f(p*.25,t-.04,t,Je,Je,8),f(p,t-Math.max(.04,o)-.035,t-.04,n,n);break;case"pendant":{let x=Math.max(.4,t-o);f(.06,t-.02,t,Je,Je,8);let g=e.variant==="globe"?x+2*p:e.variant==="drum"?x+.24:x+.2;if(f(.008,g,t-.02,Je,Je,5),e.variant==="globe")for(let y=0;y<7;y++){let _=Math.PI*(y/7),b=Math.PI*((y+1)/7);f(p*Math.max(.2,Math.sin((_+b)/2)),x+p-p*Math.cos(_),x+p-p*Math.cos(b),n,n,14)}else if(e.variant==="cone")for(let y=0;y<4;y++)f(p*(.25+.75*(4-y)/4),x+.06*y,x+.06*(y+1),n,n,16);else e.variant==="drum"?f(p,x,x+.24,n,n,18):(f(p*.35,x+.14,x+.2,n,n,12),f(p,x,x+.14,n,n,16));break}case"fan":{let x=Math.max(.05,t-Math.max(.22,o)),g=x+.16;f(.07,t-.05,t,Je,Je,10),g[e.x+w*M-R*S,e.z+w*S+R*M];Tt(i,[v(.1,-.035),v(m,-.075),v(m,.075),v(.1,.035)],y,y+.012,v1,v1,{aoFrom:0,bottom:!0})}break}case"downlight":f(p,t-.012,t,Je,Je,12),f(p*.7,t-.02,t-.012,n,n,12);break;case"spot":f(p*.6,t-.02,t,Je,Je,10),f(p,t-Math.max(.06,o),t-.02,Je,Je,12),f(p*.8,t-Math.max(.06,o)-.008,t-Math.max(.06,o),n,n,12);break;case"panel":d(-r/2,r/2,-s/2,s/2,t-Math.max(.015,o),t,Je,Je),d(-r/2+.02,r/2-.02,-s/2+.02,s/2-.02,t-Math.max(.015,o)-.004,t-Math.max(.015,o),n);break;case"uplight":f(Math.max(.1,p*.6),a,a+.03,Je,Je),f(.014,a+.03,a+o-.12,Je,Je,6),f(p,a+o-.14,a+o-.02,Je,Je),f(p*.92,a+o-.02,a+o,n,n);break;case"bollard":f(p,a,a+o-.14,Je,Je,10),f(p*.9,a+o-.14,a+o-.03,n,n,10),f(p*1.1,a+o-.03,a+o,Je,Je,10);break;case"garden":f(.012,a,a+o-.08,Je,Je,5),f(p,a+o-.08,a+o-.01,Je,Je,10),f(p*.8,a+o-.01,a+o,n,n,10);break;case"floor":f(Math.max(.1,p*.7),a,a+.03,Je,Je),f(.014,a+.03,a+o-.28,Je,Je,6),f(p,a+o-.3,a+o,n,n);break;case"table":f(Math.max(.05,p*.55),a,a+.03,Je,Je),f(.012,a+.03,a+o-.16,Je,Je,6),f(p,a+o-.18,a+o,n,n);break;case"wall":{let x=e.base??Gl;d(-r/2+.03,r/2-.03,-s/2,-s/2+.02,x,x+o,Je),d(-r/2,r/2,-s/2+.02,s/2,x+o*.15,x+o*.85,n);break}case"strip":{let x=Math.max(.02,o),g=e.base!=null?e.base+x:t-.04,m=e.upright?0:(e.rise??0)*mt;if(!e.roll&&!e.upright&&!m){d(-r/2,r/2,-s/2,s/2,g-x,g,n);break}let y=(e.roll??0)*mt,_=Math.cos(y),b=Math.sin(y),[M,S]=[Math.cos(m),Math.sin(m)],v=e.upright?a+r/2:g-x/2+Oo(e.base,r,e.rise),w=(O,P,I)=>{let D=O,F=P*_-I*b,H=P*b+I*_;return e.upright?[D,F]=[-F,D]:m&&([D,F]=[D*M-F*S,D*S+F*M]),[e.x+D*c-H*u,v+F,e.z+D*u+H*c]},R=[w(-r/2,-x/2,-s/2),w(r/2,-x/2,-s/2),w(r/2,-x/2,s/2),w(-r/2,-x/2,s/2),w(-r/2,x/2,-s/2),w(r/2,x/2,-s/2),w(r/2,x/2,s/2),w(-r/2,x/2,s/2)],T=new W(n),C=[e.x,v,e.z],L=(O,P,I,D)=>{let[F,H,B]=[R[O],R[P],R[I]],X=[(H[1]-F[1])*(B[2]-F[2])-(H[2]-F[2])*(B[1]-F[1]),(H[2]-F[2])*(B[0]-F[0])-(H[0]-F[0])*(B[2]-F[2]),(H[0]-F[0])*(B[1]-F[1])-(H[1]-F[1])*(B[0]-F[0])],V=[F[0]-C[0],F[1]-C[1],F[2]-C[2]],re=X[0]*V[0]+X[1]*V[1]+X[2]*V[2]<0,[ye,Y,Q,se]=re?[R[D],R[I],R[P],R[O]]:[R[O],R[P],R[I],R[D]];i.tri(ye,Y,Q,T,T,T),i.tri(ye,Q,se,T,T,T)};L(0,1,2,3),L(4,5,6,7),L(0,1,5,4),L(1,2,6,5),L(2,3,7,6),L(3,0,4,7);break}}}export{ki as ModelError,S0 as NextFloorViewer,t4 as createViewer,cI as furniturePreview,rI as inspectModel,zy as isLowEnd,sI as prepareModel,oI as previewModel,v0 as pushLampModel}; /*! Bundled license information: three/build/three.core.js: diff --git a/NextFloor/assets/nextfloor-designer.js b/NextFloor/assets/nextfloor-designer.js index 506c71a..7db3279 100644 --- a/NextFloor/assets/nextfloor-designer.js +++ b/NextFloor/assets/nextfloor-designer.js @@ -1,13 +1,13 @@ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ -var w={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var Un=globalThis,jn=Un.ShadowRoot&&(Un.ShadyCSS===void 0||Un.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gi=Symbol(),fs=new WeakMap,rn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==gi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(jn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=fs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&fs.set(t,e))}return e}toString(){return this.cssText}},gs=n=>new rn(typeof n=="string"?n:n+"",void 0,gi),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new rn(t,n,gi)},_s=(n,e)=>{if(jn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Un.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},_i=jn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return gs(t)})(n):n;var{is:_d,defineProperty:bd,getOwnPropertyDescriptor:yd,getOwnPropertyNames:vd,getOwnPropertySymbols:wd,getPrototypeOf:xd}=Object,qn=globalThis,bs=qn.trustedTypes,kd=bs?bs.emptyScript:"",Sd=qn.reactiveElementPolyfillSupport,on=(n,e)=>n,bi={toAttribute(n,e){switch(e){case Boolean:n=n?kd:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},vs=(n,e)=>!_d(n,e),ys={attribute:!0,type:String,converter:bi,reflect:!1,useDefault:!1,hasChanged:vs};Symbol.metadata??=Symbol("metadata"),qn.litPropertyMetadata??=new WeakMap;var Le=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ys){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&bd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=yd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ys}static _$Ei(){if(this.hasOwnProperty(on("elementProperties")))return;let e=xd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(on("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(on("properties"))){let t=this.properties,r=[...vd(t),...wd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(_i(i))}else e!==void 0&&t.push(_i(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _s(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:bi).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:bi;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??vs)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Le.elementStyles=[],Le.shadowRootOptions={mode:"open"},Le[on("elementProperties")]=new Map,Le[on("finalized")]=new Map,Sd?.({ReactiveElement:Le}),(qn.reactiveElementVersions??=[]).push("2.1.2");var $i=globalThis,ws=n=>n,Zn=$i.trustedTypes,xs=Zn?Zn.createPolicy("lit-html",{createHTML:n=>n}):void 0,Es="$lit$",tt=`lit$${Math.random().toFixed(9).slice(2)}$`,Rs="?"+tt,$d=`<${Rs}>`,ht=document,an=()=>ht.createComment(""),ln=n=>n===null||typeof n!="object"&&typeof n!="function",Mi=Array.isArray,Md=n=>Mi(n)||typeof n?.[Symbol.iterator]=="function",yi=`[ -\f\r]`,sn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ks=/-->/g,Ss=/>/g,ut=RegExp(`>|${yi}(?:([^\\s"'>=/]+)(${yi}*=${yi}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),$s=/'/g,Ms=/"/g,zs=/^(?:script|style|textarea|title)$/i,Ai=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),p=Ai(1),ne=Ai(2),vg=Ai(3),mt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),As=new WeakMap,dt=ht.createTreeWalker(ht,129);function Ts(n,e){if(!Mi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return xs!==void 0?xs.createHTML(e):e}var Ad=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"":e===3?"":"",s=sn;for(let a=0;a"?(s=i??sn,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ut:u[3]==='"'?Ms:$s):s===Ms||s===$s?s=ut:s===ks||s===Ss?s=sn:(s=ut,i=void 0);let d=s===ut&&n[a+1].startsWith("/>")?" ":"";o+=s===sn?l+$d:h>=0?(r.push(c),l.slice(0,h)+Es+l.slice(h)+tt+d):l+tt+(h===-2?a:d)}return[Ts(n,o+(n[t]||"")+(e===2?"":e===3?"":"")),r]},cn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Ad(e,t);if(this.el=n.createElement(c,r),dt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=dt.nextNode())!==null&&l.length0){i.textContent=Zn?Zn.emptyScript:"";for(let d=0;d2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=f}_$AI(e,t=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=Mt(this,e,t,0),s=!ln(e)||e!==this._$AH&&e!==mt,s&&(this._$AH=e);else{let a=e,l,c;for(e=o[0],l=0;l{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new un(e.insertBefore(an(),o),o,void 0,t??{})}return i._$AI(n),i};var Ei=globalThis,Q=class extends Le{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ds(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return mt}};Q._$litElement$=!0,Q.finalized=!0,Ei.litElementHydrateSupport?.({LitElement:Q});var Rd=Ei.litElementPolyfillSupport;Rd?.({LitElement:Q});(Ei.litElementVersions??=[]).push("4.2.2");var pt=Math.PI/180;function ft(n,e,t){let r=n.getTime()/864e5-10957.5,i=(357.529+.98560028*r)*pt,s=(280.459+.98564736*r+1.915*Math.sin(i)+.02*Math.sin(2*i))*pt,a=(23.439-36e-8*r)*pt,l=Math.atan2(Math.cos(a)*Math.sin(s),Math.cos(s)),c=Math.asin(Math.sin(a)*Math.sin(s)),h=(((18.697374558+24.06570982441908*r)%24+24)%24*15+t)*pt-l,m=e*pt,d=Math.asin(Math.sin(m)*Math.sin(c)+Math.cos(m)*Math.cos(c)*Math.cos(h)),g=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(m)-Math.tan(c)*Math.cos(m))/pt+180;return{elevation:d/pt,azimuth:(g%360+360)%360}}function Ri(n,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(n)).map(r=>[r.type,Number(r.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function Et(n,e,t=new Date){let[r,i]=[Math.floor(n),Math.round(n%1*60)];if(e)try{let s=new Date(Ri(t.getTime(),e)),a=Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate(),r,i),l=a-(Ri(a,e)-a);return l=a-(Ri(l,e)-l),new Date(l)}catch{}let o=new Date(t);return o.setHours(r,i,0,0),o}var Fs;function Yn(){let n=new URL("./nextfloor-card-editor.js?v=26dc3cb20c0f",new URL(import.meta.url)).href;return Fs??=import(n),Fs}var Jn=(n,e,t={})=>n.callWS({type:`nextfloor/${e}`,...t}),Hs=n=>Jn(n,"building/get");async function Ps(n,e){return(await Jn(n,"building/save",{building:e})).revision}function Is(n,e){return n.connection.subscribeMessage(t=>e(t.revision),{type:"nextfloor/building/subscribe"})}async function Cs(n,e){return(await Jn(n,"image/get",{image_id:e})).data}async function Ns(n){return(await Jn(n,"packs/list")).packs}var zd=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Ls(n){let e=n instanceof Uint8Array?n:new Uint8Array(n),t=e.length*8,r=new Uint8Array(e.length+9+63>>6<<6);r.set(e),r[e.length]=128;let i=new DataView(r.buffer);i.setUint32(r.length-8,Math.floor(t/4294967296)),i.setUint32(r.length-4,t>>>0);let o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64),a=(l,c)=>l>>>c|l<<32-c;for(let l=0;l>>3,k=a(s[y-2],17)^a(s[y-2],19)^s[y-2]>>>10;s[y]=s[y-16]+S+s[y-7]+k>>>0}let[c,u,h,m,d,g,_,b]=o;for(let y=0;y<64;y++){let S=b+(a(d,6)^a(d,11)^a(d,25))+(d&g^~d&_)+zd[y]+s[y]>>>0,k=(a(c,2)^a(c,13)^a(c,22))+(c&u^c&h^u&h)>>>0;[b,_,g,d,m,h,u,c]=[_,g,d,m+S>>>0,h,u,c,S+k>>>0]}o[0]+=c,o[1]+=u,o[2]+=h,o[3]+=m,o[4]+=d,o[5]+=g,o[6]+=_,o[7]+=b}return[...o].map(l=>l.toString(16).padStart(8,"0")).join("")}var Os=n=>n.trim().replace(/^\/local\/www\//i,"/local/"),Ws=n=>/^(https:\/\/|\/local\/|\/hacsfiles\/)\S+\.m?js(\?\S*)?$/i.test(n.trim());var Td=globalThis,Bs=Td.__nextfloorPluginStore??={plugins:new Map,listeners:new Set},er=Bs.plugins,zi=Bs.listeners,Dd=new Set(["none","rainbow","pulse","flicker"]),Fd=5;function Rt(n,e){n.errors.lengthzi.delete(n)}function Ti(n,e=""){if(!n||typeof n!="object")throw new Error("register() needs a plugin object");if(typeof n.id!="string"||!/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(n.id))throw new Error("plugin id must be 1\u201364 letters, digits, '.', '_' or '-'");if(n.apiVersion!==1)throw new Error(`plugin "${n.id}" wants API ${String(n.apiVersion)}, NextFloor offers ${1}`);for(let t of Object.keys(n.lightAnimations??{})){if(Dd.has(t))throw new Error(`plugin "${n.id}": light animation "${t}" is built in`);if(typeof n.lightAnimations?.[t]!="function")throw new Error(`plugin "${n.id}": light animation "${t}" is not a function`)}for(let t of n.devices??[]){if(typeof t?.match!="function")throw new Error(`plugin "${n.id}": every device extension needs match()`);for(let r of["floorWedge","tap","watch"])if(t[r]!==void 0&&typeof t[r]!="function")throw new Error(`plugin "${n.id}": ${r} must be a function`);for(let r of t.settings??[]){if(!r||typeof r.key!="string"||!/^\w{1,32}$/.test(r.key))throw new Error(`plugin "${n.id}": a setting needs a key of 1\u201332 letters, digits or "_"`);if(!["number","select","boolean"].includes(r.type))throw new Error(`plugin "${n.id}": setting "${r.key}" has an unknown type`)}}for(let t of n.roomSections??[])if(typeof t?.render!="function"||typeof t.id!="string")throw new Error(`plugin "${n.id}": every room section needs id and render()`);er.set(n.id,{plugin:n,status:{id:n.id,name:n.name||n.id,version:n.version||"",source:e,errors:[]}}),Hd()}function Pd(n){for(let{plugin:e,status:t}of er.values()){let r=e.lightAnimations?.[n];if(r)return{fn:r,status:t}}return null}var Vs=n=>Pd(n)!==null;function*dn(n,e){for(let{plugin:t,status:r}of er.values())for(let i of t.devices??[]){let o=!1;try{o=i.match(n,e)}catch(s){Rt(r,s)}o&&(yield{device:i,status:r})}}function Tt(n,e){for(let{device:t}of dn(n,e))return t.kind??"sensor";return null}function Ks(n){let e=null;for(let{device:t,status:r}of dn(n.entityId,n.state))if(t.marker)try{let i=t.marker(n);if(!i)continue;e={...e??{}},typeof i.icon=="string"&&i.icon&&(e.icon=i.icon),typeof i.text=="string"&&(e.text=i.text.slice(0,60)),typeof i.active=="boolean"&&(e.active=i.active)}catch(i){Rt(r,i)}return e}function Gs(n){let e=[];for(let{device:t,status:r}of dn(n.entityId,n.state))if(t.watch)try{let i=t.watch(n);Array.isArray(i)&&e.push(...i.filter(o=>typeof o=="string").slice(0,20))}catch(i){Rt(r,i)}return e}function Us(n,e){let t={};for(let r of n??[]){let i=e?.[r.key],o=r.type==="number"?typeof i=="number"&&Number.isFinite(i):r.type==="boolean"?typeof i=="boolean":typeof i=="string"&&(r.options??[]).some(([s])=>s===i);t[r.key]=o?i:r.default}return t}var Id=n=>{let e=typeof n=="string"?/^#([0-9a-f]{6})$/i.exec(n.trim()):null;if(!e)return null;let t=Number.parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]},Qn=(n,e,t,r)=>typeof n=="number"&&Number.isFinite(n)?Math.min(r,Math.max(t,n)):e;function js(n,e,t){for(let{device:r,status:i}of dn(n.entityId,n.state))if(r.floorWedge)try{let o=r.floorWedge({...n,placement:e,settings:Us(r.settings,t?.[i.id])});if(!o)continue;let s=Qn(o.reach,0,0,30);if(s<=0)continue;return{angle:Qn(o.angle,90,1,360),reach:s,near:Qn(o.near,0,0,s),color:Id(o.color)??[.04,.22,.28],opacity:Qn(o.opacity,.6,0,1),through:o.tapThrough===!0}}catch(o){Rt(i,o)}return null}function qs(n,e,t,r){for(let{device:i,status:o}of dn(n.entityId,n.state))if(i.tap)try{if(i.tap({...n,...r,placement:e,settings:Us(i.settings,t?.[o.id])})===!0)return!0}catch(s){Rt(o,s)}return!1}function Zs(n){let e=[];for(let{plugin:t,status:r}of er.values())for(let i of t.roomSections??[])try{let o=i.render(n);if(o==null||o===""||typeof o!="string"&&!(o instanceof Node))continue;e.push({key:`${t.id}/${i.id}`,title:r.name,content:o})}catch(o){Rt(r,o)}return e}var Di=new Map,Fi="";function Hi(){let n=globalThis;if(n.NextFloor)return;n.NextFloor={apiVersion:1,register:t=>Ti(t,Fi)};let e=n.__nextfloorPlugins??[];n.__nextfloorPlugins=[];for(let t of e)try{Ti(t)}catch(r){console.warn("NextFloor: plugin rejected",r)}}var Cd=n=>[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("");async function Nd(n,e=(...t)=>fetch(...t)){if(!n.sha256)return{url:n.url};let t=globalThis.crypto?.subtle,r=await e(n.url,{cache:"no-store"});if(!r.ok)throw new Error(`HTTP ${r.status}`);let i=await r.arrayBuffer();if((t?Cd(await t.digest("SHA-256",i)):Ls(i))!==n.sha256.toLowerCase())throw new Error("checksum mismatch: the file is not the one that was reviewed");let s=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));return{url:s,revoke:()=>URL.revokeObjectURL(s)}}async function Pi(n,e=r=>import(r),t){Hi();for(let r of n??[]){if(!r.enabled||Di.has(r.url))continue;if(!Ws(r.url)){Di.set(r.url,{url:r.url,state:"error",error:"not allowed: use /local/\u2026, /hacsfiles/\u2026 or https://\u2026"});continue}let i={url:r.url,state:"loading"};Di.set(r.url,i);let o;try{o=await Nd({...r,url:Os(r.url)},t),Fi=r.url,await e(o.url),i.state="loaded"}catch(s){i.state="error",i.error=s instanceof Error?s.message:String(s),console.warn(`NextFloor: plugin ${r.url} failed to load`,s)}finally{Fi="",o?.revoke?.()}}}var Ys=[],tr=new Map,Js=0,Qs=(n,e)=>`pack:${n}:${e}`,Ii=n=>n.startsWith("pack:");function Xs(n){Ys=n,tr=new Map;for(let e of n)for(let t of e.items)tr.set(Qs(e.id,t.id),t);Js+=1}var Ci=()=>Ys,nr=()=>Js,Ld={};function X(n){if(!Ii(n))return;let e=tr.get(n);if(e)return e;let[,t,...r]=n.split(":"),i=Ld[t];return i?tr.get(Qs(i,r.join(":"))):void 0}var rr=n=>!!n?.parts.some(e=>e.move);function ea(n,e){if(e===null)return Math.min(1,Math.max(0,n.cover_rest??1));let t=Math.min(1,Math.max(0,e/100));return n.cover==="extends"?t:1-t}var ta=n=>X(n)?.parts.find(e=>e.screen);var na=n=>!!X(n)?.climate;function ra(n,e){return n.name[e.split("-")[0]]??n.name.en??Object.values(n.name)[0]??n.id}function oe(n,e){return e.mount_y!=null?e.mount_y:Wd(n,e)+(Od(e)?0:or(n,e.x,e.z))}var Od=n=>n.type==="led_strip"||X(n.type)?.mount==="ceiling";function Wd(n,e){if(e.type==="lamp_wall")return ia;if(e.type==="led_strip")return Math.max(0,xe(n,e.x,e.z)-.04-Math.max(.02,e.h));let t=X(e.type);if(!t)return oa(e);switch(t.mount){case"surface":return ar(n,e.x,e.z);case"wall":return t.wall_y??1;case"ceiling":return Math.max(0,sr(n,e)-e.h);default:return 0}}function ir(n){if(n==="plant")return"plant";let e=X(n);return e?e.household?e.household:/monstera|plant|herb_garden|flower_pots|bonsai|ficus|cactus|kaktus/.test(e.id)?"plant":null:null}var Oe=["electricity","water","gas","heating","cooling"];var Vd={lawn:.012,terrace:.12,path:.02,driveway:.02,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function Kd(n){return n==="hedge"||n==="fence"||n==="pergola"}function Gd(n,e,t){let r=n.slope??0;if(!r||n.type==="pool")return 0;let i=n.slope_dir??"x",o=(c,u)=>i==="x"?c:i==="-x"?-c:i==="z"?u:-u,s=1/0,a=-1/0;for(let[c,u]of n.points){let h=o(c,u);s=Math.min(s,h),a=Math.max(a,h)}if(a-s<1e-6)return 0;let l=Math.min(1,Math.max(0,(o(e,t)-s)/(a-s)));return r*l}function lr(n,e,t,r){return cr(n)+(e.offset??0)+Vd[e.type]-Gd(e,t,r)}function cr(n){return n.elevation>.3?0:-.2}function hn(n,e,t){let r=(n.outdoor??[]).filter(o=>!Kd(o.type)&&o.type!=="pool"&&H([e,t],o.points)),i=[...r].reverse().find(o=>o.cut)??r[0];return i?lr(n,i,e,t):cr(n)}var Ud={meter:null,grid:null,grid_invert:!1,solar:null,battery:null,battery_invert:!1,battery_soc:null,consumption:null,tariff:null};var la={type:"none",pitch:35,overhang:.4};var jd={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...la}};function qd(n,e,t){return{id:n,name:e,elevation:t,height:2.5,cut_height:1.15,rooms:[],openings:[],furniture:[],placements:[],background:null,outdoor:[],walls:[],ha_floor:null}}var ca=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),ia=1.75;function ua(n){return Yd.has(n.type)||["stairwell","parking"].includes(n.type)?!1:X(n.type)?.mount!=="ceiling"}function ur(n){return ca.has(n)||!!X(n)?.light}var Zd=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function da(n,e,t,r=0){let i=Xd(n.points),o=i.x1-i.x0-2*r,s=i.z1-i.z0-2*r,a=[];for(let l=0;ln?.floor_offset&&Number.isFinite(n.floor_offset)?n.floor_offset:0;function or(n,e,t){let r=n.rooms.find(i=>i.points.length>=3&&i.floor_offset&&H([e,t],i.points));return Jd(r)}function xe(n,e,t){let r=n.rooms.find(i=>i.points.length>=3&&H([e,t],i.points));return r?.ceiling!=null&&r.ceiling>0?r.ceiling:n.height}var sr=(n,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:xe(n,e.x,e.z);function ar(n,e,t){let r=0;for(let i of n.furniture)!(Zd.has(i.type)||X(i.type)?.surface)||!H([e,t],dr(i))||(r=Math.max(r,i.h));return r}var Bd=new Set([...ca,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]),sa={sofa:[2.2,.9,.82],armchair:[.85,.85,.8],table:[1.6,.9,.75],chair:[.46,.5,.9],bed:[1.6,2.05,.9],nightstand:[.45,.4,.5],wardrobe:[1.8,.6,2.1],shelf:[.9,.35,1.9],kitchen:[2.4,.62,.92],worktop:[1.2,.62,.91],inverter:[.5,.2,.65],home_battery:[.6,.25,1.1],wallbox:[.3,.15,.42],heating_manifold:[1.5,.35,1.1],buffer_tank:[.85,.85,1.85],freshwater_station:[.65,.28,.9],meter:[.55,.21,1.1],grid_point:[.4,.22,.6],fridge:[.6,.65,1.8],fridge_smart:[.91,.73,1.78],stairwell:[1,2.6,.02],stove:[.6,.62,.92],sink:[.9,.62,.92],bathtub:[1.7,.75,.58],shower:[.9,.9,2],wc:[.38,.6,.8],washbasin:[.6,.46,.85],desk:[1.4,.7,.75],tv_board:[1.8,.42,.5],plant:[.45,.45,1.1],rug:[2,1.4,.01],stairs:[1,3.2,2.75],stool:[.55,.55,.42],lamp_ceiling:[.4,.4,.08],lamp_downlight:[.1,.1,.02],lamp_spot:[.1,.1,.14],lamp_panel:[.6,.6,.03],lamp_uplight:[.35,.35,1.8],lamp_bollard:[.16,.16,.8],lamp_garden:[.12,.12,.3],radiator:[1,.1,.6],robot_vacuum:[.36,.5,.1],parking:[2.6,5.2,.02],lamp_pendant:[.4,.4,.8],ceiling_fan:[1.32,1.32,.32],lamp_floor:[.4,.4,1.7],lamp_table:[.28,.28,.45],lamp_wall:[.22,.12,.2],led_strip:[2,.04,.03],coffee_table:[1.1,.6,.42],tv_wall:[1.3,.08,.75],sideboard:[1.6,.45,.8],table_round:[1.1,1.1,.75],bench:[1.4,.45,.85],corner_bench:[2,1.6,.9],bar_stool:[.42,.42,.75],kitchen_wall:[.8,.35,.7],kitchen_tall:[.6,.62,2.1],island:[1.8,.9,.92],dishwasher:[.6,.62,.92],bunk_bed:[1,2.05,1.65],dresser:[1,.5,.9],washer:[.6,.6,.85],dryer:[.6,.6,.85],office_chair:[.65,.65,1.1],tall_cabinet:[.6,.6,2.1],coat_rack:[1,.35,1.9]};function Ni(n){n.energy={...Ud,...n.energy??{}},n.presence=n.presence??[],n.version=1,n.settings={...jd,...n.settings,roof:{...la,...n.settings?.roof??{}}},n.floors.forEach((e,t)=>{let r=qd(e.id,e.name??`Floor ${t+1}`,e.elevation??t*2.8);for(let i of Object.keys(r))e[i]===void 0&&(e[i]=r[i])});for(let e of n.floors){e.outdoor=e.outdoor??[],e.walls=e.walls??[],e.rooms=e.rooms.map(r=>({...r,name:r.name??"",area_id:r.area_id??null,floor_material:r.floor_material??"wood",panel:r.panel??[]})),e.ha_floor=e.ha_floor??null,e.placements=e.placements.map(r=>({...r,mount:r.mount??null,rotation:r.rotation??0})),e.furniture=e.furniture.map(r=>({...r,entity:r.entity??null,power:r.power??null}));let t=e.placements.filter(r=>r.entity_id.startsWith("light."));if(t.length){let r={ceiling:"lamp_ceiling",floor:"lamp_floor",table:"lamp_table",wall:"lamp_wall"};for(let i of t){let o=r[i.mount??"ceiling"],[s,a,l]=sa[o],c=`lamp_${i.entity_id.slice(6).replace(/[^A-Za-z0-9_\-.]/g,"_")}`.slice(0,54),u=c,h=1;for(;e.furniture.some(m=>m.id===u);)u=`${c}_${h++}`;e.furniture.push({id:u,type:o,x:i.x,z:i.z,rotation:0,w:s,d:a,h:l,variant:null,entity:i.entity_id,power:null,animations_enabled:i.animations_enabled,effect_animations:structuredClone(i.effect_animations)})}e.placements=e.placements.filter(i=>!i.entity_id.startsWith("light."))}e.openings=e.openings.map(r=>({...r,type:["door","window","garage"].includes(r.type)?r.type:"door",edge:Number.isInteger(r.edge)?r.edge:0,offset:Number.isFinite(r.offset)?r.offset:.5,width:Number.isFinite(r.width)&&r.width>0?r.width:r.type==="garage"?2.5:r.type==="window"?1.2:.9,height:Number.isFinite(r.height)&&r.height>0?r.height:r.type==="window"?1.3:r.type==="garage"?2.1:2.05,sill:Number.isFinite(r.sill)?r.sill:r.type==="window"?.9:0,hinge:r.hinge??"left",leaves:r.leaves??1,swing:r.swing??"in",style:r.style??null,cover:r.cover??null,contact:r.contact??null,contact2:r.contact2??null,tilt:r.tilt??null}))}return Qd(n),n}function Qd(n){let e=(t,r)=>{let i=new Set;for(let o of t)(typeof o.id!="string"||!o.id||i.has(o.id))&&(o.id=aa(r)),i.add(o.id)};e(n.floors,"floor");for(let t of n.floors){for(let r of t.rooms)(typeof r.id!="string"||!r.id)&&(r.id=aa("room"));e(t.openings,"op"),e(t.furniture,"furn"),e(t.outdoor,"out")}}function aa(n){return`${n}_${Math.random().toString(36).slice(2,10)}`}function gt(n){let e=0;for(let t=0;to+s[0],0)/i,n.reduce((o,s)=>o+s[1],0)/i]}let t=0,r=0;for(let i=0;i[n.x+s*t-a*r,n.z+s*r+a*t])}function H(n,e){let t=!1;for(let r=0,i=e.length-1;rn[1]!=l>n[1]&&n[0]<(a-o)*(n[1]-s)/(l-s)+o&&(t=!t)}return t}var ha={lamp_ceiling:"ceiling",lamp_downlight:"downlight",lamp_spot:"spot",lamp_panel:"panel",lamp_uplight:"uplight",lamp_bollard:"bollard",lamp_garden:"garden",lamp_pendant:"pendant",ceiling_fan:"fan",lamp_floor:"floor",lamp_table:"table",lamp_wall:"wall",led_strip:"strip"};var eh=700,Oi="nextfloor.unsaved",Dt="0.2.27";function th(){try{let n=localStorage.getItem(Oi);return n?JSON.parse(n):null}catch{return null}}function Li(n){try{n?localStorage.setItem(Oi,JSON.stringify(n)):localStorage.removeItem(Oi)}catch{}}var ma=n=>n&&typeof n=="object"&&"message"in n?String(n.message):String(n);function nh(n,e){let t=o=>o.split(/[.-]/).map(s=>Number.parseInt(s,10)||0),[r,i]=[t(n),t(e)];for(let o=0;othis.host.requestUpdate()),this.hass&&this.start()}hostDisconnected(){this.connected=!1,this.stopPlugins?.(),this.stopPlugins=null,this.flush(),this.stopListening?.(),this.stopListening=null}edit(e){this.building=e,Pi(e.settings.plugins),this.waiting=e,clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flush()},eh),this.host.requestUpdate()}get frontendVersion(){return Dt}get versionGap(){let e=this.backendVersion;return!e||Dt==="dev"||e===Dt?null:nh(e,Dt)>0?"frontend":"backend"}get needsRestart(){return this.saveError&&/extra keys not allowed/i.test(this.saveError)?!0:!!this.backendVersion&&Dt!=="dev"&&this.backendVersion!==Dt}restoreDraft(){let e=this.draft;this.draft=null,e&&this.edit(Ni(e.building))}discardDraft(){this.draft=null,Li(null),this.host.requestUpdate()}async flush(){clearTimeout(this.timer),this.inFlight&&await this.inFlight;let e=this.waiting,t=this.hass;!e||!t||(this.waiting=null,this.saveState="saving",this.host.requestUpdate(),this.inFlight=this.send(t,e),await this.inFlight,this.inFlight=null)}async send(e,t){try{let r=await Ps(e,t);this.ownRevisions.add(r),this.revision=r,this.saveState=this.waiting?"saving":"saved",this.saveError=null,Li(null)}catch(r){this.saveState="error",this.saveError=ma(r),Li({building:t,savedAt:Date.now()})}this.host.requestUpdate()}async start(){let e=this.hass;if(e&&(await Promise.all([this.reloadPacks(),this.reload()]),!(this.stopListening||!this.connected)))try{this.stopListening=await Is(e,t=>{let r=this.ownRevisions.has(t)||t===this.revision,i=this.waiting!==null||this.inFlight!==null;!r&&!i&&this.reload()})}catch{}}async reloadPacks(){if(this.hass){try{this.packs=await Ns(this.hass)}catch{this.packs=[]}Xs(this.packs),this.host.requestUpdate()}}async reload(){if(this.hass){try{let e=await Hs(this.hass);this.building=Ni(e.building),Pi(this.building.settings.plugins),this.backendVersion=e.version??null,this.revision=e.revision,this.error=null,this.draft===null&&!this.waiting&&(this.draft=th())}catch(e){this.error=ma(e)}this.host.requestUpdate()}}};var Wi=n=>n.slice(0,n.indexOf(".")),rh={light:"light",switch:"switch",input_boolean:"switch",valve:"switch",fan:"fan",cover:"cover",climate:"climate",media_player:"media",lock:"lock",sensor:"sensor",binary_sensor:"binary",event:"sensor",scene:"scene",script:"script"},P=n=>rh[Wi(n)]??null,Bi=["light","cover","climate","media","switch","fan","lock","binary","sensor","scene","script"];function pa(n,e=!1){if(e||n.startsWith("lamp:"))return"light";if(n.startsWith("tap:"))return"tap";if(n.startsWith("gang:"))return"switch";if(n==="grid")return"sensor";let t=P(n);return t&&t!=="scene"&&t!=="script"?t:"other"}var fa=new Set(["light","switch","fan"]),ga=n=>n!==null&&n!=="scene"&&n!=="script",C=n=>!n||n.state==="unavailable"||n.state==="unknown"&&!n.entity_id.startsWith("event."),ih=new Set(["motion","occupancy","presence","moving"]),_a=(n,e)=>e.startsWith("binary_sensor.")&&ih.has(String(n?.states[e]?.attributes.device_class??"")),pn=n=>!!n&&n.entity_id.startsWith("cover.")&&n.state==="unknown"&&n.attributes.assumed_state===!0,hr=(n,e)=>n.filter(t=>(!C(t)||pn(t))&&!e?.has(t.entity_id)).map(t=>t.entity_id);function O(n,e,t){let r=String(n?.states[e]?.attributes.friendly_name??n?.entities?.[e]?.name??e);if(!t||r.length<=t.length+1||!r.toLowerCase().startsWith(`${t.toLowerCase()} `))return r;let i=r.slice(t.length+1);return i[0].toUpperCase()+i.slice(1)}var oh=new Set(["running","printing","prepare","preparing","slicing","heating","busy","working","active","washing","rinsing","spinning","drying","cleaning","in_progress","in progress","on"]),mr=n=>!!n&&n.entity_id.startsWith("sensor.")&&n.attributes.device_class==="enum";function te(n){if(!n)return!1;if(n.entity_id.startsWith("vacuum."))return["cleaning","returning"].includes(n.state);if(n.entity_id.startsWith("valve."))return n.state==="open"||n.state==="opening";let e=P(n.entity_id);return e==="light"||e==="switch"||e==="fan"||e==="binary"?n.state==="on":e==="cover"?n.state==="open"||n.state==="opening":e==="climate"?["heating","cooling"].includes(String(n.attributes.hvac_action)):e==="media"?n.state==="playing":e==="lock"?n.state==="unlocked"||n.state==="open":e==="sensor"?mr(n)&&oh.has(n.state.toLowerCase()):!1}var ba=n=>Math.min(1,Math.max(0,n));function sh(n){let e=ba((n-2200)/4300),t=[1,.66,.26],r=[.78,.9,1];return[0,1,2].map(i=>t[i]+(r[i]-t[i])*e)}function We(n,e){if(!n||n.state!=="on")return null;let t=e&&!["unavailable","unknown"].includes(e.state)?e.attributes:n.attributes,r=typeof t.brightness=="number"?.2+.8*Math.sqrt(ba(t.brightness/255)):1,i=t.rgb_color;return i&&!["color_temp","brightness","onoff"].includes(String(t.color_mode))?{color:[i[0]/255,i[1]/255,i[2]/255],level:r}:typeof t.color_temp_kelvin=="number"?{color:sh(t.color_temp_kelvin),level:r}:{color:[1,.71,.28],level:r}}function ya(n,e,t){let r=We(n,t);if(r)return r;for(let i of e){let o=We(i);if(o)return{color:o.color,level:o.level*.6}}return null}function Ht(n,e,t=null){if(n==="light"&&t==="floor")return 1.95;if(n==="light"&&t==="table")return 1.25;if(n==="light"&&t==="wall")return 1.95;switch(n){case"light":return Math.max(.5,e-.25);case"cover":return Math.min(2,e-.3);case"climate":return .6;case"media":return .9;case"binary":case"sensor":return 1.4;default:return 1.05}}var re=n=>n.config?.unit_system?.temperature==="\xB0F"?"\xB0F":"\xB0C";function pr(n,e){let t=String(e??"").replace(/\s/g,"").toLowerCase();return t==="\xB0f"||t==="\u2109"?(n-32)*5/9:t==="k"?n-273.15:n}var ce=(n,e)=>re(n)==="\xB0F"?e*9/5+32:e;var ah=new Set(["temperature","humidity","power","carbon_dioxide","energy","gas","water","volume","volume_storage","volume_flow_rate","illuminance","pressure","atmospheric_pressure","pm1","pm25","pm10","volatile_organic_compounds","volatile_organic_compounds_parts","carbon_monoxide","nitrogen_dioxide","moisture","sound_pressure"]),lh=new Set(["m\xB3","m3","L","l","kWh","Wh","MWh","lx"]),ch=new Set(["door","window","opening","garage_door","motion","occupancy","presence","smoke","moisture","gas","carbon_monoxide"]),uh=new Set(["battery","signal_strength","timestamp","date","duration","data_rate","data_size","frequency","enum"]);function nt(n,e){let t=n.entities?.[e];return t&&(t.area_id||(t.device_id?n.devices?.[t.device_id]?.area_id:null))||null}var wa=(n,e)=>{let t=n.entities?.[e];return!!(t?.hidden||t?.entity_category)},dh=(n,e)=>P(e)??Tt(e,n.states[e]);function va(n,e){let t=n.states[e];if(!t||wa(n,e))return!1;if(Tt(e,t)!==null)return!0;let r=P(e);if(!r)return!1;let i=t.attributes.device_class;return e.startsWith("event.")?!i||i==="button"||i==="doorbell":r==="sensor"?i?ah.has(i):lh.has(String(t.attributes.unit_of_measurement??"")):r==="binary"?i?ch.has(i):!!n.entities?.[e]?.area_id:!0}function hh(n,e){let t=n.states[e];return P(e)!=="sensor"||!t?.attributes.unit_of_measurement||wa(n,e)||uh.has(String(t.attributes.device_class??""))?!1:Number.isFinite(Number(t.state))||C(t)}var gr=(n,e)=>e.startsWith("sensor.")&&n.states[e]?.attributes.device_class==="power",Vi=null;zt(()=>Vi=null);function Ki(n,e){let t=n.get(e);return t||n.set(e,t=[]),t}function mh(n){let e=new Map,t=new Map,r=new Map,i=new Map,o=[],s=u=>{(va(n,u)||hh(n,u))&&ga(dh(n,u))&&o.push(u)};for(let[u,h]of Object.entries(n.entities??{})){let m=h.device_id;m&&h.area_id&&(i.get(m)??i.set(m,new Set).get(m)).add(h.area_id),m&&gr(n,u)&&Ki(t,m).push(u),m&&!h.hidden&&!h.entity_category&&(r.get(m)??r.set(m,new Set).get(m)).add(Wi(u));let d=nt(n,u);d===null?s(u):va(n,u)&&Ki(e,d).push(u)}if(n.entities)for(let u of Object.keys(n.states))n.entities[u]||s(u);let a=Bi.indexOf("binary")-.5,l=u=>{let h=P(u),m=h?Bi.indexOf(h):a;return m>a&&Tt(u,n.states[u])!==null?a:m};o.sort((u,h)=>l(u)-l(h)||O(n,u).localeCompare(O(n,h)));for(let[u,h]of e){let m=n.areas?.[u]?.name;h.sort((d,g)=>l(d)-l(g)||O(n,d,m).localeCompare(O(n,g,m)))}let c=new Set;for(let[u,h]of i)h.size>1&&c.add(u);return{entities:n.entities,devices:n.devices,states:n.states,stateCount:Object.keys(n.states).length,byArea:e,powerByDevice:t,withoutArea:o,domainsByDevice:r,hubs:c}}function _r(n){let e=Vi;return e&&e.entities===n.entities&&e.devices===n.devices&&(e.states===n.states||(e.states=n.states,Object.keys(n.states).length===e.stateCount))?e:Vi=mh(n)}function U(n,e){let t=fr(n,e.area_id);return e.sub_areas?.length?[...new Set([...t,...e.sub_areas.flatMap(r=>fr(n,r))])]:t}function fr(n,e){return!e||!n.entities?[]:_r(n).byArea.get(e)??[]}var Gi=(n,e)=>!!n.entities&&_r(n).hubs.has(e),br=(n,e)=>n.entities?_r(n).powerByDevice.get(e)??[]:[];function Ui(n,e){let t=new Map;for(let i of e)Ki(t,n.entities?.[i]?.device_id??`entity:${i}`).push(i);let r=new Map(e.map((i,o)=>[i,o]));return[...t.values()].map(i=>{let o=i.find(s=>!n.entities?.[s]?.name)??i[0];return{primary:o,others:i.filter(s=>s!==o)}}).sort((i,o)=>r.get(i.primary)-r.get(o.primary))}var _t=(n,e)=>Ui(n,e).map(t=>t.primary),ph={temperature:"temperature",humidity:"humidity",co2:"carbon_dioxide",illuminance:"illuminance"};function fh(n,e,t,r=!1){let i=n.states[e]?.attributes;if(!i)return!1;let o=(i.symcon_variable_type===1||i.symcon_variable_type===2)&&typeof i.symcon_id=="number";if(typeof i.symcon_id=="number"&&!o||!o&&!/^(sensor|input_number|number)\./.test(e))return!1;if(r&&o)return!0;let s=String(i.unit_of_measurement??"").replace(/\s/g,"").toLowerCase();return t==="temperature"&&["\xB0c","\xB0f","\u2103","\u2109","k"].includes(s)||t==="humidity"&&!i.device_class&&["%","%rh","%r.h.","%rf","%r.f."].includes(s)||t==="co2"&&s==="ppm"&&/co[₂2]/i.test(String(i.friendly_name??""))||t==="illuminance"&&["lx","lux"].includes(s)?!0:i.device_class===ph[t]}var gh=new Set(["climate","water_heater","switch","button","camera","media_player","vacuum","light","fan","lawn_mower"]),_h=["vorlauf","r(\xFC|ue)cklauf","flow","return","d(\xFC|ue)se","nozzle","hotend","extruder","druckbett","heatbed","(^|[^a-z])bed($|[^a-z])","chamber","cpu","gpu","chip","soc","akku","batter","wasser","water","kessel","boiler","au(\xDF|ss)en","outdoor","outside","abgas","exhaust","sole","brine","verdampfer","kondensat","verdichter","compressor","motor","k(\xFC|ue)hl","freezer","fridge","gefrier"],bh=new RegExp(`(${_h.join("|")})`,"i");function yh(n,e){let t=n.entities?.[e]?.device_id,r=t&&!Gi(n,t)?_r(n).domainsByDevice.get(t):void 0;return r&&[...r].some(i=>gh.has(i))?!1:!bh.test(`${e} ${n.states[e]?.attributes.friendly_name??""}`)}function be(n,e,t,r){let i=t.climate?.[r];if(i==="none")return[];if(i)return[i].flat().filter(c=>n.states[c]);let o=(e?.placements??[]).filter(c=>c.entity_id.startsWith("sensor.")),s=o.filter(c=>H([c.x,c.z],t.points)).map(c=>c.entity_id),a=new Set(o.filter(c=>!H([c.x,c.z],t.points)).map(c=>c.entity_id));return[...new Set([...U(n,t).filter(c=>!a.has(c)),...s])].filter(c=>c.startsWith("sensor.")&&fh(n,c,r)&&yh(n,c))}function Z(n,e,t,r){let i=be(n,e,t,r).map(a=>{let l=n.states[a];if(!l||C(l)||!l.state.trim()&&l.attributes.symcon_numeric_value===void 0)return NaN;let c=Number(l?.attributes.symcon_numeric_value??l?.state);return r==="temperature"?pr(c,n.states[a]?.attributes.unit_of_measurement):c}).filter(Number.isFinite);if(i.length)return i.reduce((a,l)=>a+l,0)/i.length;if(t.climate?.[r]||r!=="temperature"&&r!=="humidity"||t.climate?.[r]==="none")return null;let o=r==="temperature"?"current_temperature":"current_humidity",s=U(n,t).filter(a=>a.startsWith("climate.")).map(a=>n.states[a]?.attributes[o]).filter(a=>typeof a=="number"&&Number.isFinite(a));return s.length?s.reduce((a,l)=>a+l,0)/s.length:null}function ji(n){let e=n.attributes;if(typeof e.symcon_numeric_value!="number")return null;let t=typeof e.symcon_min=="number"?e.symcon_min:0,r=typeof e.symcon_max=="number"&&e.symcon_max>t?e.symcon_max:100;return Math.max(0,Math.min(100,(e.symcon_numeric_value-t)/(r-t)*100))}function xa(n,e){let t=n.attributes.symcon_id;if(e==="light"&&n.attributes.symcon_variable_type===0&&typeof t=="number"){let i=n.attributes.symcon_value;return{...n,entity_id:`light.${t}`,state:n.state==="unavailable"||n.state==="unknown"?n.state:(typeof i=="boolean"?i:n.state==="on")?"on":"off",attributes:{...n.attributes,color_mode:"onoff",supported_color_modes:["onoff"],...n.entity_id!==`light.${t}`?{symcon_source_entity:n.entity_id}:{}}}}let r=ji(n);return r===null||typeof t!="number"?null:{...n,entity_id:`${e}.${t}`,state:e==="light"?r>0?"on":"off":r>0?"open":"closed",attributes:{...n.attributes,...e==="light"?{brightness:Math.round(r*2.55),color_mode:"brightness",supported_color_modes:["brightness"]}:{current_position:r,supported_features:4},...n.entity_id!==`${e}.${t}`?{symcon_source_entity:n.entity_id}:{}}}}function Pt(n,e){let t=e?n.states[e]:void 0;if(!t||C(t))return null;let r=t.attributes;if(r.nf_cover_control&&typeof r.current_position=="number")return r.current_position;let i=ji(t);if(i!==null)return i;if(typeof r.current_position=="number")return Math.max(0,Math.min(100,r.current_position));if(!t.state.trim())return null;let o=Number(t.state);if(!Number.isFinite(o))return null;let s=r.unit_of_measurement==="%"||o>1||o<0?o:o*100;return Math.max(0,Math.min(100,s))}var vh=new Set([void 0,"shutter","blind","awning","shade","curtain","window"]),wh=new Set(["garage","gate"]),xh=new Set(["window","opening"]);function fn(n,e,t=!1){let r=new Map;return n.forEach((i,o)=>{let s=t&&e.length===1?e[0]:e[o];s&&r.set(i.id,s)}),r}var ka=(n,e)=>n==="none"?null:n??e??null,rt=n=>n&&n!=="none"?n:null;function Be(n,e){let t=new Map;for(let r of e)for(let i of r.rooms){let o=r.openings.filter(_=>_.room_id===i.id).sort((_,b)=>_.edge-b.edge||_.offset-b.offset);if(o.length===0)continue;let s=U(n,i),a=_=>n.states[_]?.attributes.device_class,l=_=>s.filter(b=>P(b)==="binary"&&_(a(b)??"")),c=_=>o.filter(b=>b.type===_),u=fn(c("window"),s.filter(_=>P(_)==="cover"&&vh.has(a(_))),!0),h=fn(c("window"),l(_=>xh.has(_))),m=fn(c("door"),l(_=>_==="door")),d=fn(c("garage"),s.filter(_=>P(_)==="cover"&&wh.has(a(_)??""))),g=fn(c("garage"),l(_=>_==="garage_door"));for(let _ of o){let b=_.type==="window"?u:_.type==="garage"?d:null,y=_.type==="window"?h:_.type==="garage"?g:m,S=_.leaves===2;t.set(_.id,{cover:ka(_.cover,b?.get(_.id)),contact:_.sensor==="handle"&&_.contact==null?null:ka(_.contact,y.get(_.id)),tilt:_.tilt==="none"?null:_.tilt,contact2:S?rt(_.contact2):null,tilt2:S?rt(_.tilt2):null,position:rt(_.position),positionInverted:!!_.position_inverted,tiltAngle:rt(_.tilt_angle),tiltMax:_.tilt_max??null,tiltOffset:_.tilt_offset??null,tiltInvert:!!_.tilt_invert,shut:!!_.shut,angled:_.type==="door"&&!!_.open_angle,lock:_.type==="door"?rt(_.lock):null,cover2:_.type==="garage"?null:rt(_.cover2),coverTilt:rt(_.cover_tilt),cover2Tilt:rt(_.cover2_tilt),coverInverted:!!_.cover_inverted,coverTiltInverted:!!_.cover_tilt_inverted,cover2Inverted:!!_.cover2_inverted,cover2TiltInverted:!!_.cover2_tilt_inverted})}}return t}var kh=[[/^(tilted|tilt|gekippt|kipp)/i,"tilted"],[/^(open|opened|offen|geöffnet|on)$/i,"open"],[/^(closed|close|geschlossen|zu|off)$/i,"closed"]];function Sh(n){if(!n||C(n))return null;let e=n.attributes.window_state;for(let t of[typeof e=="string"?e:"",n.state]){let r=t.trim(),i=r&&kh.find(([o])=>o.test(r));if(i)return i[1]}return null}var $h=.5;function $a(n,e){let t=Pt(n,e);return t===null?null:t/100}function Ma(n,e,t=!1){let r=e?n.states[e]:void 0;if(!r||C(r))return e?0:null;let i=r.attributes.current_position;if(typeof i=="number"){let o=1-Math.min(100,Math.max(0,i))/100;return t?1-o:o}return r.state==="closed"?t?0:1:r.state==="open"?t?1:0:r.state==="opening"||r.state==="closing"?.5:0}function Sa(n,e,t,r=!1){let i=n.states[e||""],o=!!i?.attributes.nf_cover_control,s=o?i.attributes:n.states[t||e||""]?.attributes,a=s?.current_tilt_position??(!o&&t?s?.current_position:void 0),l=typeof a=="number"?Math.min(100,Math.max(0,a)):t?Pt(n,t):null;return l===null?null:(r?100-l:l)/100}function Mh(n,e){let t=$a(n,e.position);if(t!==null){let i=e.positionInverted?t:1-t;return e.coverInverted?1-i:i}let r=e.cover?n.states[e.cover]:void 0;return r&&!C(r)?typeof r.attributes.current_position=="number"?Ma(n,e.cover,e.coverInverted):r.state==="closed"?e.coverInverted?0:1:r.state==="open"?e.coverInverted?1:0:r.state==="opening"||r.state==="closing"?.5:0:e.cover?0:null}function qi(n,e){let t=e?n.states[e]?.state:void 0;return t==="unlocked"||t==="open"||t==="opening"}function Ve(n,e,t="window"){let r=g=>!!g&&n.states[g]?.state==="on",i=g=>!!g&&!!n.states[g]&&!C(n.states[g]),o=g=>g?Sh(n.states[g]):null,s=Mh(n,e),a=Sa(n,e.cover,e.coverTilt,e.coverTiltInverted),l=Sa(n,e.cover2,e.cover2Tilt,e.cover2TiltInverted),c={...e.cover2?{cover2:Ma(n,e.cover2,e.cover2Inverted)}:{},...a!==null?{slats:a}:{},...l!==null?{slats2:l}:{}};if(t==="door"){let g=o(e.contact);return{open:g===null?e.shut?0:e.angled?1:$h:g==="closed"?0:1,open2:o(e.contact2)==="open"?1:0,tilt:0,tilt2:0,cover:s,...c,sensed:g!==null||s!==null,unlocked:qi(n,e.lock),assumed:g===null}}if(t==="garage"){let g=s!==null||i(e.contact),_=$a(n,e.position)!==null||i(e.cover),b=i(e.contact)?r(e.contact)?0:1:null;return{open:0,open2:0,tilt:0,tilt2:0,cover:(_?s:b??s)??1,sensed:g}}let u=r(e.tilt2)||o(e.tilt2)==="tilted"||o(e.contact2)==="tilted",h=r(e.tilt)||o(e.tilt)==="tilted"||o(e.contact)==="tilted",m=h?1:0,d=e.tiltAngle?Number(n.states[e.tiltAngle]?.state):NaN;if(Number.isFinite(d)){let g=(d-(e.tiltOffset??0))*(e.tiltInvert?-1:1);m=Math.min(1,Math.max(0,g/(e.tiltMax||15))),m<.08&&(m=0),h=m>0}return{open:o(e.contact)==="open"&&!h?1:0,open2:o(e.contact2)==="open"&&!u?1:0,tilt:m,tilt2:u?1:0,cover:s,sensed:i(e.contact)||i(e.tilt)||Number.isFinite(d),...c}}var Aa=/\b(tv|fernseh|television|fire ?tv|apple ?tv|chromecast|shield)/i,Ea=/(kühl|fridge|gefrier|freezer)/i,Ra=/(spülmaschine|geschirrspül|dishwasher)/i,Ah=/(kochfeld|herd|induktion|cooktop)/i,Eh={robot_vacuum:/(saug|vacuum|robo|roomba|roborock|dreame|ecovacs|deebot)/i,tv_board:Aa,tv_wall:Aa,desk:/\b(pc|computer|rechner|desktop|monitor|workstation)/i,fridge:Ea,fridge_smart:Ea,stove:/(herd|kochfeld|cooktop|stove|induktion)/i,kitchen_tall:/(backofen|oven|ofen)/i,dishwasher:Ra,washer:/(waschmaschine|washer|washing)/i,dryer:/(trockner|dryer)/i,kitchen:/(kaffee|coffee|wasserkocher|kettle)/i,island:Ah,sink:Ra,radiator:/(heiz|radiator|thermostat|climate|hk|trv)/i},za={lamp_ceiling:/(decke|ceiling|haupt|main)/i,lamp_downlight:/(spot|strahler|downlight|einbau)/i,lamp_spot:/(spot|strahler)/i,lamp_panel:/(panel|decke|ceiling)/i,lamp_uplight:/(fluter|uplight|steh)/i,lamp_bollard:/(weg|garten|garden|path|poller|außen|aussen|outdoor)/i,lamp_garden:/(garten|garden|spot|außen|aussen|outdoor|baum|tree)/i,lamp_pendant:/(pendel|pendant|hänge|esstisch|dining)/i,ceiling_fan:/(ventilator|fan)/i,lamp_floor:/(steh|floor)/i,lamp_table:/(tisch|nacht|table|bedside|lese|reading)/i,lamp_wall:/(wand|wall)/i,led_strip:/(led|strip|streifen|leiste|band)/i},Da=new Set(["tv_board","tv_wall"]);var Fa=n=>Da.has(n)||!!ta(n),Ta=n=>!!X(n)?.electric&&/speaker|multiroom|soundbar/.test(n.split(":").pop()??n),yr=n=>Fa(n)||n==="desk"||n==="fridge_smart",It=n=>!!n&&n!=="none";function Rh(n,e){if(gr(n,e))return e;let t=n.entities?.[e]?.device_id;return t?br(n,t).find(r=>r!==e)??null:null}var zh=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function gn(n,e,t,r){return n.find(i=>e?.test(t(i)))??(r?n[0]??null:null)}function Ke(n,e){let t=new Map;for(let r of e){let i=new Set([...r.furniture.flatMap(o=>[o.entity,o.power,o.fan_entity]),...r.placements.map(o=>o.entity_id)].filter(It));for(let o of r.furniture){let s=o.type in za,a=na(o.type),l=s?za[o.type]:Eh[o.type];if(!l&&!a&&!Ta(o.type)&&o.entity==null&&o.power==null)continue;let c=zh(r,o.x,o.z),u=(c?_t(n,U(n,c)):[]).filter(b=>!i.has(b)),h=b=>`${b} ${O(n,b)}`,m=b=>u.filter(y=>P(y)===b),d=o.entity==="none"?null:o.entity??null;if(o.entity==null){if(o.type==="ceiling_fan"){let b=(c?U(n,c):[]).filter(S=>!i.has(S)),y=new Set(b.filter(S=>P(S)==="fan").map(S=>n.entities?.[S]?.device_id).filter(Boolean));d=b.find(S=>P(S)==="light"&&y.has(n.entities?.[S]?.device_id))??gn(m("light"),l,h,!1)}else if(s)d=gn(m("light"),l,h,!0);else if(o.type==="robot_vacuum"){let b=c?.area_id??null;d=Object.keys(n.entities??{}).find(y=>y.startsWith("vacuum.")&&!i.has(y)&&nt(n,y)===b)??null}else if(o.type==="radiator"||a)d=gn(m("climate"),l,h,!0);else if(Fa(o.type)){let b=m("media");d=b.find(y=>n.states[y]?.attributes.device_class==="tv")??gn(b,l,h,Da.has(o.type))}else if(Ta(o.type)){let b=m("media").filter(y=>n.states[y]?.attributes.device_class!=="tv");d=gn(b,l,h,!1)??(b.length===1?b[0]:null)}else l&&(d=u.find(b=>["switch","media","fan"].includes(P(b)??"")&&l.test(h(b)))??null);d&&i.add(d)}let g=o.power==="none"?null:o.power??null;o.power==null&&(g=d?Rh(n,d):null,!g&&l&&c&&!s&&(g=U(n,c).find(b=>gr(n,b)&&!i.has(b)&&l.test(h(b)))??null),g&&i.add(g));let _=null;if(o.type==="ceiling_fan"&&(_=o.fan_entity==="none"?null:o.fan_entity??null,o.fan_entity==null)){let b=(c?U(n,c):[]).filter(S=>P(S)==="fan"&&!i.has(S)),y=d?n.entities?.[d]?.device_id:void 0;_=(y?b.find(S=>n.entities?.[S]?.device_id===y):void 0)??b[0]??null,_&&i.add(_)}(d||g||_)&&t.set(o.id,{entity:d,power:g,...o.type==="ceiling_fan"?{fan:_}:{}})}}return t}function bt(n,e){let t=new Set,r=Ke(n,e),i=e.some(o=>o.openings.some(s=>s.confirm))?Be(n,e):null;for(let o of e){for(let s of o.placements)s.confirm&&t.add(s.entity_id);for(let s of o.openings){let a=s.confirm?i?.get(s.id)?.cover:null;It(a)&&t.add(a)}for(let s of o.furniture){let a=s.confirm?r.get(s.id)?.entity:null;It(a)&&t.add(a)}}return t}var Zi=n=>n==="fridge"||n==="fridge_smart"||/(fridge|freezer|kuehl|gefrier|chest_freezer)/.test(n.slice(n.lastIndexOf(":")+1)),Th=8,Dh=-12;function Ha(n,e,t){let r=a=>{if(!It(a))return null;let l=n.states[a],c=l?Number(l.state):NaN;return Number.isFinite(c)?l.attributes.unit_of_measurement==="\xB0F"?(c-32)*5/9:c:null},i=r(e.temp_entity),o=r(e.temp_entity2);return i===null&&o===null?null:{text:[i,o].filter(a=>a!==null).map(t).join(" \xB7 "),warm:i!==null&&i>Th||o!==null&&o>Dh}}var Pa=60;function Ia(n,e){if(!It(e))return null;let t=n.states[e],r=t?Number(t.state):NaN;return Number.isFinite(r)?t.attributes.unit_of_measurement==="\xB0F"?(r-32)*5/9:r:null}function Ca(n,e){let t=i=>It(i)&&["on","open"].includes(n.states[i]?.state??""),r=new Map;for(let i of e.flatMap(o=>o.furniture))i.type==="fridge_smart"&&r.set(i.id,{left:t(i.door_left),right:t(i.door_right)});return r}function Na(n,e,t){let r=(u,h)=>H([u,h],t.points),i=Ke(n,[e]),o=Be(n,[e]),s=new Set(t.hidden??[]),a=[...e.placements.filter(u=>!u.outside&&r(u.x,u.z)).map(u=>u.entity_id),...e.furniture.filter(u=>r(u.x,u.z)).flatMap(u=>[i.get(u.id)?.entity,i.get(u.id)?.power]),...e.openings.filter(u=>u.room_id===t.id).flatMap(u=>{let h=o.get(u.id);return h?[h.cover,h.cover2,h.contact,h.tilt,h.contact2]:[]}),...t.panel??[]],l=[...new Set(a.filter(u=>!!u&&!!n.states[u]))].filter(u=>!s.has(u)),c=new Set(l);return{shown:l,more:U(n,t).filter(u=>!c.has(u)&&!s.has(u))}}function _n(n,e,t=[]){let r=[];for(let i of e){let o=(a,l)=>i.rooms.some(c=>c.points.length>=3&&H([a,l],c.points)),s=Ke(n,[i]);r.push(...i.placements.filter(a=>a.outside||!o(a.x,a.z)).map(a=>a.entity_id)),r.push(...i.furniture.filter(a=>!o(a.x,a.z)).flatMap(a=>[s.get(a.id)?.entity,s.get(a.id)?.power]));for(let a of i.outdoor??[])a.area_id&&r.push(..._t(n,fr(n,a.area_id))),r.push(a.pump_entity,a.temp_entity)}return[...new Set(r.filter(i=>!!i&&!!n.states[i]&&!t.includes(i)))]}var Fh={soc:/(^|_)(soc|state_of_charge|battery_level|battery|ladestand|ladezustand|akku)($|_)/,range:/(^|_)(range|reichweite|remaining_range)($|_)/,charging:/(charging|charge_power|ladeleistung|laden|charger_power|lade)/,plugged:/(plug|cable|connected|stecker|kabel|angeschlossen)/,lock:/(lock|verriegel|schloss)/,climate:/(climat|preheat|precondition|hvac|heiz|klima|standheizung)/,tracker:/./},Hh=/^k?W$/,Ge=n=>n&&n!=="none"?n:null;function Ph(n,e){let t=e.car??{},r=Ge(t.device)??Ge(e.entity),i=r?n.entities?.[r]?.device_id:null,o=i&&n.entities?Object.values(n.entities).filter(m=>m.device_id===i).map(m=>m.entity_id):[],s=(m,d)=>String(n.states[m]?.attributes[d]??""),a=m=>`${m} ${s(m,"friendly_name")} ${n.entities?.[m]?.translation_key??""}`.toLowerCase().replace(/[\s-]+/g,"_"),l=(m,d,g=()=>!0)=>o.find(_=>d.includes(_.split(".")[0])&&Fh[m].test(a(_))&&g(_))??null,c=(m,d)=>o.find(g=>g.startsWith(`${m}.`)&&s(g,"device_class")===d)??null,u=m=>o.find(d=>d.startsWith(`${m}.`))??null,h=m=>s(m,"unit_of_measurement");return{soc:Ge(t.soc)??c("sensor","battery")??l("soc",["sensor"],m=>h(m)==="%"),range:Ge(t.range)??l("range",["sensor"],m=>/km|mi/.test(h(m)))??l("range",["sensor"]),charging:Ge(t.charging)??l("charging",["sensor"],m=>Hh.test(h(m)))??l("charging",["binary_sensor","switch"]),plugged:Ge(t.plugged)??c("binary_sensor","plug")??l("plugged",["binary_sensor"]),lock:Ge(t.lock)??u("lock")??l("lock",["binary_sensor"]),climate:Ge(t.climate)??u("climate")??l("climate",["switch","binary_sensor"]),tracker:Ge(t.tracker)??u("device_tracker")}}function La(n,e){return e.flatMap(r=>r.furniture).filter(r=>r.type==="parking"&&r.car).flatMap(r=>Object.values(Ph(n,r))).filter(r=>!!r)}var Oa=/(^|_)(current_room|current_segment|aktueller_raum|current_area)($|_)/;function vr(n,e,t){if(t==="none")return null;if(t)return t;let r=e?n.entities?.[e]?.device_id:null;return!r||!n.entities?null:Object.values(n.entities).find(o=>o.device_id===r&&o.entity_id.startsWith("sensor.")&&(Oa.test(o.translation_key??"")||Oa.test(o.entity_id.split(".")[1])))?.entity_id??null}function Wa(n){return n.toLowerCase().replace(/ä/g,"a").replace(/ö/g,"o").replace(/ü/g,"u").replace(/ß/g,"ss").replace(/ae/g,"a").replace(/oe/g,"o").replace(/ue/g,"u").normalize("NFD").replace(/[^a-z0-9]/g,"")}function Yi(n,e,t,r){let i=r?n.states[r]?.state:t?n.states[t]?.attributes.current_room:void 0;if(typeof i!="string"||["","unknown","unavailable"].includes(i))return null;let o=Wa(i);if(!o)return null;let s=l=>[l.name,l.area_id??"",l.area_id&&n.areas?.[l.area_id]?.name||""].map(Wa).filter(Boolean);return e.find(l=>s(l).includes(o))??e.find(l=>s(l).some(c=>c.length>=3&&(c.includes(o)||o.includes(c))))??null}var Ih=new Set(["garage","gate","door"]);function Ji(n,e){let t=new Set,r=new Set,i=o=>{if(!o||o==="none"||!n.states[o])return;let s=P(o);s==="light"&&t.add(o),s==="cover"&&!Ih.has(String(n.states[o].attributes.device_class??""))&&r.add(o)};for(let o of e.rooms){let s=new Set(o.hidden??[]);_t(n,U(n,o)).filter(a=>!s.has(a)).forEach(i)}return e.placements.forEach(o=>i(o.entity_id)),e.furniture.forEach(o=>i(o.entity)),{lights:[...t],covers:[...r]}}function Ba(n){let e=n.split(".")[0];switch(e){case"scene":case"script":return[e,"turn_on"];case"automation":return[e,"trigger"];case"button":case"input_button":return[e,"press"];default:return["homeassistant","toggle"]}}function Qi(n,e,t){let r=t.target?.trim()??"",i=(o,s)=>e.dispatchEvent(new CustomEvent(o,{detail:s,bubbles:!0,composed:!0}));switch(t.action){case"navigate":if(!r)return;history.pushState(null,"",r),window.dispatchEvent(new CustomEvent("location-changed",{detail:{replace:!1}}));return;case"more_info":r&&i("hass-more-info",{entityId:r});return;case"service":{if(!r.includes("."))return;let[o,s]=r.split(".",2);n.callService(o,s,t.data??{});return}case"fire_dom_event":i("ll-custom",t.data??{});return}}function Va(n,e){let t=e.data?.entity_id,r=e.state_entity||(e.action==="more_info"?e.target:null)||(e.action==="service"&&typeof t=="string"?t:null),i=r?n?.states[r]:void 0;return!!i&&["on","open","playing","home","heat","cool","unlocked"].includes(i.state)}var Ch=[.25,.9,.45],Nh=[1,.82,.55];function Lh(n,e){let t=n.states[e],r=Number(t?.attributes.current_power_w??t?.attributes.power??NaN);return Number.isFinite(r)?r:null}function Ka(n,e,t){let r=[];return e.forEach((i,o)=>{if(!i||i==="none")return;let s=n.states[i];if(!s||C(s))return;if(P(i)==="light"){let c=We(s);c&&r.push({gang:o,color:c.color,level:c.level});return}if(!te(s)&&s.state!=="on")return;let a=t?Lh(n,i):null,l=a===null?.8:Math.min(1,.45+Math.sqrt(Math.max(0,a))/40);r.push({gang:o,color:t?Ch:Nh,level:l})}),r}var Xi=(n,e)=>(n??[]).slice(0,e).filter(t=>!!t&&t!=="none");var Oh=864e5,eo=n=>{let e=new Date(n);return e.setHours(0,0,0,0),e.getTime()};function Wh(n,e){let t=/(\d{4})-(\d{2})-(\d{2})/.exec(n);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3])).getTime();if(t=/(\d{1,2})\.(\d{1,2})\.(\d{4}|\d{2})?/.exec(n),t){let r=t[3]?t[3].length===2?2e3+Number(t[3]):Number(t[3]):new Date(e).getFullYear(),i=new Date(r,Number(t[2])-1,Number(t[1])).getTime();return!t[3]&&it)return Math.ceil((c-t)/6e4);continue}let s=/^(\d+):(\d{2})(?::(\d{2}))?$/.exec(i.state.trim());if(s){let c=s[3]!==void 0?Number(s[1])*60+Number(s[2])+Number(s[3])/60:Number(s[1])*60+Number(s[2]);if(c>0)return Math.ceil(c);continue}let a=Number(i.state);if(!Number.isFinite(a)||a<=0)continue;let l=String(o.unit_of_measurement??"min").toLowerCase();return Math.ceil(l==="h"?a*60:l==="s"?a/60:a)}return null}function bn(n,e){let t=e?n.entities?.[e]?.device_id:null;return t&&n.entities?Object.values(n.entities).filter(r=>r.device_id===t).map(r=>r.entity_id):[]}var ja=n=>n<60?`${n} min`:`${Math.floor(n/60)} h ${String(n%60).padStart(2,"0")} min`;function xr(n,e,t){for(let r of e)for(let i of r.placements)if(i.entity_id===t&&i.cover_tilt&&i.cover_tilt!=="none")return i.cover_tilt;for(let r of Be(n,e).values()){if(r.cover===t&&r.coverTilt)return r.coverTilt;if(r.cover2===t&&r.cover2Tilt)return r.cover2Tilt}return null}function kr(n,e,t){if(e.attributes.nf_cover_control||!t)return e;let r=n.states[t]?.attributes,i=r?.current_tilt_position??r?.current_position;return typeof i!="number"?e:{...e,attributes:{...e.attributes,current_tilt_position:i,supported_features:Number(e.attributes.supported_features??0)|128}}}function Vh(n,e){let t=e?n.states[e]:void 0;if(!t||C(t))return null;let r=t.attributes.current_position;return typeof r=="number"?Math.min(100,Math.max(0,r)):t.state==="open"?100:t.state==="closed"?0:t.state==="opening"||t.state==="closing"?50:null}function qa(n,e){let t=new Map;for(let r of e.floors.flatMap(i=>i.furniture)){let i=X(r.type);if(!i||!rr(i))continue;let o=r.cover_entity?Vh(n,r.cover_entity):null;t.set(r.id,ea(i,o!==null&&r.cover_inverted?100-o:o))}return t}var Kh={view:"3D",editor:"Editor",all_floors:"Alle Etagen",outside_area:"Au\xDFen",outside_area_hint:"Alle Ger\xE4te drau\xDFen auf einen Blick: im Garten, au\xDFerhalb der R\xE4ume, und was zu Au\xDFen geh\xF6rt (etwa die Wetterstation auf dem Dach).",device_outside:"Geh\xF6rt zu Au\xDFen",device_outside_hint:"Das Ger\xE4t z\xE4hlt nicht zum Raum darunter (eine Wetterstation auf dem Dach) und steht im Au\xDFen-Panel.",no_building:"Noch kein Grundriss vorhanden.",no_building_admin:"Noch kein Grundriss vorhanden. Im Editor zeichnest du deine erste Etage.",no_rooms_admin:"Die Etagen sind angelegt, aber es gibt noch keinen Raum. W\xE4nde allein reichen nicht: Zeichne im Editor mit \u201ERechteck\u201C oder \u201EFreie Form\u201C mindestens einen Raum.",open_editor:"Editor \xF6ffnen",loading:"L\xE4dt \u2026",load_error:"Laden fehlgeschlagen",saving:"Speichert \u2026",saved:"Gespeichert",save_error:"Speichern fehlgeschlagen",save_failed_detail:"Speichern fehlgeschlagen: {error}. Deine \xC4nderungen bleiben in diesem Browser erhalten.",needs_restart:"Eine neue Version von NextFloor ({frontend}) ist installiert, aber Home Assistant l\xE4uft noch mit {version}. Bitte Home Assistant neu starten \u2013 bis dahin kann das Speichern fehlschlagen.",needs_reload:"Diese Seite zeigt noch NextFloor {frontend}, Home Assistant hat schon {backend}. Bitte die Seite neu laden; in der Companion-App: Einstellungen \u2192 Companion-App \u2192 Frontend-Cache zur\xFCcksetzen.",reload_page:"Neu laden",symcon_variables_reload:"Variablen neu laden",symcon_cover_position:"Position (Behang)",climate_card:"Raumklima als schwebende Karte",climate_card_hint:"Zeigt Temperatur, Luftfeuchtigkeit und CO\u2082 \xFCber diesem Raum. In der 3D-Ansicht lassen sie sich \xFCber \u201EKarten\u201C ein- und ausblenden.",climate_card_missing:"Keine aktuellen Messwerte",furniture_power_card:"Leistung als 3D-Kachel",furniture_power_card_hint:"Zeigt den Leistungswert \xFCber diesem M\xF6belst\xFCck, auch ohne verkn\xFCpfte Schaltvariable. Die Kachel bleibt bei 0 W sichtbar. Bei archivierten Variablen \xF6ffnet das Trendsymbol den Verlauf. Der Schalter \u201EKarten\u201C blendet die schwebenden Kacheln gemeinsam ein und aus.",climate_illuminance:"Helligkeit",device_values:"Zus\xE4tzliche Werte",device_value:"Datenpunkt",device_value_add:"Wert hinzuf\xFCgen",device_value_remove:"Wert entfernen",device_value_icon:"Symbol",device_value_label:"Bezeichnung (optional)",device_values_hint:"\xDCber + weitere Datenpunkte ausw\xE4hlen, zum Beispiel mehrere Temperaturen oder andere Messwerte. Als Symbol eignen sich Emojis oder kurze Zeichen wie \u{1F321}, \u{1F4A7}, \u2601 oder \u26A1. Die Werte erscheinen am Ger\xE4t und im Raumfenster.",cover_tilt_entity:"Lamellenposition",cover_direction_invert:"Behang in 3D umkehren",cover_tilt_direction_invert:"Lamellen in 3D umkehren",cover2_direction_invert:"Zweiten Behang in 3D umkehren",cover2_tilt_direction_invert:"Lamellen des zweiten Behangs in 3D umkehren",cover_direction_hint:"Die Umkehrung betrifft nur die 3D-Darstellung. Zahlenwerte, Regler und Steuerbefehle bleiben unver\xE4ndert: Ein empfangener Wert von 0 wird weiterhin als 0 angezeigt und ein eingestellter Wert von 0 als 0 gesendet.",cover2_tilt_entity:"Lamellenposition (zweiter Behang)",symcon_variables_loading:"Variablen werden geladen \u2026",symcon_variables_loaded:"Variablen und Objektbaum wurden neu geladen.",symcon_variables_error:"Variablen konnten nicht neu geladen werden: {error}",needs_restart_old:"Eine neue Version von NextFloor ist installiert, aber Home Assistant l\xE4uft noch mit einer \xE4lteren. Bitte Home Assistant neu starten \u2013 bis dahin schl\xE4gt das Speichern fehl.",draft_found:"Nicht gespeicherte \xC4nderungen vom {time} gefunden.",draft_restore:"\xDCbernehmen und speichern",draft_discard:"Verwerfen",walls_auto:"W\xE4nde hoch",walls_cut:"Schnitt",walls_slope:"Schr\xE4g",walls_slope_hint:"W\xE4nde schr\xE4g abgeschnitten: vorne halbhoch, hinten voll \u2013 wie ein Puppenhaus, dreht mit der Kamera",walls_solid:"Massiv",walls_solid_hint:"Massive W\xE4nde in ihren Farben statt Glas (Farben: Editor \u2192 Einstellungen, pro Raum im Raum)",wall_paint_outside:"Wandfarbe au\xDFen",wall_paint_inside:"Wandfarbe innen",furn_color_body:"M\xF6belfarbe Korpus",furn_color_wood:"M\xF6belfarbe Holz",furn_color_fabric:"M\xF6belfarbe Stoff",furn_color_white:"M\xF6belfarbe Wei\xDF",furn_color_metal:"M\xF6belfarbe Metall",furn_color_dark:"M\xF6belfarbe Dunkel",furn_color_hint:"Die M\xF6bel sind aus wenigen Materialien gebaut, auch die aus dem M\xF6belbauer und den Paketen. Hier bekommt jedes Material eine Farbe f\xFCr das ganze Haus; eine Karte kann eigene Farben setzen. Am st\xE4rksten sieht man sie im Look Neon, Tag und Blaupause f\xE4rben sie nur leicht.",wall_paint_room:"Wandfarbe innen (dieser Raum)",wall_paint_floor:"Wandfarbe au\xDFen (diese Etage)",wall_paint_hint:"Gilt in der 3D-Ansicht \u201EMassiv\u201C.",wall_paint_default:"Standard",card_solid_walls:"Massive W\xE4nde (in ihren Farben)",reset_view:"\xDCbersicht",back:"Zur\xFCck",floor:"Etage",floors:"Etagen",add_floor:"Etage hinzuf\xFCgen",floor_from_ha:"Etagen aus Home Assistant:",floor_empty:"Leere Etage",level:"Ebene {n}",ha_floor:"Etage in Home Assistant",floor_layer:"Ebene (ein- und ausblendbar)",floor_power:"Etagen-Z\xE4hler (Leistung)",floor_power_hint:"Ein Leistungssensor nur f\xFCr diese Etage (ein Unterz\xE4hler, eine Wohnung). Sein Wert steht auf dem Etagen-Schild und in der Ansicht dieser Etage auf der Haus-Karte, mit seinem Anteil am Verbrauch des Hauses.",floor_power_share:"{n} % vom Haus",living_area:"Wohnfl\xE4che {living}",room_living:"Z\xE4hlt zur Wohnfl\xE4che",living_area_none:"Keine Wohnfl\xE4che \xB7 Grundfl\xE4che {floor}",living_area_low:"Wohnfl\xE4che {living} (Grundfl\xE4che {floor}, davon {low} unter 2 m H\xF6he)",living_area_hint:"Gerechnet wie die Wohnfl\xE4chenverordnung: die Fl\xE4che innerhalb der W\xE4nde, voll ab 2 m lichter H\xF6he, zur H\xE4lfte zwischen 1 und 2 m (unter Schr\xE4gen), unter 1 m gar nicht. Ein Richtwert, kein Aufma\xDF.",living_area_floor:"Wohnfl\xE4che: {floor}",living_area_floor_house:"Wohnfl\xE4che dieser Etage: {floor} \xB7 ganzes Haus: {house}",print_plan:"Plan drucken / PDF",print_plan_hint:"Jede Etage als sauberer Plan mit Ma\xDFen und Fl\xE4chen, dazu eine Fl\xE4chentabelle \u2013 zum Drucken oder im Druckdialog als PDF speichern.",print_title:"Grundriss",print_room:"Raum",print_floor_area:"Grundfl\xE4che",print_living:"Wohnfl\xE4che",print_low:"unter 2 m",print_total:"Summe",print_blocked:"Das Druckfenster wurde blockiert \u2013 bitte Pop-ups f\xFCr Home Assistant erlauben.",check_open:"Plan pr\xFCfen",note:"Notiz",note_add:"Notiz hier",note_text:"Text",note_placeholder:"z. B. \u201EFilter wechseln\u201C oder \u201ESicherung 12\u201C",note_due:"F\xE4llig am",note_height:"H\xF6he \xFCber dem Boden (m)",note_height_hint:"Wo der Pin in der 3D-Ansicht schwebt: 1,3 m ist Augenh\xF6he, mehr f\xFCr etwas unter der Decke (ein Absperrventil, eine Klappe).",note_photo_upload:"Foto hinzuf\xFCgen",note_photo_hint:"Das Foto erscheint, wenn man die Notiz in der 3D-Ansicht antippt, z. B. wie das Ventil aussieht.",note_due_hint:"Ab diesem Tag wird der Pin orange.",note_is_due:"Diese Notiz ist f\xE4llig.",keys_title:"Tasten im Editor",keys_undo:"R\xFCckg\xE4ngig",keys_redo:"Wiederholen",keys_duplicate:"Raum verdoppeln",keys_delete:"Auswahl l\xF6schen",keys_nudge:"Auswahl um einen Rasterschritt verschieben",keys_nudge_10:"\u2026 um 10 cm",keys_nudge_1:"\u2026 um 1 cm",keys_rotate:"M\xF6bel um 90\xB0 drehen (Shift: zur\xFCck)",keys_lock:"M\xF6bel, Ger\xE4t oder Dachteil festsetzen / l\xF6sen",keys_close_shape:"Freie Form schlie\xDFen",keys_escape:"Abbrechen, Werkzeug verlassen, Auswahl aufheben",keys_straight:"Beim Zeichnen: gerade Linien",keys_sheet:"Diese \xDCbersicht",tour_title:"Erste Schritte",tour_1_title:"R\xE4ume zeichnen",tour_1:"Mit \u201E{rect}\u201C oder \u201E{free}\u201C zeichnest du die R\xE4ume; die W\xE4nde entstehen von selbst. Ordne jedem Raum seinen Home-Assistant-Bereich zu \u2013 dann findet NextFloor seine Ger\xE4te. Hast du schon Bereiche, legt \u201E{rooms}\u201C im Etagenformular sie auf einmal an.",tour_2_title:"T\xFCren und Fenster",tour_2:"\u201E{opening}\u201C setzt sie auf eine Wand. Verkn\xFCpfe ihren Kontakt oder Rollladen \u2013 in 3D gehen sie dann mit auf und zu, und offene Fenster melden sich.",tour_3_title:"M\xF6bel und Ger\xE4te",tour_3:"\u201E{furniture}\u201C \xF6ffnet die Bibliothek \u2013 oder baue eigene St\xFCcke in der \u{1F6E0}\uFE0F M\xF6bel-Werkstatt. W\xE4hlst du einen Raum, stehen darunter die Ger\xE4te seines Bereichs zum Platzieren bereit; Lampen leuchten dann in der Farbe ihres Lichts.",tour_4_title:"Ansehen und pr\xFCfen",tour_4:"\u201E{split}\u201C zeigt dein Haus beim Zeichnen; oben wechselst du in die 3D-Ansicht. \u201E{check}\u201C listet, was noch fehlt \u2013 und mit ? siehst du jederzeit die Tasten.",tour_next:"Weiter",tour_back:"Zur\xFCck",tour_done:"Los geht's",tour_skip:"\xDCberspringen",check_open_hint:"Listet, was im Plan fehlt oder schief ist, mit einer L\xF6sung per Tipp.",check_title:"Plan-Pr\xFCfung",check_all_good:"Alles in Ordnung \u2013 nichts gefunden.",check_hint:"{n} Punkte gefunden. Blaue Kn\xF6pfe \xE4ndern den Plan (R\xFCckg\xE4ngig geht wie immer), die anderen zeigen die Stelle.",check_room_no_area:"\u201E{room}\u201C hat keinen Home-Assistant-Bereich: seine Ger\xE4te werden nicht gefunden.",check_room_no_area_named:"\u201E{room}\u201C hat keinen Bereich \u2013 der freie Bereich \u201E{area}\u201C hei\xDFt genauso.",check_areas_unplaced:"{n} Bereiche dieser Etage haben noch keinen Raum: {names}",check_devices_unplaced:"\u201E{room}\u201C: {n} Ger\xE4te des Bereichs stehen noch nicht im Plan.",check_rooms_overlap:"\u201E{a}\u201C und \u201E{b}\u201C liegen \xFCbereinander.",check_opening_off_wall:"Eine T\xFCr oder ein Fenster in \u201E{room}\u201C sitzt auf keiner Wand.",check_entity_missing:"{n} Ger\xE4te-Pins zeigen auf Entit\xE4ten, die Home Assistant nicht mehr kennt ({ids}).",check_furniture_entity_missing:"Ein M\xF6bel ist mit {id} verkn\xFCpft \u2013 die Entit\xE4t gibt es nicht mehr.",check_battery_low:"Batterie schwach: {name} ({level} %)",battery_low_n:"Batterie schwach: {names}",check_standby:"{name} zieht {w} W, obwohl aus \u2013 etwa {cost} im Jahr.",check_fix_show:"Zeigen",check_fix_ignore:"Ignorieren",check_show_devices:"{n} Ger\xE4te ansehen",check_ignore_all:"Alle {n} ignorieren",check_reset_ignored:"{n} ignorierte Ger\xE4te wieder pr\xFCfen",check_fix_set_area:"\u201E{area}\u201C zuordnen",check_fix_add_rooms:"R\xE4ume anlegen",check_fix_place:"{n} setzen",check_fix_remove:"{n} entfernen",floor_layer_hint:"Diese Etage ist kein Geschoss, sondern eine Ebene \u2013 z. B. alle B\xE4ume oder die Deko. Die 3D-Ansicht zeigt oben ein Auge, mit dem du sie auf jedem Ger\xE4t ein- und ausblendest.",no_ha_floor:"\u2013 keine \u2013",area_rooms:"R\xE4ume aus HA-Bereichen anlegen ({n})",area_rooms_hint:"Legt f\xFCr jeden Bereich dieser Etage einen Raum an (4 \xD7 3 m) \u2013 danach an die richtige Stelle ziehen und die Ecken anpassen",floor_name:"Name",elevation:"H\xF6he \xFCber Boden (m)",floor_shift:"Etage verschieben (m)",floor_shift_apply:"Verschieben",floor_shift_hint:"Verschiebt alle R\xE4ume, M\xF6bel, Ger\xE4te, Au\xDFenfl\xE4chen, freien W\xE4nde und das Hintergrundbild dieser Etage um X und Z. Dachfl\xE4chen bleiben liegen.",height:"Raumh\xF6he (m)",cut_height:"Schnitth\xF6he (m)",delete_floor:"Etage l\xF6schen",floor_copy:"Etage duplizieren",floor_copy_hint:"Die Kopie kommt oben aufs Haus, mit allen R\xE4umen, W\xE4nden, T\xFCren und Fenstern. R\xE4ume und Etage verlieren ihre Verkn\xFCpfung mit Home Assistant, M\xF6bel ihre Entit\xE4ten; Energieger\xE4te bleiben auf der alten Etage.",floor_copy_furniture:"M\xF6bel mitnehmen",floor_copy_devices:"Ger\xE4te-Pins mitnehmen",floor_copy_devices_hint:"Dieselbe Entit\xE4t steht dann auf beiden Etagen.",floor_copy_outdoor:"Au\xDFenfl\xE4chen mitnehmen",floor_copy_make:"Kopie anlegen",floor_copy_name:"{name} (Kopie)",furn_to_floor:"Auf Etage verschieben",furn_to_floor_hint:"Das M\xF6bel wandert an dieselbe Stelle auf der gew\xE4hlten Etage.",delete_floor_confirm:"Etage \u201E{name}\u201C mit allen R\xE4umen l\xF6schen?",move_up:"Nach oben",move_down:"Nach unten",default_floor:"Erdgeschoss",new_floor:"Etage {n}",tool_select:"Ausw\xE4hlen",tool_rect:"Rechteck",tool_polygon:"Freie Form",undo:"R\xFCckg\xE4ngig",redo:"Wiederholen",fit:"Alles zeigen",room:"Raum",rooms:"R\xE4ume",room_name:"Name",area:"Bereich",no_area:"Kein Bereich",sub_area_add:"+ Bereich im Raum",sub_area_hint:"Ein Teil des Raums mit eigenem Home-Assistant-Bereich, aber ohne eigene W\xE4nde \u2013 eine Leseecke, ein Regal, eine K\xFCchenzeile im Wohnraum. Seine Ger\xE4te und Sensoren geh\xF6ren zu diesem Raum.",material:"Boden",x:"X (m)",z:"Y (m)",width:"Breite (m)",depth:"Tiefe (m)",points:"Eckpunkte",delete_point:"Punkt l\xF6schen",duplicate:"Duplizieren",delete:"L\xF6schen",new_room:"Raum {n}",settings:"Einstellungen",pendant_shape:"Form",pendant_shade:"Schirm",paint_colour:"Lackfarbe",pendant_globe:"Kugel",pendant_cone:"Kegel",pendant_drum:"Trommel",sofa_shape:"Form",sofa_straight:"Gerade",sofa_l:"L-Form (Spiegeln: andere Seite)",sofa_u:"U-Form",pkg_open:"Einrichten \u2026",pkg_hint:"Die M\xF6bel kommen an die W\xE4nde des Raums; Leuchten verbinden sich mit den Lichtern des Bereichs. Danach einzeln anpassen \u2013 Strg+Z nimmt alles zur\xFCck.",pkg_done:"{n} M\xF6bel gesetzt \u2013 Strg+Z nimmt es zur\xFCck.",pkg_kitchen_row:"K\xFCchenzeile",pkg_kitchen_row_desc:"Zeile an der R\xFCckwand mit K\xFChlschrank, Backofen, Sp\xFCle, Sp\xFClmaschine und Herd, Oberschrank, Esstisch mit Pendelleuchte",pkg_kitchen_l:"K\xFCche in L-Form",pkg_kitchen_l_desc:"Zeile hinten und links, Kochinsel mit Barhockern",pkg_bath:"Bad",pkg_bath_desc:"Waschtisch, WC, Badewanne, Waschmaschine, Einbauspot",pkg_bedroom:"Schlafzimmer",pkg_bedroom_desc:"Doppelbett mit zwei Nachttischen, Schrank, Kommode, Deckenleuchte",pkg_living:"Wohnzimmer",pkg_living_desc:"TV-Board, Sofa, Couchtisch, Teppich, Sessel, Regal, Stehlampe, Pflanze",pkg_dining:"Esszimmer",pkg_dining_desc:"Esstisch mit vier St\xFChlen, Sideboard, Pendelleuchte",pkg_office:"B\xFCro",pkg_office_desc:"Schreibtisch mit B\xFCrostuhl, zwei Regale, Deckenleuchte",pkg_kids:"Kinderzimmer",pkg_kids_desc:"Einzelbett, Schreibtisch, Regal, Teppich",pkg_hall:"Flur",pkg_hall_desc:"Garderobe, zwei Einbauspots",spots_place:"Spots setzen",spots_type:"Leuchte",spots_cols:"Spalten (links\u2013rechts)",spots_rows:"Reihen (vorne\u2013hinten)",spots_add:"{n} Leuchten setzen",spots_placed:"{n} Leuchten gesetzt.",spots_hint:"Alle Leuchten folgen dem gew\xE4hlten Licht (z. B. Spots an einem Dimmer). Einzeln verschieben und ein anderes Licht w\xE4hlen geht danach wie bei jedem M\xF6bel.",cancel:"Abbrechen",backup:"Sicherung",backup_history:"Wiederherstellungspunkte",share_view:"Ansicht teilen",share_view_hint:"Speichert das Haus als kleine Datei, die in jedem Browser ohne Home Assistant aufgeht (\xFCber die Online-Demo von NextFloor) \u2013 zum Zeigen f\xFCr Familie oder Planer. Ohne Ger\xE4te und Entit\xE4ten, wie eine Vorlage.",share_view_title:"Unser Haus in NextFloor",share_view_needs_js:"Diese Seite braucht JavaScript und eine Internetverbindung.",share_view_file:"ansicht",share_view_done:"Ansicht gespeichert \u2013 die Datei im Browser \xF6ffnen oder weitergeben.",version_save:"Stand speichern \u2026",version_save_hint:"H\xE4lt den Plan unter einem Namen fest (\u201Evor dem Umbau\u201C). Benannte St\xE4nde bleiben, wenn die automatischen Wiederherstellungspunkte gehen.",version_name_prompt:"Name f\xFCr diesen Stand (z. B. \u201Evor dem Umbau\u201C):",version_saved:"Stand \u201E{name}\u201C gespeichert.",version_compare:"Vergleichen",version_delete_confirm:"\u201E{name}\u201C l\xF6schen?",version_same:"Kein Unterschied zum Plan.",version_diff_n:"{n} Unterschiede zum Plan, wie er jetzt ist:",diff_floor_added:"Etage \u201E{name}\u201C neu",diff_floor_removed:"Etage \u201E{name}\u201C entfernt",diff_room_added:"Raum \u201E{name}\u201C neu",diff_room_removed:"Raum \u201E{name}\u201C entfernt",diff_room_renamed:"\u201E{detail}\u201C hei\xDFt jetzt \u201E{name}\u201C",diff_room_reshaped:"\u201E{name}\u201C umgeformt ({detail} m\xB2)",diff_opening_added:"{name} neu ({detail})",diff_opening_removed:"{name} entfernt ({detail})",diff_furniture_added:"{name} neu",diff_furniture_removed:"{name} entfernt",diff_furniture_moved:"{name} verschoben oder ge\xE4ndert",diff_device_added:"Ger\xE4t {name} gesetzt",diff_device_removed:"Ger\xE4t {name} entfernt",diff_device_moved:"Ger\xE4t {name} verschoben",backup_none:"Noch keine. Beim Bearbeiten entsteht h\xF6chstens alle 10 Minuten ein Punkt.",backup_summary:"{rooms} R\xE4ume, {furniture} M\xF6bel",backup_restore:"Wiederherstellen",backup_restore_confirm:"Den Stand vom {time} wiederherstellen? Der jetzige Stand bleibt als Wiederherstellungspunkt erhalten.",backup_restored:"Wiederhergestellt.",backup_file:"Datei",backup_export:"Exportieren",backup_export_share:"Als Vorlage teilen",backup_export_share_hint:"Ohne Bereiche, Ger\xE4te, Sensoren und Bilder \u2013 zum Weitergeben an andere.",backup_import:"Importieren \u2026",backup_import_confirm:"Den ganzen Grundriss durch die Datei ersetzen? Der jetzige Stand bleibt als Wiederherstellungspunkt erhalten.",backup_import_error:"Die Datei ist kein NextFloor-Plan ({error}).",backup_imported:"Importiert.",backup_hint:"Hintergrundbilder sind nicht in der Datei enthalten.",backup_full:"Komplett-Backup",backup_full_export:"Alles sichern (Plan, Bilder, Packs)",backup_full_import:"Komplett-Backup wiederherstellen \u2026",backup_full_hint:"Eine Datei mit dem Plan, allen Hintergrund- und Bildschirmbildern und den installierten Packs. Beim Wiederherstellen wird jedes Pack erneut gepr\xFCft; der Lizenzschl\xFCssel ist nicht enthalten.",backup_full_confirm:"Plan, Bilder und Packs durch das Backup ersetzen? Der aktuelle Stand bleibt als Wiederherstellungspunkt erhalten.",backup_full_not_backup:"Das ist kein Komplett-Backup von NextFloor.",backup_full_restored:"Backup wiederhergestellt: {packs} Packs, {pictures} Bilder.",backup_full_skipped:"\xDCbersprungen (nicht lesbar): {packs}.",export_name_full:"komplett",device_confirm:"Vor dem Schalten nachfragen",device_confirm_hint:"Beim Antippen in 3D, im Schnellmen\xFC und im Raumfenster erscheint erst eine R\xFCckfrage. Doppeltipp auf den Raum l\xE4sst dieses Ger\xE4t aus.",cover_confirm_hint:"Auf, Zu und Positionen fragen im Schnellmen\xFC und im Raumfenster erst nach, und Wischen \xFCber das Symbol bewegt den Rollladen nicht mehr (es dreht dann die Ansicht). Stopp fragt nie.",blind_kind:"Art des Behangs",blind_roller:"Rollladen au\xDFen",blind_venetian:"Raffstore mit Lamellen",blind_inside:"Rollo innen",cover2_entity:"Zweiter Rollladen (rechte H\xE4lfte)",cover_my:"Lieblingsposition \u201EMy\u201C (%, 0 = keine)",cover_my_go:"Zur Lieblingsposition ({p} %)",blind_hint:"Ein Raffstore dreht seine Lamellen in 3D mit der Lamellenstellung des Rollladens; ein Rollo innen h\xE4ngt hinter dem Glas. Ein breites Fenster kann f\xFCr seine rechte H\xE4lfte einen zweiten Rollladen haben. Die Lieblingsposition erscheint als \u201EMy\u201C im Schnellmen\xFC: ein Rollladen mit Positionen f\xE4hrt dorthin, ein Somfy-RTS-Motor ohne R\xFCckmeldung f\xE4hrt mit Stopp in seine eigene My-Stellung.",confirm_switch:"{name} wirklich schalten?",lock_confirm_unlock:"{name} wirklich aufschlie\xDFen?",gang_switch_one:"Schaltet",furn_cover_entity:"Bewegt sich mit",furn_cover_hint:"Vorhang, Leinwand, Markise oder Tor folgen dieser Cover-Entit\xE4t (Rollladen, Vorhang, Markise, Tor) und fahren mit ihr. Ein Tipp \xF6ffnet ihr Men\xFC (auf, Stopp, zu).",furn_cover_inverted:"Laufrichtung umkehren",furn_cover_inverted_hint:"F\xFCr eine Markise oder einen Vorhang, die im Plan genau andersherum fahren als in Wirklichkeit: ausgefahren zeigt dann eingefahren und umgekehrt.",gang_switch:"Taste {n} schaltet",gang_socket_one:"Steckdose an",gang_socket:"Steckdose {n} an",gang_switch_hint:"Eine Taste leuchtet, solange ihr Licht an ist (in seiner Farbe). Ein Tipp schaltet; bei mehreren Tasten fragt ein kleines Men\xFC, welche. Dieselbe Entit\xE4t darf an mehreren Schaltern sitzen.",gang_socket_hint:"Eine Steckdose leuchtet gr\xFCn, solange ihr Schalter an ist \u2013 heller, je mehr sie zieht. Ein Tipp schaltet; bei mehreren fragt ein kleines Men\xFC, welche.",lock_confirm_lock:"{name} abschlie\xDFen?",opening_lock:"Smart Lock",opening_lock_hint:"Ein Tipp auf die T\xFCr schlie\xDFt ab oder auf (immer mit R\xFCckfrage). Solange sie aufgeschlossen ist, leuchtet ihre Kante.",split_handle_hint:"Ziehen: Breite von Plan und 3D-Ansicht",wall_exterior:"Au\xDFenwand (m)",wall_interior:"Innenwand (m)",grid:"Raster (m)",units:"Ma\xDFe anzeigen in",units_metric:"Meter",units_imperial:"Fu\xDF und Zoll",units_hint:"Wie L\xE4ngen und Fl\xE4chen im Plan, in den Formularen und in der Wandansicht stehen. Eingaben bleiben in Metern.",background:"Vorlage (Grundriss-Bild)",background_upload:"Bild w\xE4hlen \u2026",background_width:"Breite im Plan (m)",background_opacity:"Deckkraft",background_rotation:"Drehung (\xB0)",background_edit:"Verschieben, skalieren und drehen",background_edit_done:"Fertig",background_edit_hint:"Solange der Modus an ist: Bild ziehen verschiebt es, der Griff unten rechts zieht es gr\xF6\xDFer oder kleiner. Erst das Bild an den Ma\xDFstab anpassen, dann drehen.",background_remove:"Vorlage entfernen",hint_select:"Raum antippen zum Ausw\xE4hlen \xB7 Ecken ziehen \xB7 \u201E+\u201C auf einer Kante f\xFCgt einen Punkt ein \xB7 Pfeiltasten verschieben \xB7 Entf l\xF6scht \xB7 Strg+Z",hint_rect:"Ziehen, um ein Rechteck zu zeichnen",hint_polygon:"Punkte setzen \xB7 auf den ersten Punkt tippen oder Enter schlie\xDFt \xB7 Esc bricht ab",hint_empty:"Lege zuerst eine Etage an.",area_m2:"{a} m\xB2",overlap_warning:"R\xE4ume \xFCberlappen sich \u2013 die W\xE4nde dort sind unvollst\xE4ndig.",read_only:"Nur Administratoren k\xF6nnen den Grundriss bearbeiten.",side_failed:"Dieses Formular lie\xDF sich nicht anzeigen ({error}). Der Grundriss bleibt bedienbar. Bitte melde den Text in einem GitHub-Issue.",mat_wood:"Holz",mat_oak:"Eiche",mat_tiles:"Fliesen",mat_carpet:"Teppich",mat_stone:"Stein",mat_concrete:"Beton",card_name:"NextFloor",card_description:"Deine Wohnung in 3D (Neon).",stats:"{calls} Draw-Calls \xB7 {tris} Dreiecke",stats_fps:"{fps} B/s (langsamstes Bild {ms} ms)",stats_idle:"Ruhe (0 B/s)",stats_busy_floors:"Etagen",stats_busy_openings:"T\xFCren/Fenster",stats_busy_flash:"Blitz",stats_busy_roof:"Dach",stats_busy_flow:"Stromfluss",stats_busy_effect:"Farbeffekt",stats_busy_robot:"Roboter",stats_busy_orbit:"Kamerafahrt",stats_busy_tint:"Raumfarbe",stats_low:"Stufe Tablet, Pixeldichte {r}",stats_full:"volle Stufe, Pixeldichte {r}",floors_apart:"Auseinander",floors_stacked:"Gestapelt",roof_keep:"Dach bleibt",roof_keep_hint:"Das Dach bleibt beim Heranzoomen auf dem Haus, statt sich zu heben und auszublenden",floor_rooms_one:"1 Raum",floor_rooms:"{n} R\xE4ume",quality:"Qualit\xE4t",quality_auto:"Auto",quality_low:"Tablet",quality_high:"Hoch",state_on:"An",state_off:"Aus",state_open:"Offen",state_closed:"Zu",state_opening:"\xD6ffnet",state_closing:"Schlie\xDFt",state_playing:"Spielt",state_paused:"Pause",state_idle:"Bereit",state_locked:"Verriegelt",state_unlocked:"Entriegelt",state_detected:"Erkannt",state_clear:"Frei",state_unavailable:"Nicht verf\xFCgbar",state_heat:"Heizen",state_cool:"K\xFChlen",state_auto:"Automatik",state_heat_cool:"Heizen/K\xFChlen",state_dry:"Entfeuchten",state_fan_only:"L\xFCften",devices:"Ger\xE4te",devices_none_area:"Verkn\xFCpfe den Raum mit einem Bereich, dann erscheinen dessen Ger\xE4te hier.",devices_none:"Im Bereich gibt es keine passenden Ger\xE4te.",devices_place_all_n:"Alle {n} platzieren \u2026",devices_place_all_confirm:"{n} Ger\xE4te auf einmal in den Raum setzen? (Strg+Z bzw. \u201ER\xFCckg\xE4ngig\u201C nimmt alle in einem Schritt zur\xFCck.)",devices_src_area:"Dieser Bereich",devices_src_other:"Andere Bereiche",devices_src_none:"Ohne Bereich",panel_hide:"Im Raumfenster ausblenden",panel_unhide:"Im Raumfenster wieder zeigen",panel_state_hide:"Zustand im Raumfenster ausblenden (z. B. ein Rollladen, der nur \u201Eunbekannt\u201C meldet)",panel_state_show:"Zustand im Raumfenster wieder zeigen",devices_place:"Platzieren",devices_remove:"Entfernen",devices_hint:"Platzierte Ger\xE4te erscheinen in 3D. Im Plan lassen sie sich verschieben.",panel_lights:"Licht",panel_covers:"Rolll\xE4den",panel_climate:"Heizung",panel_media:"Medien",panel_switches:"Schalter",panel_sensors:"Sensoren",panel_scenes:"Szenen & Skripte",panel_announce:"\u{1F4E2} Durchsage",announce_placeholder:"Eigene Nachricht \u2026",announce_send:"Sagen",announce_sent:"Gesagt: \u201E{message}\u201C",announce_failed:"Durchsage fehlgeschlagen: {error}",announce_phrase_1:"Essen ist fertig!",announce_phrase_2:"Zeit f\xFCrs Bett!",announce_phrase_3:"Bitte runterkommen!",announce_phrase_4:"Wir fahren gleich los!",announce_phrase_5:"Der Hund muss raus!",state_recording:"Nimmt auf",state_streaming:"Streamt",panel_all_off:"Alle aus",readable:"Gut lesbar",readable_hint:"Kr\xE4ftigere Kontraste und gr\xF6\xDFere Schrift \u2013 f\xFCr Wandtablets und alle, die so besser lesen.",plain:"Nur Grundriss",plain_hint:"Zeigt nur W\xE4nde, T\xFCren, Fenster und Treppen, ohne M\xF6bel. Ger\xE4te und ihre Pins bleiben.",right_back:"Rechtsklick = zur\xFCck",right_back_hint:"Ein kurzer Rechtsklick in der 3D-Ansicht geht einen Schritt zur\xFCck: vom Raum zur Etage, von der Etage zum Haus (wie ein Doppeltipp auf leere Fl\xE4che). Ziehen mit der rechten Taste verschiebt weiter die Ansicht.",stl:"3D-Druck (STL)",stl_hint:"Speichert das Haus als STL-Datei (W\xE4nde, B\xF6den, M\xF6bel und Au\xDFenfl\xE4chen aller Etagen) zum 3D-Drucken, im Ma\xDFstab 1:100 (ein Meter wird zu 10 mm). Fenster, Licht und Dach fehlen; ein Slicer repariert die Datei bei Bedarf.",card_plain:"Nur Grundriss",card_rooms:"Nur diese R\xE4ume",card_rooms_hint:"Die Karte zeigt nur die angehakten R\xE4ume mit ihren M\xF6beln, Ger\xE4ten, T\xFCren und Fenstern (zum Beispiel f\xFCr ein Tablet in der K\xFCche). Nichts angehakt: der ganze Plan.",card_templates:"Kartenvorlagen",card_templates_hint:"Eine Dashboard-Karte einmal hier einrichten (mit den Einstellungen der Karte) und auf jedem Tablet nur noch den Namen angeben: `template: k\xFCche_tablet`. \xC4nderungen hier erreichen alle Karten mit dieser Vorlage; was auf der Karte selbst steht, gilt vor der Vorlage.",template_name:"Neue Vorlage (Name)",template_add:"Vorlage anlegen",template_reload:"Bildschirme mit dieser Vorlage neu laden",template_reload_all:"Alle Bildschirme neu laden",template_use:"Auf der Dashboard-Karte: `template: {name}`",card_template:"Kartenvorlage",card_template_none:"keine (nur diese Karte)",card_readable:"Gut lesbar",all_off_n:"Alles aus ({n})",all_off_hint:"Schaltet Lichter, Schalter, Ventilatoren und Medien des Raums aus; zehn Sekunden lang l\xE4sst es sich r\xFCckg\xE4ngig machen.",all_off_done:"Alles aus.",all_off_undo:"R\xFCckg\xE4ngig",all_off_floor:"Alles aus im {floor} ({n} Ger\xE4te), zehn Sekunden lang r\xFCckg\xE4ngig zu machen",mood_save:"Stimmung speichern",mood_save_hint:"Speichert, wie die Lampen des Raums gerade leuchten, als Stimmung \u2013 ein Tipp darauf stellt sie sp\xE4ter wieder her, \u201E\u2192\u201C \xFCbertr\xE4gt sie auf einen anderen Raum.",mood_new:"Stimmung",mood_set:"Stimmung einstellen",mood_carry:"Auf einen anderen Raum \xFCbertragen",panel_all_on:"Alle an",view_options:"Ansicht: Qualit\xE4t, Look, Symbole, FPS",panel_all_open:"Alle auf",panel_all_close:"Alle zu",central:"Zentral: alle Lichter, Rolll\xE4den und Favoriten",central_house:"Ganzes Haus",central_lights:"Lichter",central_covers:"Rolll\xE4den",central_on:"An",central_off:"Aus",central_open:"Auf",central_close:"Zu",central_sure:"Sicher?",central_favorites:"Favoriten",central_no_favorites:"Noch keine Favoriten. Im Editor unter \u201EFavoriten\u201C legst du Szenen, Skripte und Schalter fest.",card_central:"Stern mit Zentral-Men\xFC",card_central_hint:"Alle Lichter und Rolll\xE4den der Etage oder des Hauses und die Favoriten aus dem Editor.",favorites:"Favoriten",favorites_hint:"Szenen, Skripte, Automationen, Tasten und Schalter f\xFCr das Zentral-Men\xFC (Stern) der 3D-Ansicht \u2013 Party, Anwesenheitssimulation, Verschattung, Bew\xE4sserung.",favorites_add:"Favorit hinzuf\xFCgen",favorite_floor:"Auf welcher Etage dieser Favorit erscheint",favorite_all_floors:"Alle Etagen",outside_hidden:"Drau\xDFen: Ger\xE4te ausblenden",outside_hidden_hint:"Ger\xE4te, die das Fenster \u201EDrau\xDFen\u201C nicht zeigen soll (sie bleiben im Plan).",outside_hidden_add:"Ger\xE4t ausblenden",outside_view_hint:"Ansicht f\xFCr \u201EDrau\xDFen\u201C: Dreh die 3D-Vorschau auf den Garten und \xFCbernimm sie. Beim \xD6ffnen von \u201EDrau\xDFen\u201C fliegt die Kamera dorthin.",outside_view_set:"Diese Ansicht f\xFCr Drau\xDFen",outside_view_reset:"Ansicht f\xFCr Drau\xDFen zur\xFCcksetzen",room_facts:"Raumfenster: angezeigte Angaben",room_fact_sun:"Sonnenstunden",room_fact_comfort:"Komfort",room_fact_air:"L\xFCftungshinweis",room_fact_circuits:"Stromkreise",background_handles_hint:"Das Bild hat jetzt Griffe wie ein M\xF6bel: ziehen verschiebt es, die Ecke unten rechts skaliert, der runde Griff oben dreht (mit Umschalt in 15\xB0-Schritten). Passt es, \u201EFertig\u201C tippen \u2013 dann liegt es fest.",background_fixed_hint:"Das Bild liegt fest, du kannst dar\xFCber zeichnen. Zum Anpassen \u201EVerschieben, skalieren und drehen\u201C tippen.",bg_level:"Gerade ausrichten",bg_level_cancel:"Ausrichten abbrechen",bg_level_first:"Tippe auf den Anfang einer Wand im Bild, die gerade (waagerecht oder senkrecht) sein soll.",bg_level_second:"Jetzt auf das Ende dieser Wand tippen \u2013 das Bild dreht sich passend.",bg_ruler:"Ma\xDFstab mit Lineal",bg_ruler_cancel:"Lineal abbrechen",bg_ruler_first:"Tippe im Bild auf den Anfang einer Strecke, deren L\xE4nge du kennst \u2013 etwa eine bema\xDFte Wand.",bg_ruler_second:"Jetzt auf das Ende der Strecke tippen.",bg_ruler_length_hint:"Im Plan gemessen: {m} m. Gib die echte L\xE4nge ein, das Bild wird passend skaliert.",bg_ruler_length:"Echte L\xE4nge (m)",bg_ruler_apply:"Ma\xDFstab \xFCbernehmen",thumbs_fold:"Etagenbilder zu Kn\xF6pfen einklappen",thumbs_show:"Etagenbilder wieder zeigen",room_start_view:"Ansicht als Start des Raums",room_start_view_hint:"Tippst du den Raum in 3D an, fliegt die Kamera genau so hin, wie die 3D-Ansicht rechts gerade steht \u2013 Blickwinkel, Zoom und Bildausschnitt. Erst 3D daneben einschalten, den Raum drehen und heranzoomen, dann tippen.",room_start_view_reset:"Startansicht des Raums entfernen (wieder von oben)",room_start_view_need_pane:"Schalte zuerst \u201E3D daneben\u201C ein und dreh und zoom den Raum so, wie er sich \xF6ffnen soll.",floor_start_view:"Ansicht als Start der Etage",floor_start_view_hint:"Diese Etage \xF6ffnet sich in 3D so, wie die 3D-Ansicht rechts gerade steht \u2013 etwa das Erdgeschoss von vorn und das Obergeschoss von hinten. Erst 3D daneben einschalten, drehen, dann tippen.",floor_start_view_reset:"Startansicht der Etage entfernen (wieder wie das Haus)",floor_start_view_need_pane:"Schalte zuerst \u201E3D daneben\u201C ein und dreh die Etage so, wie sie sich \xF6ffnen soll.",ambilight:"Leuchten hinter dem Fernseher (%)",ambilight_hint:"Wie kr\xE4ftig es hinter dem Fernseher leuchtet, solange er l\xE4uft. 0 schaltet es aus (zum Beispiel wenn du LED-Streifen am Fernseher hast), 100 ist die Standardst\xE4rke.",sound_rings:"Klangringe (%)",sound_rings_hint:"Wie gro\xDF die Ringe um den Lautsprecher werden, solange er spielt. 0 schaltet sie aus, Bild und Leuchten bleiben; 100 ist die Standardgr\xF6\xDFe. Die Gr\xF6\xDFe folgt au\xDFerdem der Lautst\xE4rke des Lautsprechers: leiser hei\xDFt kleiner.",glow_scale:"Leuchtst\xE4rke in 3D (%)",light_effects:"Effektanimationen in 3D",light_effects_hint:"Nur exakte HA-Effektnamen zuordnen. Ohne Zuordnung bleibt die HA-Farbe statisch. \xC4ndert nichts in Home Assistant.",light_effects_enabled:"Animationen f\xFCr diese Leuchte erlauben",light_effect_unmapped:"Nicht zugeordnet (statisch)",light_effect_add:"Exakten Effektnamen hinzuf\xFCgen",light_effect_name_limit:"Der exakte Effektname muss 1 bis 255 Zeichen lang sein. Er wird nicht gek\xFCrzt.",light_effect_count_limit:"Maximal 100 Zuordnungen. Entferne zuerst einen vorhandenen Eintrag.",light_effect_exists:"Dieser Effektname ist bereits zugeordnet. Die vorhandene Zuordnung bleibt erhalten.",light_animation_none:"Statisch",light_animation_rainbow:"Regenbogen (ersetzt Farbe)",light_animation_pulse:"Pulsieren (Intensit\xE4t)",light_animation_flicker:"Flackern (Intensit\xE4t)",glow_scale_hint:"Wie kr\xE4ftig die Leuchte in 3D leuchtet: unter 100 % d\xE4mpft helle LED-Streifen, damit der Raum nicht \xFCberstrahlt; \xFCber 100 % l\xE4sst eine schwache Lampe st\xE4rker leuchten. Schaltet nichts in Home Assistant.",vehicle_to_spot:"In Stellplatz umwandeln",vehicle_to_spot_hint:"Ein Fahrzeug als einfaches M\xF6bel steht immer da. Als Stellplatz erscheint es nur, wenn ein Sensor das Auto meldet, und dort verkn\xFCpfst du auch das Auto-Ger\xE4t (Ladestand, Reichweite, Schloss, Klima).",as_furniture:"Als M\xF6bel darstellen",as_furniture_hint:"Ersetzt den Pin durch ein M\xF6bel an derselben Stelle, das mit diesem Ger\xE4t verkn\xFCpft ist \u2013 etwa ein Lautsprecher f\xFCr einen Media Player oder eine Leuchte f\xFCr ein Licht. Strg+Z nimmt es zur\xFCck.",as_furniture_pick:"M\xF6bel w\xE4hlen \u2026",as_device:"Wieder als Ger\xE4te-Pin",as_device_hint:"Ersetzt das M\xF6bel durch den einfachen Pin seines Ger\xE4ts an derselben Stelle.",presets:"Sender und Playlists (Klang)",presets_hint:"Erscheinen im Schnellmen\xFC jedes Lautsprechers unter \u201EAbspielen\u201C, neben den Quellen des Players. F\xFCr einen Echo (Alexa Media Player): Art SPOTIFY, AMAZON_MUSIC oder TUNEIN und als Inhalt, was du sagen w\xFCrdest (\u201ERock Antenne\u201C). F\xFCr Sonos, Music Assistant und andere: Art music oder url mit einer Stream-Adresse oder einer URI.",preset_type:"Art",preset_type_hint:"media_content_type von play_media, z. B. music, url, playlist, SPOTIFY, AMAZON_MUSIC, TUNEIN",preset_content:"Inhalt",preset_content_hint:"media_content_id: Stream-URL, URI (spotify:playlist:\u2026) oder bei Alexa ein Suchbegriff",preset_speakers:"Nur auf diesen Lautsprechern (keiner = auf allen)",media_play:"Abspielen",media_pause:"Pause",media_previous:"Zur\xFCck",media_next:"Weiter",media_volume:"Lautst\xE4rke",media_sources:"Quellen",preset_add:"Sender oder Playlist",own_buttons:"Eigene Kn\xF6pfe",own_buttons_hint:"Erscheinen im Zentral-Men\xFC (Stern) unter den Favoriten: eine Dashboard-Seite \xF6ffnen, die Details einer Entit\xE4t zeigen, einen Dienst aufrufen oder ein browser_mod-Popup mit deiner eigenen Karte \xF6ffnen.",own_alerts:"Eigene Warnungen",circuits:"Sicherungskasten",circuits_hint:"Die Stromkreise mit den R\xE4umen, die an ihnen h\xE4ngen. Das Raum-Panel nennt sie, und die Suche findet sie (\u201EF12\u201C).",circuit_name:"Name",circuit_new:"Neuer Stromkreis",circuit_add:"Stromkreis hinzuf\xFCgen",circuit_add_room:"Raum hinzuf\xFCgen",own_alerts_hint:"Eine Zeile in der Warnleiste der 3D-Ansicht, solange eine Entit\xE4t in einem Zustand ist \u2013 \u201EWassertank leer\u201C vom Saugroboter, \u201ESp\xFClmaschine fertig\u201C. Mehrere Zust\xE4nde mit Komma; bei Zahlen <20 oder >80.",own_alert_entity:"Wenn \u2026",own_alert_state:"\u2026 im Zustand ist (leer = an)",own_alert_text:"\u2026 dann diese Warnung",own_alert_color:"Farbe",own_alert_tap:"Antippen",own_alert_tap_info:"\xF6ffnet die Details",own_alert_tap_toggle:"schaltet die Entit\xE4t",own_alert_tap_room:"springt in den Raum",own_alert_house:"Ganzes Haus",own_alert_new:"Neue Warnung",own_alert_add:"Warnung hinzuf\xFCgen",today:"Heute",tomorrow:"Morgen",today_days:"Tage auf der Karte \u201EHeute\u201C",today_days_one:"Nur heute",today_days_n:"{n} Tage",forecast:"Wettervorhersage",forecast_hint:"Eine kleine Karte mit den n\xE4chsten Tagen der Wetter-Entit\xE4t (Einstellungen): Wetter, H\xF6chst- und Tiefstwert, Regen. Sie steht in einer oberen Ecke der 3D-Ansicht, oben rechts unter der Karte \u201EHeute\u201C.",forecast_days:"Vorhersage",forecast_off:"Aus",forecast_corner:"Ecke",today_none:"Heute steht nichts an.",today_calendars:"Kalender f\xFCr \u201EHeute\u201C",today_calendars_hint:"Die Termine dieser Kalender stehen oben rechts in der 3D-Ansicht auf der Karte \u201EHeute\u201C, zusammen mit den M\xFClltonnen, die heute oder morgen abgeholt werden. Ein Tipp auf den Titel klappt die Karte ein.",own_button_state:"Leuchtet, solange \u2026 an ist (optional)",own_button_label:"Beschriftung",own_button_action:"Aktion",own_button_new:"Neuer Knopf",own_button_add:"Eigener Knopf",own_action_navigate:"Seite \xF6ffnen",own_action_more_info:"Details einer Entit\xE4t",own_action_service:"Dienst aufrufen",own_action_fire_dom_event:"fire-dom-event (browser_mod)",own_target_navigate:"Pfad",own_target_more_info:"Entit\xE4t",own_target_service:"Dienst (domain.service)",own_data:"Daten (JSON)",own_data_hint:'F\xFCr einen Dienst seine Daten, f\xFCr fire-dom-event der Inhalt des Ereignisses, z. B. {"browser_mod": {"service": "browser_mod.popup", "data": {\u2026}}}.',own_data_bad:"Kein g\xFCltiges JSON-Objekt.",panel_no_area:"Dieser Raum ist mit keinem Bereich verkn\xFCpft. Im Editor kannst du ihn verkn\xFCpfen.",panel_empty:"F\xFCr diesen Raum sind keine Ger\xE4te im Grundriss. Im Editor lassen sich Ger\xE4te platzieren oder mit \u2606 f\xFCrs Raumfenster ausw\xE4hlen.",close:"Schlie\xDFen",panel_fold:"Einklappen (Raum bleibt sichtbar)",panel_unfold:"Wieder aufklappen",brightness:"Helligkeit",color_temp:"Farbtemperatur",color:"Farbe",position:"Position",cover_open:"Auf",cover_stop:"Stopp",cover_tilt:"Lamellen",cover_tilt_open:"Lamellen auf",cover_tilt_close:"Lamellen zu",cover_close:"Zu",target_temp:"Soll",current_temp:"Ist",temp_down:"K\xE4lter",temp_up:"W\xE4rmer",volume:"Lautst\xE4rke",play_pause:"Wiedergabe/Pause",previous:"Zur\xFCck",next:"Weiter",run:"Ausf\xFChren",details:"Details",hold_hint:"Antippen schaltet \xB7 lange dr\xFCcken \xF6ffnet Details",tool_opening:"T\xFCr & Fenster",tool_furniture:"M\xF6bel",qm_off:"Aus",find:"Suchen",find_placeholder:"Wo ist \u2026? Ger\xE4t oder Raum",find_none:"Nichts gefunden",swipe_off:"Aus",panel_pin:"Im Raumfenster zeigen",panel_unpin:"Nicht im Raumfenster zeigen",devices_panel_hint:"Das Raumfenster zeigt die Ger\xE4te im Grundriss. \u2606 nimmt ein Ger\xE4t zus\xE4tzlich ins Raumfenster auf, ohne es zu platzieren.",card_section_view:"Ansicht",card_size:"Gr\xF6\xDFe",card_size_fixed:"Feste H\xF6he",card_size_fill:"Bildschirm f\xFCllen",card_fill_hint:"Am besten in einer Dashboard-Ansicht vom Typ \u201EPanel (1 Karte)\u201C \u2013 dann nimmt die Karte den ganzen Platz ein.",card_controls:"Schalter in der Karte",card_floor_thumbs:"Etagen als Mini-Ansichten",card_floor_thumbs_hint:"Kleine Bilder der Etagen am Rand \u2013 antippen wechselt die Etage",card_floor_thumbs_hint_start:"Die gew\xE4hlte Etage ist dann die Start-Etage \u2013 mit den Bildern am Rand wechselt man zu den anderen",card_room_names:"Raumnamen anzeigen",card_section_kiosk:"Wandtablet (Kiosk)",card_section_features:"Funktionen",card_weather_plan:"wie im Plan eingestellt",card_pro_hint:"Bewegungsspur und Kamerawand geh\xF6ren zum Kameras: Die Spur zeigt die letzte halbe Stunde, die Wand alle Kameras des Plans.",card_idle_return:"Zur\xFCck zur Startansicht nach",card_idle_off:"Nie",card_idle_min:"{n} min ohne Bedienung",card_idle_hint:"Nach der Wartezeit schlie\xDFt die Karte den Raum und zeigt wieder die Startansicht.",card_night:"Nachtdimmung",card_night_off:"Aus",card_night_sun:"Nach Sonnenstand",card_night_time:"Zeitraum",card_night_range:"Zeitraum (z. B. 22:00-06:00)",card_idle_orbit:"Kamerafahrt als Bildschirmschoner",card_idle_orbit_hint:"Nach der R\xFCckkehr dreht sich die Ansicht langsam, bis jemand das Tablet ber\xFChrt",card_dashboard:"Knopf zu einem Dashboard (Pfad)",card_dashboard_label:"Beschriftung des Knopfs",card_dashboard_hint:"Ein Knopf oben rechts in der Karte \xF6ffnet das Dashboard oder die Ansicht mit diesem Pfad, z. B. /lovelace/home oder /dashboard-haus/0. Ohne Beschriftung zeigt er \u2302.",card_alerts:"Warnungen anzeigen",card_alerts_hint:"Rauch, Gas, CO, Wasser, Alarmanlage und offene Fenster bei Regen: der Raum pulsiert, oben erscheint ein Hinweis",card_alert_jump:"Bei neuer Warnung zum Raum springen",card_alert_jump_hint:"Die Ansicht wechselt selbst zur Etage und zum Raum der Warnung",card_scenes:"Szenen-Kn\xF6pfe im Raum",card_scenes_hint:"Szenen und Skripte des Bereichs als Kn\xF6pfe unter der 3D-Ansicht, wenn ein Raum gew\xE4hlt ist",card_sensor_bar:"Eigene Sensoren oben",card_sensor_bar_hint:"Die im Editor gew\xE4hlten Sensoren (Einstellungen) oben links auf der Karte",card_central_open:"Sternmen\xFC offen und gro\xDF",card_central_open_hint:"Favoriten und eigene Kn\xF6pfe stehen von Anfang an offen, eine Nummer gr\xF6\xDFer",card_keep_camera:"Kamera beim Etagenwechsel behalten",card_keep_camera_hint:"Gleiche Seite, H\xF6he und Entfernung auf jeder Etage",card_today:"Karte \u201EHeute\u201C",card_today_hint:"Termine von heute und f\xE4llige M\xFClltonnen oben rechts",card_announcements:"Durchsagen",card_announcements_hint:"Durchsagen (Aktion \u201ENextFloor: Durchsage\u201C) erscheinen gro\xDF auf der Karte, mit Gong und gesprochen",weather_short:"Wetter",time_of_day:"Tageszeit",time_of_day_hint:"Zeigt Sonne, Licht, Schatten und Look zu einer anderen Uhrzeit von heute. Noch einmal tippen zeigt wieder das Jetzt.",menu_open:"Men\xFC offen",menu_open_hint:"Das Sternmen\xFC mit Favoriten und eigenen Kn\xF6pfen steht auf diesem Ger\xE4t von Anfang an offen, eine Nummer gr\xF6\xDFer \u2013 f\xFCr ein Wandtablet, das vor allem Szenen schaltet.",keep_camera:"Kamera behalten",keep_camera_hint:"Beim Wechsel der Etage bleibt die Kamera auf derselben Seite, H\xF6he und Entfernung, statt die neue Etage von der Startseite aus einzupassen.",view_zoom:"Zoom",view_zoom_hint:"Wie nah die eingepassten Ansichten kommen \u2013 auf kleinen Tablets wirkt das Haus gr\xF6\xDFer.",weather_entity:"Wetter-Entit\xE4t",weather_effects:"Wetter-Effekte in 3D",card_weather_density:"Regen- und Schneemenge",card_weather_density_hint:"Weniger Tropfen und Flocken als das Wetter meldet; Wolken, Nebel und Blitze bleiben",weather_effect_rain:"Regen",weather_effect_snow:"Schnee",weather_effect_fog:"Nebel (graut die Szene ein)",weather_effect_clouds:"Wolken dunkeln Himmel und Sonne ab",weather_effect_lightning:"Blitze bei Gewitter",weather_effect_sky:"Sonne und Mond am Himmel",rain_warning:"Warnung: Fenster offen bei Regen",sun_patches:"Sonnenlicht und Schatten",sun_patches_hint:"Mit eingestellter Nordrichtung f\xE4llt das Sonnenlicht aus sun.sun als helle Flecken durch die Fenster auf den Boden, und das Haus wirft seinen Schatten auf das Grundst\xFCck. Ohne Haken bleiben Boden und Grundst\xFCck ohne Sonnenflecken und Schatten.",sun_arc:"Sonnenbogen und Kompass",sun_arc_hint:"Zeichnet den Weg der Sonne von heute als Bogen \xFCber das Grundst\xFCck, mit einem Ring und den Himmelsrichtungen am Boden (Norden rot). Braucht die Position deines Zuhauses in Home Assistant.",weather_entity_hint:"Welche Wetter-Entit\xE4t den Himmel ums Haus steuert. \u201EAutomatisch\u201C nimmt die erste gefundene.",weather_hint:"Wetter am Haus: Regen und Schnee fallen mit dem echten Wind, Wolken ziehen mit Schatten \xFCbers Grundst\xFCck, Blitze, Nebel, Sonne und Mond",card_weather:"Wetter drau\xDFen",card_weather_hint:"Regen, Schnee, Hagel, Wolken mit Schatten, Blitze und Nebel aus der ersten Wetter-Entit\xE4t (weather_entity w\xE4hlt eine andere); auf Stufe Tablet weniger Teilchen",alerts:"Warnungen",alert_smoke:"Rauch: {name}",alert_gas:"Gas: {name}",alert_co:"Kohlenmonoxid: {name}",alert_water:"Wasser: {name}",alert_alarm:"Alarm ausgel\xF6st",alert_alarm_by:"Alarm ausgel\xF6st durch {cause}",alert_alarm_pending:"Alarm wird ausgel\xF6st",alert_window_rain:"Fenster offen bei Regen: {name}",alert_power_outage:"Stromausfall: {name}",alert_contact_lost:"Kontakt antwortet nicht: {name}",rain_sensor:"Regensensor (eigene Wetterstation)",rain_sensor_inverted:"Regensensor umkehren",rain_sensor_inverted_hint:"F\xFCr Sensoren, die bei Regen \u201Eaus\u201C (oder 0) melden und bei Trockenheit \u201Eein\u201C.",outage_sensor:"Sensor f\xFCr Stromausfall",outage_hint:"Ein Bin\xE4rsensor der Klasse Strom, der aus ist, ein anderer Bin\xE4rsensor, der an ist, ein Status wie \u201Eoff_grid\u201C oder \u201Ebackup\u201C oder eine Spannung unter 50 V l\xF6sen eine Warnung f\xFCrs ganze Haus aus.",contact_warning:"Warnen, wenn ein T\xFCr- oder Fensterkontakt nicht erreichbar ist",contact_warning_hint:"Ist ein Kontakt 10 Minuten lang \u201Enicht verf\xFCgbar\u201C (leere Batterie, au\xDFer Funkreichweite), sieht das Fenster in 3D geschlossen aus, obwohl es keiner wei\xDF. Dann nennt ein Hinweis den Kontakt. Ein Neustart von Home Assistant warnt nicht.",night_lock_warning:"Nachts warnen, wenn eine T\xFCr nicht abgeschlossen ist",night_lock_warning_hint:"Zwischen 22 und 6 Uhr nennt ein Hinweis die T\xFCrschl\xF6sser des Plans, die offen stehen.",alert_unlocked_night:"Nicht abgeschlossen: {name}",motion_markers_active:"Bewegungsmelder nur zeigen, wenn sie etwas erkennen",motion_markers_active_hint:"Gilt f\xFCr Bewegungs-, Anwesenheits- und Pr\xE4senzmelder. Ein Melder, dessen Symbol auf immer zeigen steht, bleibt sichtbar.",room_double_tap:"Doppeltipp auf einen Raum",room_double_tap_hint:"Ein Doppeltipp auf einen Raum schaltet seine Lichter aus, wenn eins an ist, sonst alle an. Ger\xE4te mit \u201EErst fragen\u201C bleiben immer au\xDFen vor.",room_double_tap_area:"Lampen im Plan und alle Lichter des Bereichs",room_double_tap_plan:"Nur Lampen im Plan",room_double_tap_off:"Nichts schalten",card_room_double_tap_auto:"Wie im Plan eingestellt",status_entities:"Eigene Sensoren oben in der 3D-Ansicht",status_add:"Sensor hinzuf\xFCgen",status_entities_hint:"Zum Beispiel Au\xDFentemperatur, Alarmanlage oder Luftqualit\xE4t: Sie stehen oben links mit Name und Wert, auch in einem ge\xF6ffneten Raum. Antippen \xF6ffnet die Details. Bis zu 12.",announce_tts:"Text-zu-Sprache f\xFCr Durchsagen",announce_phrases:"S\xE4tze f\xFCr Durchsagen (einer pro Zeile)",announce_phrases_hint:"Leer: die mitgelieferten S\xE4tze. Durchsagen gibt es auch als Aktion \u201ENextFloor: Durchsage\u201C f\xFCr Automationen \u2013 auf den Lautsprechern der R\xE4ume und auf jedem offenen NextFloor-Bildschirm.",opening_rain_warning:"Bei Regen warnen",opening_light_well:"Lichtschacht davor",sill_boards:"Fensterbank",sill_boards_auto:"Automatisch",sill_boards_none:"Keine",sill_boards_inside:"Nur innen",sill_boards_outside:"Nur au\xDFen",room_names_short:"Raumnamen",room_names_toggle_hint:"Raumnamen in der 3D-Ansicht ein- oder ausblenden",floor_stack_short_dim:"Abgedunkelt",floor_stack_short_stacked:"Gestapelt",floor_stack_short_single:"Einzeln",size_short_w:"B",size_short_d:"T",size_short_h:"H",import_error_not_json:"Die Datei ist kein JSON.",import_error_not_plan:"Die Datei ist kein NextFloor-Plan.",import_other_hint:"Aus Sweet Home 3D: die .sh3d-Datei hier importieren. Etagen, R\xE4ume, T\xFCren, Fenster und freie W\xE4nde werden \xFCbernommen, M\xF6bel nicht.",import_sh3d_found:"Sweet Home 3D: {floors} Etagen, {rooms} R\xE4ume, {openings} T\xFCren und Fenster, {walls} freie W\xE4nde ({furniture} M\xF6bel werden nicht \xFCbernommen).",import_dxf_found:"DXF: {rooms} R\xE4ume (geschlossene Polylinien) und {walls} freie W\xE4nde (Linien) auf einer Etage.",import_ifc_found:"In der IFC-Datei: {floors} Etagen und {rooms} R\xE4ume (die W\xE4nde zeichnet NextFloor aus den R\xE4umen).",import_roomplan_found:"Raumscan (RoomPlan): {rooms} R\xE4ume, {openings} T\xFCren und Fenster; {skipped} Objekte wurden nicht \xFCbernommen (M\xF6bel stellst du selbst).",import_error_roomplan_empty:"Im Raumscan sind keine W\xE4nde.",import_error_ifc_empty:"In der IFC-Datei sind keine R\xE4ume (IfcSpace) mit Grundriss.",import_error_dxf_empty:"In der DXF-Datei sind keine Linien oder Polylinien.",import_error_sh3d:"Das ist keine Sweet-Home-3D-Datei, die sich lesen l\xE4sst (es braucht Sweet Home 3D 5.3 oder neuer).",import_error_sh3d_empty:"In der Sweet-Home-3D-Datei sind keine R\xE4ume oder W\xE4nde.",export_name_template:"vorlage",export_name_backup:"sicherung",card_floor_stack:"Etagen darunter",floor_stack_dim:"Abgedunkelt",floor_stack_stacked:"Gestapelt (ganzes Haus bis hier)",floor_stack_single:"Ausgeblendet (nur diese Etage)",card_control_walls:"W\xE4nde hoch/Schnitt",card_control_floors:"Etagen auseinander",card_control_temperature:"Temperatur",card_control_humidity:"Feuchte",card_control_co2:"CO\u2082",card_controls_hint:"W\xE4nde hoch/Schnitt, Etagen auseinander und Temperatur, Feuchte, CO\u2082 zum Umschalten",controls_hide:"Bedienelemente ausblenden \u2013 nur die 3D-Ansicht bleibt",nav_wrap:"Leiste umbrechen: alle Etagen und R\xE4ume auf mehreren Zeilen",bars_unfold:"Schalter",nav_row:"Leiste in einer Zeile (seitlich scrollen)",controls_show:"Bedienelemente wieder einblenden",card_controls_hidden:"Mit ausgeblendeten Bedienelementen starten",card_controls_hidden_hint:"Nur die 3D-Ansicht; ein Auge unten links holt Leisten, Werte und Schalter zur\xFCck",card_controls_hide_after:"Bedienelemente ausblenden nach",card_hide_after_s:"{n} s ohne Ber\xFChrung",card_fullscreen_button:"Vollbild-Taste",card_fullscreen_button_hint:"Blendet das Dashboard drumherum aus (z. B. am Wandtablet)",fullscreen:"Vollbild",fullscreen_exit:"Vollbild beenden",card_section_show:"Anzeigen",card_floor:"Etage",card_floor_house:"Ganzes Haus (Etage antippen zum \xD6ffnen)",card_height:"H\xF6he (Pixel)",card_walls:"W\xE4nde",card_quality_hint:"\u201ETablet\u201C ist die sparsamste Stufe \u2013 ideal f\xFCr Fire-Tablets und andere Wandtablets.",card_flows_switch:"Schalter in der Karte",card_flows_on:"Immer an",card_flows_off:"Immer aus",holos:"Karten",holos_hint:"Die Live-Karten \xFCber dem Haus (Energiebilanz, Auto, Medien) ein- oder ausblenden",card_energy:"Energiewerte oben anzeigen",card_room_panel:"Raum-Details beim Antippen",card_room_buttons:"Raum-Kn\xF6pfe",card_room_buttons_hint:"Eine Reihe mit einem Knopf je Raum oben in der Karte \u2013 antippen \xF6ffnet den Raum, wie das Antippen im Modell",card_room_panel_hint:"Lichter und Rolll\xE4den des Raums in einem Seitenfenster",card_explode:"Etagen in der Hausansicht auseinanderziehen",card_roof_fade:"Dach beim Heranzoomen ausblenden",card_roof_fade_hint:"Aus: Das Dach bleibt auf dem Haus, auch wenn die Kamera nah herankommt.",card_stats:"Leistungsanzeige (Bilder pro Sekunde)",card_stats_hint:"Zum Pr\xFCfen, wie fl\xFCssig die Karte auf dem Ger\xE4t l\xE4uft",packs:"M\xF6bel-Packs",lib_badge_light:"Leuchte: l\xE4sst sich mit einem Licht verkn\xFCpfen und in 3D schalten",lib_badge_electric:"Elektrisch: l\xE4sst sich mit Entit\xE4t und Leistungssensor verkn\xFCpfen (schalten, Bild, Verbrauch)",lib_badge_hint:"M\xF6bel mit Symbol lassen sich mit Entit\xE4ten verkn\xFCpfen: Leuchten schalten, Bildschirme zeigen Bilder, Ger\xE4te ihren Verbrauch.",care_bin_today:"Heute Abholung",care_bin_tomorrow:"Morgen Abholung",care_bin_days:"In {n} Tagen",care_mail_yes:"Post ist da",care_mail_no:"Leer",care_plant_thirsty:"Durst",care_plant_ok:"Gut versorgt",care_time_left:"Noch {time}",care_entity_bin:"Abholtermin (Sensor)",care_entity_mail:"Post-Sensor",care_entity_plant:"Bodenfeuchte (Sensor)",care_thirsty_below:"Durst unter (%)",care_hint_bin:"Ein Sensor mit dem n\xE4chsten Abholtermin: Tage, ein Datum, \u201Eheute\u201C/\u201Emorgen\u201C oder die Integration Waste Collection Schedule. Am Tag davor und am Abholtag leuchtet die Tonne.",care_hint_mail:"Ein Sensor, der meldet, dass Post im Kasten ist (z. B. ein Kontakt an der Klappe). Dann leuchtet der Briefkasten.",care_hint_plant:"Ein Feuchtesensor in der Erde. Darunter leuchtet die Pflanze und meldet Durst.",lib_cat_lights:"Leuchten",lib_cat_seating:"Sitzen",lib_cat_tables:"Tische",lib_cat_storage:"Schr\xE4nke & Regale",lib_cat_beds:"Betten",lib_cat_kitchen:"K\xFCche",lib_cat_appliances:"Haushaltsger\xE4te",lib_cat_bath:"Bad",lib_cat_media:"TV & Audio",lib_cat_office:"B\xFCro",lib_cat_tech:"Technik",lib_cat_climate:"Heizung & Klima",lib_cat_energy:"Energie",lib_cat_garden:"Garten & Terrasse",lib_cat_plants:"Pflanzen",lib_cat_kids:"Kinder",lib_cat_fitness:"Fitness",lib_cat_pets:"Haustiere",lib_cat_workshop:"Werkstatt & Garage",lib_cat_music:"Musik & Atelier",lib_cat_season:"Saison & Deko",lib_cat_pictures:"Bilder & Rahmen",lib_cat_vehicles:"Fahrzeuge",lib_cat_building:"Treppen & Bauteile",lib_cat_decor:"Deko & Sonstiges",lib_favourites:"Favoriten",lib_recent:"Zuletzt benutzt",lib_for_room:"Passend zu {room}",lib_all_rooms:"Alle R\xE4ume zeigen",lib_linkable:"verkn\xFCpfbar",lib_lit:"leuchtet",lib_outdoor:"drau\xDFen",lib_fav_add:"Zu den Favoriten",lib_fav_remove:"Aus den Favoriten nehmen",lib_sizes:"Gr\xF6\xDFen",feature_name_energy:"Energiefluss",ext_tab:"Erweiterungen",ext_title:"Erweiterungen",models:"Eigene 3D-Modelle",models_hint:"F\xFCr manche Fahrzeuge kann NextFloor ein echtes 3D-Modell zeigen, wenn du eins besitzt. W\xE4hle die Datei (.glb) hier aus: NextFloor dreht sie richtig herum, macht sie leichter, markiert den Lack und legt sie auf deinem Home Assistant ab. Ohne Modell sieht das Fahrzeug aus wie bisher.",models_licence:"Die Dateien geh\xF6ren dir und bleiben auf deinem Home Assistant. NextFloor liefert keine Modelle mit; bitte pr\xFCfe, dass die Lizenz deines Modells die Nutzung in deiner Installation erlaubt.",model_add:"Modell hochladen \u2026",model_replace:"Modell ersetzen \u2026",model_remove:"Entfernen",model_present:"vorhanden",model_missing:"noch keins",model_remove_confirm:"Das Modell \u201E{id}\u201C von Home Assistant l\xF6schen?",model_removed:"Modell \u201E{id}\u201C gel\xF6scht.",model_uploaded:"Modell \u201E{id}\u201C hochgeladen ({size}). Lade das Panel neu, damit es erscheint.",model_upload:"Auf Home Assistant ablegen",model_info:"{triangles} Dreiecke, {size} m",model_front:"Vorderseite",model_front_hint:"Drehe das Modell, bis die Front zum Betrachter zeigt (schr\xE4g nach unten links in der Vorschau).",model_paint:"Lack (die Farbe, die du im Editor w\xE4hlst)",model_paint_preview:"Farbe in der Vorschau",model_detail:"Detailgrad",model_detail_light:"Leicht (Tablet)",model_detail_normal:"Normal",model_detail_fine:"Fein",model_result:"Ergebnis: {triangles} Dreiecke, {size}",model_error_not_glb:"Das ist keine .glb-Datei (bin\xE4res glTF). Exportiere das Modell als \u201EglTF binary\u201C.",model_error_compressed:"Die Datei ist komprimiert (Draco, Meshopt oder KTX). Exportiere sie ohne Kompression.",model_error_empty:"In der Datei ist nichts Dreidimensionales zu finden.",model_error_unreadable:"Die Datei l\xE4sst sich nicht lesen: {detail}",model_error_too_large:"Die Datei ist gr\xF6\xDFer als {max}. W\xE4hle einen geringeren Detailgrad.",model_upload_forbidden:"Nur Administratoren d\xFCrfen Modelle hochladen.",model_upload_too_large:"Home Assistant nimmt keine Dateien \xFCber {max} an. W\xE4hle einen geringeren Detailgrad.",model_upload_not_glb:"Home Assistant hat die Datei abgelehnt (kein bin\xE4res glTF).",model_upload_bad_id:"Die Modell-Kennung ist ung\xFCltig.",model_upload_other:"Das Hochladen hat nicht geklappt: {detail}",ext_intro:"Hier importierst du eigene M\xF6bel-Packs, l\xE4dst eigene 3D-Modelle hoch und bindest Plugins ein.",plugin:"Plugin",plugins_title:"Plugins",plugins_intro:"Plugins erweitern NextFloor um eigene Licht-Animationen, Ger\xE4te und Karten im Raum-Panel. Trag die Adresse eines Plugins ein (eine .js-Datei in /config/www, also /local/\u2026, aus HACS /hacsfiles/\u2026 oder https://\u2026).",plugins_docs:"Wie man ein Plugin schreibt",plugins_warning:"Plugins laufen mit denselben Rechten wie NextFloor in deinem Browser. Nimm nur Plugins, deren Quelle du vertraust.",plugins_off:"ausgeschaltet",plugins_error:"Fehler",plugins_loading:"wird geladen \u2026",plugins_nothing_registered:"geladen, hat aber nichts angemeldet",plugins_loaded:"aktiv",plugins_reload_hint:"Wirkt nach dem Neuladen der Seite",plugins_remove:"Entfernen",plugins_none:"Noch keine Plugins eingetragen.",plugins_from_dashboard:"\xDCber eine Dashboard-Ressource angemeldet",plugins_add:"Hinzuf\xFCgen",plugins_url_invalid:"Bitte eine .js-Adresse unter /local/\u2026, /hacsfiles/\u2026 oder https://\u2026 angeben.",plugins_exists:"Dieses Plugin ist schon eingetragen.",plugins_limit:"H\xF6chstens 20 Plugins.",packs_title:"M\xF6bel-Packs",packs_intro:"Eigene M\xF6bel als Pack (JSON) importieren: als Datei oder unten einf\xFCgen. {n} Packs sind mitgeliefert und immer da.",packs_docs:"Pack-Format",packs_none:"Noch keine eigenen Packs importiert.",community_title:"Community-M\xF6bel",community_intro:"M\xF6bel, die andere mit dem M\xF6bel-Baukasten gebaut und geteilt haben \u2013 gepr\xFCft und kostenlos. Bau deine eigenen:",community_builder:"M\xF6bel-Baukasten \xF6ffnen",community_how:"So teilst du deine",community_load:"Community-M\xF6bel laden",community_none:"Noch keine Community-M\xF6bel \u2013 sei die oder der Erste!",community_install:"Installieren",community_update:"Aktualisieren",community_installed:"Installiert",community_failed:"Die Community-M\xF6bel lie\xDFen sich nicht laden: {detail}",pack_import:"Pack-Dateien importieren \u2026",pack_paste:"JSON importieren",pack_paste_empty:"F\xFCge zuerst das JSON eines Packs ein.",pack_paste_not_json:"Das ist kein g\xFCltiges JSON: {detail}",pack_imported:"\u201E{name}\u201C von {publisher} importiert \u2013 {n} M\xF6bel",packs_imported_n:"{n} von {total} Packs importiert",pack_by:"von {publisher} \xB7 {n} M\xF6bel",pack_remove:"Entfernen",pack_remove_confirm:"Pack \u201E{name}\u201C entfernen? M\xF6bel daraus bleiben als einfache K\xE4sten im Plan.",pack_error_not_a_pack:'Das ist kein M\xF6bel-Pack (es fehlt "format": "nfpack").',pack_error_builtin:"Ein mitgeliefertes Pack hat schon diese ID.",pack_error_invalid_content:"Das Pack enth\xE4lt ung\xFCltige M\xF6bel: {detail}",pack_error_too_large:"Das Pack ist zu gro\xDF (h\xF6chstens 1 MB).",pack_error_needs_update:"Dieses Pack braucht eine neuere Version von NextFloor. Bitte zuerst aktualisieren (HACS \u203A NextFloor \u203A \u22EE \u203A \u201EInformationen aktualisieren\u201C \u203A \u201EHerunterladen\u201C), Home Assistant neu starten und dann noch einmal importieren.",pack_error_other:"Import fehlgeschlagen: {detail}",store_open:"Plugin-Store \xF6ffnen",store_close:"Plugin-Store schlie\xDFen",store_intro:"Gepr\xFCfte Plugins aus der Community. Jedes wird vor der Aufnahme angesehen und danach nicht mehr ver\xE4ndert.",store_submit:"Eigenes Plugin einreichen",store_empty:"Noch keine Plugins im Store.",store_failed:"Der Store lie\xDF sich nicht laden ({error}).",store_install:"Installieren",store_installed:"installiert",store_update:"Aktualisieren",store_confirm:`\u201E{name}\u201C von {author} installieren? +var w={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var jn=globalThis,qn=jn.ShadowRoot&&(jn.ShadyCSS===void 0||jn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_i=Symbol(),gs=new WeakMap,rn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==_i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(qn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=gs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&gs.set(t,e))}return e}toString(){return this.cssText}},_s=n=>new rn(typeof n=="string"?n:n+"",void 0,_i),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new rn(t,n,_i)},bs=(n,e)=>{if(qn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=jn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},bi=qn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return _s(t)})(n):n;var{is:yd,defineProperty:vd,getOwnPropertyDescriptor:wd,getOwnPropertyNames:xd,getOwnPropertySymbols:kd,getPrototypeOf:Sd}=Object,Zn=globalThis,ys=Zn.trustedTypes,$d=ys?ys.emptyScript:"",Md=Zn.reactiveElementPolyfillSupport,on=(n,e)=>n,yi={toAttribute(n,e){switch(e){case Boolean:n=n?$d:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},ws=(n,e)=>!yd(n,e),vs={attribute:!0,type:String,converter:yi,reflect:!1,useDefault:!1,hasChanged:ws};Symbol.metadata??=Symbol("metadata"),Zn.litPropertyMetadata??=new WeakMap;var Le=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=vs){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&vd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=wd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??vs}static _$Ei(){if(this.hasOwnProperty(on("elementProperties")))return;let e=Sd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(on("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(on("properties"))){let t=this.properties,r=[...xd(t),...kd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(bi(i))}else e!==void 0&&t.push(bi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bs(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:yi).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:yi;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??ws)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Le.elementStyles=[],Le.shadowRootOptions={mode:"open"},Le[on("elementProperties")]=new Map,Le[on("finalized")]=new Map,Md?.({ReactiveElement:Le}),(Zn.reactiveElementVersions??=[]).push("2.1.2");var Mi=globalThis,xs=n=>n,Yn=Mi.trustedTypes,ks=Yn?Yn.createPolicy("lit-html",{createHTML:n=>n}):void 0,Rs="$lit$",tt=`lit$${Math.random().toFixed(9).slice(2)}$`,zs="?"+tt,Ad=`<${zs}>`,ht=document,an=()=>ht.createComment(""),ln=n=>n===null||typeof n!="object"&&typeof n!="function",Ai=Array.isArray,Ed=n=>Ai(n)||typeof n?.[Symbol.iterator]=="function",vi=`[ +\f\r]`,sn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ss=/-->/g,$s=/>/g,ut=RegExp(`>|${vi}(?:([^\\s"'>=/]+)(${vi}*=${vi}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),Ms=/'/g,As=/"/g,Ts=/^(?:script|style|textarea|title)$/i,Ei=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),p=Ei(1),ne=Ei(2),kg=Ei(3),mt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Es=new WeakMap,dt=ht.createTreeWalker(ht,129);function Fs(n,e){if(!Ai(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ks!==void 0?ks.createHTML(e):e}var Rd=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"":e===3?"":"",s=sn;for(let a=0;a"?(s=i??sn,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ut:u[3]==='"'?As:Ms):s===As||s===Ms?s=ut:s===Ss||s===$s?s=sn:(s=ut,i=void 0);let d=s===ut&&n[a+1].startsWith("/>")?" ":"";o+=s===sn?l+Ad:h>=0?(r.push(c),l.slice(0,h)+Rs+l.slice(h)+tt+d):l+tt+(h===-2?a:d)}return[Fs(n,o+(n[t]||"")+(e===2?"":e===3?"":"")),r]},cn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Rd(e,t);if(this.el=n.createElement(c,r),dt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=dt.nextNode())!==null&&l.length0){i.textContent=Yn?Yn.emptyScript:"";for(let d=0;d2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=f}_$AI(e,t=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=Mt(this,e,t,0),s=!ln(e)||e!==this._$AH&&e!==mt,s&&(this._$AH=e);else{let a=e,l,c;for(e=o[0],l=0;l{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new un(e.insertBefore(an(),o),o,void 0,t??{})}return i._$AI(n),i};var Ri=globalThis,Q=class extends Le{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ds(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return mt}};Q._$litElement$=!0,Q.finalized=!0,Ri.litElementHydrateSupport?.({LitElement:Q});var Td=Ri.litElementPolyfillSupport;Td?.({LitElement:Q});(Ri.litElementVersions??=[]).push("4.2.2");var pt=Math.PI/180;function ft(n,e,t){let r=n.getTime()/864e5-10957.5,i=(357.529+.98560028*r)*pt,s=(280.459+.98564736*r+1.915*Math.sin(i)+.02*Math.sin(2*i))*pt,a=(23.439-36e-8*r)*pt,l=Math.atan2(Math.cos(a)*Math.sin(s),Math.cos(s)),c=Math.asin(Math.sin(a)*Math.sin(s)),h=(((18.697374558+24.06570982441908*r)%24+24)%24*15+t)*pt-l,m=e*pt,d=Math.asin(Math.sin(m)*Math.sin(c)+Math.cos(m)*Math.cos(c)*Math.cos(h)),g=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(m)-Math.tan(c)*Math.cos(m))/pt+180;return{elevation:d/pt,azimuth:(g%360+360)%360}}function zi(n,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(n)).map(r=>[r.type,Number(r.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function Et(n,e,t=new Date){let[r,i]=[Math.floor(n),Math.round(n%1*60)];if(e)try{let s=new Date(zi(t.getTime(),e)),a=Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate(),r,i),l=a-(zi(a,e)-a);return l=a-(zi(l,e)-l),new Date(l)}catch{}let o=new Date(t);return o.setHours(r,i,0,0),o}var Hs;function Jn(){let n=new URL("./nextfloor-card-editor.js?v=26dc3cb20c0f",new URL(import.meta.url)).href;return Hs??=import(n),Hs}var Qn=(n,e,t={})=>n.callWS({type:`nextfloor/${e}`,...t}),Ps=n=>Qn(n,"building/get");async function Is(n,e){return(await Qn(n,"building/save",{building:e})).revision}function Cs(n,e){return n.connection.subscribeMessage(t=>e(t.revision),{type:"nextfloor/building/subscribe"})}async function Ns(n,e){return(await Qn(n,"image/get",{image_id:e})).data}async function Ls(n){return(await Qn(n,"packs/list")).packs}var Fd=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Os(n){let e=n instanceof Uint8Array?n:new Uint8Array(n),t=e.length*8,r=new Uint8Array(e.length+9+63>>6<<6);r.set(e),r[e.length]=128;let i=new DataView(r.buffer);i.setUint32(r.length-8,Math.floor(t/4294967296)),i.setUint32(r.length-4,t>>>0);let o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64),a=(l,c)=>l>>>c|l<<32-c;for(let l=0;l>>3,k=a(s[y-2],17)^a(s[y-2],19)^s[y-2]>>>10;s[y]=s[y-16]+S+s[y-7]+k>>>0}let[c,u,h,m,d,g,_,b]=o;for(let y=0;y<64;y++){let S=b+(a(d,6)^a(d,11)^a(d,25))+(d&g^~d&_)+Fd[y]+s[y]>>>0,k=(a(c,2)^a(c,13)^a(c,22))+(c&u^c&h^u&h)>>>0;[b,_,g,d,m,h,u,c]=[_,g,d,m+S>>>0,h,u,c,S+k>>>0]}o[0]+=c,o[1]+=u,o[2]+=h,o[3]+=m,o[4]+=d,o[5]+=g,o[6]+=_,o[7]+=b}return[...o].map(l=>l.toString(16).padStart(8,"0")).join("")}var Ws=n=>n.trim().replace(/^\/local\/www\//i,"/local/"),Bs=n=>/^(https:\/\/|\/local\/|\/hacsfiles\/)\S+\.m?js(\?\S*)?$/i.test(n.trim());var Dd=globalThis,Vs=Dd.__nextfloorPluginStore??={plugins:new Map,listeners:new Set},tr=Vs.plugins,Ti=Vs.listeners,Hd=new Set(["none","rainbow","pulse","flicker"]),Pd=5;function Rt(n,e){n.errors.lengthTi.delete(n)}function Fi(n,e=""){if(!n||typeof n!="object")throw new Error("register() needs a plugin object");if(typeof n.id!="string"||!/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(n.id))throw new Error("plugin id must be 1\u201364 letters, digits, '.', '_' or '-'");if(n.apiVersion!==1)throw new Error(`plugin "${n.id}" wants API ${String(n.apiVersion)}, NextFloor offers ${1}`);for(let t of Object.keys(n.lightAnimations??{})){if(Hd.has(t))throw new Error(`plugin "${n.id}": light animation "${t}" is built in`);if(typeof n.lightAnimations?.[t]!="function")throw new Error(`plugin "${n.id}": light animation "${t}" is not a function`)}for(let t of n.devices??[]){if(typeof t?.match!="function")throw new Error(`plugin "${n.id}": every device extension needs match()`);for(let r of["floorWedge","tap","watch"])if(t[r]!==void 0&&typeof t[r]!="function")throw new Error(`plugin "${n.id}": ${r} must be a function`);for(let r of t.settings??[]){if(!r||typeof r.key!="string"||!/^\w{1,32}$/.test(r.key))throw new Error(`plugin "${n.id}": a setting needs a key of 1\u201332 letters, digits or "_"`);if(!["number","select","boolean"].includes(r.type))throw new Error(`plugin "${n.id}": setting "${r.key}" has an unknown type`)}}for(let t of n.roomSections??[])if(typeof t?.render!="function"||typeof t.id!="string")throw new Error(`plugin "${n.id}": every room section needs id and render()`);tr.set(n.id,{plugin:n,status:{id:n.id,name:n.name||n.id,version:n.version||"",source:e,errors:[]}}),Id()}function Cd(n){for(let{plugin:e,status:t}of tr.values()){let r=e.lightAnimations?.[n];if(r)return{fn:r,status:t}}return null}var Ks=n=>Cd(n)!==null;function*dn(n,e){for(let{plugin:t,status:r}of tr.values())for(let i of t.devices??[]){let o=!1;try{o=i.match(n,e)}catch(s){Rt(r,s)}o&&(yield{device:i,status:r})}}function Tt(n,e){for(let{device:t}of dn(n,e))return t.kind??"sensor";return null}function Gs(n){let e=null;for(let{device:t,status:r}of dn(n.entityId,n.state))if(t.marker)try{let i=t.marker(n);if(!i)continue;e={...e??{}},typeof i.icon=="string"&&i.icon&&(e.icon=i.icon),typeof i.text=="string"&&(e.text=i.text.slice(0,60)),typeof i.active=="boolean"&&(e.active=i.active)}catch(i){Rt(r,i)}return e}function Us(n){let e=[];for(let{device:t,status:r}of dn(n.entityId,n.state))if(t.watch)try{let i=t.watch(n);Array.isArray(i)&&e.push(...i.filter(o=>typeof o=="string").slice(0,20))}catch(i){Rt(r,i)}return e}function js(n,e){let t={};for(let r of n??[]){let i=e?.[r.key],o=r.type==="number"?typeof i=="number"&&Number.isFinite(i):r.type==="boolean"?typeof i=="boolean":typeof i=="string"&&(r.options??[]).some(([s])=>s===i);t[r.key]=o?i:r.default}return t}var Nd=n=>{let e=typeof n=="string"?/^#([0-9a-f]{6})$/i.exec(n.trim()):null;if(!e)return null;let t=Number.parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]},Xn=(n,e,t,r)=>typeof n=="number"&&Number.isFinite(n)?Math.min(r,Math.max(t,n)):e;function qs(n,e,t){for(let{device:r,status:i}of dn(n.entityId,n.state))if(r.floorWedge)try{let o=r.floorWedge({...n,placement:e,settings:js(r.settings,t?.[i.id])});if(!o)continue;let s=Xn(o.reach,0,0,30);if(s<=0)continue;return{angle:Xn(o.angle,90,1,360),reach:s,near:Xn(o.near,0,0,s),color:Nd(o.color)??[.04,.22,.28],opacity:Xn(o.opacity,.6,0,1),through:o.tapThrough===!0}}catch(o){Rt(i,o)}return null}function Zs(n,e,t,r){for(let{device:i,status:o}of dn(n.entityId,n.state))if(i.tap)try{if(i.tap({...n,...r,placement:e,settings:js(i.settings,t?.[o.id])})===!0)return!0}catch(s){Rt(o,s)}return!1}function Ys(n){let e=[];for(let{plugin:t,status:r}of tr.values())for(let i of t.roomSections??[])try{let o=i.render(n);if(o==null||o===""||typeof o!="string"&&!(o instanceof Node))continue;e.push({key:`${t.id}/${i.id}`,title:r.name,content:o})}catch(o){Rt(r,o)}return e}var Di=new Map,Hi="";function Pi(){let n=globalThis;if(n.NextFloor)return;n.NextFloor={apiVersion:1,register:t=>Fi(t,Hi)};let e=n.__nextfloorPlugins??[];n.__nextfloorPlugins=[];for(let t of e)try{Fi(t)}catch(r){console.warn("NextFloor: plugin rejected",r)}}var Ld=n=>[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("");async function Od(n,e=(...t)=>fetch(...t)){if(!n.sha256)return{url:n.url};let t=globalThis.crypto?.subtle,r=await e(n.url,{cache:"no-store"});if(!r.ok)throw new Error(`HTTP ${r.status}`);let i=await r.arrayBuffer();if((t?Ld(await t.digest("SHA-256",i)):Os(i))!==n.sha256.toLowerCase())throw new Error("checksum mismatch: the file is not the one that was reviewed");let s=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));return{url:s,revoke:()=>URL.revokeObjectURL(s)}}async function Ii(n,e=r=>import(r),t){Pi();for(let r of n??[]){if(!r.enabled||Di.has(r.url))continue;if(!Bs(r.url)){Di.set(r.url,{url:r.url,state:"error",error:"not allowed: use /local/\u2026, /hacsfiles/\u2026 or https://\u2026"});continue}let i={url:r.url,state:"loading"};Di.set(r.url,i);let o;try{o=await Od({...r,url:Ws(r.url)},t),Hi=r.url,await e(o.url),i.state="loaded"}catch(s){i.state="error",i.error=s instanceof Error?s.message:String(s),console.warn(`NextFloor: plugin ${r.url} failed to load`,s)}finally{Hi="",o?.revoke?.()}}}var Js=[],nr=new Map,Qs=0,Xs=(n,e)=>`pack:${n}:${e}`,Ci=n=>n.startsWith("pack:");function ea(n){Js=n,nr=new Map;for(let e of n)for(let t of e.items)nr.set(Xs(e.id,t.id),t);Qs+=1}var Ni=()=>Js,rr=()=>Qs,Wd={};function X(n){if(!Ci(n))return;let e=nr.get(n);if(e)return e;let[,t,...r]=n.split(":"),i=Wd[t];return i?nr.get(Xs(i,r.join(":"))):void 0}var ir=n=>!!n?.parts.some(e=>e.move);function ta(n,e){if(e===null)return Math.min(1,Math.max(0,n.cover_rest??1));let t=Math.min(1,Math.max(0,e/100));return n.cover==="extends"?t:1-t}var na=n=>X(n)?.parts.find(e=>e.screen);var ra=n=>!!X(n)?.climate;function ia(n,e){return n.name[e.split("-")[0]]??n.name.en??Object.values(n.name)[0]??n.id}function oe(n,e){return e.mount_y!=null?e.mount_y:Vd(n,e)+(Bd(e)?0:sr(n,e.x,e.z))}var Bd=n=>n.type==="led_strip"||X(n.type)?.mount==="ceiling";function Vd(n,e){if(e.type==="lamp_wall")return oa;if(e.type==="led_strip")return Math.max(0,xe(n,e.x,e.z)-.04-Math.max(.02,e.h));let t=X(e.type);if(!t)return sa(e);switch(t.mount){case"surface":return lr(n,e.x,e.z);case"wall":return t.wall_y??1;case"ceiling":return Math.max(0,ar(n,e)-e.h);default:return 0}}function or(n){if(n==="plant")return"plant";let e=X(n);return e?e.household?e.household:/monstera|plant|herb_garden|flower_pots|bonsai|ficus|cactus|kaktus/.test(e.id)?"plant":null:null}var Oe=["electricity","water","gas","heating","cooling"];var Gd={lawn:.012,terrace:.12,path:.02,driveway:.02,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function Ud(n){return n==="hedge"||n==="fence"||n==="pergola"}function jd(n,e,t){let r=n.slope??0;if(!r||n.type==="pool")return 0;let i=n.slope_dir??"x",o=(c,u)=>i==="x"?c:i==="-x"?-c:i==="z"?u:-u,s=1/0,a=-1/0;for(let[c,u]of n.points){let h=o(c,u);s=Math.min(s,h),a=Math.max(a,h)}if(a-s<1e-6)return 0;let l=Math.min(1,Math.max(0,(o(e,t)-s)/(a-s)));return r*l}function cr(n,e,t,r){return ur(n)+(e.offset??0)+Gd[e.type]-jd(e,t,r)}function ur(n){return n.elevation>.3?0:-.2}function hn(n,e,t){let r=(n.outdoor??[]).filter(o=>!Ud(o.type)&&o.type!=="pool"&&H([e,t],o.points)),i=[...r].reverse().find(o=>o.cut)??r[0];return i?cr(n,i,e,t):ur(n)}var qd={meter:null,grid:null,grid_invert:!1,solar:null,battery:null,battery_invert:!1,battery_soc:null,consumption:null,tariff:null};var ca={type:"none",pitch:35,overhang:.4};var Zd={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...ca}};function Yd(n,e,t){return{id:n,name:e,elevation:t,height:2.5,cut_height:1.15,rooms:[],openings:[],furniture:[],placements:[],background:null,outdoor:[],walls:[],ha_floor:null}}var ua=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),oa=1.75;function da(n){return Qd.has(n.type)||["stairwell","parking"].includes(n.type)?!1:X(n.type)?.mount!=="ceiling"}function dr(n){return ua.has(n)||!!X(n)?.light}var Jd=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function ha(n,e,t,r=0){let i=th(n.points),o=i.x1-i.x0-2*r,s=i.z1-i.z0-2*r,a=[];for(let l=0;ln?.floor_offset&&Number.isFinite(n.floor_offset)?n.floor_offset:0;function sr(n,e,t){let r=n.rooms.find(i=>i.points.length>=3&&i.floor_offset&&H([e,t],i.points));return Xd(r)}function xe(n,e,t){let r=n.rooms.find(i=>i.points.length>=3&&H([e,t],i.points));return r?.ceiling!=null&&r.ceiling>0?r.ceiling:n.height}var ar=(n,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:xe(n,e.x,e.z);function lr(n,e,t){let r=0;for(let i of n.furniture)!(Jd.has(i.type)||X(i.type)?.surface)||!H([e,t],hr(i))||(r=Math.max(r,i.h));return r}var Kd=new Set([...ua,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]),aa={sofa:[2.2,.9,.82],armchair:[.85,.85,.8],table:[1.6,.9,.75],chair:[.46,.5,.9],bed:[1.6,2.05,.9],nightstand:[.45,.4,.5],wardrobe:[1.8,.6,2.1],shelf:[.9,.35,1.9],kitchen:[2.4,.62,.92],worktop:[1.2,.62,.91],inverter:[.5,.2,.65],home_battery:[.6,.25,1.1],wallbox:[.3,.15,.42],heating_manifold:[1.5,.35,1.1],buffer_tank:[.85,.85,1.85],freshwater_station:[.65,.28,.9],meter:[.55,.21,1.1],grid_point:[.4,.22,.6],fridge:[.6,.65,1.8],fridge_smart:[.91,.73,1.78],stairwell:[1,2.6,.02],stove:[.6,.62,.92],sink:[.9,.62,.92],bathtub:[1.7,.75,.58],shower:[.9,.9,2],wc:[.38,.6,.8],washbasin:[.6,.46,.85],desk:[1.4,.7,.75],tv_board:[1.8,.42,.5],plant:[.45,.45,1.1],rug:[2,1.4,.01],stairs:[1,3.2,2.75],stool:[.55,.55,.42],lamp_ceiling:[.4,.4,.08],lamp_downlight:[.1,.1,.02],lamp_spot:[.1,.1,.14],lamp_panel:[.6,.6,.03],lamp_uplight:[.35,.35,1.8],lamp_bollard:[.16,.16,.8],lamp_garden:[.12,.12,.3],radiator:[1,.1,.6],robot_vacuum:[.36,.5,.1],parking:[2.6,5.2,.02],lamp_pendant:[.4,.4,.8],ceiling_fan:[1.32,1.32,.32],lamp_floor:[.4,.4,1.7],lamp_table:[.28,.28,.45],lamp_wall:[.22,.12,.2],led_strip:[2,.04,.03],coffee_table:[1.1,.6,.42],tv_wall:[1.3,.08,.75],sideboard:[1.6,.45,.8],table_round:[1.1,1.1,.75],bench:[1.4,.45,.85],corner_bench:[2,1.6,.9],bar_stool:[.42,.42,.75],kitchen_wall:[.8,.35,.7],kitchen_tall:[.6,.62,2.1],island:[1.8,.9,.92],dishwasher:[.6,.62,.92],bunk_bed:[1,2.05,1.65],dresser:[1,.5,.9],washer:[.6,.6,.85],dryer:[.6,.6,.85],office_chair:[.65,.65,1.1],tall_cabinet:[.6,.6,2.1],coat_rack:[1,.35,1.9]};function Li(n){n.energy={...qd,...n.energy??{}},n.presence=n.presence??[],n.version=1,n.settings={...Zd,...n.settings,roof:{...ca,...n.settings?.roof??{}}},n.floors.forEach((e,t)=>{let r=Yd(e.id,e.name??`Floor ${t+1}`,e.elevation??t*2.8);for(let i of Object.keys(r))e[i]===void 0&&(e[i]=r[i])});for(let e of n.floors){e.outdoor=e.outdoor??[],e.walls=e.walls??[],e.rooms=e.rooms.map(r=>({...r,name:r.name??"",area_id:r.area_id??null,floor_material:r.floor_material??"wood",panel:r.panel??[]})),e.ha_floor=e.ha_floor??null,e.placements=e.placements.map(r=>({...r,mount:r.mount??null,rotation:r.rotation??0})),e.furniture=e.furniture.map(r=>({...r,entity:r.entity??null,power:r.power??null}));let t=e.placements.filter(r=>r.entity_id.startsWith("light."));if(t.length){let r={ceiling:"lamp_ceiling",floor:"lamp_floor",table:"lamp_table",wall:"lamp_wall"};for(let i of t){let o=r[i.mount??"ceiling"],[s,a,l]=aa[o],c=`lamp_${i.entity_id.slice(6).replace(/[^A-Za-z0-9_\-.]/g,"_")}`.slice(0,54),u=c,h=1;for(;e.furniture.some(m=>m.id===u);)u=`${c}_${h++}`;e.furniture.push({id:u,type:o,x:i.x,z:i.z,rotation:0,w:s,d:a,h:l,variant:null,entity:i.entity_id,power:null,animations_enabled:i.animations_enabled,effect_animations:structuredClone(i.effect_animations)})}e.placements=e.placements.filter(i=>!i.entity_id.startsWith("light."))}e.openings=e.openings.map(r=>({...r,type:["door","window","garage"].includes(r.type)?r.type:"door",edge:Number.isInteger(r.edge)?r.edge:0,offset:Number.isFinite(r.offset)?r.offset:.5,width:Number.isFinite(r.width)&&r.width>0?r.width:r.type==="garage"?2.5:r.type==="window"?1.2:.9,height:Number.isFinite(r.height)&&r.height>0?r.height:r.type==="window"?1.3:r.type==="garage"?2.1:2.05,sill:Number.isFinite(r.sill)?r.sill:r.type==="window"?.9:0,hinge:r.hinge??"left",leaves:r.leaves??1,swing:r.swing??"in",style:r.style??null,cover:r.cover??null,contact:r.contact??null,contact2:r.contact2??null,tilt:r.tilt??null}))}return eh(n),n}function eh(n){let e=(t,r)=>{let i=new Set;for(let o of t)(typeof o.id!="string"||!o.id||i.has(o.id))&&(o.id=la(r)),i.add(o.id)};e(n.floors,"floor");for(let t of n.floors){for(let r of t.rooms)(typeof r.id!="string"||!r.id)&&(r.id=la("room"));e(t.openings,"op"),e(t.furniture,"furn"),e(t.outdoor,"out")}}function la(n){return`${n}_${Math.random().toString(36).slice(2,10)}`}function gt(n){let e=0;for(let t=0;to+s[0],0)/i,n.reduce((o,s)=>o+s[1],0)/i]}let t=0,r=0;for(let i=0;i[n.x+s*t-a*r,n.z+s*r+a*t])}function H(n,e){let t=!1;for(let r=0,i=e.length-1;rn[1]!=l>n[1]&&n[0]<(a-o)*(n[1]-s)/(l-s)+o&&(t=!t)}return t}var ma={lamp_ceiling:"ceiling",lamp_downlight:"downlight",lamp_spot:"spot",lamp_panel:"panel",lamp_uplight:"uplight",lamp_bollard:"bollard",lamp_garden:"garden",lamp_pendant:"pendant",ceiling_fan:"fan",lamp_floor:"floor",lamp_table:"table",lamp_wall:"wall",led_strip:"strip"};var nh=700,Wi="nextfloor.unsaved",Ft="0.2.28";function rh(){try{let n=localStorage.getItem(Wi);return n?JSON.parse(n):null}catch{return null}}function Oi(n){try{n?localStorage.setItem(Wi,JSON.stringify(n)):localStorage.removeItem(Wi)}catch{}}var pa=n=>n&&typeof n=="object"&&"message"in n?String(n.message):String(n);function ih(n,e){let t=o=>o.split(/[.-]/).map(s=>Number.parseInt(s,10)||0),[r,i]=[t(n),t(e)];for(let o=0;othis.host.requestUpdate()),this.hass&&this.start()}hostDisconnected(){this.connected=!1,this.stopPlugins?.(),this.stopPlugins=null,this.flush(),this.stopListening?.(),this.stopListening=null}edit(e){this.building=e,Ii(e.settings.plugins),this.waiting=e,clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flush()},nh),this.host.requestUpdate()}get frontendVersion(){return Ft}get versionGap(){let e=this.backendVersion;return!e||Ft==="dev"||e===Ft?null:ih(e,Ft)>0?"frontend":"backend"}get needsRestart(){return this.saveError&&/extra keys not allowed/i.test(this.saveError)?!0:!!this.backendVersion&&Ft!=="dev"&&this.backendVersion!==Ft}restoreDraft(){let e=this.draft;this.draft=null,e&&this.edit(Li(e.building))}discardDraft(){this.draft=null,Oi(null),this.host.requestUpdate()}async flush(){clearTimeout(this.timer),this.inFlight&&await this.inFlight;let e=this.waiting,t=this.hass;!e||!t||(this.waiting=null,this.saveState="saving",this.host.requestUpdate(),this.inFlight=this.send(t,e),await this.inFlight,this.inFlight=null)}async send(e,t){try{let r=await Is(e,t);this.ownRevisions.add(r),this.revision=r,this.saveState=this.waiting?"saving":"saved",this.saveError=null,Oi(null)}catch(r){this.saveState="error",this.saveError=pa(r),Oi({building:t,savedAt:Date.now()})}this.host.requestUpdate()}async start(){let e=this.hass;if(e&&(await Promise.all([this.reloadPacks(),this.reload()]),!(this.stopListening||!this.connected)))try{this.stopListening=await Cs(e,t=>{let r=this.ownRevisions.has(t)||t===this.revision,i=this.waiting!==null||this.inFlight!==null;!r&&!i&&this.reload()})}catch{}}async reloadPacks(){if(this.hass){try{this.packs=await Ls(this.hass)}catch{this.packs=[]}ea(this.packs),this.host.requestUpdate()}}async reload(){if(this.hass){try{let e=await Ps(this.hass);this.building=Li(e.building),Ii(this.building.settings.plugins),this.backendVersion=e.version??null,this.revision=e.revision,this.error=null,this.draft===null&&!this.waiting&&(this.draft=rh())}catch(e){this.error=pa(e)}this.host.requestUpdate()}}};var Bi=n=>n.slice(0,n.indexOf(".")),oh={light:"light",switch:"switch",input_boolean:"switch",valve:"switch",fan:"fan",cover:"cover",climate:"climate",media_player:"media",lock:"lock",sensor:"sensor",binary_sensor:"binary",event:"sensor",scene:"scene",script:"script"},P=n=>oh[Bi(n)]??null,Vi=["light","cover","climate","media","switch","fan","lock","binary","sensor","scene","script"];function fa(n,e=!1){if(e||n.startsWith("lamp:"))return"light";if(n.startsWith("tap:"))return"tap";if(n.startsWith("gang:"))return"switch";if(n==="grid")return"sensor";let t=P(n);return t&&t!=="scene"&&t!=="script"?t:"other"}var ga=new Set(["light","switch","fan"]),_a=n=>n!==null&&n!=="scene"&&n!=="script",C=n=>!n||n.state==="unavailable"||n.state==="unknown"&&!n.entity_id.startsWith("event."),sh=new Set(["motion","occupancy","presence","moving"]),ba=(n,e)=>e.startsWith("binary_sensor.")&&sh.has(String(n?.states[e]?.attributes.device_class??"")),pn=n=>!!n&&n.entity_id.startsWith("cover.")&&n.state==="unknown"&&n.attributes.assumed_state===!0,mr=(n,e)=>n.filter(t=>(!C(t)||pn(t))&&!e?.has(t.entity_id)).map(t=>t.entity_id);function O(n,e,t){let r=String(n?.states[e]?.attributes.friendly_name??n?.entities?.[e]?.name??e);if(!t||r.length<=t.length+1||!r.toLowerCase().startsWith(`${t.toLowerCase()} `))return r;let i=r.slice(t.length+1);return i[0].toUpperCase()+i.slice(1)}var ah=new Set(["running","printing","prepare","preparing","slicing","heating","busy","working","active","washing","rinsing","spinning","drying","cleaning","in_progress","in progress","on"]),pr=n=>!!n&&n.entity_id.startsWith("sensor.")&&n.attributes.device_class==="enum";function te(n){if(!n)return!1;if(n.entity_id.startsWith("vacuum."))return["cleaning","returning"].includes(n.state);if(n.entity_id.startsWith("valve."))return n.state==="open"||n.state==="opening";let e=P(n.entity_id);return e==="light"||e==="switch"||e==="fan"||e==="binary"?n.state==="on":e==="cover"?n.state==="open"||n.state==="opening":e==="climate"?["heating","cooling"].includes(String(n.attributes.hvac_action)):e==="media"?n.state==="playing":e==="lock"?n.state==="unlocked"||n.state==="open":e==="sensor"?pr(n)&&ah.has(n.state.toLowerCase()):!1}var ya=n=>Math.min(1,Math.max(0,n));function lh(n){let e=ya((n-2200)/4300),t=[1,.66,.26],r=[.78,.9,1];return[0,1,2].map(i=>t[i]+(r[i]-t[i])*e)}function We(n,e){if(!n||n.state!=="on")return null;let t=e&&!["unavailable","unknown"].includes(e.state)?e.attributes:n.attributes,r=typeof t.brightness=="number"?.2+.8*Math.sqrt(ya(t.brightness/255)):1,i=t.rgb_color;return i&&!["color_temp","brightness","onoff"].includes(String(t.color_mode))?{color:[i[0]/255,i[1]/255,i[2]/255],level:r}:typeof t.color_temp_kelvin=="number"?{color:lh(t.color_temp_kelvin),level:r}:{color:[1,.71,.28],level:r}}function va(n,e,t){let r=We(n,t);if(r)return r;for(let i of e){let o=We(i);if(o)return{color:o.color,level:o.level*.6}}return null}function Ht(n,e,t=null){if(n==="light"&&t==="floor")return 1.95;if(n==="light"&&t==="table")return 1.25;if(n==="light"&&t==="wall")return 1.95;switch(n){case"light":return Math.max(.5,e-.25);case"cover":return Math.min(2,e-.3);case"climate":return .6;case"media":return .9;case"binary":case"sensor":return 1.4;default:return 1.05}}var re=n=>n.config?.unit_system?.temperature==="\xB0F"?"\xB0F":"\xB0C";function fr(n,e){let t=String(e??"").replace(/\s/g,"").toLowerCase();return t==="\xB0f"||t==="\u2109"?(n-32)*5/9:t==="k"?n-273.15:n}var ce=(n,e)=>re(n)==="\xB0F"?e*9/5+32:e;var ch=new Set(["temperature","humidity","power","carbon_dioxide","energy","gas","water","volume","volume_storage","volume_flow_rate","illuminance","pressure","atmospheric_pressure","pm1","pm25","pm10","volatile_organic_compounds","volatile_organic_compounds_parts","carbon_monoxide","nitrogen_dioxide","moisture","sound_pressure"]),uh=new Set(["m\xB3","m3","L","l","kWh","Wh","MWh","lx"]),dh=new Set(["door","window","opening","garage_door","motion","occupancy","presence","smoke","moisture","gas","carbon_monoxide"]),hh=new Set(["battery","signal_strength","timestamp","date","duration","data_rate","data_size","frequency","enum"]);function nt(n,e){let t=n.entities?.[e];return t&&(t.area_id||(t.device_id?n.devices?.[t.device_id]?.area_id:null))||null}var xa=(n,e)=>{let t=n.entities?.[e];return!!(t?.hidden||t?.entity_category)},mh=(n,e)=>P(e)??Tt(e,n.states[e]);function wa(n,e){let t=n.states[e];if(!t||xa(n,e))return!1;if(Tt(e,t)!==null)return!0;let r=P(e);if(!r)return!1;let i=t.attributes.device_class;return e.startsWith("event.")?!i||i==="button"||i==="doorbell":r==="sensor"?i?ch.has(i):uh.has(String(t.attributes.unit_of_measurement??"")):r==="binary"?i?dh.has(i):!!n.entities?.[e]?.area_id:!0}function ph(n,e){let t=n.states[e];return P(e)!=="sensor"||!t?.attributes.unit_of_measurement||xa(n,e)||hh.has(String(t.attributes.device_class??""))?!1:Number.isFinite(Number(t.state))||C(t)}var _r=(n,e)=>e.startsWith("sensor.")&&n.states[e]?.attributes.device_class==="power",Ki=null;zt(()=>Ki=null);function Gi(n,e){let t=n.get(e);return t||n.set(e,t=[]),t}function fh(n){let e=new Map,t=new Map,r=new Map,i=new Map,o=[],s=u=>{(wa(n,u)||ph(n,u))&&_a(mh(n,u))&&o.push(u)};for(let[u,h]of Object.entries(n.entities??{})){let m=h.device_id;m&&h.area_id&&(i.get(m)??i.set(m,new Set).get(m)).add(h.area_id),m&&_r(n,u)&&Gi(t,m).push(u),m&&!h.hidden&&!h.entity_category&&(r.get(m)??r.set(m,new Set).get(m)).add(Bi(u));let d=nt(n,u);d===null?s(u):wa(n,u)&&Gi(e,d).push(u)}if(n.entities)for(let u of Object.keys(n.states))n.entities[u]||s(u);let a=Vi.indexOf("binary")-.5,l=u=>{let h=P(u),m=h?Vi.indexOf(h):a;return m>a&&Tt(u,n.states[u])!==null?a:m};o.sort((u,h)=>l(u)-l(h)||O(n,u).localeCompare(O(n,h)));for(let[u,h]of e){let m=n.areas?.[u]?.name;h.sort((d,g)=>l(d)-l(g)||O(n,d,m).localeCompare(O(n,g,m)))}let c=new Set;for(let[u,h]of i)h.size>1&&c.add(u);return{entities:n.entities,devices:n.devices,states:n.states,stateCount:Object.keys(n.states).length,byArea:e,powerByDevice:t,withoutArea:o,domainsByDevice:r,hubs:c}}function br(n){let e=Ki;return e&&e.entities===n.entities&&e.devices===n.devices&&(e.states===n.states||(e.states=n.states,Object.keys(n.states).length===e.stateCount))?e:Ki=fh(n)}function U(n,e){let t=gr(n,e.area_id);return e.sub_areas?.length?[...new Set([...t,...e.sub_areas.flatMap(r=>gr(n,r))])]:t}function gr(n,e){return!e||!n.entities?[]:br(n).byArea.get(e)??[]}var Ui=(n,e)=>!!n.entities&&br(n).hubs.has(e),yr=(n,e)=>n.entities?br(n).powerByDevice.get(e)??[]:[];function ji(n,e){let t=new Map;for(let i of e)Gi(t,n.entities?.[i]?.device_id??`entity:${i}`).push(i);let r=new Map(e.map((i,o)=>[i,o]));return[...t.values()].map(i=>{let o=i.find(s=>!n.entities?.[s]?.name)??i[0];return{primary:o,others:i.filter(s=>s!==o)}}).sort((i,o)=>r.get(i.primary)-r.get(o.primary))}var _t=(n,e)=>ji(n,e).map(t=>t.primary),gh={temperature:"temperature",humidity:"humidity",co2:"carbon_dioxide",illuminance:"illuminance"};function _h(n,e,t,r=!1){let i=n.states[e]?.attributes;if(!i)return!1;let o=(i.symcon_variable_type===1||i.symcon_variable_type===2)&&typeof i.symcon_id=="number";if(typeof i.symcon_id=="number"&&!o||!o&&!/^(sensor|input_number|number)\./.test(e))return!1;if(r&&o)return!0;let s=String(i.unit_of_measurement??"").replace(/\s/g,"").toLowerCase();return t==="temperature"&&["\xB0c","\xB0f","\u2103","\u2109","k"].includes(s)||t==="humidity"&&!i.device_class&&["%","%rh","%r.h.","%rf","%r.f."].includes(s)||t==="co2"&&s==="ppm"&&/co[₂2]/i.test(String(i.friendly_name??""))||t==="illuminance"&&["lx","lux"].includes(s)?!0:i.device_class===gh[t]}var bh=new Set(["climate","water_heater","switch","button","camera","media_player","vacuum","light","fan","lawn_mower"]),yh=["vorlauf","r(\xFC|ue)cklauf","flow","return","d(\xFC|ue)se","nozzle","hotend","extruder","druckbett","heatbed","(^|[^a-z])bed($|[^a-z])","chamber","cpu","gpu","chip","soc","akku","batter","wasser","water","kessel","boiler","au(\xDF|ss)en","outdoor","outside","abgas","exhaust","sole","brine","verdampfer","kondensat","verdichter","compressor","motor","k(\xFC|ue)hl","freezer","fridge","gefrier"],vh=new RegExp(`(${yh.join("|")})`,"i");function wh(n,e){let t=n.entities?.[e]?.device_id,r=t&&!Ui(n,t)?br(n).domainsByDevice.get(t):void 0;return r&&[...r].some(i=>bh.has(i))?!1:!vh.test(`${e} ${n.states[e]?.attributes.friendly_name??""}`)}function be(n,e,t,r){let i=t.climate?.[r];if(i==="none")return[];if(i)return[i].flat().filter(c=>n.states[c]);let o=(e?.placements??[]).filter(c=>c.entity_id.startsWith("sensor.")),s=o.filter(c=>H([c.x,c.z],t.points)).map(c=>c.entity_id),a=new Set(o.filter(c=>!H([c.x,c.z],t.points)).map(c=>c.entity_id));return[...new Set([...U(n,t).filter(c=>!a.has(c)),...s])].filter(c=>c.startsWith("sensor.")&&_h(n,c,r)&&wh(n,c))}function Z(n,e,t,r){let i=be(n,e,t,r).map(a=>{let l=n.states[a];if(!l||C(l)||!l.state.trim()&&l.attributes.symcon_numeric_value===void 0)return NaN;let c=Number(l?.attributes.symcon_numeric_value??l?.state);return r==="temperature"?fr(c,n.states[a]?.attributes.unit_of_measurement):c}).filter(Number.isFinite);if(i.length)return i.reduce((a,l)=>a+l,0)/i.length;if(t.climate?.[r]||r!=="temperature"&&r!=="humidity"||t.climate?.[r]==="none")return null;let o=r==="temperature"?"current_temperature":"current_humidity",s=U(n,t).filter(a=>a.startsWith("climate.")).map(a=>n.states[a]?.attributes[o]).filter(a=>typeof a=="number"&&Number.isFinite(a));return s.length?s.reduce((a,l)=>a+l,0)/s.length:null}function qi(n){let e=n.attributes;if(typeof e.symcon_numeric_value!="number")return null;let t=typeof e.symcon_min=="number"?e.symcon_min:0,r=typeof e.symcon_max=="number"&&e.symcon_max>t?e.symcon_max:100;return Math.max(0,Math.min(100,(e.symcon_numeric_value-t)/(r-t)*100))}function ka(n,e){let t=n.attributes.symcon_id;if(e==="light"&&n.attributes.symcon_variable_type===0&&typeof t=="number"){let i=n.attributes.symcon_value;return{...n,entity_id:`light.${t}`,state:n.state==="unavailable"||n.state==="unknown"?n.state:(typeof i=="boolean"?i:n.state==="on")?"on":"off",attributes:{...n.attributes,color_mode:"onoff",supported_color_modes:["onoff"],...n.entity_id!==`light.${t}`?{symcon_source_entity:n.entity_id}:{}}}}let r=qi(n);return r===null||typeof t!="number"?null:{...n,entity_id:`${e}.${t}`,state:e==="light"?r>0?"on":"off":r>0?"open":"closed",attributes:{...n.attributes,...e==="light"?{brightness:Math.round(r*2.55),color_mode:"brightness",supported_color_modes:["brightness"]}:{current_position:r,supported_features:4},...n.entity_id!==`${e}.${t}`?{symcon_source_entity:n.entity_id}:{}}}}function Pt(n,e){let t=e?n.states[e]:void 0;if(!t||C(t))return null;let r=t.attributes;if(r.nf_cover_control&&typeof r.current_position=="number")return r.current_position;let i=qi(t);if(i!==null)return i;if(typeof r.current_position=="number")return Math.max(0,Math.min(100,r.current_position));if(!t.state.trim())return null;let o=Number(t.state);if(!Number.isFinite(o))return null;let s=r.unit_of_measurement==="%"||o>1||o<0?o:o*100;return Math.max(0,Math.min(100,s))}var xh=new Set([void 0,"shutter","blind","awning","shade","curtain","window"]),kh=new Set(["garage","gate"]),Sh=new Set(["window","opening"]);function fn(n,e,t=!1){let r=new Map;return n.forEach((i,o)=>{let s=t&&e.length===1?e[0]:e[o];s&&r.set(i.id,s)}),r}var Sa=(n,e)=>n==="none"?null:n??e??null,rt=n=>n&&n!=="none"?n:null;function Be(n,e){let t=new Map;for(let r of e)for(let i of r.rooms){let o=r.openings.filter(_=>_.room_id===i.id).sort((_,b)=>_.edge-b.edge||_.offset-b.offset);if(o.length===0)continue;let s=U(n,i),a=_=>n.states[_]?.attributes.device_class,l=_=>s.filter(b=>P(b)==="binary"&&_(a(b)??"")),c=_=>o.filter(b=>b.type===_),u=fn(c("window"),s.filter(_=>P(_)==="cover"&&xh.has(a(_))),!0),h=fn(c("window"),l(_=>Sh.has(_))),m=fn(c("door"),l(_=>_==="door")),d=fn(c("garage"),s.filter(_=>P(_)==="cover"&&kh.has(a(_)??""))),g=fn(c("garage"),l(_=>_==="garage_door"));for(let _ of o){let b=_.type==="window"?u:_.type==="garage"?d:null,y=_.type==="window"?h:_.type==="garage"?g:m,S=_.leaves===2;t.set(_.id,{cover:Sa(_.cover,b?.get(_.id)),contact:_.sensor==="handle"&&_.contact==null?null:Sa(_.contact,y.get(_.id)),tilt:_.tilt==="none"?null:_.tilt,contact2:S?rt(_.contact2):null,tilt2:S?rt(_.tilt2):null,position:rt(_.position),positionInverted:!!_.position_inverted,tiltAngle:rt(_.tilt_angle),tiltMax:_.tilt_max??null,tiltOffset:_.tilt_offset??null,tiltInvert:!!_.tilt_invert,shut:!!_.shut,angled:_.type==="door"&&!!_.open_angle,lock:_.type==="door"?rt(_.lock):null,cover2:_.type==="garage"?null:rt(_.cover2),coverTilt:rt(_.cover_tilt),cover2Tilt:rt(_.cover2_tilt),coverInverted:!!_.cover_inverted,coverTiltInverted:!!_.cover_tilt_inverted,cover2Inverted:!!_.cover2_inverted,cover2TiltInverted:!!_.cover2_tilt_inverted})}}return t}var $h=[[/^(tilted|tilt|gekippt|kipp)/i,"tilted"],[/^(open|opened|offen|geöffnet|on)$/i,"open"],[/^(closed|close|geschlossen|zu|off)$/i,"closed"]];function Mh(n){if(!n||C(n))return null;let e=n.attributes.window_state;for(let t of[typeof e=="string"?e:"",n.state]){let r=t.trim(),i=r&&$h.find(([o])=>o.test(r));if(i)return i[1]}return null}var Ah=.5;function Ma(n,e){let t=Pt(n,e);return t===null?null:t/100}function Aa(n,e,t=!1){let r=e?n.states[e]:void 0;if(!r||C(r))return e?0:null;let i=r.attributes.current_position;if(typeof i=="number"){let o=1-Math.min(100,Math.max(0,i))/100;return t?1-o:o}return r.state==="closed"?t?0:1:r.state==="open"?t?1:0:r.state==="opening"||r.state==="closing"?.5:0}function $a(n,e,t,r=!1){let i=n.states[e||""],o=!!i?.attributes.nf_cover_control,s=o?i.attributes:n.states[t||e||""]?.attributes,a=s?.current_tilt_position??(!o&&t?s?.current_position:void 0),l=typeof a=="number"?Math.min(100,Math.max(0,a)):t?Pt(n,t):null;return l===null?null:(r?100-l:l)/100}function Eh(n,e){let t=Ma(n,e.position);if(t!==null){let i=e.positionInverted?t:1-t;return e.coverInverted?1-i:i}let r=e.cover?n.states[e.cover]:void 0;return r&&!C(r)?typeof r.attributes.current_position=="number"?Aa(n,e.cover,e.coverInverted):r.state==="closed"?e.coverInverted?0:1:r.state==="open"?e.coverInverted?1:0:r.state==="opening"||r.state==="closing"?.5:0:e.cover?0:null}function Zi(n,e){let t=e?n.states[e]?.state:void 0;return t==="unlocked"||t==="open"||t==="opening"}function Ve(n,e,t="window"){let r=g=>!!g&&n.states[g]?.state==="on",i=g=>!!g&&!!n.states[g]&&!C(n.states[g]),o=g=>g?Mh(n.states[g]):null,s=Eh(n,e),a=$a(n,e.cover,e.coverTilt,e.coverTiltInverted),l=$a(n,e.cover2,e.cover2Tilt,e.cover2TiltInverted),c={...e.cover2?{cover2:Aa(n,e.cover2,e.cover2Inverted)}:{},...a!==null?{slats:a}:{},...l!==null?{slats2:l}:{}};if(t==="door"){let g=o(e.contact);return{open:g===null?e.shut?0:e.angled?1:Ah:g==="closed"?0:1,open2:o(e.contact2)==="open"?1:0,tilt:0,tilt2:0,cover:s,...c,sensed:g!==null||s!==null,unlocked:Zi(n,e.lock),assumed:g===null}}if(t==="garage"){let g=s!==null||i(e.contact),_=Ma(n,e.position)!==null||i(e.cover),b=i(e.contact)?r(e.contact)?0:1:null;return{open:0,open2:0,tilt:0,tilt2:0,cover:(_?s:b??s)??1,sensed:g}}let u=r(e.tilt2)||o(e.tilt2)==="tilted"||o(e.contact2)==="tilted",h=r(e.tilt)||o(e.tilt)==="tilted"||o(e.contact)==="tilted",m=h?1:0,d=e.tiltAngle?Number(n.states[e.tiltAngle]?.state):NaN;if(Number.isFinite(d)){let g=(d-(e.tiltOffset??0))*(e.tiltInvert?-1:1);m=Math.min(1,Math.max(0,g/(e.tiltMax||15))),m<.08&&(m=0),h=m>0}return{open:o(e.contact)==="open"&&!h?1:0,open2:o(e.contact2)==="open"&&!u?1:0,tilt:m,tilt2:u?1:0,cover:s,sensed:i(e.contact)||i(e.tilt)||Number.isFinite(d),...c}}var Ea=/\b(tv|fernseh|television|fire ?tv|apple ?tv|chromecast|shield)/i,Ra=/(kühl|fridge|gefrier|freezer)/i,za=/(spülmaschine|geschirrspül|dishwasher)/i,Rh=/(kochfeld|herd|induktion|cooktop)/i,zh={robot_vacuum:/(saug|vacuum|robo|roomba|roborock|dreame|ecovacs|deebot)/i,tv_board:Ea,tv_wall:Ea,desk:/\b(pc|computer|rechner|desktop|monitor|workstation)/i,fridge:Ra,fridge_smart:Ra,stove:/(herd|kochfeld|cooktop|stove|induktion)/i,kitchen_tall:/(backofen|oven|ofen)/i,dishwasher:za,washer:/(waschmaschine|washer|washing)/i,dryer:/(trockner|dryer)/i,kitchen:/(kaffee|coffee|wasserkocher|kettle)/i,island:Rh,sink:za,radiator:/(heiz|radiator|thermostat|climate|hk|trv)/i},Ta={lamp_ceiling:/(decke|ceiling|haupt|main)/i,lamp_downlight:/(spot|strahler|downlight|einbau)/i,lamp_spot:/(spot|strahler)/i,lamp_panel:/(panel|decke|ceiling)/i,lamp_uplight:/(fluter|uplight|steh)/i,lamp_bollard:/(weg|garten|garden|path|poller|außen|aussen|outdoor)/i,lamp_garden:/(garten|garden|spot|außen|aussen|outdoor|baum|tree)/i,lamp_pendant:/(pendel|pendant|hänge|esstisch|dining)/i,ceiling_fan:/(ventilator|fan)/i,lamp_floor:/(steh|floor)/i,lamp_table:/(tisch|nacht|table|bedside|lese|reading)/i,lamp_wall:/(wand|wall)/i,led_strip:/(led|strip|streifen|leiste|band)/i},Da=new Set(["tv_board","tv_wall"]);var Ha=n=>Da.has(n)||!!na(n),Fa=n=>!!X(n)?.electric&&/speaker|multiroom|soundbar/.test(n.split(":").pop()??n),vr=n=>Ha(n)||n==="desk"||n==="fridge_smart",It=n=>!!n&&n!=="none";function Th(n,e){if(_r(n,e))return e;let t=n.entities?.[e]?.device_id;return t?yr(n,t).find(r=>r!==e)??null:null}var Fh=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function gn(n,e,t,r){return n.find(i=>e?.test(t(i)))??(r?n[0]??null:null)}function Ke(n,e){let t=new Map;for(let r of e){let i=new Set([...r.furniture.flatMap(o=>[o.entity,o.power,o.fan_entity]),...r.placements.map(o=>o.entity_id)].filter(It));for(let o of r.furniture){let s=o.type in Ta,a=ra(o.type),l=s?Ta[o.type]:zh[o.type];if(!l&&!a&&!Fa(o.type)&&o.entity==null&&o.power==null)continue;let c=Fh(r,o.x,o.z),u=(c?_t(n,U(n,c)):[]).filter(b=>!i.has(b)),h=b=>`${b} ${O(n,b)}`,m=b=>u.filter(y=>P(y)===b),d=o.entity==="none"?null:o.entity??null;if(o.entity==null){if(o.type==="ceiling_fan"){let b=(c?U(n,c):[]).filter(S=>!i.has(S)),y=new Set(b.filter(S=>P(S)==="fan").map(S=>n.entities?.[S]?.device_id).filter(Boolean));d=b.find(S=>P(S)==="light"&&y.has(n.entities?.[S]?.device_id))??gn(m("light"),l,h,!1)}else if(s)d=gn(m("light"),l,h,!0);else if(o.type==="robot_vacuum"){let b=c?.area_id??null;d=Object.keys(n.entities??{}).find(y=>y.startsWith("vacuum.")&&!i.has(y)&&nt(n,y)===b)??null}else if(o.type==="radiator"||a)d=gn(m("climate"),l,h,!0);else if(Ha(o.type)){let b=m("media");d=b.find(y=>n.states[y]?.attributes.device_class==="tv")??gn(b,l,h,Da.has(o.type))}else if(Fa(o.type)){let b=m("media").filter(y=>n.states[y]?.attributes.device_class!=="tv");d=gn(b,l,h,!1)??(b.length===1?b[0]:null)}else l&&(d=u.find(b=>["switch","media","fan"].includes(P(b)??"")&&l.test(h(b)))??null);d&&i.add(d)}let g=o.power==="none"?null:o.power??null;o.power==null&&(g=d?Th(n,d):null,!g&&l&&c&&!s&&(g=U(n,c).find(b=>_r(n,b)&&!i.has(b)&&l.test(h(b)))??null),g&&i.add(g));let _=null;if(o.type==="ceiling_fan"&&(_=o.fan_entity==="none"?null:o.fan_entity??null,o.fan_entity==null)){let b=(c?U(n,c):[]).filter(S=>P(S)==="fan"&&!i.has(S)),y=d?n.entities?.[d]?.device_id:void 0;_=(y?b.find(S=>n.entities?.[S]?.device_id===y):void 0)??b[0]??null,_&&i.add(_)}(d||g||_)&&t.set(o.id,{entity:d,power:g,...o.type==="ceiling_fan"?{fan:_}:{}})}}return t}function bt(n,e){let t=new Set,r=Ke(n,e),i=e.some(o=>o.openings.some(s=>s.confirm))?Be(n,e):null;for(let o of e){for(let s of o.placements)s.confirm&&t.add(s.entity_id);for(let s of o.openings){let a=s.confirm?i?.get(s.id)?.cover:null;It(a)&&t.add(a)}for(let s of o.furniture){let a=s.confirm?r.get(s.id)?.entity:null;It(a)&&t.add(a)}}return t}var Yi=n=>n==="fridge"||n==="fridge_smart"||/(fridge|freezer|kuehl|gefrier|chest_freezer)/.test(n.slice(n.lastIndexOf(":")+1)),Dh=8,Hh=-12;function Pa(n,e,t){let r=a=>{if(!It(a))return null;let l=n.states[a],c=l?Number(l.state):NaN;return Number.isFinite(c)?l.attributes.unit_of_measurement==="\xB0F"?(c-32)*5/9:c:null},i=r(e.temp_entity),o=r(e.temp_entity2);return i===null&&o===null?null:{text:[i,o].filter(a=>a!==null).map(t).join(" \xB7 "),warm:i!==null&&i>Dh||o!==null&&o>Hh}}var Ia=60;function Ca(n,e){if(!It(e))return null;let t=n.states[e],r=t?Number(t.state):NaN;return Number.isFinite(r)?t.attributes.unit_of_measurement==="\xB0F"?(r-32)*5/9:r:null}function Na(n,e){let t=i=>It(i)&&["on","open"].includes(n.states[i]?.state??""),r=new Map;for(let i of e.flatMap(o=>o.furniture))i.type==="fridge_smart"&&r.set(i.id,{left:t(i.door_left),right:t(i.door_right)});return r}function La(n,e,t){let r=(u,h)=>H([u,h],t.points),i=Ke(n,[e]),o=Be(n,[e]),s=new Set(t.hidden??[]),a=[...e.placements.filter(u=>!u.outside&&r(u.x,u.z)).map(u=>u.entity_id),...e.furniture.filter(u=>r(u.x,u.z)).flatMap(u=>[i.get(u.id)?.entity,i.get(u.id)?.power]),...e.openings.filter(u=>u.room_id===t.id).flatMap(u=>{let h=o.get(u.id);return h?[h.cover,h.cover2,h.contact,h.tilt,h.contact2]:[]}),...t.panel??[]],l=[...new Set(a.filter(u=>!!u&&!!n.states[u]))].filter(u=>!s.has(u)),c=new Set(l);return{shown:l,more:U(n,t).filter(u=>!c.has(u)&&!s.has(u))}}function _n(n,e,t=[]){let r=[];for(let i of e){let o=(a,l)=>i.rooms.some(c=>c.points.length>=3&&H([a,l],c.points)),s=Ke(n,[i]);r.push(...i.placements.filter(a=>a.outside||!o(a.x,a.z)).map(a=>a.entity_id)),r.push(...i.furniture.filter(a=>!o(a.x,a.z)).flatMap(a=>[s.get(a.id)?.entity,s.get(a.id)?.power]));for(let a of i.outdoor??[])a.area_id&&r.push(..._t(n,gr(n,a.area_id))),r.push(a.pump_entity,a.temp_entity)}return[...new Set(r.filter(i=>!!i&&!!n.states[i]&&!t.includes(i)))]}var Ph={soc:/(^|_)(soc|state_of_charge|battery_level|battery|ladestand|ladezustand|akku)($|_)/,range:/(^|_)(range|reichweite|remaining_range)($|_)/,charging:/(charging|charge_power|ladeleistung|laden|charger_power|lade)/,plugged:/(plug|cable|connected|stecker|kabel|angeschlossen)/,lock:/(lock|verriegel|schloss)/,climate:/(climat|preheat|precondition|hvac|heiz|klima|standheizung)/,tracker:/./},Ih=/^k?W$/,Ge=n=>n&&n!=="none"?n:null;function Ch(n,e){let t=e.car??{},r=Ge(t.device)??Ge(e.entity),i=r?n.entities?.[r]?.device_id:null,o=i&&n.entities?Object.values(n.entities).filter(m=>m.device_id===i).map(m=>m.entity_id):[],s=(m,d)=>String(n.states[m]?.attributes[d]??""),a=m=>`${m} ${s(m,"friendly_name")} ${n.entities?.[m]?.translation_key??""}`.toLowerCase().replace(/[\s-]+/g,"_"),l=(m,d,g=()=>!0)=>o.find(_=>d.includes(_.split(".")[0])&&Ph[m].test(a(_))&&g(_))??null,c=(m,d)=>o.find(g=>g.startsWith(`${m}.`)&&s(g,"device_class")===d)??null,u=m=>o.find(d=>d.startsWith(`${m}.`))??null,h=m=>s(m,"unit_of_measurement");return{soc:Ge(t.soc)??c("sensor","battery")??l("soc",["sensor"],m=>h(m)==="%"),range:Ge(t.range)??l("range",["sensor"],m=>/km|mi/.test(h(m)))??l("range",["sensor"]),charging:Ge(t.charging)??l("charging",["sensor"],m=>Ih.test(h(m)))??l("charging",["binary_sensor","switch"]),plugged:Ge(t.plugged)??c("binary_sensor","plug")??l("plugged",["binary_sensor"]),lock:Ge(t.lock)??u("lock")??l("lock",["binary_sensor"]),climate:Ge(t.climate)??u("climate")??l("climate",["switch","binary_sensor"]),tracker:Ge(t.tracker)??u("device_tracker")}}function Oa(n,e){return e.flatMap(r=>r.furniture).filter(r=>r.type==="parking"&&r.car).flatMap(r=>Object.values(Ch(n,r))).filter(r=>!!r)}var Wa=/(^|_)(current_room|current_segment|aktueller_raum|current_area)($|_)/;function wr(n,e,t){if(t==="none")return null;if(t)return t;let r=e?n.entities?.[e]?.device_id:null;return!r||!n.entities?null:Object.values(n.entities).find(o=>o.device_id===r&&o.entity_id.startsWith("sensor.")&&(Wa.test(o.translation_key??"")||Wa.test(o.entity_id.split(".")[1])))?.entity_id??null}function Ba(n){return n.toLowerCase().replace(/ä/g,"a").replace(/ö/g,"o").replace(/ü/g,"u").replace(/ß/g,"ss").replace(/ae/g,"a").replace(/oe/g,"o").replace(/ue/g,"u").normalize("NFD").replace(/[^a-z0-9]/g,"")}function Ji(n,e,t,r){let i=r?n.states[r]?.state:t?n.states[t]?.attributes.current_room:void 0;if(typeof i!="string"||["","unknown","unavailable"].includes(i))return null;let o=Ba(i);if(!o)return null;let s=l=>[l.name,l.area_id??"",l.area_id&&n.areas?.[l.area_id]?.name||""].map(Ba).filter(Boolean);return e.find(l=>s(l).includes(o))??e.find(l=>s(l).some(c=>c.length>=3&&(c.includes(o)||o.includes(c))))??null}var Nh=new Set(["garage","gate","door"]);function Qi(n,e){let t=new Set,r=new Set,i=o=>{if(!o||o==="none"||!n.states[o])return;let s=P(o);s==="light"&&t.add(o),s==="cover"&&!Nh.has(String(n.states[o].attributes.device_class??""))&&r.add(o)};for(let o of e.rooms){let s=new Set(o.hidden??[]);_t(n,U(n,o)).filter(a=>!s.has(a)).forEach(i)}return e.placements.forEach(o=>i(o.entity_id)),e.furniture.forEach(o=>i(o.entity)),{lights:[...t],covers:[...r]}}function Va(n){let e=n.split(".")[0];switch(e){case"scene":case"script":return[e,"turn_on"];case"automation":return[e,"trigger"];case"button":case"input_button":return[e,"press"];default:return["homeassistant","toggle"]}}function Xi(n,e,t){let r=t.target?.trim()??"",i=(o,s)=>e.dispatchEvent(new CustomEvent(o,{detail:s,bubbles:!0,composed:!0}));switch(t.action){case"navigate":if(!r)return;history.pushState(null,"",r),window.dispatchEvent(new CustomEvent("location-changed",{detail:{replace:!1}}));return;case"more_info":r&&i("hass-more-info",{entityId:r});return;case"service":{if(!r.includes("."))return;let[o,s]=r.split(".",2);n.callService(o,s,t.data??{});return}case"fire_dom_event":i("ll-custom",t.data??{});return}}function Ka(n,e){let t=e.data?.entity_id,r=e.state_entity||(e.action==="more_info"?e.target:null)||(e.action==="service"&&typeof t=="string"?t:null),i=r?n?.states[r]:void 0;return!!i&&["on","open","playing","home","heat","cool","unlocked"].includes(i.state)}var Lh=[.25,.9,.45],Oh=[1,.82,.55];function Wh(n,e){let t=n.states[e],r=Number(t?.attributes.current_power_w??t?.attributes.power??NaN);return Number.isFinite(r)?r:null}function Ga(n,e,t){let r=[];return e.forEach((i,o)=>{if(!i||i==="none")return;let s=n.states[i];if(!s||C(s))return;if(P(i)==="light"){let c=We(s);c&&r.push({gang:o,color:c.color,level:c.level});return}if(!te(s)&&s.state!=="on")return;let a=t?Wh(n,i):null,l=a===null?.8:Math.min(1,.45+Math.sqrt(Math.max(0,a))/40);r.push({gang:o,color:t?Lh:Oh,level:l})}),r}var eo=(n,e)=>(n??[]).slice(0,e).filter(t=>!!t&&t!=="none");var Bh=864e5,to=n=>{let e=new Date(n);return e.setHours(0,0,0,0),e.getTime()};function Vh(n,e){let t=/(\d{4})-(\d{2})-(\d{2})/.exec(n);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3])).getTime();if(t=/(\d{1,2})\.(\d{1,2})\.(\d{4}|\d{2})?/.exec(n),t){let r=t[3]?t[3].length===2?2e3+Number(t[3]):Number(t[3]):new Date(e).getFullYear(),i=new Date(r,Number(t[2])-1,Number(t[1])).getTime();return!t[3]&&it)return Math.ceil((c-t)/6e4);continue}let s=/^(\d+):(\d{2})(?::(\d{2}))?$/.exec(i.state.trim());if(s){let c=s[3]!==void 0?Number(s[1])*60+Number(s[2])+Number(s[3])/60:Number(s[1])*60+Number(s[2]);if(c>0)return Math.ceil(c);continue}let a=Number(i.state);if(!Number.isFinite(a)||a<=0)continue;let l=String(o.unit_of_measurement??"min").toLowerCase();return Math.ceil(l==="h"?a*60:l==="s"?a/60:a)}return null}function bn(n,e){let t=e?n.entities?.[e]?.device_id:null;return t&&n.entities?Object.values(n.entities).filter(r=>r.device_id===t).map(r=>r.entity_id):[]}var qa=n=>n<60?`${n} min`:`${Math.floor(n/60)} h ${String(n%60).padStart(2,"0")} min`;function kr(n,e,t){for(let r of e)for(let i of r.placements)if(i.entity_id===t&&i.cover_tilt&&i.cover_tilt!=="none")return i.cover_tilt;for(let r of Be(n,e).values()){if(r.cover===t&&r.coverTilt)return r.coverTilt;if(r.cover2===t&&r.cover2Tilt)return r.cover2Tilt}return null}function Sr(n,e,t){if(e.attributes.nf_cover_control||!t)return e;let r=n.states[t]?.attributes,i=r?.current_tilt_position??r?.current_position;return typeof i!="number"?e:{...e,attributes:{...e.attributes,current_tilt_position:i,supported_features:Number(e.attributes.supported_features??0)|128}}}function Gh(n,e){let t=e?n.states[e]:void 0;if(!t||C(t))return null;let r=t.attributes.current_position;return typeof r=="number"?Math.min(100,Math.max(0,r)):t.state==="open"?100:t.state==="closed"?0:t.state==="opening"||t.state==="closing"?50:null}function Za(n,e){let t=new Map;for(let r of e.floors.flatMap(i=>i.furniture)){let i=X(r.type);if(!i||!ir(i))continue;let o=r.cover_entity?Gh(n,r.cover_entity):null;t.set(r.id,ta(i,o!==null&&r.cover_inverted?100-o:o))}return t}var Uh={view:"3D",editor:"Editor",all_floors:"Alle Etagen",outside_area:"Au\xDFen",outside_area_hint:"Alle Ger\xE4te drau\xDFen auf einen Blick: im Garten, au\xDFerhalb der R\xE4ume, und was zu Au\xDFen geh\xF6rt (etwa die Wetterstation auf dem Dach).",device_outside:"Geh\xF6rt zu Au\xDFen",device_outside_hint:"Das Ger\xE4t z\xE4hlt nicht zum Raum darunter (eine Wetterstation auf dem Dach) und steht im Au\xDFen-Panel.",no_building:"Noch kein Grundriss vorhanden.",no_building_admin:"Noch kein Grundriss vorhanden. Im Editor zeichnest du deine erste Etage.",no_rooms_admin:"Die Etagen sind angelegt, aber es gibt noch keinen Raum. W\xE4nde allein reichen nicht: Zeichne im Editor mit \u201ERechteck\u201C oder \u201EFreie Form\u201C mindestens einen Raum.",open_editor:"Editor \xF6ffnen",loading:"L\xE4dt \u2026",load_error:"Laden fehlgeschlagen",saving:"Speichert \u2026",saved:"Gespeichert",save_error:"Speichern fehlgeschlagen",save_failed_detail:"Speichern fehlgeschlagen: {error}. Deine \xC4nderungen bleiben in diesem Browser erhalten.",needs_restart:"Eine neue Version von NextFloor ({frontend}) ist installiert, aber Home Assistant l\xE4uft noch mit {version}. Bitte Home Assistant neu starten \u2013 bis dahin kann das Speichern fehlschlagen.",needs_reload:"Diese Seite zeigt noch NextFloor {frontend}, Home Assistant hat schon {backend}. Bitte die Seite neu laden; in der Companion-App: Einstellungen \u2192 Companion-App \u2192 Frontend-Cache zur\xFCcksetzen.",reload_page:"Neu laden",symcon_variables_reload:"Variablen neu laden",symcon_cover_position:"Position (Behang)",climate_card:"Raumklima als schwebende Karte",climate_card_hint:"Zeigt Temperatur, Luftfeuchtigkeit und CO\u2082 \xFCber diesem Raum. In der 3D-Ansicht lassen sie sich \xFCber \u201EKarten\u201C ein- und ausblenden.",climate_card_missing:"Keine aktuellen Messwerte",furniture_power_card:"Leistung als 3D-Kachel",furniture_power_card_hint:"Zeigt den Leistungswert \xFCber diesem M\xF6belst\xFCck, auch ohne verkn\xFCpfte Schaltvariable. Die Kachel bleibt bei 0 W sichtbar. Bei archivierten Variablen \xF6ffnet das Trendsymbol den Verlauf. Der Schalter \u201EKarten\u201C blendet die schwebenden Kacheln gemeinsam ein und aus.",climate_illuminance:"Helligkeit",device_values:"Zus\xE4tzliche Werte",device_value:"Datenpunkt",device_value_add:"Wert hinzuf\xFCgen",device_value_remove:"Wert entfernen",device_value_icon:"Symbol",device_value_label:"Bezeichnung (optional)",device_values_hint:"\xDCber + weitere Datenpunkte ausw\xE4hlen, zum Beispiel mehrere Temperaturen oder andere Messwerte. Als Symbol eignen sich Emojis oder kurze Zeichen wie \u{1F321}, \u{1F4A7}, \u2601 oder \u26A1. Die Werte erscheinen am Ger\xE4t und im Raumfenster.",cover_tilt_entity:"Lamellenposition",cover_direction_invert:"Behang in 3D umkehren",cover_tilt_direction_invert:"Lamellen in 3D umkehren",cover2_direction_invert:"Zweiten Behang in 3D umkehren",cover2_tilt_direction_invert:"Lamellen des zweiten Behangs in 3D umkehren",cover_direction_hint:"Die Umkehrung betrifft nur die 3D-Darstellung. Zahlenwerte, Regler und Steuerbefehle bleiben unver\xE4ndert: Ein empfangener Wert von 0 wird weiterhin als 0 angezeigt und ein eingestellter Wert von 0 als 0 gesendet.",cover2_tilt_entity:"Lamellenposition (zweiter Behang)",symcon_variables_loading:"Variablen werden geladen \u2026",symcon_variables_loaded:"Variablen und Objektbaum wurden neu geladen.",symcon_variables_error:"Variablen konnten nicht neu geladen werden: {error}",needs_restart_old:"Eine neue Version von NextFloor ist installiert, aber Home Assistant l\xE4uft noch mit einer \xE4lteren. Bitte Home Assistant neu starten \u2013 bis dahin schl\xE4gt das Speichern fehl.",draft_found:"Nicht gespeicherte \xC4nderungen vom {time} gefunden.",draft_restore:"\xDCbernehmen und speichern",draft_discard:"Verwerfen",walls_auto:"W\xE4nde hoch",walls_cut:"Schnitt",walls_slope:"Schr\xE4g",walls_slope_hint:"W\xE4nde schr\xE4g abgeschnitten: vorne halbhoch, hinten voll \u2013 wie ein Puppenhaus, dreht mit der Kamera",walls_solid:"Massiv",walls_solid_hint:"Massive W\xE4nde in ihren Farben statt Glas (Farben: Editor \u2192 Einstellungen, pro Raum im Raum)",wall_paint_outside:"Wandfarbe au\xDFen",wall_paint_inside:"Wandfarbe innen",furn_color_body:"M\xF6belfarbe Korpus",furn_color_wood:"M\xF6belfarbe Holz",furn_color_fabric:"M\xF6belfarbe Stoff",furn_color_white:"M\xF6belfarbe Wei\xDF",furn_color_metal:"M\xF6belfarbe Metall",furn_color_dark:"M\xF6belfarbe Dunkel",furn_color_hint:"Die M\xF6bel sind aus wenigen Materialien gebaut, auch die aus dem M\xF6belbauer und den Paketen. Hier bekommt jedes Material eine Farbe f\xFCr das ganze Haus; eine Karte kann eigene Farben setzen. Am st\xE4rksten sieht man sie im Look Neon, Tag und Blaupause f\xE4rben sie nur leicht.",wall_paint_room:"Wandfarbe innen (dieser Raum)",wall_paint_floor:"Wandfarbe au\xDFen (diese Etage)",wall_paint_hint:"Gilt in der 3D-Ansicht \u201EMassiv\u201C.",wall_paint_default:"Standard",card_solid_walls:"Massive W\xE4nde (in ihren Farben)",reset_view:"\xDCbersicht",back:"Zur\xFCck",floor:"Etage",floors:"Etagen",add_floor:"Etage hinzuf\xFCgen",floor_from_ha:"Etagen aus Home Assistant:",floor_empty:"Leere Etage",level:"Ebene {n}",ha_floor:"Etage in Home Assistant",floor_layer:"Ebene (ein- und ausblendbar)",floor_power:"Etagen-Z\xE4hler (Leistung)",floor_power_hint:"Ein Leistungssensor nur f\xFCr diese Etage (ein Unterz\xE4hler, eine Wohnung). Sein Wert steht auf dem Etagen-Schild und in der Ansicht dieser Etage auf der Haus-Karte, mit seinem Anteil am Verbrauch des Hauses.",floor_power_share:"{n} % vom Haus",living_area:"Wohnfl\xE4che {living}",room_living:"Z\xE4hlt zur Wohnfl\xE4che",living_area_none:"Keine Wohnfl\xE4che \xB7 Grundfl\xE4che {floor}",living_area_low:"Wohnfl\xE4che {living} (Grundfl\xE4che {floor}, davon {low} unter 2 m H\xF6he)",living_area_hint:"Gerechnet wie die Wohnfl\xE4chenverordnung: die Fl\xE4che innerhalb der W\xE4nde, voll ab 2 m lichter H\xF6he, zur H\xE4lfte zwischen 1 und 2 m (unter Schr\xE4gen), unter 1 m gar nicht. Ein Richtwert, kein Aufma\xDF.",living_area_floor:"Wohnfl\xE4che: {floor}",living_area_floor_house:"Wohnfl\xE4che dieser Etage: {floor} \xB7 ganzes Haus: {house}",print_plan:"Plan drucken / PDF",print_plan_hint:"Jede Etage als sauberer Plan mit Ma\xDFen und Fl\xE4chen, dazu eine Fl\xE4chentabelle \u2013 zum Drucken oder im Druckdialog als PDF speichern.",print_title:"Grundriss",print_room:"Raum",print_floor_area:"Grundfl\xE4che",print_living:"Wohnfl\xE4che",print_low:"unter 2 m",print_total:"Summe",print_blocked:"Das Druckfenster wurde blockiert \u2013 bitte Pop-ups f\xFCr Home Assistant erlauben.",check_open:"Plan pr\xFCfen",note:"Notiz",note_add:"Notiz hier",note_text:"Text",note_placeholder:"z. B. \u201EFilter wechseln\u201C oder \u201ESicherung 12\u201C",note_due:"F\xE4llig am",note_height:"H\xF6he \xFCber dem Boden (m)",note_height_hint:"Wo der Pin in der 3D-Ansicht schwebt: 1,3 m ist Augenh\xF6he, mehr f\xFCr etwas unter der Decke (ein Absperrventil, eine Klappe).",note_photo_upload:"Foto hinzuf\xFCgen",note_photo_hint:"Das Foto erscheint, wenn man die Notiz in der 3D-Ansicht antippt, z. B. wie das Ventil aussieht.",note_due_hint:"Ab diesem Tag wird der Pin orange.",note_is_due:"Diese Notiz ist f\xE4llig.",keys_title:"Tasten im Editor",keys_undo:"R\xFCckg\xE4ngig",keys_redo:"Wiederholen",keys_duplicate:"Raum verdoppeln",keys_delete:"Auswahl l\xF6schen",keys_nudge:"Auswahl um einen Rasterschritt verschieben",keys_nudge_10:"\u2026 um 10 cm",keys_nudge_1:"\u2026 um 1 cm",keys_rotate:"M\xF6bel um 90\xB0 drehen (Shift: zur\xFCck)",keys_lock:"M\xF6bel, Ger\xE4t oder Dachteil festsetzen / l\xF6sen",keys_close_shape:"Freie Form schlie\xDFen",keys_escape:"Abbrechen, Werkzeug verlassen, Auswahl aufheben",keys_straight:"Beim Zeichnen: gerade Linien",keys_sheet:"Diese \xDCbersicht",tour_title:"Erste Schritte",tour_1_title:"R\xE4ume zeichnen",tour_1:"Mit \u201E{rect}\u201C oder \u201E{free}\u201C zeichnest du die R\xE4ume; die W\xE4nde entstehen von selbst. Ordne jedem Raum seinen Home-Assistant-Bereich zu \u2013 dann findet NextFloor seine Ger\xE4te. Hast du schon Bereiche, legt \u201E{rooms}\u201C im Etagenformular sie auf einmal an.",tour_2_title:"T\xFCren und Fenster",tour_2:"\u201E{opening}\u201C setzt sie auf eine Wand. Verkn\xFCpfe ihren Kontakt oder Rollladen \u2013 in 3D gehen sie dann mit auf und zu, und offene Fenster melden sich.",tour_3_title:"M\xF6bel und Ger\xE4te",tour_3:"\u201E{furniture}\u201C \xF6ffnet die Bibliothek \u2013 oder baue eigene St\xFCcke in der \u{1F6E0}\uFE0F M\xF6bel-Werkstatt. W\xE4hlst du einen Raum, stehen darunter die Ger\xE4te seines Bereichs zum Platzieren bereit; Lampen leuchten dann in der Farbe ihres Lichts.",tour_4_title:"Ansehen und pr\xFCfen",tour_4:"\u201E{split}\u201C zeigt dein Haus beim Zeichnen; oben wechselst du in die 3D-Ansicht. \u201E{check}\u201C listet, was noch fehlt \u2013 und mit ? siehst du jederzeit die Tasten.",tour_next:"Weiter",tour_back:"Zur\xFCck",tour_done:"Los geht's",tour_skip:"\xDCberspringen",check_open_hint:"Listet, was im Plan fehlt oder schief ist, mit einer L\xF6sung per Tipp.",check_title:"Plan-Pr\xFCfung",check_all_good:"Alles in Ordnung \u2013 nichts gefunden.",check_hint:"{n} Punkte gefunden. Blaue Kn\xF6pfe \xE4ndern den Plan (R\xFCckg\xE4ngig geht wie immer), die anderen zeigen die Stelle.",check_room_no_area:"\u201E{room}\u201C hat keinen Home-Assistant-Bereich: seine Ger\xE4te werden nicht gefunden.",check_room_no_area_named:"\u201E{room}\u201C hat keinen Bereich \u2013 der freie Bereich \u201E{area}\u201C hei\xDFt genauso.",check_areas_unplaced:"{n} Bereiche dieser Etage haben noch keinen Raum: {names}",check_devices_unplaced:"\u201E{room}\u201C: {n} Ger\xE4te des Bereichs stehen noch nicht im Plan.",check_rooms_overlap:"\u201E{a}\u201C und \u201E{b}\u201C liegen \xFCbereinander.",check_opening_off_wall:"Eine T\xFCr oder ein Fenster in \u201E{room}\u201C sitzt auf keiner Wand.",check_entity_missing:"{n} Ger\xE4te-Pins zeigen auf Entit\xE4ten, die Home Assistant nicht mehr kennt ({ids}).",check_furniture_entity_missing:"Ein M\xF6bel ist mit {id} verkn\xFCpft \u2013 die Entit\xE4t gibt es nicht mehr.",check_battery_low:"Batterie schwach: {name} ({level} %)",battery_low_n:"Batterie schwach: {names}",check_standby:"{name} zieht {w} W, obwohl aus \u2013 etwa {cost} im Jahr.",check_fix_show:"Zeigen",check_fix_ignore:"Ignorieren",check_show_devices:"{n} Ger\xE4te ansehen",check_ignore_all:"Alle {n} ignorieren",check_reset_ignored:"{n} ignorierte Ger\xE4te wieder pr\xFCfen",check_fix_set_area:"\u201E{area}\u201C zuordnen",check_fix_add_rooms:"R\xE4ume anlegen",check_fix_place:"{n} setzen",check_fix_remove:"{n} entfernen",floor_layer_hint:"Diese Etage ist kein Geschoss, sondern eine Ebene \u2013 z. B. alle B\xE4ume oder die Deko. Die 3D-Ansicht zeigt oben ein Auge, mit dem du sie auf jedem Ger\xE4t ein- und ausblendest.",no_ha_floor:"\u2013 keine \u2013",area_rooms:"R\xE4ume aus HA-Bereichen anlegen ({n})",area_rooms_hint:"Legt f\xFCr jeden Bereich dieser Etage einen Raum an (4 \xD7 3 m) \u2013 danach an die richtige Stelle ziehen und die Ecken anpassen",floor_name:"Name",elevation:"H\xF6he \xFCber Boden (m)",floor_shift:"Etage verschieben (m)",floor_shift_apply:"Verschieben",floor_shift_hint:"Verschiebt alle R\xE4ume, M\xF6bel, Ger\xE4te, Au\xDFenfl\xE4chen, freien W\xE4nde und das Hintergrundbild dieser Etage um X und Z. Dachfl\xE4chen bleiben liegen.",height:"Raumh\xF6he (m)",cut_height:"Schnitth\xF6he (m)",delete_floor:"Etage l\xF6schen",floor_copy:"Etage duplizieren",floor_copy_hint:"Die Kopie kommt oben aufs Haus, mit allen R\xE4umen, W\xE4nden, T\xFCren und Fenstern. R\xE4ume und Etage verlieren ihre Verkn\xFCpfung mit Home Assistant, M\xF6bel ihre Entit\xE4ten; Energieger\xE4te bleiben auf der alten Etage.",floor_copy_furniture:"M\xF6bel mitnehmen",floor_copy_devices:"Ger\xE4te-Pins mitnehmen",floor_copy_devices_hint:"Dieselbe Entit\xE4t steht dann auf beiden Etagen.",floor_copy_outdoor:"Au\xDFenfl\xE4chen mitnehmen",floor_copy_make:"Kopie anlegen",floor_copy_name:"{name} (Kopie)",furn_to_floor:"Auf Etage verschieben",furn_to_floor_hint:"Das M\xF6bel wandert an dieselbe Stelle auf der gew\xE4hlten Etage.",delete_floor_confirm:"Etage \u201E{name}\u201C mit allen R\xE4umen l\xF6schen?",move_up:"Nach oben",move_down:"Nach unten",default_floor:"Erdgeschoss",new_floor:"Etage {n}",tool_select:"Ausw\xE4hlen",tool_rect:"Rechteck",tool_polygon:"Freie Form",undo:"R\xFCckg\xE4ngig",redo:"Wiederholen",fit:"Alles zeigen",room:"Raum",rooms:"R\xE4ume",room_name:"Name",area:"Bereich",no_area:"Kein Bereich",sub_area_add:"+ Bereich im Raum",sub_area_hint:"Ein Teil des Raums mit eigenem Home-Assistant-Bereich, aber ohne eigene W\xE4nde \u2013 eine Leseecke, ein Regal, eine K\xFCchenzeile im Wohnraum. Seine Ger\xE4te und Sensoren geh\xF6ren zu diesem Raum.",material:"Boden",x:"X (m)",z:"Y (m)",width:"Breite (m)",depth:"Tiefe (m)",points:"Eckpunkte",delete_point:"Punkt l\xF6schen",duplicate:"Duplizieren",delete:"L\xF6schen",new_room:"Raum {n}",settings:"Einstellungen",pendant_shape:"Form",pendant_shade:"Schirm",paint_colour:"Lackfarbe",pendant_globe:"Kugel",pendant_cone:"Kegel",pendant_drum:"Trommel",sofa_shape:"Form",sofa_straight:"Gerade",sofa_l:"L-Form (Spiegeln: andere Seite)",sofa_u:"U-Form",pkg_open:"Einrichten \u2026",pkg_hint:"Die M\xF6bel kommen an die W\xE4nde des Raums; Leuchten verbinden sich mit den Lichtern des Bereichs. Danach einzeln anpassen \u2013 Strg+Z nimmt alles zur\xFCck.",pkg_done:"{n} M\xF6bel gesetzt \u2013 Strg+Z nimmt es zur\xFCck.",pkg_kitchen_row:"K\xFCchenzeile",pkg_kitchen_row_desc:"Zeile an der R\xFCckwand mit K\xFChlschrank, Backofen, Sp\xFCle, Sp\xFClmaschine und Herd, Oberschrank, Esstisch mit Pendelleuchte",pkg_kitchen_l:"K\xFCche in L-Form",pkg_kitchen_l_desc:"Zeile hinten und links, Kochinsel mit Barhockern",pkg_bath:"Bad",pkg_bath_desc:"Waschtisch, WC, Badewanne, Waschmaschine, Einbauspot",pkg_bedroom:"Schlafzimmer",pkg_bedroom_desc:"Doppelbett mit zwei Nachttischen, Schrank, Kommode, Deckenleuchte",pkg_living:"Wohnzimmer",pkg_living_desc:"TV-Board, Sofa, Couchtisch, Teppich, Sessel, Regal, Stehlampe, Pflanze",pkg_dining:"Esszimmer",pkg_dining_desc:"Esstisch mit vier St\xFChlen, Sideboard, Pendelleuchte",pkg_office:"B\xFCro",pkg_office_desc:"Schreibtisch mit B\xFCrostuhl, zwei Regale, Deckenleuchte",pkg_kids:"Kinderzimmer",pkg_kids_desc:"Einzelbett, Schreibtisch, Regal, Teppich",pkg_hall:"Flur",pkg_hall_desc:"Garderobe, zwei Einbauspots",spots_place:"Spots setzen",spots_type:"Leuchte",spots_cols:"Spalten (links\u2013rechts)",spots_rows:"Reihen (vorne\u2013hinten)",spots_add:"{n} Leuchten setzen",spots_placed:"{n} Leuchten gesetzt.",spots_hint:"Alle Leuchten folgen dem gew\xE4hlten Licht (z. B. Spots an einem Dimmer). Einzeln verschieben und ein anderes Licht w\xE4hlen geht danach wie bei jedem M\xF6bel.",cancel:"Abbrechen",backup:"Sicherung",backup_history:"Wiederherstellungspunkte",share_view:"Ansicht teilen",share_view_hint:"Speichert das Haus als kleine Datei, die in jedem Browser ohne Home Assistant aufgeht (\xFCber die Online-Demo von NextFloor) \u2013 zum Zeigen f\xFCr Familie oder Planer. Ohne Ger\xE4te und Entit\xE4ten, wie eine Vorlage.",share_view_title:"Unser Haus in NextFloor",share_view_needs_js:"Diese Seite braucht JavaScript und eine Internetverbindung.",share_view_file:"ansicht",share_view_done:"Ansicht gespeichert \u2013 die Datei im Browser \xF6ffnen oder weitergeben.",version_save:"Stand speichern \u2026",version_save_hint:"H\xE4lt den Plan unter einem Namen fest (\u201Evor dem Umbau\u201C). Benannte St\xE4nde bleiben, wenn die automatischen Wiederherstellungspunkte gehen.",version_name_prompt:"Name f\xFCr diesen Stand (z. B. \u201Evor dem Umbau\u201C):",version_saved:"Stand \u201E{name}\u201C gespeichert.",version_compare:"Vergleichen",version_delete_confirm:"\u201E{name}\u201C l\xF6schen?",version_same:"Kein Unterschied zum Plan.",version_diff_n:"{n} Unterschiede zum Plan, wie er jetzt ist:",diff_floor_added:"Etage \u201E{name}\u201C neu",diff_floor_removed:"Etage \u201E{name}\u201C entfernt",diff_room_added:"Raum \u201E{name}\u201C neu",diff_room_removed:"Raum \u201E{name}\u201C entfernt",diff_room_renamed:"\u201E{detail}\u201C hei\xDFt jetzt \u201E{name}\u201C",diff_room_reshaped:"\u201E{name}\u201C umgeformt ({detail} m\xB2)",diff_opening_added:"{name} neu ({detail})",diff_opening_removed:"{name} entfernt ({detail})",diff_furniture_added:"{name} neu",diff_furniture_removed:"{name} entfernt",diff_furniture_moved:"{name} verschoben oder ge\xE4ndert",diff_device_added:"Ger\xE4t {name} gesetzt",diff_device_removed:"Ger\xE4t {name} entfernt",diff_device_moved:"Ger\xE4t {name} verschoben",backup_none:"Noch keine. Beim Bearbeiten entsteht h\xF6chstens alle 10 Minuten ein Punkt.",backup_summary:"{rooms} R\xE4ume, {furniture} M\xF6bel",backup_restore:"Wiederherstellen",backup_restore_confirm:"Den Stand vom {time} wiederherstellen? Der jetzige Stand bleibt als Wiederherstellungspunkt erhalten.",backup_restored:"Wiederhergestellt.",backup_file:"Datei",backup_export:"Exportieren",backup_export_share:"Als Vorlage teilen",backup_export_share_hint:"Ohne Bereiche, Ger\xE4te, Sensoren und Bilder \u2013 zum Weitergeben an andere.",backup_import:"Importieren \u2026",backup_import_confirm:"Den ganzen Grundriss durch die Datei ersetzen? Der jetzige Stand bleibt als Wiederherstellungspunkt erhalten.",backup_import_error:"Die Datei ist kein NextFloor-Plan ({error}).",backup_imported:"Importiert.",backup_hint:"Hintergrundbilder sind nicht in der Datei enthalten.",backup_full:"Komplett-Backup",backup_full_export:"Alles sichern (Plan, Bilder, Packs)",backup_full_import:"Komplett-Backup wiederherstellen \u2026",backup_full_hint:"Eine Datei mit dem Plan, allen Hintergrund- und Bildschirmbildern und den installierten Packs. Beim Wiederherstellen wird jedes Pack erneut gepr\xFCft; der Lizenzschl\xFCssel ist nicht enthalten.",backup_full_confirm:"Plan, Bilder und Packs durch das Backup ersetzen? Der aktuelle Stand bleibt als Wiederherstellungspunkt erhalten.",backup_full_not_backup:"Das ist kein Komplett-Backup von NextFloor.",backup_full_restored:"Backup wiederhergestellt: {packs} Packs, {pictures} Bilder.",backup_full_skipped:"\xDCbersprungen (nicht lesbar): {packs}.",export_name_full:"komplett",device_confirm:"Vor dem Schalten nachfragen",device_confirm_hint:"Beim Antippen in 3D, im Schnellmen\xFC und im Raumfenster erscheint erst eine R\xFCckfrage. Doppeltipp auf den Raum l\xE4sst dieses Ger\xE4t aus.",cover_confirm_hint:"Auf, Zu und Positionen fragen im Schnellmen\xFC und im Raumfenster erst nach, und Wischen \xFCber das Symbol bewegt den Rollladen nicht mehr (es dreht dann die Ansicht). Stopp fragt nie.",blind_kind:"Art des Behangs",blind_roller:"Rollladen au\xDFen",blind_venetian:"Raffstore mit Lamellen",blind_inside:"Rollo innen",cover2_entity:"Zweiter Rollladen (rechte H\xE4lfte)",cover_my:"Lieblingsposition \u201EMy\u201C (%, 0 = keine)",cover_my_go:"Zur Lieblingsposition ({p} %)",blind_hint:"Ein Raffstore dreht seine Lamellen in 3D mit der Lamellenstellung des Rollladens; ein Rollo innen h\xE4ngt hinter dem Glas. Ein breites Fenster kann f\xFCr seine rechte H\xE4lfte einen zweiten Rollladen haben. Die Lieblingsposition erscheint als \u201EMy\u201C im Schnellmen\xFC: ein Rollladen mit Positionen f\xE4hrt dorthin, ein Somfy-RTS-Motor ohne R\xFCckmeldung f\xE4hrt mit Stopp in seine eigene My-Stellung.",confirm_switch:"{name} wirklich schalten?",lock_confirm_unlock:"{name} wirklich aufschlie\xDFen?",gang_switch_one:"Schaltet",furn_cover_entity:"Bewegt sich mit",furn_cover_hint:"Vorhang, Leinwand, Markise oder Tor folgen dieser Cover-Entit\xE4t (Rollladen, Vorhang, Markise, Tor) und fahren mit ihr. Ein Tipp \xF6ffnet ihr Men\xFC (auf, Stopp, zu).",furn_cover_inverted:"Laufrichtung umkehren",furn_cover_inverted_hint:"F\xFCr eine Markise oder einen Vorhang, die im Plan genau andersherum fahren als in Wirklichkeit: ausgefahren zeigt dann eingefahren und umgekehrt.",gang_switch:"Taste {n} schaltet",gang_socket_one:"Steckdose an",gang_socket:"Steckdose {n} an",gang_switch_hint:"Eine Taste leuchtet, solange ihr Licht an ist (in seiner Farbe). Ein Tipp schaltet; bei mehreren Tasten fragt ein kleines Men\xFC, welche. Dieselbe Entit\xE4t darf an mehreren Schaltern sitzen.",gang_socket_hint:"Eine Steckdose leuchtet gr\xFCn, solange ihr Schalter an ist \u2013 heller, je mehr sie zieht. Ein Tipp schaltet; bei mehreren fragt ein kleines Men\xFC, welche.",lock_confirm_lock:"{name} abschlie\xDFen?",opening_lock:"Smart Lock",opening_lock_hint:"Ein Tipp auf die T\xFCr schlie\xDFt ab oder auf (immer mit R\xFCckfrage). Solange sie aufgeschlossen ist, leuchtet ihre Kante.",split_handle_hint:"Ziehen: Breite von Plan und 3D-Ansicht",wall_exterior:"Au\xDFenwand (m)",wall_interior:"Innenwand (m)",grid:"Raster (m)",units:"Ma\xDFe anzeigen in",units_metric:"Meter",units_imperial:"Fu\xDF und Zoll",units_hint:"Wie L\xE4ngen und Fl\xE4chen im Plan, in den Formularen und in der Wandansicht stehen. Eingaben bleiben in Metern.",background:"Vorlage (Grundriss-Bild)",background_upload:"Bild w\xE4hlen \u2026",background_width:"Breite im Plan (m)",background_opacity:"Deckkraft",background_rotation:"Drehung (\xB0)",background_edit:"Verschieben, skalieren und drehen",background_edit_done:"Fertig",background_edit_hint:"Solange der Modus an ist: Bild ziehen verschiebt es, der Griff unten rechts zieht es gr\xF6\xDFer oder kleiner. Erst das Bild an den Ma\xDFstab anpassen, dann drehen.",background_remove:"Vorlage entfernen",hint_select:"Raum antippen zum Ausw\xE4hlen \xB7 Ecken ziehen \xB7 \u201E+\u201C auf einer Kante f\xFCgt einen Punkt ein \xB7 Pfeiltasten verschieben \xB7 Entf l\xF6scht \xB7 Strg+Z",hint_rect:"Ziehen, um ein Rechteck zu zeichnen",hint_polygon:"Punkte setzen \xB7 auf den ersten Punkt tippen oder Enter schlie\xDFt \xB7 Esc bricht ab",hint_empty:"Lege zuerst eine Etage an.",area_m2:"{a} m\xB2",overlap_warning:"R\xE4ume \xFCberlappen sich \u2013 die W\xE4nde dort sind unvollst\xE4ndig.",read_only:"Nur Administratoren k\xF6nnen den Grundriss bearbeiten.",side_failed:"Dieses Formular lie\xDF sich nicht anzeigen ({error}). Der Grundriss bleibt bedienbar. Bitte melde den Text in einem GitHub-Issue.",mat_wood:"Holz",mat_oak:"Eiche",mat_tiles:"Fliesen",mat_carpet:"Teppich",mat_stone:"Stein",mat_concrete:"Beton",card_name:"NextFloor",card_description:"Deine Wohnung in 3D (Neon).",stats:"{calls} Draw-Calls \xB7 {tris} Dreiecke",stats_fps:"{fps} B/s (langsamstes Bild {ms} ms)",stats_idle:"Ruhe (0 B/s)",stats_busy_floors:"Etagen",stats_busy_openings:"T\xFCren/Fenster",stats_busy_flash:"Blitz",stats_busy_roof:"Dach",stats_busy_flow:"Stromfluss",stats_busy_effect:"Farbeffekt",stats_busy_robot:"Roboter",stats_busy_orbit:"Kamerafahrt",stats_busy_tint:"Raumfarbe",stats_low:"Stufe Tablet, Pixeldichte {r}",stats_full:"volle Stufe, Pixeldichte {r}",floors_apart:"Auseinander",floors_stacked:"Gestapelt",roof_keep:"Dach bleibt",roof_keep_hint:"Das Dach bleibt beim Heranzoomen auf dem Haus, statt sich zu heben und auszublenden",floor_rooms_one:"1 Raum",floor_rooms:"{n} R\xE4ume",quality:"Qualit\xE4t",quality_auto:"Auto",quality_low:"Tablet",quality_high:"Hoch",state_on:"An",state_off:"Aus",state_open:"Offen",state_closed:"Zu",state_opening:"\xD6ffnet",state_closing:"Schlie\xDFt",state_playing:"Spielt",state_paused:"Pause",state_idle:"Bereit",state_locked:"Verriegelt",state_unlocked:"Entriegelt",state_detected:"Erkannt",state_clear:"Frei",state_unavailable:"Nicht verf\xFCgbar",state_heat:"Heizen",state_cool:"K\xFChlen",state_auto:"Automatik",state_heat_cool:"Heizen/K\xFChlen",state_dry:"Entfeuchten",state_fan_only:"L\xFCften",devices:"Ger\xE4te",devices_none_area:"Verkn\xFCpfe den Raum mit einem Bereich, dann erscheinen dessen Ger\xE4te hier.",devices_none:"Im Bereich gibt es keine passenden Ger\xE4te.",devices_place_all_n:"Alle {n} platzieren \u2026",devices_place_all_confirm:"{n} Ger\xE4te auf einmal in den Raum setzen? (Strg+Z bzw. \u201ER\xFCckg\xE4ngig\u201C nimmt alle in einem Schritt zur\xFCck.)",devices_src_area:"Dieser Bereich",devices_src_other:"Andere Bereiche",devices_src_none:"Ohne Bereich",panel_hide:"Im Raumfenster ausblenden",panel_unhide:"Im Raumfenster wieder zeigen",panel_state_hide:"Zustand im Raumfenster ausblenden (z. B. ein Rollladen, der nur \u201Eunbekannt\u201C meldet)",panel_state_show:"Zustand im Raumfenster wieder zeigen",devices_place:"Platzieren",devices_remove:"Entfernen",devices_hint:"Platzierte Ger\xE4te erscheinen in 3D. Im Plan lassen sie sich verschieben.",panel_lights:"Licht",panel_covers:"Rolll\xE4den",panel_climate:"Heizung",panel_media:"Medien",panel_switches:"Schalter",panel_sensors:"Sensoren",panel_scenes:"Szenen & Skripte",panel_announce:"\u{1F4E2} Durchsage",announce_placeholder:"Eigene Nachricht \u2026",announce_send:"Sagen",announce_sent:"Gesagt: \u201E{message}\u201C",announce_failed:"Durchsage fehlgeschlagen: {error}",announce_phrase_1:"Essen ist fertig!",announce_phrase_2:"Zeit f\xFCrs Bett!",announce_phrase_3:"Bitte runterkommen!",announce_phrase_4:"Wir fahren gleich los!",announce_phrase_5:"Der Hund muss raus!",state_recording:"Nimmt auf",state_streaming:"Streamt",panel_all_off:"Alle aus",readable:"Gut lesbar",readable_hint:"Kr\xE4ftigere Kontraste und gr\xF6\xDFere Schrift \u2013 f\xFCr Wandtablets und alle, die so besser lesen.",plain:"Nur Grundriss",plain_hint:"Zeigt nur W\xE4nde, T\xFCren, Fenster und Treppen, ohne M\xF6bel. Ger\xE4te und ihre Pins bleiben.",right_back:"Rechtsklick = zur\xFCck",right_back_hint:"Ein kurzer Rechtsklick in der 3D-Ansicht geht einen Schritt zur\xFCck: vom Raum zur Etage, von der Etage zum Haus (wie ein Doppeltipp auf leere Fl\xE4che). Ziehen mit der rechten Taste verschiebt weiter die Ansicht.",stl:"3D-Druck (STL)",stl_hint:"Speichert das Haus als STL-Datei (W\xE4nde, B\xF6den, M\xF6bel und Au\xDFenfl\xE4chen aller Etagen) zum 3D-Drucken, im Ma\xDFstab 1:100 (ein Meter wird zu 10 mm). Fenster, Licht und Dach fehlen; ein Slicer repariert die Datei bei Bedarf.",card_plain:"Nur Grundriss",card_rooms:"Nur diese R\xE4ume",card_rooms_hint:"Die Karte zeigt nur die angehakten R\xE4ume mit ihren M\xF6beln, Ger\xE4ten, T\xFCren und Fenstern (zum Beispiel f\xFCr ein Tablet in der K\xFCche). Nichts angehakt: der ganze Plan.",card_templates:"Kartenvorlagen",card_templates_hint:"Eine Dashboard-Karte einmal hier einrichten (mit den Einstellungen der Karte) und auf jedem Tablet nur noch den Namen angeben: `template: k\xFCche_tablet`. \xC4nderungen hier erreichen alle Karten mit dieser Vorlage; was auf der Karte selbst steht, gilt vor der Vorlage.",template_name:"Neue Vorlage (Name)",template_add:"Vorlage anlegen",template_reload:"Bildschirme mit dieser Vorlage neu laden",template_reload_all:"Alle Bildschirme neu laden",template_use:"Auf der Dashboard-Karte: `template: {name}`",card_template:"Kartenvorlage",card_template_none:"keine (nur diese Karte)",card_readable:"Gut lesbar",all_off_n:"Alles aus ({n})",all_off_hint:"Schaltet Lichter, Schalter, Ventilatoren und Medien des Raums aus; zehn Sekunden lang l\xE4sst es sich r\xFCckg\xE4ngig machen.",all_off_done:"Alles aus.",all_off_undo:"R\xFCckg\xE4ngig",all_off_floor:"Alles aus im {floor} ({n} Ger\xE4te), zehn Sekunden lang r\xFCckg\xE4ngig zu machen",mood_save:"Stimmung speichern",mood_save_hint:"Speichert, wie die Lampen des Raums gerade leuchten, als Stimmung \u2013 ein Tipp darauf stellt sie sp\xE4ter wieder her, \u201E\u2192\u201C \xFCbertr\xE4gt sie auf einen anderen Raum.",mood_new:"Stimmung",mood_set:"Stimmung einstellen",mood_carry:"Auf einen anderen Raum \xFCbertragen",panel_all_on:"Alle an",view_options:"Ansicht: Qualit\xE4t, Look, Symbole, FPS",panel_all_open:"Alle auf",panel_all_close:"Alle zu",central:"Zentral: alle Lichter, Rolll\xE4den und Favoriten",central_house:"Ganzes Haus",central_lights:"Lichter",central_covers:"Rolll\xE4den",central_on:"An",central_off:"Aus",central_open:"Auf",central_close:"Zu",central_sure:"Sicher?",central_favorites:"Favoriten",central_no_favorites:"Noch keine Favoriten. Im Editor unter \u201EFavoriten\u201C legst du Szenen, Skripte und Schalter fest.",card_central:"Stern mit Zentral-Men\xFC",card_central_hint:"Alle Lichter und Rolll\xE4den der Etage oder des Hauses und die Favoriten aus dem Editor.",favorites:"Favoriten",favorites_hint:"Szenen, Skripte, Automationen, Tasten und Schalter f\xFCr das Zentral-Men\xFC (Stern) der 3D-Ansicht \u2013 Party, Anwesenheitssimulation, Verschattung, Bew\xE4sserung.",favorites_add:"Favorit hinzuf\xFCgen",favorite_floor:"Auf welcher Etage dieser Favorit erscheint",favorite_all_floors:"Alle Etagen",outside_hidden:"Drau\xDFen: Ger\xE4te ausblenden",outside_hidden_hint:"Ger\xE4te, die das Fenster \u201EDrau\xDFen\u201C nicht zeigen soll (sie bleiben im Plan).",outside_hidden_add:"Ger\xE4t ausblenden",outside_view_hint:"Ansicht f\xFCr \u201EDrau\xDFen\u201C: Dreh die 3D-Vorschau auf den Garten und \xFCbernimm sie. Beim \xD6ffnen von \u201EDrau\xDFen\u201C fliegt die Kamera dorthin.",outside_view_set:"Diese Ansicht f\xFCr Drau\xDFen",outside_view_reset:"Ansicht f\xFCr Drau\xDFen zur\xFCcksetzen",room_facts:"Raumfenster: angezeigte Angaben",room_fact_sun:"Sonnenstunden",room_fact_comfort:"Komfort",room_fact_air:"L\xFCftungshinweis",room_fact_circuits:"Stromkreise",background_handles_hint:"Das Bild hat jetzt Griffe wie ein M\xF6bel: ziehen verschiebt es, die Ecke unten rechts skaliert, der runde Griff oben dreht (mit Umschalt in 15\xB0-Schritten). Passt es, \u201EFertig\u201C tippen \u2013 dann liegt es fest.",background_fixed_hint:"Das Bild liegt fest, du kannst dar\xFCber zeichnen. Zum Anpassen \u201EVerschieben, skalieren und drehen\u201C tippen.",bg_level:"Gerade ausrichten",bg_level_cancel:"Ausrichten abbrechen",bg_level_first:"Tippe auf den Anfang einer Wand im Bild, die gerade (waagerecht oder senkrecht) sein soll.",bg_level_second:"Jetzt auf das Ende dieser Wand tippen \u2013 das Bild dreht sich passend.",bg_ruler:"Ma\xDFstab mit Lineal",bg_ruler_cancel:"Lineal abbrechen",bg_ruler_first:"Tippe im Bild auf den Anfang einer Strecke, deren L\xE4nge du kennst \u2013 etwa eine bema\xDFte Wand.",bg_ruler_second:"Jetzt auf das Ende der Strecke tippen.",bg_ruler_length_hint:"Im Plan gemessen: {m} m. Gib die echte L\xE4nge ein, das Bild wird passend skaliert.",bg_ruler_length:"Echte L\xE4nge (m)",bg_ruler_apply:"Ma\xDFstab \xFCbernehmen",thumbs_fold:"Etagenbilder zu Kn\xF6pfen einklappen",thumbs_show:"Etagenbilder wieder zeigen",room_start_view:"Ansicht als Start des Raums",room_start_view_hint:"Tippst du den Raum in 3D an, fliegt die Kamera genau so hin, wie die 3D-Ansicht rechts gerade steht \u2013 Blickwinkel, Zoom und Bildausschnitt. Erst 3D daneben einschalten, den Raum drehen und heranzoomen, dann tippen.",room_start_view_reset:"Startansicht des Raums entfernen (wieder von oben)",room_start_view_need_pane:"Schalte zuerst \u201E3D daneben\u201C ein und dreh und zoom den Raum so, wie er sich \xF6ffnen soll.",floor_start_view:"Ansicht als Start der Etage",floor_start_view_hint:"Diese Etage \xF6ffnet sich in 3D so, wie die 3D-Ansicht rechts gerade steht \u2013 etwa das Erdgeschoss von vorn und das Obergeschoss von hinten. Erst 3D daneben einschalten, drehen, dann tippen.",floor_start_view_reset:"Startansicht der Etage entfernen (wieder wie das Haus)",floor_start_view_need_pane:"Schalte zuerst \u201E3D daneben\u201C ein und dreh die Etage so, wie sie sich \xF6ffnen soll.",ambilight:"Leuchten hinter dem Fernseher (%)",ambilight_hint:"Wie kr\xE4ftig es hinter dem Fernseher leuchtet, solange er l\xE4uft. 0 schaltet es aus (zum Beispiel wenn du LED-Streifen am Fernseher hast), 100 ist die Standardst\xE4rke.",sound_rings:"Klangringe (%)",sound_rings_hint:"Wie gro\xDF die Ringe um den Lautsprecher werden, solange er spielt. 0 schaltet sie aus, Bild und Leuchten bleiben; 100 ist die Standardgr\xF6\xDFe. Die Gr\xF6\xDFe folgt au\xDFerdem der Lautst\xE4rke des Lautsprechers: leiser hei\xDFt kleiner.",glow_scale:"Leuchtst\xE4rke in 3D (%)",light_effects:"Effektanimationen in 3D",light_effects_hint:"Nur exakte HA-Effektnamen zuordnen. Ohne Zuordnung bleibt die HA-Farbe statisch. \xC4ndert nichts in Home Assistant.",light_effects_enabled:"Animationen f\xFCr diese Leuchte erlauben",light_effect_unmapped:"Nicht zugeordnet (statisch)",light_effect_add:"Exakten Effektnamen hinzuf\xFCgen",light_effect_name_limit:"Der exakte Effektname muss 1 bis 255 Zeichen lang sein. Er wird nicht gek\xFCrzt.",light_effect_count_limit:"Maximal 100 Zuordnungen. Entferne zuerst einen vorhandenen Eintrag.",light_effect_exists:"Dieser Effektname ist bereits zugeordnet. Die vorhandene Zuordnung bleibt erhalten.",light_animation_none:"Statisch",light_animation_rainbow:"Regenbogen (ersetzt Farbe)",light_animation_pulse:"Pulsieren (Intensit\xE4t)",light_animation_flicker:"Flackern (Intensit\xE4t)",glow_scale_hint:"Wie kr\xE4ftig die Leuchte in 3D leuchtet: unter 100 % d\xE4mpft helle LED-Streifen, damit der Raum nicht \xFCberstrahlt; \xFCber 100 % l\xE4sst eine schwache Lampe st\xE4rker leuchten. Schaltet nichts in Home Assistant.",vehicle_to_spot:"In Stellplatz umwandeln",vehicle_to_spot_hint:"Ein Fahrzeug als einfaches M\xF6bel steht immer da. Als Stellplatz erscheint es nur, wenn ein Sensor das Auto meldet, und dort verkn\xFCpfst du auch das Auto-Ger\xE4t (Ladestand, Reichweite, Schloss, Klima).",as_furniture:"Als M\xF6bel darstellen",as_furniture_hint:"Ersetzt den Pin durch ein M\xF6bel an derselben Stelle, das mit diesem Ger\xE4t verkn\xFCpft ist \u2013 etwa ein Lautsprecher f\xFCr einen Media Player oder eine Leuchte f\xFCr ein Licht. Strg+Z nimmt es zur\xFCck.",as_furniture_pick:"M\xF6bel w\xE4hlen \u2026",as_device:"Wieder als Ger\xE4te-Pin",as_device_hint:"Ersetzt das M\xF6bel durch den einfachen Pin seines Ger\xE4ts an derselben Stelle.",presets:"Sender und Playlists (Klang)",presets_hint:"Erscheinen im Schnellmen\xFC jedes Lautsprechers unter \u201EAbspielen\u201C, neben den Quellen des Players. F\xFCr einen Echo (Alexa Media Player): Art SPOTIFY, AMAZON_MUSIC oder TUNEIN und als Inhalt, was du sagen w\xFCrdest (\u201ERock Antenne\u201C). F\xFCr Sonos, Music Assistant und andere: Art music oder url mit einer Stream-Adresse oder einer URI.",preset_type:"Art",preset_type_hint:"media_content_type von play_media, z. B. music, url, playlist, SPOTIFY, AMAZON_MUSIC, TUNEIN",preset_content:"Inhalt",preset_content_hint:"media_content_id: Stream-URL, URI (spotify:playlist:\u2026) oder bei Alexa ein Suchbegriff",preset_speakers:"Nur auf diesen Lautsprechern (keiner = auf allen)",media_play:"Abspielen",media_pause:"Pause",media_previous:"Zur\xFCck",media_next:"Weiter",media_volume:"Lautst\xE4rke",media_sources:"Quellen",preset_add:"Sender oder Playlist",own_buttons:"Eigene Kn\xF6pfe",own_buttons_hint:"Erscheinen im Zentral-Men\xFC (Stern) unter den Favoriten: eine Dashboard-Seite \xF6ffnen, die Details einer Entit\xE4t zeigen, einen Dienst aufrufen oder ein browser_mod-Popup mit deiner eigenen Karte \xF6ffnen.",own_alerts:"Eigene Warnungen",circuits:"Sicherungskasten",circuits_hint:"Die Stromkreise mit den R\xE4umen, die an ihnen h\xE4ngen. Das Raum-Panel nennt sie, und die Suche findet sie (\u201EF12\u201C).",circuit_name:"Name",circuit_new:"Neuer Stromkreis",circuit_add:"Stromkreis hinzuf\xFCgen",circuit_add_room:"Raum hinzuf\xFCgen",own_alerts_hint:"Eine Zeile in der Warnleiste der 3D-Ansicht, solange eine Entit\xE4t in einem Zustand ist \u2013 \u201EWassertank leer\u201C vom Saugroboter, \u201ESp\xFClmaschine fertig\u201C. Mehrere Zust\xE4nde mit Komma; bei Zahlen <20 oder >80.",own_alert_entity:"Wenn \u2026",own_alert_state:"\u2026 im Zustand ist (leer = an)",own_alert_text:"\u2026 dann diese Warnung",own_alert_color:"Farbe",own_alert_tap:"Antippen",own_alert_tap_info:"\xF6ffnet die Details",own_alert_tap_toggle:"schaltet die Entit\xE4t",own_alert_tap_room:"springt in den Raum",own_alert_house:"Ganzes Haus",own_alert_new:"Neue Warnung",own_alert_add:"Warnung hinzuf\xFCgen",today:"Heute",tomorrow:"Morgen",today_days:"Tage auf der Karte \u201EHeute\u201C",today_days_one:"Nur heute",today_days_n:"{n} Tage",forecast:"Wettervorhersage",forecast_hint:"Eine kleine Karte mit den n\xE4chsten Tagen der Wetter-Entit\xE4t (Einstellungen): Wetter, H\xF6chst- und Tiefstwert, Regen. Sie steht in einer oberen Ecke der 3D-Ansicht, oben rechts unter der Karte \u201EHeute\u201C.",forecast_days:"Vorhersage",forecast_off:"Aus",forecast_corner:"Ecke",today_none:"Heute steht nichts an.",today_calendars:"Kalender f\xFCr \u201EHeute\u201C",today_calendars_hint:"Die Termine dieser Kalender stehen oben rechts in der 3D-Ansicht auf der Karte \u201EHeute\u201C, zusammen mit den M\xFClltonnen, die heute oder morgen abgeholt werden. Ein Tipp auf den Titel klappt die Karte ein.",own_button_state:"Leuchtet, solange \u2026 an ist (optional)",own_button_label:"Beschriftung",own_button_action:"Aktion",own_button_new:"Neuer Knopf",own_button_add:"Eigener Knopf",own_action_navigate:"Seite \xF6ffnen",own_action_more_info:"Details einer Entit\xE4t",own_action_service:"Dienst aufrufen",own_action_fire_dom_event:"fire-dom-event (browser_mod)",own_target_navigate:"Pfad",own_target_more_info:"Entit\xE4t",own_target_service:"Dienst (domain.service)",own_data:"Daten (JSON)",own_data_hint:'F\xFCr einen Dienst seine Daten, f\xFCr fire-dom-event der Inhalt des Ereignisses, z. B. {"browser_mod": {"service": "browser_mod.popup", "data": {\u2026}}}.',own_data_bad:"Kein g\xFCltiges JSON-Objekt.",panel_no_area:"Dieser Raum ist mit keinem Bereich verkn\xFCpft. Im Editor kannst du ihn verkn\xFCpfen.",panel_empty:"F\xFCr diesen Raum sind keine Ger\xE4te im Grundriss. Im Editor lassen sich Ger\xE4te platzieren oder mit \u2606 f\xFCrs Raumfenster ausw\xE4hlen.",close:"Schlie\xDFen",panel_fold:"Einklappen (Raum bleibt sichtbar)",panel_unfold:"Wieder aufklappen",brightness:"Helligkeit",color_temp:"Farbtemperatur",color:"Farbe",position:"Position",cover_open:"Auf",cover_stop:"Stopp",cover_tilt:"Lamellen",cover_tilt_open:"Lamellen auf",cover_tilt_close:"Lamellen zu",cover_close:"Zu",target_temp:"Soll",current_temp:"Ist",temp_down:"K\xE4lter",temp_up:"W\xE4rmer",volume:"Lautst\xE4rke",play_pause:"Wiedergabe/Pause",previous:"Zur\xFCck",next:"Weiter",run:"Ausf\xFChren",details:"Details",hold_hint:"Antippen schaltet \xB7 lange dr\xFCcken \xF6ffnet Details",tool_opening:"T\xFCr & Fenster",tool_furniture:"M\xF6bel",qm_off:"Aus",find:"Suchen",find_placeholder:"Wo ist \u2026? Ger\xE4t oder Raum",find_none:"Nichts gefunden",swipe_off:"Aus",panel_pin:"Im Raumfenster zeigen",panel_unpin:"Nicht im Raumfenster zeigen",devices_panel_hint:"Das Raumfenster zeigt die Ger\xE4te im Grundriss. \u2606 nimmt ein Ger\xE4t zus\xE4tzlich ins Raumfenster auf, ohne es zu platzieren.",card_section_view:"Ansicht",card_size:"Gr\xF6\xDFe",card_size_fixed:"Feste H\xF6he",card_size_fill:"Bildschirm f\xFCllen",card_fill_hint:"Am besten in einer Dashboard-Ansicht vom Typ \u201EPanel (1 Karte)\u201C \u2013 dann nimmt die Karte den ganzen Platz ein.",card_controls:"Schalter in der Karte",card_floor_thumbs:"Etagen als Mini-Ansichten",card_floor_thumbs_hint:"Kleine Bilder der Etagen am Rand \u2013 antippen wechselt die Etage",card_floor_thumbs_hint_start:"Die gew\xE4hlte Etage ist dann die Start-Etage \u2013 mit den Bildern am Rand wechselt man zu den anderen",card_room_names:"Raumnamen anzeigen",card_section_kiosk:"Wandtablet (Kiosk)",card_section_features:"Funktionen",card_weather_plan:"wie im Plan eingestellt",card_pro_hint:"Bewegungsspur und Kamerawand geh\xF6ren zum Kameras: Die Spur zeigt die letzte halbe Stunde, die Wand alle Kameras des Plans.",card_idle_return:"Zur\xFCck zur Startansicht nach",card_idle_off:"Nie",card_idle_min:"{n} min ohne Bedienung",card_idle_hint:"Nach der Wartezeit schlie\xDFt die Karte den Raum und zeigt wieder die Startansicht.",card_night:"Nachtdimmung",card_night_off:"Aus",card_night_sun:"Nach Sonnenstand",card_night_time:"Zeitraum",card_night_range:"Zeitraum (z. B. 22:00-06:00)",card_idle_orbit:"Kamerafahrt als Bildschirmschoner",card_idle_orbit_hint:"Nach der R\xFCckkehr dreht sich die Ansicht langsam, bis jemand das Tablet ber\xFChrt",card_dashboard:"Knopf zu einem Dashboard (Pfad)",card_dashboard_label:"Beschriftung des Knopfs",card_dashboard_hint:"Ein Knopf oben rechts in der Karte \xF6ffnet das Dashboard oder die Ansicht mit diesem Pfad, z. B. /lovelace/home oder /dashboard-haus/0. Ohne Beschriftung zeigt er \u2302.",card_alerts:"Warnungen anzeigen",card_alerts_hint:"Rauch, Gas, CO, Wasser, Alarmanlage und offene Fenster bei Regen: der Raum pulsiert, oben erscheint ein Hinweis",card_alert_jump:"Bei neuer Warnung zum Raum springen",card_alert_jump_hint:"Die Ansicht wechselt selbst zur Etage und zum Raum der Warnung",card_scenes:"Szenen-Kn\xF6pfe im Raum",card_scenes_hint:"Szenen und Skripte des Bereichs als Kn\xF6pfe unter der 3D-Ansicht, wenn ein Raum gew\xE4hlt ist",card_sensor_bar:"Eigene Sensoren oben",card_sensor_bar_hint:"Die im Editor gew\xE4hlten Sensoren (Einstellungen) oben links auf der Karte",card_central_open:"Sternmen\xFC offen und gro\xDF",card_central_open_hint:"Favoriten und eigene Kn\xF6pfe stehen von Anfang an offen, eine Nummer gr\xF6\xDFer",card_keep_camera:"Kamera beim Etagenwechsel behalten",card_keep_camera_hint:"Gleiche Seite, H\xF6he und Entfernung auf jeder Etage",card_today:"Karte \u201EHeute\u201C",card_today_hint:"Termine von heute und f\xE4llige M\xFClltonnen oben rechts",card_announcements:"Durchsagen",card_announcements_hint:"Durchsagen (Aktion \u201ENextFloor: Durchsage\u201C) erscheinen gro\xDF auf der Karte, mit Gong und gesprochen",weather_short:"Wetter",time_of_day:"Tageszeit",time_of_day_hint:"Zeigt Sonne, Licht, Schatten und Look zu einer anderen Uhrzeit von heute. Noch einmal tippen zeigt wieder das Jetzt.",menu_open:"Men\xFC offen",menu_open_hint:"Das Sternmen\xFC mit Favoriten und eigenen Kn\xF6pfen steht auf diesem Ger\xE4t von Anfang an offen, eine Nummer gr\xF6\xDFer \u2013 f\xFCr ein Wandtablet, das vor allem Szenen schaltet.",keep_camera:"Kamera behalten",keep_camera_hint:"Beim Wechsel der Etage bleibt die Kamera auf derselben Seite, H\xF6he und Entfernung, statt die neue Etage von der Startseite aus einzupassen.",view_zoom:"Zoom",view_zoom_hint:"Wie nah die eingepassten Ansichten kommen \u2013 auf kleinen Tablets wirkt das Haus gr\xF6\xDFer.",weather_entity:"Wetter-Entit\xE4t",weather_effects:"Wetter-Effekte in 3D",card_weather_density:"Regen- und Schneemenge",card_weather_density_hint:"Weniger Tropfen und Flocken als das Wetter meldet; Wolken, Nebel und Blitze bleiben",weather_effect_rain:"Regen",weather_effect_snow:"Schnee",weather_effect_fog:"Nebel (graut die Szene ein)",weather_effect_clouds:"Wolken dunkeln Himmel und Sonne ab",weather_effect_lightning:"Blitze bei Gewitter",weather_effect_sky:"Sonne und Mond am Himmel",rain_warning:"Warnung: Fenster offen bei Regen",sun_patches:"Sonnenlicht und Schatten",sun_patches_hint:"Mit eingestellter Nordrichtung f\xE4llt das Sonnenlicht aus sun.sun als helle Flecken durch die Fenster auf den Boden, und das Haus wirft seinen Schatten auf das Grundst\xFCck. Ohne Haken bleiben Boden und Grundst\xFCck ohne Sonnenflecken und Schatten.",sun_arc:"Sonnenbogen und Kompass",sun_arc_hint:"Zeichnet den Weg der Sonne von heute als Bogen \xFCber das Grundst\xFCck, mit einem Ring und den Himmelsrichtungen am Boden (Norden rot). Braucht die Position deines Zuhauses in Home Assistant.",weather_entity_hint:"Welche Wetter-Entit\xE4t den Himmel ums Haus steuert. \u201EAutomatisch\u201C nimmt die erste gefundene.",weather_hint:"Wetter am Haus: Regen und Schnee fallen mit dem echten Wind, Wolken ziehen mit Schatten \xFCbers Grundst\xFCck, Blitze, Nebel, Sonne und Mond",card_weather:"Wetter drau\xDFen",card_weather_hint:"Regen, Schnee, Hagel, Wolken mit Schatten, Blitze und Nebel aus der ersten Wetter-Entit\xE4t (weather_entity w\xE4hlt eine andere); auf Stufe Tablet weniger Teilchen",alerts:"Warnungen",alert_smoke:"Rauch: {name}",alert_gas:"Gas: {name}",alert_co:"Kohlenmonoxid: {name}",alert_water:"Wasser: {name}",alert_alarm:"Alarm ausgel\xF6st",alert_alarm_by:"Alarm ausgel\xF6st durch {cause}",alert_alarm_pending:"Alarm wird ausgel\xF6st",alert_window_rain:"Fenster offen bei Regen: {name}",alert_power_outage:"Stromausfall: {name}",alert_contact_lost:"Kontakt antwortet nicht: {name}",rain_sensor:"Regensensor (eigene Wetterstation)",rain_sensor_inverted:"Regensensor umkehren",rain_sensor_inverted_hint:"F\xFCr Sensoren, die bei Regen \u201Eaus\u201C (oder 0) melden und bei Trockenheit \u201Eein\u201C.",outage_sensor:"Sensor f\xFCr Stromausfall",outage_hint:"Ein Bin\xE4rsensor der Klasse Strom, der aus ist, ein anderer Bin\xE4rsensor, der an ist, ein Status wie \u201Eoff_grid\u201C oder \u201Ebackup\u201C oder eine Spannung unter 50 V l\xF6sen eine Warnung f\xFCrs ganze Haus aus.",contact_warning:"Warnen, wenn ein T\xFCr- oder Fensterkontakt nicht erreichbar ist",contact_warning_hint:"Ist ein Kontakt 10 Minuten lang \u201Enicht verf\xFCgbar\u201C (leere Batterie, au\xDFer Funkreichweite), sieht das Fenster in 3D geschlossen aus, obwohl es keiner wei\xDF. Dann nennt ein Hinweis den Kontakt. Ein Neustart von Home Assistant warnt nicht.",night_lock_warning:"Nachts warnen, wenn eine T\xFCr nicht abgeschlossen ist",night_lock_warning_hint:"Zwischen 22 und 6 Uhr nennt ein Hinweis die T\xFCrschl\xF6sser des Plans, die offen stehen.",alert_unlocked_night:"Nicht abgeschlossen: {name}",motion_markers_active:"Bewegungsmelder nur zeigen, wenn sie etwas erkennen",motion_markers_active_hint:"Gilt f\xFCr Bewegungs-, Anwesenheits- und Pr\xE4senzmelder. Ein Melder, dessen Symbol auf immer zeigen steht, bleibt sichtbar.",room_double_tap:"Doppeltipp auf einen Raum",room_double_tap_hint:"Ein Doppeltipp auf einen Raum schaltet seine Lichter aus, wenn eins an ist, sonst alle an. Ger\xE4te mit \u201EErst fragen\u201C bleiben immer au\xDFen vor.",room_double_tap_area:"Lampen im Plan und alle Lichter des Bereichs",room_double_tap_plan:"Nur Lampen im Plan",room_double_tap_off:"Nichts schalten",card_room_double_tap_auto:"Wie im Plan eingestellt",status_entities:"Eigene Sensoren oben in der 3D-Ansicht",status_add:"Sensor hinzuf\xFCgen",status_entities_hint:"Zum Beispiel Au\xDFentemperatur, Alarmanlage oder Luftqualit\xE4t: Sie stehen oben links mit Name und Wert, auch in einem ge\xF6ffneten Raum. Antippen \xF6ffnet die Details. Bis zu 12.",announce_tts:"Text-zu-Sprache f\xFCr Durchsagen",announce_phrases:"S\xE4tze f\xFCr Durchsagen (einer pro Zeile)",announce_phrases_hint:"Leer: die mitgelieferten S\xE4tze. Durchsagen gibt es auch als Aktion \u201ENextFloor: Durchsage\u201C f\xFCr Automationen \u2013 auf den Lautsprechern der R\xE4ume und auf jedem offenen NextFloor-Bildschirm.",opening_rain_warning:"Bei Regen warnen",opening_light_well:"Lichtschacht davor",sill_boards:"Fensterbank",sill_boards_auto:"Automatisch",sill_boards_none:"Keine",sill_boards_inside:"Nur innen",sill_boards_outside:"Nur au\xDFen",room_names_short:"Raumnamen",room_names_toggle_hint:"Raumnamen in der 3D-Ansicht ein- oder ausblenden",floor_stack_short_dim:"Abgedunkelt",floor_stack_short_stacked:"Gestapelt",floor_stack_short_single:"Einzeln",size_short_w:"B",size_short_d:"T",size_short_h:"H",import_error_not_json:"Die Datei ist kein JSON.",import_error_not_plan:"Die Datei ist kein NextFloor-Plan.",import_other_hint:"Aus Sweet Home 3D: die .sh3d-Datei hier importieren. Etagen, R\xE4ume, T\xFCren, Fenster und freie W\xE4nde werden \xFCbernommen, M\xF6bel nicht.",import_sh3d_found:"Sweet Home 3D: {floors} Etagen, {rooms} R\xE4ume, {openings} T\xFCren und Fenster, {walls} freie W\xE4nde ({furniture} M\xF6bel werden nicht \xFCbernommen).",import_dxf_found:"DXF: {rooms} R\xE4ume (geschlossene Polylinien) und {walls} freie W\xE4nde (Linien) auf einer Etage.",import_ifc_found:"In der IFC-Datei: {floors} Etagen und {rooms} R\xE4ume (die W\xE4nde zeichnet NextFloor aus den R\xE4umen).",import_roomplan_found:"Raumscan (RoomPlan): {rooms} R\xE4ume, {openings} T\xFCren und Fenster; {skipped} Objekte wurden nicht \xFCbernommen (M\xF6bel stellst du selbst).",import_error_roomplan_empty:"Im Raumscan sind keine W\xE4nde.",import_error_ifc_empty:"In der IFC-Datei sind keine R\xE4ume (IfcSpace) mit Grundriss.",import_error_dxf_empty:"In der DXF-Datei sind keine Linien oder Polylinien.",import_error_sh3d:"Das ist keine Sweet-Home-3D-Datei, die sich lesen l\xE4sst (es braucht Sweet Home 3D 5.3 oder neuer).",import_error_sh3d_empty:"In der Sweet-Home-3D-Datei sind keine R\xE4ume oder W\xE4nde.",export_name_template:"vorlage",export_name_backup:"sicherung",card_floor_stack:"Etagen darunter",floor_stack_dim:"Abgedunkelt",floor_stack_stacked:"Gestapelt (ganzes Haus bis hier)",floor_stack_single:"Ausgeblendet (nur diese Etage)",card_control_walls:"W\xE4nde hoch/Schnitt",card_control_floors:"Etagen auseinander",card_control_temperature:"Temperatur",card_control_humidity:"Feuchte",card_control_co2:"CO\u2082",card_controls_hint:"W\xE4nde hoch/Schnitt, Etagen auseinander und Temperatur, Feuchte, CO\u2082 zum Umschalten",controls_hide:"Bedienelemente ausblenden \u2013 nur die 3D-Ansicht bleibt",nav_wrap:"Leiste umbrechen: alle Etagen und R\xE4ume auf mehreren Zeilen",bars_unfold:"Schalter",nav_row:"Leiste in einer Zeile (seitlich scrollen)",controls_show:"Bedienelemente wieder einblenden",card_controls_hidden:"Mit ausgeblendeten Bedienelementen starten",card_controls_hidden_hint:"Nur die 3D-Ansicht; ein Auge unten links holt Leisten, Werte und Schalter zur\xFCck",card_controls_hide_after:"Bedienelemente ausblenden nach",card_hide_after_s:"{n} s ohne Ber\xFChrung",card_fullscreen_button:"Vollbild-Taste",card_fullscreen_button_hint:"Blendet das Dashboard drumherum aus (z. B. am Wandtablet)",fullscreen:"Vollbild",fullscreen_exit:"Vollbild beenden",card_section_show:"Anzeigen",card_floor:"Etage",card_floor_house:"Ganzes Haus (Etage antippen zum \xD6ffnen)",card_height:"H\xF6he (Pixel)",card_walls:"W\xE4nde",card_quality_hint:"\u201ETablet\u201C ist die sparsamste Stufe \u2013 ideal f\xFCr Fire-Tablets und andere Wandtablets.",card_flows_switch:"Schalter in der Karte",card_flows_on:"Immer an",card_flows_off:"Immer aus",holos:"Karten",holos_hint:"Die Live-Karten \xFCber dem Haus (Energiebilanz, Auto, Medien) ein- oder ausblenden",card_energy:"Energiewerte oben anzeigen",card_room_panel:"Raum-Details beim Antippen",card_room_buttons:"Raum-Kn\xF6pfe",card_room_buttons_hint:"Eine Reihe mit einem Knopf je Raum oben in der Karte \u2013 antippen \xF6ffnet den Raum, wie das Antippen im Modell",card_room_panel_hint:"Lichter und Rolll\xE4den des Raums in einem Seitenfenster",card_explode:"Etagen in der Hausansicht auseinanderziehen",card_roof_fade:"Dach beim Heranzoomen ausblenden",card_roof_fade_hint:"Aus: Das Dach bleibt auf dem Haus, auch wenn die Kamera nah herankommt.",card_stats:"Leistungsanzeige (Bilder pro Sekunde)",card_stats_hint:"Zum Pr\xFCfen, wie fl\xFCssig die Karte auf dem Ger\xE4t l\xE4uft",packs:"M\xF6bel-Packs",lib_badge_light:"Leuchte: l\xE4sst sich mit einem Licht verkn\xFCpfen und in 3D schalten",lib_badge_electric:"Elektrisch: l\xE4sst sich mit Entit\xE4t und Leistungssensor verkn\xFCpfen (schalten, Bild, Verbrauch)",lib_badge_hint:"M\xF6bel mit Symbol lassen sich mit Entit\xE4ten verkn\xFCpfen: Leuchten schalten, Bildschirme zeigen Bilder, Ger\xE4te ihren Verbrauch.",care_bin_today:"Heute Abholung",care_bin_tomorrow:"Morgen Abholung",care_bin_days:"In {n} Tagen",care_mail_yes:"Post ist da",care_mail_no:"Leer",care_plant_thirsty:"Durst",care_plant_ok:"Gut versorgt",care_time_left:"Noch {time}",care_entity_bin:"Abholtermin (Sensor)",care_entity_mail:"Post-Sensor",care_entity_plant:"Bodenfeuchte (Sensor)",care_thirsty_below:"Durst unter (%)",care_hint_bin:"Ein Sensor mit dem n\xE4chsten Abholtermin: Tage, ein Datum, \u201Eheute\u201C/\u201Emorgen\u201C oder die Integration Waste Collection Schedule. Am Tag davor und am Abholtag leuchtet die Tonne.",care_hint_mail:"Ein Sensor, der meldet, dass Post im Kasten ist (z. B. ein Kontakt an der Klappe). Dann leuchtet der Briefkasten.",care_hint_plant:"Ein Feuchtesensor in der Erde. Darunter leuchtet die Pflanze und meldet Durst.",lib_cat_lights:"Leuchten",lib_cat_seating:"Sitzen",lib_cat_tables:"Tische",lib_cat_storage:"Schr\xE4nke & Regale",lib_cat_beds:"Betten",lib_cat_kitchen:"K\xFCche",lib_cat_appliances:"Haushaltsger\xE4te",lib_cat_bath:"Bad",lib_cat_media:"TV & Audio",lib_cat_office:"B\xFCro",lib_cat_tech:"Technik",lib_cat_climate:"Heizung & Klima",lib_cat_energy:"Energie",lib_cat_garden:"Garten & Terrasse",lib_cat_plants:"Pflanzen",lib_cat_kids:"Kinder",lib_cat_fitness:"Fitness",lib_cat_pets:"Haustiere",lib_cat_workshop:"Werkstatt & Garage",lib_cat_music:"Musik & Atelier",lib_cat_season:"Saison & Deko",lib_cat_pictures:"Bilder & Rahmen",lib_cat_vehicles:"Fahrzeuge",lib_cat_building:"Treppen & Bauteile",lib_cat_decor:"Deko & Sonstiges",lib_favourites:"Favoriten",lib_recent:"Zuletzt benutzt",lib_for_room:"Passend zu {room}",lib_all_rooms:"Alle R\xE4ume zeigen",lib_linkable:"verkn\xFCpfbar",lib_lit:"leuchtet",lib_outdoor:"drau\xDFen",lib_fav_add:"Zu den Favoriten",lib_fav_remove:"Aus den Favoriten nehmen",lib_sizes:"Gr\xF6\xDFen",feature_name_energy:"Energiefluss",ext_tab:"Erweiterungen",ext_title:"Erweiterungen",models:"Eigene 3D-Modelle",models_hint:"F\xFCr manche Fahrzeuge kann NextFloor ein echtes 3D-Modell zeigen, wenn du eins besitzt. W\xE4hle die Datei (.glb) hier aus: NextFloor dreht sie richtig herum, macht sie leichter, markiert den Lack und legt sie auf deinem Home Assistant ab. Ohne Modell sieht das Fahrzeug aus wie bisher.",models_licence:"Die Dateien geh\xF6ren dir und bleiben auf deinem Home Assistant. NextFloor liefert keine Modelle mit; bitte pr\xFCfe, dass die Lizenz deines Modells die Nutzung in deiner Installation erlaubt.",model_add:"Modell hochladen \u2026",model_replace:"Modell ersetzen \u2026",model_remove:"Entfernen",model_present:"vorhanden",model_missing:"noch keins",model_remove_confirm:"Das Modell \u201E{id}\u201C von Home Assistant l\xF6schen?",model_removed:"Modell \u201E{id}\u201C gel\xF6scht.",model_uploaded:"Modell \u201E{id}\u201C hochgeladen ({size}). Lade das Panel neu, damit es erscheint.",model_upload:"Auf Home Assistant ablegen",model_info:"{triangles} Dreiecke, {size} m",model_front:"Vorderseite",model_front_hint:"Drehe das Modell, bis die Front zum Betrachter zeigt (schr\xE4g nach unten links in der Vorschau).",model_paint:"Lack (die Farbe, die du im Editor w\xE4hlst)",model_paint_preview:"Farbe in der Vorschau",model_detail:"Detailgrad",model_detail_light:"Leicht (Tablet)",model_detail_normal:"Normal",model_detail_fine:"Fein",model_result:"Ergebnis: {triangles} Dreiecke, {size}",model_error_not_glb:"Das ist keine .glb-Datei (bin\xE4res glTF). Exportiere das Modell als \u201EglTF binary\u201C.",model_error_compressed:"Die Datei ist komprimiert (Draco, Meshopt oder KTX). Exportiere sie ohne Kompression.",model_error_empty:"In der Datei ist nichts Dreidimensionales zu finden.",model_error_unreadable:"Die Datei l\xE4sst sich nicht lesen: {detail}",model_error_too_large:"Die Datei ist gr\xF6\xDFer als {max}. W\xE4hle einen geringeren Detailgrad.",model_upload_forbidden:"Nur Administratoren d\xFCrfen Modelle hochladen.",model_upload_too_large:"Home Assistant nimmt keine Dateien \xFCber {max} an. W\xE4hle einen geringeren Detailgrad.",model_upload_not_glb:"Home Assistant hat die Datei abgelehnt (kein bin\xE4res glTF).",model_upload_bad_id:"Die Modell-Kennung ist ung\xFCltig.",model_upload_other:"Das Hochladen hat nicht geklappt: {detail}",ext_intro:"Hier importierst du eigene M\xF6bel-Packs, l\xE4dst eigene 3D-Modelle hoch und bindest Plugins ein.",plugin:"Plugin",plugins_title:"Plugins",plugins_intro:"Plugins erweitern NextFloor um eigene Licht-Animationen, Ger\xE4te und Karten im Raum-Panel. Trag die Adresse eines Plugins ein (eine .js-Datei in /config/www, also /local/\u2026, aus HACS /hacsfiles/\u2026 oder https://\u2026).",plugins_docs:"Wie man ein Plugin schreibt",plugins_warning:"Plugins laufen mit denselben Rechten wie NextFloor in deinem Browser. Nimm nur Plugins, deren Quelle du vertraust.",plugins_off:"ausgeschaltet",plugins_error:"Fehler",plugins_loading:"wird geladen \u2026",plugins_nothing_registered:"geladen, hat aber nichts angemeldet",plugins_loaded:"aktiv",plugins_reload_hint:"Wirkt nach dem Neuladen der Seite",plugins_remove:"Entfernen",plugins_none:"Noch keine Plugins eingetragen.",plugins_from_dashboard:"\xDCber eine Dashboard-Ressource angemeldet",plugins_add:"Hinzuf\xFCgen",plugins_url_invalid:"Bitte eine .js-Adresse unter /local/\u2026, /hacsfiles/\u2026 oder https://\u2026 angeben.",plugins_exists:"Dieses Plugin ist schon eingetragen.",plugins_limit:"H\xF6chstens 20 Plugins.",packs_title:"M\xF6bel-Packs",packs_intro:"Eigene M\xF6bel als Pack (JSON) importieren: als Datei oder unten einf\xFCgen. {n} Packs sind mitgeliefert und immer da.",packs_docs:"Pack-Format",packs_none:"Noch keine eigenen Packs importiert.",community_title:"Community-M\xF6bel",community_intro:"M\xF6bel, die andere mit dem M\xF6bel-Baukasten gebaut und geteilt haben \u2013 gepr\xFCft und kostenlos. Bau deine eigenen:",community_builder:"M\xF6bel-Baukasten \xF6ffnen",community_how:"So teilst du deine",community_load:"Community-M\xF6bel laden",community_none:"Noch keine Community-M\xF6bel \u2013 sei die oder der Erste!",community_install:"Installieren",community_update:"Aktualisieren",community_installed:"Installiert",community_failed:"Die Community-M\xF6bel lie\xDFen sich nicht laden: {detail}",pack_import:"Pack-Dateien importieren \u2026",pack_paste:"JSON importieren",pack_paste_empty:"F\xFCge zuerst das JSON eines Packs ein.",pack_paste_not_json:"Das ist kein g\xFCltiges JSON: {detail}",pack_imported:"\u201E{name}\u201C von {publisher} importiert \u2013 {n} M\xF6bel",packs_imported_n:"{n} von {total} Packs importiert",pack_by:"von {publisher} \xB7 {n} M\xF6bel",pack_remove:"Entfernen",pack_remove_confirm:"Pack \u201E{name}\u201C entfernen? M\xF6bel daraus bleiben als einfache K\xE4sten im Plan.",pack_error_not_a_pack:'Das ist kein M\xF6bel-Pack (es fehlt "format": "nfpack").',pack_error_builtin:"Ein mitgeliefertes Pack hat schon diese ID.",pack_error_invalid_content:"Das Pack enth\xE4lt ung\xFCltige M\xF6bel: {detail}",pack_error_too_large:"Das Pack ist zu gro\xDF (h\xF6chstens 1 MB).",pack_error_needs_update:"Dieses Pack braucht eine neuere Version von NextFloor. Bitte zuerst aktualisieren (HACS \u203A NextFloor \u203A \u22EE \u203A \u201EInformationen aktualisieren\u201C \u203A \u201EHerunterladen\u201C), Home Assistant neu starten und dann noch einmal importieren.",pack_error_other:"Import fehlgeschlagen: {detail}",store_open:"Plugin-Store \xF6ffnen",store_close:"Plugin-Store schlie\xDFen",store_intro:"Gepr\xFCfte Plugins aus der Community. Jedes wird vor der Aufnahme angesehen und danach nicht mehr ver\xE4ndert.",store_submit:"Eigenes Plugin einreichen",store_empty:"Noch keine Plugins im Store.",store_failed:"Der Store lie\xDF sich nicht laden ({error}).",store_install:"Installieren",store_installed:"installiert",store_update:"Aktualisieren",store_confirm:`\u201E{name}\u201C von {author} installieren? Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt: -{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_passage:"Durchbruch (ohne T\xFCr)",style_standard:"Standard",style_bars:"Mit Sprossen",style_glass_wall:"Glaswand (feststehend)",preset_glass_wall:"Glaswand",glass_panes:"Glasfelder",glass_panes_auto:"automatisch (ca. 0,9 m)",glass_panes_hint:"0 = ein einziges Glas ohne Teilung, leer = Teilung etwa alle 0,9 m",flip_hinge:"Anschlag wechseln",flip_main_leaf:"Hauptfl\xFCgel wechseln",flip_hinge_hint:"Scharniere auf die andere Seite",flip_swing:"\xD6ffnungsrichtung umdrehen",flip_swing_hint:"Die T\xFCr schwenkt in den Raum oder zur anderen Seite",main_leaf:"Hauptfl\xFCgel (vom Raum aus)",contact_main:"Kontakt Hauptfl\xFCgel",contact_second:"Kontakt zweiter Fl\xFCgel",tool_outdoor:"Au\xDFen",tool_measure:"Nach Ma\xDF",hint_measure:"Startpunkt antippen, dann rechts die Wandl\xE4ngen mit Richtung eingeben",measure:"Raum nach Ma\xDF",measure_start:"Tippe im Plan auf den Startpunkt, z. B. eine Raumecke.",measure_from:"Start bei {x} / {z} m \u2013 antippen verschiebt den Start.",measure_length:"L\xE4nge der n\xE4chsten Wand (m)",measure_close:"Raum schlie\xDFen",measure_undo:"Letzte Wand weg",measure_gap:"L\xFCcke zum Start: {gap} m (wird beim Schlie\xDFen verbunden)",measure_hint:"Tipp: L\xE4nge eintippen und Pfeiltaste dr\xFCcken. Mit gemessenen Innenma\xDFen danach \u201EL\xFCcken schlie\xDFen\u201C.",rect_by_size:"Rechteck nach Ma\xDF",rect_add:"Rechteck anlegen",dir_up:"Nach oben",dir_down:"Nach unten",dir_left:"Nach links",dir_right:"Nach rechts",hint_outdoor:"Ziehen, um eine Au\xDFenfl\xE4che (Rasen, Terrasse, Pool \u2026) aufzuziehen",outdoor:"Au\xDFenfl\xE4che",outdoor_type:"Art",outdoor_height:"H\xF6he (m)",outdoor_offset:"H\xF6henversatz (m, \u2212 = tiefer)",outdoor_opacity:"Deckkraft (%)",outdoor_opacity_hint:"100 = undurchsichtig. Weniger macht die Fl\xE4che durchsichtig, etwa eine Einfahrt \xFCber dem Keller; der Umriss bleibt.",outdoor_outline:"Umrisslinie zeigen",outdoor_outline_hint:"Ohne Haken zeichnet die Fl\xE4che keine Leuchtlinie an ihrem Rand \u2013 f\xFCr gro\xDFe Grundst\xFCcke aus mehreren Rasenfl\xE4chen.",outdoor_corners_hint:"Ecken: ein + auf einer Kante f\xFCgt eine Ecke hinzu, Ziehen formt die Fl\xE4che, \xD7 entfernt eine Ecke.",outdoor_hint:"Au\xDFenleuchten (Wegleuchte, Garten-Spot, Wandleuchte au\xDFen) beleuchten alle Au\xDFenfl\xE4chen und die Fassade.",out_lawn:"Rasen",out_terrace:"Terrasse",out_path:"Weg",out_driveway:"Einfahrt",out_pool:"Pool",out_bed:"Beet",out_hedge:"Hecke",out_fence:"Zaun",out_wild:"Wildfl\xE4che",out_pergola:"Pergola / Rahmen",outdoor_open:"Offen (letzte Kante weglassen)",outdoor_open_hint:"Die Kante vom letzten zum ersten Punkt wird nicht gezeichnet \u2013 ein Zaun oder eine Pergola, die ans Haus lehnt.",fence_gates:"Tore im Zaun",gate_add:"+ Tor im Zaun",gate_edge:"Zaunseite",gate_kind:"Art",gate_single:"Gartentor",gate_double:"Doppeltor",gate_sliding:"Schiebetor",gate_offset:"Mitte ab Zaunanfang (m)",gate_width:"Breite (m)",gate_entity:"Antrieb oder Schalter",gate_contact:"Kontakt (an = offen)",fence_gates_hint:"Ein Tor ist eine L\xFCcke im Zaun mit Torpfosten und Fl\xFCgel. Mit einem Antrieb (Cover, Schalter, Hilfsschalter, Schloss) und/oder Kontakt geht es in 3D auf: Garten- und Doppeltor schwingen nach innen, ein Schiebetor f\xE4hrt hinter den Zaun.",outdoor_bracing:"X-Verstrebung",outdoor_cut:"Aus Fl\xE4chen ausschneiden",outdoor_cut_hint:"Jede Fl\xE4che, in der diese ganz liegt, bekommt hier ein Loch \u2013 ein Pool in der Terrasse, ein Teich oder eine Wildfl\xE4che im Rasen. Die Reihenfolge beim Zeichnen spielt keine Rolle. Ein Pool schneidet sich von selbst aus.",outdoor_area_hint:"Der Home-Assistant-Bereich dieser Fl\xE4che (Garten, Terrasse, Pool): seine Ger\xE4te und Sensoren stehen unter Drau\xDFen, und ein Pin auf der Fl\xE4che \xF6ffnet es.",pool_temp:"Wassertemperatur (optional)",pool_pump:"Pumpe / Filter (optional)",pool_pump_on:"Pumpe l\xE4uft",outdoor_slope:"Gef\xE4lle (m)",outdoor_slope_hint:"H\xF6henunterschied von der hohen zur tiefen Kante; die hohe Kante liegt auf dem H\xF6henversatz. Leuchten auf der Fl\xE4che folgen.",outdoor_slope_dir:"F\xE4llt nach",slope_x:"rechts (+X)",slope_nx:"links (\u2212X)",slope_z:"unten (+Z)",slope_nz:"oben (\u2212Z)",north:"Nordrichtung (\xB0 im Uhrzeigersinn von oben)",north_hint:"Die Nordrichtung braucht der Sonnenstand (Licht durch die Fenster).",map_on:"Echte Karte unter dem Plan anzeigen",map_lat:"Breitengrad",map_lon:"L\xE4ngengrad",map_use_ha:"Standort von Home Assistant \xFCbernehmen",map_opacity:"Sichtbarkeit (%)",map_zoom:"Detailstufe",map_zoom_coarse:"grob",map_zoom_fine:"fein",map_move:"Karte unter dem Plan verschieben",map_step:"Schritt",map_url:"Eigene Kachel-Adresse (leer = OpenStreetMap)",map_hint:"Dein Browser l\xE4dt die Kartenkacheln direkt vom Kartenserver (standardm\xE4\xDFig OpenStreetMap, bitte deren Nutzungsbedingungen beachten); solange die Karte aus ist, wird nichts geladen. Der Plan liegt auf der Karte, wie der Kompass es sagt \u2013 drehe den Kompass oder verschiebe die Karte, bis das Haus passt.",compass_title:"Kompass",compass_n_short:"N",compass_s_short:"S",compass_swap:"Nord \u2194 S\xFCd tauschen",compass_swap_hint:"Dreht den Kompass um 180\xB0. Zeichnung, Dachfl\xE4chen und Solarfelder bleiben, wie sie sind.",compass_hint:"Stimmt der Kompass nicht mit der Wirklichkeit \xFCberein, drehst du ihn hier \u2013 nichts muss neu gezeichnet werden. Sonnenlicht, Wind und die Himmelsrichtungen der Dachfl\xE4chen richten sich danach.",roof:"Dach",roof_none:"Kein Dach",roof_flat:"Flachdach",roof_gable:"Satteldach",roof_custom:"Dachfl\xE4chen (frei)",roof_sections:"Dachfl\xE4chen",roof_sections_hint:"Jede Dachfl\xE4che deckt ein Rechteck des Hauses ab, etwa das Wohnhaus, die Scheune oder einen Anbau \u2013 jede mit eigener Form, Firstrichtung, Traufh\xF6he und Neigung. Eine neue Fl\xE4che ziehst du im Plan auf; antippen w\xE4hlt sie aus, ziehen verschiebt sie, die Ecken \xE4ndern die Gr\xF6\xDFe.",roof_sections_start:"Dachfl\xE4chen aus den R\xE4umen erzeugen",roof_sections_regen:"Neu aus den R\xE4umen erzeugen",roof_sections_off:"Zur\xFCck zu einem Dach",roof_regen_confirm:"Alle Dachfl\xE4chen durch einen neuen Vorschlag aus den R\xE4umen ersetzen?",roof_section:"Dachfl\xE4che",roof_section_hint:"H\xF6hen z\xE4hlen vom Boden. Eine Seite mit tieferer Traufe zieht weiter herunter (Abschleppdach); Pultd\xE4cher steigen von der ersten Seite an.",roof_shape_gable:"Sattel",roof_shape_hip:"Walm",roof_shape_pent:"Pult",roof_shape_flat:"Flach",roof_shape_halfhip:"Kr\xFCppelwalm",roof_shape_pyramid:"Zelt",roof_shape_mansard:"Mansard",roof_shape_parapet:"Attika",roof_shape:"Form",roof_end_start:"Ende am Firstanfang",roof_end_end:"Ende am Firstende",roof_halfhip:"Kr\xFCppelwalm beginnt bei",roof_halfhip_hint:"Wie weit oben am Giebel die Walmfl\xE4che beginnt, als Anteil der Giebelh\xF6he: niedrig = ein gro\xDFer Walm, hoch = nur die Spitze ist abgewalmt.",roof_axis_x:"First \u2194",roof_axis_z:"First \u2195",roof_eave:"Traufe (m)",roof_pitch_short:"Neigung (\xB0)",roof_height:"H\xF6he (m)",roof_base:"Wandoberkante (m)",roof_rotation:"Drehung (\xB0)",roof_on_floor:"Sitzt auf Etage",roof_on_floor_hint:"Setzt den Abschnitt auf die Wandoberkante dieser Etage; Grundh\xF6he und Traufen wandern mit. In der 3D-Ansicht geh\xF6rt das Dach zu dieser Etage.",roof_base_hint:"Liegt sie unter der Deckenh\xF6he des Geschosses darunter, enden dessen W\xE4nde an der Dachunterseite: Kniestock an der Traufe, Giebel bis zum First, Innenw\xE4nde an der Schr\xE4ge. Im Grundriss zeigen gestrichelte Linien, wo 1,5 m und 2 m Kopfh\xF6he bleiben.",roof_ridge_height:"Firsth\xF6he",roof_side_top:"oben",roof_side_bottom:"unten",roof_side_left:"links",roof_side_right:"rechts",roof_swap:"Seiten tauschen",roof_open:"\xDCberdachung (Pfosten statt W\xE4nde, durchsichtig)",roof_open_short:"\xDCberdachung",roof_dormer:"Gaube",roof_dormer_hint:"Eine Gaube auf dieser Dachseite: 2 m breit, Front an der Traufwand, Traufe 1,4 m \xFCber der Dachtraufe, Satteldach. Danach verschieben, Breite und H\xF6hen \xE4ndern wie bei jeder Dachfl\xE4che; die Hauptfl\xE4che \xF6ffnet sich darunter, die Wand des Dachgeschosses steigt bis zur Gaube \u2013 dort passt ein Fenster.",roof_outline:"Umriss des Geschosses \xFCbernehmen",roof_outline_hint:"Ein Flachdach als freie Form: \xFCbernimmt den Umriss der R\xE4ume des angezeigten Geschosses (auch L- oder Z-f\xF6rmig) als eine Fl\xE4che ohne Kanten. Die Ecken lassen sich danach ziehen.",roof_points_hint:"Freie Form: Ziehe die Ecken im Plan, ein + auf einer Kante f\xFCgt eine Ecke hinzu, \xD7 entfernt eine. Zur\xFCck zum Rechteck l\xF6scht die Form.",roof_rect:"Zur\xFCck zum Rechteck",roof_open_hint:"F\xFCr Terrassendach oder Carport: Statt W\xE4nden tragen Pfosten und Balken das Dach, die Fl\xE4che ist durchsichtig. Wo die \xDCberdachung an die Hauswand st\xF6\xDFt, liegt sie auf der Wand auf.",roof_swap_hint:"Dreht das Dach um: Die beiden Seiten tauschen Traufe und Neigung, ein Pultdach steigt in die andere Richtung.",roof_pitch:"Dachneigung (\xB0)",roof_overhang:"Dach\xFCberstand (m)",roof_overhang_sides:"\xDCberstand je Seite",roof_overhang_a:"\xDCberstand Traufe A (m)",roof_overhang_b:"\xDCberstand Traufe B (m)",roof_overhang_u0:"\xDCberstand Giebel vorn (m)",roof_overhang_u1:"\xDCberstand Giebel hinten (m)",roof_overhang_auto:"Wieder automatisch",roof_overhang_sides_hint:"Ohne eigene Werte ist der \xDCberstand automatisch: \xFCberall gleich, au\xDFer wo der Dachteil ans Haus st\xF6\xDFt (dort keiner).",roof_ridge:"First",roof_ridge_long:"Entlang der langen Seite",roof_ridge_short:"Entlang der kurzen Seite (z. B. Reihenhaus)",device:"Ger\xE4t",lamp_mount:"Lampe",lamp_ceiling:"Deckenleuchte",lamp_floor:"Stehlampe",lamp_table:"Tischlampe",lamp_wall:"Wandleuchte",marker_height:"H\xF6he des Symbols (m)",height_auto:"H\xF6he automatisch",device_centre:"In Raummitte",lights_spread:"Deckenlampen gleichm\xE4\xDFig verteilen",devices_search:"Ger\xE4te suchen \u2026",devices_more:"+{n} weitere",devices_less:"weniger",panel_more:"Weitere Ger\xE4te des Bereichs ({n})",panel_less:"Weniger anzeigen",gaps_close:"L\xFCcken schlie\xDFen",gaps_hint:"R\xE4ume mit bis zu 60 cm Abstand an einer gemeinsamen Wand zusammenf\xFChren; der Abstand wird die Innenwandst\xE4rke.",gaps_none:"Keine L\xFCcken zwischen R\xE4umen gefunden.",gaps_closed:"{n} Stellen geschlossen.",gaps_closed_wall:"{n} Stellen geschlossen, Innenwand jetzt {t} m.",fps:"FPS",fps_title:"Leistungsanzeige (Bilder pro Sekunde)",hint_garage:"Auf eine Wand tippen, um ein Garagentor einzusetzen",opening_garage:"Garagentor",garage_hint:"Das Tor folgt einem Garagen-Cover (Position oder offen/zu) oder einem Garagentor-Kontakt aus dem Bereich des Raums.",door_hint:"Mit T\xFCrkontakt schwenkt das T\xFCrblatt auf, ohne Sensor steht es halb offen.",hint_door:"Auf eine Wand tippen, um eine T\xFCr einzusetzen",hint_window:"Auf eine Wand tippen, um ein Fenster einzusetzen",opening_door:"T\xFCr",opening_window:"Fenster",opening_type:"Art",opening_position:"Mitte ab Ecke (m)",sill:"Br\xFCstung (m)",opening_height:"H\xF6he (m)",hinge:"Anschlag (vom Raum aus)",hinge_left:"Links",hinge_right:"Rechts",cover_entity:"Rollladen",door_cover:"Antrieb (T\xFCr oder Tor mit Motor)",cover_position_entity:"Positions-Sensor (live)",cover_position_invert:"Positionssensor in 3D umkehren (0 = offen)",contact_entity:"Kontakt",sensor_kind:"Sensor-Art",sensor_kind_contact:"Fensterkontakt (offen/zu)",sensor_kind_handle:"Griff-Sensor (offen/gekippt/zu)",sensor_kind_contact_tilt:"Kontakt + Kipp-Sensor",handle_entity:"Griff-Sensor",handle_main:"Griff-Sensor Hauptfl\xFCgel",leaf_main:"Hauptfl\xFCgel",leaf_second:"Zweiter Fl\xFCgel",tilt_entity:"Kipp-Sensor",tilt_angle_entity:"Kippwinkel-Sensor (\xB0, optional)",tilt_angle_max:"Winkel f\xFCr \u201Eganz gekippt\u201C (\xB0)",tilt_angle_offset:"Offset: Winkel bei geschlossenem Fenster (\xB0)",tilt_angle_invert:"Winkel z\xE4hlt andersherum",door_shut:"Ohne Sensor geschlossen zeigen",door_shut_hint:"Eine T\xFCr ohne Kontakt steht in 3D halb offen, damit man sie als T\xFCr erkennt. Mit Haken wird sie geschlossen gezeichnet \u2013 Haust\xFCr, Carport, Nebent\xFCr.",door_angle:"\xD6ffnungswinkel",door_angle_default:"Standard",door_angle_hint:"Wie weit das T\xFCrblatt aufgeht. Mit Sensor \xF6ffnet es so weit, sobald er \u201Eoffen\u201C meldet; ohne Sensor steht es so weit offen (statt halb). Standard bleibt wie bisher.",entity_auto:"Automatisch ({name})",entity_auto_none:"Automatisch (keiner gefunden)",entity_none:"Keiner",entity_search:"Tippen zum Suchen \u2026",opening_hint:"Sensor-Art: Fensterkontakt (meldet offen/zu), Griff-Sensor (meldet offen, gekippt und zu \u2013 z. B. Homematic-Fenstergriff) oder Kontakt + Kipp-Sensor (ein zweiter Sensor, der nur \u201Egekippt\u201C meldet). Automatisch nimmt Rolll\xE4den und Kontakte aus dem Bereich des Raums. Positions-Sensor: eine Entit\xE4t, die die Rollladen-Position auch w\xE4hrend der Fahrt meldet (z. B. Homematic \u201ELevel\u201C, 0\u2013100 % oder 0\u20131, offen = hoch) \u2013 dann f\xE4hrt der Rollladen in 3D live.",furniture:"M\xF6bel",furniture_add:"M\xF6bel hinzuf\xFCgen",studio_new:"Eigenes M\xF6bel bauen",studio_title:"M\xF6bel-Werkstatt",studio_title_edit:"M\xF6bel-Werkstatt: \xE4ndern",studio_hint:"W\xE4hle eine Vorlage, stell Ma\xDFe und Fronten ein und setz das M\xF6bel in den Plan. Es landet im Pack \u201EEigene M\xF6bel\u201C und l\xE4sst sich sp\xE4ter hier wieder \xE4ndern.",studio_kind:"Vorlage",studio_kind_cabinet:"Schrank",studio_kind_shelf:"Regal",studio_kind_lamp:"Lampe",studio_kind_device:"Ger\xE4t",studio_name:"Name",studio_width:"Breite (cm)",studio_depth:"Tiefe (cm)",studio_height:"H\xF6he (cm)",studio_doors:"T\xFCren",studio_drawers:"Schubladen",studio_shelves:"B\xF6den",studio_handle:"Griffe",studio_handle_bar:"Stangengriff",studio_handle_knob:"Knopf",studio_handle_none:"Grifflos",studio_base:"Unterbau",studio_base_plinth:"Sockel",studio_base_legs:"F\xFC\xDFe",studio_base_none:"Ohne",studio_back:"R\xFCckwand",studio_lamp:"Art",studio_lamp_floor:"Stehlampe",studio_lamp_table:"Tischlampe",studio_lamp_pendant:"Pendelleuchte",studio_lamp_wall:"Wandleuchte",studio_display:"Display vorne (zeigt den Mediaplayer)",studio_mount:"Steht",studio_mount_floor:"Auf dem Boden",studio_mount_surface:"Auf einem M\xF6bel",studio_mount_wall:"An der Wand",studio_color_body:"Korpus",studio_color_lamp_body:"Fu\xDF und Gestell",studio_color_front:"Fronten",studio_color_boards:"B\xF6den",studio_color_shade:"Schirm",studio_color_display:"Rahmen des Displays",studio_color_white:"Wei\xDF",studio_color_wood:"Holz",studio_color_metal:"Metall",studio_color_dark:"Dunkel",studio_color_glass:"Glas",studio_color_accent:"Akzent",studio_color_own:"Eigene Farbe",studio_color_plan:"Farbe des Plans",studio_place:"In den Plan setzen",studio_save:"\xC4nderung speichern",studio_open:"In der Werkstatt \xE4ndern",studio_error:"Speichern ging nicht: {detail}",studio_pack_name:"Eigene M\xF6bel",studio_pack_publisher:"M\xF6bel-Werkstatt",furniture_search:"M\xF6bel suchen \u2026",furniture_search_none:"Nichts gefunden. Versuch ein anderes Wort \u2013 deutsch oder englisch.",furniture_type:"M\xF6belst\xFCck",rotation:"Drehung (\xB0)",tilt_x:"Neigung vorn/hinten (\xB0)",tilt_z:"Neigung seitlich (\xB0)",strip_tilt:"Neigung um die L\xE4nge (\xB0)",strip_upright:"Senkrecht",strip_rise:"Steigung entlang der L\xE4nge (\xB0)",strip_upright_hint:"Der Streifen steht hochkant: Seine L\xE4nge l\xE4uft von der H\xF6he \xFCber Boden nach oben \u2013 am T\xFCrrahmen, als Lichts\xE4ule. Die Neigung legt einen liegenden Streifen an die Schr\xE4ge (90\xB0 = Fl\xE4che zeigt zur Seite).",rotate_left:"\u21BA 90\xB0",rotate_right:"\u21BB 90\xB0",height_m:"H\xF6he (m)",furn_sofa:"Sofa",furn_armchair:"Sessel",furn_table:"Tisch",furn_chair:"Stuhl",furn_bed:"Bett",furn_nightstand:"Nachttisch",furn_wardrobe:"Schrank",furn_shelf:"Regal",furn_kitchen:"K\xFCchenzeile",furn_worktop:"Arbeitsplatte",furn_fridge:"K\xFChlschrank",furn_fridge_smart:"Smart-K\xFChlschrank (Side-by-Side)",furn_door_left:"T\xFCrsensor links (Gefrierseite)",furn_door_right:"T\xFCrsensor rechts (K\xFChlseite)",fridge_hint:"Meldet ein T\xFCrsensor \u201Eoffen\u201C, schwingt die T\xFCr in 3D auf.",furn_stove:"Herd",furn_sink:"Sp\xFCle",furn_bathtub:"Badewanne",furn_shower:"Dusche",furn_wc:"WC",furn_washbasin:"Waschtisch",furn_desk:"Schreibtisch",furn_tv_board:"TV-Board",furn_plant:"Pflanze",furn_rug:"Teppich",furn_stairs:"Treppe",furn_stairwell:"Boden\xF6ffnung",stairwell_hint:"Ein Loch im Boden dieser Etage, zum Beispiel \xFCber dem Treppenaufgang oder f\xFCr eine Galerie; von oben sieht man hindurch. Die \xD6ffnung muss ganz in einem Raum liegen; mehrere \xD6ffnungen d\xFCrfen sich \xFCberlappen (zum Beispiel f\xFCr eine L-Form). Eine Treppe auf der Etage darunter, die bis hier hinauf reicht, \xF6ffnet den Boden auch von selbst.",tool_hole:"Boden\xF6ffnung",tool_stairs:"Treppe",hint_stairs:"Ziehen, wo die Treppe stehen soll \u2013 sie l\xE4uft entlang der langen Seite; Form, Drehrichtung und Bauart stellst du danach rechts ein",tool_roof:"Dach",tool_energy:"Energie",tool_wall:"Wand",hint_wall:"Ziehen, um eine einzelne Wand zu zeichnen (Raumteiler, halbe Wand) \xB7 Umschalt h\xE4lt sie gerade \xB7 Alt ohne Fangen",free_wall:"Wand",wall_length:"L\xE4nge (m)",wall_thickness:"Wandst\xE4rke (m)",wall_height:"H\xF6he (m)",wall_height_full:"Volle Raumh\xF6he",wall_slope:"Schr\xE4g",wall_slope_start:"H\xF6he am Anfang (m)",wall_slope_end:"H\xF6he am Ende (m)",wall_slope_hint:"Schr\xE4ge Wand: die Oberkante l\xE4uft gerade von der H\xF6he am Anfang der Wand (Ecke mit der kleineren Nummer) zur H\xF6he am Ende. Beide H\xF6hen d\xFCrfen \xFCber der Geschossh\xF6he liegen, zum Beispiel f\xFCr ein Pultdach-Zimmer mit hohen Oberlichtern.",wall_slope_off:"Wieder eine ebene Wand",wall_none:"Keine Wand",wall_none_hint:"Diese Wand ganz weglassen: f\xFCr offene Grundrisse, bei denen R\xE4ume baulich ein Raum sind, in Home Assistant aber getrennt.",edge_thickness:"Dicke (m)",wall_thickness_hint:"Dicke dieser Wand, z. B. 0,365 an einer dicken Au\xDFenwand oder 0,115 an einer leichten Trennwand. Eine Wand zwischen zwei R\xE4umen nimmt die dickere Angabe.",wall_thickness_reset:"Dicke wie im Haus eingestellt",wall_heights:"Wandh\xF6hen",wall_n:"Wand {a}\u2013{b}",wall_view:"Wandansicht",wall_view_hint:"Die Wand von vorne: T\xFCren, Fenster und M\xF6bel an ihr ziehen oder ihren Abstand eintippen.",wall_view_prev:"Vorige Wand",wall_view_next:"N\xE4chste Wand",wall_view_left:"Abstand links (m)",wall_view_height:"H\xF6he \xFCber Boden (m)",wall_part:"Teil {n}",wall_split_hint:"Wand hier teilen: Das Teilst\xFCck bekommt eine eigene H\xF6he, z. B. 2,5 m neben 1,7 m in einer Flucht",wall_split_at:"Teilpunkt ab Ecke (m)",wall_join_hint:"Teilpunkt entfernen: Das Teilst\xFCck w\xE4chst wieder mit dem davor zusammen",wall_exterior_short:"Au\xDFenwand",room_wall_hint:"Eine niedrigere H\xF6he macht aus der Wand eine Br\xFCstung oder Theke. Teilen sich zwei R\xE4ume die Wand, gilt die niedrigere Einstellung. Fenster und T\xFCren darin enden an der Wandh\xF6he.",free_wall_hint:"Eine frei stehende Wand, zum Beispiel ein Raumteiler. Trifft sie auf eine Raumwand, wird die Ecke verschnitten. Die Endpunkte ziehst du an den Griffen, die ganze Wand verschiebst du an der Linie.",free_wall_slope:"\u25E2 Schr\xE4g",free_wall_slope_hint:"Die Wand wird von einem Ende zum anderen h\xF6her oder niedriger: oben die H\xF6he am Anfang, hier die am Ende.",free_wall_height_end:"H\xF6he am Ende (m)",arc:"Bogen",arc_hint:"Biegt die Wand zu einem Bogen. Ein Nachbarraum an dieser Wand biegt sich mit, T\xFCren und Fenster wandern mit; R\xFCckg\xE4ngig nimmt den Bogen zur\xFCck.",arc_bulge:"W\xF6lbung (m)",arc_bulge_hint:"Wie weit sich die Wand in der Mitte w\xF6lbt: positiv nach au\xDFen, negativ in den Raum.",arc_apply:"Biegen",arc_too_wide:"Eine T\xFCr oder ein Fenster in dieser Wand ist f\xFCr diesen Bogen zu breit. Mach den Bogen flacher oder die \xD6ffnung schmaler.",stairwell_outside:"Diese \xD6ffnung ragt \xFCber eine Raumgrenze und wird deshalb nicht ausgeschnitten. Ziehe sie ganz in einen Raum oder verkleinere sie.",hint_hole:"Ziehen, um eine Boden\xF6ffnung aufzuziehen (Treppenaufgang, Galerie)",hint_roof:"Dachfl\xE4che aufziehen \xB7 antippen w\xE4hlt aus \xB7 ziehen verschiebt \xB7 Ecken \xE4ndern die Gr\xF6\xDFe",hint_energy:"Solarfeld antippen w\xE4hlt aus \xB7 ziehen verschiebt, auch auf eine andere Dachfl\xE4che \xB7 neue Felder rechts mit + Solarfeld",furn_parking:"Stellplatz",furn_group_vehicles:"Stellpl\xE4tze",parking_entity:"Sensor \u201EAuto anwesend\u201C",parking_vehicle:"Fahrzeug",parking_vehicle_none:"Keins",parking_no_pack:"Kein Fahrzeug-Pack importiert \u2013 Fahrzeuge kommen aus dem Pack \u201EFahrzeuge\u201C (Erweiterungen \u2192 M\xF6bel-Packs).",parking_scale:"Gr\xF6\xDFe (%)",parking_type_entity:"Fahrzeugtyp-Sensor (optional)",parking_types:"Zustand \u2192 Fahrzeug",parking_type_state:"Zustand (z. B. van)",parking_add_type:"+ Zuordnung",parking_hint:"Ohne Sensor steht das Fahrzeug immer da. Mit Sensor erscheint es, sobald der Sensor \u201Ean\u201C, \u201Ehome\u201C oder \u201Eanwesend\u201C meldet. Ein Fahrzeugtyp-Sensor (z. B. aus einer KI-Kameraauswertung) w\xE4hlt das Modell: Passt sein Zustand zu einer Zuordnung \u2013 auch als Wort im Text \u2013, wird dieses Fahrzeug gezeigt, sonst das Standard-Fahrzeug.",parking_too_tall:"Das Fahrzeug ({car} m) ist h\xF6her als der Raum ({room} m).",furn_lamp_ceiling:"Deckenleuchte",furn_lamp_downlight:"Einbauspot",furn_lamp_spot:"Aufbau-Spot",furn_lamp_panel:"LED-Panel",furn_lamp_uplight:"Deckenfluter",furn_lamp_bollard:"Wegleuchte",furn_lamp_garden:"Garten-Spot",furn_radiator:"Heizk\xF6rper",furn_robot_vacuum:"Saugroboter",furn_entity_vacuum:"Saugroboter",furn_entity_mower:"M\xE4hroboter",pet_room_sensor:"Raum-Sensor des Tiers (optional)",pet_room_hint:"Ein Sensor, der den Raum nennt, in dem das Tier gerade ist \u2013 Bermuda oder ESPresense mit einem Anh\xE4nger am Halsband: in 3D l\xE4uft es dann in diesem Raum herum.",furn_entity_water:"Ventil oder Schalter",device_temp:"Ger\xE4tetemperatur",device_temp_hint:"Ein Temperatursensor des Ger\xE4ts (Wechselrichter, Akku, PC \u2026): sein Wert steht am Pin in der 3D-Ansicht, ab 60 \xB0C ist der Pin hervorgehoben.",fridge_temp:"Temperatur K\xFChlteil",freezer_temp:"Temperatur Gefrierteil",fridge_temp_hint:"Der Pin zeigt die Temperaturen. \xDCber 8 \xB0C im K\xFChlteil oder \u221212 \xB0C im Gefrierteil leuchtet er als Warnung.",spray_reach:"Reichweite des Wassers (m)",spray_hint:"Solange das Ventil offen oder der Schalter an ist, spritzt der Sprenger Wasser in B\xF6gen um sich herum.",furn_robot_room:"Aktueller Raum (Sensor)",robot_cal_none:"Noch nicht kalibriert \u2013 ohne Bezug zur Karte bleibt die Fahrspur erfunden.",robot_cal_done:"Kalibriert: eine Rasterzelle misst {m} m.",robot_cal_do:"Von der jetzigen Position des Roboters kalibrieren",robot_cal_doing:"Tippe in den Plan, wo der Roboter gerade steht.",robot_cal_need:"Die Karte des Roboters meldet gerade keine Position \u2013 l\xE4uft die Integration?",robot_cal_hint:"Die Station ist der Anker: der Plan wei\xDF, wo sie steht, die Kamera wei\xDF, wo Roboter und Station in ihrem Raster liegen. Kennt die Karte R\xE4ume mit denselben Namen wie der Plan, reicht der Knopf \u201EAus den R\xE4umen kalibrieren\u201C. Sonst: Stell den Roboter mindestens 1,5 m entfernt ab \u2013 Reinigung pausieren \u2013 und tippe ihn im Plan an. Kommen die R\xE4ume spiegelverkehrt heraus, setze den Haken.",robot_cal_mirror:"Die Karte des Roboters ist gespiegelt (R\xE4ume kommen verkehrt heraus)",robot_cal_forget:"Kalibrierung entfernen",robot_cal_nudge:"Von Hand nachr\xFCcken: Pfeile schieben die Karte um 10 cm, \u27F2 \u27F3 drehen um 1\xB0, \u2212 + \xE4ndern die Gr\xF6\xDFe um 1 %.",robot_cal_nudge_move:"Karte verschieben",robot_cal_nudge_turn:"Karte drehen",robot_cal_nudge_grow:"Karte gr\xF6\xDFer oder kleiner",robot_cal_rooms:"Aus den R\xE4umen kalibrieren (die Karte kennt {n} R\xE4ume)",robot_cal_rooms_none:"Zu wenige R\xE4ume hei\xDFen im Plan so wie auf der Karte des Roboters ({n} gefunden, mindestens 2 n\xF6tig). Benenne die R\xE4ume gleich \u2013 oder kalibriere \xFCber die Position des Roboters.",robot_cal_rooms_bad:"Die gleichnamigen R\xE4ume liegen im Plan anders als auf der Karte des Roboters \u2013 ist ein Raum vertauscht? Kalibriere sonst \xFCber die Position des Roboters.",robot_hint:"Saugt der Roboter in Home Assistant, f\xE4hrt er in 3D in Bahnen durch den Raum, den er meldet (Sensor \u201EAktueller Raum\u201C, zugeordnet \xFCber den Raum- oder Bereichsnamen), sonst durch den Raum seiner Station. Ist die Karte des Roboters unten kalibriert, zeigt die Spur stattdessen, wo er wirklich gefahren ist; ohne sie sind die Bahnen erfunden. Zur\xFCck f\xE4hrt er zur Station.",furn_lamp_pendant:"Pendelleuchte",furn_ceiling_fan:"Deckenventilator",furn_fan_entity:"Ventilator",fan_hint:"Die Leuchte ist das Licht des Ventilators (leer lassen, wenn er keins hat). Der Ventilator wird im Raum gefunden oder hier gew\xE4hlt: In 3D drehen sich die Fl\xFCgel so schnell wie er l\xE4uft, sein Symbol schaltet ihn, Wischen hoch/runter \xE4ndert die Stufe, lange dr\xFCcken \xF6ffnet das Schnellmen\xFC. Die H\xF6he ist, wie weit er von der Decke h\xE4ngt (mehr = l\xE4ngere Stange).",room_ceiling:"Deckenh\xF6he",room_ceiling_tip:"Niedriger als das Stockwerk (ein Bad unter der Treppe) oder h\xF6her (ein Wohnzimmer offen bis unters Dach): Deckenleuchten, Ventilatoren, LED-Streifen und Ger\xE4te an der Decke h\xE4ngen dann hier, und die W\xE4nde des Raums sind so hoch.",room_ceiling_through:"Die Decke ({ceiling} m) liegt \xFCber der Etagenh\xF6he ({floor} m): Der Raum reicht in die Etage dar\xFCber, seine W\xE4nde wachsen mit, und die Etage dar\xFCber bleibt \xFCber ihm offen (Luftraum). Im Editor der oberen Etage ist die Fl\xE4che schraffiert.",room_floor_offset:"Bodenh\xF6he (m)",room_floor_offset_hint:"Liegt der Boden dieses Raums tiefer oder h\xF6her als die Etage (ein abgesenkter Eingang: \u22120,39), wandern Boden, W\xE4nde, T\xFCren und Fenster und was im Raum steht mit; die Decke bleibt. Die Stufen stellst du als Treppe dazu.",room_inner:"Innenma\xDF {w} \xD7 {d}",room_inner_hint:"Von Wand zu Wand gemessen: Innenw\xE4nde nehmen die H\xE4lfte ihrer Dicke, Au\xDFenw\xE4nde stehen au\xDFerhalb des Umrisses.",floor_heating:"Fu\xDFbodenheizung (optional)",floor_heating_hint:"Solange der Thermostat heizt (oder das Ventil offen, der Schalter an ist), gl\xFCht der Boden des Raums in 3D warm.",room_announce_speaker:"Lautsprecher f\xFCr Durchsagen",room_announce_quiet:"Ruhezeit f\xFCr Durchsagen",room_announce_hint:"Ohne Wahl spricht der Lautsprecher, der im Raum steht, sonst ein Sprachassistent, ein Echo oder ein Lautsprecher des Bereichs (nie ein Fernseher). In der Ruhezeit lassen Durchsagen an mehrere R\xE4ume diesen Raum aus; eine Durchsage nur f\xFCr ihn kommt trotzdem an.",ceiling_here:"Decke hier",ceiling_here_hint:"H\xF6he der Decke genau an dieser Stelle, z. B. bei einer Dachschr\xE4ge. Leer = Decke des Raums.",ceiling_slope:"An die Dachschr\xE4ge",ceiling_slope_hint:"Die Decke liegt hier unter der Dachschr\xE4ge: die Leuchte h\xE4ngt an deren Unterseite, genau \xFCber ihrem Platz.",furn_lamp_floor:"Stehlampe",furn_lamp_table:"Tischlampe",furn_lamp_wall:"Wandleuchte",furn_led_strip:"LED-Streifen",furn_group_lights:"Leuchten",furn_entity_light:"Licht oder Schalter",furn_color_entity:"Farbe und Helligkeit von (optional)",furn_color_entity_hint:"F\xFCr Lampen, die ein Relais (Shelly, Schaltaktor) ein- und ausschaltet, w\xE4hrend die Leuchte selbst Farbe und Helligkeit kennt: An/Aus kommt vom Schalter oben, Farbe und Helligkeit von dieser Entit\xE4t.",lamp_extra_light:"Leuchtmittel {n} (optional)",lamp_extra_hint:"Eine Leuchte mit mehreren Lichtern \u2013 Hauptlicht, Nachtlicht, Lichtring: Ist das Hauptlicht aus, leuchtet sie in 3D mit dem n\xE4chsten Licht, das an ist, etwas schw\xE4cher. Die Lichter schaltest du im Raumfenster einzeln.",furn_entity_climate:"Heizung (Thermostat)",lamp_hint:"Antippen in 3D schaltet die Leuchte, lange dr\xFCcken \xF6ffnet das Schnellmen\xFC. Auch Schalter (z. B. ein Relais f\xFCrs Deckenlicht) sind m\xF6glich \u2013 die Leuchte strahlt dann, solange er an ist. Tischlampen stehen automatisch auf dem M\xF6bel darunter.",lamp_hint_pendant:"H\xF6he = Abh\xE4ngung unter der Decke. Antippen in 3D schaltet, lange dr\xFCcken \xF6ffnet die Details.",theme:"Look",version_hint:"Installierte Version von NextFloor \u2013 Oberfl\xE4che; die Integration in Home Assistant meldet {backend}",accent:"Akzentfarbe",accent_hint:"Eigene Akzentfarbe: Linien und Leuchtkanten im Neon-Look, Kn\xF6pfe und Pins \u2013 \u21BA setzt das Neon-Cyan zur\xFCck",accent_reset:"Zur\xFCck zu Cyan",furn_colors_card:"M\xF6belfarben dieser Karte",furn_color_house:"Farbe des Hauses",theme_neon:"Neon",theme_blueprint:"Blueprint",theme_day:"Tag",theme_auto:"Auto",clock:"Uhr",clock_none:"Keine",clock_top_left:"Oben links",clock_top_right:"Oben rechts",clock_bottom_left:"Unten links",clock_bottom_right:"Unten rechts",glass_walls:"Glasw\xE4nde",glass_walls_hint:"Wie deckend die W\xE4nde sind, durch die man in die R\xE4ume schaut: links fast unsichtbar, rechts undurchsichtig. Gilt f\xFCr diesen Bildschirm.",screen_name:"Name dieses Bildschirms",screen_name_hint:"Durchsagen erscheinen auf jedem offenen NextFloor-Bildschirm. Mit einem Namen (z. B. \u201EFlur\u201C) kann eine Durchsage auch nur an diesen Bildschirm gehen. Ohne Haken bleibt dieser Bildschirm still.",announce_on:"Durchsagen auf diesem Bildschirm an",announce_muted:"Durchsagen auf diesem Bildschirm stumm",lock3d_on:"3D sperren (Drehen, Zoomen und Verschieben aus, Tippen geht weiter)",lock3d_off:"3D entsperren",walk:"Durchs Haus gehen",travel:"Zeitreise: die letzten 24 Stunden oder 7 Tage abspielen",travel_play:"Abspielen",travel_pause:"Anhalten",travel_loading:"Lade Verlauf \u2026",travel_failed:"Der Verlauf lie\xDF sich nicht laden.",travel_speed:"Tempo",travel_speed_min:"1 Min./s",travel_speed_10min:"10 Min./s",travel_speed_hour:"1 Std./s",travel_days:"Tage",travel_live:"Live",card_travel_button:"Taste f\xFCr die Zeitreise",walk_stop:"Gehen beenden",walk_hint:"Ziehen: umsehen \xB7 W A S D / Pfeile oder Stick: gehen \xB7 Mausrad: Schritt",card_walk_button:"Taste zum Durchgehen",card_lock_button:"Taste f\xFCr die 3D-Sperre",backdrop:"Eigener Hintergrund",backdrop_color:"Farbe",backdrop_image:"Bild (/local/\u2026 oder https://\u2026)",backdrop_dim:"Abdunkeln",backdrop_hint:"Statt des Himmels des Looks steht das Haus vor einer eigenen Farbe oder einem Bild. Ein Bild in /config/www ist unter /local/\u2026 erreichbar.",furnish:"Einrichten",split_3d:"3D daneben",plan_dims:"Ma\xDFe",plan_dims_hint:"Schreibt an jede Raumkante ihre L\xE4nge.",mount_height:"H\xF6he \xFCber Boden (m)",side_open:"Seitenleiste \xF6ffnen",side_close:"Schlie\xDFen",side_details:"Details zur Auswahl",side_pin:"Anheften",side_pinned:"Angeheftet",side_pin_hint:"Angeheftet bleibt die Seitenleiste immer offen; sonst klappt sie neben der 3D-Ansicht zu, solange nichts ausgew\xE4hlt ist",split_3d_hint:"Live-3D neben dem Plan: M\xF6bel und Ger\xE4te dort ziehen und drehen \u2013 mit R\xFCckg\xE4ngig, gespeichert wird mit dem Plan",size_w:"Breite (m)",size_d:"Tiefe (m)",size_h:"H\xF6he (m)",furnish_hint:"M\xF6bel, Leuchten und Ger\xE4te mit dem Finger ziehen \xB7 M\xF6bel rasten an W\xE4nden ein \xB7 antippen zum Drehen, f\xFCr H\xF6he und Montage",done:"Fertig",heatmap:"Heatmap",heat_off:"Normal",heat_short_temperature:"Temp.",heat_short_humidity:"Feuchte",heat_short_co2:"CO\u2082",heat_short_mould:"Schimmel",heat_short_power:"Strom",heat_short_comfort:"Komfort",heat_short_sun:"Sonne",heat_short_wifi:"WLAN",heat_short_values:"Werte",heat_temperature:"Temperatur",heat_humidity:"Luftfeuchtigkeit",heat_co2:"CO\u2082",heat_mould:"Schimmel",heat_power:"Stromverbrauch",heat_comfort:"Wohlf\xFChlwert",heat_sun:"Sonne heute",room_sun_hours:"{h} h Sonne heute ({facing})",open_since:"offen seit {time}",presence_now:"jemand da",presence_last:"zuletzt vor {time}",comfort_n:"Komfort {n}",empty_lights_hint:"{n} Licht an, seit {min} min niemand da.",empty_lights_off:"Licht aus",open_heating_hint:"{n} Fenster offen, w\xE4hrend die Heizung l\xE4uft.",open_heating_off:"Heizung aus",room_clean:"Reinigung (Skript oder Knopf)",room_clean_hint:"Ein Skript oder Knopf, der den Saugroboter in diesen Raum schickt (z. B. die Raumreinigung deiner Roboter-Integration). Das Raum-Panel zeigt dann \u201E\u{1F9F9} Saugen\u201C.",room_clean_run:"Saugen",room_clean_run_hint:"Schickt den Saugroboter in diesen Raum.",shade_hint:"Sonne auf {n} Fenstern bei {temp} \u2013 Rolll\xE4den senken?",shade_close:"Senken",room_sun_year:"Sonne \xFCbers Jahr",room_sun_year_hint:"Die Sonnenstunden durch die Au\xDFenfenster des Raums am 15. jedes Monats.",room_energy:"heute {today} \xB7 Monat {month}",room_energy_hint:"Aus der Statistik der Leistungssensoren der Ger\xE4te im Raum; die Kosten f\xFCr den Monat mit dem Tarif des Hauses.",heat_summer:"Sommer",heat_winter:"Winter",air_co2:"l\xFCften (CO\u2082)",air_humidity:"l\xFCften (feucht)",air_mould:"Schimmelgefahr \u2013 l\xFCften",room_curve_hint:"Die Temperatur des Raums in den letzten 24 Stunden",heat_values:"Werte am Raumnamen",heat_wifi:"WLAN",wifi_aps:"{n} Access Points \xB7 {clients} Ger\xE4te",wifi_network:"Netzwerk: {online} online \xB7 {offline} offline",wifi_none:"Stelle Access Points oder Router aus den Packs (Smart Home 2) auf und verkn\xFCpfe sie mit einer Entit\xE4t ihres Ger\xE4ts.",wifi_clients:"{n} Ger\xE4te",heat_none_found:"Keine passenden Sensoren in den Bereichen der R\xE4ume.",markers:"Symbole",markers_none:"Keine",markers_important:"Wichtige",markers_all:"Alle",furn_stool:"Hocker",furn_coffee_table:"Couchtisch",furn_tv_wall:"Fernseher (Wand)",furn_sideboard:"Sideboard",furn_table_round:"Runder Tisch",furn_bench:"Sitzbank",furn_corner_bench:"Eckbank",furn_bar_stool:"Barhocker",furn_kitchen_wall:"Oberschrank",furn_kitchen_tall:"Hochschrank mit Backofen",furn_island:"Kochinsel",furn_dishwasher:"Sp\xFClmaschine",furn_bunk_bed:"Etagenbett",furn_dresser:"Kommode",furn_washer:"Waschmaschine",furn_dryer:"Trockner",furn_office_chair:"B\xFCrostuhl",furn_tall_cabinet:"Hochschrank",furn_coat_rack:"Garderobe",furn_group_living:"Wohnen",furn_group_dining:"Essen",furn_group_kitchen:"K\xFCche",furn_group_sleeping:"Schlafen",furn_group_bath:"Bad & Hauswirtschaft",furn_group_work:"Arbeiten & Sonstiges",furn_group_energy:"Energie & Solar",energy_devices:"Ger\xE4te",wallbox_charging:"l\xE4dt",wallbox_plugged:"angesteckt",furn_soc:"Ladestand (%)",furn_export:"Einspeiseleistung (W, separater Sensor, optional)",furn_export_hint:"Meldet dein Z\xE4hler Bezug und Einspeisung in zwei Sensoren (z. B. Growatt, Tibber Pulse), nimm oben den Bezugs-Sensor als Leistung und hier den Einspeise-Sensor. Ein Sensor mit Vorzeichen braucht das nicht.",meter_parent:"H\xE4ngt an Z\xE4hler",meter_parent_none:"keinem (Hauptz\xE4hler)",meter_main:"Hauptz\xE4hler",meter_unmetered:"{w} ungemessen",meter_device_hint:"Steht das Ger\xE4t hinter einem Zwischenz\xE4hler (z. B. Balkonkraftwerk in einer Wohnung), z\xE4hlt seine Leistung zu dieser Wohnung. Der Zwischenz\xE4hler muss daf\xFCr in beide Richtungen messen (\u2212 = R\xFCckspeisung); z\xE4hlt er nur Bezug, f\xE4llt der Verbrauch der Wohnung bei \xDCberschuss zu hoch aus.",meter_sub_power:"Leistung des Zweigs (W, + = Bezug, \u2212 = R\xFCckspeisung)",meter_floors:"Versorgt die Etagen",meter_sub_hint:"Ein Zwischenz\xE4hler misst seinen Zweig, z. B. eine Wohnung. Ger\xE4te auf den angehakten Etagen h\xE4ngen in 3D an ihm statt am Hauptz\xE4hler; was der Hauptz\xE4hler dar\xFCber hinaus z\xE4hlt, steht als \u201EAllgemein (Rest)\u201C in der Bilanz.",furn_charge:"Ladeleistung (W, separater Sensor, optional)",furn_charge_hint:"Meldet dein Speicher Laden und Entladen in zwei Sensoren (z. B. Anker Solix), nimm oben den Entlade-Sensor als Leistung und hier den Lade-Sensor. Ein Sensor mit Vorzeichen braucht das nicht.",furn_wallbox_status:"Status (l\xE4dt, angesteckt)",charging_data:"Ladedaten",charging_card:"Ladestation als 3D-Kachel",charging_hint:"Verkn\xFCpfte Ladedaten erscheinen in der 3D-Kachel und im Raummen\xFC, auch ohne Leistungswert. Nicht verkn\xFCpfte Zeilen bleiben ausgeblendet. Zeitprofile und Integer-Aliase werden aus Symcon \xFCbernommen. Ohne Zeitprofil erkennt Automatisch Unix-Zeitstempel; numerische Ladezeiten ohne Einheit gelten als Sekunden. Die Formatwahl kann dies \xE4ndern. Die Werte dienen ausschlie\xDFlich der Anzeige.",charging_start:"Startzeit",charging_end:"Endzeit",charging_duration:"Ladezeit",charging_energy:"Geladene Energie",charging_lock:"Verriegelungsstatus",charging_time_format:"Zeitformat",charging_duration_unit:"Ladezeit-Einheit",charging_auto:"Automatisch",charging_value:"Symcon-Wert unver\xE4ndert",charging_seconds:"Sekunden",charging_minutes:"Minuten",charging_hours:"Stunden",charging_unix_seconds:"Unix-Zeit (Sekunden)",charging_unix_ms:"Unix-Zeit (Millisekunden)",energy_only_note:"\u26A1 Energie: Hier lassen sich nur Solarfelder und Energieger\xE4te verschieben, R\xE4ume und M\xF6bel sind gesperrt.",roof_only_note:"\u{1F3E0} Dach: Hier lassen sich nur Dachfl\xE4chen und Dachfenster verschieben, R\xE4ume und M\xF6bel sind gesperrt.",energy_devices_hint:"Stromz\xE4hler, Wechselrichter, Stromspeicher, Wallbox und Netzanschluss werden hier angelegt: auf der oben gew\xE4hlten Etage, im Grundriss verschiebbar. Mit Leistungssensor zeigen sie ihre Watt; der Z\xE4hler bekommt den Netzsensor, beim Strang w\xE4hlst du den Wechselrichter. Mehrere Wechselrichter und Speicher (etwa eine Balkonanlage dazu) gehen auch: Jeder bekommt seinen eigenen Sensor.",energy_routes:"Kabelwege",energy_routes_hint:"Wo ein Kabel wirklich l\xE4uft: Der Fluss folgt dann deinen Punkten statt eines Bogens quer durchs Haus. Ohne Weg bleibt es beim Bogen. Verbraucher behalten ihren Bogen.",route_conn_solar:"{name} \u2192 Wechselrichter",route_conn_battery:"Batterie \u2194 Haus",route_conn_inverter:"Wechselrichter \u2192 Haus",route_conn_grid:"Netz \u2194 Haus",route_conn_meter:"{name} \u2194 \xFCbergeordneter Z\xE4hler",route_conn_device:"{name} \u2194 Unterz\xE4hler",route_points:"{n} Punkte",route_none:"direkter Bogen",route_draw:"Weg zeichnen",route_redraw:"Neu zeichnen",route_drawing:"Tippe im Plan die Punkte an, durch die das Kabel l\xE4uft, vom einen Ende zum anderen; wechsle dazwischen das Geschoss, wo es durch die Decke geht. {n} Punkte.",route_undo:"Letzter Punkt",route_done:"Fertig",route_cable:"Als Kabel zeigen",route_cable_hint:"Zeichnet den Weg als sichtbares Kabel, nicht nur als feine Linie unter den Teilchen.",solar_fields:"Solarfelder",solar_hint:"Module aufs Dach legen: Sie liegen in der Neigung der Dachfl\xE4che, auf einem Flachdach stehen sie aufgest\xE4ndert. Im Grundriss l\xE4sst sich ein Feld mit der Maus verschieben.",solar_no_roof:"F\xFCr Solarfelder braucht das Haus ein Dach: unter Einstellungen ein Sattel- oder Flachdach, oder Dachabschnitte hier im Dach-Werkzeug.",solar_face_gone:"Dachfl\xE4che fehlt",solar_summary:"{n} Module \xB7 {kwp} kWp",solar_add:"Solarfeld",solar_field:"Solarfeld",solar_face:"Dachfl\xE4che",solar_rows:"Reihen",solar_cols:"Module pro Reihe",solar_portrait:"Hochformat",solar_landscape:"Querformat",solar_u:"Abstand vom Rand (m)",solar_v:"Abstand von der Traufe (m)",solar_tilt:"Neigung der Aufst\xE4nderung (\xB0)",solar_rack_ew:"Ost-West-Aufst\xE4nderung",solar_rack_ew_hint:"Jede zweite Reihe zeigt in die andere Richtung, die Paare stehen R\xFCcken an R\xFCcken \u2013 flach und dicht wie auf vielen Flachd\xE4chern.",solar_rack_tilt:"Aufst\xE4nderung (\xB0 zus\xE4tzlich)",solar_flip:"In die andere Richtung neigen",solar_partial:"nur {n} von {total} passen auf die Fl\xE4che",solar_form_hint:"Module, die \xFCber die Dachfl\xE4che hinausragen w\xFCrden, fallen weg. \u201EFl\xE4che f\xFCllen\u201C legt so viele Module aufs Dach, wie passen. kWp gerechnet mit 400 W je Modul.",solar_fit:"Fl\xE4che f\xFCllen",roof_windows:"Dachfenster",roof_window:"Dachfenster",chimneys:"Schornsteine",chimney:"Schornstein",chimney_shape:"Form",chimney_brick:"Gemauert",chimney_round:"Rund",chimney_wide:"Breit, zwei Z\xFCge",chimney_steel:"Edelstahlrohr",chimney_diameter:"Durchmesser (m)",chimney_depth:"Tiefe (m)",chimney_height:"H\xF6he \xFCber dem Dach (m)",chimney_hint:"Die H\xF6he z\xE4hlt ab der oberen Seite, wo der Schornstein aus dem Dach kommt. Im Grundriss und in der 3D-Ansicht l\xE4sst er sich verschieben, auch auf eine andere Dachfl\xE4che.",roof_windows_hint:"Dachfenster liegen in der Dachfl\xE4che, mit Rollladen und Kontakt wie normale Fenster. Im Grundriss lassen sie sich verschieben, auch auf eine andere Dachfl\xE4che.",roof_window_tilt:"Kippkontakt",roof_window_name:"Name (optional)",roof_window_motor:"Fenstermotor (Cover, optional)",roof_window_motor_hint:"Ein Fenstermotor (Velux, Roto, Fakro) meldet seine Position als Cover: Der Fl\xFCgel \xF6ffnet in 3D so weit, wie der Motor steht. Ein Kontakt oder Kippkontakt geht weiterhin ohne Motor.",roof_window_hint:"Offen klappt der Fl\xFCgel oben angeschlagen nach au\xDFen, gekippt ein St\xFCck, und der Rahmen leuchtet warm; der Rollladen f\xE4hrt von oben \xFCber die Scheibe. In einer Dachfl\xE4che schneidet das Fenster ein Loch in die Schr\xE4ge, so sieht das Dachgeschoss hinaus.",solar_ground:"Frei aufgest\xE4ndert (Garten, Garagendach \u2026)",solar_add_ground:"Frei aufgest\xE4ndert",solar_base:"H\xF6he der Aufstellfl\xE4che (m, 0 = Boden)",solar_add_wall:"An der Wand",solar_wall:"Wand",solar_v_wall:"H\xF6he \xFCber dem Boden (m)",solar_tilt_wall:"Neigung von der Wand (\xB0, 90 = Vordach)",solar_flip_wall:"Unten abstehend statt oben",solar_rotation:"Drehung (\xB0)",solar_name:"Name",solar_name_hint:"z. B. Strang 1 S\xFCd",solar_module_w:"Modulbreite (m)",solar_module_h:"Modulh\xF6he (m)",solar_wp:"Modulleistung (Wp)",solar_string:"Strang",solar_strings:"Str\xE4nge",solar_string_none:"Kein Strang",solar_string_new:"Neuer Strang",solar_string_n:"Strang {n}",solar_string_name:"Name des Strangs",solar_string_entity:"PV-Leistung des Strangs",solar_string_inverter:"Wechselrichter",solar_string_inverter_none:"Kein Wechselrichter gew\xE4hlt",inverter_strings:"Str\xE4nge an diesem Wechselrichter: {names}",inverter_strings_none:"Noch kein Strang an diesem Wechselrichter \u2013 zuordnen beim Solarfeld unter Strang \u203A Wechselrichter.",solar_string_inverter_missing:"Noch kein Wechselrichter im Plan (unten bei Ger\xE4te anlegen)",solar_string_hint:"Felder im selben Strang geh\xF6ren zusammen, auch auf verschiedenen D\xE4chern (z. B. 5 Module auf dem Haus und 5 auf der Garage). Sensor und Wechselrichter gelten f\xFCr den ganzen Strang.",solar_string_sum:"{fields} Felder \xB7 {n} Module \xB7 {kwp} kWp",solar_face_size:"Dachfl\xE4che {w} \xD7 {h} m (entlang der Traufe \xD7 die Schr\xE4ge hoch)",solar_cols_hint:"Eine Zahl f\xFCr gleich lange Reihen, oder eine Liste f\xFCr Reihen eigener L\xE4nge: \u201E4, 4, 3\u201C (von der Traufe aus).",solar_align_left:"Links",solar_align_center:"Mitte",solar_align_right:"Rechts",solar_look_black:"Full Black",solar_look_blue:"Blau",solar_pick:"Module einzeln an/aus",solar_pick_all:"Alle wieder an",solar_pick_hint:"Tippe im Grundriss auf ein Modul, um es wegzunehmen oder wieder dazuzunehmen. Weggenommene sind gestrichelt.",solar_entity:"PV-Leistung dieses Feldes (z. B. sein Strang)",solar_main:"Hauptdach",solar_section:"Abschnitt {n}",solar_flat:"Flachdach",compass_n:"Nord",compass_ne:"Nordost",compass_e:"Ost",compass_se:"S\xFCdost",compass_s:"S\xFCd",compass_sw:"S\xFCdwest",compass_w:"West",compass_nw:"Nordwest",furn_meter:"Stromz\xE4hler",furn_grid_point:"Netzanschluss",grid_point_hint:"Hier steht der Netzanschluss: der \xDCbergabepunkt zum Stromanbieter, zum Beispiel am Ende der Einfahrt. Im Grundriss verschiebbar.",furn_model:"Modell",inverter_std:"Standard (Wandger\xE4t mit Display)",inverter_slim:"Schmal und hoch (Lichtleiste)",inverter_hybrid:"Hybrid (Rund-Display, L\xFCfter)",battery_std:"Turm (gestapelte Module)",battery_wall:"Wandspeicher (flach, h\xE4ngend)",battery_cube:"Kompakt (Balkonspeicher)",furn_inverter:"Wechselrichter",furn_home_battery:"Stromspeicher",furn_wallbox:"Wallbox",furn_heating_manifold:"Heiz-/K\xFChlkreisverteiler",furn_buffer_tank:"Pufferspeicher",furn_freshwater_station:"Frischwasserstation",furn_entity:"Ger\xE4t (Schalter, Steckdose \u2026)",furn_state_entity:"Zustand von (optional)",furn_state_entity2:"Zweiter Zustand (andere H\xE4lfte)",furn_tap:"Antippen des M\xF6bels",furn_tap_default:"Wie \xFCblich",furn_tap_hint:"Eine eigene Aktion wie bei den eigenen Kn\xF6pfen des Sternmen\xFCs, z. B. ein browser_mod-Popup mit deiner Karte.",furn_show_when:"Nur zeigen, solange \u2026",furn_show_when_state:"\u2026 im Zustand (leer = an)",furn_show_when_invert:"Umgekehrt: zeigen, solange es nicht so ist",furn_show_when_hint:"Saison-Deko, die nur im Dezember steht: ein Helfer (input_boolean), ein Kalender oder ein Sensor entscheidet, ob das M\xF6bel in 3D erscheint. Mehrere Zust\xE4nde mit Komma trennen. Im Editor bleibt es immer sichtbar.",picture_upload:"Foto hochladen",picture_replace:"Anderes Foto hochladen",picture_stored:"Ein eigenes Foto ist gespeichert.",picture_url:"\u2026 oder Bild-Adresse",picture_entity:"\u2026 oder Bild einer Entit\xE4t",picture_border:"Passepartout (%)",picture_fit:"Foto",picture_fit_cover:"f\xFCllt den Rahmen",picture_fit_contain:"ganz zu sehen",picture_hint:"Dein Foto im Rahmen, in 3D und auf dem Wandtablet. Hochgeladene Fotos werden verkleinert mit dem Plan gespeichert; eine Bild-Entit\xE4t (z. B. Foto des Tages) oder eine Kamera zeigt ihr aktuelles Bild.",furn_state_split:"H\xE4lften",furn_state_left_right:"Links / rechts",furn_state_top_bottom:"Unten / oben (Hochbett)",furn_state_hint:"Das M\xF6bel leuchtet, solange die Entit\xE4t an, belegt oder zu Hause meldet \u2013 ein Bett mit Belegungsmatte, ein Sessel, die Sauna. Zwei Entit\xE4ten beleuchten die H\xE4lften: links und rechts, beim Hochbett unten und oben.",furn_entity_tv:"Fernseher (Media-Player oder Steckdose)",fix:"Fixieren",unfix:"L\xF6sen",fix_hint:"Fixiert: l\xE4sst sich nicht mehr versehentlich verschieben (Taste L, Rechtsklick oder langes Dr\xFCcken)",fixed_drag_hint:"\u{1F512} Fixiert \u2013 zum Verschieben erst l\xF6sen (Schloss im Formular, Rechtsklick oder Taste L)",fixed_delete_confirm:"Dieses Element ist fixiert. Trotzdem l\xF6schen?",lock_plan:"\u{1F512} Grundriss",lock_plan_hint:"Grundriss sperren: R\xE4ume, W\xE4nde, T\xFCren, Fenster und Au\xDFenfl\xE4chen lassen sich nicht mehr versehentlich verschieben. M\xF6bel und Ger\xE4te bleiben frei.",start_view:"Startansicht",start_view_hint:"Mit dieser Ansicht \xF6ffnen 3D-Ansicht, Karte und Kiosk das Haus, zum Beispiel von der Gartenseite. Drehe, zoome und verschiebe das Haus in der 3D-Ansicht rechts, bis es passt, und merke sie dir dann.",start_view_card:"Soll eine Karte eine andere Ansicht haben: diese Zeile in ihre YAML-Konfiguration \xFCbernehmen.",start_view_set:"Aktuelle 3D-Ansicht als Start merken",start_view_reset:"Standard",start_view_saved:"Eine eigene Startansicht ist gespeichert.",ctx_rotate:"Drehen 90\xB0",devices_placed_in:"in {room}",devices_narrow:"{n} weitere \u2013 Suche eingrenzen",climate:"Raumklima",climate_temperature:"Temperatur",climate_humidity:"Luftfeuchte",climate_co2:"CO\u2082",climate_hint:"Diese Sensoren gelten f\xFCr die Heatmap und das Raumfenster. \u201EAutomatisch\u201C nimmt die Sensoren des Bereichs und die im Raum platzierten, aber keine Ger\xE4tetemperaturen (3D-Drucker, W\xE4rmepumpe, Vorlauf \u2026).",climate_more:"\u2026 und noch ein Sensor (Mittelwert)",plan_locked:"Grundriss gesperrt",plan_lock:"Grundriss sperren",plan_unlock:"Grundriss entsperren",opening_mark:"Markieren in 3D",opening_mark_open:"Wenn offen",opening_mark_closed:"Wenn geschlossen (z. B. WC)",opening_mark_hint:"Ein markiertes Fenster oder eine markierte T\xFCr leuchtet warm. \u201EWenn geschlossen\u201C braucht einen Kontakt; ohne Sensor wird nichts markiert.",window_opens:"\xD6ffnet",window_opens_turn:"Dreh-Kipp (nach innen)",window_opens_slide:"Schiebend (Schiebefenster, Hebe-Schiebet\xFCr)",window_opens_top:"Klappfenster (unten nach au\xDFen)",window_opens_hint:"Schiebend: Der Fl\xFCgel auf der Seite des Scharniers gleitet vor den festen; zweifl\xFCgelig gleiten die beiden mittleren nach au\xDFen. Klappfenster \xF6ffnen mit dem Kontakt oder einem Kippsensor.",marker_show:"Symbol in 3D",marker_show_hint:"Automatisch folgt dem Schalter Keine / Wichtige / Alle in der 3D-Ansicht. Immer zeigen und Ausblenden gelten unabh\xE4ngig davon (au\xDFer bei Keine).",pin_shift:"Pin verschieben",pin_shift_up:"\u2191 H\xF6he",pin_shift_hint:"Stehen Ger\xE4te dicht beieinander, schiebst du den Pin hier ein St\xFCck zur Seite oder nach oben (in Metern); das Ger\xE4t selbst bleibt, wo es ist.",marker_show_auto:"Automatisch",marker_show_always:"Immer zeigen",marker_show_no_power:"Ohne Watt",marker_show_active:"Nur wenn aktiv",marker_show_never:"Ausblenden",marker_icon:"Eigenes Symbol (Material-Design-Icon)",device_name:"Eigener Name (optional)",show_name:"Name unter dem Symbol in 3D zeigen",card_marker_names:"Eigene Namen an den Symbolen",card_marker_names_hint:"Jedes Ger\xE4t mit eigenem Namen zeigt ihn klein unter seinem Symbol \u2013 drei Thermometer im Garten bleiben unterscheidbar.",card_tap_in_room:"Ger\xE4te nur im ge\xF6ffneten Raum schalten",card_tap_in_room_hint:"In der Haus- und Stockwerksansicht \xF6ffnet ein Antippen das Stockwerk oder den Raum, auch auf einem Ger\xE4t oder seinem Symbol. Im ge\xF6ffneten Raum schaltet es das Ger\xE4t. Langes Dr\xFCcken \xF6ffnet immer sein Men\xFC oder seine Details.",card_markers_outside:"Symbole au\xDFerhalb des ge\xF6ffneten Raums w\xE4hlen",card_markers_outside_hint:"Im Haus, auf dem Stockwerk und in den anderen R\xE4umen nur die angehakten Arten; im ge\xF6ffneten Raum alle wie oben eingestellt. \u201EImmer\u201C und \u201ENie\u201C am Ger\xE4t gehen vor.",marker_kind_light:"Lichter",marker_kind_cover:"Rolll\xE4den",marker_kind_climate:"Heizung",marker_kind_media:"Medien",marker_kind_switch:"Schalter",marker_kind_fan:"Ventilatoren",marker_kind_lock:"Schl\xF6sser",marker_kind_binary:"Kontakte und Melder",marker_kind_sensor:"Sensoren",marker_kind_tap:"M\xF6bel mit Aktion",marker_kind_other:"Sonstige",device_name_hint:"Ein Name f\xFCr den Plan und das Raumfenster, z. B. \u201EDekolicht Kochinsel\u201C \u2013 die Entit\xE4t in Home Assistant bleibt, wie sie ist.",device_simple:"Im Raumfenster nur schalten",device_simple_hint:"Der Raumdialog zeigt f\xFCr diese Lampe nur den Schalter, ohne Helligkeit, Farbtemperatur und Farben.",floor_turn:"90\xB0 drehen",floor_shift_all:"Alle Etagen mitnehmen (ganzes Haus)",floor_shift_all_hint:"Verschieben und Drehen wirken auf alle Etagen samt Dachfl\xE4chen, Au\xDFenfl\xE4chen, Energieger\xE4ten und Z\xE4hler \u2013 das ganze Haus wandert als Ganzes.",floor_turn_hint:"Dreht alles auf der Etage um 90\xB0 im Uhrzeigersinn um die Mitte der R\xE4ume \u2013 wenn eine Etage verdreht gezeichnet wurde. Dreimal = 270\xB0.",marker_icon_hint:"Name eines Material-Design-Icons wie bei Home Assistant, z. B. mdi:thermometer oder mdi:water-alert. Leer = Symbol nach Ger\xE4teart.",furn_power:"Leistungssensor (W)",furn_links_hint:"Mit Leistungssensor zeigt das M\xF6bel seine Watt und nimmt am Energiefluss teil.",furn_links_hint_tv:"Der Bildschirm leuchtet, solange der Fernseher an ist, in der Farbe der App (Netflix, YouTube \u2026); das Schild zeigt App oder Titel.",stairs_hint:"Die Treppe steigt nach hinten an (weg von der markierten Vorderkante) und \xF6ffnet die Decke der Etage dar\xFCber.",stair_shape:"Form",stair_shape_straight:"Gerade",stair_shape_quarter:"Viertelgewendelt",stair_shape_l:"L mit Podest",stair_shape_half:"Halbgewendelt",stair_shape_u:"U mit Podest",stair_shape_spiral:"Wendeltreppe",stair_turn:"Laufrichtung (beim Hinaufgehen)",stair_turn_left:"Links herum",stair_turn_right:"Rechts herum",stair_build:"Bauart",stair_build_solid:"Massiv (Beton)",stair_build_stringer:"Wangentreppe",stair_build_mono:"Holmtreppe (Mittelholm)",stair_build_cantilever:"Kragarm (schwebend)",stair_risers:"Setzstufen",stair_steps:"Steigungen",stair_run_width:"Laufbreite (m)",stair_landing_after:"Stufen bis zum Podest",stair_landing_hint:"Das Podest liegt {h} cm \xFCber dem Boden; der Rest der Stufen kommt danach.",stair_rail:"Gel\xE4nder",stair_rail_none:"Keins",stair_rail_left:"Links",stair_rail_right:"Rechts",stair_rail_both:"Beidseitig",stair_down:"F\xFChrt nach unten",stair_down_hint:"Die Treppe beginnt auf dieser Etage und f\xFChrt hinunter, zum Beispiel in einen Keller, der nicht gezeichnet sein muss. Sie \xF6ffnet den Boden dieser Etage.",stair_measures:"{steps} Steigungen \xE0 {rise} cm \xB7 Auftritt {going} cm \xB7 Schrittma\xDF {measure} cm",stair_uncomfortable:"unbequem (Schrittma\xDF 59\u201365 cm, Steigung h\xF6chstens 21 cm)",stair_up_note:"Die Treppe beginnt an der markierten Vorderkante. Die Decke der Etage dar\xFCber \xF6ffnet sich nur dort, wo \xFCber den Stufen keine 2,2 m Kopfh\xF6he bleiben.",stair_down_note:"Man betritt die Treppe an der markierten Vorderkante und geht hinunter. Im Plan ist sie gestrichelt; der Boden dieser Etage \xF6ffnet sich \xFCber den Stufen.",stair_opening:"Decken\xF6ffnung",stair_opening_headroom:"Nach Kopfh\xF6he (nur wo n\xF6tig)",stair_opening_full:"\xDCber der ganzen Treppe",stair_opening_none:"Keine (Luke, geschlossener Schacht)",stair_opening_hint:"Wie weit die Treppe den Boden \xF6ffnet, den sie erreicht: die Etage dar\xFCber, oder bei einer Treppe nach unten die eigene. Nach Kopfh\xF6he \xF6ffnet nur \xFCber den Stufen, \xFCber denen keine 2,2 m bleiben.",stair_up_note_plain:"Die Treppe beginnt an der markierten Vorderkante und steigt nach hinten an.",stair_upgrade:"Form einstellen",stair_upgrade_hint:"Macht daraus eine Treppe mit Form (gewendelt, L, U, Wendel), Bauart, Gel\xE4nder und Stufenzahl.",floor_lights:"{n} Licht an",floor_open:"{n} offen",floor_persons:"{n} Pers.",energy_consumption:"Verbrauch",energy_grid_import:"Netzbezug",energy_grid_export:"Einspeisung",energy_solar:"Solar",energy_battery:"Akku",energy_tariff:"Tarif",energy:"Energie",energy_meter:"Z\xE4hlerplatz",energy_grid:"Netz (W, + = Bezug)",energy_solar_sensor:"Solar-Erzeugung (W)",energy_battery_sensor:"Akku-Leistung (W, + = Entladen)",energy_battery_soc:"Akku-Ladestand (%)",energy_tariff_sensor:"Tarif (z. B. \u20AC/kWh)",energy_gas:"Gasz\xE4hler (optional)",energy_water:"Wasserz\xE4hler (optional)",energy_meters_hint:"Gas und Wasser stehen bei der Hausbilanz \u2013 in der Energieleiste und auf der Hauskarte: ein Sensor mit dem Durchfluss jetzt (m\xB3/h, l/min) oder dem Z\xE4hlerstand von heute.",energy_gas_short:"Gas",energy_water_short:"Wasser",energy_invert:"Vorzeichen umkehren",energy_hint:"Verbraucher sind platzierte Ger\xE4te mit Leistungssensor (W) \u2013 der Sensor selbst oder einer vom selben Ger\xE4t.",energy_balance:"Energiebilanz",energy_balance_hint:"Netz, Solar und Akku kommen von den Ger\xE4ten im Plan: Stromz\xE4hler, Wechselrichter und Stromspeicher. Hier kannst du andere Sensoren w\xE4hlen, Vorzeichen umkehren und den Hausverbrauch angeben.",energy_rest:"Allgemein (Rest)",energy_advanced:"Erweiterter Energiemodus",energy_advanced_on:"Zwischenz\xE4hler nutzen",energy_show_unmetered:"Ungemessenen Verbrauch am Zwischenz\xE4hler zeigen",energy_show_unmetered_hint:"Das Schild eines Zwischenz\xE4hlers zeigt dann den Verbrauch seiner Etagen und wie viel davon kein platziertes Ger\xE4t misst, z. B. \u201E500 W \xB7 450 W ungemessen\u201C. Sonst zeigt es den Z\xE4hlerwert.",energy_advanced_hint:"F\xFCr Zwischenz\xE4hler, z. B. je Wohnung hinter einem Hauptz\xE4hler: Ein Stromz\xE4hler kann dann an einem anderen h\xE4ngen und eigene Etagen versorgen. Aus = der erste Z\xE4hler ist der Netzanschluss, weitere sind Verbraucher.",energy_consumption_sensor:"Hausverbrauch (W, sonst aus der Bilanz)",energy_import_prefs:"Aus dem Energie-Dashboard \xFCbernehmen",energy_import_done:"{n} Sensoren \xFCbernommen \u2013 bitte die Vorzeichen pr\xFCfen.",energy_import_none:"Im Energie-Dashboard sind keine passenden Leistungssensoren (W) zu finden \u2013 bitte von Hand w\xE4hlen.",energy_import_failed:"Das Energie-Dashboard von Home Assistant ist nicht eingerichtet.",tool_meter:"Z\xE4hler",hint_meter:"Auf die Stelle des Z\xE4hlers tippen",presence:"Anwesenheit",ble:"Bluetooth-Ortung",ble_hint:"Orte einen Bluetooth-Tag (Schl\xFCsselanh\xE4nger, Uhr, Handy) raumgenau: Du l\xE4ufst mit ihm durch die R\xE4ume und nimmst jeden Raum auf. NextFloor vergleicht danach, wie stark ihn die Bluetooth-Scanner von Home Assistant (ESPHome-Proxys, Shelly-Ger\xE4te mit eingeschaltetem Bluetooth, Adapter am Server) h\xF6ren. Je Tag entsteht ein Sensor mit dem Raumnamen als Zustand.",ble_unavailable:"Die Bluetooth-Integration von Home Assistant l\xE4uft nicht. Ohne sie gibt es keine Scanner.",ble_scanners:"{n} Bluetooth-Scanner in Home Assistant. Je mehr Scanner in verschiedenen R\xE4umen, desto genauer.",ble_add:"Tag oder Ger\xE4t hinzuf\xFCgen",ble_trackers:"Handys und Uhren (Private BLE Device)",ble_devices:"Gefundene Bluetooth-Ger\xE4te",ble_name:"Name (optional)",ble_refresh:"Liste neu laden",ble_add_button:"Hinzuf\xFCgen",ble_learn:"R\xE4ume lernen",ble_close:"Schlie\xDFen",ble_spots:"{n} Aufnahmen",ble_now:"Jetzt",ble_unknown:"unbekannt",ble_none_heard:"Kein Scanner h\xF6rt den Tag gerade. Halte ihn nah an einen Scanner und warte kurz; ein Tag sendet nur alle paar Sekunden.",ble_no_address:"Dieses Handy oder diese Uhr hat gerade keine bekannte Adresse. Pr\xFCfe in Home Assistant die Integration \u201EPrivate BLE Device\u201C.",ble_one_scanner:"Nur ein Scanner h\xF6rt den Tag. Zum Unterscheiden von R\xE4umen braucht es mindestens zwei, besser drei oder mehr.",ble_learn_room:"Raum aufnehmen",ble_record:"Aufnehmen ({s} s)",ble_recording:"Nimmt auf \u2026 noch {s} s",ble_forget_room:"Raum vergessen",ble_learn_hint:"W\xE4hle den Raum, dr\xFCcke Aufnehmen und geh mit dem Tag in der Hand langsam durch den ganzen Raum, auch in die Ecken. Aufnehmen erneut ersetzt den Raum. Lerne alle R\xE4ume, in denen du den Tag orten willst.",ble_sensor_hint:"Der Sensor \u201E{name}\u201C (Ger\xE4t NextFloor) zeigt den Raum. Unter Anwesenheit kannst du ihn als Raum-Sensor einer Person w\xE4hlen.",presence_hint:"Raumsensor je Person (z. B. ESPresense, Bermuda): sein Zustand nennt den Raum oder Bereich.",presence_sensor:"Raumsensor",presence_room:"Standardraum",presence_room_none:"\u2013 keiner \u2013",presence_add:"Weitere Entit\xE4t (Hilfsschalter, Tracker)",no_persons:"In Home Assistant gibt es keine Personen."},Gh={view:"3D",editor:"Editor",all_floors:"All floors",outside_area:"Outside",outside_area_hint:"All devices outside at a glance: in the garden, outside the rooms, and what belongs to Outside (a weather station on the roof, say).",device_outside:"Belongs to Outside",device_outside_hint:"The device does not count for the room under it (a weather station on the roof) and is listed in the Outside panel.",no_building:"No floor plan yet.",no_building_admin:"No floor plan yet. Draw your first floor in the editor.",no_rooms_admin:"The floors exist, but there is no room yet. Walls alone are not enough: draw at least one room in the editor with \u201CRectangle\u201D or \u201CFree form\u201D.",open_editor:"Open editor",loading:"Loading \u2026",load_error:"Loading failed",saving:"Saving \u2026",saved:"Saved",save_error:"Saving failed",save_failed_detail:"Saving failed: {error}. Your changes are kept in this browser.",needs_restart:"A new version of NextFloor ({frontend}) is installed, but Home Assistant still runs {version}. Please restart Home Assistant \u2013 until then saving may fail.",needs_reload:"This page still shows NextFloor {frontend}, Home Assistant already has {backend}. Please reload the page; in the companion app: Settings \u2192 Companion app \u2192 Reset frontend cache.",reload_page:"Reload",symcon_variables_reload:"Reload variables",symcon_cover_position:"Blind position",climate_card:"Room climate as a floating card",climate_card_hint:"Shows temperature, humidity and CO\u2082 over this room. Toggle them with \u201CCards\u201D in the 3D view.",climate_card_missing:"No current readings",furniture_power_card:"Power as a floating 3D card",furniture_power_card_hint:"Shows the power reading above this furniture, even without a linked switch. The card remains visible at 0 W. Logged variables offer a trend button. Use the Cards switch to show or hide floating cards together.",climate_illuminance:"Illuminance",device_values:"Additional values",device_value:"Data point",device_value_add:"Add value",device_value_remove:"Remove value",device_value_icon:"Symbol",device_value_label:"Label (optional)",device_values_hint:"Use + to select additional data points, such as several temperatures or other readings. Symbols can be emoji or short characters such as \u{1F321}, \u{1F4A7}, \u2601 or \u26A1. Values appear on the device and in the room panel.",cover_tilt_entity:"Slat position",cover_direction_invert:"Reverse blind in 3D",cover_tilt_direction_invert:"Reverse slats in 3D",cover2_direction_invert:"Reverse second blind in 3D",cover2_tilt_direction_invert:"Reverse second blind slats in 3D",cover_direction_hint:"Reversal affects only the 3D appearance. Numeric values, sliders and control commands stay unchanged: a received value of 0 is still displayed as 0, and a chosen value of 0 is sent as 0.",cover2_tilt_entity:"Slat position (second blind)",symcon_variables_loading:"Loading variables \u2026",symcon_variables_loaded:"Variables and object tree reloaded.",symcon_variables_error:"Could not reload variables: {error}",needs_restart_old:"A new version of NextFloor is installed, but Home Assistant still runs an older one. Please restart Home Assistant \u2013 until then saving fails.",draft_found:"Unsaved changes from {time} found.",draft_restore:"Restore and save",draft_discard:"Discard",walls_auto:"Tall walls",walls_cut:"Cut",walls_slope:"Sloped",walls_slope_hint:"Walls cut on a slope: half height in front, full height at the back \u2013 like a doll's house, turns with the camera",walls_solid:"Solid",walls_solid_hint:"Solid walls in their colours instead of glass (colours: editor \u2192 settings, per room in the room)",wall_paint_outside:"Wall colour outside",wall_paint_inside:"Wall colour inside",furn_color_body:"Furniture colour body",furn_color_wood:"Furniture colour wood",furn_color_fabric:"Furniture colour fabric",furn_color_white:"Furniture colour white",furn_color_metal:"Furniture colour metal",furn_color_dark:"Furniture colour dark",furn_color_hint:"Furniture is built from a few materials, the pieces from the furniture builder and the packs too. Here each material gets a colour for the whole house; a card can set its own. They show most in the Neon look; Day and Blueprint only tint with them.",wall_paint_room:"Wall colour inside (this room)",wall_paint_floor:"Wall colour outside (this floor)",wall_paint_hint:"Used in the 3D view \u201CSolid\u201D.",wall_paint_default:"Default",card_solid_walls:"Solid walls (in their colours)",reset_view:"Overview",back:"Back",floor:"Floor",floors:"Floors",add_floor:"Add floor",floor_from_ha:"Floors from Home Assistant:",floor_empty:"Empty floor",level:"Level {n}",ha_floor:"Floor in Home Assistant",floor_layer:"Layer (can be shown and hidden)",floor_power:"Floor meter (power)",floor_power_hint:"A power sensor for this floor alone (a sub-meter, a flat). Its value shows on the floor label and, in this floor's view, on the house card with its share of the house's use.",floor_power_share:"{n} % of the house",living_area:"Living area {living}",room_living:"Counts as living area",living_area_none:"No living area \xB7 floor {floor}",living_area_low:"Living area {living} (floor {floor}, of which {low} below 2 m)",living_area_hint:"Counted like the German Wohnfl\xE4chenverordnung: the floor inside the walls, in full from 2 m clear height, half between 1 and 2 m (under slopes), not at all below 1 m. A guide value, not a survey.",living_area_floor:"Living area: {floor}",living_area_floor_house:"Living area of this floor: {floor} \xB7 whole house: {house}",print_plan:"Print plan / PDF",print_plan_hint:"Every floor as a clean plan with measurements and areas, and a table of the areas \u2013 to print, or save as PDF from the print dialog.",print_title:"Floor plan",print_room:"Room",print_floor_area:"Floor area",print_living:"Living area",print_low:"below 2 m",print_total:"Total",print_blocked:"The print window was blocked \u2013 please allow pop-ups for Home Assistant.",check_open:"Check the plan",note:"Note",note_add:"Note here",note_text:"Text",note_placeholder:'e.g. "change the filter" or "fuse 12"',note_due:"Due on",note_height:"Height above the floor (m)",note_height_hint:"Where the pin floats in the 3D view: 1.3 m is eye level, higher for something under the ceiling (a shutoff valve, a hatch).",note_photo_upload:"Add a photo",note_photo_hint:"The photo shows when the note is tapped in the 3D view, e.g. what the valve looks like.",note_due_hint:"From that day on the pin turns orange.",note_is_due:"This note is due.",keys_title:"Editor keys",keys_undo:"Undo",keys_redo:"Redo",keys_duplicate:"Duplicate the room",keys_delete:"Delete the selection",keys_nudge:"Move the selection one grid step",keys_nudge_10:"\u2026 by 10 cm",keys_nudge_1:"\u2026 by 1 cm",keys_rotate:"Turn furniture by 90\xB0 (Shift: back)",keys_lock:"Fix or free furniture, a device or a roof section",keys_close_shape:"Close the free shape",keys_escape:"Cancel, leave the tool, clear the selection",keys_straight:"While drawing: straight lines",keys_sheet:"This sheet",tour_title:"First steps",tour_1_title:"Draw the rooms",tour_1:'Draw the rooms with "{rect}" or "{free}"; the walls come by themselves. Give each room its Home Assistant area \u2013 then NextFloor finds its devices. With areas already set up, "{rooms}" in the floor form adds them all at once.',tour_2_title:"Doors and windows",tour_2:'"{opening}" puts them on a wall. Link their contact or blind \u2013 in 3D they then open and close with it, and open windows tell you.',tour_3_title:"Furniture and devices",tour_3:'"{furniture}" opens the library \u2013 or build your own pieces in the \u{1F6E0}\uFE0F furniture studio. Select a room and the devices of its area are listed below, ready to place; lamps then shine in the colour of their light.',tour_4_title:"Look and check",tour_4:'"{split}" shows your house while you draw; at the top you switch to the 3D view. "{check}" lists what is still missing \u2013 and ? shows the keys at any time.',tour_next:"Next",tour_back:"Back",tour_done:"Let's go",tour_skip:"Skip",check_open_hint:"Lists what is missing or off in the plan, with a fix in one tap.",check_title:"Plan check",check_all_good:"All good \u2013 nothing found.",check_hint:"{n} points found. Blue buttons change the plan (undo works as always), the others show the place.",check_room_no_area:'"{room}" has no Home Assistant area: its devices are not found.',check_room_no_area_named:'"{room}" has no area \u2013 the free area "{area}" has the same name.',check_areas_unplaced:"{n} areas of this floor have no room yet: {names}",check_devices_unplaced:'"{room}": {n} devices of the area are not in the plan yet.',check_rooms_overlap:'"{a}" and "{b}" overlap.',check_opening_off_wall:'A door or window in "{room}" is not on a wall.',check_entity_missing:"{n} device pins point to entities Home Assistant no longer knows ({ids}).",check_furniture_entity_missing:"A piece of furniture is linked to {id} \u2013 that entity no longer exists.",check_battery_low:"Battery low: {name} ({level} %)",battery_low_n:"Battery low: {names}",check_standby:"{name} draws {w} W while off \u2013 about {cost} a year.",check_fix_show:"Show",check_fix_ignore:"Ignore",check_show_devices:"Look at the {n} devices",check_ignore_all:"Ignore all {n}",check_reset_ignored:"Check the {n} ignored devices again",check_fix_set_area:'Link "{area}"',check_fix_add_rooms:"Add the rooms",check_fix_place:"Place {n}",check_fix_remove:"Remove {n}",floor_layer_hint:"This floor is no storey but a layer \u2013 all the trees or the decoration, say. The 3D view shows an eye at the top that shows or hides it on each device.",no_ha_floor:"\u2013 none \u2013",area_rooms:"Add rooms from HA areas ({n})",area_rooms_hint:"Adds a room (4 \xD7 3 m) for each area of this floor \u2013 then drag it into place and adjust the corners",floor_name:"Name",elevation:"Elevation (m)",floor_shift:"Shift the floor (m)",floor_shift_apply:"Shift",floor_shift_hint:"Moves every room, furniture item, device, outdoor area, free wall and the background image of this floor by X and Z. Roof sections stay.",height:"Ceiling height (m)",cut_height:"Cut height (m)",delete_floor:"Delete floor",floor_copy:"Duplicate floor",floor_copy_hint:"The copy goes on top of the house with all rooms, walls, doors and windows. Rooms and the floor lose their link to Home Assistant, furniture its entities; energy devices stay on the old floor.",floor_copy_furniture:"Take the furniture along",floor_copy_devices:"Take the device pins along",floor_copy_devices_hint:"The same entity then shows on both floors.",floor_copy_outdoor:"Take the outdoor areas along",floor_copy_make:"Make the copy",floor_copy_name:"{name} (copy)",furn_to_floor:"Move to floor",furn_to_floor_hint:"The item moves to the same spot on the chosen floor.",delete_floor_confirm:"Delete floor \u201C{name}\u201D with all its rooms?",move_up:"Move up",move_down:"Move down",default_floor:"Ground floor",new_floor:"Floor {n}",tool_select:"Select",tool_rect:"Rectangle",tool_polygon:"Free shape",undo:"Undo",redo:"Redo",fit:"Show all",room:"Room",rooms:"Rooms",room_name:"Name",area:"Area",no_area:"No area",sub_area_add:"+ Area within the room",sub_area_hint:"A part of the room with a Home Assistant area of its own but no walls \u2013 a reading corner, a shelf, a kitchenette in the living room. Its devices and sensors belong to this room.",material:"Floor",x:"X (m)",z:"Y (m)",width:"Width (m)",depth:"Depth (m)",points:"Corners",delete_point:"Delete corner",duplicate:"Duplicate",delete:"Delete",new_room:"Room {n}",settings:"Settings",pendant_shape:"Shape",pendant_shade:"Shade",paint_colour:"Paint colour",pendant_globe:"Globe",pendant_cone:"Cone",pendant_drum:"Drum",sofa_shape:"Shape",sofa_straight:"Straight",sofa_l:"L-shaped (mirror: other side)",sofa_u:"U-shaped",pkg_open:"Furnish \u2026",pkg_hint:"Furniture goes against the room's walls; lamps link to the area's lights. Adjust single items afterwards \u2013 Ctrl+Z takes it all back.",pkg_done:"{n} items placed \u2013 Ctrl+Z takes it back.",pkg_kitchen_row:"Kitchen row",pkg_kitchen_row_desc:"Row on the back wall with fridge, oven, sink, dishwasher and stove, wall cabinet, dining table with pendant",pkg_kitchen_l:"L-shaped kitchen",pkg_kitchen_l_desc:"Rows at the back and left, kitchen island with bar stools",pkg_bath:"Bathroom",pkg_bath_desc:"Washbasin, WC, bathtub, washing machine, downlight",pkg_bedroom:"Bedroom",pkg_bedroom_desc:"Double bed with two nightstands, wardrobe, chest of drawers, ceiling light",pkg_living:"Living room",pkg_living_desc:"TV board, sofa, coffee table, rug, armchair, shelf, floor lamp, plant",pkg_dining:"Dining room",pkg_dining_desc:"Table with four chairs, sideboard, pendant",pkg_office:"Office",pkg_office_desc:"Desk with office chair, two shelves, ceiling light",pkg_kids:"Kids' room",pkg_kids_desc:"Single bed, desk, shelf, rug",pkg_hall:"Hall",pkg_hall_desc:"Coat rack, two downlights",spots_place:"Place spots",spots_type:"Lamp",spots_cols:"Columns (left\u2013right)",spots_rows:"Rows (front\u2013back)",spots_add:"Place {n} lamps",spots_placed:"{n} lamps placed.",spots_hint:"All lamps follow the chosen light (e.g. spots on one dimmer). Afterwards each can be moved and linked to another light like any furniture.",cancel:"Cancel",backup:"Backup",backup_history:"Restore points",share_view:"Share a view",share_view_hint:"Saves the house as a small file that opens in any browser without Home Assistant (through NextFloor's online demo) \u2013 to show it to family or a planner. Without devices and entities, like a template.",share_view_title:"Our home in NextFloor",share_view_needs_js:"This page needs JavaScript and an internet connection.",share_view_file:"view",share_view_done:"View saved \u2013 open the file in a browser or pass it on.",version_save:"Save this state \u2026",version_save_hint:'Keeps the plan under a name ("before the renovation"). Named states stay when the automatic restore points go.',version_name_prompt:'Name for this state (e.g. "before the renovation"):',version_saved:'State "{name}" saved.',version_compare:"Compare",version_delete_confirm:'Delete "{name}"?',version_same:"No difference to the plan.",version_diff_n:"{n} differences to the plan as it is now:",diff_floor_added:'Floor "{name}" added',diff_floor_removed:'Floor "{name}" removed',diff_room_added:'Room "{name}" added',diff_room_removed:'Room "{name}" removed',diff_room_renamed:'"{detail}" is now called "{name}"',diff_room_reshaped:'"{name}" reshaped ({detail} m\xB2)',diff_opening_added:"{name} added ({detail})",diff_opening_removed:"{name} removed ({detail})",diff_furniture_added:"{name} added",diff_furniture_removed:"{name} removed",diff_furniture_moved:"{name} moved or changed",diff_device_added:"Device {name} placed",diff_device_removed:"Device {name} removed",diff_device_moved:"Device {name} moved",backup_none:"None yet. While editing, a restore point is kept at most every 10 minutes.",backup_summary:"{rooms} rooms, {furniture} items",backup_restore:"Restore",backup_restore_confirm:"Restore the state of {time}? The current state is kept as a restore point.",backup_restored:"Restored.",backup_file:"File",backup_export:"Export",backup_export_share:"Share as template",backup_export_share_hint:"Without areas, devices, sensors and images \u2013 for passing on to others.",backup_import:"Import \u2026",backup_import_confirm:"Replace the whole plan with the file? The current state is kept as a restore point.",backup_import_error:"The file is no NextFloor plan ({error}).",backup_imported:"Imported.",backup_hint:"Background images are not part of the file.",backup_full:"Full backup",backup_full_export:"Back up everything (plan, pictures, packs)",backup_full_import:"Restore a full backup \u2026",backup_full_hint:"One file with the plan, every background and screen picture and the installed packs. On restore every pack is checked again; the licence key is not included.",backup_full_confirm:"Replace the plan, the pictures and the packs with the backup? The current state stays as a restore point.",backup_full_not_backup:"This is not a full NextFloor backup.",backup_full_restored:"Backup restored: {packs} packs, {pictures} pictures.",backup_full_skipped:"Skipped (could not be read): {packs}.",export_name_full:"full",device_confirm:"Ask before switching",device_confirm_hint:"A tap in 3D, the quick menu and the room panel ask first. A double tap on the room leaves this device out.",cover_confirm_hint:"Open, close and positions ask first in the quick menu and the room panel, and a swipe on the marker no longer moves the blind (it turns the view instead). Stop never asks.",blind_kind:"Kind of blind",blind_roller:"Roller shutter outside",blind_venetian:"Venetian blind with slats",blind_inside:"Roller blind inside",cover2_entity:"Second blind (right half)",cover_my:'Favourite position "My" (%, 0 = none)',cover_my_go:"To the favourite position ({p} %)",blind_hint:`A venetian blind turns its slats in 3D with the cover's tilt; a roller blind inside hangs behind the glass. A wide window can have a second blind for its right half. The favourite position shows as "My" in the quick menu: a blind with positions moves there, a Somfy RTS motor without feedback goes to its own My on stop.`,confirm_switch:"Really switch {name}?",lock_confirm_unlock:"Really unlock {name}?",gang_switch_one:"Switches",furn_cover_entity:"Moves with",furn_cover_hint:"The curtain, screen, awning or gate follows this cover entity (blind, curtain, awning, gate) and travels with it. A tap opens its menu (up, stop, down).",furn_cover_inverted:"Reverse the direction",furn_cover_inverted_hint:"For an awning or curtain that moves the opposite way in the plan than in reality: out then shows in, and the other way round.",gang_switch:"Button {n} switches",gang_socket_one:"Socket powered by",gang_socket:"Socket {n} powered by",gang_switch_hint:"A button glows while its light is on (in its colour). A tap switches it; with several buttons a small menu asks which. The same entity may sit on several switches.",gang_socket_hint:"A socket glows green while its switch is on \u2013 brighter the more it draws. A tap switches it; with several, a small menu asks which.",lock_confirm_lock:"Lock {name}?",opening_lock:"Smart lock",opening_lock_hint:"A tap on the door locks or unlocks it (always asking first). While it is unlocked, its edge glows.",split_handle_hint:"Drag: width of the plan and the 3D view",wall_exterior:"Exterior wall (m)",wall_interior:"Interior wall (m)",grid:"Grid (m)",units:"Show lengths in",units_metric:"Metres",units_imperial:"Feet and inches",units_hint:"How lengths and areas appear in the plan, the forms and the wall view. Inputs stay in metres.",background:"Template (floor plan image)",background_upload:"Choose image \u2026",background_width:"Width in plan (m)",background_opacity:"Opacity",background_rotation:"Rotation (\xB0)",background_edit:"Move, scale and turn",background_edit_done:"Done",background_edit_hint:"While the mode is on: dragging the picture moves it, the handle at the bottom right scales it. Fit the picture to the scale first, then turn it.",background_remove:"Remove template",hint_select:"Tap a room to select \xB7 drag corners \xB7 \u201C+\u201D on an edge inserts a corner \xB7 arrow keys nudge \xB7 Del deletes \xB7 Ctrl+Z",hint_rect:"Drag to draw a rectangle",hint_polygon:"Place corners \xB7 tap the first corner or press Enter to close \xB7 Esc cancels",hint_empty:"Add a floor first.",area_m2:"{a} m\xB2",overlap_warning:"Rooms overlap \u2013 walls there are incomplete.",read_only:"Only administrators can edit the floor plan.",side_failed:"This form could not be shown ({error}). The plan stays usable. Please report the text in a GitHub issue.",mat_wood:"Wood",mat_oak:"Oak",mat_tiles:"Tiles",mat_carpet:"Carpet",mat_stone:"Stone",mat_concrete:"Concrete",card_name:"NextFloor",card_description:"Your home in 3D (neon).",stats:"{calls} draw calls \xB7 {tris} triangles",stats_fps:"{fps} fps (slowest frame {ms} ms)",stats_idle:"At rest (0 fps)",stats_busy_floors:"floors",stats_busy_openings:"doors/windows",stats_busy_flash:"flash",stats_busy_roof:"roof",stats_busy_flow:"power flow",stats_busy_effect:"colour effect",stats_busy_robot:"robot",stats_busy_orbit:"camera turn",stats_busy_tint:"room tint",stats_low:"tablet level, pixel ratio {r}",stats_full:"full level, pixel ratio {r}",floors_apart:"Apart",floors_stacked:"Stacked",roof_keep:"Roof stays",roof_keep_hint:"The roof stays on the house while zooming in instead of lifting and fading out",floor_rooms_one:"1 room",floor_rooms:"{n} rooms",quality:"Quality",quality_auto:"Auto",quality_low:"Tablet",quality_high:"High",state_on:"On",state_off:"Off",state_open:"Open",state_closed:"Closed",state_opening:"Opening",state_closing:"Closing",state_playing:"Playing",state_paused:"Paused",state_idle:"Idle",state_locked:"Locked",state_unlocked:"Unlocked",state_detected:"Detected",state_clear:"Clear",state_unavailable:"Unavailable",state_heat:"Heat",state_cool:"Cool",state_auto:"Auto",state_heat_cool:"Heat/cool",state_dry:"Dry",state_fan_only:"Fan",devices:"Devices",devices_none_area:"Link the room to an area and its devices appear here.",devices_none:"The area has no suitable devices.",devices_place_all_n:"Place all {n} \u2026",devices_place_all_confirm:"Put {n} devices into the room at once? (Ctrl+Z or \u201CUndo\u201D takes them all back in one step.)",devices_src_area:"This area",devices_src_other:"Other areas",devices_src_none:"No area",panel_hide:"Hide from the room panel",panel_unhide:"Show in the room panel again",panel_state_hide:'Hide the state in the room panel (e.g. a cover that only reports "unknown")',panel_state_show:"Show the state in the room panel again",devices_place:"Place",devices_remove:"Remove",devices_hint:"Placed devices appear in 3D. Drag them in the plan to move them.",panel_lights:"Lights",panel_covers:"Covers",panel_climate:"Heating",panel_media:"Media",panel_switches:"Switches",panel_sensors:"Sensors",panel_scenes:"Scenes & scripts",panel_announce:"\u{1F4E2} Announcement",announce_placeholder:"Your own message \u2026",announce_send:"Say it",announce_sent:'Said: "{message}"',announce_failed:"Announcement failed: {error}",announce_phrase_1:"Dinner is ready!",announce_phrase_2:"Time for bed!",announce_phrase_3:"Please come down!",announce_phrase_4:"We are leaving soon!",announce_phrase_5:"The dog needs to go out!",state_recording:"Recording",state_streaming:"Streaming",panel_all_off:"All off",readable:"Easy to read",readable_hint:"Stronger contrast and larger text \u2013 for wall tablets and anyone who reads better that way.",plain:"Floor plan only",plain_hint:"Shows only walls, doors, windows and stairs, without furniture. Devices and their pins stay.",right_back:"Right click = back",right_back_hint:"A short right click in the 3D view goes one step back: from the room to the floor, from the floor to the house (like a double tap on empty space). Dragging with the right button still pans the view.",stl:"3D print (STL)",stl_hint:"Saves the house as an STL file (walls, floors, furniture and outdoor areas of every floor) for 3D printing, at 1:100 (one metre becomes 10 mm). Windows, lights and the roof are not in it; a slicer repairs the file if needed.",card_plain:"Floor plan only",card_rooms:"Only these rooms",card_rooms_hint:"The card shows only the ticked rooms with their furniture, devices, doors and windows (for a tablet in the kitchen, say). Nothing ticked: the whole plan.",card_templates:"Card templates",card_templates_hint:"Set up a dashboard card once here (with the card's own settings) and give just its name on each tablet: `template: kitchen_tablet`. Changes here reach every card that uses the template; what stands on the card itself wins over the template.",template_name:"New template (name)",template_add:"Create template",template_reload:"Reload screens with this template",template_reload_all:"Reload all screens",template_use:"On the dashboard card: `template: {name}`",card_template:"Card template",card_template_none:"none (this card only)",card_readable:"Easy to read",all_off_n:"Everything off ({n})",all_off_hint:"Switches off the room's lights, switches, fans and media; it can be undone for ten seconds.",all_off_done:"Everything off.",all_off_undo:"Undo",all_off_floor:"Everything off on {floor} ({n} devices), undo for ten seconds",mood_save:"Save mood",mood_save_hint:`Keeps how the room's lamps shine right now as a mood \u2013 a tap on it sets them again later, "\u2192" carries it to another room.`,mood_new:"Mood",mood_set:"Set this mood",mood_carry:"Carry over to another room",panel_all_on:"All on",view_options:"View: quality, look, markers, FPS",panel_all_open:"All up",panel_all_close:"All down",central:"Central: all lights, blinds and favourites",central_house:"Whole house",central_lights:"Lights",central_covers:"Blinds",central_on:"On",central_off:"Off",central_open:"Up",central_close:"Down",central_sure:"Sure?",central_favorites:"Favourites",central_no_favorites:'No favourites yet. Set scenes, scripts and switches in the editor under "Favourites".',card_central:"Star with the central menu",card_central_hint:"All lights and blinds of the floor or the house and the favourites from the editor.",favorites:"Favourites",favorites_hint:"Scenes, scripts, automations, buttons and switches for the central menu (star) of the 3D view \u2013 party, presence simulation, shading, watering.",favorites_add:"Add a favourite",favorite_floor:"Which floor this favourite shows on",favorite_all_floors:"All floors",outside_hidden:"Outside: hide devices",outside_hidden_hint:"Devices the Outside panel should not show (they stay in the plan).",outside_hidden_add:"Hide a device",outside_view_hint:"View for Outside: turn the 3D preview to the garden and use it. Opening Outside then flies the camera there.",outside_view_set:"Use this view for Outside",outside_view_reset:"Reset the Outside view",room_facts:"Room panel: facts shown",room_fact_sun:"Sun hours",room_fact_comfort:"Comfort",room_fact_air:"Airing hint",room_fact_circuits:"Circuits",background_handles_hint:'The picture now has handles like a piece of furniture: drag moves it, the lower right corner scales it, the round handle on top turns it (Shift for 15\xB0 steps). When it fits, tap "Done" \u2013 then it stays put.',background_fixed_hint:'The picture stays put, you can draw over it. To adjust it, tap "Move, scale and turn".',bg_level:"Straighten",bg_level_cancel:"Cancel straightening",bg_level_first:"Tap the start of a wall in the picture that should run straight (horizontal or vertical).",bg_level_second:"Now tap the end of that wall \u2013 the picture turns to fit.",bg_ruler:"Scale with a ruler",bg_ruler_cancel:"Cancel the ruler",bg_ruler_first:"Tap the start of a stretch of known length in the picture \u2013 e.g. a dimensioned wall.",bg_ruler_second:"Now tap the end of the stretch.",bg_ruler_length_hint:"Measured in the plan: {m} m. Enter the real length and the picture is scaled to fit.",bg_ruler_length:"Real length (m)",bg_ruler_apply:"Apply the scale",thumbs_fold:"Fold the floor pictures into buttons",thumbs_show:"Show the floor pictures again",room_start_view:"View as this room's start",room_start_view_hint:"When you tap the room in 3D, the camera flies to exactly the view the 3D pane on the right shows now \u2013 angle, zoom and framing. Turn on 3D beside first, turn and zoom in on the room, then tap.",room_start_view_reset:"Remove the room's start view (from above again)",room_start_view_need_pane:'Turn on "3D beside" first, then turn and zoom the room the way it should open.',floor_start_view:"View as this floor's start",floor_start_view_hint:"This floor opens in 3D the way the 3D pane on the right stands right now \u2013 e.g. the ground floor from the front and the upper floor from the back. Turn on 3D beside first, turn it, then tap.",floor_start_view_reset:"Remove the floor's start view (like the house again)",floor_start_view_need_pane:'Turn on "3D beside" first and turn the floor the way it should open.',ambilight:"Glow behind the TV (%)",ambilight_hint:"How strongly it glows behind the TV while it plays. 0 switches it off (for example if you have LED strips on the TV), 100 is the usual strength.",sound_rings:"Sound rings (%)",sound_rings_hint:"How large the rings around the speaker grow while it plays. 0 switches them off, the picture and the glow stay; 100 is the usual size. The size also follows the speaker's volume: quieter means smaller.",glow_scale:"Glow in 3D (%)",light_effects:"Effect animations in 3D",light_effects_hint:"Map exact HA effect names only. Unmapped effects keep the static HA colour. Changes nothing in Home Assistant.",light_effects_enabled:"Allow animations for this lamp",light_effect_unmapped:"Unmapped (static)",light_effect_add:"Add exact effect name",light_effect_name_limit:"The exact effect name must contain 1 to 255 characters. It will not be shortened.",light_effect_count_limit:"At most 100 mappings. Remove an existing entry first.",light_effect_exists:"This effect name is already mapped. Its existing mapping is preserved.",light_animation_none:"Static",light_animation_rainbow:"Rainbow (replaces colour)",light_animation_pulse:"Pulse (intensity)",light_animation_flicker:"Flicker (intensity)",glow_scale_hint:"How strongly the lamp glows in 3D: below 100 % tones down bright LED strips so the room does not burn out; above 100 % makes a weak lamp glow more. Switches nothing in Home Assistant.",vehicle_to_spot:"Turn into a parking spot",vehicle_to_spot_hint:"A vehicle as plain furniture always stands there. As a parking spot it appears only while a sensor reports the car, and that is where the car device is linked (charge, range, lock, climate).",as_furniture:"Show as furniture",as_furniture_hint:"Replaces the pin by a furniture item in the same place, linked to this device \u2013 a speaker for a media player, a lamp for a light. Ctrl+Z takes it back.",as_furniture_pick:"Pick furniture \u2026",as_device:"Back to a device pin",as_device_hint:"Replaces the furniture by the plain pin of its device in the same place.",presets:"Stations and playlists (Sound)",presets_hint:`Shown in every speaker's quick menu under "Play", next to the player's sources. For an Echo (Alexa Media Player): type SPOTIFY, AMAZON_MUSIC or TUNEIN and as content what you would say ("Rock Antenne"). For Sonos, Music Assistant and others: type music or url with a stream address or a URI.`,preset_type:"Type",preset_type_hint:"media_content_type of play_media, e.g. music, url, playlist, SPOTIFY, AMAZON_MUSIC, TUNEIN",preset_content:"Content",preset_content_hint:"media_content_id: stream URL, URI (spotify:playlist:\u2026) or, for Alexa, a search phrase",preset_speakers:"Only on these speakers (none = on all)",media_play:"Play",media_pause:"Pause",media_previous:"Previous",media_next:"Next",media_volume:"Volume",media_sources:"Sources",preset_add:"Station or playlist",own_buttons:"Own buttons",own_buttons_hint:"Shown in the central menu (star) below the favourites: open a dashboard path, show an entity's details, call a service, or open a browser_mod popup with your own card.",own_alerts:"Own warnings",circuits:"Fuse box",circuits_hint:'The circuits with the rooms they feed. The room panel names them, and the search finds them ("F12").',circuit_name:"Name",circuit_new:"New circuit",circuit_add:"Add a circuit",circuit_add_room:"Add a room",own_alerts_hint:'A line in the warning bar of the 3D view while an entity is in a state \u2013 "Water tank empty" from the robot vacuum, "Dishwasher done". Several states with commas; for numbers <20 or >80.',own_alert_entity:"When \u2026",own_alert_state:"\u2026 is in state (empty = on)",own_alert_text:"\u2026 then this warning",own_alert_color:"Colour",own_alert_tap:"A tap",own_alert_tap_info:"opens the details",own_alert_tap_toggle:"switches the entity",own_alert_tap_room:"jumps to the room",own_alert_house:"Whole house",own_alert_new:"New warning",own_alert_add:"Add a warning",today:"Today",tomorrow:"Tomorrow",today_days:'Days on the "Today" card',today_days_one:"Today only",today_days_n:"{n} days",forecast:"Weather forecast",forecast_hint:'A small card with the next days of the weather entity (settings): the weather, high and low, and rain. It sits in a top corner of the 3D view, top right below the "Today" card.',forecast_days:"Forecast",forecast_off:"Off",forecast_corner:"Corner",today_none:"Nothing on today.",today_calendars:'Calendars for "Today"',today_calendars_hint:'The appointments of these calendars show top right in the 3D view on the "Today" card, with the bins collected today or tomorrow. A tap on its title folds the card.',own_button_state:"Lights up while \u2026 is on (optional)",own_button_label:"Label",own_button_action:"Action",own_button_new:"New button",own_button_add:"Own button",own_action_navigate:"Open a path",own_action_more_info:"Entity details",own_action_service:"Call a service",own_action_fire_dom_event:"fire-dom-event (browser_mod)",own_target_navigate:"Path",own_target_more_info:"Entity",own_target_service:"Service (domain.service)",own_data:"Data (JSON)",own_data_hint:`For a service its data, for fire-dom-event the event's content, e.g. {"browser_mod": {"service": "browser_mod.popup", "data": {\u2026}}}.`,own_data_bad:"Not a valid JSON object.",panel_no_area:"This room is not linked to an area. You can link it in the editor.",panel_empty:"No devices of this room are in the plan. In the editor, place devices or pick them for the room panel with \u2606.",close:"Close",panel_fold:"Fold away (the room stays in view)",panel_unfold:"Open again",brightness:"Brightness",color_temp:"Colour temperature",color:"Colour",position:"Position",cover_open:"Open",cover_stop:"Stop",cover_tilt:"Slats",cover_tilt_open:"Slats open",cover_tilt_close:"Slats closed",cover_close:"Close",target_temp:"Target",current_temp:"Current",temp_down:"Cooler",temp_up:"Warmer",volume:"Volume",play_pause:"Play/pause",previous:"Previous",next:"Next",run:"Run",details:"Details",hold_hint:"Tap toggles \xB7 long press opens details",tool_opening:"Doors & windows",tool_furniture:"Furniture",qm_off:"Off",find:"Search",find_placeholder:"Where is \u2026? Device or room",find_none:"Nothing found",swipe_off:"Off",panel_pin:"Show in the room panel",panel_unpin:"Don't show in the room panel",devices_panel_hint:"The room panel shows the devices in the plan. \u2606 adds a device to the room panel without placing it.",card_section_view:"View",card_size:"Size",card_size_fixed:"Fixed height",card_size_fill:"Fill the screen",card_fill_hint:"Works best in a dashboard view of the type \u201CPanel (single card)\u201D \u2013 the card then takes all the space.",card_controls:"Switches in the card",card_floor_thumbs:"Floors as miniatures",card_floor_thumbs_hint:"Small pictures of the floors at the side \u2013 tap one to switch",card_floor_thumbs_hint_start:"The chosen floor is then where the card starts \u2013 the pictures at the side switch to the others",card_room_names:"Show room names",card_section_kiosk:"Wall tablet (kiosk)",card_section_features:"Features",card_weather_plan:"as set in the plan",card_pro_hint:"Motion trail and camera wall belong to the cameras: the trail shows the last half hour, the wall every camera of the plan.",card_idle_return:"Back to the start view after",card_idle_off:"Never",card_idle_min:"{n} min without a touch",card_idle_hint:"After the wait the card closes the room and shows the start view again.",card_night:"Night dimming",card_night_off:"Off",card_night_sun:"By the sun",card_night_time:"Time range",card_night_range:"Time range (e.g. 22:00-06:00)",card_idle_orbit:"Camera turn as screensaver",card_idle_orbit_hint:"After the return the view turns slowly until someone touches the tablet",card_dashboard:"Button to a dashboard (path)",card_dashboard_label:"Label of the button",card_dashboard_hint:"A button at the top right of the card opens the dashboard or view with this path, e.g. /lovelace/home or /dashboard-house/0. Without a label it shows \u2302.",card_alerts:"Show warnings",card_alerts_hint:"Smoke, gas, CO, water, alarm panel and windows open in the rain: the room pulses, a note appears at the top",card_alert_jump:"Jump to the room of a new warning",card_alert_jump_hint:"The view switches to the floor and room of the warning by itself",card_scenes:"Scene buttons in the room",card_scenes_hint:"Scenes and scripts of the area as buttons under the 3D view while a room is selected",card_sensor_bar:"Own sensors at the top",card_sensor_bar_hint:"The sensors chosen in the editor (Settings) at the top left of the card",card_central_open:"Star menu open and large",card_central_open_hint:"Favourites and own buttons stand open from the start, a size larger",card_keep_camera:"Keep the camera when switching floors",card_keep_camera_hint:"The same side, height and distance on every floor",card_today:'"Today" card',card_today_hint:"Today's appointments and the bins due, top right",card_announcements:"Announcements",card_announcements_hint:'Announcements (action "NextFloor: Announcement") show big on the card, with a chime, and are spoken',weather_short:"Weather",time_of_day:"Time of day",time_of_day_hint:"Shows sun, light, shadows and look at another time of today. Tap again to go back to now.",menu_open:"Menu open",menu_open_hint:"The star menu with favourites and own buttons stands open from the start on this device, a size larger \u2013 for a wall tablet that mostly runs scenes.",keep_camera:"Keep camera",keep_camera_hint:"Switching floors keeps the camera on the same side, height and distance instead of fitting the new floor from the start side.",view_zoom:"Zoom",view_zoom_hint:"How close the fitted views come \u2013 on small tablets the house looks larger.",weather_entity:"Weather entity",weather_effects:"Weather effects in 3D",card_weather_density:"Amount of rain and snow",card_weather_density_hint:"Fewer drops and flakes than the weather reports; clouds, fog and lightning stay",rain_warning:"Warning: window open while it rains",sun_patches:"Sunlight and shadows",sun_patches_hint:"With north set, the sunlight from sun.sun falls through the windows as bright patches on the floor, and the house throws its shadow on the plot. Untick it to keep floor and plot free of sun patches and shadows.",sun_arc:"Sun arc and compass",sun_arc_hint:"Draws today's path of the sun as an arc over the plot, with a ring and the compass points on the ground (north in red). Needs your home's location in Home Assistant.",weather_effect_rain:"Rain",weather_effect_snow:"Snow",weather_effect_fog:"Fog (greys the scene)",weather_effect_clouds:"Clouds dim the sky and the sun",weather_effect_lightning:"Lightning in storms",weather_effect_sky:"Sun and moon in the sky",weather_entity_hint:"Which weather entity drives the sky around the house. Automatic uses the first one found.",weather_hint:"Weather at the house: rain and snow fall with the real wind, clouds drift over the plot with their shadows, lightning, fog, sun and moon",card_weather:"Weather outside",card_weather_hint:"Rain, snow, hail, clouds with shadows, lightning and fog from the first weather entity (weather_entity picks another); fewer particles on the tablet level",alerts:"Warnings",alert_smoke:"Smoke: {name}",alert_gas:"Gas: {name}",alert_co:"Carbon monoxide: {name}",alert_water:"Water: {name}",alert_alarm:"Alarm triggered",alert_alarm_by:"Alarm set off by {cause}",alert_alarm_pending:"Alarm pending",alert_window_rain:"Window open in the rain: {name}",alert_power_outage:"Power outage: {name}",alert_contact_lost:"Contact not answering: {name}",rain_sensor:"Rain sensor (own weather station)",rain_sensor_inverted:"Invert rain sensor",rain_sensor_inverted_hint:"For sensors that read off (or 0) when it rains and on when it is dry.",outage_sensor:"Power outage sensor",outage_hint:'A binary sensor of class power that is off, another binary sensor that is on, a state like "off_grid" or "backup", or a voltage below 50 V raise a warning for the whole house.',contact_warning:"Warn when a door or window contact is unavailable",contact_warning_hint:"When a contact has been unavailable for 10 minutes (empty battery, out of radio reach), the window looks shut in 3D although nobody knows. A note then names the contact. A restart of Home Assistant does not warn.",night_lock_warning:"Warn at night when a door is not locked",night_lock_warning_hint:"Between 10 pm and 6 am a note names the plan's door locks that stand unlocked.",alert_unlocked_night:"Not locked: {name}",motion_markers_active:"Show motion sensors only while they detect something",motion_markers_active_hint:"Applies to motion, occupancy and presence sensors. A sensor whose marker is set to always show stays visible.",room_double_tap:"Double tap on a room",room_double_tap_hint:"A double tap on a room turns its lights off when one is on, otherwise all on. Devices set to ask first always stay out.",room_double_tap_area:"Lamps in the plan and every light of the area",room_double_tap_plan:"Only lamps in the plan",room_double_tap_off:"Switch nothing",card_room_double_tap_auto:"As set in the plan",status_entities:"Own sensors at the top of the 3D view",status_add:"Add a sensor",status_entities_hint:"For example the outside temperature, the alarm or the air quality: they show at the top left with name and value, in an opened room too. A tap opens their details. Up to 12.",announce_tts:"Text-to-speech for announcements",announce_phrases:"Sentences for announcements (one per line)",announce_phrases_hint:`Empty: the sentences that come with NextFloor. Announcements also exist as the action "NextFloor: Announcement" for automations \u2013 on the rooms' speakers and on every open NextFloor screen.`,opening_rain_warning:"Warn when it rains",opening_light_well:"Light well in front",sill_boards:"Sill and board",sill_boards_auto:"Automatic",sill_boards_none:"None",sill_boards_inside:"Inside only",sill_boards_outside:"Outside only",room_names_short:"Room names",room_names_toggle_hint:"Show or hide room names in the 3D view",floor_stack_short_dim:"Dimmed",floor_stack_short_stacked:"Stacked",floor_stack_short_single:"Alone",size_short_w:"W",size_short_d:"D",size_short_h:"H",import_error_not_json:"The file is no JSON.",import_error_not_plan:"The file is no NextFloor plan.",import_other_hint:"From Sweet Home 3D: import the .sh3d file here. Floors, rooms, doors, windows and free walls come over, furniture does not.",import_sh3d_found:"Sweet Home 3D: {floors} floors, {rooms} rooms, {openings} doors and windows, {walls} free walls ({furniture} pieces of furniture are not taken over).",import_dxf_found:"DXF: {rooms} rooms (closed polylines) and {walls} free walls (lines) on one floor.",import_ifc_found:"In the IFC file: {floors} floors and {rooms} rooms (NextFloor draws the walls from the rooms).",import_roomplan_found:"Room scan (RoomPlan): {rooms} rooms, {openings} doors and windows; {skipped} objects were not taken over (you place furniture yourself).",import_error_roomplan_empty:"The room scan has no walls.",import_error_ifc_empty:"The IFC file has no spaces (IfcSpace) with a footprint.",import_error_dxf_empty:"The DXF file has no lines or polylines.",import_error_sh3d:"This is not a Sweet Home 3D file that can be read (it needs Sweet Home 3D 5.3 or newer).",import_error_sh3d_empty:"The Sweet Home 3D file has no rooms or walls.",export_name_template:"template",export_name_backup:"backup",card_floor_stack:"Floors below",floor_stack_dim:"Dimmed",floor_stack_stacked:"Stacked (the house up to here)",floor_stack_single:"Hidden (only this floor)",card_control_walls:"Tall walls/cut",card_control_floors:"Floors apart",card_control_temperature:"Temperature",card_control_humidity:"Humidity",card_control_co2:"CO\u2082",card_controls_hint:"Tall walls/cut, floors apart and temperature, humidity, CO\u2082 to switch",controls_hide:"Hide the controls \u2013 only the 3D view remains",nav_wrap:"Wrap the bar: every floor and room on several lines",bars_unfold:"Switches",nav_row:"Bar in one line (scrolls sideways)",controls_show:"Show the controls again",card_controls_hidden:"Start with the controls hidden",card_controls_hidden_hint:"Only the 3D view; an eye at the bottom left brings bars, values and switches back",card_controls_hide_after:"Hide the controls after",card_hide_after_s:"{n} s without a touch",card_fullscreen_button:"Full screen button",card_fullscreen_button_hint:"Hides the dashboard around the card (e.g. on a wall tablet)",fullscreen:"Full screen",fullscreen_exit:"Exit full screen",card_section_show:"Show",card_floor:"Floor",card_floor_house:"Whole house (tap a floor to open it)",card_height:"Height (pixels)",card_walls:"Walls",card_quality_hint:"\u201CTablet\u201D is the lightest setting \u2013 ideal for Fire tablets and other wall tablets.",card_flows_switch:"Switch in the card",card_flows_on:"Always on",card_flows_off:"Always off",holos:"Cards",holos_hint:"Show or hide the live cards over the house (energy balance, car, media)",card_energy:"Show energy values at the top",card_room_panel:"Room details on tap",card_room_buttons:"Room buttons",card_room_buttons_hint:"A row with one button per room at the top of the card \u2013 tap one to open the room, like tapping it in the model",card_room_panel_hint:"The room's lights and blinds in a side panel",card_explode:"Pull floors apart in the house view",card_roof_fade:"Fade the roof out while zooming in",card_roof_fade_hint:"Off: the roof stays on the house even when the camera comes close.",card_stats:"Performance display (frames per second)",card_stats_hint:"To check how smoothly the card runs on the device",packs:"Furniture packs",lib_badge_light:"Lamp: links to a light and switches in 3D",lib_badge_electric:"Electric: links to an entity and a power sensor (switching, pictures, consumption)",lib_badge_hint:"Items with a symbol link to entities: lamps switch, screens show pictures, appliances show their consumption.",care_bin_today:"Collected today",care_bin_tomorrow:"Collected tomorrow",care_bin_days:"In {n} days",care_mail_yes:"Post is in",care_mail_no:"Empty",care_plant_thirsty:"Thirsty",care_plant_ok:"Well watered",care_time_left:"{time} left",care_entity_bin:"Pickup date (sensor)",care_entity_mail:"Post sensor",care_entity_plant:"Soil moisture (sensor)",care_thirsty_below:"Thirsty below (%)",care_hint_bin:'A sensor with the next pickup: days, a date, "today"/"tomorrow" or the Waste Collection Schedule integration. The bin glows the day before and on the day.',care_hint_mail:"A sensor that reports post in the box (a contact on the flap, say). The mailbox glows then.",care_hint_plant:"A moisture sensor in the soil. Below the threshold the plant glows and says it is thirsty.",lib_cat_lights:"Lights",lib_cat_seating:"Seating",lib_cat_tables:"Tables",lib_cat_storage:"Cabinets & shelves",lib_cat_beds:"Beds",lib_cat_kitchen:"Kitchen",lib_cat_appliances:"Appliances",lib_cat_bath:"Bathroom",lib_cat_media:"TV & audio",lib_cat_office:"Office",lib_cat_tech:"Tech",lib_cat_climate:"Heating & climate",lib_cat_energy:"Energy",lib_cat_garden:"Garden & terrace",lib_cat_plants:"Plants",lib_cat_kids:"Kids",lib_cat_fitness:"Fitness",lib_cat_pets:"Pets",lib_cat_workshop:"Workshop & garage",lib_cat_music:"Music & studio",lib_cat_season:"Season & decoration",lib_cat_pictures:"Pictures & frames",lib_cat_vehicles:"Vehicles",lib_cat_building:"Stairs & building parts",lib_cat_decor:"Decoration & more",lib_favourites:"Favourites",lib_recent:"Recently used",lib_for_room:"Fits {room}",lib_all_rooms:"Show all rooms",lib_linkable:"linkable",lib_lit:"lit",lib_outdoor:"outdoor",lib_fav_add:"Add to favourites",lib_fav_remove:"Remove from favourites",lib_sizes:"Sizes",feature_name_energy:"Energy flow",ext_tab:"Extensions",ext_title:"Extensions",models:"Your own 3D models",models_hint:"For some vehicles NextFloor can show a real 3D model if you own one. Choose the file (.glb) here: NextFloor turns it the right way round, makes it lighter, marks the paint and stores it on your Home Assistant. Without a model the vehicle looks as it did before.",models_licence:"The files are yours and stay on your Home Assistant. NextFloor ships no models; please make sure your model's licence lets you use it in your own installation.",model_add:"Add a model \u2026",model_replace:"Replace the model \u2026",model_remove:"Remove",model_present:"in place",model_missing:"none yet",model_remove_confirm:"Delete the model \u201C{id}\u201D from Home Assistant?",model_removed:"Model \u201C{id}\u201D deleted.",model_uploaded:"Model \u201C{id}\u201D stored ({size}). Reload the panel to see it.",model_upload:"Store on Home Assistant",model_info:"{triangles} triangles, {size} m",model_front:"Front",model_front_hint:"Turn the model until its front faces the viewer (towards the lower left in the picture).",model_paint:"Paint (the colour you pick in the editor)",model_paint_preview:"Colour in the preview",model_detail:"Level of detail",model_detail_light:"Light (tablet)",model_detail_normal:"Normal",model_detail_fine:"Fine",model_result:"Result: {triangles} triangles, {size}",model_error_not_glb:"This is not a .glb file (binary glTF). Export the model as \u201CglTF binary\u201D.",model_error_compressed:"The file is compressed (Draco, Meshopt or KTX). Export it without compression.",model_error_empty:"The file contains nothing three-dimensional.",model_error_unreadable:"The file cannot be read: {detail}",model_error_too_large:"The file is larger than {max}. Choose a lower level of detail.",model_upload_forbidden:"Only administrators may upload models.",model_upload_too_large:"Home Assistant accepts no files over {max}. Choose a lower level of detail.",model_upload_not_glb:"Home Assistant refused the file (not a binary glTF).",model_upload_bad_id:"The model id is not valid.",model_upload_other:"Uploading did not work: {detail}",ext_intro:"Import your own furniture packs, upload your own 3D models and add plugins here.",plugin:"plugin",plugins_title:"Plugins",plugins_intro:"Plugins add your own light animations, devices and cards in the room panel. Enter a plugin's address (a .js file in /config/www, i.e. /local/\u2026, from HACS /hacsfiles/\u2026, or https://\u2026).",plugins_docs:"How to write a plugin",plugins_warning:"Plugins run with the same rights as NextFloor in your browser. Only use plugins from sources you trust.",plugins_off:"off",plugins_error:"error",plugins_loading:"loading \u2026",plugins_nothing_registered:"loaded, but registered nothing",plugins_loaded:"active",plugins_reload_hint:"Takes effect after reloading the page",plugins_remove:"Remove",plugins_none:"No plugins yet.",plugins_from_dashboard:"Registered by a dashboard resource",plugins_add:"Add",plugins_url_invalid:"Enter a .js address under /local/\u2026, /hacsfiles/\u2026 or https://\u2026.",plugins_exists:"This plugin is already in the list.",plugins_limit:"At most 20 plugins.",packs_title:"Furniture packs",packs_intro:"Import your own furniture as a pack (JSON): as a file or pasted below. {n} packs come with NextFloor and are always there.",packs_docs:"Pack format",packs_none:"No packs of your own yet.",community_title:"Community furniture",community_intro:"Furniture others built with the furniture builder and shared \u2013 checked and free. Build your own:",community_builder:"Open the furniture builder",community_how:"How to share yours",community_load:"Load community furniture",community_none:"No community furniture yet \u2013 be the first!",community_install:"Install",community_update:"Update",community_installed:"Installed",community_failed:"The community furniture could not be loaded: {detail}",pack_import:"Import pack files \u2026",pack_paste:"Import JSON",pack_paste_empty:"Paste a pack's JSON first.",pack_paste_not_json:"This is not valid JSON: {detail}",pack_imported:"Imported \u201C{name}\u201D by {publisher} \u2013 {n} items",packs_imported_n:"{n} of {total} packs imported",pack_by:"by {publisher} \xB7 {n} items",pack_remove:"Remove",pack_remove_confirm:"Remove the pack \u201C{name}\u201D? Its furniture stays in the plan as plain boxes.",pack_error_not_a_pack:'This is not a furniture pack ("format": "nfpack" is missing).',pack_error_builtin:"A pack that comes with NextFloor already has this id.",pack_error_invalid_content:"The pack contains invalid furniture: {detail}",pack_error_too_large:"The pack is too large (1 MB at most).",pack_error_needs_update:'This pack needs a newer version of NextFloor. Please update first (HACS \u203A NextFloor \u203A \u22EE \u203A "Update information" \u203A "Download"), restart Home Assistant, then import again.',pack_error_other:"Import failed: {detail}",store_open:"Open plugin store",store_close:"Close plugin store",store_intro:"Reviewed plugins from the community. Each one is looked at before it is added and does not change afterwards.",store_submit:"Submit your own plugin",store_empty:"No plugins in the store yet.",store_failed:"The store could not be loaded ({error}).",store_install:"Install",store_installed:"installed",store_update:"Update",store_confirm:`Install \u201C{name}\u201D by {author}? +{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_passage:"Durchbruch (ohne T\xFCr)",style_standard:"Standard",style_bars:"Mit Sprossen",style_glass_wall:"Glaswand (feststehend)",preset_glass_wall:"Glaswand",glass_panes:"Glasfelder",glass_panes_auto:"automatisch (ca. 0,9 m)",glass_panes_hint:"0 = ein einziges Glas ohne Teilung, leer = Teilung etwa alle 0,9 m",flip_hinge:"Anschlag wechseln",flip_main_leaf:"Hauptfl\xFCgel wechseln",flip_hinge_hint:"Scharniere auf die andere Seite",flip_swing:"\xD6ffnungsrichtung umdrehen",flip_swing_hint:"Die T\xFCr schwenkt in den Raum oder zur anderen Seite",main_leaf:"Hauptfl\xFCgel (vom Raum aus)",contact_main:"Kontakt Hauptfl\xFCgel",contact_second:"Kontakt zweiter Fl\xFCgel",tool_outdoor:"Au\xDFen",tool_measure:"Nach Ma\xDF",hint_measure:"Startpunkt antippen, dann rechts die Wandl\xE4ngen mit Richtung eingeben",measure:"Raum nach Ma\xDF",measure_start:"Tippe im Plan auf den Startpunkt, z. B. eine Raumecke.",measure_from:"Start bei {x} / {z} m \u2013 antippen verschiebt den Start.",measure_length:"L\xE4nge der n\xE4chsten Wand (m)",measure_close:"Raum schlie\xDFen",measure_undo:"Letzte Wand weg",measure_gap:"L\xFCcke zum Start: {gap} m (wird beim Schlie\xDFen verbunden)",measure_hint:"Tipp: L\xE4nge eintippen und Pfeiltaste dr\xFCcken. Mit gemessenen Innenma\xDFen danach \u201EL\xFCcken schlie\xDFen\u201C.",rect_by_size:"Rechteck nach Ma\xDF",rect_add:"Rechteck anlegen",dir_up:"Nach oben",dir_down:"Nach unten",dir_left:"Nach links",dir_right:"Nach rechts",hint_outdoor:"Ziehen, um eine Au\xDFenfl\xE4che (Rasen, Terrasse, Pool \u2026) aufzuziehen",outdoor:"Au\xDFenfl\xE4che",outdoor_type:"Art",outdoor_height:"H\xF6he (m)",outdoor_offset:"H\xF6henversatz (m, \u2212 = tiefer)",outdoor_opacity:"Deckkraft (%)",outdoor_opacity_hint:"100 = undurchsichtig. Weniger macht die Fl\xE4che durchsichtig, etwa eine Einfahrt \xFCber dem Keller; der Umriss bleibt.",outdoor_outline:"Umrisslinie zeigen",outdoor_outline_hint:"Ohne Haken zeichnet die Fl\xE4che keine Leuchtlinie an ihrem Rand \u2013 f\xFCr gro\xDFe Grundst\xFCcke aus mehreren Rasenfl\xE4chen.",outdoor_corners_hint:"Ecken: ein + auf einer Kante f\xFCgt eine Ecke hinzu, Ziehen formt die Fl\xE4che, \xD7 entfernt eine Ecke.",outdoor_hint:"Au\xDFenleuchten (Wegleuchte, Garten-Spot, Wandleuchte au\xDFen) beleuchten alle Au\xDFenfl\xE4chen und die Fassade.",out_lawn:"Rasen",out_terrace:"Terrasse",out_path:"Weg",out_driveway:"Einfahrt",out_pool:"Pool",out_bed:"Beet",out_hedge:"Hecke",out_fence:"Zaun",out_wild:"Wildfl\xE4che",out_pergola:"Pergola / Rahmen",outdoor_open:"Offen (letzte Kante weglassen)",outdoor_open_hint:"Die Kante vom letzten zum ersten Punkt wird nicht gezeichnet \u2013 ein Zaun oder eine Pergola, die ans Haus lehnt.",fence_gates:"Tore im Zaun",gate_add:"+ Tor im Zaun",gate_edge:"Zaunseite",gate_kind:"Art",gate_single:"Gartentor",gate_double:"Doppeltor",gate_sliding:"Schiebetor",gate_offset:"Mitte ab Zaunanfang (m)",gate_width:"Breite (m)",gate_entity:"Antrieb oder Schalter",gate_contact:"Kontakt (an = offen)",fence_gates_hint:"Ein Tor ist eine L\xFCcke im Zaun mit Torpfosten und Fl\xFCgel. Mit einem Antrieb (Cover, Schalter, Hilfsschalter, Schloss) und/oder Kontakt geht es in 3D auf: Garten- und Doppeltor schwingen nach innen, ein Schiebetor f\xE4hrt hinter den Zaun.",outdoor_bracing:"X-Verstrebung",outdoor_cut:"Aus Fl\xE4chen ausschneiden",outdoor_cut_hint:"Jede Fl\xE4che, in der diese ganz liegt, bekommt hier ein Loch \u2013 ein Pool in der Terrasse, ein Teich oder eine Wildfl\xE4che im Rasen. Die Reihenfolge beim Zeichnen spielt keine Rolle. Ein Pool schneidet sich von selbst aus.",outdoor_area_hint:"Der Home-Assistant-Bereich dieser Fl\xE4che (Garten, Terrasse, Pool): seine Ger\xE4te und Sensoren stehen unter Drau\xDFen, und ein Pin auf der Fl\xE4che \xF6ffnet es.",pool_temp:"Wassertemperatur (optional)",pool_pump:"Pumpe / Filter (optional)",pool_pump_on:"Pumpe l\xE4uft",outdoor_slope:"Gef\xE4lle (m)",outdoor_slope_hint:"H\xF6henunterschied von der hohen zur tiefen Kante; die hohe Kante liegt auf dem H\xF6henversatz. Leuchten auf der Fl\xE4che folgen.",outdoor_slope_dir:"F\xE4llt nach",slope_x:"rechts (+X)",slope_nx:"links (\u2212X)",slope_z:"unten (+Z)",slope_nz:"oben (\u2212Z)",north:"Nordrichtung (\xB0 im Uhrzeigersinn von oben)",north_hint:"Die Nordrichtung braucht der Sonnenstand (Licht durch die Fenster).",map_on:"Echte Karte unter dem Plan anzeigen",map_lat:"Breitengrad",map_lon:"L\xE4ngengrad",map_use_ha:"Standort von Home Assistant \xFCbernehmen",map_opacity:"Sichtbarkeit (%)",map_zoom:"Detailstufe",map_zoom_coarse:"grob",map_zoom_fine:"fein",map_move:"Karte unter dem Plan verschieben",map_step:"Schritt",map_url:"Eigene Kachel-Adresse (leer = OpenStreetMap)",map_hint:"Dein Browser l\xE4dt die Kartenkacheln direkt vom Kartenserver (standardm\xE4\xDFig OpenStreetMap, bitte deren Nutzungsbedingungen beachten); solange die Karte aus ist, wird nichts geladen. Der Plan liegt auf der Karte, wie der Kompass es sagt \u2013 drehe den Kompass oder verschiebe die Karte, bis das Haus passt.",compass_title:"Kompass",compass_n_short:"N",compass_s_short:"S",compass_swap:"Nord \u2194 S\xFCd tauschen",compass_swap_hint:"Dreht den Kompass um 180\xB0. Zeichnung, Dachfl\xE4chen und Solarfelder bleiben, wie sie sind.",compass_hint:"Stimmt der Kompass nicht mit der Wirklichkeit \xFCberein, drehst du ihn hier \u2013 nichts muss neu gezeichnet werden. Sonnenlicht, Wind und die Himmelsrichtungen der Dachfl\xE4chen richten sich danach.",roof:"Dach",roof_none:"Kein Dach",roof_flat:"Flachdach",roof_gable:"Satteldach",roof_custom:"Dachfl\xE4chen (frei)",roof_sections:"Dachfl\xE4chen",roof_sections_hint:"Jede Dachfl\xE4che deckt ein Rechteck des Hauses ab, etwa das Wohnhaus, die Scheune oder einen Anbau \u2013 jede mit eigener Form, Firstrichtung, Traufh\xF6he und Neigung. Eine neue Fl\xE4che ziehst du im Plan auf; antippen w\xE4hlt sie aus, ziehen verschiebt sie, die Ecken \xE4ndern die Gr\xF6\xDFe.",roof_sections_start:"Dachfl\xE4chen aus den R\xE4umen erzeugen",roof_sections_regen:"Neu aus den R\xE4umen erzeugen",roof_sections_off:"Zur\xFCck zu einem Dach",roof_regen_confirm:"Alle Dachfl\xE4chen durch einen neuen Vorschlag aus den R\xE4umen ersetzen?",roof_section:"Dachfl\xE4che",roof_section_hint:"H\xF6hen z\xE4hlen vom Boden. Eine Seite mit tieferer Traufe zieht weiter herunter (Abschleppdach); Pultd\xE4cher steigen von der ersten Seite an.",roof_shape_gable:"Sattel",roof_shape_hip:"Walm",roof_shape_pent:"Pult",roof_shape_flat:"Flach",roof_shape_halfhip:"Kr\xFCppelwalm",roof_shape_pyramid:"Zelt",roof_shape_mansard:"Mansard",roof_shape_parapet:"Attika",roof_shape:"Form",roof_end_start:"Ende am Firstanfang",roof_end_end:"Ende am Firstende",roof_halfhip:"Kr\xFCppelwalm beginnt bei",roof_halfhip_hint:"Wie weit oben am Giebel die Walmfl\xE4che beginnt, als Anteil der Giebelh\xF6he: niedrig = ein gro\xDFer Walm, hoch = nur die Spitze ist abgewalmt.",roof_axis_x:"First \u2194",roof_axis_z:"First \u2195",roof_eave:"Traufe (m)",roof_pitch_short:"Neigung (\xB0)",roof_height:"H\xF6he (m)",roof_base:"Wandoberkante (m)",roof_rotation:"Drehung (\xB0)",roof_on_floor:"Sitzt auf Etage",roof_on_floor_hint:"Setzt den Abschnitt auf die Wandoberkante dieser Etage; Grundh\xF6he und Traufen wandern mit. In der 3D-Ansicht geh\xF6rt das Dach zu dieser Etage.",roof_base_hint:"Liegt sie unter der Deckenh\xF6he des Geschosses darunter, enden dessen W\xE4nde an der Dachunterseite: Kniestock an der Traufe, Giebel bis zum First, Innenw\xE4nde an der Schr\xE4ge. Im Grundriss zeigen gestrichelte Linien, wo 1,5 m und 2 m Kopfh\xF6he bleiben.",roof_ridge_height:"Firsth\xF6he",roof_side_top:"oben",roof_side_bottom:"unten",roof_side_left:"links",roof_side_right:"rechts",roof_swap:"Seiten tauschen",roof_open:"\xDCberdachung (Pfosten statt W\xE4nde, durchsichtig)",roof_open_short:"\xDCberdachung",roof_dormer:"Gaube",roof_dormer_hint:"Eine Gaube auf dieser Dachseite: 2 m breit, Front an der Traufwand, Traufe 1,4 m \xFCber der Dachtraufe, Satteldach. Danach verschieben, Breite und H\xF6hen \xE4ndern wie bei jeder Dachfl\xE4che; die Hauptfl\xE4che \xF6ffnet sich darunter, die Wand des Dachgeschosses steigt bis zur Gaube \u2013 dort passt ein Fenster.",roof_outline:"Umriss des Geschosses \xFCbernehmen",roof_outline_hint:"Ein Flachdach als freie Form: \xFCbernimmt den Umriss der R\xE4ume des angezeigten Geschosses (auch L- oder Z-f\xF6rmig) als eine Fl\xE4che ohne Kanten. Die Ecken lassen sich danach ziehen.",roof_points_hint:"Freie Form: Ziehe die Ecken im Plan, ein + auf einer Kante f\xFCgt eine Ecke hinzu, \xD7 entfernt eine. Zur\xFCck zum Rechteck l\xF6scht die Form.",roof_rect:"Zur\xFCck zum Rechteck",roof_open_hint:"F\xFCr Terrassendach oder Carport: Statt W\xE4nden tragen Pfosten und Balken das Dach, die Fl\xE4che ist durchsichtig. Wo die \xDCberdachung an die Hauswand st\xF6\xDFt, liegt sie auf der Wand auf.",roof_swap_hint:"Dreht das Dach um: Die beiden Seiten tauschen Traufe und Neigung, ein Pultdach steigt in die andere Richtung.",roof_pitch:"Dachneigung (\xB0)",roof_overhang:"Dach\xFCberstand (m)",roof_overhang_sides:"\xDCberstand je Seite",roof_overhang_a:"\xDCberstand Traufe A (m)",roof_overhang_b:"\xDCberstand Traufe B (m)",roof_overhang_u0:"\xDCberstand Giebel vorn (m)",roof_overhang_u1:"\xDCberstand Giebel hinten (m)",roof_overhang_auto:"Wieder automatisch",roof_overhang_sides_hint:"Ohne eigene Werte ist der \xDCberstand automatisch: \xFCberall gleich, au\xDFer wo der Dachteil ans Haus st\xF6\xDFt (dort keiner).",roof_ridge:"First",roof_ridge_long:"Entlang der langen Seite",roof_ridge_short:"Entlang der kurzen Seite (z. B. Reihenhaus)",device:"Ger\xE4t",lamp_mount:"Lampe",lamp_ceiling:"Deckenleuchte",lamp_floor:"Stehlampe",lamp_table:"Tischlampe",lamp_wall:"Wandleuchte",marker_height:"H\xF6he des Symbols (m)",height_auto:"H\xF6he automatisch",device_centre:"In Raummitte",lights_spread:"Deckenlampen gleichm\xE4\xDFig verteilen",devices_search:"Ger\xE4te suchen \u2026",devices_more:"+{n} weitere",devices_less:"weniger",panel_more:"Weitere Ger\xE4te des Bereichs ({n})",panel_less:"Weniger anzeigen",gaps_close:"L\xFCcken schlie\xDFen",gaps_hint:"R\xE4ume mit bis zu 60 cm Abstand an einer gemeinsamen Wand zusammenf\xFChren; der Abstand wird die Innenwandst\xE4rke.",gaps_none:"Keine L\xFCcken zwischen R\xE4umen gefunden.",gaps_closed:"{n} Stellen geschlossen.",gaps_closed_wall:"{n} Stellen geschlossen, Innenwand jetzt {t} m.",fps:"FPS",fps_title:"Leistungsanzeige (Bilder pro Sekunde)",hint_garage:"Auf eine Wand tippen, um ein Garagentor einzusetzen",opening_garage:"Garagentor",garage_hint:"Das Tor folgt einem Garagen-Cover (Position oder offen/zu) oder einem Garagentor-Kontakt aus dem Bereich des Raums.",door_hint:"Mit T\xFCrkontakt schwenkt das T\xFCrblatt auf, ohne Sensor steht es halb offen.",hint_door:"Auf eine Wand tippen, um eine T\xFCr einzusetzen",hint_window:"Auf eine Wand tippen, um ein Fenster einzusetzen",opening_door:"T\xFCr",opening_window:"Fenster",opening_type:"Art",opening_position:"Mitte ab Ecke (m)",sill:"Br\xFCstung (m)",opening_height:"H\xF6he (m)",hinge:"Anschlag (vom Raum aus)",hinge_left:"Links",hinge_right:"Rechts",cover_entity:"Rollladen",door_cover:"Antrieb (T\xFCr oder Tor mit Motor)",cover_position_entity:"Positions-Sensor (live)",cover_position_invert:"Positionssensor in 3D umkehren (0 = offen)",contact_entity:"Kontakt",sensor_kind:"Sensor-Art",sensor_kind_contact:"Fensterkontakt (offen/zu)",sensor_kind_handle:"Griff-Sensor (offen/gekippt/zu)",sensor_kind_contact_tilt:"Kontakt + Kipp-Sensor",handle_entity:"Griff-Sensor",handle_main:"Griff-Sensor Hauptfl\xFCgel",leaf_main:"Hauptfl\xFCgel",leaf_second:"Zweiter Fl\xFCgel",tilt_entity:"Kipp-Sensor",tilt_angle_entity:"Kippwinkel-Sensor (\xB0, optional)",tilt_angle_max:"Winkel f\xFCr \u201Eganz gekippt\u201C (\xB0)",tilt_angle_offset:"Offset: Winkel bei geschlossenem Fenster (\xB0)",tilt_angle_invert:"Winkel z\xE4hlt andersherum",door_shut:"Ohne Sensor geschlossen zeigen",door_shut_hint:"Eine T\xFCr ohne Kontakt steht in 3D halb offen, damit man sie als T\xFCr erkennt. Mit Haken wird sie geschlossen gezeichnet \u2013 Haust\xFCr, Carport, Nebent\xFCr.",door_angle:"\xD6ffnungswinkel",door_angle_default:"Standard",door_angle_hint:"Wie weit das T\xFCrblatt aufgeht. Mit Sensor \xF6ffnet es so weit, sobald er \u201Eoffen\u201C meldet; ohne Sensor steht es so weit offen (statt halb). Standard bleibt wie bisher.",entity_auto:"Automatisch ({name})",entity_auto_none:"Automatisch (keiner gefunden)",entity_none:"Keiner",entity_search:"Tippen zum Suchen \u2026",opening_hint:"Sensor-Art: Fensterkontakt (meldet offen/zu), Griff-Sensor (meldet offen, gekippt und zu \u2013 z. B. Homematic-Fenstergriff) oder Kontakt + Kipp-Sensor (ein zweiter Sensor, der nur \u201Egekippt\u201C meldet). Automatisch nimmt Rolll\xE4den und Kontakte aus dem Bereich des Raums. Positions-Sensor: eine Entit\xE4t, die die Rollladen-Position auch w\xE4hrend der Fahrt meldet (z. B. Homematic \u201ELevel\u201C, 0\u2013100 % oder 0\u20131, offen = hoch) \u2013 dann f\xE4hrt der Rollladen in 3D live.",furniture:"M\xF6bel",furniture_add:"M\xF6bel hinzuf\xFCgen",studio_new:"Eigenes M\xF6bel bauen",studio_title:"M\xF6bel-Werkstatt",studio_title_edit:"M\xF6bel-Werkstatt: \xE4ndern",studio_hint:"W\xE4hle eine Vorlage, stell Ma\xDFe und Fronten ein und setz das M\xF6bel in den Plan. Es landet im Pack \u201EEigene M\xF6bel\u201C und l\xE4sst sich sp\xE4ter hier wieder \xE4ndern.",studio_kind:"Vorlage",studio_kind_cabinet:"Schrank",studio_kind_shelf:"Regal",studio_kind_lamp:"Lampe",studio_kind_device:"Ger\xE4t",studio_name:"Name",studio_width:"Breite (cm)",studio_depth:"Tiefe (cm)",studio_height:"H\xF6he (cm)",studio_doors:"T\xFCren",studio_drawers:"Schubladen",studio_shelves:"B\xF6den",studio_handle:"Griffe",studio_handle_bar:"Stangengriff",studio_handle_knob:"Knopf",studio_handle_none:"Grifflos",studio_base:"Unterbau",studio_base_plinth:"Sockel",studio_base_legs:"F\xFC\xDFe",studio_base_none:"Ohne",studio_back:"R\xFCckwand",studio_lamp:"Art",studio_lamp_floor:"Stehlampe",studio_lamp_table:"Tischlampe",studio_lamp_pendant:"Pendelleuchte",studio_lamp_wall:"Wandleuchte",studio_display:"Display vorne (zeigt den Mediaplayer)",studio_mount:"Steht",studio_mount_floor:"Auf dem Boden",studio_mount_surface:"Auf einem M\xF6bel",studio_mount_wall:"An der Wand",studio_color_body:"Korpus",studio_color_lamp_body:"Fu\xDF und Gestell",studio_color_front:"Fronten",studio_color_boards:"B\xF6den",studio_color_shade:"Schirm",studio_color_display:"Rahmen des Displays",studio_color_white:"Wei\xDF",studio_color_wood:"Holz",studio_color_metal:"Metall",studio_color_dark:"Dunkel",studio_color_glass:"Glas",studio_color_accent:"Akzent",studio_color_own:"Eigene Farbe",studio_color_plan:"Farbe des Plans",studio_place:"In den Plan setzen",studio_save:"\xC4nderung speichern",studio_open:"In der Werkstatt \xE4ndern",studio_error:"Speichern ging nicht: {detail}",studio_pack_name:"Eigene M\xF6bel",studio_pack_publisher:"M\xF6bel-Werkstatt",furniture_search:"M\xF6bel suchen \u2026",furniture_search_none:"Nichts gefunden. Versuch ein anderes Wort \u2013 deutsch oder englisch.",furniture_type:"M\xF6belst\xFCck",rotation:"Drehung (\xB0)",tilt_x:"Neigung vorn/hinten (\xB0)",tilt_z:"Neigung seitlich (\xB0)",strip_tilt:"Neigung um die L\xE4nge (\xB0)",strip_upright:"Senkrecht",strip_rise:"Steigung entlang der L\xE4nge (\xB0)",strip_upright_hint:"Der Streifen steht hochkant: Seine L\xE4nge l\xE4uft von der H\xF6he \xFCber Boden nach oben \u2013 am T\xFCrrahmen, als Lichts\xE4ule. Die Neigung legt einen liegenden Streifen an die Schr\xE4ge (90\xB0 = Fl\xE4che zeigt zur Seite).",rotate_left:"\u21BA 90\xB0",rotate_right:"\u21BB 90\xB0",height_m:"H\xF6he (m)",furn_sofa:"Sofa",furn_armchair:"Sessel",furn_table:"Tisch",furn_chair:"Stuhl",furn_bed:"Bett",furn_nightstand:"Nachttisch",furn_wardrobe:"Schrank",furn_shelf:"Regal",furn_kitchen:"K\xFCchenzeile",furn_worktop:"Arbeitsplatte",furn_fridge:"K\xFChlschrank",furn_fridge_smart:"Smart-K\xFChlschrank (Side-by-Side)",furn_door_left:"T\xFCrsensor links (Gefrierseite)",furn_door_right:"T\xFCrsensor rechts (K\xFChlseite)",fridge_hint:"Meldet ein T\xFCrsensor \u201Eoffen\u201C, schwingt die T\xFCr in 3D auf.",furn_stove:"Herd",furn_sink:"Sp\xFCle",furn_bathtub:"Badewanne",furn_shower:"Dusche",furn_wc:"WC",furn_washbasin:"Waschtisch",furn_desk:"Schreibtisch",furn_tv_board:"TV-Board",furn_plant:"Pflanze",furn_rug:"Teppich",furn_stairs:"Treppe",furn_stairwell:"Boden\xF6ffnung",stairwell_hint:"Ein Loch im Boden dieser Etage, zum Beispiel \xFCber dem Treppenaufgang oder f\xFCr eine Galerie; von oben sieht man hindurch. Die \xD6ffnung muss ganz in einem Raum liegen; mehrere \xD6ffnungen d\xFCrfen sich \xFCberlappen (zum Beispiel f\xFCr eine L-Form). Eine Treppe auf der Etage darunter, die bis hier hinauf reicht, \xF6ffnet den Boden auch von selbst.",tool_hole:"Boden\xF6ffnung",tool_stairs:"Treppe",hint_stairs:"Ziehen, wo die Treppe stehen soll \u2013 sie l\xE4uft entlang der langen Seite; Form, Drehrichtung und Bauart stellst du danach rechts ein",tool_roof:"Dach",tool_energy:"Energie",tool_wall:"Wand",hint_wall:"Ziehen, um eine einzelne Wand zu zeichnen (Raumteiler, halbe Wand) \xB7 Umschalt h\xE4lt sie gerade \xB7 Alt ohne Fangen",free_wall:"Wand",wall_length:"L\xE4nge (m)",wall_thickness:"Wandst\xE4rke (m)",wall_height:"H\xF6he (m)",wall_height_full:"Volle Raumh\xF6he",wall_slope:"Schr\xE4g",wall_slope_start:"H\xF6he am Anfang (m)",wall_slope_end:"H\xF6he am Ende (m)",wall_slope_hint:"Schr\xE4ge Wand: die Oberkante l\xE4uft gerade von der H\xF6he am Anfang der Wand (Ecke mit der kleineren Nummer) zur H\xF6he am Ende. Beide H\xF6hen d\xFCrfen \xFCber der Geschossh\xF6he liegen, zum Beispiel f\xFCr ein Pultdach-Zimmer mit hohen Oberlichtern.",wall_slope_off:"Wieder eine ebene Wand",wall_none:"Keine Wand",wall_none_hint:"Diese Wand ganz weglassen: f\xFCr offene Grundrisse, bei denen R\xE4ume baulich ein Raum sind, in Home Assistant aber getrennt.",edge_thickness:"Dicke (m)",wall_thickness_hint:"Dicke dieser Wand, z. B. 0,365 an einer dicken Au\xDFenwand oder 0,115 an einer leichten Trennwand. Eine Wand zwischen zwei R\xE4umen nimmt die dickere Angabe.",wall_thickness_reset:"Dicke wie im Haus eingestellt",wall_heights:"Wandh\xF6hen",wall_n:"Wand {a}\u2013{b}",wall_view:"Wandansicht",wall_view_hint:"Die Wand von vorne: T\xFCren, Fenster und M\xF6bel an ihr ziehen oder ihren Abstand eintippen.",wall_view_prev:"Vorige Wand",wall_view_next:"N\xE4chste Wand",wall_view_left:"Abstand links (m)",wall_view_height:"H\xF6he \xFCber Boden (m)",wall_part:"Teil {n}",wall_split_hint:"Wand hier teilen: Das Teilst\xFCck bekommt eine eigene H\xF6he, z. B. 2,5 m neben 1,7 m in einer Flucht",wall_split_at:"Teilpunkt ab Ecke (m)",wall_join_hint:"Teilpunkt entfernen: Das Teilst\xFCck w\xE4chst wieder mit dem davor zusammen",wall_exterior_short:"Au\xDFenwand",room_wall_hint:"Eine niedrigere H\xF6he macht aus der Wand eine Br\xFCstung oder Theke. Teilen sich zwei R\xE4ume die Wand, gilt die niedrigere Einstellung. Fenster und T\xFCren darin enden an der Wandh\xF6he.",free_wall_hint:"Eine frei stehende Wand, zum Beispiel ein Raumteiler. Trifft sie auf eine Raumwand, wird die Ecke verschnitten. Die Endpunkte ziehst du an den Griffen, die ganze Wand verschiebst du an der Linie.",free_wall_slope:"\u25E2 Schr\xE4g",free_wall_slope_hint:"Die Wand wird von einem Ende zum anderen h\xF6her oder niedriger: oben die H\xF6he am Anfang, hier die am Ende.",free_wall_height_end:"H\xF6he am Ende (m)",arc:"Bogen",arc_hint:"Biegt die Wand zu einem Bogen. Ein Nachbarraum an dieser Wand biegt sich mit, T\xFCren und Fenster wandern mit; R\xFCckg\xE4ngig nimmt den Bogen zur\xFCck.",arc_bulge:"W\xF6lbung (m)",arc_bulge_hint:"Wie weit sich die Wand in der Mitte w\xF6lbt: positiv nach au\xDFen, negativ in den Raum.",arc_apply:"Biegen",arc_too_wide:"Eine T\xFCr oder ein Fenster in dieser Wand ist f\xFCr diesen Bogen zu breit. Mach den Bogen flacher oder die \xD6ffnung schmaler.",stairwell_outside:"Diese \xD6ffnung ragt \xFCber eine Raumgrenze und wird deshalb nicht ausgeschnitten. Ziehe sie ganz in einen Raum oder verkleinere sie.",hint_hole:"Ziehen, um eine Boden\xF6ffnung aufzuziehen (Treppenaufgang, Galerie)",hint_roof:"Dachfl\xE4che aufziehen \xB7 antippen w\xE4hlt aus \xB7 ziehen verschiebt \xB7 Ecken \xE4ndern die Gr\xF6\xDFe",hint_energy:"Solarfeld antippen w\xE4hlt aus \xB7 ziehen verschiebt, auch auf eine andere Dachfl\xE4che \xB7 neue Felder rechts mit + Solarfeld",furn_parking:"Stellplatz",furn_group_vehicles:"Stellpl\xE4tze",parking_entity:"Sensor \u201EAuto anwesend\u201C",parking_vehicle:"Fahrzeug",parking_vehicle_none:"Keins",parking_no_pack:"Kein Fahrzeug-Pack importiert \u2013 Fahrzeuge kommen aus dem Pack \u201EFahrzeuge\u201C (Erweiterungen \u2192 M\xF6bel-Packs).",parking_scale:"Gr\xF6\xDFe (%)",parking_type_entity:"Fahrzeugtyp-Sensor (optional)",parking_types:"Zustand \u2192 Fahrzeug",parking_type_state:"Zustand (z. B. van)",parking_add_type:"+ Zuordnung",parking_hint:"Ohne Sensor steht das Fahrzeug immer da. Mit Sensor erscheint es, sobald der Sensor \u201Ean\u201C, \u201Ehome\u201C oder \u201Eanwesend\u201C meldet. Ein Fahrzeugtyp-Sensor (z. B. aus einer KI-Kameraauswertung) w\xE4hlt das Modell: Passt sein Zustand zu einer Zuordnung \u2013 auch als Wort im Text \u2013, wird dieses Fahrzeug gezeigt, sonst das Standard-Fahrzeug.",parking_too_tall:"Das Fahrzeug ({car} m) ist h\xF6her als der Raum ({room} m).",furn_lamp_ceiling:"Deckenleuchte",furn_lamp_downlight:"Einbauspot",furn_lamp_spot:"Aufbau-Spot",furn_lamp_panel:"LED-Panel",furn_lamp_uplight:"Deckenfluter",furn_lamp_bollard:"Wegleuchte",furn_lamp_garden:"Garten-Spot",furn_radiator:"Heizk\xF6rper",furn_robot_vacuum:"Saugroboter",furn_entity_vacuum:"Saugroboter",furn_entity_mower:"M\xE4hroboter",pet_room_sensor:"Raum-Sensor des Tiers (optional)",pet_room_hint:"Ein Sensor, der den Raum nennt, in dem das Tier gerade ist \u2013 Bermuda oder ESPresense mit einem Anh\xE4nger am Halsband: in 3D l\xE4uft es dann in diesem Raum herum.",furn_entity_water:"Ventil oder Schalter",device_temp:"Ger\xE4tetemperatur",device_temp_hint:"Ein Temperatursensor des Ger\xE4ts (Wechselrichter, Akku, PC \u2026): sein Wert steht am Pin in der 3D-Ansicht, ab 60 \xB0C ist der Pin hervorgehoben.",fridge_temp:"Temperatur K\xFChlteil",freezer_temp:"Temperatur Gefrierteil",fridge_temp_hint:"Der Pin zeigt die Temperaturen. \xDCber 8 \xB0C im K\xFChlteil oder \u221212 \xB0C im Gefrierteil leuchtet er als Warnung.",spray_reach:"Reichweite des Wassers (m)",spray_hint:"Solange das Ventil offen oder der Schalter an ist, spritzt der Sprenger Wasser in B\xF6gen um sich herum.",furn_robot_room:"Aktueller Raum (Sensor)",robot_cal_none:"Noch nicht kalibriert \u2013 ohne Bezug zur Karte bleibt die Fahrspur erfunden.",robot_cal_done:"Kalibriert: eine Rasterzelle misst {m} m.",robot_cal_do:"Von der jetzigen Position des Roboters kalibrieren",robot_cal_doing:"Tippe in den Plan, wo der Roboter gerade steht.",robot_cal_need:"Die Karte des Roboters meldet gerade keine Position \u2013 l\xE4uft die Integration?",robot_cal_hint:"Die Station ist der Anker: der Plan wei\xDF, wo sie steht, die Kamera wei\xDF, wo Roboter und Station in ihrem Raster liegen. Kennt die Karte R\xE4ume mit denselben Namen wie der Plan, reicht der Knopf \u201EAus den R\xE4umen kalibrieren\u201C. Sonst: Stell den Roboter mindestens 1,5 m entfernt ab \u2013 Reinigung pausieren \u2013 und tippe ihn im Plan an. Kommen die R\xE4ume spiegelverkehrt heraus, setze den Haken.",robot_cal_mirror:"Die Karte des Roboters ist gespiegelt (R\xE4ume kommen verkehrt heraus)",robot_cal_forget:"Kalibrierung entfernen",robot_cal_nudge:"Von Hand nachr\xFCcken: Pfeile schieben die Karte um 10 cm, \u27F2 \u27F3 drehen um 1\xB0, \u2212 + \xE4ndern die Gr\xF6\xDFe um 1 %.",robot_cal_nudge_move:"Karte verschieben",robot_cal_nudge_turn:"Karte drehen",robot_cal_nudge_grow:"Karte gr\xF6\xDFer oder kleiner",robot_cal_rooms:"Aus den R\xE4umen kalibrieren (die Karte kennt {n} R\xE4ume)",robot_cal_rooms_none:"Zu wenige R\xE4ume hei\xDFen im Plan so wie auf der Karte des Roboters ({n} gefunden, mindestens 2 n\xF6tig). Benenne die R\xE4ume gleich \u2013 oder kalibriere \xFCber die Position des Roboters.",robot_cal_rooms_bad:"Die gleichnamigen R\xE4ume liegen im Plan anders als auf der Karte des Roboters \u2013 ist ein Raum vertauscht? Kalibriere sonst \xFCber die Position des Roboters.",robot_hint:"Saugt der Roboter in Home Assistant, f\xE4hrt er in 3D in Bahnen durch den Raum, den er meldet (Sensor \u201EAktueller Raum\u201C, zugeordnet \xFCber den Raum- oder Bereichsnamen), sonst durch den Raum seiner Station. Ist die Karte des Roboters unten kalibriert, zeigt die Spur stattdessen, wo er wirklich gefahren ist; ohne sie sind die Bahnen erfunden. Zur\xFCck f\xE4hrt er zur Station.",furn_lamp_pendant:"Pendelleuchte",furn_ceiling_fan:"Deckenventilator",furn_fan_entity:"Ventilator",fan_hint:"Die Leuchte ist das Licht des Ventilators (leer lassen, wenn er keins hat). Der Ventilator wird im Raum gefunden oder hier gew\xE4hlt: In 3D drehen sich die Fl\xFCgel so schnell wie er l\xE4uft, sein Symbol schaltet ihn, Wischen hoch/runter \xE4ndert die Stufe, lange dr\xFCcken \xF6ffnet das Schnellmen\xFC. Die H\xF6he ist, wie weit er von der Decke h\xE4ngt (mehr = l\xE4ngere Stange).",room_ceiling:"Deckenh\xF6he",room_ceiling_tip:"Niedriger als das Stockwerk (ein Bad unter der Treppe) oder h\xF6her (ein Wohnzimmer offen bis unters Dach): Deckenleuchten, Ventilatoren, LED-Streifen und Ger\xE4te an der Decke h\xE4ngen dann hier, und die W\xE4nde des Raums sind so hoch.",room_ceiling_through:"Die Decke ({ceiling} m) liegt \xFCber der Etagenh\xF6he ({floor} m): Der Raum reicht in die Etage dar\xFCber, seine W\xE4nde wachsen mit, und die Etage dar\xFCber bleibt \xFCber ihm offen (Luftraum). Im Editor der oberen Etage ist die Fl\xE4che schraffiert.",room_floor_offset:"Bodenh\xF6he (m)",room_floor_offset_hint:"Liegt der Boden dieses Raums tiefer oder h\xF6her als die Etage (ein abgesenkter Eingang: \u22120,39), wandern Boden, W\xE4nde, T\xFCren und Fenster und was im Raum steht mit; die Decke bleibt. Die Stufen stellst du als Treppe dazu.",room_inner:"Innenma\xDF {w} \xD7 {d}",room_inner_hint:"Von Wand zu Wand gemessen: Innenw\xE4nde nehmen die H\xE4lfte ihrer Dicke, Au\xDFenw\xE4nde stehen au\xDFerhalb des Umrisses.",floor_heating:"Fu\xDFbodenheizung (optional)",floor_heating_hint:"Solange der Thermostat heizt (oder das Ventil offen, der Schalter an ist), gl\xFCht der Boden des Raums in 3D warm.",room_announce_speaker:"Lautsprecher f\xFCr Durchsagen",room_announce_quiet:"Ruhezeit f\xFCr Durchsagen",room_announce_hint:"Ohne Wahl spricht der Lautsprecher, der im Raum steht, sonst ein Sprachassistent, ein Echo oder ein Lautsprecher des Bereichs (nie ein Fernseher). In der Ruhezeit lassen Durchsagen an mehrere R\xE4ume diesen Raum aus; eine Durchsage nur f\xFCr ihn kommt trotzdem an.",ceiling_here:"Decke hier",ceiling_here_hint:"H\xF6he der Decke genau an dieser Stelle, z. B. bei einer Dachschr\xE4ge. Leer = Decke des Raums.",ceiling_slope:"An die Dachschr\xE4ge",ceiling_slope_hint:"Die Decke liegt hier unter der Dachschr\xE4ge: die Leuchte h\xE4ngt an deren Unterseite, genau \xFCber ihrem Platz.",furn_lamp_floor:"Stehlampe",furn_lamp_table:"Tischlampe",furn_lamp_wall:"Wandleuchte",furn_led_strip:"LED-Streifen",furn_group_lights:"Leuchten",furn_entity_light:"Licht oder Schalter",furn_color_entity:"Farbe und Helligkeit von (optional)",furn_color_entity_hint:"F\xFCr Lampen, die ein Relais (Shelly, Schaltaktor) ein- und ausschaltet, w\xE4hrend die Leuchte selbst Farbe und Helligkeit kennt: An/Aus kommt vom Schalter oben, Farbe und Helligkeit von dieser Entit\xE4t.",lamp_extra_light:"Leuchtmittel {n} (optional)",lamp_extra_hint:"Eine Leuchte mit mehreren Lichtern \u2013 Hauptlicht, Nachtlicht, Lichtring: Ist das Hauptlicht aus, leuchtet sie in 3D mit dem n\xE4chsten Licht, das an ist, etwas schw\xE4cher. Die Lichter schaltest du im Raumfenster einzeln.",furn_entity_climate:"Heizung (Thermostat)",lamp_hint:"Antippen in 3D schaltet die Leuchte, lange dr\xFCcken \xF6ffnet das Schnellmen\xFC. Auch Schalter (z. B. ein Relais f\xFCrs Deckenlicht) sind m\xF6glich \u2013 die Leuchte strahlt dann, solange er an ist. Tischlampen stehen automatisch auf dem M\xF6bel darunter.",lamp_hint_pendant:"H\xF6he = Abh\xE4ngung unter der Decke. Antippen in 3D schaltet, lange dr\xFCcken \xF6ffnet die Details.",theme:"Look",version_hint:"Installierte Version von NextFloor \u2013 Oberfl\xE4che; die Integration in Home Assistant meldet {backend}",accent:"Akzentfarbe",accent_hint:"Eigene Akzentfarbe: Linien und Leuchtkanten im Neon-Look, Kn\xF6pfe und Pins \u2013 \u21BA setzt das Neon-Cyan zur\xFCck",accent_reset:"Zur\xFCck zu Cyan",furn_colors_card:"M\xF6belfarben dieser Karte",furn_color_house:"Farbe des Hauses",theme_neon:"Neon",theme_blueprint:"Blueprint",theme_day:"Tag",theme_auto:"Auto",clock:"Uhr",clock_none:"Keine",clock_top_left:"Oben links",clock_top_right:"Oben rechts",clock_bottom_left:"Unten links",clock_bottom_right:"Unten rechts",glass_walls:"Glasw\xE4nde",glass_walls_hint:"Wie deckend die W\xE4nde sind, durch die man in die R\xE4ume schaut: links fast unsichtbar, rechts undurchsichtig. Gilt f\xFCr diesen Bildschirm.",screen_name:"Name dieses Bildschirms",screen_name_hint:"Durchsagen erscheinen auf jedem offenen NextFloor-Bildschirm. Mit einem Namen (z. B. \u201EFlur\u201C) kann eine Durchsage auch nur an diesen Bildschirm gehen. Ohne Haken bleibt dieser Bildschirm still.",announce_on:"Durchsagen auf diesem Bildschirm an",announce_muted:"Durchsagen auf diesem Bildschirm stumm",lock3d_on:"3D sperren (Drehen, Zoomen und Verschieben aus, Tippen geht weiter)",lock3d_off:"3D entsperren",walk:"Durchs Haus gehen",travel:"Zeitreise: die letzten 24 Stunden oder 7 Tage abspielen",travel_play:"Abspielen",travel_pause:"Anhalten",travel_loading:"Lade Verlauf \u2026",travel_failed:"Der Verlauf lie\xDF sich nicht laden.",travel_speed:"Tempo",travel_speed_min:"1 Min./s",travel_speed_10min:"10 Min./s",travel_speed_hour:"1 Std./s",travel_days:"Tage",travel_live:"Live",card_travel_button:"Taste f\xFCr die Zeitreise",walk_stop:"Gehen beenden",walk_hint:"Ziehen: umsehen \xB7 W A S D / Pfeile oder Stick: gehen \xB7 Mausrad: Schritt",card_walk_button:"Taste zum Durchgehen",card_lock_button:"Taste f\xFCr die 3D-Sperre",backdrop:"Eigener Hintergrund",backdrop_color:"Farbe",backdrop_image:"Bild (/local/\u2026 oder https://\u2026)",backdrop_dim:"Abdunkeln",backdrop_hint:"Statt des Himmels des Looks steht das Haus vor einer eigenen Farbe oder einem Bild. Ein Bild in /config/www ist unter /local/\u2026 erreichbar.",furnish:"Einrichten",split_3d:"3D daneben",plan_dims:"Ma\xDFe",plan_dims_hint:"Schreibt an jede Raumkante ihre L\xE4nge.",mount_height:"H\xF6he \xFCber Boden (m)",side_open:"Seitenleiste \xF6ffnen",side_close:"Schlie\xDFen",side_details:"Details zur Auswahl",side_pin:"Anheften",side_pinned:"Angeheftet",side_pin_hint:"Angeheftet bleibt die Seitenleiste immer offen; sonst klappt sie neben der 3D-Ansicht zu, solange nichts ausgew\xE4hlt ist",split_3d_hint:"Live-3D neben dem Plan: M\xF6bel und Ger\xE4te dort ziehen und drehen \u2013 mit R\xFCckg\xE4ngig, gespeichert wird mit dem Plan",size_w:"Breite (m)",size_d:"Tiefe (m)",size_h:"H\xF6he (m)",furnish_hint:"M\xF6bel, Leuchten und Ger\xE4te mit dem Finger ziehen \xB7 M\xF6bel rasten an W\xE4nden ein \xB7 antippen zum Drehen, f\xFCr H\xF6he und Montage",done:"Fertig",heatmap:"Heatmap",heat_off:"Normal",heat_short_temperature:"Temp.",heat_short_humidity:"Feuchte",heat_short_co2:"CO\u2082",heat_short_mould:"Schimmel",heat_short_power:"Strom",heat_short_comfort:"Komfort",heat_short_sun:"Sonne",heat_short_wifi:"WLAN",heat_short_values:"Werte",heat_temperature:"Temperatur",heat_humidity:"Luftfeuchtigkeit",heat_co2:"CO\u2082",heat_mould:"Schimmel",heat_power:"Stromverbrauch",heat_comfort:"Wohlf\xFChlwert",heat_sun:"Sonne heute",room_sun_hours:"{h} h Sonne heute ({facing})",open_since:"offen seit {time}",presence_now:"jemand da",presence_last:"zuletzt vor {time}",comfort_n:"Komfort {n}",empty_lights_hint:"{n} Licht an, seit {min} min niemand da.",empty_lights_off:"Licht aus",open_heating_hint:"{n} Fenster offen, w\xE4hrend die Heizung l\xE4uft.",open_heating_off:"Heizung aus",room_clean:"Reinigung (Skript oder Knopf)",room_clean_hint:"Ein Skript oder Knopf, der den Saugroboter in diesen Raum schickt (z. B. die Raumreinigung deiner Roboter-Integration). Das Raum-Panel zeigt dann \u201E\u{1F9F9} Saugen\u201C.",room_clean_run:"Saugen",room_clean_run_hint:"Schickt den Saugroboter in diesen Raum.",shade_hint:"Sonne auf {n} Fenstern bei {temp} \u2013 Rolll\xE4den senken?",shade_close:"Senken",room_sun_year:"Sonne \xFCbers Jahr",room_sun_year_hint:"Die Sonnenstunden durch die Au\xDFenfenster des Raums am 15. jedes Monats.",room_energy:"heute {today} \xB7 Monat {month}",room_energy_hint:"Aus der Statistik der Leistungssensoren der Ger\xE4te im Raum; die Kosten f\xFCr den Monat mit dem Tarif des Hauses.",heat_summer:"Sommer",heat_winter:"Winter",air_co2:"l\xFCften (CO\u2082)",air_humidity:"l\xFCften (feucht)",air_mould:"Schimmelgefahr \u2013 l\xFCften",room_curve_hint:"Die Temperatur des Raums in den letzten 24 Stunden",heat_values:"Werte am Raumnamen",heat_wifi:"WLAN",wifi_aps:"{n} Access Points \xB7 {clients} Ger\xE4te",wifi_network:"Netzwerk: {online} online \xB7 {offline} offline",wifi_none:"Stelle Access Points oder Router aus den Packs (Smart Home 2) auf und verkn\xFCpfe sie mit einer Entit\xE4t ihres Ger\xE4ts.",wifi_clients:"{n} Ger\xE4te",heat_none_found:"Keine passenden Sensoren in den Bereichen der R\xE4ume.",markers:"Symbole",markers_none:"Keine",markers_important:"Wichtige",markers_all:"Alle",furn_stool:"Hocker",furn_coffee_table:"Couchtisch",furn_tv_wall:"Fernseher (Wand)",furn_sideboard:"Sideboard",furn_table_round:"Runder Tisch",furn_bench:"Sitzbank",furn_corner_bench:"Eckbank",furn_bar_stool:"Barhocker",furn_kitchen_wall:"Oberschrank",furn_kitchen_tall:"Hochschrank mit Backofen",furn_island:"Kochinsel",furn_dishwasher:"Sp\xFClmaschine",furn_bunk_bed:"Etagenbett",furn_dresser:"Kommode",furn_washer:"Waschmaschine",furn_dryer:"Trockner",furn_office_chair:"B\xFCrostuhl",furn_tall_cabinet:"Hochschrank",furn_coat_rack:"Garderobe",furn_group_living:"Wohnen",furn_group_dining:"Essen",furn_group_kitchen:"K\xFCche",furn_group_sleeping:"Schlafen",furn_group_bath:"Bad & Hauswirtschaft",furn_group_work:"Arbeiten & Sonstiges",furn_group_energy:"Energie & Solar",energy_devices:"Ger\xE4te",wallbox_charging:"l\xE4dt",wallbox_plugged:"angesteckt",furn_soc:"Ladestand (%)",furn_export:"Einspeiseleistung (W, separater Sensor, optional)",furn_export_hint:"Meldet dein Z\xE4hler Bezug und Einspeisung in zwei Sensoren (z. B. Growatt, Tibber Pulse), nimm oben den Bezugs-Sensor als Leistung und hier den Einspeise-Sensor. Ein Sensor mit Vorzeichen braucht das nicht.",meter_parent:"H\xE4ngt an Z\xE4hler",meter_parent_none:"keinem (Hauptz\xE4hler)",meter_main:"Hauptz\xE4hler",meter_unmetered:"{w} ungemessen",meter_device_hint:"Steht das Ger\xE4t hinter einem Zwischenz\xE4hler (z. B. Balkonkraftwerk in einer Wohnung), z\xE4hlt seine Leistung zu dieser Wohnung. Der Zwischenz\xE4hler muss daf\xFCr in beide Richtungen messen (\u2212 = R\xFCckspeisung); z\xE4hlt er nur Bezug, f\xE4llt der Verbrauch der Wohnung bei \xDCberschuss zu hoch aus.",meter_sub_power:"Leistung des Zweigs (W, + = Bezug, \u2212 = R\xFCckspeisung)",meter_floors:"Versorgt die Etagen",meter_sub_hint:"Ein Zwischenz\xE4hler misst seinen Zweig, z. B. eine Wohnung. Ger\xE4te auf den angehakten Etagen h\xE4ngen in 3D an ihm statt am Hauptz\xE4hler; was der Hauptz\xE4hler dar\xFCber hinaus z\xE4hlt, steht als \u201EAllgemein (Rest)\u201C in der Bilanz.",furn_charge:"Ladeleistung (W, separater Sensor, optional)",furn_charge_hint:"Meldet dein Speicher Laden und Entladen in zwei Sensoren (z. B. Anker Solix), nimm oben den Entlade-Sensor als Leistung und hier den Lade-Sensor. Ein Sensor mit Vorzeichen braucht das nicht.",furn_wallbox_status:"Status (l\xE4dt, angesteckt)",charging_data:"Ladedaten",charging_card:"Ladestation als 3D-Kachel",charging_hint:"Verkn\xFCpfte Ladedaten erscheinen in der 3D-Kachel und im Raummen\xFC, auch ohne Leistungswert. Nicht verkn\xFCpfte Zeilen bleiben ausgeblendet. Zeitprofile und Integer-Aliase werden aus Symcon \xFCbernommen. Ohne Zeitprofil erkennt Automatisch Unix-Zeitstempel; numerische Ladezeiten ohne Einheit gelten als Sekunden. Die Formatwahl kann dies \xE4ndern. Die Werte dienen ausschlie\xDFlich der Anzeige.",charging_start:"Startzeit",charging_end:"Endzeit",charging_duration:"Ladezeit",charging_energy:"Geladene Energie",charging_lock:"Verriegelungsstatus",charging_time_format:"Zeitformat",charging_duration_unit:"Ladezeit-Einheit",charging_auto:"Automatisch",charging_value:"Symcon-Wert unver\xE4ndert",charging_seconds:"Sekunden",charging_minutes:"Minuten",charging_hours:"Stunden",charging_unix_seconds:"Unix-Zeit (Sekunden)",charging_unix_ms:"Unix-Zeit (Millisekunden)",energy_only_note:"\u26A1 Energie: Hier lassen sich nur Solarfelder und Energieger\xE4te verschieben, R\xE4ume und M\xF6bel sind gesperrt.",roof_only_note:"\u{1F3E0} Dach: Hier lassen sich nur Dachfl\xE4chen und Dachfenster verschieben, R\xE4ume und M\xF6bel sind gesperrt.",energy_devices_hint:"Stromz\xE4hler, Wechselrichter, Stromspeicher, Wallbox und Netzanschluss werden hier angelegt: auf der oben gew\xE4hlten Etage, im Grundriss verschiebbar. Mit Leistungssensor zeigen sie ihre Watt; der Z\xE4hler bekommt den Netzsensor, beim Strang w\xE4hlst du den Wechselrichter. Mehrere Wechselrichter und Speicher (etwa eine Balkonanlage dazu) gehen auch: Jeder bekommt seinen eigenen Sensor.",energy_routes:"Kabelwege",energy_routes_hint:"Wo ein Kabel wirklich l\xE4uft: Der Fluss folgt dann deinen Punkten statt eines Bogens quer durchs Haus. Ohne Weg bleibt es beim Bogen. Verbraucher behalten ihren Bogen.",route_conn_solar:"{name} \u2192 Wechselrichter",route_conn_battery:"Batterie \u2194 Haus",route_conn_inverter:"Wechselrichter \u2192 Haus",route_conn_grid:"Netz \u2194 Haus",route_conn_meter:"{name} \u2194 \xFCbergeordneter Z\xE4hler",route_conn_device:"{name} \u2194 Unterz\xE4hler",route_points:"{n} Punkte",route_none:"direkter Bogen",route_draw:"Weg zeichnen",route_redraw:"Neu zeichnen",route_drawing:"Tippe im Plan die Punkte an, durch die das Kabel l\xE4uft, vom einen Ende zum anderen; wechsle dazwischen das Geschoss, wo es durch die Decke geht. {n} Punkte.",route_undo:"Letzter Punkt",route_done:"Fertig",route_cable:"Als Kabel zeigen",route_cable_hint:"Zeichnet den Weg als sichtbares Kabel, nicht nur als feine Linie unter den Teilchen.",solar_fields:"Solarfelder",solar_hint:"Module aufs Dach legen: Sie liegen in der Neigung der Dachfl\xE4che, auf einem Flachdach stehen sie aufgest\xE4ndert. Im Grundriss l\xE4sst sich ein Feld mit der Maus verschieben.",solar_no_roof:"F\xFCr Solarfelder braucht das Haus ein Dach: unter Einstellungen ein Sattel- oder Flachdach, oder Dachabschnitte hier im Dach-Werkzeug.",solar_face_gone:"Dachfl\xE4che fehlt",solar_summary:"{n} Module \xB7 {kwp} kWp",solar_add:"Solarfeld",solar_field:"Solarfeld",solar_face:"Dachfl\xE4che",solar_rows:"Reihen",solar_cols:"Module pro Reihe",solar_portrait:"Hochformat",solar_landscape:"Querformat",solar_u:"Abstand vom Rand (m)",solar_v:"Abstand von der Traufe (m)",solar_tilt:"Neigung der Aufst\xE4nderung (\xB0)",solar_rack_ew:"Ost-West-Aufst\xE4nderung",solar_rack_ew_hint:"Jede zweite Reihe zeigt in die andere Richtung, die Paare stehen R\xFCcken an R\xFCcken \u2013 flach und dicht wie auf vielen Flachd\xE4chern.",solar_rack_tilt:"Aufst\xE4nderung (\xB0 zus\xE4tzlich)",solar_flip:"In die andere Richtung neigen",solar_partial:"nur {n} von {total} passen auf die Fl\xE4che",solar_form_hint:"Module, die \xFCber die Dachfl\xE4che hinausragen w\xFCrden, fallen weg. \u201EFl\xE4che f\xFCllen\u201C legt so viele Module aufs Dach, wie passen. kWp gerechnet mit 400 W je Modul.",solar_fit:"Fl\xE4che f\xFCllen",roof_windows:"Dachfenster",roof_window:"Dachfenster",chimneys:"Schornsteine",chimney:"Schornstein",chimney_shape:"Form",chimney_brick:"Gemauert",chimney_round:"Rund",chimney_wide:"Breit, zwei Z\xFCge",chimney_steel:"Edelstahlrohr",chimney_diameter:"Durchmesser (m)",chimney_depth:"Tiefe (m)",chimney_height:"H\xF6he \xFCber dem Dach (m)",chimney_hint:"Die H\xF6he z\xE4hlt ab der oberen Seite, wo der Schornstein aus dem Dach kommt. Im Grundriss und in der 3D-Ansicht l\xE4sst er sich verschieben, auch auf eine andere Dachfl\xE4che.",roof_windows_hint:"Dachfenster liegen in der Dachfl\xE4che, mit Rollladen und Kontakt wie normale Fenster. Im Grundriss lassen sie sich verschieben, auch auf eine andere Dachfl\xE4che.",roof_window_tilt:"Kippkontakt",roof_window_name:"Name (optional)",roof_window_motor:"Fenstermotor (Cover, optional)",roof_window_motor_hint:"Ein Fenstermotor (Velux, Roto, Fakro) meldet seine Position als Cover: Der Fl\xFCgel \xF6ffnet in 3D so weit, wie der Motor steht. Ein Kontakt oder Kippkontakt geht weiterhin ohne Motor.",roof_window_hint:"Offen klappt der Fl\xFCgel oben angeschlagen nach au\xDFen, gekippt ein St\xFCck, und der Rahmen leuchtet warm; der Rollladen f\xE4hrt von oben \xFCber die Scheibe. In einer Dachfl\xE4che schneidet das Fenster ein Loch in die Schr\xE4ge, so sieht das Dachgeschoss hinaus.",solar_ground:"Frei aufgest\xE4ndert (Garten, Garagendach \u2026)",solar_add_ground:"Frei aufgest\xE4ndert",solar_base:"H\xF6he der Aufstellfl\xE4che (m, 0 = Boden)",solar_add_wall:"An der Wand",solar_wall:"Wand",solar_v_wall:"H\xF6he \xFCber dem Boden (m)",solar_tilt_wall:"Neigung von der Wand (\xB0, 90 = Vordach)",solar_flip_wall:"Unten abstehend statt oben",solar_rotation:"Drehung (\xB0)",solar_name:"Name",solar_name_hint:"z. B. Strang 1 S\xFCd",solar_module_w:"Modulbreite (m)",solar_module_h:"Modulh\xF6he (m)",solar_wp:"Modulleistung (Wp)",solar_string:"Strang",solar_strings:"Str\xE4nge",solar_string_none:"Kein Strang",solar_string_new:"Neuer Strang",solar_string_n:"Strang {n}",solar_string_name:"Name des Strangs",solar_string_entity:"PV-Leistung des Strangs",solar_string_inverter:"Wechselrichter",solar_string_inverter_none:"Kein Wechselrichter gew\xE4hlt",inverter_strings:"Str\xE4nge an diesem Wechselrichter: {names}",inverter_strings_none:"Noch kein Strang an diesem Wechselrichter \u2013 zuordnen beim Solarfeld unter Strang \u203A Wechselrichter.",solar_string_inverter_missing:"Noch kein Wechselrichter im Plan (unten bei Ger\xE4te anlegen)",solar_string_hint:"Felder im selben Strang geh\xF6ren zusammen, auch auf verschiedenen D\xE4chern (z. B. 5 Module auf dem Haus und 5 auf der Garage). Sensor und Wechselrichter gelten f\xFCr den ganzen Strang.",solar_string_sum:"{fields} Felder \xB7 {n} Module \xB7 {kwp} kWp",solar_face_size:"Dachfl\xE4che {w} \xD7 {h} m (entlang der Traufe \xD7 die Schr\xE4ge hoch)",solar_cols_hint:"Eine Zahl f\xFCr gleich lange Reihen, oder eine Liste f\xFCr Reihen eigener L\xE4nge: \u201E4, 4, 3\u201C (von der Traufe aus).",solar_align_left:"Links",solar_align_center:"Mitte",solar_align_right:"Rechts",solar_look_black:"Full Black",solar_look_blue:"Blau",solar_pick:"Module einzeln an/aus",solar_pick_all:"Alle wieder an",solar_pick_hint:"Tippe im Grundriss auf ein Modul, um es wegzunehmen oder wieder dazuzunehmen. Weggenommene sind gestrichelt.",solar_entity:"PV-Leistung dieses Feldes (z. B. sein Strang)",solar_main:"Hauptdach",solar_section:"Abschnitt {n}",solar_flat:"Flachdach",compass_n:"Nord",compass_ne:"Nordost",compass_e:"Ost",compass_se:"S\xFCdost",compass_s:"S\xFCd",compass_sw:"S\xFCdwest",compass_w:"West",compass_nw:"Nordwest",furn_meter:"Stromz\xE4hler",furn_grid_point:"Netzanschluss",grid_point_hint:"Hier steht der Netzanschluss: der \xDCbergabepunkt zum Stromanbieter, zum Beispiel am Ende der Einfahrt. Im Grundriss verschiebbar.",furn_model:"Modell",inverter_std:"Standard (Wandger\xE4t mit Display)",inverter_slim:"Schmal und hoch (Lichtleiste)",inverter_hybrid:"Hybrid (Rund-Display, L\xFCfter)",battery_std:"Turm (gestapelte Module)",battery_wall:"Wandspeicher (flach, h\xE4ngend)",battery_cube:"Kompakt (Balkonspeicher)",furn_inverter:"Wechselrichter",furn_home_battery:"Stromspeicher",furn_wallbox:"Wallbox",furn_heating_manifold:"Heiz-/K\xFChlkreisverteiler",furn_buffer_tank:"Pufferspeicher",furn_freshwater_station:"Frischwasserstation",furn_entity:"Ger\xE4t (Schalter, Steckdose \u2026)",furn_state_entity:"Zustand von (optional)",furn_state_entity2:"Zweiter Zustand (andere H\xE4lfte)",furn_tap:"Antippen des M\xF6bels",furn_tap_default:"Wie \xFCblich",furn_tap_hint:"Eine eigene Aktion wie bei den eigenen Kn\xF6pfen des Sternmen\xFCs, z. B. ein browser_mod-Popup mit deiner Karte.",furn_show_when:"Nur zeigen, solange \u2026",furn_show_when_state:"\u2026 im Zustand (leer = an)",furn_show_when_invert:"Umgekehrt: zeigen, solange es nicht so ist",furn_show_when_hint:"Saison-Deko, die nur im Dezember steht: ein Helfer (input_boolean), ein Kalender oder ein Sensor entscheidet, ob das M\xF6bel in 3D erscheint. Mehrere Zust\xE4nde mit Komma trennen. Im Editor bleibt es immer sichtbar.",picture_upload:"Foto hochladen",picture_replace:"Anderes Foto hochladen",picture_stored:"Ein eigenes Foto ist gespeichert.",picture_url:"\u2026 oder Bild-Adresse",picture_entity:"\u2026 oder Bild einer Entit\xE4t",picture_border:"Passepartout (%)",picture_fit:"Foto",picture_fit_cover:"f\xFCllt den Rahmen",picture_fit_contain:"ganz zu sehen",picture_hint:"Dein Foto im Rahmen, in 3D und auf dem Wandtablet. Hochgeladene Fotos werden verkleinert mit dem Plan gespeichert; eine Bild-Entit\xE4t (z. B. Foto des Tages) oder eine Kamera zeigt ihr aktuelles Bild.",furn_state_split:"H\xE4lften",furn_state_left_right:"Links / rechts",furn_state_top_bottom:"Unten / oben (Hochbett)",furn_state_hint:"Das M\xF6bel leuchtet, solange die Entit\xE4t an, belegt oder zu Hause meldet \u2013 ein Bett mit Belegungsmatte, ein Sessel, die Sauna. Zwei Entit\xE4ten beleuchten die H\xE4lften: links und rechts, beim Hochbett unten und oben.",furn_entity_tv:"Fernseher (Media-Player oder Steckdose)",fix:"Fixieren",unfix:"L\xF6sen",fix_hint:"Fixiert: l\xE4sst sich nicht mehr versehentlich verschieben (Taste L, Rechtsklick oder langes Dr\xFCcken)",fixed_drag_hint:"\u{1F512} Fixiert \u2013 zum Verschieben erst l\xF6sen (Schloss im Formular, Rechtsklick oder Taste L)",fixed_delete_confirm:"Dieses Element ist fixiert. Trotzdem l\xF6schen?",lock_plan:"\u{1F512} Grundriss",lock_plan_hint:"Grundriss sperren: R\xE4ume, W\xE4nde, T\xFCren, Fenster und Au\xDFenfl\xE4chen lassen sich nicht mehr versehentlich verschieben. M\xF6bel und Ger\xE4te bleiben frei.",start_view:"Startansicht",start_view_hint:"Mit dieser Ansicht \xF6ffnen 3D-Ansicht, Karte und Kiosk das Haus, zum Beispiel von der Gartenseite. Drehe, zoome und verschiebe das Haus in der 3D-Ansicht rechts, bis es passt, und merke sie dir dann.",start_view_card:"Soll eine Karte eine andere Ansicht haben: diese Zeile in ihre YAML-Konfiguration \xFCbernehmen.",start_view_set:"Aktuelle 3D-Ansicht als Start merken",start_view_reset:"Standard",start_view_saved:"Eine eigene Startansicht ist gespeichert.",ctx_rotate:"Drehen 90\xB0",devices_placed_in:"in {room}",devices_narrow:"{n} weitere \u2013 Suche eingrenzen",climate:"Raumklima",climate_temperature:"Temperatur",climate_humidity:"Luftfeuchte",climate_co2:"CO\u2082",climate_hint:"Diese Sensoren gelten f\xFCr die Heatmap und das Raumfenster. \u201EAutomatisch\u201C nimmt die Sensoren des Bereichs und die im Raum platzierten, aber keine Ger\xE4tetemperaturen (3D-Drucker, W\xE4rmepumpe, Vorlauf \u2026).",climate_more:"\u2026 und noch ein Sensor (Mittelwert)",plan_locked:"Grundriss gesperrt",plan_lock:"Grundriss sperren",plan_unlock:"Grundriss entsperren",opening_mark:"Markieren in 3D",opening_mark_open:"Wenn offen",opening_mark_closed:"Wenn geschlossen (z. B. WC)",opening_mark_hint:"Ein markiertes Fenster oder eine markierte T\xFCr leuchtet warm. \u201EWenn geschlossen\u201C braucht einen Kontakt; ohne Sensor wird nichts markiert.",window_opens:"\xD6ffnet",window_opens_turn:"Dreh-Kipp (nach innen)",window_opens_slide:"Schiebend (Schiebefenster, Hebe-Schiebet\xFCr)",window_opens_top:"Klappfenster (unten nach au\xDFen)",window_opens_hint:"Schiebend: Der Fl\xFCgel auf der Seite des Scharniers gleitet vor den festen; zweifl\xFCgelig gleiten die beiden mittleren nach au\xDFen. Klappfenster \xF6ffnen mit dem Kontakt oder einem Kippsensor.",marker_show:"Symbol in 3D",marker_show_hint:"Automatisch folgt dem Schalter Keine / Wichtige / Alle in der 3D-Ansicht. Immer zeigen und Ausblenden gelten unabh\xE4ngig davon (au\xDFer bei Keine).",pin_shift:"Pin verschieben",pin_shift_up:"\u2191 H\xF6he",pin_shift_hint:"Stehen Ger\xE4te dicht beieinander, schiebst du den Pin hier ein St\xFCck zur Seite oder nach oben (in Metern); das Ger\xE4t selbst bleibt, wo es ist.",marker_show_auto:"Automatisch",marker_show_always:"Immer zeigen",marker_show_no_power:"Ohne Watt",marker_show_active:"Nur wenn aktiv",marker_show_never:"Ausblenden",marker_icon:"Eigenes Symbol (Material-Design-Icon)",device_name:"Eigener Name (optional)",show_name:"Name unter dem Symbol in 3D zeigen",card_marker_names:"Eigene Namen an den Symbolen",card_marker_names_hint:"Jedes Ger\xE4t mit eigenem Namen zeigt ihn klein unter seinem Symbol \u2013 drei Thermometer im Garten bleiben unterscheidbar.",card_tap_in_room:"Ger\xE4te nur im ge\xF6ffneten Raum schalten",card_tap_in_room_hint:"In der Haus- und Stockwerksansicht \xF6ffnet ein Antippen das Stockwerk oder den Raum, auch auf einem Ger\xE4t oder seinem Symbol. Im ge\xF6ffneten Raum schaltet es das Ger\xE4t. Langes Dr\xFCcken \xF6ffnet immer sein Men\xFC oder seine Details.",card_markers_outside:"Symbole au\xDFerhalb des ge\xF6ffneten Raums w\xE4hlen",card_markers_outside_hint:"Im Haus, auf dem Stockwerk und in den anderen R\xE4umen nur die angehakten Arten; im ge\xF6ffneten Raum alle wie oben eingestellt. \u201EImmer\u201C und \u201ENie\u201C am Ger\xE4t gehen vor.",marker_kind_light:"Lichter",marker_kind_cover:"Rolll\xE4den",marker_kind_climate:"Heizung",marker_kind_media:"Medien",marker_kind_switch:"Schalter",marker_kind_fan:"Ventilatoren",marker_kind_lock:"Schl\xF6sser",marker_kind_binary:"Kontakte und Melder",marker_kind_sensor:"Sensoren",marker_kind_tap:"M\xF6bel mit Aktion",marker_kind_other:"Sonstige",device_name_hint:"Ein Name f\xFCr den Plan und das Raumfenster, z. B. \u201EDekolicht Kochinsel\u201C \u2013 die Entit\xE4t in Home Assistant bleibt, wie sie ist.",device_simple:"Im Raumfenster nur schalten",device_simple_hint:"Der Raumdialog zeigt f\xFCr diese Lampe nur den Schalter, ohne Helligkeit, Farbtemperatur und Farben.",floor_turn:"90\xB0 drehen",floor_shift_all:"Alle Etagen mitnehmen (ganzes Haus)",floor_shift_all_hint:"Verschieben und Drehen wirken auf alle Etagen samt Dachfl\xE4chen, Au\xDFenfl\xE4chen, Energieger\xE4ten und Z\xE4hler \u2013 das ganze Haus wandert als Ganzes.",floor_turn_hint:"Dreht alles auf der Etage um 90\xB0 im Uhrzeigersinn um die Mitte der R\xE4ume \u2013 wenn eine Etage verdreht gezeichnet wurde. Dreimal = 270\xB0.",marker_icon_hint:"Name eines Material-Design-Icons wie bei Home Assistant, z. B. mdi:thermometer oder mdi:water-alert. Leer = Symbol nach Ger\xE4teart.",furn_power:"Leistungssensor (W)",furn_links_hint:"Mit Leistungssensor zeigt das M\xF6bel seine Watt und nimmt am Energiefluss teil.",furn_links_hint_tv:"Der Bildschirm leuchtet, solange der Fernseher an ist, in der Farbe der App (Netflix, YouTube \u2026); das Schild zeigt App oder Titel.",stairs_hint:"Die Treppe steigt nach hinten an (weg von der markierten Vorderkante) und \xF6ffnet die Decke der Etage dar\xFCber.",stair_shape:"Form",stair_shape_straight:"Gerade",stair_shape_quarter:"Viertelgewendelt",stair_shape_l:"L mit Podest",stair_shape_half:"Halbgewendelt",stair_shape_u:"U mit Podest",stair_shape_spiral:"Wendeltreppe",stair_turn:"Laufrichtung (beim Hinaufgehen)",stair_turn_left:"Links herum",stair_turn_right:"Rechts herum",stair_build:"Bauart",stair_build_solid:"Massiv (Beton)",stair_build_stringer:"Wangentreppe",stair_build_mono:"Holmtreppe (Mittelholm)",stair_build_cantilever:"Kragarm (schwebend)",stair_risers:"Setzstufen",stair_steps:"Steigungen",stair_run_width:"Laufbreite (m)",stair_landing_after:"Stufen bis zum Podest",stair_landing_hint:"Das Podest liegt {h} cm \xFCber dem Boden; der Rest der Stufen kommt danach.",stair_rail:"Gel\xE4nder",stair_rail_none:"Keins",stair_rail_left:"Links",stair_rail_right:"Rechts",stair_rail_both:"Beidseitig",stair_down:"F\xFChrt nach unten",stair_down_hint:"Die Treppe beginnt auf dieser Etage und f\xFChrt hinunter, zum Beispiel in einen Keller, der nicht gezeichnet sein muss. Sie \xF6ffnet den Boden dieser Etage.",stair_measures:"{steps} Steigungen \xE0 {rise} cm \xB7 Auftritt {going} cm \xB7 Schrittma\xDF {measure} cm",stair_uncomfortable:"unbequem (Schrittma\xDF 59\u201365 cm, Steigung h\xF6chstens 21 cm)",stair_up_note:"Die Treppe beginnt an der markierten Vorderkante. Die Decke der Etage dar\xFCber \xF6ffnet sich nur dort, wo \xFCber den Stufen keine 2,2 m Kopfh\xF6he bleiben.",stair_down_note:"Man betritt die Treppe an der markierten Vorderkante und geht hinunter. Im Plan ist sie gestrichelt; der Boden dieser Etage \xF6ffnet sich \xFCber den Stufen.",stair_opening:"Decken\xF6ffnung",stair_opening_headroom:"Nach Kopfh\xF6he (nur wo n\xF6tig)",stair_opening_full:"\xDCber der ganzen Treppe",stair_opening_none:"Keine (Luke, geschlossener Schacht)",stair_opening_hint:"Wie weit die Treppe den Boden \xF6ffnet, den sie erreicht: die Etage dar\xFCber, oder bei einer Treppe nach unten die eigene. Nach Kopfh\xF6he \xF6ffnet nur \xFCber den Stufen, \xFCber denen keine 2,2 m bleiben.",stair_up_note_plain:"Die Treppe beginnt an der markierten Vorderkante und steigt nach hinten an.",stair_upgrade:"Form einstellen",stair_upgrade_hint:"Macht daraus eine Treppe mit Form (gewendelt, L, U, Wendel), Bauart, Gel\xE4nder und Stufenzahl.",floor_lights:"{n} Licht an",floor_open:"{n} offen",floor_persons:"{n} Pers.",energy_consumption:"Verbrauch",energy_grid_import:"Netzbezug",energy_grid_export:"Einspeisung",energy_solar:"Solar",energy_battery:"Akku",energy_tariff:"Tarif",energy:"Energie",energy_meter:"Z\xE4hlerplatz",energy_grid:"Netz (W, + = Bezug)",energy_solar_sensor:"Solar-Erzeugung (W)",energy_battery_sensor:"Akku-Leistung (W, + = Entladen)",energy_battery_soc:"Akku-Ladestand (%)",energy_tariff_sensor:"Tarif (z. B. \u20AC/kWh)",energy_gas:"Gasz\xE4hler (optional)",energy_water:"Wasserz\xE4hler (optional)",energy_meters_hint:"Gas und Wasser stehen bei der Hausbilanz \u2013 in der Energieleiste und auf der Hauskarte: ein Sensor mit dem Durchfluss jetzt (m\xB3/h, l/min) oder dem Z\xE4hlerstand von heute.",energy_gas_short:"Gas",energy_water_short:"Wasser",energy_invert:"Vorzeichen umkehren",energy_hint:"Verbraucher sind platzierte Ger\xE4te mit Leistungssensor (W) \u2013 der Sensor selbst oder einer vom selben Ger\xE4t.",energy_balance:"Energiebilanz",energy_balance_hint:"Netz, Solar und Akku kommen von den Ger\xE4ten im Plan: Stromz\xE4hler, Wechselrichter und Stromspeicher. Hier kannst du andere Sensoren w\xE4hlen, Vorzeichen umkehren und den Hausverbrauch angeben.",energy_rest:"Allgemein (Rest)",energy_advanced:"Erweiterter Energiemodus",energy_advanced_on:"Zwischenz\xE4hler nutzen",energy_show_unmetered:"Ungemessenen Verbrauch am Zwischenz\xE4hler zeigen",energy_show_unmetered_hint:"Das Schild eines Zwischenz\xE4hlers zeigt dann den Verbrauch seiner Etagen und wie viel davon kein platziertes Ger\xE4t misst, z. B. \u201E500 W \xB7 450 W ungemessen\u201C. Sonst zeigt es den Z\xE4hlerwert.",energy_advanced_hint:"F\xFCr Zwischenz\xE4hler, z. B. je Wohnung hinter einem Hauptz\xE4hler: Ein Stromz\xE4hler kann dann an einem anderen h\xE4ngen und eigene Etagen versorgen. Aus = der erste Z\xE4hler ist der Netzanschluss, weitere sind Verbraucher.",energy_consumption_sensor:"Hausverbrauch (W, sonst aus der Bilanz)",energy_import_prefs:"Aus dem Energie-Dashboard \xFCbernehmen",energy_import_done:"{n} Sensoren \xFCbernommen \u2013 bitte die Vorzeichen pr\xFCfen.",energy_import_none:"Im Energie-Dashboard sind keine passenden Leistungssensoren (W) zu finden \u2013 bitte von Hand w\xE4hlen.",energy_import_failed:"Das Energie-Dashboard von Home Assistant ist nicht eingerichtet.",tool_meter:"Z\xE4hler",hint_meter:"Auf die Stelle des Z\xE4hlers tippen",presence:"Anwesenheit",ble:"Bluetooth-Ortung",ble_hint:"Orte einen Bluetooth-Tag (Schl\xFCsselanh\xE4nger, Uhr, Handy) raumgenau: Du l\xE4ufst mit ihm durch die R\xE4ume und nimmst jeden Raum auf. NextFloor vergleicht danach, wie stark ihn die Bluetooth-Scanner von Home Assistant (ESPHome-Proxys, Shelly-Ger\xE4te mit eingeschaltetem Bluetooth, Adapter am Server) h\xF6ren. Je Tag entsteht ein Sensor mit dem Raumnamen als Zustand.",ble_unavailable:"Die Bluetooth-Integration von Home Assistant l\xE4uft nicht. Ohne sie gibt es keine Scanner.",ble_scanners:"{n} Bluetooth-Scanner in Home Assistant. Je mehr Scanner in verschiedenen R\xE4umen, desto genauer.",ble_add:"Tag oder Ger\xE4t hinzuf\xFCgen",ble_trackers:"Handys und Uhren (Private BLE Device)",ble_devices:"Gefundene Bluetooth-Ger\xE4te",ble_name:"Name (optional)",ble_refresh:"Liste neu laden",ble_add_button:"Hinzuf\xFCgen",ble_learn:"R\xE4ume lernen",ble_close:"Schlie\xDFen",ble_spots:"{n} Aufnahmen",ble_now:"Jetzt",ble_unknown:"unbekannt",ble_none_heard:"Kein Scanner h\xF6rt den Tag gerade. Halte ihn nah an einen Scanner und warte kurz; ein Tag sendet nur alle paar Sekunden.",ble_no_address:"Dieses Handy oder diese Uhr hat gerade keine bekannte Adresse. Pr\xFCfe in Home Assistant die Integration \u201EPrivate BLE Device\u201C.",ble_one_scanner:"Nur ein Scanner h\xF6rt den Tag. Zum Unterscheiden von R\xE4umen braucht es mindestens zwei, besser drei oder mehr.",ble_learn_room:"Raum aufnehmen",ble_record:"Aufnehmen ({s} s)",ble_recording:"Nimmt auf \u2026 noch {s} s",ble_forget_room:"Raum vergessen",ble_learn_hint:"W\xE4hle den Raum, dr\xFCcke Aufnehmen und geh mit dem Tag in der Hand langsam durch den ganzen Raum, auch in die Ecken. Aufnehmen erneut ersetzt den Raum. Lerne alle R\xE4ume, in denen du den Tag orten willst.",ble_sensor_hint:"Der Sensor \u201E{name}\u201C (Ger\xE4t NextFloor) zeigt den Raum. Unter Anwesenheit kannst du ihn als Raum-Sensor einer Person w\xE4hlen.",presence_hint:"Raumsensor je Person (z. B. ESPresense, Bermuda): sein Zustand nennt den Raum oder Bereich.",presence_sensor:"Raumsensor",presence_room:"Standardraum",presence_room_none:"\u2013 keiner \u2013",presence_add:"Weitere Entit\xE4t (Hilfsschalter, Tracker)",no_persons:"In Home Assistant gibt es keine Personen."},jh={view:"3D",editor:"Editor",all_floors:"All floors",outside_area:"Outside",outside_area_hint:"All devices outside at a glance: in the garden, outside the rooms, and what belongs to Outside (a weather station on the roof, say).",device_outside:"Belongs to Outside",device_outside_hint:"The device does not count for the room under it (a weather station on the roof) and is listed in the Outside panel.",no_building:"No floor plan yet.",no_building_admin:"No floor plan yet. Draw your first floor in the editor.",no_rooms_admin:"The floors exist, but there is no room yet. Walls alone are not enough: draw at least one room in the editor with \u201CRectangle\u201D or \u201CFree form\u201D.",open_editor:"Open editor",loading:"Loading \u2026",load_error:"Loading failed",saving:"Saving \u2026",saved:"Saved",save_error:"Saving failed",save_failed_detail:"Saving failed: {error}. Your changes are kept in this browser.",needs_restart:"A new version of NextFloor ({frontend}) is installed, but Home Assistant still runs {version}. Please restart Home Assistant \u2013 until then saving may fail.",needs_reload:"This page still shows NextFloor {frontend}, Home Assistant already has {backend}. Please reload the page; in the companion app: Settings \u2192 Companion app \u2192 Reset frontend cache.",reload_page:"Reload",symcon_variables_reload:"Reload variables",symcon_cover_position:"Blind position",climate_card:"Room climate as a floating card",climate_card_hint:"Shows temperature, humidity and CO\u2082 over this room. Toggle them with \u201CCards\u201D in the 3D view.",climate_card_missing:"No current readings",furniture_power_card:"Power as a floating 3D card",furniture_power_card_hint:"Shows the power reading above this furniture, even without a linked switch. The card remains visible at 0 W. Logged variables offer a trend button. Use the Cards switch to show or hide floating cards together.",climate_illuminance:"Illuminance",device_values:"Additional values",device_value:"Data point",device_value_add:"Add value",device_value_remove:"Remove value",device_value_icon:"Symbol",device_value_label:"Label (optional)",device_values_hint:"Use + to select additional data points, such as several temperatures or other readings. Symbols can be emoji or short characters such as \u{1F321}, \u{1F4A7}, \u2601 or \u26A1. Values appear on the device and in the room panel.",cover_tilt_entity:"Slat position",cover_direction_invert:"Reverse blind in 3D",cover_tilt_direction_invert:"Reverse slats in 3D",cover2_direction_invert:"Reverse second blind in 3D",cover2_tilt_direction_invert:"Reverse second blind slats in 3D",cover_direction_hint:"Reversal affects only the 3D appearance. Numeric values, sliders and control commands stay unchanged: a received value of 0 is still displayed as 0, and a chosen value of 0 is sent as 0.",cover2_tilt_entity:"Slat position (second blind)",symcon_variables_loading:"Loading variables \u2026",symcon_variables_loaded:"Variables and object tree reloaded.",symcon_variables_error:"Could not reload variables: {error}",needs_restart_old:"A new version of NextFloor is installed, but Home Assistant still runs an older one. Please restart Home Assistant \u2013 until then saving fails.",draft_found:"Unsaved changes from {time} found.",draft_restore:"Restore and save",draft_discard:"Discard",walls_auto:"Tall walls",walls_cut:"Cut",walls_slope:"Sloped",walls_slope_hint:"Walls cut on a slope: half height in front, full height at the back \u2013 like a doll's house, turns with the camera",walls_solid:"Solid",walls_solid_hint:"Solid walls in their colours instead of glass (colours: editor \u2192 settings, per room in the room)",wall_paint_outside:"Wall colour outside",wall_paint_inside:"Wall colour inside",furn_color_body:"Furniture colour body",furn_color_wood:"Furniture colour wood",furn_color_fabric:"Furniture colour fabric",furn_color_white:"Furniture colour white",furn_color_metal:"Furniture colour metal",furn_color_dark:"Furniture colour dark",furn_color_hint:"Furniture is built from a few materials, the pieces from the furniture builder and the packs too. Here each material gets a colour for the whole house; a card can set its own. They show most in the Neon look; Day and Blueprint only tint with them.",wall_paint_room:"Wall colour inside (this room)",wall_paint_floor:"Wall colour outside (this floor)",wall_paint_hint:"Used in the 3D view \u201CSolid\u201D.",wall_paint_default:"Default",card_solid_walls:"Solid walls (in their colours)",reset_view:"Overview",back:"Back",floor:"Floor",floors:"Floors",add_floor:"Add floor",floor_from_ha:"Floors from Home Assistant:",floor_empty:"Empty floor",level:"Level {n}",ha_floor:"Floor in Home Assistant",floor_layer:"Layer (can be shown and hidden)",floor_power:"Floor meter (power)",floor_power_hint:"A power sensor for this floor alone (a sub-meter, a flat). Its value shows on the floor label and, in this floor's view, on the house card with its share of the house's use.",floor_power_share:"{n} % of the house",living_area:"Living area {living}",room_living:"Counts as living area",living_area_none:"No living area \xB7 floor {floor}",living_area_low:"Living area {living} (floor {floor}, of which {low} below 2 m)",living_area_hint:"Counted like the German Wohnfl\xE4chenverordnung: the floor inside the walls, in full from 2 m clear height, half between 1 and 2 m (under slopes), not at all below 1 m. A guide value, not a survey.",living_area_floor:"Living area: {floor}",living_area_floor_house:"Living area of this floor: {floor} \xB7 whole house: {house}",print_plan:"Print plan / PDF",print_plan_hint:"Every floor as a clean plan with measurements and areas, and a table of the areas \u2013 to print, or save as PDF from the print dialog.",print_title:"Floor plan",print_room:"Room",print_floor_area:"Floor area",print_living:"Living area",print_low:"below 2 m",print_total:"Total",print_blocked:"The print window was blocked \u2013 please allow pop-ups for Home Assistant.",check_open:"Check the plan",note:"Note",note_add:"Note here",note_text:"Text",note_placeholder:'e.g. "change the filter" or "fuse 12"',note_due:"Due on",note_height:"Height above the floor (m)",note_height_hint:"Where the pin floats in the 3D view: 1.3 m is eye level, higher for something under the ceiling (a shutoff valve, a hatch).",note_photo_upload:"Add a photo",note_photo_hint:"The photo shows when the note is tapped in the 3D view, e.g. what the valve looks like.",note_due_hint:"From that day on the pin turns orange.",note_is_due:"This note is due.",keys_title:"Editor keys",keys_undo:"Undo",keys_redo:"Redo",keys_duplicate:"Duplicate the room",keys_delete:"Delete the selection",keys_nudge:"Move the selection one grid step",keys_nudge_10:"\u2026 by 10 cm",keys_nudge_1:"\u2026 by 1 cm",keys_rotate:"Turn furniture by 90\xB0 (Shift: back)",keys_lock:"Fix or free furniture, a device or a roof section",keys_close_shape:"Close the free shape",keys_escape:"Cancel, leave the tool, clear the selection",keys_straight:"While drawing: straight lines",keys_sheet:"This sheet",tour_title:"First steps",tour_1_title:"Draw the rooms",tour_1:'Draw the rooms with "{rect}" or "{free}"; the walls come by themselves. Give each room its Home Assistant area \u2013 then NextFloor finds its devices. With areas already set up, "{rooms}" in the floor form adds them all at once.',tour_2_title:"Doors and windows",tour_2:'"{opening}" puts them on a wall. Link their contact or blind \u2013 in 3D they then open and close with it, and open windows tell you.',tour_3_title:"Furniture and devices",tour_3:'"{furniture}" opens the library \u2013 or build your own pieces in the \u{1F6E0}\uFE0F furniture studio. Select a room and the devices of its area are listed below, ready to place; lamps then shine in the colour of their light.',tour_4_title:"Look and check",tour_4:'"{split}" shows your house while you draw; at the top you switch to the 3D view. "{check}" lists what is still missing \u2013 and ? shows the keys at any time.',tour_next:"Next",tour_back:"Back",tour_done:"Let's go",tour_skip:"Skip",check_open_hint:"Lists what is missing or off in the plan, with a fix in one tap.",check_title:"Plan check",check_all_good:"All good \u2013 nothing found.",check_hint:"{n} points found. Blue buttons change the plan (undo works as always), the others show the place.",check_room_no_area:'"{room}" has no Home Assistant area: its devices are not found.',check_room_no_area_named:'"{room}" has no area \u2013 the free area "{area}" has the same name.',check_areas_unplaced:"{n} areas of this floor have no room yet: {names}",check_devices_unplaced:'"{room}": {n} devices of the area are not in the plan yet.',check_rooms_overlap:'"{a}" and "{b}" overlap.',check_opening_off_wall:'A door or window in "{room}" is not on a wall.',check_entity_missing:"{n} device pins point to entities Home Assistant no longer knows ({ids}).",check_furniture_entity_missing:"A piece of furniture is linked to {id} \u2013 that entity no longer exists.",check_battery_low:"Battery low: {name} ({level} %)",battery_low_n:"Battery low: {names}",check_standby:"{name} draws {w} W while off \u2013 about {cost} a year.",check_fix_show:"Show",check_fix_ignore:"Ignore",check_show_devices:"Look at the {n} devices",check_ignore_all:"Ignore all {n}",check_reset_ignored:"Check the {n} ignored devices again",check_fix_set_area:'Link "{area}"',check_fix_add_rooms:"Add the rooms",check_fix_place:"Place {n}",check_fix_remove:"Remove {n}",floor_layer_hint:"This floor is no storey but a layer \u2013 all the trees or the decoration, say. The 3D view shows an eye at the top that shows or hides it on each device.",no_ha_floor:"\u2013 none \u2013",area_rooms:"Add rooms from HA areas ({n})",area_rooms_hint:"Adds a room (4 \xD7 3 m) for each area of this floor \u2013 then drag it into place and adjust the corners",floor_name:"Name",elevation:"Elevation (m)",floor_shift:"Shift the floor (m)",floor_shift_apply:"Shift",floor_shift_hint:"Moves every room, furniture item, device, outdoor area, free wall and the background image of this floor by X and Z. Roof sections stay.",height:"Ceiling height (m)",cut_height:"Cut height (m)",delete_floor:"Delete floor",floor_copy:"Duplicate floor",floor_copy_hint:"The copy goes on top of the house with all rooms, walls, doors and windows. Rooms and the floor lose their link to Home Assistant, furniture its entities; energy devices stay on the old floor.",floor_copy_furniture:"Take the furniture along",floor_copy_devices:"Take the device pins along",floor_copy_devices_hint:"The same entity then shows on both floors.",floor_copy_outdoor:"Take the outdoor areas along",floor_copy_make:"Make the copy",floor_copy_name:"{name} (copy)",furn_to_floor:"Move to floor",furn_to_floor_hint:"The item moves to the same spot on the chosen floor.",delete_floor_confirm:"Delete floor \u201C{name}\u201D with all its rooms?",move_up:"Move up",move_down:"Move down",default_floor:"Ground floor",new_floor:"Floor {n}",tool_select:"Select",tool_rect:"Rectangle",tool_polygon:"Free shape",undo:"Undo",redo:"Redo",fit:"Show all",room:"Room",rooms:"Rooms",room_name:"Name",area:"Area",no_area:"No area",sub_area_add:"+ Area within the room",sub_area_hint:"A part of the room with a Home Assistant area of its own but no walls \u2013 a reading corner, a shelf, a kitchenette in the living room. Its devices and sensors belong to this room.",material:"Floor",x:"X (m)",z:"Y (m)",width:"Width (m)",depth:"Depth (m)",points:"Corners",delete_point:"Delete corner",duplicate:"Duplicate",delete:"Delete",new_room:"Room {n}",settings:"Settings",pendant_shape:"Shape",pendant_shade:"Shade",paint_colour:"Paint colour",pendant_globe:"Globe",pendant_cone:"Cone",pendant_drum:"Drum",sofa_shape:"Shape",sofa_straight:"Straight",sofa_l:"L-shaped (mirror: other side)",sofa_u:"U-shaped",pkg_open:"Furnish \u2026",pkg_hint:"Furniture goes against the room's walls; lamps link to the area's lights. Adjust single items afterwards \u2013 Ctrl+Z takes it all back.",pkg_done:"{n} items placed \u2013 Ctrl+Z takes it back.",pkg_kitchen_row:"Kitchen row",pkg_kitchen_row_desc:"Row on the back wall with fridge, oven, sink, dishwasher and stove, wall cabinet, dining table with pendant",pkg_kitchen_l:"L-shaped kitchen",pkg_kitchen_l_desc:"Rows at the back and left, kitchen island with bar stools",pkg_bath:"Bathroom",pkg_bath_desc:"Washbasin, WC, bathtub, washing machine, downlight",pkg_bedroom:"Bedroom",pkg_bedroom_desc:"Double bed with two nightstands, wardrobe, chest of drawers, ceiling light",pkg_living:"Living room",pkg_living_desc:"TV board, sofa, coffee table, rug, armchair, shelf, floor lamp, plant",pkg_dining:"Dining room",pkg_dining_desc:"Table with four chairs, sideboard, pendant",pkg_office:"Office",pkg_office_desc:"Desk with office chair, two shelves, ceiling light",pkg_kids:"Kids' room",pkg_kids_desc:"Single bed, desk, shelf, rug",pkg_hall:"Hall",pkg_hall_desc:"Coat rack, two downlights",spots_place:"Place spots",spots_type:"Lamp",spots_cols:"Columns (left\u2013right)",spots_rows:"Rows (front\u2013back)",spots_add:"Place {n} lamps",spots_placed:"{n} lamps placed.",spots_hint:"All lamps follow the chosen light (e.g. spots on one dimmer). Afterwards each can be moved and linked to another light like any furniture.",cancel:"Cancel",backup:"Backup",backup_history:"Restore points",share_view:"Share a view",share_view_hint:"Saves the house as a small file that opens in any browser without Home Assistant (through NextFloor's online demo) \u2013 to show it to family or a planner. Without devices and entities, like a template.",share_view_title:"Our home in NextFloor",share_view_needs_js:"This page needs JavaScript and an internet connection.",share_view_file:"view",share_view_done:"View saved \u2013 open the file in a browser or pass it on.",version_save:"Save this state \u2026",version_save_hint:'Keeps the plan under a name ("before the renovation"). Named states stay when the automatic restore points go.',version_name_prompt:'Name for this state (e.g. "before the renovation"):',version_saved:'State "{name}" saved.',version_compare:"Compare",version_delete_confirm:'Delete "{name}"?',version_same:"No difference to the plan.",version_diff_n:"{n} differences to the plan as it is now:",diff_floor_added:'Floor "{name}" added',diff_floor_removed:'Floor "{name}" removed',diff_room_added:'Room "{name}" added',diff_room_removed:'Room "{name}" removed',diff_room_renamed:'"{detail}" is now called "{name}"',diff_room_reshaped:'"{name}" reshaped ({detail} m\xB2)',diff_opening_added:"{name} added ({detail})",diff_opening_removed:"{name} removed ({detail})",diff_furniture_added:"{name} added",diff_furniture_removed:"{name} removed",diff_furniture_moved:"{name} moved or changed",diff_device_added:"Device {name} placed",diff_device_removed:"Device {name} removed",diff_device_moved:"Device {name} moved",backup_none:"None yet. While editing, a restore point is kept at most every 10 minutes.",backup_summary:"{rooms} rooms, {furniture} items",backup_restore:"Restore",backup_restore_confirm:"Restore the state of {time}? The current state is kept as a restore point.",backup_restored:"Restored.",backup_file:"File",backup_export:"Export",backup_export_share:"Share as template",backup_export_share_hint:"Without areas, devices, sensors and images \u2013 for passing on to others.",backup_import:"Import \u2026",backup_import_confirm:"Replace the whole plan with the file? The current state is kept as a restore point.",backup_import_error:"The file is no NextFloor plan ({error}).",backup_imported:"Imported.",backup_hint:"Background images are not part of the file.",backup_full:"Full backup",backup_full_export:"Back up everything (plan, pictures, packs)",backup_full_import:"Restore a full backup \u2026",backup_full_hint:"One file with the plan, every background and screen picture and the installed packs. On restore every pack is checked again; the licence key is not included.",backup_full_confirm:"Replace the plan, the pictures and the packs with the backup? The current state stays as a restore point.",backup_full_not_backup:"This is not a full NextFloor backup.",backup_full_restored:"Backup restored: {packs} packs, {pictures} pictures.",backup_full_skipped:"Skipped (could not be read): {packs}.",export_name_full:"full",device_confirm:"Ask before switching",device_confirm_hint:"A tap in 3D, the quick menu and the room panel ask first. A double tap on the room leaves this device out.",cover_confirm_hint:"Open, close and positions ask first in the quick menu and the room panel, and a swipe on the marker no longer moves the blind (it turns the view instead). Stop never asks.",blind_kind:"Kind of blind",blind_roller:"Roller shutter outside",blind_venetian:"Venetian blind with slats",blind_inside:"Roller blind inside",cover2_entity:"Second blind (right half)",cover_my:'Favourite position "My" (%, 0 = none)',cover_my_go:"To the favourite position ({p} %)",blind_hint:`A venetian blind turns its slats in 3D with the cover's tilt; a roller blind inside hangs behind the glass. A wide window can have a second blind for its right half. The favourite position shows as "My" in the quick menu: a blind with positions moves there, a Somfy RTS motor without feedback goes to its own My on stop.`,confirm_switch:"Really switch {name}?",lock_confirm_unlock:"Really unlock {name}?",gang_switch_one:"Switches",furn_cover_entity:"Moves with",furn_cover_hint:"The curtain, screen, awning or gate follows this cover entity (blind, curtain, awning, gate) and travels with it. A tap opens its menu (up, stop, down).",furn_cover_inverted:"Reverse the direction",furn_cover_inverted_hint:"For an awning or curtain that moves the opposite way in the plan than in reality: out then shows in, and the other way round.",gang_switch:"Button {n} switches",gang_socket_one:"Socket powered by",gang_socket:"Socket {n} powered by",gang_switch_hint:"A button glows while its light is on (in its colour). A tap switches it; with several buttons a small menu asks which. The same entity may sit on several switches.",gang_socket_hint:"A socket glows green while its switch is on \u2013 brighter the more it draws. A tap switches it; with several, a small menu asks which.",lock_confirm_lock:"Lock {name}?",opening_lock:"Smart lock",opening_lock_hint:"A tap on the door locks or unlocks it (always asking first). While it is unlocked, its edge glows.",split_handle_hint:"Drag: width of the plan and the 3D view",wall_exterior:"Exterior wall (m)",wall_interior:"Interior wall (m)",grid:"Grid (m)",units:"Show lengths in",units_metric:"Metres",units_imperial:"Feet and inches",units_hint:"How lengths and areas appear in the plan, the forms and the wall view. Inputs stay in metres.",background:"Template (floor plan image)",background_upload:"Choose image \u2026",background_width:"Width in plan (m)",background_opacity:"Opacity",background_rotation:"Rotation (\xB0)",background_edit:"Move, scale and turn",background_edit_done:"Done",background_edit_hint:"While the mode is on: dragging the picture moves it, the handle at the bottom right scales it. Fit the picture to the scale first, then turn it.",background_remove:"Remove template",hint_select:"Tap a room to select \xB7 drag corners \xB7 \u201C+\u201D on an edge inserts a corner \xB7 arrow keys nudge \xB7 Del deletes \xB7 Ctrl+Z",hint_rect:"Drag to draw a rectangle",hint_polygon:"Place corners \xB7 tap the first corner or press Enter to close \xB7 Esc cancels",hint_empty:"Add a floor first.",area_m2:"{a} m\xB2",overlap_warning:"Rooms overlap \u2013 walls there are incomplete.",read_only:"Only administrators can edit the floor plan.",side_failed:"This form could not be shown ({error}). The plan stays usable. Please report the text in a GitHub issue.",mat_wood:"Wood",mat_oak:"Oak",mat_tiles:"Tiles",mat_carpet:"Carpet",mat_stone:"Stone",mat_concrete:"Concrete",card_name:"NextFloor",card_description:"Your home in 3D (neon).",stats:"{calls} draw calls \xB7 {tris} triangles",stats_fps:"{fps} fps (slowest frame {ms} ms)",stats_idle:"At rest (0 fps)",stats_busy_floors:"floors",stats_busy_openings:"doors/windows",stats_busy_flash:"flash",stats_busy_roof:"roof",stats_busy_flow:"power flow",stats_busy_effect:"colour effect",stats_busy_robot:"robot",stats_busy_orbit:"camera turn",stats_busy_tint:"room tint",stats_low:"tablet level, pixel ratio {r}",stats_full:"full level, pixel ratio {r}",floors_apart:"Apart",floors_stacked:"Stacked",roof_keep:"Roof stays",roof_keep_hint:"The roof stays on the house while zooming in instead of lifting and fading out",floor_rooms_one:"1 room",floor_rooms:"{n} rooms",quality:"Quality",quality_auto:"Auto",quality_low:"Tablet",quality_high:"High",state_on:"On",state_off:"Off",state_open:"Open",state_closed:"Closed",state_opening:"Opening",state_closing:"Closing",state_playing:"Playing",state_paused:"Paused",state_idle:"Idle",state_locked:"Locked",state_unlocked:"Unlocked",state_detected:"Detected",state_clear:"Clear",state_unavailable:"Unavailable",state_heat:"Heat",state_cool:"Cool",state_auto:"Auto",state_heat_cool:"Heat/cool",state_dry:"Dry",state_fan_only:"Fan",devices:"Devices",devices_none_area:"Link the room to an area and its devices appear here.",devices_none:"The area has no suitable devices.",devices_place_all_n:"Place all {n} \u2026",devices_place_all_confirm:"Put {n} devices into the room at once? (Ctrl+Z or \u201CUndo\u201D takes them all back in one step.)",devices_src_area:"This area",devices_src_other:"Other areas",devices_src_none:"No area",panel_hide:"Hide from the room panel",panel_unhide:"Show in the room panel again",panel_state_hide:'Hide the state in the room panel (e.g. a cover that only reports "unknown")',panel_state_show:"Show the state in the room panel again",devices_place:"Place",devices_remove:"Remove",devices_hint:"Placed devices appear in 3D. Drag them in the plan to move them.",panel_lights:"Lights",panel_covers:"Covers",panel_climate:"Heating",panel_media:"Media",panel_switches:"Switches",panel_sensors:"Sensors",panel_scenes:"Scenes & scripts",panel_announce:"\u{1F4E2} Announcement",announce_placeholder:"Your own message \u2026",announce_send:"Say it",announce_sent:'Said: "{message}"',announce_failed:"Announcement failed: {error}",announce_phrase_1:"Dinner is ready!",announce_phrase_2:"Time for bed!",announce_phrase_3:"Please come down!",announce_phrase_4:"We are leaving soon!",announce_phrase_5:"The dog needs to go out!",state_recording:"Recording",state_streaming:"Streaming",panel_all_off:"All off",readable:"Easy to read",readable_hint:"Stronger contrast and larger text \u2013 for wall tablets and anyone who reads better that way.",plain:"Floor plan only",plain_hint:"Shows only walls, doors, windows and stairs, without furniture. Devices and their pins stay.",right_back:"Right click = back",right_back_hint:"A short right click in the 3D view goes one step back: from the room to the floor, from the floor to the house (like a double tap on empty space). Dragging with the right button still pans the view.",stl:"3D print (STL)",stl_hint:"Saves the house as an STL file (walls, floors, furniture and outdoor areas of every floor) for 3D printing, at 1:100 (one metre becomes 10 mm). Windows, lights and the roof are not in it; a slicer repairs the file if needed.",card_plain:"Floor plan only",card_rooms:"Only these rooms",card_rooms_hint:"The card shows only the ticked rooms with their furniture, devices, doors and windows (for a tablet in the kitchen, say). Nothing ticked: the whole plan.",card_templates:"Card templates",card_templates_hint:"Set up a dashboard card once here (with the card's own settings) and give just its name on each tablet: `template: kitchen_tablet`. Changes here reach every card that uses the template; what stands on the card itself wins over the template.",template_name:"New template (name)",template_add:"Create template",template_reload:"Reload screens with this template",template_reload_all:"Reload all screens",template_use:"On the dashboard card: `template: {name}`",card_template:"Card template",card_template_none:"none (this card only)",card_readable:"Easy to read",all_off_n:"Everything off ({n})",all_off_hint:"Switches off the room's lights, switches, fans and media; it can be undone for ten seconds.",all_off_done:"Everything off.",all_off_undo:"Undo",all_off_floor:"Everything off on {floor} ({n} devices), undo for ten seconds",mood_save:"Save mood",mood_save_hint:`Keeps how the room's lamps shine right now as a mood \u2013 a tap on it sets them again later, "\u2192" carries it to another room.`,mood_new:"Mood",mood_set:"Set this mood",mood_carry:"Carry over to another room",panel_all_on:"All on",view_options:"View: quality, look, markers, FPS",panel_all_open:"All up",panel_all_close:"All down",central:"Central: all lights, blinds and favourites",central_house:"Whole house",central_lights:"Lights",central_covers:"Blinds",central_on:"On",central_off:"Off",central_open:"Up",central_close:"Down",central_sure:"Sure?",central_favorites:"Favourites",central_no_favorites:'No favourites yet. Set scenes, scripts and switches in the editor under "Favourites".',card_central:"Star with the central menu",card_central_hint:"All lights and blinds of the floor or the house and the favourites from the editor.",favorites:"Favourites",favorites_hint:"Scenes, scripts, automations, buttons and switches for the central menu (star) of the 3D view \u2013 party, presence simulation, shading, watering.",favorites_add:"Add a favourite",favorite_floor:"Which floor this favourite shows on",favorite_all_floors:"All floors",outside_hidden:"Outside: hide devices",outside_hidden_hint:"Devices the Outside panel should not show (they stay in the plan).",outside_hidden_add:"Hide a device",outside_view_hint:"View for Outside: turn the 3D preview to the garden and use it. Opening Outside then flies the camera there.",outside_view_set:"Use this view for Outside",outside_view_reset:"Reset the Outside view",room_facts:"Room panel: facts shown",room_fact_sun:"Sun hours",room_fact_comfort:"Comfort",room_fact_air:"Airing hint",room_fact_circuits:"Circuits",background_handles_hint:'The picture now has handles like a piece of furniture: drag moves it, the lower right corner scales it, the round handle on top turns it (Shift for 15\xB0 steps). When it fits, tap "Done" \u2013 then it stays put.',background_fixed_hint:'The picture stays put, you can draw over it. To adjust it, tap "Move, scale and turn".',bg_level:"Straighten",bg_level_cancel:"Cancel straightening",bg_level_first:"Tap the start of a wall in the picture that should run straight (horizontal or vertical).",bg_level_second:"Now tap the end of that wall \u2013 the picture turns to fit.",bg_ruler:"Scale with a ruler",bg_ruler_cancel:"Cancel the ruler",bg_ruler_first:"Tap the start of a stretch of known length in the picture \u2013 e.g. a dimensioned wall.",bg_ruler_second:"Now tap the end of the stretch.",bg_ruler_length_hint:"Measured in the plan: {m} m. Enter the real length and the picture is scaled to fit.",bg_ruler_length:"Real length (m)",bg_ruler_apply:"Apply the scale",thumbs_fold:"Fold the floor pictures into buttons",thumbs_show:"Show the floor pictures again",room_start_view:"View as this room's start",room_start_view_hint:"When you tap the room in 3D, the camera flies to exactly the view the 3D pane on the right shows now \u2013 angle, zoom and framing. Turn on 3D beside first, turn and zoom in on the room, then tap.",room_start_view_reset:"Remove the room's start view (from above again)",room_start_view_need_pane:'Turn on "3D beside" first, then turn and zoom the room the way it should open.',floor_start_view:"View as this floor's start",floor_start_view_hint:"This floor opens in 3D the way the 3D pane on the right stands right now \u2013 e.g. the ground floor from the front and the upper floor from the back. Turn on 3D beside first, turn it, then tap.",floor_start_view_reset:"Remove the floor's start view (like the house again)",floor_start_view_need_pane:'Turn on "3D beside" first and turn the floor the way it should open.',ambilight:"Glow behind the TV (%)",ambilight_hint:"How strongly it glows behind the TV while it plays. 0 switches it off (for example if you have LED strips on the TV), 100 is the usual strength.",sound_rings:"Sound rings (%)",sound_rings_hint:"How large the rings around the speaker grow while it plays. 0 switches them off, the picture and the glow stay; 100 is the usual size. The size also follows the speaker's volume: quieter means smaller.",glow_scale:"Glow in 3D (%)",light_effects:"Effect animations in 3D",light_effects_hint:"Map exact HA effect names only. Unmapped effects keep the static HA colour. Changes nothing in Home Assistant.",light_effects_enabled:"Allow animations for this lamp",light_effect_unmapped:"Unmapped (static)",light_effect_add:"Add exact effect name",light_effect_name_limit:"The exact effect name must contain 1 to 255 characters. It will not be shortened.",light_effect_count_limit:"At most 100 mappings. Remove an existing entry first.",light_effect_exists:"This effect name is already mapped. Its existing mapping is preserved.",light_animation_none:"Static",light_animation_rainbow:"Rainbow (replaces colour)",light_animation_pulse:"Pulse (intensity)",light_animation_flicker:"Flicker (intensity)",glow_scale_hint:"How strongly the lamp glows in 3D: below 100 % tones down bright LED strips so the room does not burn out; above 100 % makes a weak lamp glow more. Switches nothing in Home Assistant.",vehicle_to_spot:"Turn into a parking spot",vehicle_to_spot_hint:"A vehicle as plain furniture always stands there. As a parking spot it appears only while a sensor reports the car, and that is where the car device is linked (charge, range, lock, climate).",as_furniture:"Show as furniture",as_furniture_hint:"Replaces the pin by a furniture item in the same place, linked to this device \u2013 a speaker for a media player, a lamp for a light. Ctrl+Z takes it back.",as_furniture_pick:"Pick furniture \u2026",as_device:"Back to a device pin",as_device_hint:"Replaces the furniture by the plain pin of its device in the same place.",presets:"Stations and playlists (Sound)",presets_hint:`Shown in every speaker's quick menu under "Play", next to the player's sources. For an Echo (Alexa Media Player): type SPOTIFY, AMAZON_MUSIC or TUNEIN and as content what you would say ("Rock Antenne"). For Sonos, Music Assistant and others: type music or url with a stream address or a URI.`,preset_type:"Type",preset_type_hint:"media_content_type of play_media, e.g. music, url, playlist, SPOTIFY, AMAZON_MUSIC, TUNEIN",preset_content:"Content",preset_content_hint:"media_content_id: stream URL, URI (spotify:playlist:\u2026) or, for Alexa, a search phrase",preset_speakers:"Only on these speakers (none = on all)",media_play:"Play",media_pause:"Pause",media_previous:"Previous",media_next:"Next",media_volume:"Volume",media_sources:"Sources",preset_add:"Station or playlist",own_buttons:"Own buttons",own_buttons_hint:"Shown in the central menu (star) below the favourites: open a dashboard path, show an entity's details, call a service, or open a browser_mod popup with your own card.",own_alerts:"Own warnings",circuits:"Fuse box",circuits_hint:'The circuits with the rooms they feed. The room panel names them, and the search finds them ("F12").',circuit_name:"Name",circuit_new:"New circuit",circuit_add:"Add a circuit",circuit_add_room:"Add a room",own_alerts_hint:'A line in the warning bar of the 3D view while an entity is in a state \u2013 "Water tank empty" from the robot vacuum, "Dishwasher done". Several states with commas; for numbers <20 or >80.',own_alert_entity:"When \u2026",own_alert_state:"\u2026 is in state (empty = on)",own_alert_text:"\u2026 then this warning",own_alert_color:"Colour",own_alert_tap:"A tap",own_alert_tap_info:"opens the details",own_alert_tap_toggle:"switches the entity",own_alert_tap_room:"jumps to the room",own_alert_house:"Whole house",own_alert_new:"New warning",own_alert_add:"Add a warning",today:"Today",tomorrow:"Tomorrow",today_days:'Days on the "Today" card',today_days_one:"Today only",today_days_n:"{n} days",forecast:"Weather forecast",forecast_hint:'A small card with the next days of the weather entity (settings): the weather, high and low, and rain. It sits in a top corner of the 3D view, top right below the "Today" card.',forecast_days:"Forecast",forecast_off:"Off",forecast_corner:"Corner",today_none:"Nothing on today.",today_calendars:'Calendars for "Today"',today_calendars_hint:'The appointments of these calendars show top right in the 3D view on the "Today" card, with the bins collected today or tomorrow. A tap on its title folds the card.',own_button_state:"Lights up while \u2026 is on (optional)",own_button_label:"Label",own_button_action:"Action",own_button_new:"New button",own_button_add:"Own button",own_action_navigate:"Open a path",own_action_more_info:"Entity details",own_action_service:"Call a service",own_action_fire_dom_event:"fire-dom-event (browser_mod)",own_target_navigate:"Path",own_target_more_info:"Entity",own_target_service:"Service (domain.service)",own_data:"Data (JSON)",own_data_hint:`For a service its data, for fire-dom-event the event's content, e.g. {"browser_mod": {"service": "browser_mod.popup", "data": {\u2026}}}.`,own_data_bad:"Not a valid JSON object.",panel_no_area:"This room is not linked to an area. You can link it in the editor.",panel_empty:"No devices of this room are in the plan. In the editor, place devices or pick them for the room panel with \u2606.",close:"Close",panel_fold:"Fold away (the room stays in view)",panel_unfold:"Open again",brightness:"Brightness",color_temp:"Colour temperature",color:"Colour",position:"Position",cover_open:"Open",cover_stop:"Stop",cover_tilt:"Slats",cover_tilt_open:"Slats open",cover_tilt_close:"Slats closed",cover_close:"Close",target_temp:"Target",current_temp:"Current",temp_down:"Cooler",temp_up:"Warmer",volume:"Volume",play_pause:"Play/pause",previous:"Previous",next:"Next",run:"Run",details:"Details",hold_hint:"Tap toggles \xB7 long press opens details",tool_opening:"Doors & windows",tool_furniture:"Furniture",qm_off:"Off",find:"Search",find_placeholder:"Where is \u2026? Device or room",find_none:"Nothing found",swipe_off:"Off",panel_pin:"Show in the room panel",panel_unpin:"Don't show in the room panel",devices_panel_hint:"The room panel shows the devices in the plan. \u2606 adds a device to the room panel without placing it.",card_section_view:"View",card_size:"Size",card_size_fixed:"Fixed height",card_size_fill:"Fill the screen",card_fill_hint:"Works best in a dashboard view of the type \u201CPanel (single card)\u201D \u2013 the card then takes all the space.",card_controls:"Switches in the card",card_floor_thumbs:"Floors as miniatures",card_floor_thumbs_hint:"Small pictures of the floors at the side \u2013 tap one to switch",card_floor_thumbs_hint_start:"The chosen floor is then where the card starts \u2013 the pictures at the side switch to the others",card_room_names:"Show room names",card_section_kiosk:"Wall tablet (kiosk)",card_section_features:"Features",card_weather_plan:"as set in the plan",card_pro_hint:"Motion trail and camera wall belong to the cameras: the trail shows the last half hour, the wall every camera of the plan.",card_idle_return:"Back to the start view after",card_idle_off:"Never",card_idle_min:"{n} min without a touch",card_idle_hint:"After the wait the card closes the room and shows the start view again.",card_night:"Night dimming",card_night_off:"Off",card_night_sun:"By the sun",card_night_time:"Time range",card_night_range:"Time range (e.g. 22:00-06:00)",card_idle_orbit:"Camera turn as screensaver",card_idle_orbit_hint:"After the return the view turns slowly until someone touches the tablet",card_dashboard:"Button to a dashboard (path)",card_dashboard_label:"Label of the button",card_dashboard_hint:"A button at the top right of the card opens the dashboard or view with this path, e.g. /lovelace/home or /dashboard-house/0. Without a label it shows \u2302.",card_alerts:"Show warnings",card_alerts_hint:"Smoke, gas, CO, water, alarm panel and windows open in the rain: the room pulses, a note appears at the top",card_alert_jump:"Jump to the room of a new warning",card_alert_jump_hint:"The view switches to the floor and room of the warning by itself",card_scenes:"Scene buttons in the room",card_scenes_hint:"Scenes and scripts of the area as buttons under the 3D view while a room is selected",card_sensor_bar:"Own sensors at the top",card_sensor_bar_hint:"The sensors chosen in the editor (Settings) at the top left of the card",card_central_open:"Star menu open and large",card_central_open_hint:"Favourites and own buttons stand open from the start, a size larger",card_keep_camera:"Keep the camera when switching floors",card_keep_camera_hint:"The same side, height and distance on every floor",card_today:'"Today" card',card_today_hint:"Today's appointments and the bins due, top right",card_announcements:"Announcements",card_announcements_hint:'Announcements (action "NextFloor: Announcement") show big on the card, with a chime, and are spoken',weather_short:"Weather",time_of_day:"Time of day",time_of_day_hint:"Shows sun, light, shadows and look at another time of today. Tap again to go back to now.",menu_open:"Menu open",menu_open_hint:"The star menu with favourites and own buttons stands open from the start on this device, a size larger \u2013 for a wall tablet that mostly runs scenes.",keep_camera:"Keep camera",keep_camera_hint:"Switching floors keeps the camera on the same side, height and distance instead of fitting the new floor from the start side.",view_zoom:"Zoom",view_zoom_hint:"How close the fitted views come \u2013 on small tablets the house looks larger.",weather_entity:"Weather entity",weather_effects:"Weather effects in 3D",card_weather_density:"Amount of rain and snow",card_weather_density_hint:"Fewer drops and flakes than the weather reports; clouds, fog and lightning stay",rain_warning:"Warning: window open while it rains",sun_patches:"Sunlight and shadows",sun_patches_hint:"With north set, the sunlight from sun.sun falls through the windows as bright patches on the floor, and the house throws its shadow on the plot. Untick it to keep floor and plot free of sun patches and shadows.",sun_arc:"Sun arc and compass",sun_arc_hint:"Draws today's path of the sun as an arc over the plot, with a ring and the compass points on the ground (north in red). Needs your home's location in Home Assistant.",weather_effect_rain:"Rain",weather_effect_snow:"Snow",weather_effect_fog:"Fog (greys the scene)",weather_effect_clouds:"Clouds dim the sky and the sun",weather_effect_lightning:"Lightning in storms",weather_effect_sky:"Sun and moon in the sky",weather_entity_hint:"Which weather entity drives the sky around the house. Automatic uses the first one found.",weather_hint:"Weather at the house: rain and snow fall with the real wind, clouds drift over the plot with their shadows, lightning, fog, sun and moon",card_weather:"Weather outside",card_weather_hint:"Rain, snow, hail, clouds with shadows, lightning and fog from the first weather entity (weather_entity picks another); fewer particles on the tablet level",alerts:"Warnings",alert_smoke:"Smoke: {name}",alert_gas:"Gas: {name}",alert_co:"Carbon monoxide: {name}",alert_water:"Water: {name}",alert_alarm:"Alarm triggered",alert_alarm_by:"Alarm set off by {cause}",alert_alarm_pending:"Alarm pending",alert_window_rain:"Window open in the rain: {name}",alert_power_outage:"Power outage: {name}",alert_contact_lost:"Contact not answering: {name}",rain_sensor:"Rain sensor (own weather station)",rain_sensor_inverted:"Invert rain sensor",rain_sensor_inverted_hint:"For sensors that read off (or 0) when it rains and on when it is dry.",outage_sensor:"Power outage sensor",outage_hint:'A binary sensor of class power that is off, another binary sensor that is on, a state like "off_grid" or "backup", or a voltage below 50 V raise a warning for the whole house.',contact_warning:"Warn when a door or window contact is unavailable",contact_warning_hint:"When a contact has been unavailable for 10 minutes (empty battery, out of radio reach), the window looks shut in 3D although nobody knows. A note then names the contact. A restart of Home Assistant does not warn.",night_lock_warning:"Warn at night when a door is not locked",night_lock_warning_hint:"Between 10 pm and 6 am a note names the plan's door locks that stand unlocked.",alert_unlocked_night:"Not locked: {name}",motion_markers_active:"Show motion sensors only while they detect something",motion_markers_active_hint:"Applies to motion, occupancy and presence sensors. A sensor whose marker is set to always show stays visible.",room_double_tap:"Double tap on a room",room_double_tap_hint:"A double tap on a room turns its lights off when one is on, otherwise all on. Devices set to ask first always stay out.",room_double_tap_area:"Lamps in the plan and every light of the area",room_double_tap_plan:"Only lamps in the plan",room_double_tap_off:"Switch nothing",card_room_double_tap_auto:"As set in the plan",status_entities:"Own sensors at the top of the 3D view",status_add:"Add a sensor",status_entities_hint:"For example the outside temperature, the alarm or the air quality: they show at the top left with name and value, in an opened room too. A tap opens their details. Up to 12.",announce_tts:"Text-to-speech for announcements",announce_phrases:"Sentences for announcements (one per line)",announce_phrases_hint:`Empty: the sentences that come with NextFloor. Announcements also exist as the action "NextFloor: Announcement" for automations \u2013 on the rooms' speakers and on every open NextFloor screen.`,opening_rain_warning:"Warn when it rains",opening_light_well:"Light well in front",sill_boards:"Sill and board",sill_boards_auto:"Automatic",sill_boards_none:"None",sill_boards_inside:"Inside only",sill_boards_outside:"Outside only",room_names_short:"Room names",room_names_toggle_hint:"Show or hide room names in the 3D view",floor_stack_short_dim:"Dimmed",floor_stack_short_stacked:"Stacked",floor_stack_short_single:"Alone",size_short_w:"W",size_short_d:"D",size_short_h:"H",import_error_not_json:"The file is no JSON.",import_error_not_plan:"The file is no NextFloor plan.",import_other_hint:"From Sweet Home 3D: import the .sh3d file here. Floors, rooms, doors, windows and free walls come over, furniture does not.",import_sh3d_found:"Sweet Home 3D: {floors} floors, {rooms} rooms, {openings} doors and windows, {walls} free walls ({furniture} pieces of furniture are not taken over).",import_dxf_found:"DXF: {rooms} rooms (closed polylines) and {walls} free walls (lines) on one floor.",import_ifc_found:"In the IFC file: {floors} floors and {rooms} rooms (NextFloor draws the walls from the rooms).",import_roomplan_found:"Room scan (RoomPlan): {rooms} rooms, {openings} doors and windows; {skipped} objects were not taken over (you place furniture yourself).",import_error_roomplan_empty:"The room scan has no walls.",import_error_ifc_empty:"The IFC file has no spaces (IfcSpace) with a footprint.",import_error_dxf_empty:"The DXF file has no lines or polylines.",import_error_sh3d:"This is not a Sweet Home 3D file that can be read (it needs Sweet Home 3D 5.3 or newer).",import_error_sh3d_empty:"The Sweet Home 3D file has no rooms or walls.",export_name_template:"template",export_name_backup:"backup",card_floor_stack:"Floors below",floor_stack_dim:"Dimmed",floor_stack_stacked:"Stacked (the house up to here)",floor_stack_single:"Hidden (only this floor)",card_control_walls:"Tall walls/cut",card_control_floors:"Floors apart",card_control_temperature:"Temperature",card_control_humidity:"Humidity",card_control_co2:"CO\u2082",card_controls_hint:"Tall walls/cut, floors apart and temperature, humidity, CO\u2082 to switch",controls_hide:"Hide the controls \u2013 only the 3D view remains",nav_wrap:"Wrap the bar: every floor and room on several lines",bars_unfold:"Switches",nav_row:"Bar in one line (scrolls sideways)",controls_show:"Show the controls again",card_controls_hidden:"Start with the controls hidden",card_controls_hidden_hint:"Only the 3D view; an eye at the bottom left brings bars, values and switches back",card_controls_hide_after:"Hide the controls after",card_hide_after_s:"{n} s without a touch",card_fullscreen_button:"Full screen button",card_fullscreen_button_hint:"Hides the dashboard around the card (e.g. on a wall tablet)",fullscreen:"Full screen",fullscreen_exit:"Exit full screen",card_section_show:"Show",card_floor:"Floor",card_floor_house:"Whole house (tap a floor to open it)",card_height:"Height (pixels)",card_walls:"Walls",card_quality_hint:"\u201CTablet\u201D is the lightest setting \u2013 ideal for Fire tablets and other wall tablets.",card_flows_switch:"Switch in the card",card_flows_on:"Always on",card_flows_off:"Always off",holos:"Cards",holos_hint:"Show or hide the live cards over the house (energy balance, car, media)",card_energy:"Show energy values at the top",card_room_panel:"Room details on tap",card_room_buttons:"Room buttons",card_room_buttons_hint:"A row with one button per room at the top of the card \u2013 tap one to open the room, like tapping it in the model",card_room_panel_hint:"The room's lights and blinds in a side panel",card_explode:"Pull floors apart in the house view",card_roof_fade:"Fade the roof out while zooming in",card_roof_fade_hint:"Off: the roof stays on the house even when the camera comes close.",card_stats:"Performance display (frames per second)",card_stats_hint:"To check how smoothly the card runs on the device",packs:"Furniture packs",lib_badge_light:"Lamp: links to a light and switches in 3D",lib_badge_electric:"Electric: links to an entity and a power sensor (switching, pictures, consumption)",lib_badge_hint:"Items with a symbol link to entities: lamps switch, screens show pictures, appliances show their consumption.",care_bin_today:"Collected today",care_bin_tomorrow:"Collected tomorrow",care_bin_days:"In {n} days",care_mail_yes:"Post is in",care_mail_no:"Empty",care_plant_thirsty:"Thirsty",care_plant_ok:"Well watered",care_time_left:"{time} left",care_entity_bin:"Pickup date (sensor)",care_entity_mail:"Post sensor",care_entity_plant:"Soil moisture (sensor)",care_thirsty_below:"Thirsty below (%)",care_hint_bin:'A sensor with the next pickup: days, a date, "today"/"tomorrow" or the Waste Collection Schedule integration. The bin glows the day before and on the day.',care_hint_mail:"A sensor that reports post in the box (a contact on the flap, say). The mailbox glows then.",care_hint_plant:"A moisture sensor in the soil. Below the threshold the plant glows and says it is thirsty.",lib_cat_lights:"Lights",lib_cat_seating:"Seating",lib_cat_tables:"Tables",lib_cat_storage:"Cabinets & shelves",lib_cat_beds:"Beds",lib_cat_kitchen:"Kitchen",lib_cat_appliances:"Appliances",lib_cat_bath:"Bathroom",lib_cat_media:"TV & audio",lib_cat_office:"Office",lib_cat_tech:"Tech",lib_cat_climate:"Heating & climate",lib_cat_energy:"Energy",lib_cat_garden:"Garden & terrace",lib_cat_plants:"Plants",lib_cat_kids:"Kids",lib_cat_fitness:"Fitness",lib_cat_pets:"Pets",lib_cat_workshop:"Workshop & garage",lib_cat_music:"Music & studio",lib_cat_season:"Season & decoration",lib_cat_pictures:"Pictures & frames",lib_cat_vehicles:"Vehicles",lib_cat_building:"Stairs & building parts",lib_cat_decor:"Decoration & more",lib_favourites:"Favourites",lib_recent:"Recently used",lib_for_room:"Fits {room}",lib_all_rooms:"Show all rooms",lib_linkable:"linkable",lib_lit:"lit",lib_outdoor:"outdoor",lib_fav_add:"Add to favourites",lib_fav_remove:"Remove from favourites",lib_sizes:"Sizes",feature_name_energy:"Energy flow",ext_tab:"Extensions",ext_title:"Extensions",models:"Your own 3D models",models_hint:"For some vehicles NextFloor can show a real 3D model if you own one. Choose the file (.glb) here: NextFloor turns it the right way round, makes it lighter, marks the paint and stores it on your Home Assistant. Without a model the vehicle looks as it did before.",models_licence:"The files are yours and stay on your Home Assistant. NextFloor ships no models; please make sure your model's licence lets you use it in your own installation.",model_add:"Add a model \u2026",model_replace:"Replace the model \u2026",model_remove:"Remove",model_present:"in place",model_missing:"none yet",model_remove_confirm:"Delete the model \u201C{id}\u201D from Home Assistant?",model_removed:"Model \u201C{id}\u201D deleted.",model_uploaded:"Model \u201C{id}\u201D stored ({size}). Reload the panel to see it.",model_upload:"Store on Home Assistant",model_info:"{triangles} triangles, {size} m",model_front:"Front",model_front_hint:"Turn the model until its front faces the viewer (towards the lower left in the picture).",model_paint:"Paint (the colour you pick in the editor)",model_paint_preview:"Colour in the preview",model_detail:"Level of detail",model_detail_light:"Light (tablet)",model_detail_normal:"Normal",model_detail_fine:"Fine",model_result:"Result: {triangles} triangles, {size}",model_error_not_glb:"This is not a .glb file (binary glTF). Export the model as \u201CglTF binary\u201D.",model_error_compressed:"The file is compressed (Draco, Meshopt or KTX). Export it without compression.",model_error_empty:"The file contains nothing three-dimensional.",model_error_unreadable:"The file cannot be read: {detail}",model_error_too_large:"The file is larger than {max}. Choose a lower level of detail.",model_upload_forbidden:"Only administrators may upload models.",model_upload_too_large:"Home Assistant accepts no files over {max}. Choose a lower level of detail.",model_upload_not_glb:"Home Assistant refused the file (not a binary glTF).",model_upload_bad_id:"The model id is not valid.",model_upload_other:"Uploading did not work: {detail}",ext_intro:"Import your own furniture packs, upload your own 3D models and add plugins here.",plugin:"plugin",plugins_title:"Plugins",plugins_intro:"Plugins add your own light animations, devices and cards in the room panel. Enter a plugin's address (a .js file in /config/www, i.e. /local/\u2026, from HACS /hacsfiles/\u2026, or https://\u2026).",plugins_docs:"How to write a plugin",plugins_warning:"Plugins run with the same rights as NextFloor in your browser. Only use plugins from sources you trust.",plugins_off:"off",plugins_error:"error",plugins_loading:"loading \u2026",plugins_nothing_registered:"loaded, but registered nothing",plugins_loaded:"active",plugins_reload_hint:"Takes effect after reloading the page",plugins_remove:"Remove",plugins_none:"No plugins yet.",plugins_from_dashboard:"Registered by a dashboard resource",plugins_add:"Add",plugins_url_invalid:"Enter a .js address under /local/\u2026, /hacsfiles/\u2026 or https://\u2026.",plugins_exists:"This plugin is already in the list.",plugins_limit:"At most 20 plugins.",packs_title:"Furniture packs",packs_intro:"Import your own furniture as a pack (JSON): as a file or pasted below. {n} packs come with NextFloor and are always there.",packs_docs:"Pack format",packs_none:"No packs of your own yet.",community_title:"Community furniture",community_intro:"Furniture others built with the furniture builder and shared \u2013 checked and free. Build your own:",community_builder:"Open the furniture builder",community_how:"How to share yours",community_load:"Load community furniture",community_none:"No community furniture yet \u2013 be the first!",community_install:"Install",community_update:"Update",community_installed:"Installed",community_failed:"The community furniture could not be loaded: {detail}",pack_import:"Import pack files \u2026",pack_paste:"Import JSON",pack_paste_empty:"Paste a pack's JSON first.",pack_paste_not_json:"This is not valid JSON: {detail}",pack_imported:"Imported \u201C{name}\u201D by {publisher} \u2013 {n} items",packs_imported_n:"{n} of {total} packs imported",pack_by:"by {publisher} \xB7 {n} items",pack_remove:"Remove",pack_remove_confirm:"Remove the pack \u201C{name}\u201D? Its furniture stays in the plan as plain boxes.",pack_error_not_a_pack:'This is not a furniture pack ("format": "nfpack" is missing).',pack_error_builtin:"A pack that comes with NextFloor already has this id.",pack_error_invalid_content:"The pack contains invalid furniture: {detail}",pack_error_too_large:"The pack is too large (1 MB at most).",pack_error_needs_update:'This pack needs a newer version of NextFloor. Please update first (HACS \u203A NextFloor \u203A \u22EE \u203A "Update information" \u203A "Download"), restart Home Assistant, then import again.',pack_error_other:"Import failed: {detail}",store_open:"Open plugin store",store_close:"Close plugin store",store_intro:"Reviewed plugins from the community. Each one is looked at before it is added and does not change afterwards.",store_submit:"Submit your own plugin",store_empty:"No plugins in the store yet.",store_failed:"The store could not be loaded ({error}).",store_install:"Install",store_installed:"installed",store_update:"Update",store_confirm:`Install \u201C{name}\u201D by {author}? A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed: -{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side",flip_swing:"Reverse opening direction",flip_swing_hint:"The door swings into the room or to the other side",main_leaf:"Main leaf (seen from the room)",contact_main:"Contact main leaf",contact_second:"Contact second leaf",tool_outdoor:"Outdoor",tool_measure:"By measure",hint_measure:"Tap the starting point, then type the wall lengths with their direction on the right",measure:"Room by measure",measure_start:"Tap the starting point in the plan, e.g. a room corner.",measure_from:"Start at {x} / {z} m \u2013 tapping moves the start.",measure_length:"Length of the next wall (m)",measure_close:"Close room",measure_undo:"Remove last wall",measure_gap:"Gap to the start: {gap} m (joined when closing)",measure_hint:"Tip: type a length and press an arrow key. With measured inside dimensions, use \u201CClose gaps\u201D afterwards.",rect_by_size:"Rectangle by size",rect_add:"Add rectangle",dir_up:"Up",dir_down:"Down",dir_left:"Left",dir_right:"Right",hint_outdoor:"Drag to draw an outdoor area (lawn, terrace, pool \u2026)",outdoor:"Outdoor area",outdoor_type:"Type",outdoor_height:"Height (m)",outdoor_offset:"Height offset (m, \u2212 = lower)",outdoor_opacity:"Opacity (%)",outdoor_opacity_hint:"100 = solid. Less makes the area see-through, such as a driveway above a cellar; the outline stays.",outdoor_outline:"Show the outline",outdoor_outline_hint:"Unticked, the area draws no glowing line along its edge \u2013 for large plots made of several lawns.",outdoor_corners_hint:"Corners: a + on an edge adds a corner, dragging shapes the area, \xD7 removes a corner.",outdoor_hint:"Outdoor lights (path light, garden spot, outdoor wall light) light all outdoor areas and the facade.",out_lawn:"Lawn",out_terrace:"Terrace",out_path:"Path",out_driveway:"Driveway",out_pool:"Pool",out_bed:"Flower bed",out_hedge:"Hedge",out_fence:"Fence",out_wild:"Wild patch",out_pergola:"Pergola / frame",outdoor_open:"Open (leave out the last edge)",outdoor_open_hint:"The edge from the last point back to the first is not drawn \u2013 a fence or pergola leaning against the house.",fence_gates:"Gates in the fence",gate_add:"+ Gate in the fence",gate_edge:"Fence side",gate_kind:"Kind",gate_single:"Garden gate",gate_double:"Double gate",gate_sliding:"Sliding gate",gate_offset:"Middle from the start (m)",gate_width:"Width (m)",gate_entity:"Motor or switch",gate_contact:"Contact (on = open)",fence_gates_hint:"A gate is a gap in the fence with gate posts and a leaf. With a motor (cover, switch, input_boolean, lock) and/or a contact it opens in 3D: garden and double gates swing inwards, a sliding gate runs along the fence.",outdoor_bracing:"X-bracing",outdoor_cut:"Cut out of surrounding areas",outdoor_cut_hint:"Every area that contains this one whole gets a hole here \u2013 a pool in the terrace, a pond or a wild patch in the lawn. The drawing order does not matter. A pool cuts itself out on its own.",outdoor_area_hint:"The Home Assistant area of this surface (garden, terrace, pool): its devices and sensors are listed under Outside, and a pin on the surface opens it.",pool_temp:"Water temperature (optional)",pool_pump:"Pump / filter (optional)",pool_pump_on:"pump on",outdoor_slope:"Slope (m)",outdoor_slope_hint:"Height difference from the high edge to the low edge; the high edge sits at the height offset. Lamps on the area follow.",outdoor_slope_dir:"Falls towards",slope_x:"right (+X)",slope_nx:"left (\u2212X)",slope_z:"down (+Z)",slope_nz:"up (\u2212Z)",north:"North (\xB0 clockwise from up)",north_hint:"North is needed for the sun (light through the windows).",map_on:"Show a real map under the plan",map_lat:"Latitude",map_lon:"Longitude",map_use_ha:"Use Home Assistant's location",map_opacity:"Visibility (%)",map_zoom:"Detail level",map_zoom_coarse:"coarse",map_zoom_fine:"fine",map_move:"Move the map under the plan",map_step:"Step",map_url:"Own tile address (empty = OpenStreetMap)",map_hint:"Your browser loads the map tiles straight from the map server (OpenStreetMap by default, please mind their usage policy); nothing is loaded while the map is off. The plan lies on the map as the compass says \u2013 turn the compass or move the map until the house fits.",compass_title:"Compass",compass_n_short:"N",compass_s_short:"S",compass_swap:"Swap north \u2194 south",compass_swap_hint:"Turns the compass by 180\xB0. The drawing, roof faces and solar fields stay as they are.",compass_hint:"If the compass does not match reality, turn it here \u2013 nothing has to be redrawn. Sunlight, wind and the compass directions of roof faces follow it.",roof:"Roof",roof_none:"No roof",roof_flat:"Flat roof",roof_gable:"Gable roof",roof_custom:"Roof sections (custom)",roof_sections:"Roof sections",roof_sections_hint:"Each roof section covers a rectangle of the house, e.g. the house, the barn or an extension \u2013 each with its own shape, ridge direction, eave height and pitch. Drag in the plan to draw a new one; tap selects it, dragging moves it, the corners resize it.",roof_sections_start:"Create roof sections from the rooms",roof_sections_regen:"Create again from the rooms",roof_sections_off:"Back to one roof",roof_regen_confirm:"Replace all roof sections with a new proposal from the rooms?",roof_section:"Roof section",roof_section_hint:"Heights count from the ground. A side with a lower eave reaches further down (catslide); pent roofs rise from the first side.",roof_shape_gable:"Gable",roof_shape_hip:"Hip",roof_shape_pent:"Pent",roof_shape_flat:"Flat",roof_shape_halfhip:"Half-hip",roof_shape_pyramid:"Pyramid",roof_shape_mansard:"Mansard",roof_shape_parapet:"Parapet",roof_shape:"Shape",roof_end_start:"End at the ridge start",roof_end_end:"End at the ridge end",roof_halfhip:"Half-hip starts at",roof_halfhip_hint:"How high up the gable the hipped part starts, as a share of the gable's height: low = a large hip, high = only the tip is hipped.",roof_axis_x:"Ridge \u2194",roof_axis_z:"Ridge \u2195",roof_eave:"Eave (m)",roof_pitch_short:"Pitch (\xB0)",roof_height:"Height (m)",roof_base:"Top of walls (m)",roof_rotation:"Turn (\xB0)",roof_on_floor:"Sits on floor",roof_on_floor_hint:"Puts the section on this floor's wall tops; base and eaves move along. In the 3D view the roof belongs to this floor.",roof_base_hint:"Below the ceiling height of the floor underneath, that floor's walls end under the roof: knee walls at the eaves, gables up to the ridge, inner walls cut by the slope. Dashed lines in the plan show where 1.5 m and 2 m of headroom remain.",roof_ridge_height:"Ridge height",roof_side_top:"top",roof_side_bottom:"bottom",roof_side_left:"left",roof_side_right:"right",roof_swap:"Swap sides",roof_open:"Canopy (posts instead of walls, see-through)",roof_open_short:"Canopy",roof_dormer:"Dormer",roof_dormer_hint:"A dormer on this side of the roof: 2 m wide, its front at the eave wall, eaves 1.4 m above the roof's eave, gable roof. Then move it and change its width and heights like any section; the main slope opens under it and the attic wall rises up to the dormer \u2013 a window fits there.",roof_outline:"Take the floor's outline",roof_outline_hint:"A flat roof as a free shape: takes the outline of the shown floor's rooms (L- or Z-shaped too) as one surface without seams. The corners can be dragged afterwards.",roof_points_hint:"Free shape: drag the corners in the plan, a + on an edge adds a corner, \xD7 removes one. Back to the rectangle drops the shape.",roof_rect:"Back to the rectangle",roof_open_hint:"For a terrace roof or a carport: posts and beams carry the roof instead of walls, and it is see-through. Where the canopy meets the house wall, it rests on the wall.",roof_swap_hint:"Turns the roof round: the two sides swap eave and pitch, a pent roof rises the other way.",roof_pitch:"Roof pitch (\xB0)",roof_overhang:"Roof overhang (m)",roof_overhang_sides:"Overhang per side",roof_overhang_a:"Overhang eave A (m)",roof_overhang_b:"Overhang eave B (m)",roof_overhang_u0:"Overhang gable start (m)",roof_overhang_u1:"Overhang gable end (m)",roof_overhang_auto:"Back to automatic",roof_overhang_sides_hint:"Without values of your own the overhang is automatic: the same everywhere, except where the roof part meets the house (none there).",roof_ridge:"Ridge",roof_ridge_long:"Along the long side",roof_ridge_short:"Along the short side (e.g. terraced house)",device:"Device",lamp_mount:"Lamp",lamp_ceiling:"Ceiling light",lamp_floor:"Floor lamp",lamp_table:"Table lamp",lamp_wall:"Wall light",marker_height:"Marker height (m)",height_auto:"Automatic height",device_centre:"To room centre",lights_spread:"Spread ceiling lights evenly",devices_search:"Search devices \u2026",devices_more:"+{n} more",devices_less:"less",panel_more:"More devices of the area ({n})",panel_less:"Show less",gaps_close:"Close gaps",gaps_hint:"Join rooms up to 60 cm apart at one shared wall; the gap becomes the interior wall thickness.",gaps_none:"No gaps between rooms found.",gaps_closed:"{n} places closed.",gaps_closed_wall:"{n} places closed, interior wall now {t} m.",fps:"FPS",fps_title:"Performance display (frames per second)",hint_garage:"Tap a wall to add a garage door",opening_garage:"Garage door",garage_hint:"The door follows a garage cover (position or open/closed) or a garage door contact of the room's area.",door_hint:"With a door contact the leaf swings open; without a sensor it stands half open.",hint_door:"Tap a wall to add a door",hint_window:"Tap a wall to add a window",opening_door:"Door",opening_window:"Window",opening_type:"Type",opening_position:"Centre from corner (m)",sill:"Sill height (m)",opening_height:"Height (m)",hinge:"Hinge (seen from the room)",hinge_left:"Left",hinge_right:"Right",cover_entity:"Blind",door_cover:"Drive (motorised door or gate)",cover_position_entity:"Position sensor (live)",cover_position_invert:"Reverse position sensor in 3D (0 = open)",contact_entity:"Contact",sensor_kind:"Sensor type",sensor_kind_contact:"Window contact (open/closed)",sensor_kind_handle:"Handle sensor (open/tilted/closed)",sensor_kind_contact_tilt:"Contact + tilt sensor",handle_entity:"Handle sensor",handle_main:"Handle sensor main leaf",leaf_main:"Main leaf",leaf_second:"Second leaf",tilt_entity:"Tilt sensor",tilt_angle_entity:"Tilt angle sensor (\xB0, optional)",tilt_angle_max:"Angle that counts as fully tilted (\xB0)",tilt_angle_offset:"Offset: angle reported while closed (\xB0)",tilt_angle_invert:"The angle counts the other way round",door_shut:"Show closed without a sensor",door_shut_hint:"A door without a contact stands half open in 3D so it reads as a door. Ticked, it is drawn closed \u2013 front door, carport, side door.",door_angle:"Opening angle",door_angle_default:"Default",door_angle_hint:"How far the leaf opens. With a sensor it opens that far once it reports open; without one it stands that far open (instead of half). Default stays as before.",entity_auto:"Automatic ({name})",entity_auto_none:"Automatic (none found)",entity_none:"None",entity_search:"Type to search \u2026",opening_hint:`Sensor type: window contact (reports open/closed), handle sensor (reports open, tilted and closed \u2013 e.g. a Homematic window handle) or contact + tilt sensor (a second sensor that only reports tilted). Automatic uses the blinds and contacts of the room's area. Position sensor: an entity reporting the blind's position while it moves (e.g. a Homematic "level", 0\u2013100 % or 0\u20131, open = high) \u2013 the blind then moves live in 3D.`,furniture:"Furniture",furniture_add:"Add furniture",studio_new:"Build your own piece",studio_title:"Furniture studio",studio_title_edit:"Furniture studio: change",studio_hint:'Pick a template, set its measurements and fronts and put the piece into the plan. It goes into the "Own furniture" pack and can be changed here again later.',studio_kind:"Template",studio_kind_cabinet:"Cabinet",studio_kind_shelf:"Shelf",studio_kind_lamp:"Lamp",studio_kind_device:"Device",studio_name:"Name",studio_width:"Width (cm)",studio_depth:"Depth (cm)",studio_height:"Height (cm)",studio_doors:"Doors",studio_drawers:"Drawers",studio_shelves:"Shelves",studio_handle:"Handles",studio_handle_bar:"Bar",studio_handle_knob:"Knob",studio_handle_none:"None",studio_base:"Base",studio_base_plinth:"Plinth",studio_base_legs:"Legs",studio_base_none:"None",studio_back:"Back panel",studio_lamp:"Kind",studio_lamp_floor:"Floor lamp",studio_lamp_table:"Table lamp",studio_lamp_pendant:"Pendant",studio_lamp_wall:"Wall light",studio_display:"Display on the front (shows the media player)",studio_mount:"Stands",studio_mount_floor:"On the floor",studio_mount_surface:"On furniture",studio_mount_wall:"On the wall",studio_color_body:"Body",studio_color_lamp_body:"Base and frame",studio_color_front:"Fronts",studio_color_boards:"Boards",studio_color_shade:"Shade",studio_color_display:"Display frame",studio_color_white:"White",studio_color_wood:"Wood",studio_color_metal:"Metal",studio_color_dark:"Dark",studio_color_glass:"Glass",studio_color_accent:"Accent",studio_color_own:"Own colour",studio_color_plan:"Colour of the plan",studio_place:"Put into the plan",studio_save:"Save the change",studio_open:"Change in the studio",studio_error:"Could not save: {detail}",studio_pack_name:"Own furniture",studio_pack_publisher:"Furniture studio",furniture_search:"Search furniture \u2026",furniture_search_none:"Nothing found. Try another word \u2013 English or German.",furniture_type:"Item",rotation:"Rotation (\xB0)",tilt_x:"Tilt front/back (\xB0)",tilt_z:"Tilt sideways (\xB0)",strip_tilt:"Tilt about its length (\xB0)",strip_upright:"Upright",strip_rise:"Rise along its length (\xB0)",strip_upright_hint:"The strip stands on end: its length runs up from the height above the floor \u2013 along a door frame, as a light column. The tilt lays a lying strip against a slope (90\xB0 = its face points sideways).",rotate_left:"\u21BA 90\xB0",rotate_right:"\u21BB 90\xB0",height_m:"Height (m)",furn_sofa:"Sofa",furn_armchair:"Armchair",furn_table:"Table",furn_chair:"Chair",furn_bed:"Bed",furn_nightstand:"Nightstand",furn_wardrobe:"Wardrobe",furn_shelf:"Shelf",furn_kitchen:"Kitchen unit",furn_worktop:"Worktop",furn_fridge:"Fridge",furn_fridge_smart:"Smart fridge (side by side)",furn_door_left:"Door sensor left (freezer side)",furn_door_right:"Door sensor right (fridge side)",fridge_hint:"While a door sensor reports open, the door swings open in 3D.",furn_stove:"Stove",furn_sink:"Sink",furn_bathtub:"Bathtub",furn_shower:"Shower",furn_wc:"WC",furn_washbasin:"Washbasin",furn_desk:"Desk",furn_tv_board:"TV board",furn_plant:"Plant",furn_rug:"Rug",furn_stairs:"Stairs",furn_stairwell:"Floor opening",stairwell_hint:"A hole in this floor, for example above the staircase or for a gallery; from above you look through it. The opening must lie within one room; several openings may overlap (for an L shape, for example). Stairs on the floor below that reach up here open the floor by themselves as well.",tool_hole:"Floor opening",tool_stairs:"Stairs",hint_stairs:"Drag where the stair should stand \u2013 it runs along the long side; set shape, turn and build on the right afterwards",tool_roof:"Roof",tool_energy:"Energy",tool_wall:"Wall",hint_wall:"Drag to draw a single wall (partition, half wall) \xB7 Shift keeps it straight \xB7 Alt without snapping",free_wall:"Wall",wall_length:"Length (m)",wall_thickness:"Wall thickness (m)",wall_height:"Height (m)",wall_height_full:"Full room height",wall_slope:"Sloping",wall_slope_start:"Height at the start (m)",wall_slope_end:"Height at the end (m)",wall_slope_hint:"Sloping wall: the top runs straight from the height at the start of the wall (the corner with the lower number) to the height at its end. Both may be above the floor height, for example for a lean-to room with high clerestory windows.",wall_slope_off:"Back to a level wall",wall_none:"No wall",wall_none_hint:"Leave this wall out altogether: for open floor plans whose rooms are one space but separate in Home Assistant.",edge_thickness:"Thickness (m)",wall_thickness_hint:"Thickness of this wall, e.g. 0.365 on a thick outer wall or 0.115 on a light partition. A wall between two rooms takes the thicker setting.",wall_thickness_reset:"Thickness as set for the house",wall_heights:"Wall heights",wall_n:"Wall {a}\u2013{b}",wall_view:"Wall view",wall_view_hint:"The wall from the front: drag its doors, windows and furniture or type their distance.",wall_view_prev:"Previous wall",wall_view_next:"Next wall",wall_view_left:"From the left (m)",wall_view_height:"Above the floor (m)",wall_part:"part {n}",wall_split_hint:"Split the wall here: the part gets a height of its own, e.g. 2.5 m next to 1.7 m in line",wall_split_at:"Split point from corner (m)",wall_join_hint:"Remove the split point: the part joins the one before it again",wall_exterior_short:"exterior wall",room_wall_hint:"A lower height turns the wall into a parapet or a counter. If two rooms share the wall, the lower setting applies. Windows and doors in it end at the wall height.",free_wall_hint:"A free-standing wall, e.g. a partition. Where it meets a room wall, the corner is mitred. Drag the handles to move its ends, drag the line to move the whole wall.",free_wall_slope:"\u25E2 Sloping",free_wall_slope_hint:"The wall gets higher or lower from one end to the other: the height above is at its start, the one here at its end.",free_wall_height_end:"Height at the end (m)",arc:"Arc",arc_hint:"Bends the wall into an arc. A room sharing the wall bends along, doors and windows move with it; Undo takes the arc back.",arc_bulge:"Bulge (m)",arc_bulge_hint:"How far the middle of the wall bulges: positive outwards, negative into the room.",arc_apply:"Bend",arc_too_wide:"A door or window in this wall is too wide for this curve. Make the curve flatter or the opening narrower.",stairwell_outside:"This opening reaches across a room boundary and is therefore not cut. Move it fully into one room or make it smaller.",hint_hole:"Drag to draw a floor opening (stairwell, gallery)",hint_roof:"Drag to draw a roof section \xB7 tap selects \xB7 drag moves \xB7 corners resize",hint_energy:"Tap a solar field to select it \xB7 drag to move it, also onto another roof face \xB7 new fields with + Solar field on the right",furn_parking:"Parking spot",furn_group_vehicles:"Parking",parking_entity:'Sensor "car present"',parking_vehicle:"Vehicle",parking_vehicle_none:"None",parking_no_pack:'No vehicle pack imported \u2013 vehicles come from the "Vehicles" pack (Extensions \u2192 Furniture packs).',parking_scale:"Size (%)",parking_type_entity:"Vehicle type sensor (optional)",parking_types:"State \u2192 vehicle",parking_type_state:"State (e.g. van)",parking_add_type:"+ Mapping",parking_hint:'Without a sensor the vehicle always stands there. With one it appears as soon as the sensor reports "on", "home" or "present". A vehicle type sensor (e.g. from an AI camera analysis) picks the model: when its state matches a mapping \u2013 also as a word in the text \u2013 that vehicle is shown, otherwise the default one.',parking_too_tall:"The vehicle ({car} m) is taller than the room ({room} m).",furn_lamp_ceiling:"Ceiling light",furn_lamp_downlight:"Downlight",furn_lamp_spot:"Surface spot",furn_lamp_panel:"LED panel",furn_lamp_uplight:"Floor uplight",furn_lamp_bollard:"Path light",furn_lamp_garden:"Garden spot",furn_radiator:"Radiator",furn_robot_vacuum:"Robot vacuum",furn_entity_vacuum:"Robot vacuum",furn_entity_mower:"Robot mower",pet_room_sensor:"The pet's room sensor (optional)",pet_room_hint:"A sensor naming the room the pet is in \u2013 Bermuda or ESPresense with a tag on its collar: in 3D it then roams that room.",furn_entity_water:"Valve or switch",device_temp:"Device temperature",device_temp_hint:"A temperature sensor of the device (inverter, battery, PC \u2026): its value shows on the pin in the 3D view, from 60 \xB0C the pin is highlighted.",fridge_temp:"Fridge temperature",freezer_temp:"Freezer temperature",fridge_temp_hint:"The pin shows the temperatures. Above 8 \xB0C in the fridge or \u221212 \xB0C in the freezer it lights up as a warning.",spray_reach:"Reach of the water (m)",spray_hint:"While the valve is open or the switch is on, the sprinkler throws water in arcs around it.",furn_robot_room:"Current room (sensor)",robot_cal_none:"Not calibrated yet \u2014 with nothing tying the robot's grid to the plan, the lanes stay invented.",robot_cal_done:"Calibrated: one map cell measures {m} m.",robot_cal_do:"Calibrate from where the robot is now",robot_cal_doing:"Tap the plan where the robot is right now.",robot_cal_need:"The robot's map is not reporting a position \u2014 is the integration running?",robot_cal_hint:"The dock is the anchor: the plan knows where it stands, the camera knows where the robot and its dock lie in their grid. If the map names its rooms like the plan does, \u201CCalibrate from the rooms\u201D is all it takes. Otherwise: stop the robot at least 1.5 m away \u2014 pause the clean \u2014 and tap it on the plan. If the rooms come out flipped, set the tick.",robot_cal_mirror:"The robot's map is mirrored (rooms come out flipped)",robot_cal_forget:"Remove the calibration",robot_cal_nudge:"Fine-tune by hand: the arrows move the map by 10 cm, \u27F2 \u27F3 turn it by 1\xB0, \u2212 + change its size by 1 %.",robot_cal_nudge_move:"Move the map",robot_cal_nudge_turn:"Turn the map",robot_cal_nudge_grow:"Make the map larger or smaller",robot_cal_rooms:"Calibrate from the rooms (the map knows {n} rooms)",robot_cal_rooms_none:"Too few rooms have the same name in the plan as on the robot's map ({n} found, at least 2 needed). Name them alike \u2014 or calibrate from the robot's position.",robot_cal_rooms_bad:"The rooms with matching names lie differently in the plan than on the robot's map \u2014 is a room mixed up? Otherwise calibrate from the robot's position.",robot_hint:"While the robot cleans in Home Assistant it drives lanes in 3D through the room it reports (a \u201Ccurrent room\u201D sensor, matched by room or area name), else through the room of its dock. With the robot's own map calibrated below, the track shows where it has really driven instead; without it the lanes are a guess. It drives back to the dock when it returns.",furn_lamp_pendant:"Pendant light",furn_ceiling_fan:"Ceiling fan",furn_fan_entity:"Fan",fan_hint:"The light is the fan's light kit (leave it empty if it has none). The fan is found in the room or chosen here: in 3D the blades turn as fast as it runs, its icon switches it, swiping up/down changes the speed, a long press opens the quick menu. The height is how far it hangs from the ceiling (more = a longer downrod).",room_ceiling:"Ceiling height",room_ceiling_tip:"Lower than the floor (a bathroom under the stairs) or higher (a living room open up to the roof): ceiling lights, fans, LED strips and ceiling devices hang from here, and the room's walls are this high.",room_ceiling_through:"The ceiling ({ceiling} m) is above the floor height ({floor} m): the room reaches into the floor above, its walls rise with it, and the floor above stays open over it. The editor of the upper floor shows the area hatched.",room_floor_offset:"Floor level (m)",room_floor_offset_hint:"When this room's floor lies lower or higher than the floor (a sunken entrance: \u22120.39), its floor, walls, doors and windows and what stands in it move with it; its ceiling stays. Add the steps as a stair.",room_inner:"Inside {w} \xD7 {d}",room_inner_hint:"Measured from wall to wall: inner walls take half their thickness, outer walls stand outside the outline.",floor_heating:"Underfloor heating (optional)",floor_heating_hint:"While the thermostat heats (or the valve is open, the switch on), the room's floor glows warm in 3D.",room_announce_speaker:"Speaker for announcements",room_announce_quiet:"Quiet time for announcements",room_announce_hint:"Without a choice, the speaker placed in the room talks, else a voice assistant, an Echo or a speaker of its area (never a TV). During the quiet time, announcements to several rooms leave this room out; one meant only for it still gets through.",ceiling_here:"Ceiling here",ceiling_here_hint:"Height of the ceiling right at this spot, e.g. in a sloping ceiling. Empty = the room's ceiling.",ceiling_slope:"Up to the roof slope",ceiling_slope_hint:"The ceiling here lies under the roof slope: the lamp hangs from its underside, right above where it stands.",furn_lamp_floor:"Floor lamp",furn_lamp_table:"Table lamp",furn_lamp_wall:"Wall light",furn_led_strip:"LED strip",furn_group_lights:"Lights",furn_entity_light:"Light or switch",furn_color_entity:"Colour and brightness from (optional)",furn_color_entity_hint:"For lights that a relay (Shelly, switch actuator) turns on and off while the bulb itself knows its colour and brightness: on/off comes from the switch above, colour and brightness from this entity.",lamp_extra_light:"Bulb {n} (optional)",lamp_extra_hint:"A fixture with several lights \u2013 main light, night light, ambient ring: while the main light is off it glows in 3D with the next light that is on, a little dimmer. Switch the lights one by one in the room panel.",furn_entity_climate:"Heating (thermostat)",lamp_hint:"Tap the lamp in 3D to switch it, long press for the quick menu. Switches work too (e.g. a relay for the ceiling light) \u2013 the lamp shines while it is on. Table lamps stand on the furniture below them.",lamp_hint_pendant:"Height = drop below the ceiling. Tap in 3D to switch, long press for details.",theme:"Look",version_hint:"Installed version of NextFloor \u2013 the frontend; the integration in Home Assistant reports {backend}",accent:"Accent colour",accent_hint:"An accent colour of your own: lines and glowing edges in the neon look, buttons and pins \u2013 \u21BA brings the neon cyan back",accent_reset:"Back to cyan",furn_colors_card:"Furniture colours of this card",furn_color_house:"House colour",theme_neon:"Neon",theme_blueprint:"Blueprint",theme_day:"Day",theme_auto:"Auto",clock:"Clock",clock_none:"None",clock_top_left:"Top left",clock_top_right:"Top right",clock_bottom_left:"Bottom left",clock_bottom_right:"Bottom right",glass_walls:"Glass walls",glass_walls_hint:"How opaque the walls you look through into the rooms are: left almost invisible, right opaque. For this screen.",screen_name:"Name of this screen",screen_name_hint:'Announcements show on every open NextFloor screen. With a name (e.g. "Hallway"), an announcement can go to this screen only. Unticked, this screen stays silent.',announce_on:"Announcements on this screen are on",announce_muted:"Announcements on this screen are muted",lock3d_on:"Lock 3D (no turning, zooming or panning; taps still work)",lock3d_off:"Unlock 3D",walk:"Walk through the house",travel:"Time travel: replay the last 24 hours or 7 days",travel_play:"Play",travel_pause:"Pause",travel_loading:"Loading history \u2026",travel_failed:"The history could not be loaded.",travel_speed:"Speed",travel_speed_min:"1 min/s",travel_speed_10min:"10 min/s",travel_speed_hour:"1 h/s",travel_days:"days",travel_live:"Live",card_travel_button:"Button for time travel",walk_stop:"Stop walking",walk_hint:"Drag: look around \xB7 W A S D / arrows or stick: walk \xB7 wheel: step",card_walk_button:"Button to walk through",card_lock_button:"Button for the 3D lock",backdrop:"Own background",backdrop_color:"Colour",backdrop_image:"Picture (/local/\u2026 or https://\u2026)",backdrop_dim:"Dim",backdrop_hint:"Instead of the look's sky the house stands in front of a colour or a picture of your own. A picture in /config/www is reachable at /local/\u2026.",furnish:"Furnish",split_3d:"3D beside",plan_dims:"Measurements",plan_dims_hint:"Labels every room edge with its length.",mount_height:"Height above the floor (m)",side_open:"Open the sidebar",side_close:"Close",side_details:"Details of the selection",side_pin:"Pin",side_pinned:"Pinned",side_pin_hint:"Pinned, the sidebar stays open; otherwise it folds away beside the 3D view while nothing is selected",split_3d_hint:"Live 3D next to the plan: drag and turn furniture and devices there \u2013 with undo, saved with the plan",size_w:"Width (m)",size_d:"Depth (m)",size_h:"Height (m)",furnish_hint:"Drag furniture, lamps and devices \xB7 furniture snaps to walls \xB7 tap one to turn it, set its height and mount",done:"Done",heatmap:"Heatmap",heat_off:"Normal",heat_short_temperature:"Temp.",heat_short_humidity:"Humidity",heat_short_co2:"CO\u2082",heat_short_mould:"Mould",heat_short_power:"Power",heat_short_comfort:"Comfort",heat_short_sun:"Sun",heat_short_wifi:"Wi-Fi",heat_short_values:"Values",heat_temperature:"Temperature",heat_humidity:"Humidity",heat_co2:"CO\u2082",heat_mould:"Mould",heat_power:"Power use",heat_comfort:"Comfort score",heat_sun:"Sun today",room_sun_hours:"{h} h of sun today ({facing})",open_since:"open for {time}",presence_now:"someone here",presence_last:"last seen {time} ago",comfort_n:"Comfort {n}",empty_lights_hint:"{n} lights on, nobody here for {min} min.",empty_lights_off:"Lights off",open_heating_hint:"{n} windows open while the heating runs.",open_heating_off:"Heating off",room_clean:"Cleaning (script or button)",room_clean_hint:`A script or button that sends the robot vacuum to this room (e.g. your robot integration's room cleaning). The room panel then shows "\u{1F9F9} Clean".`,room_clean_run:"Clean",room_clean_run_hint:"Sends the robot vacuum to this room.",shade_hint:"Sun on {n} windows at {temp} \u2013 lower the blinds?",shade_close:"Lower",room_sun_year:"Sun over the year",room_sun_year_hint:"The hours of sun through the room's outside windows on the 15th of every month.",room_energy:"today {today} \xB7 month {month}",room_energy_hint:"From the statistics of the power sensors of the room's devices; the month's cost at the house's tariff.",heat_summer:"summer",heat_winter:"winter",air_co2:"air it (CO\u2082)",air_humidity:"air it (damp)",air_mould:"risk of mould \u2013 air it",room_curve_hint:"The room's temperature over the last 24 hours",heat_values:"Values at the room names",heat_wifi:"Wi-Fi",wifi_aps:"{n} access points \xB7 {clients} devices",wifi_network:"Network: {online} online \xB7 {offline} offline",wifi_none:"Place access points or routers from the packs (Smart home 2) and link them to an entity of their device.",wifi_clients:"{n} devices",heat_none_found:"No matching sensors in the rooms' areas.",markers:"Markers",markers_none:"None",markers_important:"Important",markers_all:"All",furn_stool:"Stool",furn_coffee_table:"Coffee table",furn_tv_wall:"TV (wall)",furn_sideboard:"Sideboard",furn_table_round:"Round table",furn_bench:"Bench",furn_corner_bench:"Corner bench",furn_bar_stool:"Bar stool",furn_kitchen_wall:"Wall cabinet",furn_kitchen_tall:"Tall unit with oven",furn_island:"Kitchen island",furn_dishwasher:"Dishwasher",furn_bunk_bed:"Bunk bed",furn_dresser:"Chest of drawers",furn_washer:"Washing machine",furn_dryer:"Dryer",furn_office_chair:"Office chair",furn_tall_cabinet:"Tall cabinet",furn_coat_rack:"Coat rack",furn_group_living:"Living",furn_group_dining:"Dining",furn_group_energy:"Energy & solar",energy_devices:"Devices",wallbox_charging:"charging",wallbox_plugged:"plugged in",furn_soc:"State of charge (%)",furn_export:"Export power (W, separate sensor, optional)",furn_export_hint:"If your meter reports import and export in two sensors (e.g. Growatt, Tibber Pulse), take the import sensor as power above and the export sensor here. A signed sensor does not need this.",meter_parent:"Hangs off meter",meter_parent_none:"none (main meter)",meter_main:"Main meter",meter_unmetered:"{w} unmetered",meter_device_hint:"If the device sits behind a sub-meter (e.g. a balcony plant in a flat), its power counts towards that flat. The sub-meter has to measure both ways for this (\u2212 = feeding back); if it only counts import, the flat's consumption comes out too high while there is a surplus.",meter_sub_power:"Power of the branch (W, + = drawn, \u2212 = fed back)",meter_floors:"Feeds the floors",meter_sub_hint:"A sub-meter measures its branch, e.g. a flat. Devices on the ticked floors hang off it in 3D instead of the main meter; what the main meter counts beyond that shows as \u201CCommon (rest)\u201D in the balance.",furn_charge:"Charging power (W, separate sensor, optional)",furn_charge_hint:"If your battery reports charging and discharging in two sensors (e.g. Anker Solix), take the discharging sensor as power above and the charging sensor here. A signed sensor does not need this.",furn_wallbox_status:"Status (charging, plugged in)",charging_data:"Charging data",charging_card:"Charging station as a floating 3D card",charging_hint:"Linked charging data appears on the floating card and in the room menu, even without a power reading. Unlinked rows stay hidden. Native date/time profiles and Integer associations retain their Symcon display. Auto detects Unix timestamps without a time profile; numeric durations without a unit use seconds. Change the format to override this. These readings are display-only.",charging_start:"Start time",charging_end:"End time",charging_duration:"Charging duration",charging_energy:"Charged energy",charging_lock:"Lock status",charging_time_format:"Time format",charging_duration_unit:"Duration unit",charging_auto:"Automatic",charging_value:"Unchanged Symcon value",charging_seconds:"Seconds",charging_minutes:"Minutes",charging_hours:"Hours",charging_unix_seconds:"Unix time (seconds)",charging_unix_ms:"Unix time (milliseconds)",energy_only_note:"\u26A1 Energy: only solar fields and energy devices can be moved here; rooms and furniture are locked.",roof_only_note:"\u{1F3E0} Roof: only roof sections and roof windows can be moved here; rooms and furniture are locked.",energy_devices_hint:"Meter, inverters, home batteries, wallboxes and the grid connection are added here: on the floor chosen above, movable in the plan. With a power sensor they show their watts; the meter takes the grid sensor, a string picks its inverter. Several inverters and batteries (say a balcony plant on top) work too: each gets its own sensor.",energy_routes:"Cable routes",energy_routes_hint:"Where a cable really runs: the flow then follows your points instead of an arc through the house. Without a route it keeps the arc. Consumers keep their arc.",route_conn_solar:"{name} \u2192 inverter",route_conn_battery:"Battery \u2194 house",route_conn_inverter:"Inverter \u2192 house",route_conn_grid:"Grid \u2194 house",route_conn_meter:"{name} \u2194 parent meter",route_conn_device:"{name} \u2194 sub-meter",route_points:"{n} points",route_none:"direct arc",route_draw:"Draw route",route_redraw:"Redraw",route_drawing:"Tap the points the cable runs through on the plan, from one end to the other; switch floors in between where it goes through a ceiling. {n} points.",route_undo:"Last point",route_done:"Done",route_cable:"Show as cable",route_cable_hint:"Draws the route as a visible cable, not just as the faint line under the particles.",solar_fields:"Solar fields",solar_hint:"Put modules on the roof: they lie in the slope of the roof face; on a flat roof they stand on frames. Drag a field in the plan to move it.",solar_no_roof:"Solar fields need a roof: a gable or flat roof under Settings, or roof sections here in the Roof tool.",solar_face_gone:"roof face missing",solar_summary:"{n} modules \xB7 {kwp} kWp",solar_add:"Solar field",solar_field:"Solar field",solar_face:"Roof face",solar_rows:"Rows",solar_cols:"Modules per row",solar_portrait:"Portrait",solar_landscape:"Landscape",solar_u:"Distance from the edge (m)",solar_v:"Distance from the eave (m)",solar_tilt:"Tilt of the frames (\xB0)",solar_rack_ew:"East-west racks",solar_rack_ew_hint:"Every second row faces the other way, the pairs stand back to back \u2013 low and close, as on many flat roofs.",solar_rack_tilt:"Rack (\xB0 more tilt)",solar_flip:"Lean the other way",solar_partial:"only {n} of {total} fit on the face",solar_form_hint:"Modules that would reach beyond the roof face are left out. \u201CFill face\u201D puts as many modules on the roof as fit. kWp counted with 400 W per module.",solar_fit:"Fill face",roof_windows:"Roof windows",roof_window:"Roof window",chimneys:"Chimneys",chimney:"Chimney",chimney_shape:"Shape",chimney_brick:"Brick",chimney_round:"Round",chimney_wide:"Wide, two flues",chimney_steel:"Steel flue pipe",chimney_diameter:"Diameter (m)",chimney_depth:"Depth (m)",chimney_height:"Height above the roof (m)",chimney_hint:"The height counts from the upper side, where the chimney leaves the roof. Drag it in the plan or in the 3D view, also onto another roof face.",roof_windows_hint:"Roof windows lie in the roof face, with a blind and contacts like windows. Drag them in the plan, also onto another roof face.",roof_window_tilt:"Tilt contact",roof_window_name:"Name (optional)",roof_window_motor:"Window motor (cover, optional)",roof_window_motor_hint:"A window motor (Velux, Roto, Fakro) reports its position as a cover: the sash opens in 3D as far as the motor stands. A contact or tilt contact still works without a motor.",roof_window_hint:"Open, the sash swings out, hinged at the top; tilted, a little; and the frame glows warm; the blind comes down over the glass from the top. In a roof section the window cuts a hole into the slope, so the attic looks out through it.",solar_ground:"Free-standing (garden, garage roof \u2026)",solar_add_ground:"Free-standing",solar_base:"Height of the surface (m, 0 = ground)",solar_add_wall:"On a wall",solar_wall:"Wall",solar_v_wall:"Height above the floor (m)",solar_tilt_wall:"Tilt away from the wall (\xB0, 90 = canopy)",solar_flip_wall:"Standing off at the bottom instead of the top",solar_rotation:"Rotation (\xB0)",solar_name:"Name",solar_name_hint:"e.g. string 1 south",solar_module_w:"Module width (m)",solar_module_h:"Module height (m)",solar_wp:"Module power (Wp)",solar_string:"String",solar_strings:"Strings",solar_string_none:"No string",solar_string_new:"New string",solar_string_n:"String {n}",solar_string_name:"Name of the string",solar_string_entity:"PV power of the string",solar_string_inverter:"Inverter",solar_string_inverter_none:"No inverter chosen",inverter_strings:"Strings on this inverter: {names}",inverter_strings_none:"No string on this inverter yet \u2013 assign it at a solar field under String \u203A Inverter.",solar_string_inverter_missing:"No inverter in the plan yet (add one below under Devices)",solar_string_hint:"Fields in the same string belong together, also on different roofs (e.g. 5 modules on the house and 5 on the garage). Sensor and inverter count for the whole string.",solar_string_sum:"{fields} fields \xB7 {n} modules \xB7 {kwp} kWp",solar_face_size:"Roof face {w} \xD7 {h} m (along the eave \xD7 up the slope)",solar_cols_hint:"One number for rows of equal length, or a list for rows of their own: \u201C4, 4, 3\u201D (from the eave).",solar_align_left:"Left",solar_align_center:"Centre",solar_align_right:"Right",solar_look_black:"Full black",solar_look_blue:"Blue",solar_pick:"Modules on/off one by one",solar_pick_all:"All on again",solar_pick_hint:"Tap a module in the plan to take it away or put it back. Removed ones are dashed.",solar_entity:"PV power of this field (e.g. its string)",solar_main:"Main roof",solar_section:"Section {n}",solar_flat:"flat roof",compass_n:"north",compass_ne:"north-east",compass_e:"east",compass_se:"south-east",compass_s:"south",compass_sw:"south-west",compass_w:"west",compass_nw:"north-west",furn_meter:"Electricity meter",furn_grid_point:"Grid connection",grid_point_hint:"The grid connection stands here: the handover point to the utility, e.g. at the end of the driveway. Movable in the plan.",furn_model:"Model",inverter_std:"Standard (wall unit with display)",inverter_slim:"Slim and tall (light strip)",inverter_hybrid:"Hybrid (round dial, fans)",battery_std:"Tower (stacked modules)",battery_wall:"Wall battery (flat, hanging)",battery_cube:"Compact (balcony battery)",furn_inverter:"Solar inverter",furn_home_battery:"Home battery",furn_wallbox:"Wallbox",furn_heating_manifold:"Heating/cooling manifold",furn_buffer_tank:"Buffer tank",furn_freshwater_station:"Fresh water station",furn_group_kitchen:"Kitchen",furn_group_sleeping:"Sleeping",furn_group_bath:"Bath & laundry",furn_group_work:"Work & other",furn_entity:"Device (switch, plug \u2026)",furn_state_entity:"State from (optional)",furn_state_entity2:"Second state (the other half)",furn_tap:"Tapping the item",furn_tap_default:"As usual",furn_tap_hint:"An own action like the star menu's own buttons, e.g. a browser_mod popup with your card.",furn_show_when:"Only show while \u2026",furn_show_when_state:"\u2026 is in state (empty = on)",furn_show_when_invert:"The other way round: show while it is not",furn_show_when_hint:"Seasonal decoration that only stands in December: a helper (input_boolean), a calendar or a sensor decides whether the piece shows in 3D. Separate several states with commas. The editor always shows it.",picture_upload:"Upload a photo",picture_replace:"Upload another photo",picture_stored:"An own photo is stored.",picture_url:"\u2026 or picture address",picture_entity:"\u2026 or an entity's picture",picture_border:"Mat (%)",picture_fit:"Photo",picture_fit_cover:"fills the frame",picture_fit_contain:"shown whole",picture_hint:"Your photo in the frame, in 3D and on the wall tablet. Uploaded photos are stored with the plan in a smaller size; an image entity (a photo of the day) or a camera shows its current picture.",furn_state_split:"Halves",furn_state_left_right:"Left / right",furn_state_top_bottom:"Bottom / top (bunk bed)",furn_state_hint:"The item glows while the entity reports on, occupied or home \u2013 a bed with an occupancy mat, an armchair, the sauna. Two entities light the halves: left and right, bottom and top for a bunk bed.",furn_entity_tv:"TV (media player or smart plug)",fix:"Fix",unfix:"Release",fix_hint:"Fixed: cannot be moved by accident any more (key L, right-click or long press)",fixed_drag_hint:"\u{1F512} Fixed \u2013 release it first to move it (lock in the form, right-click or key L)",fixed_delete_confirm:"This item is fixed. Delete it anyway?",lock_plan:"\u{1F512} Floor plan",lock_plan_hint:"Lock the floor plan: rooms, walls, doors, windows and outdoor areas cannot be moved by accident. Furniture and devices stay free.",start_view:"Start view",start_view_hint:"The 3D view, the card and the kiosk open the house with this view, e.g. from the garden side. Turn, zoom and move the house in the 3D pane on the right until it fits, then remember it.",start_view_card:"If a card should open with a different view, put this line into its YAML configuration.",start_view_set:"Remember the current 3D view as the start",start_view_reset:"Default",start_view_saved:"An own start view is saved.",ctx_rotate:"Turn 90\xB0",devices_placed_in:"in {room}",devices_narrow:"{n} more \u2013 narrow the search",climate:"Room climate",climate_temperature:"Temperature",climate_humidity:"Humidity",climate_co2:"CO\u2082",climate_hint:"These sensors count for the heatmap and the room panel. \u201CAutomatic\u201D takes the sensors of the area and the ones placed in the room, but no device temperatures (3D printer, heat pump, flow \u2026).",climate_more:"\u2026 and another sensor (averaged)",plan_locked:"Floor plan locked",plan_lock:"Lock floor plan",plan_unlock:"Unlock floor plan",opening_mark:"Highlight in 3D",opening_mark_open:"When open",opening_mark_closed:"When closed (e.g. WC)",opening_mark_hint:"A highlighted window or door glows warm. \u201CWhen closed\u201D needs a contact; without a sensor nothing is highlighted.",window_opens:"Opens",window_opens_turn:"Turn and tilt (inwards)",window_opens_slide:"Sliding (sliding window, lift-and-slide door)",window_opens_top:"Top-hung (bottom swings out)",window_opens_hint:"Sliding: the pane on the hinge side slides in front of the fixed one; with two leaves the middle two slide outwards. Top-hung windows open with their contact or a tilt sensor.",marker_show:"Marker in 3D",marker_show_hint:"Automatic follows the None / Important / All switch of the 3D view. Always show and Hide apply regardless (except with None).",pin_shift:"Move the pin",pin_shift_up:"\u2191 up",pin_shift_hint:"When devices stand close together, push the pin a little aside or up here (in metres); the device itself stays where it is.",marker_show_auto:"Automatic",marker_show_always:"Always show",marker_show_no_power:"Without watts",marker_show_active:"Only while active",marker_show_never:"Hide",marker_icon:"Own symbol (Material Design icon)",device_name:"Own name (optional)",show_name:"Show the name under the marker in 3D",card_marker_names:"Own names at the markers",card_marker_names_hint:"Every device with an own name shows it small under its marker \u2013 three thermometers in the garden stay apart.",card_tap_in_room:"Switch devices only in the opened room",card_tap_in_room_hint:"In the house and floor views a tap opens the floor or room, even on a device or its marker. In the opened room it switches the device. A long press always opens its menu or details.",card_markers_outside:"Choose the markers outside the opened room",card_markers_outside_hint:`In the house, on the floor and in the other rooms only the ticked kinds; in the opened room all, as set above. A device's own "always" and "never" come first.`,marker_kind_light:"Lights",marker_kind_cover:"Blinds",marker_kind_climate:"Heating",marker_kind_media:"Media",marker_kind_switch:"Switches",marker_kind_fan:"Fans",marker_kind_lock:"Locks",marker_kind_binary:"Contacts and detectors",marker_kind_sensor:"Sensors",marker_kind_tap:"Furniture with an action",marker_kind_other:"Other",device_name_hint:'A name for the plan and the room panel only, e.g. "Island accent light" \u2013 the entity in Home Assistant stays as it is.',device_simple:"Switch only in the room panel",device_simple_hint:"The room panel shows only the switch for this lamp, without brightness, colour temperature and colours.",floor_turn:"Turn 90\xB0",floor_shift_all:"Take every floor along (whole house)",floor_shift_all_hint:"Shift and turn act on every floor with the roof sections, outdoor areas, energy devices and meter \u2013 the whole house moves as one.",floor_turn_hint:"Turns everything on the floor by 90\xB0 clockwise about the middle of its rooms \u2013 when a floor was drawn the wrong way round. Three times = 270\xB0.",marker_icon_hint:"The name of a Material Design icon as in Home Assistant, e.g. mdi:thermometer or mdi:water-alert. Empty = the symbol of the device kind.",furn_power:"Power sensor (W)",furn_links_hint:"With a power sensor the item shows its watts and takes part in the energy flow.",furn_links_hint_tv:"The screen glows while the TV is on, in the colour of the app (Netflix, YouTube \u2026); the label shows the app or title.",stairs_hint:"The stair rises towards the back (away from the marked front edge) and opens the ceiling of the floor above.",stair_shape:"Shape",stair_shape_straight:"Straight",stair_shape_quarter:"Quarter turn (winders)",stair_shape_l:"L with landing",stair_shape_half:"Half turn (winders)",stair_shape_u:"U with landing",stair_shape_spiral:"Spiral",stair_turn:"Turns (walking up)",stair_turn_left:"To the left",stair_turn_right:"To the right",stair_build:"Build",stair_build_solid:"Solid (concrete)",stair_build_stringer:"On stringers",stair_build_mono:"Mono stringer (spine)",stair_build_cantilever:"Cantilevered (floating)",stair_risers:"Closed risers",stair_steps:"Risers",stair_run_width:"Flight width (m)",stair_landing_after:"Risers up to the landing",stair_landing_hint:"The landing lies {h} cm above the floor; the other risers come after it.",stair_rail:"Railing",stair_rail_none:"None",stair_rail_left:"Left",stair_rail_right:"Right",stair_rail_both:"Both sides",stair_down:"Leads down",stair_down_hint:"The stair starts on this floor and leads down, for example into a cellar that need not be drawn. It opens the floor of this level.",stair_measures:"{steps} risers of {rise} cm \xB7 going {going} cm \xB7 step measure {measure} cm",stair_uncomfortable:"uncomfortable (step measure 59\u201365 cm, rise at most 21 cm)",stair_up_note:"The stair starts at the marked front edge. The floor above opens only where less than 2.2 m of headroom is left above the steps.",stair_down_note:"You step onto the stair at the marked front edge and walk down. The plan draws it dashed; this floor opens above the steps.",stair_opening:"Floor opening",stair_opening_headroom:"By headroom (only where needed)",stair_opening_full:"Over the whole stair",stair_opening_none:"None (hatch, closed stairwell)",stair_opening_hint:"How much of the floor the stair reaches it opens: the floor above, or its own floor for a stair going down. By headroom opens only above the steps that lack 2.2 m.",stair_up_note_plain:"The stair starts at the marked front edge and rises towards the back.",stair_upgrade:"Set the shape",stair_upgrade_hint:"Turns this into a stair with a shape (winding, L, U, spiral), build, railing and number of steps.",floor_lights:"{n} lights on",floor_open:"{n} open",floor_persons:"{n} people",energy_consumption:"Consumption",energy_grid_import:"Grid import",energy_grid_export:"Export",energy_solar:"Solar",energy_battery:"Battery",energy_tariff:"Tariff",energy:"Energy",energy_meter:"Meter",energy_grid:"Grid (W, + = import)",energy_solar_sensor:"Solar production (W)",energy_battery_sensor:"Battery power (W, + = discharging)",energy_battery_soc:"Battery charge (%)",energy_tariff_sensor:"Tariff (e.g. \u20AC/kWh)",energy_gas:"Gas meter (optional)",energy_water:"Water meter (optional)",energy_meters_hint:"Gas and water show with the house's balance \u2013 in the energy bar and on the house card: a sensor with the flow now (m\xB3/h, l/min) or today's reading.",energy_gas_short:"Gas",energy_water_short:"Water",energy_invert:"Invert sign",energy_hint:"Consumers are placed devices with a power sensor (W) \u2013 the sensor itself or one of the same device.",energy_balance:"Energy balance",energy_balance_hint:"Grid, solar and battery come from the devices in the plan: meter, inverter and home battery. Here you can choose other sensors, flip signs and set the house consumption.",energy_rest:"Common (rest)",energy_advanced:"Advanced energy mode",energy_advanced_on:"Use sub-meters",energy_show_unmetered:"Show unmetered use at sub-meters",energy_show_unmetered_hint:"A sub-meter's label then shows what its floors use and how much of it no placed device measures, e.g. \u201C500 W \xB7 450 W unmetered\u201D. Otherwise it shows the meter's reading.",energy_advanced_hint:"For sub-meters, e.g. one per flat behind a main meter: a meter can then hang off another one and feed its own floors. Off = the first meter is the grid connection, further ones are consumers.",energy_consumption_sensor:"House consumption (W, else from the balance)",energy_import_prefs:"Take over from the energy dashboard",energy_import_done:"{n} sensors taken over \u2013 please check the signs.",energy_import_none:"No matching power sensors (W) were found in the energy dashboard \u2013 please choose them by hand.",energy_import_failed:"Home Assistant's energy dashboard is not set up.",tool_meter:"Meter",hint_meter:"Tap the spot of the meter",presence:"Presence",ble:"Bluetooth locating",ble_hint:"Locate a Bluetooth tag (key fob, watch, phone) by room: walk through the rooms with it and record each room. NextFloor then compares how strongly Home Assistant's Bluetooth scanners (ESPHome proxies, Shelly devices with Bluetooth switched on, adapters on the server) hear it. Every tag gets a sensor whose state is the room name.",ble_unavailable:"Home Assistant's Bluetooth integration is not running. Without it there are no scanners.",ble_scanners:"{n} Bluetooth scanners in Home Assistant. The more scanners in different rooms, the more exact.",ble_add:"Add a tag or device",ble_trackers:"Phones and watches (Private BLE Device)",ble_devices:"Bluetooth devices found",ble_name:"Name (optional)",ble_refresh:"Reload the list",ble_add_button:"Add",ble_learn:"Learn rooms",ble_close:"Close",ble_spots:"{n} recordings",ble_now:"Now",ble_unknown:"unknown",ble_none_heard:"No scanner hears the tag right now. Hold it near a scanner and wait a moment; a tag only sends every few seconds.",ble_no_address:"This phone or watch has no known address right now. Check Home Assistant's Private BLE Device integration.",ble_one_scanner:"Only one scanner hears the tag. Telling rooms apart takes at least two, better three or more.",ble_learn_room:"Record a room",ble_record:"Record ({s} s)",ble_recording:"Recording \u2026 {s} s left",ble_forget_room:"Forget the room",ble_learn_hint:"Pick the room, press Record and walk slowly through the whole room with the tag in your hand, into the corners too. Recording again replaces the room. Learn every room you want to locate the tag in.",ble_sensor_hint:`The sensor "{name}" (device NextFloor) shows the room. Under Presence you can pick it as a person's room sensor.`,presence_hint:"Room sensor per person (e.g. ESPresense, Bermuda): its state names the room or area.",presence_sensor:"Room sensor",presence_room:"Default room",presence_room_none:"\u2013 none \u2013",presence_add:"Another entity (helper switch, tracker)",no_persons:"There are no people in Home Assistant."},io=globalThis,no=globalThis.__NF_SHARED_TEXTS__?io.__nextfloorBuiltin?.de??{}:Kh,ro=globalThis.__NF_SHARED_TEXTS__?io.__nextfloorBuiltin?.en??{}:Gh;io.__nextfloorBuiltin??={de:no,en:ro};var Za=()=>typeof w=="object"&&w||{},Uh=globalThis,Sr=Uh.__nextfloorTexts??=new Map;function Ya(n){let e=n.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in Za()?e:void 0}function Ja(n){let e=Ya(n),t=e===void 0?void 0:Sr.get(e);return t instanceof Promise?void 0:t}function $r(n,e){let t=Ya(n?.language??navigator.language);if(t===void 0)return!1;let r=Sr.get(t);return r===void 0&&(r=fetch(new URL(`./lang/${t}.json?v=${Za()[t]}`,import.meta.url)).then(i=>i.ok?i.json():{}).catch(()=>({})).then(i=>{Sr.set(t,i&&typeof i=="object"?i:{})}),Sr.set(t,r)),r instanceof Promise?(r.then(()=>e.requestUpdate()),!0):!1}function Qa(n,e){return Ja(n)?.[e]}function $(n,e,t={}){let r=n?.language??navigator.language,i=r.startsWith("de"),o=(i?void 0:Ja(r)?.[e])??(i?no:ro)[e]??ro[e]??no[e]??e;for(let[s,a]of Object.entries(t))o=o.replace(`{${s}}`,String(a));return o}function L(n,e,t=2){return e.toLocaleString(n?.language??void 0,{maximumFractionDigits:t})}var Xa={light:"M8.5 17.5h7M9.5 20.5h5M12 2.5a6.5 6.5 0 0 0-3.5 12v1.5h7V14.5A6.5 6.5 0 0 0 12 2.5z",switch:"M6 5h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM12 7.5v9M9 12h6",fan:"M12 11.5c-1-3.5 0-7 2.5-7s2 4-2.5 7zm.5.5c3.5-1 7 0 7 2.5s-4 2-7-2.5zm-.5.5c1 3.5 0 7-2.5 7s-2-4 2.5-7zm-.5-.5c-3.5 1-7 0-7-2.5s4-2 7 2.5z",cover:"M3.5 3.5h17v3h-17zM6 6.5v12M18 6.5v12M8.5 9.5h7M8.5 12.5h7M8.5 15.5h7",climate:"M12 15V5.5a2.5 2.5 0 0 0-5 0V15a4.5 4.5 0 1 0 5 0zM9.5 9v7M15 5.5h5M15 9.5h4",media:"M3.5 5.5h17v11h-17zM8 20.5h8M12 16.5v4M10 8.5v5l4.5-2.5z",lock:"M5.5 10.5h13v9.5h-13zM8 10.5V7.5a4 4 0 0 1 8 0v3M12 14v3",sensor:"M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM12 7.5v4.5l3.5 2",binary:"M5.5 20.5v-17h10v17M3.5 20.5h14M9 20.5v-13h4.5v13M12.5 14h.01",scene:"M5.5 18.5l8-8M14 3.5l1 2.5 2.5 1-2.5 1-1 2.5-1-2.5-2.5-1 2.5-1zM18.5 12l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z",script:"M8.5 3.5h8.5a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H7.5a2 2 0 0 1-2-2v-2h9M8.5 3.5a2 2 0 0 0-2 2v10M9.5 8.5h6M9.5 11.5h4"},Mr=n=>Xa[n];function De(n){return``}function Ct(n){return``}function jh(n){let e=n?.attributes;return{temperature:"\u{1F321}",humidity:"\u{1F4A7}",carbon_dioxide:"\u2601",illuminance:"\u2600",power:"\u26A1",energy:"\u26A1"}[String(e?.device_class)]??(e?.unit_of_measurement==="\xB0C"?"\u{1F321}":"\u25C9")}function Ar(n,e=[]){return e.flatMap(t=>{if(!t.entity||t.entity==="none")return[];let r=n.states[t.entity],i="\u2013";if(r&&!C(r)){let o=r.attributes;if(typeof o.symcon_formatted=="string"&&o.symcon_formatted.trim())i=o.symcon_formatted;else{let s=o.symcon_numeric_value??r.state,a=typeof s=="number"||typeof s=="string"&&s.trim()?Number(s):NaN;i=Number.isFinite(a)?`${L(n,a,n.entities?.[t.entity]?.display_precision??(o.symcon_variable_type===1?0:1))}${o.unit_of_measurement?` ${o.unit_of_measurement}`:""}`:String(s??"\u2013")}}return[{id:t.id,entity:t.entity,icon:t.icon?.trim()||jh(r),label:t.label?.trim()||O(n,t.entity),text:i}]})}function yn(n,e=[]){return Ar(n,e).map(t=>`${t.icon} ${t.label&&e.find(r=>r.id===t.id)?.label?`${t.label}: `:""}${t.text}`).join(" \xB7 ")}function el(n,e,t){let r=e.color_entity&&e.color_entity!=="none"?e.color_entity:t;return r?n.states[r]:void 0}function Er(n,e){if(n.animations_enabled===!1||e?.state!=="on")return;let t=e.attributes.effect;if(typeof t!="string"||!n.effect_animations||!Object.prototype.hasOwnProperty.call(n.effect_animations,t))return;let r=n.effect_animations[t];return r==="rainbow"||r==="pulse"||r==="flicker"||Vs(r)?r:void 0}var it=(n,e)=>$(n,e),qh=(n,e)=>it(n,e?"state_on":"state_off");function Rr(n,e){let t=`state_${e}`,r=$(n,t);return r===t?e:r}var Zh=new Set(["door","window","opening","garage_door"]),Yh=new Set(["playing","paused","on","idle"]);function Jh(n,e){if(e.state!=="on")return it(n,"state_off");let t=e.attributes.brightness;return typeof t=="number"?`${Math.round(t/255*100)} %`:it(n,"state_on")}function tl(n,e){let t=e.attributes.current_position,r=e.state==="opening"||e.state==="closing";return typeof t=="number"&&!r?`${t} %`:Rr(n,e.state)}function Qh(n,e){let t=e.attributes.current_temperature,r=typeof t=="number"?`${L(n,t,1)} ${n?re(n):"\xB0C"}`:null;return e.state==="off"?r?`${r} \xB7 ${it(n,"state_off")}`:it(n,"state_off"):r??Rr(n,e.state)}function Xh(n,e){let t=[e.attributes.app_name,e.attributes.media_title,e.attributes.source].find(r=>typeof r=="string"&&r!=="");return Yh.has(e.state)&&t?t:Rr(n,e.state)}function em(n,e){let t=e.state==="on";return Zh.has(String(e.attributes.device_class))?it(n,t?"state_open":"state_closed"):it(n,t?"state_detected":"state_clear")}function tm(n,e,t=new Date){let r=new Date(e.state);if(Number.isNaN(r.getTime()))return"\u2013";let i=n?.language??navigator.language,s=r.toDateString()===t.toDateString()?{hour:"2-digit",minute:"2-digit"}:{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"};return new Intl.DateTimeFormat(i,s).format(r)}function nm(n,e){if(e.entity_id.startsWith("event."))return tm(n,e);let t=Number(e.state);if(!Number.isFinite(t))return e.state;let r=n?.entities?.[e.entity_id]?.display_precision??1,i=e.attributes.unit_of_measurement;return`${L(n,t,r)}${typeof i=="string"&&i?` ${i}`:""}`}function se(n,e){if(!e||C(e))return it(n,"state_unavailable");switch(P(e.entity_id)){case"light":return Jh(n,e);case"switch":case"fan":return e.entity_id.startsWith("valve.")?tl(n,e):qh(n,e.state==="on");case"cover":return tl(n,e);case"climate":return Qh(n,e);case"media":return Xh(n,e);case"lock":return Rr(n,e.state);case"binary":return em(n,e);case"sensor":return nm(n,e);default:return""}}var rm=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points))??null;function oo(n,e){return!n||e==null||e===1?n:{...n,level:Math.min(1.5,Math.max(.02,n.level*e))}}function im(n,e,t){let r=n.states[t.entity_id],i=P(t.entity_id)??Tt(t.entity_id,r);if(!i||!r)return null;let o=t.outside?null:rm(e,t.x,t.z),s=o?.area_id?n.areas?.[o.area_id]?.name:void 0,a={id:t.entity_id,floorId:e.id,roomId:o?.id??null,x:t.x,z:t.z,y:t.y??Ht(i,xe(e,t.x,t.z),t.mount??null)+(i==="light"&&(t.mount??"ceiling")==="ceiling"?0:or(e,t.x,t.z)),lamp:i==="light"?t.mount??"ceiling":null,ceiling:xe(e,t.x,t.z),rotation:t.rotation??0,icon:t.icon?De(t.icon):Ct(i),name:t.name||O(n,t.entity_id,s),ownName:t.name||void 0,showName:!!t.show_name,text:[se(n,r),yn(n,t.values)].filter(Boolean).join(" \xB7 "),active:i==="cover"&&!!t.cover_inverted!=(!!t.position&&!!t.position_inverted)&&!C(r)?!te(r):te(r),unavailable:C(r),glow:i==="light"?oo(We(r),t.glow_scale):null,effect:i==="light"?Er(t,r):void 0,show:t.marker??void 0,fixed:!!t.locked};return a.wedge=js({hass:n,entityId:t.entity_id,state:r},{floorId:e.id,roomId:a.roomId,x:a.x,z:a.z,y:a.y,rotation:a.rotation??0},t.plugin??void 0),so(n,a,r,!!t.icon)}function so(n,e,t,r){let i=Ks({hass:n,entityId:e.id,state:t});if(!i)return e;let o=i.icon&&!r?i.icon.trimStart().startsWith("t.placements.map(r=>im(n,t,r)).filter(r=>r!==null))}var rl=n=>n.floors.flatMap(e=>e.placements.map(t=>t.entity_id));function ke(n,e){n.dispatchEvent(new CustomEvent("hass-more-info",{detail:{entityId:e},bubbles:!0,composed:!0}))}function il(n,e){return n.callService(e.split(".")[0],"toggle",{entity_id:e})}function al(n,e,t=!1){if(t)return!1;if(!Array.isArray(n.screens)||!n.screens.length)return!0;let r=(e??"").trim().toLocaleLowerCase();return!!r&&n.screens.some(i=>i.trim().toLocaleLowerCase()===r)}var Nt=globalThis.__nfAnnounced??new Set;globalThis.__nfAnnounced=Nt;function ll(n){let e=`${n.time}|${n.message}`;return Nt.has(e)?!1:(Nt.add(e),Nt.size>50&&Nt.delete(Nt.values().next().value),!0)}var cl=n=>Math.min(3e4,Math.max(6e3,n.split(/\s+/).length*600+2e3));function om(){try{let n=globalThis.AudioContext??globalThis.webkitAudioContext;if(!n)return Promise.resolve();let e=new n,t=(r,i)=>{let o=e.createOscillator(),s=e.createGain();o.type="sine",o.frequency.value=r,s.gain.setValueAtTime(1e-4,e.currentTime+i),s.gain.exponentialRampToValueAtTime(.25,e.currentTime+i+.03),s.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+i+.9),o.connect(s).connect(e.destination),o.start(e.currentTime+i),o.stop(e.currentTime+i+1)};return t(880,0),t(660,.35),new Promise(r=>setTimeout(()=>{e.close().catch(()=>{}),r()},1400))}catch{return Promise.resolve()}}function sm(n,e){let t=globalThis.speechSynthesis,r=globalThis.SpeechSynthesisUtterance;if(!t||!r)return;let i=new r(e);i.lang=n.language||"en",t.cancel(),t.speak(i)}async function ul(n,e){if(await om(),e.audio)try{let t=e.audio.startsWith("/")&&n.hassUrl?n.hassUrl(e.audio):e.audio;await new Audio(t).play();return}catch{}sm(n,e.message)}function dl(n,e){return n.connection.subscribeMessage(e,{type:"nextfloor/announcements/subscribe"}).then(t=>()=>{t().catch(()=>{})},()=>()=>{})}var ol=/^(media_player|assist_satellite)\./;function am(n,e){return e?Object.values(n.entities??{}).filter(t=>!t.hidden&&(t.area_id??(t.device_id?n.devices?.[t.device_id]?.area_id:null))===e).map(t=>t.entity_id):[]}function sl(n,e){let t=n.states[e];return!t||t.state==="unavailable"?!1:e.startsWith("notify.")?n.entities?.[e]?.platform==="alexa_devices"&&e.endsWith("_announce"):t.state==="off"||t.state==="unknown"?!1:t.attributes.device_class!=="tv"}function lm(n,e,t){if(t.announce_speaker==="none")return null;if(t.announce_speaker)return t.announce_speaker;if(e&&t.points.length>=3){let o=[...e.placements.filter(s=>ol.test(s.entity_id)).map(s=>({id:s.entity_id,x:s.x,z:s.z})),...e.furniture.filter(s=>s.entity&&ol.test(s.entity)).map(s=>({id:s.entity,x:s.x,z:s.z}))].find(s=>H([s.x,s.z],t.points)&&sl(n,s.id));if(o)return o.id}let r=am(n,t.area_id);for(let i of["assist_satellite.","notify.","media_player."]){let o=r.filter(s=>s.startsWith(i)&&sl(n,s)).sort()[0];if(o)return o}return null}var hl=(n,e,t)=>lm(n,e,t)!==null,ml=n=>!!n?.services?.nextfloor?.announce;var V=n=>n?.symconObjects!==void 0;function pl(n,e,t=[0,1,2,3]){let r=n?.states[e]?.attributes;return!!r?.symcon_id&&!r.symcon_source_entity&&t.includes(Number(r.symcon_variable_type))}function fe(n){return!n||n.state==="unknown"||n.state==="unavailable"?null:n.attributes.symcon_value??n.attributes.symcon_numeric_value??n.state}function ge(n){let e=fe(n);if(e===null||typeof e=="boolean"||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function le(n){let e=fe(n);if(e===null)return null;if(typeof e=="boolean")return e;if(typeof e=="number")return e>0;let t=String(e).trim().toLowerCase();if(["on","true","1","home","open","an","ein","ja","regen","rain","wet","nass"].includes(t))return!0;if(["off","false","0","not_home","closed","aus","nein","trocken","dry"].includes(t))return!1;let r=Number(t);return t!==""&&Number.isFinite(r)?r>0:null}function Fe(n){return fe(n)===null?"\u2013":String(n?.attributes.symcon_formatted??fe(n))}var fl=[{key:"supply_vsr",label:"Zuluft-VSR",types:[0,1,2],control:!0},{key:"extract_vsr",label:"Abluft-VSR",types:[0,1,2],control:!0},{key:"supply_temperature",label:"Zulufttemperatur",types:[1,2]},{key:"extract_temperature",label:"Ablufttemperatur",types:[1,2]},{key:"reheat",label:"NHR (Nachheizregister)",types:[0,1,2],control:!0},{key:"status",label:"Raumstatus",types:[1]}];var ye=J` +{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side",flip_swing:"Reverse opening direction",flip_swing_hint:"The door swings into the room or to the other side",main_leaf:"Main leaf (seen from the room)",contact_main:"Contact main leaf",contact_second:"Contact second leaf",tool_outdoor:"Outdoor",tool_measure:"By measure",hint_measure:"Tap the starting point, then type the wall lengths with their direction on the right",measure:"Room by measure",measure_start:"Tap the starting point in the plan, e.g. a room corner.",measure_from:"Start at {x} / {z} m \u2013 tapping moves the start.",measure_length:"Length of the next wall (m)",measure_close:"Close room",measure_undo:"Remove last wall",measure_gap:"Gap to the start: {gap} m (joined when closing)",measure_hint:"Tip: type a length and press an arrow key. With measured inside dimensions, use \u201CClose gaps\u201D afterwards.",rect_by_size:"Rectangle by size",rect_add:"Add rectangle",dir_up:"Up",dir_down:"Down",dir_left:"Left",dir_right:"Right",hint_outdoor:"Drag to draw an outdoor area (lawn, terrace, pool \u2026)",outdoor:"Outdoor area",outdoor_type:"Type",outdoor_height:"Height (m)",outdoor_offset:"Height offset (m, \u2212 = lower)",outdoor_opacity:"Opacity (%)",outdoor_opacity_hint:"100 = solid. Less makes the area see-through, such as a driveway above a cellar; the outline stays.",outdoor_outline:"Show the outline",outdoor_outline_hint:"Unticked, the area draws no glowing line along its edge \u2013 for large plots made of several lawns.",outdoor_corners_hint:"Corners: a + on an edge adds a corner, dragging shapes the area, \xD7 removes a corner.",outdoor_hint:"Outdoor lights (path light, garden spot, outdoor wall light) light all outdoor areas and the facade.",out_lawn:"Lawn",out_terrace:"Terrace",out_path:"Path",out_driveway:"Driveway",out_pool:"Pool",out_bed:"Flower bed",out_hedge:"Hedge",out_fence:"Fence",out_wild:"Wild patch",out_pergola:"Pergola / frame",outdoor_open:"Open (leave out the last edge)",outdoor_open_hint:"The edge from the last point back to the first is not drawn \u2013 a fence or pergola leaning against the house.",fence_gates:"Gates in the fence",gate_add:"+ Gate in the fence",gate_edge:"Fence side",gate_kind:"Kind",gate_single:"Garden gate",gate_double:"Double gate",gate_sliding:"Sliding gate",gate_offset:"Middle from the start (m)",gate_width:"Width (m)",gate_entity:"Motor or switch",gate_contact:"Contact (on = open)",fence_gates_hint:"A gate is a gap in the fence with gate posts and a leaf. With a motor (cover, switch, input_boolean, lock) and/or a contact it opens in 3D: garden and double gates swing inwards, a sliding gate runs along the fence.",outdoor_bracing:"X-bracing",outdoor_cut:"Cut out of surrounding areas",outdoor_cut_hint:"Every area that contains this one whole gets a hole here \u2013 a pool in the terrace, a pond or a wild patch in the lawn. The drawing order does not matter. A pool cuts itself out on its own.",outdoor_area_hint:"The Home Assistant area of this surface (garden, terrace, pool): its devices and sensors are listed under Outside, and a pin on the surface opens it.",pool_temp:"Water temperature (optional)",pool_pump:"Pump / filter (optional)",pool_pump_on:"pump on",outdoor_slope:"Slope (m)",outdoor_slope_hint:"Height difference from the high edge to the low edge; the high edge sits at the height offset. Lamps on the area follow.",outdoor_slope_dir:"Falls towards",slope_x:"right (+X)",slope_nx:"left (\u2212X)",slope_z:"down (+Z)",slope_nz:"up (\u2212Z)",north:"North (\xB0 clockwise from up)",north_hint:"North is needed for the sun (light through the windows).",map_on:"Show a real map under the plan",map_lat:"Latitude",map_lon:"Longitude",map_use_ha:"Use Home Assistant's location",map_opacity:"Visibility (%)",map_zoom:"Detail level",map_zoom_coarse:"coarse",map_zoom_fine:"fine",map_move:"Move the map under the plan",map_step:"Step",map_url:"Own tile address (empty = OpenStreetMap)",map_hint:"Your browser loads the map tiles straight from the map server (OpenStreetMap by default, please mind their usage policy); nothing is loaded while the map is off. The plan lies on the map as the compass says \u2013 turn the compass or move the map until the house fits.",compass_title:"Compass",compass_n_short:"N",compass_s_short:"S",compass_swap:"Swap north \u2194 south",compass_swap_hint:"Turns the compass by 180\xB0. The drawing, roof faces and solar fields stay as they are.",compass_hint:"If the compass does not match reality, turn it here \u2013 nothing has to be redrawn. Sunlight, wind and the compass directions of roof faces follow it.",roof:"Roof",roof_none:"No roof",roof_flat:"Flat roof",roof_gable:"Gable roof",roof_custom:"Roof sections (custom)",roof_sections:"Roof sections",roof_sections_hint:"Each roof section covers a rectangle of the house, e.g. the house, the barn or an extension \u2013 each with its own shape, ridge direction, eave height and pitch. Drag in the plan to draw a new one; tap selects it, dragging moves it, the corners resize it.",roof_sections_start:"Create roof sections from the rooms",roof_sections_regen:"Create again from the rooms",roof_sections_off:"Back to one roof",roof_regen_confirm:"Replace all roof sections with a new proposal from the rooms?",roof_section:"Roof section",roof_section_hint:"Heights count from the ground. A side with a lower eave reaches further down (catslide); pent roofs rise from the first side.",roof_shape_gable:"Gable",roof_shape_hip:"Hip",roof_shape_pent:"Pent",roof_shape_flat:"Flat",roof_shape_halfhip:"Half-hip",roof_shape_pyramid:"Pyramid",roof_shape_mansard:"Mansard",roof_shape_parapet:"Parapet",roof_shape:"Shape",roof_end_start:"End at the ridge start",roof_end_end:"End at the ridge end",roof_halfhip:"Half-hip starts at",roof_halfhip_hint:"How high up the gable the hipped part starts, as a share of the gable's height: low = a large hip, high = only the tip is hipped.",roof_axis_x:"Ridge \u2194",roof_axis_z:"Ridge \u2195",roof_eave:"Eave (m)",roof_pitch_short:"Pitch (\xB0)",roof_height:"Height (m)",roof_base:"Top of walls (m)",roof_rotation:"Turn (\xB0)",roof_on_floor:"Sits on floor",roof_on_floor_hint:"Puts the section on this floor's wall tops; base and eaves move along. In the 3D view the roof belongs to this floor.",roof_base_hint:"Below the ceiling height of the floor underneath, that floor's walls end under the roof: knee walls at the eaves, gables up to the ridge, inner walls cut by the slope. Dashed lines in the plan show where 1.5 m and 2 m of headroom remain.",roof_ridge_height:"Ridge height",roof_side_top:"top",roof_side_bottom:"bottom",roof_side_left:"left",roof_side_right:"right",roof_swap:"Swap sides",roof_open:"Canopy (posts instead of walls, see-through)",roof_open_short:"Canopy",roof_dormer:"Dormer",roof_dormer_hint:"A dormer on this side of the roof: 2 m wide, its front at the eave wall, eaves 1.4 m above the roof's eave, gable roof. Then move it and change its width and heights like any section; the main slope opens under it and the attic wall rises up to the dormer \u2013 a window fits there.",roof_outline:"Take the floor's outline",roof_outline_hint:"A flat roof as a free shape: takes the outline of the shown floor's rooms (L- or Z-shaped too) as one surface without seams. The corners can be dragged afterwards.",roof_points_hint:"Free shape: drag the corners in the plan, a + on an edge adds a corner, \xD7 removes one. Back to the rectangle drops the shape.",roof_rect:"Back to the rectangle",roof_open_hint:"For a terrace roof or a carport: posts and beams carry the roof instead of walls, and it is see-through. Where the canopy meets the house wall, it rests on the wall.",roof_swap_hint:"Turns the roof round: the two sides swap eave and pitch, a pent roof rises the other way.",roof_pitch:"Roof pitch (\xB0)",roof_overhang:"Roof overhang (m)",roof_overhang_sides:"Overhang per side",roof_overhang_a:"Overhang eave A (m)",roof_overhang_b:"Overhang eave B (m)",roof_overhang_u0:"Overhang gable start (m)",roof_overhang_u1:"Overhang gable end (m)",roof_overhang_auto:"Back to automatic",roof_overhang_sides_hint:"Without values of your own the overhang is automatic: the same everywhere, except where the roof part meets the house (none there).",roof_ridge:"Ridge",roof_ridge_long:"Along the long side",roof_ridge_short:"Along the short side (e.g. terraced house)",device:"Device",lamp_mount:"Lamp",lamp_ceiling:"Ceiling light",lamp_floor:"Floor lamp",lamp_table:"Table lamp",lamp_wall:"Wall light",marker_height:"Marker height (m)",height_auto:"Automatic height",device_centre:"To room centre",lights_spread:"Spread ceiling lights evenly",devices_search:"Search devices \u2026",devices_more:"+{n} more",devices_less:"less",panel_more:"More devices of the area ({n})",panel_less:"Show less",gaps_close:"Close gaps",gaps_hint:"Join rooms up to 60 cm apart at one shared wall; the gap becomes the interior wall thickness.",gaps_none:"No gaps between rooms found.",gaps_closed:"{n} places closed.",gaps_closed_wall:"{n} places closed, interior wall now {t} m.",fps:"FPS",fps_title:"Performance display (frames per second)",hint_garage:"Tap a wall to add a garage door",opening_garage:"Garage door",garage_hint:"The door follows a garage cover (position or open/closed) or a garage door contact of the room's area.",door_hint:"With a door contact the leaf swings open; without a sensor it stands half open.",hint_door:"Tap a wall to add a door",hint_window:"Tap a wall to add a window",opening_door:"Door",opening_window:"Window",opening_type:"Type",opening_position:"Centre from corner (m)",sill:"Sill height (m)",opening_height:"Height (m)",hinge:"Hinge (seen from the room)",hinge_left:"Left",hinge_right:"Right",cover_entity:"Blind",door_cover:"Drive (motorised door or gate)",cover_position_entity:"Position sensor (live)",cover_position_invert:"Reverse position sensor in 3D (0 = open)",contact_entity:"Contact",sensor_kind:"Sensor type",sensor_kind_contact:"Window contact (open/closed)",sensor_kind_handle:"Handle sensor (open/tilted/closed)",sensor_kind_contact_tilt:"Contact + tilt sensor",handle_entity:"Handle sensor",handle_main:"Handle sensor main leaf",leaf_main:"Main leaf",leaf_second:"Second leaf",tilt_entity:"Tilt sensor",tilt_angle_entity:"Tilt angle sensor (\xB0, optional)",tilt_angle_max:"Angle that counts as fully tilted (\xB0)",tilt_angle_offset:"Offset: angle reported while closed (\xB0)",tilt_angle_invert:"The angle counts the other way round",door_shut:"Show closed without a sensor",door_shut_hint:"A door without a contact stands half open in 3D so it reads as a door. Ticked, it is drawn closed \u2013 front door, carport, side door.",door_angle:"Opening angle",door_angle_default:"Default",door_angle_hint:"How far the leaf opens. With a sensor it opens that far once it reports open; without one it stands that far open (instead of half). Default stays as before.",entity_auto:"Automatic ({name})",entity_auto_none:"Automatic (none found)",entity_none:"None",entity_search:"Type to search \u2026",opening_hint:`Sensor type: window contact (reports open/closed), handle sensor (reports open, tilted and closed \u2013 e.g. a Homematic window handle) or contact + tilt sensor (a second sensor that only reports tilted). Automatic uses the blinds and contacts of the room's area. Position sensor: an entity reporting the blind's position while it moves (e.g. a Homematic "level", 0\u2013100 % or 0\u20131, open = high) \u2013 the blind then moves live in 3D.`,furniture:"Furniture",furniture_add:"Add furniture",studio_new:"Build your own piece",studio_title:"Furniture studio",studio_title_edit:"Furniture studio: change",studio_hint:'Pick a template, set its measurements and fronts and put the piece into the plan. It goes into the "Own furniture" pack and can be changed here again later.',studio_kind:"Template",studio_kind_cabinet:"Cabinet",studio_kind_shelf:"Shelf",studio_kind_lamp:"Lamp",studio_kind_device:"Device",studio_name:"Name",studio_width:"Width (cm)",studio_depth:"Depth (cm)",studio_height:"Height (cm)",studio_doors:"Doors",studio_drawers:"Drawers",studio_shelves:"Shelves",studio_handle:"Handles",studio_handle_bar:"Bar",studio_handle_knob:"Knob",studio_handle_none:"None",studio_base:"Base",studio_base_plinth:"Plinth",studio_base_legs:"Legs",studio_base_none:"None",studio_back:"Back panel",studio_lamp:"Kind",studio_lamp_floor:"Floor lamp",studio_lamp_table:"Table lamp",studio_lamp_pendant:"Pendant",studio_lamp_wall:"Wall light",studio_display:"Display on the front (shows the media player)",studio_mount:"Stands",studio_mount_floor:"On the floor",studio_mount_surface:"On furniture",studio_mount_wall:"On the wall",studio_color_body:"Body",studio_color_lamp_body:"Base and frame",studio_color_front:"Fronts",studio_color_boards:"Boards",studio_color_shade:"Shade",studio_color_display:"Display frame",studio_color_white:"White",studio_color_wood:"Wood",studio_color_metal:"Metal",studio_color_dark:"Dark",studio_color_glass:"Glass",studio_color_accent:"Accent",studio_color_own:"Own colour",studio_color_plan:"Colour of the plan",studio_place:"Put into the plan",studio_save:"Save the change",studio_open:"Change in the studio",studio_error:"Could not save: {detail}",studio_pack_name:"Own furniture",studio_pack_publisher:"Furniture studio",furniture_search:"Search furniture \u2026",furniture_search_none:"Nothing found. Try another word \u2013 English or German.",furniture_type:"Item",rotation:"Rotation (\xB0)",tilt_x:"Tilt front/back (\xB0)",tilt_z:"Tilt sideways (\xB0)",strip_tilt:"Tilt about its length (\xB0)",strip_upright:"Upright",strip_rise:"Rise along its length (\xB0)",strip_upright_hint:"The strip stands on end: its length runs up from the height above the floor \u2013 along a door frame, as a light column. The tilt lays a lying strip against a slope (90\xB0 = its face points sideways).",rotate_left:"\u21BA 90\xB0",rotate_right:"\u21BB 90\xB0",height_m:"Height (m)",furn_sofa:"Sofa",furn_armchair:"Armchair",furn_table:"Table",furn_chair:"Chair",furn_bed:"Bed",furn_nightstand:"Nightstand",furn_wardrobe:"Wardrobe",furn_shelf:"Shelf",furn_kitchen:"Kitchen unit",furn_worktop:"Worktop",furn_fridge:"Fridge",furn_fridge_smart:"Smart fridge (side by side)",furn_door_left:"Door sensor left (freezer side)",furn_door_right:"Door sensor right (fridge side)",fridge_hint:"While a door sensor reports open, the door swings open in 3D.",furn_stove:"Stove",furn_sink:"Sink",furn_bathtub:"Bathtub",furn_shower:"Shower",furn_wc:"WC",furn_washbasin:"Washbasin",furn_desk:"Desk",furn_tv_board:"TV board",furn_plant:"Plant",furn_rug:"Rug",furn_stairs:"Stairs",furn_stairwell:"Floor opening",stairwell_hint:"A hole in this floor, for example above the staircase or for a gallery; from above you look through it. The opening must lie within one room; several openings may overlap (for an L shape, for example). Stairs on the floor below that reach up here open the floor by themselves as well.",tool_hole:"Floor opening",tool_stairs:"Stairs",hint_stairs:"Drag where the stair should stand \u2013 it runs along the long side; set shape, turn and build on the right afterwards",tool_roof:"Roof",tool_energy:"Energy",tool_wall:"Wall",hint_wall:"Drag to draw a single wall (partition, half wall) \xB7 Shift keeps it straight \xB7 Alt without snapping",free_wall:"Wall",wall_length:"Length (m)",wall_thickness:"Wall thickness (m)",wall_height:"Height (m)",wall_height_full:"Full room height",wall_slope:"Sloping",wall_slope_start:"Height at the start (m)",wall_slope_end:"Height at the end (m)",wall_slope_hint:"Sloping wall: the top runs straight from the height at the start of the wall (the corner with the lower number) to the height at its end. Both may be above the floor height, for example for a lean-to room with high clerestory windows.",wall_slope_off:"Back to a level wall",wall_none:"No wall",wall_none_hint:"Leave this wall out altogether: for open floor plans whose rooms are one space but separate in Home Assistant.",edge_thickness:"Thickness (m)",wall_thickness_hint:"Thickness of this wall, e.g. 0.365 on a thick outer wall or 0.115 on a light partition. A wall between two rooms takes the thicker setting.",wall_thickness_reset:"Thickness as set for the house",wall_heights:"Wall heights",wall_n:"Wall {a}\u2013{b}",wall_view:"Wall view",wall_view_hint:"The wall from the front: drag its doors, windows and furniture or type their distance.",wall_view_prev:"Previous wall",wall_view_next:"Next wall",wall_view_left:"From the left (m)",wall_view_height:"Above the floor (m)",wall_part:"part {n}",wall_split_hint:"Split the wall here: the part gets a height of its own, e.g. 2.5 m next to 1.7 m in line",wall_split_at:"Split point from corner (m)",wall_join_hint:"Remove the split point: the part joins the one before it again",wall_exterior_short:"exterior wall",room_wall_hint:"A lower height turns the wall into a parapet or a counter. If two rooms share the wall, the lower setting applies. Windows and doors in it end at the wall height.",free_wall_hint:"A free-standing wall, e.g. a partition. Where it meets a room wall, the corner is mitred. Drag the handles to move its ends, drag the line to move the whole wall.",free_wall_slope:"\u25E2 Sloping",free_wall_slope_hint:"The wall gets higher or lower from one end to the other: the height above is at its start, the one here at its end.",free_wall_height_end:"Height at the end (m)",arc:"Arc",arc_hint:"Bends the wall into an arc. A room sharing the wall bends along, doors and windows move with it; Undo takes the arc back.",arc_bulge:"Bulge (m)",arc_bulge_hint:"How far the middle of the wall bulges: positive outwards, negative into the room.",arc_apply:"Bend",arc_too_wide:"A door or window in this wall is too wide for this curve. Make the curve flatter or the opening narrower.",stairwell_outside:"This opening reaches across a room boundary and is therefore not cut. Move it fully into one room or make it smaller.",hint_hole:"Drag to draw a floor opening (stairwell, gallery)",hint_roof:"Drag to draw a roof section \xB7 tap selects \xB7 drag moves \xB7 corners resize",hint_energy:"Tap a solar field to select it \xB7 drag to move it, also onto another roof face \xB7 new fields with + Solar field on the right",furn_parking:"Parking spot",furn_group_vehicles:"Parking",parking_entity:'Sensor "car present"',parking_vehicle:"Vehicle",parking_vehicle_none:"None",parking_no_pack:'No vehicle pack imported \u2013 vehicles come from the "Vehicles" pack (Extensions \u2192 Furniture packs).',parking_scale:"Size (%)",parking_type_entity:"Vehicle type sensor (optional)",parking_types:"State \u2192 vehicle",parking_type_state:"State (e.g. van)",parking_add_type:"+ Mapping",parking_hint:'Without a sensor the vehicle always stands there. With one it appears as soon as the sensor reports "on", "home" or "present". A vehicle type sensor (e.g. from an AI camera analysis) picks the model: when its state matches a mapping \u2013 also as a word in the text \u2013 that vehicle is shown, otherwise the default one.',parking_too_tall:"The vehicle ({car} m) is taller than the room ({room} m).",furn_lamp_ceiling:"Ceiling light",furn_lamp_downlight:"Downlight",furn_lamp_spot:"Surface spot",furn_lamp_panel:"LED panel",furn_lamp_uplight:"Floor uplight",furn_lamp_bollard:"Path light",furn_lamp_garden:"Garden spot",furn_radiator:"Radiator",furn_robot_vacuum:"Robot vacuum",furn_entity_vacuum:"Robot vacuum",furn_entity_mower:"Robot mower",pet_room_sensor:"The pet's room sensor (optional)",pet_room_hint:"A sensor naming the room the pet is in \u2013 Bermuda or ESPresense with a tag on its collar: in 3D it then roams that room.",furn_entity_water:"Valve or switch",device_temp:"Device temperature",device_temp_hint:"A temperature sensor of the device (inverter, battery, PC \u2026): its value shows on the pin in the 3D view, from 60 \xB0C the pin is highlighted.",fridge_temp:"Fridge temperature",freezer_temp:"Freezer temperature",fridge_temp_hint:"The pin shows the temperatures. Above 8 \xB0C in the fridge or \u221212 \xB0C in the freezer it lights up as a warning.",spray_reach:"Reach of the water (m)",spray_hint:"While the valve is open or the switch is on, the sprinkler throws water in arcs around it.",furn_robot_room:"Current room (sensor)",robot_cal_none:"Not calibrated yet \u2014 with nothing tying the robot's grid to the plan, the lanes stay invented.",robot_cal_done:"Calibrated: one map cell measures {m} m.",robot_cal_do:"Calibrate from where the robot is now",robot_cal_doing:"Tap the plan where the robot is right now.",robot_cal_need:"The robot's map is not reporting a position \u2014 is the integration running?",robot_cal_hint:"The dock is the anchor: the plan knows where it stands, the camera knows where the robot and its dock lie in their grid. If the map names its rooms like the plan does, \u201CCalibrate from the rooms\u201D is all it takes. Otherwise: stop the robot at least 1.5 m away \u2014 pause the clean \u2014 and tap it on the plan. If the rooms come out flipped, set the tick.",robot_cal_mirror:"The robot's map is mirrored (rooms come out flipped)",robot_cal_forget:"Remove the calibration",robot_cal_nudge:"Fine-tune by hand: the arrows move the map by 10 cm, \u27F2 \u27F3 turn it by 1\xB0, \u2212 + change its size by 1 %.",robot_cal_nudge_move:"Move the map",robot_cal_nudge_turn:"Turn the map",robot_cal_nudge_grow:"Make the map larger or smaller",robot_cal_rooms:"Calibrate from the rooms (the map knows {n} rooms)",robot_cal_rooms_none:"Too few rooms have the same name in the plan as on the robot's map ({n} found, at least 2 needed). Name them alike \u2014 or calibrate from the robot's position.",robot_cal_rooms_bad:"The rooms with matching names lie differently in the plan than on the robot's map \u2014 is a room mixed up? Otherwise calibrate from the robot's position.",robot_hint:"While the robot cleans in Home Assistant it drives lanes in 3D through the room it reports (a \u201Ccurrent room\u201D sensor, matched by room or area name), else through the room of its dock. With the robot's own map calibrated below, the track shows where it has really driven instead; without it the lanes are a guess. It drives back to the dock when it returns.",furn_lamp_pendant:"Pendant light",furn_ceiling_fan:"Ceiling fan",furn_fan_entity:"Fan",fan_hint:"The light is the fan's light kit (leave it empty if it has none). The fan is found in the room or chosen here: in 3D the blades turn as fast as it runs, its icon switches it, swiping up/down changes the speed, a long press opens the quick menu. The height is how far it hangs from the ceiling (more = a longer downrod).",room_ceiling:"Ceiling height",room_ceiling_tip:"Lower than the floor (a bathroom under the stairs) or higher (a living room open up to the roof): ceiling lights, fans, LED strips and ceiling devices hang from here, and the room's walls are this high.",room_ceiling_through:"The ceiling ({ceiling} m) is above the floor height ({floor} m): the room reaches into the floor above, its walls rise with it, and the floor above stays open over it. The editor of the upper floor shows the area hatched.",room_floor_offset:"Floor level (m)",room_floor_offset_hint:"When this room's floor lies lower or higher than the floor (a sunken entrance: \u22120.39), its floor, walls, doors and windows and what stands in it move with it; its ceiling stays. Add the steps as a stair.",room_inner:"Inside {w} \xD7 {d}",room_inner_hint:"Measured from wall to wall: inner walls take half their thickness, outer walls stand outside the outline.",floor_heating:"Underfloor heating (optional)",floor_heating_hint:"While the thermostat heats (or the valve is open, the switch on), the room's floor glows warm in 3D.",room_announce_speaker:"Speaker for announcements",room_announce_quiet:"Quiet time for announcements",room_announce_hint:"Without a choice, the speaker placed in the room talks, else a voice assistant, an Echo or a speaker of its area (never a TV). During the quiet time, announcements to several rooms leave this room out; one meant only for it still gets through.",ceiling_here:"Ceiling here",ceiling_here_hint:"Height of the ceiling right at this spot, e.g. in a sloping ceiling. Empty = the room's ceiling.",ceiling_slope:"Up to the roof slope",ceiling_slope_hint:"The ceiling here lies under the roof slope: the lamp hangs from its underside, right above where it stands.",furn_lamp_floor:"Floor lamp",furn_lamp_table:"Table lamp",furn_lamp_wall:"Wall light",furn_led_strip:"LED strip",furn_group_lights:"Lights",furn_entity_light:"Light or switch",furn_color_entity:"Colour and brightness from (optional)",furn_color_entity_hint:"For lights that a relay (Shelly, switch actuator) turns on and off while the bulb itself knows its colour and brightness: on/off comes from the switch above, colour and brightness from this entity.",lamp_extra_light:"Bulb {n} (optional)",lamp_extra_hint:"A fixture with several lights \u2013 main light, night light, ambient ring: while the main light is off it glows in 3D with the next light that is on, a little dimmer. Switch the lights one by one in the room panel.",furn_entity_climate:"Heating (thermostat)",lamp_hint:"Tap the lamp in 3D to switch it, long press for the quick menu. Switches work too (e.g. a relay for the ceiling light) \u2013 the lamp shines while it is on. Table lamps stand on the furniture below them.",lamp_hint_pendant:"Height = drop below the ceiling. Tap in 3D to switch, long press for details.",theme:"Look",version_hint:"Installed version of NextFloor \u2013 the frontend; the integration in Home Assistant reports {backend}",accent:"Accent colour",accent_hint:"An accent colour of your own: lines and glowing edges in the neon look, buttons and pins \u2013 \u21BA brings the neon cyan back",accent_reset:"Back to cyan",furn_colors_card:"Furniture colours of this card",furn_color_house:"House colour",theme_neon:"Neon",theme_blueprint:"Blueprint",theme_day:"Day",theme_auto:"Auto",clock:"Clock",clock_none:"None",clock_top_left:"Top left",clock_top_right:"Top right",clock_bottom_left:"Bottom left",clock_bottom_right:"Bottom right",glass_walls:"Glass walls",glass_walls_hint:"How opaque the walls you look through into the rooms are: left almost invisible, right opaque. For this screen.",screen_name:"Name of this screen",screen_name_hint:'Announcements show on every open NextFloor screen. With a name (e.g. "Hallway"), an announcement can go to this screen only. Unticked, this screen stays silent.',announce_on:"Announcements on this screen are on",announce_muted:"Announcements on this screen are muted",lock3d_on:"Lock 3D (no turning, zooming or panning; taps still work)",lock3d_off:"Unlock 3D",walk:"Walk through the house",travel:"Time travel: replay the last 24 hours or 7 days",travel_play:"Play",travel_pause:"Pause",travel_loading:"Loading history \u2026",travel_failed:"The history could not be loaded.",travel_speed:"Speed",travel_speed_min:"1 min/s",travel_speed_10min:"10 min/s",travel_speed_hour:"1 h/s",travel_days:"days",travel_live:"Live",card_travel_button:"Button for time travel",walk_stop:"Stop walking",walk_hint:"Drag: look around \xB7 W A S D / arrows or stick: walk \xB7 wheel: step",card_walk_button:"Button to walk through",card_lock_button:"Button for the 3D lock",backdrop:"Own background",backdrop_color:"Colour",backdrop_image:"Picture (/local/\u2026 or https://\u2026)",backdrop_dim:"Dim",backdrop_hint:"Instead of the look's sky the house stands in front of a colour or a picture of your own. A picture in /config/www is reachable at /local/\u2026.",furnish:"Furnish",split_3d:"3D beside",plan_dims:"Measurements",plan_dims_hint:"Labels every room edge with its length.",mount_height:"Height above the floor (m)",side_open:"Open the sidebar",side_close:"Close",side_details:"Details of the selection",side_pin:"Pin",side_pinned:"Pinned",side_pin_hint:"Pinned, the sidebar stays open; otherwise it folds away beside the 3D view while nothing is selected",split_3d_hint:"Live 3D next to the plan: drag and turn furniture and devices there \u2013 with undo, saved with the plan",size_w:"Width (m)",size_d:"Depth (m)",size_h:"Height (m)",furnish_hint:"Drag furniture, lamps and devices \xB7 furniture snaps to walls \xB7 tap one to turn it, set its height and mount",done:"Done",heatmap:"Heatmap",heat_off:"Normal",heat_short_temperature:"Temp.",heat_short_humidity:"Humidity",heat_short_co2:"CO\u2082",heat_short_mould:"Mould",heat_short_power:"Power",heat_short_comfort:"Comfort",heat_short_sun:"Sun",heat_short_wifi:"Wi-Fi",heat_short_values:"Values",heat_temperature:"Temperature",heat_humidity:"Humidity",heat_co2:"CO\u2082",heat_mould:"Mould",heat_power:"Power use",heat_comfort:"Comfort score",heat_sun:"Sun today",room_sun_hours:"{h} h of sun today ({facing})",open_since:"open for {time}",presence_now:"someone here",presence_last:"last seen {time} ago",comfort_n:"Comfort {n}",empty_lights_hint:"{n} lights on, nobody here for {min} min.",empty_lights_off:"Lights off",open_heating_hint:"{n} windows open while the heating runs.",open_heating_off:"Heating off",room_clean:"Cleaning (script or button)",room_clean_hint:`A script or button that sends the robot vacuum to this room (e.g. your robot integration's room cleaning). The room panel then shows "\u{1F9F9} Clean".`,room_clean_run:"Clean",room_clean_run_hint:"Sends the robot vacuum to this room.",shade_hint:"Sun on {n} windows at {temp} \u2013 lower the blinds?",shade_close:"Lower",room_sun_year:"Sun over the year",room_sun_year_hint:"The hours of sun through the room's outside windows on the 15th of every month.",room_energy:"today {today} \xB7 month {month}",room_energy_hint:"From the statistics of the power sensors of the room's devices; the month's cost at the house's tariff.",heat_summer:"summer",heat_winter:"winter",air_co2:"air it (CO\u2082)",air_humidity:"air it (damp)",air_mould:"risk of mould \u2013 air it",room_curve_hint:"The room's temperature over the last 24 hours",heat_values:"Values at the room names",heat_wifi:"Wi-Fi",wifi_aps:"{n} access points \xB7 {clients} devices",wifi_network:"Network: {online} online \xB7 {offline} offline",wifi_none:"Place access points or routers from the packs (Smart home 2) and link them to an entity of their device.",wifi_clients:"{n} devices",heat_none_found:"No matching sensors in the rooms' areas.",markers:"Markers",markers_none:"None",markers_important:"Important",markers_all:"All",furn_stool:"Stool",furn_coffee_table:"Coffee table",furn_tv_wall:"TV (wall)",furn_sideboard:"Sideboard",furn_table_round:"Round table",furn_bench:"Bench",furn_corner_bench:"Corner bench",furn_bar_stool:"Bar stool",furn_kitchen_wall:"Wall cabinet",furn_kitchen_tall:"Tall unit with oven",furn_island:"Kitchen island",furn_dishwasher:"Dishwasher",furn_bunk_bed:"Bunk bed",furn_dresser:"Chest of drawers",furn_washer:"Washing machine",furn_dryer:"Dryer",furn_office_chair:"Office chair",furn_tall_cabinet:"Tall cabinet",furn_coat_rack:"Coat rack",furn_group_living:"Living",furn_group_dining:"Dining",furn_group_energy:"Energy & solar",energy_devices:"Devices",wallbox_charging:"charging",wallbox_plugged:"plugged in",furn_soc:"State of charge (%)",furn_export:"Export power (W, separate sensor, optional)",furn_export_hint:"If your meter reports import and export in two sensors (e.g. Growatt, Tibber Pulse), take the import sensor as power above and the export sensor here. A signed sensor does not need this.",meter_parent:"Hangs off meter",meter_parent_none:"none (main meter)",meter_main:"Main meter",meter_unmetered:"{w} unmetered",meter_device_hint:"If the device sits behind a sub-meter (e.g. a balcony plant in a flat), its power counts towards that flat. The sub-meter has to measure both ways for this (\u2212 = feeding back); if it only counts import, the flat's consumption comes out too high while there is a surplus.",meter_sub_power:"Power of the branch (W, + = drawn, \u2212 = fed back)",meter_floors:"Feeds the floors",meter_sub_hint:"A sub-meter measures its branch, e.g. a flat. Devices on the ticked floors hang off it in 3D instead of the main meter; what the main meter counts beyond that shows as \u201CCommon (rest)\u201D in the balance.",furn_charge:"Charging power (W, separate sensor, optional)",furn_charge_hint:"If your battery reports charging and discharging in two sensors (e.g. Anker Solix), take the discharging sensor as power above and the charging sensor here. A signed sensor does not need this.",furn_wallbox_status:"Status (charging, plugged in)",charging_data:"Charging data",charging_card:"Charging station as a floating 3D card",charging_hint:"Linked charging data appears on the floating card and in the room menu, even without a power reading. Unlinked rows stay hidden. Native date/time profiles and Integer associations retain their Symcon display. Auto detects Unix timestamps without a time profile; numeric durations without a unit use seconds. Change the format to override this. These readings are display-only.",charging_start:"Start time",charging_end:"End time",charging_duration:"Charging duration",charging_energy:"Charged energy",charging_lock:"Lock status",charging_time_format:"Time format",charging_duration_unit:"Duration unit",charging_auto:"Automatic",charging_value:"Unchanged Symcon value",charging_seconds:"Seconds",charging_minutes:"Minutes",charging_hours:"Hours",charging_unix_seconds:"Unix time (seconds)",charging_unix_ms:"Unix time (milliseconds)",energy_only_note:"\u26A1 Energy: only solar fields and energy devices can be moved here; rooms and furniture are locked.",roof_only_note:"\u{1F3E0} Roof: only roof sections and roof windows can be moved here; rooms and furniture are locked.",energy_devices_hint:"Meter, inverters, home batteries, wallboxes and the grid connection are added here: on the floor chosen above, movable in the plan. With a power sensor they show their watts; the meter takes the grid sensor, a string picks its inverter. Several inverters and batteries (say a balcony plant on top) work too: each gets its own sensor.",energy_routes:"Cable routes",energy_routes_hint:"Where a cable really runs: the flow then follows your points instead of an arc through the house. Without a route it keeps the arc. Consumers keep their arc.",route_conn_solar:"{name} \u2192 inverter",route_conn_battery:"Battery \u2194 house",route_conn_inverter:"Inverter \u2192 house",route_conn_grid:"Grid \u2194 house",route_conn_meter:"{name} \u2194 parent meter",route_conn_device:"{name} \u2194 sub-meter",route_points:"{n} points",route_none:"direct arc",route_draw:"Draw route",route_redraw:"Redraw",route_drawing:"Tap the points the cable runs through on the plan, from one end to the other; switch floors in between where it goes through a ceiling. {n} points.",route_undo:"Last point",route_done:"Done",route_cable:"Show as cable",route_cable_hint:"Draws the route as a visible cable, not just as the faint line under the particles.",solar_fields:"Solar fields",solar_hint:"Put modules on the roof: they lie in the slope of the roof face; on a flat roof they stand on frames. Drag a field in the plan to move it.",solar_no_roof:"Solar fields need a roof: a gable or flat roof under Settings, or roof sections here in the Roof tool.",solar_face_gone:"roof face missing",solar_summary:"{n} modules \xB7 {kwp} kWp",solar_add:"Solar field",solar_field:"Solar field",solar_face:"Roof face",solar_rows:"Rows",solar_cols:"Modules per row",solar_portrait:"Portrait",solar_landscape:"Landscape",solar_u:"Distance from the edge (m)",solar_v:"Distance from the eave (m)",solar_tilt:"Tilt of the frames (\xB0)",solar_rack_ew:"East-west racks",solar_rack_ew_hint:"Every second row faces the other way, the pairs stand back to back \u2013 low and close, as on many flat roofs.",solar_rack_tilt:"Rack (\xB0 more tilt)",solar_flip:"Lean the other way",solar_partial:"only {n} of {total} fit on the face",solar_form_hint:"Modules that would reach beyond the roof face are left out. \u201CFill face\u201D puts as many modules on the roof as fit. kWp counted with 400 W per module.",solar_fit:"Fill face",roof_windows:"Roof windows",roof_window:"Roof window",chimneys:"Chimneys",chimney:"Chimney",chimney_shape:"Shape",chimney_brick:"Brick",chimney_round:"Round",chimney_wide:"Wide, two flues",chimney_steel:"Steel flue pipe",chimney_diameter:"Diameter (m)",chimney_depth:"Depth (m)",chimney_height:"Height above the roof (m)",chimney_hint:"The height counts from the upper side, where the chimney leaves the roof. Drag it in the plan or in the 3D view, also onto another roof face.",roof_windows_hint:"Roof windows lie in the roof face, with a blind and contacts like windows. Drag them in the plan, also onto another roof face.",roof_window_tilt:"Tilt contact",roof_window_name:"Name (optional)",roof_window_motor:"Window motor (cover, optional)",roof_window_motor_hint:"A window motor (Velux, Roto, Fakro) reports its position as a cover: the sash opens in 3D as far as the motor stands. A contact or tilt contact still works without a motor.",roof_window_hint:"Open, the sash swings out, hinged at the top; tilted, a little; and the frame glows warm; the blind comes down over the glass from the top. In a roof section the window cuts a hole into the slope, so the attic looks out through it.",solar_ground:"Free-standing (garden, garage roof \u2026)",solar_add_ground:"Free-standing",solar_base:"Height of the surface (m, 0 = ground)",solar_add_wall:"On a wall",solar_wall:"Wall",solar_v_wall:"Height above the floor (m)",solar_tilt_wall:"Tilt away from the wall (\xB0, 90 = canopy)",solar_flip_wall:"Standing off at the bottom instead of the top",solar_rotation:"Rotation (\xB0)",solar_name:"Name",solar_name_hint:"e.g. string 1 south",solar_module_w:"Module width (m)",solar_module_h:"Module height (m)",solar_wp:"Module power (Wp)",solar_string:"String",solar_strings:"Strings",solar_string_none:"No string",solar_string_new:"New string",solar_string_n:"String {n}",solar_string_name:"Name of the string",solar_string_entity:"PV power of the string",solar_string_inverter:"Inverter",solar_string_inverter_none:"No inverter chosen",inverter_strings:"Strings on this inverter: {names}",inverter_strings_none:"No string on this inverter yet \u2013 assign it at a solar field under String \u203A Inverter.",solar_string_inverter_missing:"No inverter in the plan yet (add one below under Devices)",solar_string_hint:"Fields in the same string belong together, also on different roofs (e.g. 5 modules on the house and 5 on the garage). Sensor and inverter count for the whole string.",solar_string_sum:"{fields} fields \xB7 {n} modules \xB7 {kwp} kWp",solar_face_size:"Roof face {w} \xD7 {h} m (along the eave \xD7 up the slope)",solar_cols_hint:"One number for rows of equal length, or a list for rows of their own: \u201C4, 4, 3\u201D (from the eave).",solar_align_left:"Left",solar_align_center:"Centre",solar_align_right:"Right",solar_look_black:"Full black",solar_look_blue:"Blue",solar_pick:"Modules on/off one by one",solar_pick_all:"All on again",solar_pick_hint:"Tap a module in the plan to take it away or put it back. Removed ones are dashed.",solar_entity:"PV power of this field (e.g. its string)",solar_main:"Main roof",solar_section:"Section {n}",solar_flat:"flat roof",compass_n:"north",compass_ne:"north-east",compass_e:"east",compass_se:"south-east",compass_s:"south",compass_sw:"south-west",compass_w:"west",compass_nw:"north-west",furn_meter:"Electricity meter",furn_grid_point:"Grid connection",grid_point_hint:"The grid connection stands here: the handover point to the utility, e.g. at the end of the driveway. Movable in the plan.",furn_model:"Model",inverter_std:"Standard (wall unit with display)",inverter_slim:"Slim and tall (light strip)",inverter_hybrid:"Hybrid (round dial, fans)",battery_std:"Tower (stacked modules)",battery_wall:"Wall battery (flat, hanging)",battery_cube:"Compact (balcony battery)",furn_inverter:"Solar inverter",furn_home_battery:"Home battery",furn_wallbox:"Wallbox",furn_heating_manifold:"Heating/cooling manifold",furn_buffer_tank:"Buffer tank",furn_freshwater_station:"Fresh water station",furn_group_kitchen:"Kitchen",furn_group_sleeping:"Sleeping",furn_group_bath:"Bath & laundry",furn_group_work:"Work & other",furn_entity:"Device (switch, plug \u2026)",furn_state_entity:"State from (optional)",furn_state_entity2:"Second state (the other half)",furn_tap:"Tapping the item",furn_tap_default:"As usual",furn_tap_hint:"An own action like the star menu's own buttons, e.g. a browser_mod popup with your card.",furn_show_when:"Only show while \u2026",furn_show_when_state:"\u2026 is in state (empty = on)",furn_show_when_invert:"The other way round: show while it is not",furn_show_when_hint:"Seasonal decoration that only stands in December: a helper (input_boolean), a calendar or a sensor decides whether the piece shows in 3D. Separate several states with commas. The editor always shows it.",picture_upload:"Upload a photo",picture_replace:"Upload another photo",picture_stored:"An own photo is stored.",picture_url:"\u2026 or picture address",picture_entity:"\u2026 or an entity's picture",picture_border:"Mat (%)",picture_fit:"Photo",picture_fit_cover:"fills the frame",picture_fit_contain:"shown whole",picture_hint:"Your photo in the frame, in 3D and on the wall tablet. Uploaded photos are stored with the plan in a smaller size; an image entity (a photo of the day) or a camera shows its current picture.",furn_state_split:"Halves",furn_state_left_right:"Left / right",furn_state_top_bottom:"Bottom / top (bunk bed)",furn_state_hint:"The item glows while the entity reports on, occupied or home \u2013 a bed with an occupancy mat, an armchair, the sauna. Two entities light the halves: left and right, bottom and top for a bunk bed.",furn_entity_tv:"TV (media player or smart plug)",fix:"Fix",unfix:"Release",fix_hint:"Fixed: cannot be moved by accident any more (key L, right-click or long press)",fixed_drag_hint:"\u{1F512} Fixed \u2013 release it first to move it (lock in the form, right-click or key L)",fixed_delete_confirm:"This item is fixed. Delete it anyway?",lock_plan:"\u{1F512} Floor plan",lock_plan_hint:"Lock the floor plan: rooms, walls, doors, windows and outdoor areas cannot be moved by accident. Furniture and devices stay free.",start_view:"Start view",start_view_hint:"The 3D view, the card and the kiosk open the house with this view, e.g. from the garden side. Turn, zoom and move the house in the 3D pane on the right until it fits, then remember it.",start_view_card:"If a card should open with a different view, put this line into its YAML configuration.",start_view_set:"Remember the current 3D view as the start",start_view_reset:"Default",start_view_saved:"An own start view is saved.",ctx_rotate:"Turn 90\xB0",devices_placed_in:"in {room}",devices_narrow:"{n} more \u2013 narrow the search",climate:"Room climate",climate_temperature:"Temperature",climate_humidity:"Humidity",climate_co2:"CO\u2082",climate_hint:"These sensors count for the heatmap and the room panel. \u201CAutomatic\u201D takes the sensors of the area and the ones placed in the room, but no device temperatures (3D printer, heat pump, flow \u2026).",climate_more:"\u2026 and another sensor (averaged)",plan_locked:"Floor plan locked",plan_lock:"Lock floor plan",plan_unlock:"Unlock floor plan",opening_mark:"Highlight in 3D",opening_mark_open:"When open",opening_mark_closed:"When closed (e.g. WC)",opening_mark_hint:"A highlighted window or door glows warm. \u201CWhen closed\u201D needs a contact; without a sensor nothing is highlighted.",window_opens:"Opens",window_opens_turn:"Turn and tilt (inwards)",window_opens_slide:"Sliding (sliding window, lift-and-slide door)",window_opens_top:"Top-hung (bottom swings out)",window_opens_hint:"Sliding: the pane on the hinge side slides in front of the fixed one; with two leaves the middle two slide outwards. Top-hung windows open with their contact or a tilt sensor.",marker_show:"Marker in 3D",marker_show_hint:"Automatic follows the None / Important / All switch of the 3D view. Always show and Hide apply regardless (except with None).",pin_shift:"Move the pin",pin_shift_up:"\u2191 up",pin_shift_hint:"When devices stand close together, push the pin a little aside or up here (in metres); the device itself stays where it is.",marker_show_auto:"Automatic",marker_show_always:"Always show",marker_show_no_power:"Without watts",marker_show_active:"Only while active",marker_show_never:"Hide",marker_icon:"Own symbol (Material Design icon)",device_name:"Own name (optional)",show_name:"Show the name under the marker in 3D",card_marker_names:"Own names at the markers",card_marker_names_hint:"Every device with an own name shows it small under its marker \u2013 three thermometers in the garden stay apart.",card_tap_in_room:"Switch devices only in the opened room",card_tap_in_room_hint:"In the house and floor views a tap opens the floor or room, even on a device or its marker. In the opened room it switches the device. A long press always opens its menu or details.",card_markers_outside:"Choose the markers outside the opened room",card_markers_outside_hint:`In the house, on the floor and in the other rooms only the ticked kinds; in the opened room all, as set above. A device's own "always" and "never" come first.`,marker_kind_light:"Lights",marker_kind_cover:"Blinds",marker_kind_climate:"Heating",marker_kind_media:"Media",marker_kind_switch:"Switches",marker_kind_fan:"Fans",marker_kind_lock:"Locks",marker_kind_binary:"Contacts and detectors",marker_kind_sensor:"Sensors",marker_kind_tap:"Furniture with an action",marker_kind_other:"Other",device_name_hint:'A name for the plan and the room panel only, e.g. "Island accent light" \u2013 the entity in Home Assistant stays as it is.',device_simple:"Switch only in the room panel",device_simple_hint:"The room panel shows only the switch for this lamp, without brightness, colour temperature and colours.",floor_turn:"Turn 90\xB0",floor_shift_all:"Take every floor along (whole house)",floor_shift_all_hint:"Shift and turn act on every floor with the roof sections, outdoor areas, energy devices and meter \u2013 the whole house moves as one.",floor_turn_hint:"Turns everything on the floor by 90\xB0 clockwise about the middle of its rooms \u2013 when a floor was drawn the wrong way round. Three times = 270\xB0.",marker_icon_hint:"The name of a Material Design icon as in Home Assistant, e.g. mdi:thermometer or mdi:water-alert. Empty = the symbol of the device kind.",furn_power:"Power sensor (W)",furn_links_hint:"With a power sensor the item shows its watts and takes part in the energy flow.",furn_links_hint_tv:"The screen glows while the TV is on, in the colour of the app (Netflix, YouTube \u2026); the label shows the app or title.",stairs_hint:"The stair rises towards the back (away from the marked front edge) and opens the ceiling of the floor above.",stair_shape:"Shape",stair_shape_straight:"Straight",stair_shape_quarter:"Quarter turn (winders)",stair_shape_l:"L with landing",stair_shape_half:"Half turn (winders)",stair_shape_u:"U with landing",stair_shape_spiral:"Spiral",stair_turn:"Turns (walking up)",stair_turn_left:"To the left",stair_turn_right:"To the right",stair_build:"Build",stair_build_solid:"Solid (concrete)",stair_build_stringer:"On stringers",stair_build_mono:"Mono stringer (spine)",stair_build_cantilever:"Cantilevered (floating)",stair_risers:"Closed risers",stair_steps:"Risers",stair_run_width:"Flight width (m)",stair_landing_after:"Risers up to the landing",stair_landing_hint:"The landing lies {h} cm above the floor; the other risers come after it.",stair_rail:"Railing",stair_rail_none:"None",stair_rail_left:"Left",stair_rail_right:"Right",stair_rail_both:"Both sides",stair_down:"Leads down",stair_down_hint:"The stair starts on this floor and leads down, for example into a cellar that need not be drawn. It opens the floor of this level.",stair_measures:"{steps} risers of {rise} cm \xB7 going {going} cm \xB7 step measure {measure} cm",stair_uncomfortable:"uncomfortable (step measure 59\u201365 cm, rise at most 21 cm)",stair_up_note:"The stair starts at the marked front edge. The floor above opens only where less than 2.2 m of headroom is left above the steps.",stair_down_note:"You step onto the stair at the marked front edge and walk down. The plan draws it dashed; this floor opens above the steps.",stair_opening:"Floor opening",stair_opening_headroom:"By headroom (only where needed)",stair_opening_full:"Over the whole stair",stair_opening_none:"None (hatch, closed stairwell)",stair_opening_hint:"How much of the floor the stair reaches it opens: the floor above, or its own floor for a stair going down. By headroom opens only above the steps that lack 2.2 m.",stair_up_note_plain:"The stair starts at the marked front edge and rises towards the back.",stair_upgrade:"Set the shape",stair_upgrade_hint:"Turns this into a stair with a shape (winding, L, U, spiral), build, railing and number of steps.",floor_lights:"{n} lights on",floor_open:"{n} open",floor_persons:"{n} people",energy_consumption:"Consumption",energy_grid_import:"Grid import",energy_grid_export:"Export",energy_solar:"Solar",energy_battery:"Battery",energy_tariff:"Tariff",energy:"Energy",energy_meter:"Meter",energy_grid:"Grid (W, + = import)",energy_solar_sensor:"Solar production (W)",energy_battery_sensor:"Battery power (W, + = discharging)",energy_battery_soc:"Battery charge (%)",energy_tariff_sensor:"Tariff (e.g. \u20AC/kWh)",energy_gas:"Gas meter (optional)",energy_water:"Water meter (optional)",energy_meters_hint:"Gas and water show with the house's balance \u2013 in the energy bar and on the house card: a sensor with the flow now (m\xB3/h, l/min) or today's reading.",energy_gas_short:"Gas",energy_water_short:"Water",energy_invert:"Invert sign",energy_hint:"Consumers are placed devices with a power sensor (W) \u2013 the sensor itself or one of the same device.",energy_balance:"Energy balance",energy_balance_hint:"Grid, solar and battery come from the devices in the plan: meter, inverter and home battery. Here you can choose other sensors, flip signs and set the house consumption.",energy_rest:"Common (rest)",energy_advanced:"Advanced energy mode",energy_advanced_on:"Use sub-meters",energy_show_unmetered:"Show unmetered use at sub-meters",energy_show_unmetered_hint:"A sub-meter's label then shows what its floors use and how much of it no placed device measures, e.g. \u201C500 W \xB7 450 W unmetered\u201D. Otherwise it shows the meter's reading.",energy_advanced_hint:"For sub-meters, e.g. one per flat behind a main meter: a meter can then hang off another one and feed its own floors. Off = the first meter is the grid connection, further ones are consumers.",energy_consumption_sensor:"House consumption (W, else from the balance)",energy_import_prefs:"Take over from the energy dashboard",energy_import_done:"{n} sensors taken over \u2013 please check the signs.",energy_import_none:"No matching power sensors (W) were found in the energy dashboard \u2013 please choose them by hand.",energy_import_failed:"Home Assistant's energy dashboard is not set up.",tool_meter:"Meter",hint_meter:"Tap the spot of the meter",presence:"Presence",ble:"Bluetooth locating",ble_hint:"Locate a Bluetooth tag (key fob, watch, phone) by room: walk through the rooms with it and record each room. NextFloor then compares how strongly Home Assistant's Bluetooth scanners (ESPHome proxies, Shelly devices with Bluetooth switched on, adapters on the server) hear it. Every tag gets a sensor whose state is the room name.",ble_unavailable:"Home Assistant's Bluetooth integration is not running. Without it there are no scanners.",ble_scanners:"{n} Bluetooth scanners in Home Assistant. The more scanners in different rooms, the more exact.",ble_add:"Add a tag or device",ble_trackers:"Phones and watches (Private BLE Device)",ble_devices:"Bluetooth devices found",ble_name:"Name (optional)",ble_refresh:"Reload the list",ble_add_button:"Add",ble_learn:"Learn rooms",ble_close:"Close",ble_spots:"{n} recordings",ble_now:"Now",ble_unknown:"unknown",ble_none_heard:"No scanner hears the tag right now. Hold it near a scanner and wait a moment; a tag only sends every few seconds.",ble_no_address:"This phone or watch has no known address right now. Check Home Assistant's Private BLE Device integration.",ble_one_scanner:"Only one scanner hears the tag. Telling rooms apart takes at least two, better three or more.",ble_learn_room:"Record a room",ble_record:"Record ({s} s)",ble_recording:"Recording \u2026 {s} s left",ble_forget_room:"Forget the room",ble_learn_hint:"Pick the room, press Record and walk slowly through the whole room with the tag in your hand, into the corners too. Recording again replaces the room. Learn every room you want to locate the tag in.",ble_sensor_hint:`The sensor "{name}" (device NextFloor) shows the room. Under Presence you can pick it as a person's room sensor.`,presence_hint:"Room sensor per person (e.g. ESPresense, Bermuda): its state names the room or area.",presence_sensor:"Room sensor",presence_room:"Default room",presence_room_none:"\u2013 none \u2013",presence_add:"Another entity (helper switch, tracker)",no_persons:"There are no people in Home Assistant."},oo=globalThis,ro=globalThis.__NF_SHARED_TEXTS__?oo.__nextfloorBuiltin?.de??{}:Uh,io=globalThis.__NF_SHARED_TEXTS__?oo.__nextfloorBuiltin?.en??{}:jh;oo.__nextfloorBuiltin??={de:ro,en:io};var Ya=()=>typeof w=="object"&&w||{},qh=globalThis,$r=qh.__nextfloorTexts??=new Map;function Ja(n){let e=n.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in Ya()?e:void 0}function Qa(n){let e=Ja(n),t=e===void 0?void 0:$r.get(e);return t instanceof Promise?void 0:t}function Mr(n,e){let t=Ja(n?.language??navigator.language);if(t===void 0)return!1;let r=$r.get(t);return r===void 0&&(r=fetch(new URL(`./lang/${t}.json?v=${Ya()[t]}`,import.meta.url)).then(i=>i.ok?i.json():{}).catch(()=>({})).then(i=>{$r.set(t,i&&typeof i=="object"?i:{})}),$r.set(t,r)),r instanceof Promise?(r.then(()=>e.requestUpdate()),!0):!1}function Xa(n,e){return Qa(n)?.[e]}function $(n,e,t={}){let r=n?.language??navigator.language,i=r.startsWith("de"),o=(i?void 0:Qa(r)?.[e])??(i?ro:io)[e]??io[e]??ro[e]??e;for(let[s,a]of Object.entries(t))o=o.replace(`{${s}}`,String(a));return o}function L(n,e,t=2){return e.toLocaleString(n?.language??void 0,{maximumFractionDigits:t})}var el={light:"M8.5 17.5h7M9.5 20.5h5M12 2.5a6.5 6.5 0 0 0-3.5 12v1.5h7V14.5A6.5 6.5 0 0 0 12 2.5z",switch:"M6 5h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM12 7.5v9M9 12h6",fan:"M12 11.5c-1-3.5 0-7 2.5-7s2 4-2.5 7zm.5.5c3.5-1 7 0 7 2.5s-4 2-7-2.5zm-.5.5c1 3.5 0 7-2.5 7s-2-4 2.5-7zm-.5-.5c-3.5 1-7 0-7-2.5s4-2 7 2.5z",cover:"M3.5 3.5h17v3h-17zM6 6.5v12M18 6.5v12M8.5 9.5h7M8.5 12.5h7M8.5 15.5h7",climate:"M12 15V5.5a2.5 2.5 0 0 0-5 0V15a4.5 4.5 0 1 0 5 0zM9.5 9v7M15 5.5h5M15 9.5h4",media:"M3.5 5.5h17v11h-17zM8 20.5h8M12 16.5v4M10 8.5v5l4.5-2.5z",lock:"M5.5 10.5h13v9.5h-13zM8 10.5V7.5a4 4 0 0 1 8 0v3M12 14v3",sensor:"M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM12 7.5v4.5l3.5 2",binary:"M5.5 20.5v-17h10v17M3.5 20.5h14M9 20.5v-13h4.5v13M12.5 14h.01",scene:"M5.5 18.5l8-8M14 3.5l1 2.5 2.5 1-2.5 1-1 2.5-1-2.5-2.5-1 2.5-1zM18.5 12l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z",script:"M8.5 3.5h8.5a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H7.5a2 2 0 0 1-2-2v-2h9M8.5 3.5a2 2 0 0 0-2 2v10M9.5 8.5h6M9.5 11.5h4"},Ar=n=>el[n];function Fe(n){return``}function Ct(n){return``}function Zh(n){let e=n?.attributes;return{temperature:"\u{1F321}",humidity:"\u{1F4A7}",carbon_dioxide:"\u2601",illuminance:"\u2600",power:"\u26A1",energy:"\u26A1"}[String(e?.device_class)]??(e?.unit_of_measurement==="\xB0C"?"\u{1F321}":"\u25C9")}function Er(n,e=[]){return e.flatMap(t=>{if(!t.entity||t.entity==="none")return[];let r=n.states[t.entity],i="\u2013";if(r&&!C(r)){let o=r.attributes;if(typeof o.symcon_formatted=="string"&&o.symcon_formatted.trim())i=o.symcon_formatted;else{let s=o.symcon_numeric_value??r.state,a=typeof s=="number"||typeof s=="string"&&s.trim()?Number(s):NaN;i=Number.isFinite(a)?`${L(n,a,n.entities?.[t.entity]?.display_precision??(o.symcon_variable_type===1?0:1))}${o.unit_of_measurement?` ${o.unit_of_measurement}`:""}`:String(s??"\u2013")}}return[{id:t.id,entity:t.entity,icon:t.icon?.trim()||Zh(r),label:t.label?.trim()||O(n,t.entity),text:i}]})}function yn(n,e=[]){return Er(n,e).map(t=>`${t.icon} ${t.label&&e.find(r=>r.id===t.id)?.label?`${t.label}: `:""}${t.text}`).join(" \xB7 ")}function tl(n,e,t){let r=e.color_entity&&e.color_entity!=="none"?e.color_entity:t;return r?n.states[r]:void 0}function Rr(n,e){if(n.animations_enabled===!1||e?.state!=="on")return;let t=e.attributes.effect;if(typeof t!="string"||!n.effect_animations||!Object.prototype.hasOwnProperty.call(n.effect_animations,t))return;let r=n.effect_animations[t];return r==="rainbow"||r==="pulse"||r==="flicker"||Ks(r)?r:void 0}var it=(n,e)=>$(n,e),Yh=(n,e)=>it(n,e?"state_on":"state_off");function zr(n,e){let t=`state_${e}`,r=$(n,t);return r===t?e:r}var Jh=new Set(["door","window","opening","garage_door"]),Qh=new Set(["playing","paused","on","idle"]);function Xh(n,e){if(e.state!=="on")return it(n,"state_off");let t=e.attributes.brightness;return typeof t=="number"?`${Math.round(t/255*100)} %`:it(n,"state_on")}function nl(n,e){let t=e.attributes.current_position,r=e.state==="opening"||e.state==="closing";return typeof t=="number"&&!r?`${t} %`:zr(n,e.state)}function em(n,e){let t=e.attributes.current_temperature,r=typeof t=="number"?`${L(n,t,1)} ${n?re(n):"\xB0C"}`:null;return e.state==="off"?r?`${r} \xB7 ${it(n,"state_off")}`:it(n,"state_off"):r??zr(n,e.state)}function tm(n,e){let t=[e.attributes.app_name,e.attributes.media_title,e.attributes.source].find(r=>typeof r=="string"&&r!=="");return Qh.has(e.state)&&t?t:zr(n,e.state)}function nm(n,e){let t=e.state==="on";return Jh.has(String(e.attributes.device_class))?it(n,t?"state_open":"state_closed"):it(n,t?"state_detected":"state_clear")}function rm(n,e,t=new Date){let r=new Date(e.state);if(Number.isNaN(r.getTime()))return"\u2013";let i=n?.language??navigator.language,s=r.toDateString()===t.toDateString()?{hour:"2-digit",minute:"2-digit"}:{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"};return new Intl.DateTimeFormat(i,s).format(r)}function im(n,e){if(e.entity_id.startsWith("event."))return rm(n,e);let t=Number(e.state);if(!Number.isFinite(t))return e.state;let r=n?.entities?.[e.entity_id]?.display_precision??1,i=e.attributes.unit_of_measurement;return`${L(n,t,r)}${typeof i=="string"&&i?` ${i}`:""}`}function se(n,e){if(!e||C(e))return it(n,"state_unavailable");switch(P(e.entity_id)){case"light":return Xh(n,e);case"switch":case"fan":return e.entity_id.startsWith("valve.")?nl(n,e):Yh(n,e.state==="on");case"cover":return nl(n,e);case"climate":return em(n,e);case"media":return tm(n,e);case"lock":return zr(n,e.state);case"binary":return nm(n,e);case"sensor":return im(n,e);default:return""}}var om=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points))??null;function so(n,e){return!n||e==null||e===1?n:{...n,level:Math.min(1.5,Math.max(.02,n.level*e))}}function sm(n,e,t){let r=n.states[t.entity_id],i=P(t.entity_id)??Tt(t.entity_id,r);if(!i||!r)return null;let o=t.outside?null:om(e,t.x,t.z),s=o?.area_id?n.areas?.[o.area_id]?.name:void 0,a={id:t.entity_id,floorId:e.id,roomId:o?.id??null,x:t.x,z:t.z,y:t.y??Ht(i,xe(e,t.x,t.z),t.mount??null)+(i==="light"&&(t.mount??"ceiling")==="ceiling"?0:sr(e,t.x,t.z)),lamp:i==="light"?t.mount??"ceiling":null,ceiling:xe(e,t.x,t.z),rotation:t.rotation??0,icon:t.icon?Fe(t.icon):Ct(i),name:t.name||O(n,t.entity_id,s),ownName:t.name||void 0,showName:!!t.show_name,text:[se(n,r),yn(n,t.values)].filter(Boolean).join(" \xB7 "),active:i==="cover"&&!!t.cover_inverted!=(!!t.position&&!!t.position_inverted)&&!C(r)?!te(r):te(r),unavailable:C(r),glow:i==="light"?so(We(r),t.glow_scale):null,effect:i==="light"?Rr(t,r):void 0,show:t.marker??void 0,fixed:!!t.locked};return a.wedge=qs({hass:n,entityId:t.entity_id,state:r},{floorId:e.id,roomId:a.roomId,x:a.x,z:a.z,y:a.y,rotation:a.rotation??0},t.plugin??void 0),ao(n,a,r,!!t.icon)}function ao(n,e,t,r){let i=Gs({hass:n,entityId:e.id,state:t});if(!i)return e;let o=i.icon&&!r?i.icon.trimStart().startsWith("t.placements.map(r=>sm(n,t,r)).filter(r=>r!==null))}var il=n=>n.floors.flatMap(e=>e.placements.map(t=>t.entity_id));function ke(n,e){n.dispatchEvent(new CustomEvent("hass-more-info",{detail:{entityId:e},bubbles:!0,composed:!0}))}function ol(n,e){return n.callService(e.split(".")[0],"toggle",{entity_id:e})}function ll(n,e,t=!1){if(t)return!1;if(!Array.isArray(n.screens)||!n.screens.length)return!0;let r=(e??"").trim().toLocaleLowerCase();return!!r&&n.screens.some(i=>i.trim().toLocaleLowerCase()===r)}var Nt=globalThis.__nfAnnounced??new Set;globalThis.__nfAnnounced=Nt;function cl(n){let e=`${n.time}|${n.message}`;return Nt.has(e)?!1:(Nt.add(e),Nt.size>50&&Nt.delete(Nt.values().next().value),!0)}var ul=n=>Math.min(3e4,Math.max(6e3,n.split(/\s+/).length*600+2e3));function am(){try{let n=globalThis.AudioContext??globalThis.webkitAudioContext;if(!n)return Promise.resolve();let e=new n,t=(r,i)=>{let o=e.createOscillator(),s=e.createGain();o.type="sine",o.frequency.value=r,s.gain.setValueAtTime(1e-4,e.currentTime+i),s.gain.exponentialRampToValueAtTime(.25,e.currentTime+i+.03),s.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+i+.9),o.connect(s).connect(e.destination),o.start(e.currentTime+i),o.stop(e.currentTime+i+1)};return t(880,0),t(660,.35),new Promise(r=>setTimeout(()=>{e.close().catch(()=>{}),r()},1400))}catch{return Promise.resolve()}}function lm(n,e){let t=globalThis.speechSynthesis,r=globalThis.SpeechSynthesisUtterance;if(!t||!r)return;let i=new r(e);i.lang=n.language||"en",t.cancel(),t.speak(i)}async function dl(n,e){if(await am(),e.audio)try{let t=e.audio.startsWith("/")&&n.hassUrl?n.hassUrl(e.audio):e.audio;await new Audio(t).play();return}catch{}lm(n,e.message)}function hl(n,e){return n.connection.subscribeMessage(e,{type:"nextfloor/announcements/subscribe"}).then(t=>()=>{t().catch(()=>{})},()=>()=>{})}var sl=/^(media_player|assist_satellite)\./;function cm(n,e){return e?Object.values(n.entities??{}).filter(t=>!t.hidden&&(t.area_id??(t.device_id?n.devices?.[t.device_id]?.area_id:null))===e).map(t=>t.entity_id):[]}function al(n,e){let t=n.states[e];return!t||t.state==="unavailable"?!1:e.startsWith("notify.")?n.entities?.[e]?.platform==="alexa_devices"&&e.endsWith("_announce"):t.state==="off"||t.state==="unknown"?!1:t.attributes.device_class!=="tv"}function um(n,e,t){if(t.announce_speaker==="none")return null;if(t.announce_speaker)return t.announce_speaker;if(e&&t.points.length>=3){let o=[...e.placements.filter(s=>sl.test(s.entity_id)).map(s=>({id:s.entity_id,x:s.x,z:s.z})),...e.furniture.filter(s=>s.entity&&sl.test(s.entity)).map(s=>({id:s.entity,x:s.x,z:s.z}))].find(s=>H([s.x,s.z],t.points)&&al(n,s.id));if(o)return o.id}let r=cm(n,t.area_id);for(let i of["assist_satellite.","notify.","media_player."]){let o=r.filter(s=>s.startsWith(i)&&al(n,s)).sort()[0];if(o)return o}return null}var ml=(n,e,t)=>um(n,e,t)!==null,pl=n=>!!n?.services?.nextfloor?.announce;var V=n=>n?.symconObjects!==void 0;function fl(n,e,t=[0,1,2,3]){let r=n?.states[e]?.attributes;return!!r?.symcon_id&&!r.symcon_source_entity&&t.includes(Number(r.symcon_variable_type))}function fe(n){return!n||n.state==="unknown"||n.state==="unavailable"?null:n.attributes.symcon_value??n.attributes.symcon_numeric_value??n.state}function ge(n){let e=fe(n);if(e===null||typeof e=="boolean"||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function le(n){let e=fe(n);if(e===null)return null;if(typeof e=="boolean")return e;if(typeof e=="number")return e>0;let t=String(e).trim().toLowerCase();if(["on","true","1","home","open","an","ein","ja","regen","rain","wet","nass"].includes(t))return!0;if(["off","false","0","not_home","closed","aus","nein","trocken","dry"].includes(t))return!1;let r=Number(t);return t!==""&&Number.isFinite(r)?r>0:null}function De(n){return fe(n)===null?"\u2013":String(n?.attributes.symcon_formatted??fe(n))}var gl=[{key:"supply_vsr",label:"Zuluft-VSR",types:[0,1,2],control:!0},{key:"extract_vsr",label:"Abluft-VSR",types:[0,1,2],control:!0},{key:"supply_temperature",label:"Zulufttemperatur",types:[1,2]},{key:"extract_temperature",label:"Ablufttemperatur",types:[1,2]},{key:"reheat",label:"NHR (Nachheizregister)",types:[0,1,2],control:!0},{key:"status",label:"Raumstatus",types:[1]}];var ye=J` :host { --nf-text: var(--primary-text-color, #e1e1e1); --nf-muted: var(--secondary-text-color, #9b9b9b); @@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be font-family: var(--nf-font); color: var(--nf-text); } -`,zr=J` +`,Tr=J` :host([readable]) { --secondary-text-color: var(--primary-text-color, #e1e1e1); --divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent); @@ -209,9 +209,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be min-height: 40px; } } -`;function Tr(n){return n?.themes?.darkMode===!1?"light":"dark"}function vn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var gl,ao=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(gl??=import(t).catch(i=>{throw gl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!vn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`${this.error?p`${this.error}`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",ao);function G(n,e,t=""){let r=vn(n,e);return r.length?p``:f}var lo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,r){let i=this.hass.states[t],o=fe(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`
${e}${Fe(i)}${G(this.hass,[t],e)} + ${this.error?p`${this.error}`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",lo);function G(n,e,t=""){let r=vn(n,e);return r.length?p``:f}var co=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,r){let i=this.hass.states[t],o=fe(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`
${e}${De(i)}${G(this.hass,[t],e)} ${r&&s?.symcon_has_action&&s.symcon_variable_type===0?p``:r&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f}
`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`

Schaltuhr nicht verfügbar

`;let r=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=r.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`
${String(t.attributes.friendly_name??"Schaltuhr")} @@ -220,7 +220,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be ${i.length?i.map(c=>p`
${a.filter((u,h)=>c.days&1<
${[...c.points].sort((u,h)=>u.hour*3600+u.minute*60+u.second-(h.hour*3600+h.minute*60+h.second)).map(u=>{let h=r.find(m=>m.id===u.action);return p`${h?.name||"Aktion"}`})}
`):p`

Keine Schaltpunkte vorhanden.

`} -
`}render(){if(!this.hass||!this.room)return f;let e=fl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${r||e.length?p`

Raumklima

${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}
`:f} + `}render(){if(!this.hass||!this.room)return f;let e=gl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${r||e.length?p`

Raumklima

${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}
`:f} ${t.length?p`

Schaltuhren

${t.map(i=>this.schedule(i))}
`:f} ${this._error?p``:f}`}static styles=[ye,He,J` :host { display:block; } @@ -240,8 +240,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be .point time { font-variant-numeric:tabular-nums; } .dot { width:8px; height:8px; border-radius:50%; } .error { color:var(--nf-danger,#ff6b7a); font-size:12px; } - `]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",lo);var cm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ue(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||C(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):cm.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function co(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ue(n,i)||t.push(i.id);return t.sort()}function _l(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Ii(e))return $(n,`furn_${e}`);let t=X(e);return t?um(t,e,n?.language??navigator.language):$(n,"pack_missing_item")}function um(n,e,t){return n.name[t.split("-")[0]]??Qa(t,e)??ra(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Pe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Se=(n,e)=>[n[0]*e,n[1]*e],ue=(n,e)=>n[0]*e[0]+n[1]*e[1],je=(n,e)=>n[0]*e[1]-n[1]*e[0],qe=n=>Math.hypot(n[0],n[1]),$e=n=>{let e=qe(n)||1;return[n[0]/e,n[1]/e]},uo=n=>[-n[1],n[0]],ho=n=>[n[1],-n[0]];function bl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function dm(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function hm(n,e,t){if(n.a===e.b)return!1;let r=$e(ee(t[n.b],t[n.a])),i=$e(ee(t[e.b],t[e.a]));return Math.abs(je(r,i))>1e-6||ue(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function yl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:bl(r[a[0]]),c=r[a[1]].a===s?r[a[1]]:bl(r[a[1]]);if(!hm(l,c,e))continue;let u={...l,b:c.b,sources:dm(l.sources,c.sources)};o=[...r.filter((h,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return r;r=o}}function vl(n,e){let t=new Map;n.forEach((i,o)=>{let s=$e(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Se(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)r.set(l.key,{left:Pe(s,Se(uo(l.d),l.left)),right:Pe(s,Se(ho(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=Pe(s,Se(uo(l.d),l.left)),m=Pe(s,Se(ho(u.d),u.right)),d=je(l.d,u.d);if(Math.abs(d)<1e-4)return;let g=Pe(h,Se(l.d,je(ee(m,h),u.d)/d));qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(u.key).right=g)})}return r}function wl(n,e){let t=n.filter((r,i)=>qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(je($e(l),$e(c)))<1e-7&&ue(l,c)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function mm(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function pm(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(gt(i))<1e-6)continue;let o=gt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:r.id,edge:l,forward:!0}:{u:c,v:a,room:r.id,edge:l,forward:!1})})}return t}function fm(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=qe(a),c=Se(a,1/l),u=e.map((m,d)=>({id:d,rel:ee(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&ue(d,c)>t&&ue(d,c)({t:ue(d,c),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function gm(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[h,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-h[0],m[1]-h[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let h of a){let[m,d]=s(h),[g,_]=h===a[0]?[m,d]:[d,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(h=>t.get(h.room)?.ceiling);if(u.every(h=>typeof h=="number"&&h>0)){let h=Math.max(...u);l===1/0&&(l=h),c===1/0&&(c=h)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(r.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.some(l=>i(l)===0)}}function kl(n){let e=t=>Math.round(t*1e6)/1e6;return n.a===void 0||n.b===void 0?n.a!==void 0?{height:e(n.a)}:n.b!==void 0?{height:e(n.b)}:{}:Math.abs(n.a-n.b)<1e-6?{height:e(n.a)}:{height:e(n.a),heightEnd:e(n.b)}}function _m(n,e,t,r){let i=gm(e,n),o=new Map;for(let l of n){let c=l.um!==c&&m.u===c.v&&m.v===c.u&&m.room!==c.room);for(let m of l)m!==c&&m!==u&&m.room!==c.room&&r.push(`overlap:${c.room}:${m.room}`);let h=u?[c,u]:[c];if(i.hasNoWall(h)){u&&a.push([c.room,u.room]);continue}if(u){let m=i.thicknessOf(h)??t.interior;s.push({a:c.u,b:c.v,left:m/2,right:m/2,exterior:!1,roomLeft:c.room,roomRight:u.room,sources:h.map(xl),...kl(i.heightsOf(h))})}else s.push({a:c.u,b:c.v,left:0,right:i.thicknessOf(h)??t.exterior,exterior:!0,roomLeft:c.room,roomRight:null,sources:[xl(c)],...kl(i.heightsOf(h))})}return{drafts:s,open:a}}function bm(n,e){let t=o=>$e(ee(e[o.b],e[o.a])),r=n.filter(o=>!o.exterior&&!o.free),i=new Map;for(let o of r){if(i.has(o))continue;let s=[o];i.set(o,s);for(let a=0;a1e-6||l.add(ue(s,d)>0?"left":"right")}if(l.size!==1)continue;let c=[...l][0];for(let u of o){let h=u.left+u.right,m=ue(t(u),s)>0,d=c==="left"===m;[u.left,u.right]=d?[0,h]:[h,0]}}}var ym=(n,e)=>{let t=o=>Math.round(o*100),[r,i]=n[0]Math.hypot(y.b[0]-y.a[0],y.b[1]-y.a[1])>.05),l=a.map(y=>[o.idOf(y.a),o.idOf(y.b)]),c=new Set;for(let y of n){let S=y.points;S.length<3||(y.wall_splits??[]).forEach((k,M)=>{if(!k||M>=S.length)return;let z=S[M],R=ee(S[(M+1)%S.length],z),F=qe(R);for(let T of k)T>r&&T{let[k,M]=l[S];if(k===M)return;let z=[(y.a[0]+y.b[0])/2,(y.a[1]+y.b[1])/2],R=n.find(T=>T.points.length>=3&&H(z,T.points))?.id??null,F=(y.thickness??e.interior)/2;d.push({free:y.id,a:k,b:M,left:F,right:F,exterior:!1,roomLeft:R,roomRight:R,sources:[],height:typeof y.height=="number"&&y.height>0?y.height:void 0,...typeof y.height=="number"&&y.height>0&&typeof y.height_end=="number"&&y.height_end>0&&Math.abs(y.height_end-y.height)>1e-6?{heightEnd:y.height_end}:{}})});let g=yl(d,o.points,c),_=vl(g,o.points);return{walls:g.map((y,S)=>{let[k,M]=[o.points[y.a],o.points[y.b]],[z,R]=[_.get(`${S}:a`),_.get(`${S}:b`)],F=wl([z.right,R.left,M,R.right,z.left,k],1e-6);return{id:ym(k,M),a:[k[0],k[1]],b:[M[0],M[1]],left:y.left,right:y.right,exterior:y.exterior,roomLeft:y.roomLeft,roomRight:y.roomRight,sources:y.sources,footprint:F,...y.free?{free:y.free}:{},...y.height!==void 0?{height:y.height}:{},...y.heightEnd!==void 0?{heightEnd:y.heightEnd}:{}}}),warnings:[...new Set(i)],open:m}}function Sl(n,e,t){let r=n.points[e];return Pe(r,Se($e(ee(n.points[(e+1)%n.points.length],r)),t))}function $l(n,e,t){if(n.wall){let i=t.find(a=>a.id===n.wall);if(!i||Math.hypot(i.b[0]-i.a[0],i.b[1]-i.a[1])<.05)return null;let o=$e(ee(i.b,i.a));return{room:{id:n.room_id,name:"",area_id:null,points:[i.a,i.b,Pe(i.a,[-o[1],o[0]])]},edge:0}}let r=e.find(i=>i.id===n.room_id);return r&&n.edgeue(ee(e,n.a),$e(ee(n.b,n.a)));function Al(n,e,t){if(!e.wall)return vm(n,t.room,t.edge,e.offset);let r=n.find(i=>i.free===e.wall);return r?{wall:r,s:Ml(r,Sl(t.room,0,e.offset))}:null}function vm(n,e,t,r){for(let i of n)if(i.sources.some(s=>s.room_id===e.id&&s.edge===t&&r>=s.t0-1e-6&&r<=s.t1+1e-6))return{wall:i,s:Ml(i,Sl(e,t,r))};return null}var wn=n=>n&&n!=="none"?n:null,xn=(n,e)=>{e&&!n.includes(e)&&n.push(e)},El=n=>new Map(n.floors.flatMap(e=>e.furniture.filter(t=>t.type==="meter").map(t=>[t.id,t])));function Rl(n,e){if(!n.energy.advanced||e.type!=="meter"||!e.parent_meter)return null;let t=El(n),r=new Set([e.id]);for(let i=t.get(e.parent_meter);i;i=t.get(i.parent_meter??"")){if(r.has(i.id))return null;r.add(i.id)}return t.has(e.parent_meter)?e.parent_meter:null}function kn(n){return new Set([...El(n).values()].filter(e=>Rl(n,e)).map(e=>e.id))}function Dr(n,e){return!n.energy.advanced||!e.parent_meter?null:kn(n).has(e.parent_meter)?e.parent_meter:null}function zl(n,e,t){let r=n.energy.show_unmetered?e.subMeters?.find(i=>i.id===t):void 0;return!r||r.use===null?null:{use:r.use,unmetered:r.unmetered!==null&&r.unmeteredwn(t.power)){let t={grid:null,gridExport:null,solar:[],battery:[],charge:[],batteries:[],soc:[]};for(let r of n.floors.flatMap(i=>i.furniture)){let i=e(r),o=r.type==="meter"?Rl(n,r):null;if(o)(t.subMeters??=[]).push({id:r.id,parent:o,power:i,invert:!!r.meter_invert,floors:r.meter_floors??[],solar:[],batteries:[]});else if(r.type==="meter")t.grid??=i,t.gridExport??=wn(r.export);else if(r.type==="inverter")xn(t.solar,i);else if(r.type==="home_battery"){let s=wn(r.charge);xn(t.battery,i),xn(t.charge,s),xn(t.soc,wn(r.soc)),(i||s)&&t.batteries.push({power:i,charge:s})}}for(let r of t.subMeters?n.floors.flatMap(i=>i.furniture):[]){let i=r.type==="inverter"||r.type==="home_battery"?t.subMeters?.find(a=>a.id===Dr(n,r)):void 0,o=i?e(r):null;i&&r.type==="inverter"&&xn(i.solar,o);let s=wn(r.charge);i&&r.type==="home_battery"&&(o||s)&&i.batteries.push({power:o,charge:s})}return t}function q(n,e=!1){let t=n?.attributes.symcon_id?ge(n):n?Number(n.state):null;if(t===null||!Number.isFinite(t))return null;let r={kW:1e3,MW:1e6}[String(n.attributes.unit_of_measurement??"W")]??1;return e?-t*r:t*r}var wm=(n,e)=>e.startsWith("sensor.")&&n.states[e]?.attributes.device_class==="power";function ve(n,e){if(wm(n,e))return e;let t=n.entities?.[e]?.device_id;if(!t)return null;let r=Gi(n,t),i=r?nt(n,e):null,o=br(n,t).filter(s=>s!==e);return(r?o.find(s=>i!==null&&nt(n,s)===i):o[0])??null}function Sn(n,e){let{grid:t,solar:r,battery:i}=e.energy,o=new Set([t,r,i].filter(a=>!!a)),s=[];for(let a of e.floors)for(let l of a.placements){let c=ve(n,l.entity_id);!c||o.has(c)||(o.add(c),s.push({id:l.entity_id,powerEntity:c,floorId:a.id,x:l.x,z:l.z,power:Math.max(0,q(n.states[c])??0)}))}return s}var Tl=n=>{let e=n.filter(t=>t!==null);return e.length?e.reduce((t,r)=>t+r,0):null};function xm(n,e,t){let r=e.grid??t.grid,i=r?q(n.states[r],e.grid_invert):null;if(!e.grid&&t.gridExport){let o=Math.max(0,q(n.states[t.gridExport])??0);return Math.max(0,i??0)-o}return i}function km(n,e,t){return e.solar?q(n.states[e.solar]):t.solar.length?Tl(t.solar.map(r=>q(n.states[r]))):null}function Fr(n,e,t){return e.charge?(e.power?Math.max(0,q(n.states[e.power])??0):0)-Math.max(0,q(n.states[e.charge])??0):e.power?q(n.states[e.power],t):null}function Sm(n,e,t){return e.battery?q(n.states[e.battery],e.battery_invert):Tl(t.batteries.map(r=>Fr(n,r,e.battery_invert)))}function $n(n,e,t,r=Ze(e)){let i=e.energy,o=xm(n,i,r),s=km(n,i,r),a=Sm(n,i,r),l=(i.battery_soc?[i.battery_soc]:r.soc).map(g=>Number(n.states[g]?.state)).filter(Number.isFinite),c=l.length?l.reduce((g,_)=>g+_,0)/l.length:null,u=i.tariff?n.states[i.tariff]:void 0,h=Number(u?.state),m=i.consumption?q(n.states[i.consumption]):null;m===null&&(o!==null||s!==null||a!==null)&&(m=(o??0)+Math.max(0,s??0)+(a??0)),m===null&&t.length>0&&(m=t.reduce((g,_)=>g+_.power,0));let d={grid:o,solar:s===null?null:Math.max(0,s),battery:a,soc:c,tariff:u&&Number.isFinite(h)?{value:h,unit:String(u.attributes.unit_of_measurement??"")}:null,consumption:m===null?null:Math.max(0,m)};return r.subMeters?{...d,...$m(n,r,d.consumption,i.battery_invert,t)}:d}function $m(n,e,t,r,i){let o=e.subMeters??[],s=new Map;for(let m of o)for(let d of m.floors)s.has(d)||s.set(d,m.id);let a=new Set([e.grid,e.gridExport,...e.solar,...e.battery,...e.charge,...o.flatMap(m=>[m.power,...m.solar,...m.batteries.flatMap(d=>[d.power,d.charge])])]),l=m=>i.filter(d=>s.get(d.floorId)===m&&!a.has(d.powerEntity)).reduce((d,g)=>d+g.power,0),c=new Map(o.map(m=>[m.id,m.power?q(n.states[m.power],m.invert):null])),u=o.map(m=>{let d=c.get(m.id)??null,g=m.solar.reduce((S,k)=>S+Math.max(0,q(n.states[k])??0),0),_=m.batteries.reduce((S,k)=>S+(Fr(n,k,r)??0),0),b=o.filter(S=>S.parent===m.id).reduce((S,k)=>S+(c.get(k.id)??0),0),y=d===null?null:Math.max(0,d+g+_-b);return{id:m.id,parent:m.parent,power:d,solar:g,battery:_,use:y,unmetered:y===null?null:Math.max(0,y-l(m.id))}}),h=u.reduce((m,d)=>m+(d.use??0),0);return{subMeters:u,rest:t===null?null:Math.max(0,t-h)}}var Mm=["heating_manifold","buffer_tank","freshwater_station"],ot=n=>Mm.includes(n),Am=(n,e="Heizkreis")=>({id:n,name:e,kind:"heating",has_pump:!0,has_valve:!0});function Em(n){return{card:!0,...n==="heating_manifold"?{circuits:[Am("c1","Heizkreis 1")]}:{},...n==="buffer_tank"?{sensors:Array.from({length:7},(e,t)=>({id:`s${t+1}`,name:`F\xFChler ${t+1}`,entity:null,level:1-t/6}))}:{}}}function mo(n){return{...Em(n.type),...n.hydronic}}var po=n=>n.has_pump!==!1,Rm=n=>n.kind!=="pump"&&n.has_valve!==!1;var Ot=n=>!!n&&n!=="none",Hr=n=>[n?.command,n?.feedback];function Dl(n){if(!ot(n.type))return[];let e=mo(n);return[...new Set([e.flow,e.return,...n.type==="heating_manifold"?(e.circuits??[]).flatMap(t=>[t.flow,t.return,t.power,t.mode_entity,...po(t)?Hr(t.pump):[],...Rm(t)?Hr(t.valve):[]]):[],...n.type==="buffer_tank"?(e.sensors??[]).map(t=>t.entity):[],...n.type==="freshwater_station"?[e.circulation_temperature,e.hot_water,...Hr(e.pump),...Hr(e.circulation)]:[]].filter(Ot))]}var Ir=(n,e)=>String(n.states[e]?.attributes.symcon_source_entity||e);function Pr(n,e){let t=n.states[Ir(n,e)]?.attributes;return t?.device_class==="power"||/^[km]?w$/i.test(String(t?.unit_of_measurement??"").trim())}function fo(n,e){let t=new Map;if(!V(n))return t;let r=Ke(n,[e]),i=(o,s,a,l,c)=>{if(!Ot(c))return;let u=e.rooms.find(m=>m.points.length>=3&&H([a,l],m.points));if(!u)return;let h=t.get(u.id)??[];h.push({id:o,name:s,source:Ir(n,c)}),t.set(u.id,h)};for(let o of e.furniture){if(!Ue(n,o))continue;let s=o.name||ae(n,o.type),a=(o.values??[]).find(u=>Ot(u.entity)&&Pr(n,u.entity)),l=r.get(o.id)?.entity,c=o.power==="none"?null:o.power||r.get(o.id)?.power||(l&&Pr(n,l)?l:null);if(i(`furniture:${o.id}`,s,o.x,o.z,c||a?.entity),!c&&!a){let u=new Set;for(let h of o.gang_entities??[]){if(!Ot(h))continue;let m=ve(n,h);!m||u.has(Ir(n,m))||(u.add(Ir(n,m)),i(`furniture:${o.id}:${h}`,`${s} \xB7 ${O(n,h)}`,o.x,o.z,m))}}if(ot(o.type))for(let u of mo(o).circuits??[])po(u)&&i(`furniture:${o.id}:${u.id}`,`${s} \xB7 ${u.name||"Pumpe"}`,o.x,o.z,u.power)}for(let o of e.placements){if(o.outside)continue;let s=(o.values??[]).find(l=>Ot(l.entity)&&Pr(n,l.entity)),a=Pr(n,o.entity_id)?o.entity_id:ve(n,o.entity_id);i(`device:${o.entity_id}`,o.name||O(n,o.entity_id),o.x,o.z,a||s?.entity)}return t}var Ie={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},Mn={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Lr=n=>n.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),zm="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Tm=n=>n.object_type!==0&&!(n.object_type===1&&n.module_id?.toUpperCase()===zm)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Lr(n.name)]??null,Cr=n=>/^symcon-category-(\d+)$/.exec(n??"")?.[1],_o=n=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(n)?"day":/monat|month/.test(n)?"month":/jahr|year/.test(n)?"year":"total",Or=(n,e)=>String(n.states[e]?.attributes.symcon_source_entity||e);function Pl(n){let e=String(n?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Dm(n,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Or(n,e.entity_id),r=n.states[t];if(!r||![1,2].includes(Number(r.attributes.symcon_variable_type)))return null;let i=Lr(e.name),o=Pl(r),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?_o(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(r.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var Fl=new WeakMap,Hl=new WeakMap;function Il(n){let e=Fl.get(n);if(e)return e;let t={nodes:new Map(n.map(r=>[r.object_id,r])),children:new Map};for(let r of n){let i=t.children.get(r.parent_id)??[];i.push(r),t.children.set(r.parent_id,i)}return Fl.set(n,t),t}function bo(n,e,t){if(!V(n))return[];let r=[e.area_id,...e.sub_areas??[]].map(Cr).filter(m=>!!m);if(!r.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Cr).filter(m=>!!m&&!r.includes(m))),o=`${r.join(",")}|${[...i].sort().join(",")}`,s=Hl.get(n)??new Map;Hl.set(n,s);let a=s.get(o);if(a)return a;let l=Il(n.symconObjects),c=[],u=new Set,h=(m,d,g)=>{if(u.has(m)||i.has(String(m)))return;u.add(m);let _=l.nodes.get(m);if(!_)return;let b=Tm(_),y=b??d,S=new Set(b&&b!==d?[]:g),k=l.children.get(m)??[];if(y){let M=k.map(z=>Dm(n,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)c.push({kind:y,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&h(M.object_id,y,S)};for(let m of r)h(Number(m),null,new Set);return s.set(o,c),c}function yt(n,e,t=!1){let r=new Map,i=new Set;for(let o of e){let s=Or(n,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=n.states[s],c=Pl(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),h=`${o.kind}|${o.metric}|${u}|${o.period}`,m=r.get(h)??{kind:o.kind,metric:o.metric,unit:u,value:null,period:o.period,sources:[],manual:t,incomplete:!1},d=ge(l);d===null?m.incomplete=!0:m.value=(m.value??0)+d*(c?.metric===o.metric?c.factor:1),m.sources.push(s),r.set(h,m)}return[...r.values()]}function Nr(n,e){return Oe.flatMap(t=>["power","energy"].flatMap(r=>{let i=e.utility_meters?.[t]?.[r];if(!i||i==="none")return[];let o=Or(n,i);return[{kind:t,metric:r,id:o,period:r==="energy"?_o(Lr(String(n.states[o]?.attributes.friendly_name??""))):"total"}]}))}function Cl(n,e){return V(n)?yt(n,Nr(n,e),!0):[]}function Wt(n,e,t=[]){let r=Cl(n,e);return r.length?r:yt(n,bo(n,e,t))}function Bt(n,e,t=e.rooms,r=!1){if(!V(n))return[];let i=r?fo(n,e):new Map,o=new Map;for(let a of e.rooms){let l=[...new Set([a.area_id,...a.sub_areas??[]].filter(c=>!!Cr(c)))];!l.length&&(Nr(n,a).length||i.get(a.id)?.length)&&l.push("unassigned");for(let c of l){let u=o.get(c)??{seed:a,members:[]};c===l[0]&&u.members.push(a),o.set(c,u)}}let s=Il(n.symconObjects).nodes;return[...o].map(([a,l])=>{let c=s.get(Number(Cr(a))),u=a==="unassigned"?[]:yt(n,bo(n,{...l.seed,area_id:a,sub_areas:null},t)),h=yt(n,l.members.flatMap(g=>Nr(n,g)),!0),m=g=>u.some(_=>_.kind===g.kind&&_.metric===g.metric&&_.unit===g.unit&&_.period===g.period),d=l.members.map(g=>({id:g.id,name:g.name,readings:Cl(n,g),devices:(i.get(g.id)??[]).map(_=>({id:_.id,name:_.name,readings:yt(n,[{kind:"electricity",metric:"power",id:_.source,period:"total"}],!0)}))})).filter(g=>g.readings.length||g.devices.length);return{id:a,name:a==="unassigned"?"Nicht zugeordnet":c?.name||n.areas?.[a]?.name||"Bereich nicht verf\xFCgbar",path:c?.path||"",readings:[...u,...h.filter(g=>!m(g))],rooms:d}}).filter(a=>a.readings.length||a.rooms.length)}function go(n,e,t,r){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:t==="electricity"&&r==="power"?e.power_entity:null;return o&&o!=="none"?Or(n,o):null}function Ce(n,e,t=e.rooms){let r=Bt(n,e,t).flatMap(o=>o.readings.flatMap(s=>s.sources.map(a=>({kind:s.kind,metric:s.metric,period:s.period,id:a})))),i=[];for(let o of Oe)for(let s of["power","energy"]){let a=go(n,e,o,s);i.push(...yt(n,a?[{kind:o,metric:s,id:a,period:s==="energy"?_o(Lr(String(n.states[a]?.attributes.friendly_name??""))):"total"}]:r.filter(l=>l.kind===o&&l.metric===s),!!a))}return i}function Nl(n,e){let t=e.flatMap(i=>i.rooms),r=e.flatMap(i=>Ce(n,i,t).flatMap(o=>o.sources.map(s=>({kind:o.kind,metric:o.metric,period:o.period,id:s}))));return yt(n,r)}function Ll(n,e){let t=e.flatMap(r=>r.rooms);return[...new Set(e.flatMap(r=>[...r.rooms.flatMap(i=>bo(n,i,t).map(o=>o.id)),...r.rooms.flatMap(i=>Nr(n,i).map(o=>o.id)),...[...fo(n,r).values()].flatMap(i=>i.map(o=>o.source)),...Oe.flatMap(i=>[go(n,r,i,"power"),go(n,r,i,"energy")]).filter(i=>!!i)]))]}function Vt(n){return n.metric==="power"?n.unit==="m\xB3/h"?"Durchfluss":"Leistung":{total:"Verbrauch",day:"Verbrauch heute",month:"Verbrauch Monat",year:"Verbrauch Jahr"}[n.period]}function Ne(n,e){let t=e.incomplete?"Err: ":"";if(e.value===null)return`${t}\u2013`;let r=e.unit==="W"&&Math.abs(e.value)>=1e3?e.value/1e3:e.value,i=e.unit==="W"&&Math.abs(e.value)>=1e3?"kW":e.unit,o=Number.isInteger(r)?0:Math.min(6,Math.max(2,1-Math.floor(Math.log10(Math.abs(r)))));return`${t}${L(n,r,o)}${i?` ${i}`:""}`}var yo=class extends Q{static properties={hass:{attribute:!1},readings:{attribute:!1}};constructor(){super(),this.readings=[]}render(){return p`${Oe.filter(e=>this.readings.some(t=>t.kind===e)).map(e=>p`
-

${Mn[e]} ${Ie[e]}

+ `]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",co);var dm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ue(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||C(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):dm.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function uo(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ue(n,i)||t.push(i.id);return t.sort()}function bl(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Ci(e))return $(n,`furn_${e}`);let t=X(e);return t?hm(t,e,n?.language??navigator.language):$(n,"pack_missing_item")}function hm(n,e,t){return n.name[t.split("-")[0]]??Xa(t,e)??ia(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Pe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Se=(n,e)=>[n[0]*e,n[1]*e],ue=(n,e)=>n[0]*e[0]+n[1]*e[1],je=(n,e)=>n[0]*e[1]-n[1]*e[0],qe=n=>Math.hypot(n[0],n[1]),$e=n=>{let e=qe(n)||1;return[n[0]/e,n[1]/e]},ho=n=>[-n[1],n[0]],mo=n=>[n[1],-n[0]];function yl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function mm(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function pm(n,e,t){if(n.a===e.b)return!1;let r=$e(ee(t[n.b],t[n.a])),i=$e(ee(t[e.b],t[e.a]));return Math.abs(je(r,i))>1e-6||ue(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function vl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:yl(r[a[0]]),c=r[a[1]].a===s?r[a[1]]:yl(r[a[1]]);if(!pm(l,c,e))continue;let u={...l,b:c.b,sources:mm(l.sources,c.sources)};o=[...r.filter((h,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return r;r=o}}function wl(n,e){let t=new Map;n.forEach((i,o)=>{let s=$e(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Se(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)r.set(l.key,{left:Pe(s,Se(ho(l.d),l.left)),right:Pe(s,Se(mo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=Pe(s,Se(ho(l.d),l.left)),m=Pe(s,Se(mo(u.d),u.right)),d=je(l.d,u.d);if(Math.abs(d)<1e-4)return;let g=Pe(h,Se(l.d,je(ee(m,h),u.d)/d));qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(u.key).right=g)})}return r}function xl(n,e){let t=n.filter((r,i)=>qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(je($e(l),$e(c)))<1e-7&&ue(l,c)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function fm(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function gm(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(gt(i))<1e-6)continue;let o=gt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:r.id,edge:l,forward:!0}:{u:c,v:a,room:r.id,edge:l,forward:!1})})}return t}function _m(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=qe(a),c=Se(a,1/l),u=e.map((m,d)=>({id:d,rel:ee(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&ue(d,c)>t&&ue(d,c)({t:ue(d,c),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function bm(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[h,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-h[0],m[1]-h[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let h of a){let[m,d]=s(h),[g,_]=h===a[0]?[m,d]:[d,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(h=>t.get(h.room)?.ceiling);if(u.every(h=>typeof h=="number"&&h>0)){let h=Math.max(...u);l===1/0&&(l=h),c===1/0&&(c=h)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(r.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.some(l=>i(l)===0)}}function Sl(n){let e=t=>Math.round(t*1e6)/1e6;return n.a===void 0||n.b===void 0?n.a!==void 0?{height:e(n.a)}:n.b!==void 0?{height:e(n.b)}:{}:Math.abs(n.a-n.b)<1e-6?{height:e(n.a)}:{height:e(n.a),heightEnd:e(n.b)}}function ym(n,e,t,r){let i=bm(e,n),o=new Map;for(let l of n){let c=l.um!==c&&m.u===c.v&&m.v===c.u&&m.room!==c.room);for(let m of l)m!==c&&m!==u&&m.room!==c.room&&r.push(`overlap:${c.room}:${m.room}`);let h=u?[c,u]:[c];if(i.hasNoWall(h)){u&&a.push([c.room,u.room]);continue}if(u){let m=i.thicknessOf(h)??t.interior;s.push({a:c.u,b:c.v,left:m/2,right:m/2,exterior:!1,roomLeft:c.room,roomRight:u.room,sources:h.map(kl),...Sl(i.heightsOf(h))})}else s.push({a:c.u,b:c.v,left:0,right:i.thicknessOf(h)??t.exterior,exterior:!0,roomLeft:c.room,roomRight:null,sources:[kl(c)],...Sl(i.heightsOf(h))})}return{drafts:s,open:a}}function vm(n,e){let t=o=>$e(ee(e[o.b],e[o.a])),r=n.filter(o=>!o.exterior&&!o.free),i=new Map;for(let o of r){if(i.has(o))continue;let s=[o];i.set(o,s);for(let a=0;a1e-6||l.add(ue(s,d)>0?"left":"right")}if(l.size!==1)continue;let c=[...l][0];for(let u of o){let h=u.left+u.right,m=ue(t(u),s)>0,d=c==="left"===m;[u.left,u.right]=d?[0,h]:[h,0]}}}var wm=(n,e)=>{let t=o=>Math.round(o*100),[r,i]=n[0]Math.hypot(y.b[0]-y.a[0],y.b[1]-y.a[1])>.05),l=a.map(y=>[o.idOf(y.a),o.idOf(y.b)]),c=new Set;for(let y of n){let S=y.points;S.length<3||(y.wall_splits??[]).forEach((k,M)=>{if(!k||M>=S.length)return;let z=S[M],R=ee(S[(M+1)%S.length],z),D=qe(R);for(let T of k)T>r&&T{let[k,M]=l[S];if(k===M)return;let z=[(y.a[0]+y.b[0])/2,(y.a[1]+y.b[1])/2],R=n.find(T=>T.points.length>=3&&H(z,T.points))?.id??null,D=(y.thickness??e.interior)/2;d.push({free:y.id,a:k,b:M,left:D,right:D,exterior:!1,roomLeft:R,roomRight:R,sources:[],height:typeof y.height=="number"&&y.height>0?y.height:void 0,...typeof y.height=="number"&&y.height>0&&typeof y.height_end=="number"&&y.height_end>0&&Math.abs(y.height_end-y.height)>1e-6?{heightEnd:y.height_end}:{}})});let g=vl(d,o.points,c),_=wl(g,o.points);return{walls:g.map((y,S)=>{let[k,M]=[o.points[y.a],o.points[y.b]],[z,R]=[_.get(`${S}:a`),_.get(`${S}:b`)],D=xl([z.right,R.left,M,R.right,z.left,k],1e-6);return{id:wm(k,M),a:[k[0],k[1]],b:[M[0],M[1]],left:y.left,right:y.right,exterior:y.exterior,roomLeft:y.roomLeft,roomRight:y.roomRight,sources:y.sources,footprint:D,...y.free?{free:y.free}:{},...y.height!==void 0?{height:y.height}:{},...y.heightEnd!==void 0?{heightEnd:y.heightEnd}:{}}}),warnings:[...new Set(i)],open:m}}function $l(n,e,t){let r=n.points[e];return Pe(r,Se($e(ee(n.points[(e+1)%n.points.length],r)),t))}function Ml(n,e,t){if(n.wall){let i=t.find(a=>a.id===n.wall);if(!i||Math.hypot(i.b[0]-i.a[0],i.b[1]-i.a[1])<.05)return null;let o=$e(ee(i.b,i.a));return{room:{id:n.room_id,name:"",area_id:null,points:[i.a,i.b,Pe(i.a,[-o[1],o[0]])]},edge:0}}let r=e.find(i=>i.id===n.room_id);return r&&n.edgeue(ee(e,n.a),$e(ee(n.b,n.a)));function El(n,e,t){if(!e.wall)return xm(n,t.room,t.edge,e.offset);let r=n.find(i=>i.free===e.wall);return r?{wall:r,s:Al(r,$l(t.room,0,e.offset))}:null}function xm(n,e,t,r){for(let i of n)if(i.sources.some(s=>s.room_id===e.id&&s.edge===t&&r>=s.t0-1e-6&&r<=s.t1+1e-6))return{wall:i,s:Al(i,$l(e,t,r))};return null}var wn=n=>n&&n!=="none"?n:null,xn=(n,e)=>{e&&!n.includes(e)&&n.push(e)},Rl=n=>new Map(n.floors.flatMap(e=>e.furniture.filter(t=>t.type==="meter").map(t=>[t.id,t])));function zl(n,e){if(!n.energy.advanced||e.type!=="meter"||!e.parent_meter)return null;let t=Rl(n),r=new Set([e.id]);for(let i=t.get(e.parent_meter);i;i=t.get(i.parent_meter??"")){if(r.has(i.id))return null;r.add(i.id)}return t.has(e.parent_meter)?e.parent_meter:null}function kn(n){return new Set([...Rl(n).values()].filter(e=>zl(n,e)).map(e=>e.id))}function Dr(n,e){return!n.energy.advanced||!e.parent_meter?null:kn(n).has(e.parent_meter)?e.parent_meter:null}function Tl(n,e,t){let r=n.energy.show_unmetered?e.subMeters?.find(i=>i.id===t):void 0;return!r||r.use===null?null:{use:r.use,unmetered:r.unmetered!==null&&r.unmeteredwn(t.power)){let t={grid:null,gridExport:null,solar:[],battery:[],charge:[],batteries:[],soc:[]};for(let r of n.floors.flatMap(i=>i.furniture)){let i=e(r),o=r.type==="meter"?zl(n,r):null;if(o)(t.subMeters??=[]).push({id:r.id,parent:o,power:i,invert:!!r.meter_invert,floors:r.meter_floors??[],solar:[],batteries:[]});else if(r.type==="meter")t.grid??=i,t.gridExport??=wn(r.export);else if(r.type==="inverter")xn(t.solar,i);else if(r.type==="home_battery"){let s=wn(r.charge);xn(t.battery,i),xn(t.charge,s),xn(t.soc,wn(r.soc)),(i||s)&&t.batteries.push({power:i,charge:s})}}for(let r of t.subMeters?n.floors.flatMap(i=>i.furniture):[]){let i=r.type==="inverter"||r.type==="home_battery"?t.subMeters?.find(a=>a.id===Dr(n,r)):void 0,o=i?e(r):null;i&&r.type==="inverter"&&xn(i.solar,o);let s=wn(r.charge);i&&r.type==="home_battery"&&(o||s)&&i.batteries.push({power:o,charge:s})}return t}function q(n,e=!1){let t=n?.attributes.symcon_id?ge(n):n?Number(n.state):null;if(t===null||!Number.isFinite(t))return null;let r={kW:1e3,MW:1e6}[String(n.attributes.unit_of_measurement??"W")]??1;return e?-t*r:t*r}var km=(n,e)=>e.startsWith("sensor.")&&n.states[e]?.attributes.device_class==="power";function ve(n,e){if(km(n,e))return e;let t=n.entities?.[e]?.device_id;if(!t)return null;let r=Ui(n,t),i=r?nt(n,e):null,o=yr(n,t).filter(s=>s!==e);return(r?o.find(s=>i!==null&&nt(n,s)===i):o[0])??null}function Sn(n,e){let{grid:t,solar:r,battery:i}=e.energy,o=new Set([t,r,i].filter(a=>!!a)),s=[];for(let a of e.floors)for(let l of a.placements){let c=ve(n,l.entity_id);!c||o.has(c)||(o.add(c),s.push({id:l.entity_id,powerEntity:c,floorId:a.id,x:l.x,z:l.z,power:Math.max(0,q(n.states[c])??0)}))}return s}var Fl=n=>{let e=n.filter(t=>t!==null);return e.length?e.reduce((t,r)=>t+r,0):null};function Sm(n,e,t){let r=e.grid??t.grid,i=r?q(n.states[r],e.grid_invert):null;if(!e.grid&&t.gridExport){let o=Math.max(0,q(n.states[t.gridExport])??0);return Math.max(0,i??0)-o}return i}function $m(n,e,t){return e.solar?q(n.states[e.solar]):t.solar.length?Fl(t.solar.map(r=>q(n.states[r]))):null}function Hr(n,e,t){return e.charge?(e.power?Math.max(0,q(n.states[e.power])??0):0)-Math.max(0,q(n.states[e.charge])??0):e.power?q(n.states[e.power],t):null}function Mm(n,e,t){return e.battery?q(n.states[e.battery],e.battery_invert):Fl(t.batteries.map(r=>Hr(n,r,e.battery_invert)))}function $n(n,e,t,r=Ze(e)){let i=e.energy,o=Sm(n,i,r),s=$m(n,i,r),a=Mm(n,i,r),l=(i.battery_soc?[i.battery_soc]:r.soc).map(g=>Number(n.states[g]?.state)).filter(Number.isFinite),c=l.length?l.reduce((g,_)=>g+_,0)/l.length:null,u=i.tariff?n.states[i.tariff]:void 0,h=Number(u?.state),m=i.consumption?q(n.states[i.consumption]):null;m===null&&(o!==null||s!==null||a!==null)&&(m=(o??0)+Math.max(0,s??0)+(a??0)),m===null&&t.length>0&&(m=t.reduce((g,_)=>g+_.power,0));let d={grid:o,solar:s===null?null:Math.max(0,s),battery:a,soc:c,tariff:u&&Number.isFinite(h)?{value:h,unit:String(u.attributes.unit_of_measurement??"")}:null,consumption:m===null?null:Math.max(0,m)};return r.subMeters?{...d,...Am(n,r,d.consumption,i.battery_invert,t)}:d}function Am(n,e,t,r,i){let o=e.subMeters??[],s=new Map;for(let m of o)for(let d of m.floors)s.has(d)||s.set(d,m.id);let a=new Set([e.grid,e.gridExport,...e.solar,...e.battery,...e.charge,...o.flatMap(m=>[m.power,...m.solar,...m.batteries.flatMap(d=>[d.power,d.charge])])]),l=m=>i.filter(d=>s.get(d.floorId)===m&&!a.has(d.powerEntity)).reduce((d,g)=>d+g.power,0),c=new Map(o.map(m=>[m.id,m.power?q(n.states[m.power],m.invert):null])),u=o.map(m=>{let d=c.get(m.id)??null,g=m.solar.reduce((S,k)=>S+Math.max(0,q(n.states[k])??0),0),_=m.batteries.reduce((S,k)=>S+(Hr(n,k,r)??0),0),b=o.filter(S=>S.parent===m.id).reduce((S,k)=>S+(c.get(k.id)??0),0),y=d===null?null:Math.max(0,d+g+_-b);return{id:m.id,parent:m.parent,power:d,solar:g,battery:_,use:y,unmetered:y===null?null:Math.max(0,y-l(m.id))}}),h=u.reduce((m,d)=>m+(d.use??0),0);return{subMeters:u,rest:t===null?null:Math.max(0,t-h)}}var Em=(n,e="Station 1")=>({id:n,name:e,has_valve:!0}),Dl=n=>n.has_valve!==!1;function Pr(n){let e=n.hydronic??{};return e.stations?.length?e.stations.slice(0,16):[{...Em("station-1"),flow:e.flow,return:e.return,hot_water:e.hot_water,cold_water:e.cold_water,pump:e.pump}]}var Rm=["heating_manifold","buffer_tank","freshwater_station"],ot=n=>Rm.includes(n),zm=(n,e="Heizkreis")=>({id:n,name:e,kind:"heating",has_pump:!0,has_valve:!0});function Tm(n){return{card:!0,...n==="heating_manifold"?{circuits:[zm("c1","Heizkreis 1")]}:{},...n==="buffer_tank"?{sensors:Array.from({length:7},(e,t)=>({id:`s${t+1}`,name:`F\xFChler ${t+1}`,entity:null,level:1-t/6}))}:{}}}function po(n){return{...Tm(n.type),...n.hydronic}}var fo=n=>n.has_pump!==!1,Fm=n=>n.kind!=="pump"&&n.has_valve!==!1;var Ot=n=>!!n&&n!=="none",Mn=n=>[n?.command,n?.feedback];function Hl(n){if(!ot(n.type))return[];let e=po(n);return[...new Set([...n.type==="freshwater_station"?[]:[e.flow,e.return],...n.type==="heating_manifold"?(e.circuits??[]).flatMap(t=>[t.flow,t.return,t.power,t.mode_entity,...fo(t)?Mn(t.pump):[],...Fm(t)?Mn(t.valve):[]]):[],...n.type==="buffer_tank"?(e.sensors??[]).map(t=>t.entity):[],...n.type==="freshwater_station"?[e.circulation_temperature,...Mn(e.circulation),...Pr(n).flatMap(t=>[t.flow,t.return,t.hot_water,t.cold_water,t.power,...Mn(t.pump),...Dl(t)?Mn(t.valve):[]])]:[]].filter(Ot))]}var Cr=(n,e)=>String(n.states[e]?.attributes.symcon_source_entity||e);function Ir(n,e){let t=n.states[Cr(n,e)]?.attributes;return t?.device_class==="power"||/^[km]?w$/i.test(String(t?.unit_of_measurement??"").trim())}function go(n,e){let t=new Map;if(!V(n))return t;let r=Ke(n,[e]),i=(o,s,a,l,c)=>{if(!Ot(c))return;let u=e.rooms.find(m=>m.points.length>=3&&H([a,l],m.points));if(!u)return;let h=t.get(u.id)??[];h.push({id:o,name:s,source:Cr(n,c)}),t.set(u.id,h)};for(let o of e.furniture){if(!Ue(n,o))continue;let s=o.name||ae(n,o.type),a=(o.values??[]).find(u=>Ot(u.entity)&&Ir(n,u.entity)),l=r.get(o.id)?.entity,c=o.power==="none"?null:o.power||r.get(o.id)?.power||(l&&Ir(n,l)?l:null);if(i(`furniture:${o.id}`,s,o.x,o.z,c||a?.entity),!c&&!a){let u=new Set;for(let h of o.gang_entities??[]){if(!Ot(h))continue;let m=ve(n,h);!m||u.has(Cr(n,m))||(u.add(Cr(n,m)),i(`furniture:${o.id}:${h}`,`${s} \xB7 ${O(n,h)}`,o.x,o.z,m))}}if(ot(o.type))for(let u of po(o).circuits??[])fo(u)&&i(`furniture:${o.id}:${u.id}`,`${s} \xB7 ${u.name||"Pumpe"}`,o.x,o.z,u.power);if(o.type==="freshwater_station")for(let u of Pr(o))i(`furniture:${o.id}:station:${u.id}`,`${s} \xB7 ${u.name}`,o.x,o.z,u.power)}for(let o of e.placements){if(o.outside)continue;let s=(o.values??[]).find(l=>Ot(l.entity)&&Ir(n,l.entity)),a=Ir(n,o.entity_id)?o.entity_id:ve(n,o.entity_id);i(`device:${o.entity_id}`,o.name||O(n,o.entity_id),o.x,o.z,a||s?.entity)}return t}var Ie={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},An={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Or=n=>n.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Dm="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Hm=n=>n.object_type!==0&&!(n.object_type===1&&n.module_id?.toUpperCase()===Dm)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Or(n.name)]??null,Nr=n=>/^symcon-category-(\d+)$/.exec(n??"")?.[1],bo=n=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(n)?"day":/monat|month/.test(n)?"month":/jahr|year/.test(n)?"year":"total",Wr=(n,e)=>String(n.states[e]?.attributes.symcon_source_entity||e);function Cl(n){let e=String(n?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Pm(n,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Wr(n,e.entity_id),r=n.states[t];if(!r||![1,2].includes(Number(r.attributes.symcon_variable_type)))return null;let i=Or(e.name),o=Cl(r),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?bo(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(r.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var Pl=new WeakMap,Il=new WeakMap;function Nl(n){let e=Pl.get(n);if(e)return e;let t={nodes:new Map(n.map(r=>[r.object_id,r])),children:new Map};for(let r of n){let i=t.children.get(r.parent_id)??[];i.push(r),t.children.set(r.parent_id,i)}return Pl.set(n,t),t}function yo(n,e,t){if(!V(n))return[];let r=[e.area_id,...e.sub_areas??[]].map(Nr).filter(m=>!!m);if(!r.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Nr).filter(m=>!!m&&!r.includes(m))),o=`${r.join(",")}|${[...i].sort().join(",")}`,s=Il.get(n)??new Map;Il.set(n,s);let a=s.get(o);if(a)return a;let l=Nl(n.symconObjects),c=[],u=new Set,h=(m,d,g)=>{if(u.has(m)||i.has(String(m)))return;u.add(m);let _=l.nodes.get(m);if(!_)return;let b=Hm(_),y=b??d,S=new Set(b&&b!==d?[]:g),k=l.children.get(m)??[];if(y){let M=k.map(z=>Pm(n,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),D=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===D);for(let E of D>=100?T.slice(0,1):T)c.push({kind:y,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&h(M.object_id,y,S)};for(let m of r)h(Number(m),null,new Set);return s.set(o,c),c}function yt(n,e,t=!1){let r=new Map,i=new Set;for(let o of e){let s=Wr(n,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=n.states[s],c=Cl(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),h=`${o.kind}|${o.metric}|${u}|${o.period}`,m=r.get(h)??{kind:o.kind,metric:o.metric,unit:u,value:null,period:o.period,sources:[],manual:t,incomplete:!1},d=ge(l);d===null?m.incomplete=!0:m.value=(m.value??0)+d*(c?.metric===o.metric?c.factor:1),m.sources.push(s),r.set(h,m)}return[...r.values()]}function Lr(n,e){return Oe.flatMap(t=>["power","energy"].flatMap(r=>{let i=e.utility_meters?.[t]?.[r];if(!i||i==="none")return[];let o=Wr(n,i);return[{kind:t,metric:r,id:o,period:r==="energy"?bo(Or(String(n.states[o]?.attributes.friendly_name??""))):"total"}]}))}function Ll(n,e){return V(n)?yt(n,Lr(n,e),!0):[]}function Wt(n,e,t=[]){let r=Ll(n,e);return r.length?r:yt(n,yo(n,e,t))}function Bt(n,e,t=e.rooms,r=!1){if(!V(n))return[];let i=r?go(n,e):new Map,o=new Map;for(let a of e.rooms){let l=[...new Set([a.area_id,...a.sub_areas??[]].filter(c=>!!Nr(c)))];!l.length&&(Lr(n,a).length||i.get(a.id)?.length)&&l.push("unassigned");for(let c of l){let u=o.get(c)??{seed:a,members:[]};c===l[0]&&u.members.push(a),o.set(c,u)}}let s=Nl(n.symconObjects).nodes;return[...o].map(([a,l])=>{let c=s.get(Number(Nr(a))),u=a==="unassigned"?[]:yt(n,yo(n,{...l.seed,area_id:a,sub_areas:null},t)),h=yt(n,l.members.flatMap(g=>Lr(n,g)),!0),m=g=>u.some(_=>_.kind===g.kind&&_.metric===g.metric&&_.unit===g.unit&&_.period===g.period),d=l.members.map(g=>({id:g.id,name:g.name,readings:Ll(n,g),devices:(i.get(g.id)??[]).map(_=>({id:_.id,name:_.name,readings:yt(n,[{kind:"electricity",metric:"power",id:_.source,period:"total"}],!0)}))})).filter(g=>g.readings.length||g.devices.length);return{id:a,name:a==="unassigned"?"Nicht zugeordnet":c?.name||n.areas?.[a]?.name||"Bereich nicht verf\xFCgbar",path:c?.path||"",readings:[...u,...h.filter(g=>!m(g))],rooms:d}}).filter(a=>a.readings.length||a.rooms.length)}function _o(n,e,t,r){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:t==="electricity"&&r==="power"?e.power_entity:null;return o&&o!=="none"?Wr(n,o):null}function Ce(n,e,t=e.rooms){let r=Bt(n,e,t).flatMap(o=>o.readings.flatMap(s=>s.sources.map(a=>({kind:s.kind,metric:s.metric,period:s.period,id:a})))),i=[];for(let o of Oe)for(let s of["power","energy"]){let a=_o(n,e,o,s);i.push(...yt(n,a?[{kind:o,metric:s,id:a,period:s==="energy"?bo(Or(String(n.states[a]?.attributes.friendly_name??""))):"total"}]:r.filter(l=>l.kind===o&&l.metric===s),!!a))}return i}function Ol(n,e){let t=e.flatMap(i=>i.rooms),r=e.flatMap(i=>Ce(n,i,t).flatMap(o=>o.sources.map(s=>({kind:o.kind,metric:o.metric,period:o.period,id:s}))));return yt(n,r)}function Wl(n,e){let t=e.flatMap(r=>r.rooms);return[...new Set(e.flatMap(r=>[...r.rooms.flatMap(i=>yo(n,i,t).map(o=>o.id)),...r.rooms.flatMap(i=>Lr(n,i).map(o=>o.id)),...[...go(n,r).values()].flatMap(i=>i.map(o=>o.source)),...Oe.flatMap(i=>[_o(n,r,i,"power"),_o(n,r,i,"energy")]).filter(i=>!!i)]))]}function Vt(n){return n.metric==="power"?n.unit==="m\xB3/h"?"Durchfluss":"Leistung":{total:"Verbrauch",day:"Verbrauch heute",month:"Verbrauch Monat",year:"Verbrauch Jahr"}[n.period]}function Ne(n,e){let t=e.incomplete?"Err: ":"";if(e.value===null)return`${t}\u2013`;let r=e.unit==="W"&&Math.abs(e.value)>=1e3?e.value/1e3:e.value,i=e.unit==="W"&&Math.abs(e.value)>=1e3?"kW":e.unit,o=Number.isInteger(r)?0:Math.min(6,Math.max(2,1-Math.floor(Math.log10(Math.abs(r)))));return`${t}${L(n,r,o)}${i?` ${i}`:""}`}var vo=class extends Q{static properties={hass:{attribute:!1},readings:{attribute:!1}};constructor(){super(),this.readings=[]}render(){return p`${Oe.filter(e=>this.readings.some(t=>t.kind===e)).map(e=>p`
+

${An[e]} ${Ie[e]}

${this.readings.filter(t=>t.kind===e).map(t=>p`
this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(` `)}`}> @@ -256,12 +256,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states .reading span { color:var(--nf-muted,#aaa); } b { white-space:nowrap; font-variant-numeric:tabular-nums; } small { font-size:.85em; } - `};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",yo);var wo=Math.PI/180,Bl=3,Vl=.1,vo=1/6,Kl=(n,e)=>[Math.sin((e+n)*wo),-Math.cos((e+n)*wo)],Fm=["N","NE","E","SE","S","SW","W","NW"];function Hm(n,e,t){return Gl(n,e,t).map(r=>r.normal)}function Gl(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=$l(i,n.rooms,n.walls??[]),s=o?Al(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let c=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],u=a.roomLeft===e.id?c:[-c[0],-c[1]];r.push({opening:i,normal:[-u[0],-u[1]]})}return r}function Pm(n,e){let t=((Math.atan2(n[0],-n[1])/wo-e)%360+360)%360;return Fm[Math.round(t/45)%8]}var Ol=new WeakMap;function Ul(n,e){let t=Ol.get(e);return t||(t=Lt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Ol.set(e,t)),t}var Wl=new WeakMap;function Kt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Wl.get(e);s||Wl.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Im(n,e,t,r,i);return s.set(o,l),l}function Im(n,e,t,r,i){let o=n.settings.north??0,s=Hm(e,t,Ul(n,e)),a=[...new Set(s.map(c=>Pm(c,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let c=vo/2;c<24;c+=vo){let u=ft(Et(c,r.zone,i),r.latitude,r.longitude);if(u.elevationm[0]*h[0]+m[1]*h[1]>Vl)&&l++}return{hours:Math.round(l*vo*10)/10,facing:a}}function jl(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Kt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function ql(n,e,t,r,i=new Date){let o=ft(i,r.latitude,r.longitude);if(o.elevationa.normal[0]*s[0]+a.normal[1]*s[1]>Vl).map(a=>a.opening)}var Zl=n=>6.112*Math.exp(17.62*n/(243.12+n));function Gt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*Zl(n)/Zl(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Wr(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function vt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Br(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=na?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Cm={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Nm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Vr(n,e=!1){return n==="temperature"&&e?Nm:Cm[n]}var Lm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function Yl(n,e,t=!1){let{stops:r}=Vr(n,t),i=r.findIndex(([c])=>e<=c);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Lm(s,l,(e-o)/(a-o))}function xo(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of ko(n,e,t,r)){let a=q(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function ko(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(h=>h.rooms)??t.rooms).filter(h=>h.kind==="electricity"&&h.metric==="power");if(i.length)return i.filter(h=>h.unit==="W").flatMap(h=>h.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),c=new Set,u=(h,m)=>r.points.length>=3&&H([h,m],r.points);for(let h of t.placements){let m=u(h.x,h.z)?ve(n,h.entity_id):null;m&&c.add(m)}for(let h of t.furniture){if(!u(h.x,h.z))continue;let m=h.power&&h.power!=="none"?h.power:h.entity&&h.entity!=="none"?ve(n,h.entity):null;m&&c.add(m);for(let d of h.gang_entities??[]){let g=d&&d!=="none"?ve(n,d):null;g&&c.add(g)}}return[...c].filter(h=>!l.has(h))}function Jl(n,e,t){let r=new Map;for(let i of e.floors)for(let o of i.rooms){if(t==="power"){let a=xo(n,e,i,o);a!==null&&r.set(o.id,a);continue}if(t==="comfort"){let a=Br(Z(n,i,o,"temperature"),Z(n,i,o,"humidity"),Z(n,i,o,"co2"),vt(new Date,n.config?.latitude));a!==null&&r.set(o.id,a);continue}if(t==="sun"){let{latitude:a,longitude:l,time_zone:c}=n.config??{};if(a===void 0||l===void 0||i.layer)continue;r.set(o.id,Kt(e,i,o,{latitude:a,longitude:l,zone:c}).hours);continue}let s=t==="mould"?Gt(Z(n,i,o,"temperature"),Z(n,i,o,"humidity")):Z(n,i,o,t);s!==null&&r.set(o.id,s)}return r}function Ql(n,e=!1){let{stops:t}=Vr(n,e),r=t[0][0],i=t[t.length-1][0]-r;return`linear-gradient(90deg, ${t.map(([s,a])=>`rgb(${a.map(l=>Math.round(l*255)).join(",")}) ${Math.round((s-r)/i*100)}%`).join(", ")})`}function An(n,e=0){let t=new Date(n);return t.setHours(0,0,0,0),t.setDate(t.getDate()-e),t.getTime()}function Om(n,e,t){let r=Array.from({length:7},(u,h)=>An(t,6-h)),i=u=>Math.min(24,Math.max(0,(Math.min(t,u+864e5)-u)/36e5)),o=(u,h)=>{if(!u)return null;let m=(n[u]??[]).find(d=>Math.abs(new Date(d.start).getTime()-h)<3*36e5);return typeof m?.mean=="number"?m.mean:null},s=(u,h,m=1)=>{let d=u.map(g=>o(g,h)).filter(g=>g!==null);return d.length?d.reduce((g,_)=>g+_,0)*m:null},a=(u,h)=>u===null?null:Math.round(u*i(h)/1e3*10)/10,l=r.map(u=>a(s(e.solar,u),u)),c=r.map(u=>{if(e.consumption)return a(o(e.consumption,u),u);let h=[s(e.solar,u),s(e.grid?[e.grid]:[],u,e.gridInvert?-1:1),s(e.battery,u,e.batteryInvert?-1:1)];return h.every(m=>m===null)?null:a(Math.max(0,h.reduce((m,d)=>m+(d??0),0)),u)});return{days:r,solar:l,use:c}}async function Xl(n,e,t=Date.now()){let r=[...new Set([...e.solar,...e.battery,e.grid,e.consumption].filter(s=>!!s))];if(!r.length)return null;let i=await n.callWS({type:"recorder/statistics_during_period",start_time:new Date(An(t,6)).toISOString(),end_time:new Date(t).toISOString(),statistic_ids:r,period:"day",types:["mean"],units:{power:"W"}}),o=Om(i,e,t);return o.solar.some(s=>s!==null)||o.use.some(s=>s!==null)?o:null}var Wm=864e5,ec=36e5;function Bm(n){let e=new Date(An(n));return e.setDate(1),e.getTime()}function Vm(n,e,t){let r=An(t),[i,o,s]=[0,0,!1];for(let l of e)for(let c of n[l]??[]){if(typeof c.mean!="number")continue;let u=new Date(c.start).getTime(),h=Math.min(24,Math.max(0,(Math.min(t,u+Wm)-u)/ec)),m=Math.max(0,c.mean)*h/1e3;o+=m,Math.abs(u-r)<3*ec&&(i+=m),s=!0}let a=l=>Math.round(l*100)/100;return s?{today:a(i),month:a(o)}:null}async function tc(n,e,t=Date.now()){if(!e.length)return null;let r=await n.callWS({type:"recorder/statistics_during_period",start_time:new Date(Bm(t)).toISOString(),end_time:new Date(t).toISOString(),statistic_ids:[...e],period:"day",types:["mean"],units:{power:"W"}});return Vm(r,e,t)}function nc(n,e){if(!e||!Number.isFinite(e.value))return null;let t=/^\s*([^/\s]+)\s*\/\s*kWh\s*$/i.exec(e.unit);if(!t)return null;let r=/^(ct|cent|cents|c)$/i.test(t[1]),i=r||/^eur$/i.test(t[1])?"\u20AC":t[1];return{value:Math.round(n*e.value*(r?1:100))/100,currency:i}}var ic=20,rc=new WeakMap;function Km(n){let e=n.entities??{},t=rc.get(e);if(!t){t=new Map;for(let[r,i]of Object.entries(e))i.device_id&&r.startsWith("sensor.")&&n.states[r]?.attributes.device_class==="battery"&&!t.has(i.device_id)&&t.set(i.device_id,r);rc.set(e,t)}return t}function Gm(n,e){let t=n.entities?.[e]?.device_id,r=t?Km(n).get(t):void 0;if(r){let s=Number(n.states[r]?.state);if(Number.isFinite(s))return s}let i=n.states[e]?.attributes;if(!i||i.battery_level===void 0&&i.battery===void 0)return null;let o=Number(i.battery_level??i.battery);return Number.isFinite(o)?o:null}function Um(n){let e=[],t=r=>typeof r=="string"&&/^[a-z_]+\.[a-z0-9_]+$/.test(r);for(let r of n.placements)e.push({entity:r.entity_id,x:r.x,z:r.z,room:null});for(let r of n.furniture)for(let i of[r.entity,r.power])t(i)&&e.push({entity:i,x:r.x,z:r.z,room:null});for(let r of n.openings)for(let i of[r.contact,r.contact2,r.tilt,r.tilt2,r.cover,r.cover2,r.lock])t(i)&&e.push({entity:i,x:NaN,z:NaN,room:r.room_id});return e}var jm=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function oc(n,e){let t=new Set,r=[];for(let i of e.floors)for(let o of Um(i)){let s=n.entities?.[o.entity]?.device_id??o.entity;if(t.has(s))continue;let a=Gm(n,o.entity);a!==null&&(t.add(s),r.push({entity:o.entity,level:a,floorId:i.id,roomId:o.room??jm(i,o.x,o.z)?.id??null}))}return r.sort((i,o)=>i.level-o.level)}var sc=n=>n.toLowerCase().replace(/[_-]+/g," ").replace(/\s+/g," ").trim(),qm=new Set(["","unknown","unavailable","not home","away"]);function Zm(n,e,t){let r=sc(t);if(qm.has(r))return null;for(let i of e.floors)for(let o of i.rooms){let s=o.area_id?n.areas?.[o.area_id]?.name:void 0;if([o.name,o.area_id,s].map(l=>sc(l??"")).includes(r))return{floorId:i.id,room:o}}return null}function Ym(n,e){if(!e)return null;for(let t of n.floors){let r=t.rooms.find(i=>i.id===e);if(r)return{floorId:t.id,room:r}}return null}function Jm(n){let e=n.split(/\s+/).filter(Boolean);return e.length===0?"?":(e.length===1?e[0].slice(0,2):e[0][0]+e[e.length-1][0]).toUpperCase()}function Qm(n,e){let[t,r]=Te(n.points),i=e*1.15-Math.PI/2+.9;return[t+.75*Math.cos(i),r+.75*Math.sin(i)]}function ac(n,e){let t=[],r=new Map;for(let{person:i,sensor:o,room:s,name:a}of e.presence){let l=n.states[i],c=o?n.states[o]:void 0;if(!l||(V(n)?le(l)!==!0:l.state!=="home"&&l.state!=="on"))continue;let u=(!V(n)&&c?Zm(n,e,c.state):null)??Ym(e,s);if(!u)continue;let h=r.get(u.room.id)??0;r.set(u.room.id,h+1);let[m,d]=Qm(u.room,h),g=a?.trim()||String(l.attributes.friendly_name??i),_=l.attributes.entity_picture;t.push({id:i,name:g,initials:Jm(g),picture:typeof _=="string"?_:null,floorId:u.floorId,roomId:u.room.id,x:m,z:d})}return t}function Xm(n,e){let t=new Set;for(let r of e.rooms)for(let i of _t(n,U(n,r)))P(i)==="light"&&t.add(i);for(let r of e.placements)P(r.entity_id)==="light"&&t.add(r.entity_id);return[...t].filter(r=>n.states[r]?.state==="on").length}function ep(n,e,t){let r=o=>!!o&&n.states[o]?.state==="on",i=0;for(let o of e.openings){let s=t.get(o.id);if(s)if(o.type==="garage")(Ve(n,s,"garage").cover??1)<.95&&i++;else if(o.type==="door")(r(s.contact)||r(s.contact2))&&i++;else{let a=Ve(n,s,"window");Math.max(a.open,a.tilt,a.open2,a.tilt2)>.5&&i++}}return i}function lc(n,e,t,r){return new Map(e.floors.map(i=>{let o=V(n)?Ce(n,i,e.floors.flatMap(s=>s.rooms)).find(s=>s.kind==="electricity"&&s.metric==="power"&&s.unit==="W"):void 0;return[i.id,{rooms:i.rooms.length,lightsOn:Xm(n,i),open:ep(n,i,t),persons:r.filter(s=>s.floorId===i.id).length,power:V(n)?o?.value??null:i.power_entity?q(n.states[i.power_entity]):null,...o?{powerLabel:Ne(n,o)}:{},temps:tp(n,i)}]}))}function tp(n,e){let t=e.rooms.map(r=>Z(n,e,r,"temperature")).filter(r=>r!==null);return t.length>=2?[Math.min(...t),Math.max(...t)]:null}function cc(n,e){let t=[e.rooms===1?$(n,"floor_rooms_one"):$(n,"floor_rooms",{n:e.rooms})];if(e.lightsOn>0&&t.push($(n,"floor_lights",{n:e.lightsOn})),e.open>0&&t.push($(n,"floor_open",{n:e.open})),e.persons>0&&t.push($(n,"floor_persons",{n:e.persons})),e.temps&&n){let[i,o]=e.temps.map(s=>L(n,ce(n,s),0));t.push(i===o?`${i} ${re(n)}`:`${i}\u2013${o} ${re(n)}`)}let r=e.powerLabel??(e.power!=null?wt(n,e.power):null);return r&&t.push(`\u26A1 ${r}`),t.join(" \xB7 ")}function wt(n,e){let t=Math.abs(e);return t>=1e3?`${L(n,e/1e3,t>=1e4?1:2)} kW`:`${Math.round(e)} W`}function So(n){let e=Math.max(0,Math.floor(n/6e4));return e<60?`${e} min`:`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")} h`}function Kr(n){if(n.state!=="on")return{entity:n.entity_id,on:!1};let e=n.attributes,t={entity:n.entity_id,on:!0};typeof e.brightness=="number"&&(t.brightness=e.brightness);let r=String(e.color_mode??"");return Array.isArray(e.rgb_color)&&!["color_temp","brightness","onoff"].includes(r)?t.rgb=e.rgb_color.slice(0,3):typeof e.color_temp_kelvin=="number"&&(t.kelvin=e.color_temp_kelvin),t}function Gr(n){let e=n.filter(r=>!r.on).map(r=>r.entity);return[...n.filter(r=>r.on).map(r=>({service:"turn_on",data:{entity_id:r.entity,...r.brightness!==void 0?{brightness:r.brightness}:{},...r.rgb?{rgb_color:r.rgb}:r.kelvin?{color_temp_kelvin:r.kelvin}:{}}})),...e.length?[{service:"turn_off",data:{entity_id:e}}]:[]]}function uc(n,e){let t=[...n.lights].filter(r=>r.on).sort((r,i)=>(i.brightness??255)-(r.brightness??255))[0];return e.map((r,i)=>({...n.lights[i]??t??{entity:r,on:!1},entity:r}))}var np=n=>n.slice(0,n.indexOf(".")),rp=new Set(["switch","fan","input_boolean"]);function En(n){let e=[],t=new Map,r=[],i=[];for(let l of n){if(!l)continue;let c=np(l.entity_id);c==="light"&&l.state==="on"?e.push(l):rp.has(c)&&l.state==="on"?t.set(c,[...t.get(c)??[],l.entity_id]):c==="media_player"&&l.state==="playing"?r.push(l.entity_id):c==="media_player"&&(l.state==="on"||l.state==="idle")&&i.push(l.entity_id)}let o=[],s=[];e.length&&(o.push({domain:"light",service:"turn_off",data:{entity_id:e.map(l=>l.entity_id)}}),s.push(...Gr(e.map(Kr)).map(l=>({domain:"light",service:l.service,data:l.data}))));for(let[l,c]of t)o.push({domain:l,service:"turn_off",data:{entity_id:c}}),s.push({domain:l,service:"turn_on",data:{entity_id:c}});r.length&&(o.push({domain:"media_player",service:"media_pause",data:{entity_id:r}}),s.push({domain:"media_player",service:"media_play",data:{entity_id:r}})),i.length&&(o.push({domain:"media_player",service:"turn_off",data:{entity_id:i}}),s.push({domain:"media_player",service:"turn_on",data:{entity_id:i}}));let a=e.length+[...t.values()].reduce((l,c)=>l+c.length,0)+r.length+i.length;return{off:o,undo:s,count:a}}function dc(n){let e=new Set,t=r=>{typeof r=="string"&&/^(light|switch|fan|input_boolean|media_player)\./.test(r)&&e.add(r)};for(let r of n.placements)t(r.entity_id);for(let r of n.furniture){t(r.entity);for(let i of r.extra_lights??[])t(i)}return[...e]}var ip=/^(light|switch|cover|binary_sensor|lock|media_player|vacuum|fan|climate|lawn_mower|input_boolean|person|device_tracker|alarm_control_panel)\./;var hc=n=>[...new Set([...n].filter(e=>ip.test(e)))].slice(0,200);function op(n){let e=new Map;for(let[t,r]of Object.entries(n)){let i={},o=[];for(let s of r)s.a&&(i=s.a),o.push({t:Math.round((s.lu??s.lc??0)*1e3),state:s.s,attributes:i});o.sort((s,a)=>s.t-a.t),e.set(t,o)}return e}async function Rn(n,e,t,r,i=!1){if(e.length===0)return new Map;let o=await n.callWS({type:"history/history_during_period",start_time:new Date(t).toISOString(),end_time:new Date(r).toISOString(),entity_ids:e,include_start_time_state:!0,significant_changes_only:!1,minimal_response:i,no_attributes:i});return op(o)}function sp(n,e){let[t,r]=[0,n.length-1],i=null;for(;t<=r;){let o=t+r>>1;n[o].t<=e?(i=n[o],t=o+1):r=o-1}return i}function Ut(n,e,t){let r={...n.states};for(let[i,o]of e){let s=sp(o,t);if(!s)continue;let a=n.states[i];r[i]={...a??{entity_id:i},entity_id:i,state:s.state,attributes:{...a?.attributes??{},...s.attributes}}}return{...n,states:r}}function mc(n,e,t,r=400){let i=[];for(let s of n.values())for(let a=1;a=e&&s[a].t<=t&&i.push(s[a].t);if(i.sort((s,a)=>s-a),i.length<=r)return i;let o=i.length/r;return Array.from({length:r},(s,a)=>i[Math.floor(a*o)])}function pc(n,e){let t=new Set,r=new Proxy(n.states,{get(i,o){return typeof o=="string"&&t.add(o),i[o]}});return e({...n,states:r}),[...t].filter(i=>i.includes(".")&&i in n.states)}function fc(n,e,t,r,i,o=96){let s=[],a=[];for(let l=0;l{if(s===null){o=!1;return}let l=a/(n.length-1)*e,c=t-Math.max(0,Math.min(r,s))/r*t;i+=`${o?"L":"M"}${l.toFixed(1)},${c.toFixed(1)}`,o=!0}),i}var gc=n=>n==="wallbox"||/^pack:[^:]+:(wallbox|ev_charger|ev_bike_charger|charging_station)$/.test(n),_c=[["soc","\u{1F50B}","furn_soc"],["start","\u25B6","charging_start"],["end","\u25A0","charging_end"],["duration","\u23F1","charging_duration"],["energy","\u26A1","charging_energy"],["lock","\u{1F510}","charging_lock"]],bc=n=>!!n&&n!=="none",$o=n=>/^[+-]?\d+(?:[.,\s]\d{3})*(?:[.,]\d+)?$/.test(n.trim()),ap=(n,e)=>String(n.states[e]?.attributes.symcon_source_entity||e);function yc(n){return gc(n.type)?[...new Set(_c.map(([e])=>n.charging?.[e]).filter(bc))]:[]}function jt(n,e,t=""){if(fe(e)===null)return"\u2013";let r=e?.attributes.symcon_formatted;if(typeof r=="string"&&r.trim())return t&&/^[-+]?\d+(?:[.,]\d+)?$/.test(r.trim())?`${r} ${t}`:r;let i=ge(e);return i===null?Fe(e):`${L(n,i,Number.isInteger(i)?0:2)}${e?.attributes.unit_of_measurement||t?` ${e?.attributes.unit_of_measurement||t}`:""}`}function lp(n,e,t="auto"){if(fe(e)===null)return"\u2013";if(t==="value")return jt(n,e);let r=ge(e),i=fe(e),o=null;if(t!=="auto")o=r===null?null:r*(t==="seconds"?1e3:1);else{let s=e?.attributes.symcon_formatted;if(typeof s=="string"&&s.trim()&&!$o(s))return s;r!==null&&r>=1e8?o=r<1e11?r*1e3:r:typeof i=="string"&&/^\d{4}-\d\d-\d\d[T ]\d\d:\d\d/.test(i)&&(o=Date.parse(i))}return o===null||!Number.isFinite(o)||!Number.isFinite(new Date(o).getTime())?jt(n,e):new Date(o).toLocaleString(n.language||"de",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function cp(n,e,t="auto"){if(fe(e)===null)return"\u2013";if(t==="value")return jt(n,e);let r=ge(e);if(r===null)return jt(n,e);if(t==="auto"){let o=e?.attributes.symcon_formatted,s=String(e?.attributes.unit_of_measurement??"").trim();if(typeof o=="string"&&o.trim()&&!$o(o)&&!(s&&o.trim().endsWith(s)&&$o(o.trim().slice(0,-s.length).trim())))return o;t=/^(min|minute[n]?|minutes)$/i.test(s)?"minutes":/^(h|std\.?|stunde[n]?|hours?)$/i.test(s)?"hours":"seconds"}let i=Math.round(Math.abs(r)*(t==="hours"?3600:t==="minutes"?60:1));return Number.isSafeInteger(i)?`${r<0?"\u2212":""}${Math.floor(i/3600)}:${String(Math.floor(i/60)%60).padStart(2,"0")}:${String(i%60).padStart(2,"0")}`:jt(n,e)}function Ur(n,e){if(!gc(e.type))return[];let t=e.charging;return _c.flatMap(([r,i,o])=>{let s=t?.[r];if(!bc(s))return[];let a=ap(n,s),l=n.states[a],c=r==="start"||r==="end"?lp(n,l,t?.[`${r}_format`]):r==="duration"?cp(n,l,t?.duration_unit):jt(n,l,r==="soc"?"%":"");return[{id:r,entity:a,icon:i,label:$(n,o),text:c}]})}var up=4,dp=8,hp=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],qt=n=>p``,jr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Mo=n=>p``,mp=24,pp=10,Ao=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Gr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>U(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Kr)}]),this._moodName=null};return p`
+ `};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",vo);var xo=Math.PI/180,Kl=3,Gl=.1,wo=1/6,Ul=(n,e)=>[Math.sin((e+n)*xo),-Math.cos((e+n)*xo)],Im=["N","NE","E","SE","S","SW","W","NW"];function Cm(n,e,t){return jl(n,e,t).map(r=>r.normal)}function jl(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Ml(i,n.rooms,n.walls??[]),s=o?El(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let c=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],u=a.roomLeft===e.id?c:[-c[0],-c[1]];r.push({opening:i,normal:[-u[0],-u[1]]})}return r}function Nm(n,e){let t=((Math.atan2(n[0],-n[1])/xo-e)%360+360)%360;return Im[Math.round(t/45)%8]}var Bl=new WeakMap;function ql(n,e){let t=Bl.get(e);return t||(t=Lt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Bl.set(e,t)),t}var Vl=new WeakMap;function Kt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Vl.get(e);s||Vl.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Lm(n,e,t,r,i);return s.set(o,l),l}function Lm(n,e,t,r,i){let o=n.settings.north??0,s=Cm(e,t,ql(n,e)),a=[...new Set(s.map(c=>Nm(c,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let c=wo/2;c<24;c+=wo){let u=ft(Et(c,r.zone,i),r.latitude,r.longitude);if(u.elevationm[0]*h[0]+m[1]*h[1]>Gl)&&l++}return{hours:Math.round(l*wo*10)/10,facing:a}}function Zl(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Kt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function Yl(n,e,t,r,i=new Date){let o=ft(i,r.latitude,r.longitude);if(o.elevationa.normal[0]*s[0]+a.normal[1]*s[1]>Gl).map(a=>a.opening)}var Jl=n=>6.112*Math.exp(17.62*n/(243.12+n));function Gt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*Jl(n)/Jl(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Br(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function vt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Vr(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=na?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Om={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Wm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Kr(n,e=!1){return n==="temperature"&&e?Wm:Om[n]}var Bm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function Ql(n,e,t=!1){let{stops:r}=Kr(n,t),i=r.findIndex(([c])=>e<=c);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Bm(s,l,(e-o)/(a-o))}function ko(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of So(n,e,t,r)){let a=q(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function So(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(h=>h.rooms)??t.rooms).filter(h=>h.kind==="electricity"&&h.metric==="power");if(i.length)return i.filter(h=>h.unit==="W").flatMap(h=>h.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),c=new Set,u=(h,m)=>r.points.length>=3&&H([h,m],r.points);for(let h of t.placements){let m=u(h.x,h.z)?ve(n,h.entity_id):null;m&&c.add(m)}for(let h of t.furniture){if(!u(h.x,h.z))continue;let m=h.power&&h.power!=="none"?h.power:h.entity&&h.entity!=="none"?ve(n,h.entity):null;m&&c.add(m);for(let d of h.gang_entities??[]){let g=d&&d!=="none"?ve(n,d):null;g&&c.add(g)}}return[...c].filter(h=>!l.has(h))}function Xl(n,e,t){let r=new Map;for(let i of e.floors)for(let o of i.rooms){if(t==="power"){let a=ko(n,e,i,o);a!==null&&r.set(o.id,a);continue}if(t==="comfort"){let a=Vr(Z(n,i,o,"temperature"),Z(n,i,o,"humidity"),Z(n,i,o,"co2"),vt(new Date,n.config?.latitude));a!==null&&r.set(o.id,a);continue}if(t==="sun"){let{latitude:a,longitude:l,time_zone:c}=n.config??{};if(a===void 0||l===void 0||i.layer)continue;r.set(o.id,Kt(e,i,o,{latitude:a,longitude:l,zone:c}).hours);continue}let s=t==="mould"?Gt(Z(n,i,o,"temperature"),Z(n,i,o,"humidity")):Z(n,i,o,t);s!==null&&r.set(o.id,s)}return r}function ec(n,e=!1){let{stops:t}=Kr(n,e),r=t[0][0],i=t[t.length-1][0]-r;return`linear-gradient(90deg, ${t.map(([s,a])=>`rgb(${a.map(l=>Math.round(l*255)).join(",")}) ${Math.round((s-r)/i*100)}%`).join(", ")})`}function En(n,e=0){let t=new Date(n);return t.setHours(0,0,0,0),t.setDate(t.getDate()-e),t.getTime()}function Vm(n,e,t){let r=Array.from({length:7},(u,h)=>En(t,6-h)),i=u=>Math.min(24,Math.max(0,(Math.min(t,u+864e5)-u)/36e5)),o=(u,h)=>{if(!u)return null;let m=(n[u]??[]).find(d=>Math.abs(new Date(d.start).getTime()-h)<3*36e5);return typeof m?.mean=="number"?m.mean:null},s=(u,h,m=1)=>{let d=u.map(g=>o(g,h)).filter(g=>g!==null);return d.length?d.reduce((g,_)=>g+_,0)*m:null},a=(u,h)=>u===null?null:Math.round(u*i(h)/1e3*10)/10,l=r.map(u=>a(s(e.solar,u),u)),c=r.map(u=>{if(e.consumption)return a(o(e.consumption,u),u);let h=[s(e.solar,u),s(e.grid?[e.grid]:[],u,e.gridInvert?-1:1),s(e.battery,u,e.batteryInvert?-1:1)];return h.every(m=>m===null)?null:a(Math.max(0,h.reduce((m,d)=>m+(d??0),0)),u)});return{days:r,solar:l,use:c}}async function tc(n,e,t=Date.now()){let r=[...new Set([...e.solar,...e.battery,e.grid,e.consumption].filter(s=>!!s))];if(!r.length)return null;let i=await n.callWS({type:"recorder/statistics_during_period",start_time:new Date(En(t,6)).toISOString(),end_time:new Date(t).toISOString(),statistic_ids:r,period:"day",types:["mean"],units:{power:"W"}}),o=Vm(i,e,t);return o.solar.some(s=>s!==null)||o.use.some(s=>s!==null)?o:null}var Km=864e5,nc=36e5;function Gm(n){let e=new Date(En(n));return e.setDate(1),e.getTime()}function Um(n,e,t){let r=En(t),[i,o,s]=[0,0,!1];for(let l of e)for(let c of n[l]??[]){if(typeof c.mean!="number")continue;let u=new Date(c.start).getTime(),h=Math.min(24,Math.max(0,(Math.min(t,u+Km)-u)/nc)),m=Math.max(0,c.mean)*h/1e3;o+=m,Math.abs(u-r)<3*nc&&(i+=m),s=!0}let a=l=>Math.round(l*100)/100;return s?{today:a(i),month:a(o)}:null}async function rc(n,e,t=Date.now()){if(!e.length)return null;let r=await n.callWS({type:"recorder/statistics_during_period",start_time:new Date(Gm(t)).toISOString(),end_time:new Date(t).toISOString(),statistic_ids:[...e],period:"day",types:["mean"],units:{power:"W"}});return Um(r,e,t)}function ic(n,e){if(!e||!Number.isFinite(e.value))return null;let t=/^\s*([^/\s]+)\s*\/\s*kWh\s*$/i.exec(e.unit);if(!t)return null;let r=/^(ct|cent|cents|c)$/i.test(t[1]),i=r||/^eur$/i.test(t[1])?"\u20AC":t[1];return{value:Math.round(n*e.value*(r?1:100))/100,currency:i}}var sc=20,oc=new WeakMap;function jm(n){let e=n.entities??{},t=oc.get(e);if(!t){t=new Map;for(let[r,i]of Object.entries(e))i.device_id&&r.startsWith("sensor.")&&n.states[r]?.attributes.device_class==="battery"&&!t.has(i.device_id)&&t.set(i.device_id,r);oc.set(e,t)}return t}function qm(n,e){let t=n.entities?.[e]?.device_id,r=t?jm(n).get(t):void 0;if(r){let s=Number(n.states[r]?.state);if(Number.isFinite(s))return s}let i=n.states[e]?.attributes;if(!i||i.battery_level===void 0&&i.battery===void 0)return null;let o=Number(i.battery_level??i.battery);return Number.isFinite(o)?o:null}function Zm(n){let e=[],t=r=>typeof r=="string"&&/^[a-z_]+\.[a-z0-9_]+$/.test(r);for(let r of n.placements)e.push({entity:r.entity_id,x:r.x,z:r.z,room:null});for(let r of n.furniture)for(let i of[r.entity,r.power])t(i)&&e.push({entity:i,x:r.x,z:r.z,room:null});for(let r of n.openings)for(let i of[r.contact,r.contact2,r.tilt,r.tilt2,r.cover,r.cover2,r.lock])t(i)&&e.push({entity:i,x:NaN,z:NaN,room:r.room_id});return e}var Ym=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ac(n,e){let t=new Set,r=[];for(let i of e.floors)for(let o of Zm(i)){let s=n.entities?.[o.entity]?.device_id??o.entity;if(t.has(s))continue;let a=qm(n,o.entity);a!==null&&(t.add(s),r.push({entity:o.entity,level:a,floorId:i.id,roomId:o.room??Ym(i,o.x,o.z)?.id??null}))}return r.sort((i,o)=>i.level-o.level)}var lc=n=>n.toLowerCase().replace(/[_-]+/g," ").replace(/\s+/g," ").trim(),Jm=new Set(["","unknown","unavailable","not home","away"]);function Qm(n,e,t){let r=lc(t);if(Jm.has(r))return null;for(let i of e.floors)for(let o of i.rooms){let s=o.area_id?n.areas?.[o.area_id]?.name:void 0;if([o.name,o.area_id,s].map(l=>lc(l??"")).includes(r))return{floorId:i.id,room:o}}return null}function Xm(n,e){if(!e)return null;for(let t of n.floors){let r=t.rooms.find(i=>i.id===e);if(r)return{floorId:t.id,room:r}}return null}function ep(n){let e=n.split(/\s+/).filter(Boolean);return e.length===0?"?":(e.length===1?e[0].slice(0,2):e[0][0]+e[e.length-1][0]).toUpperCase()}function tp(n,e){let[t,r]=Te(n.points),i=e*1.15-Math.PI/2+.9;return[t+.75*Math.cos(i),r+.75*Math.sin(i)]}function cc(n,e){let t=[],r=new Map;for(let{person:i,sensor:o,room:s,name:a}of e.presence){let l=n.states[i],c=o?n.states[o]:void 0;if(!l||(V(n)?le(l)!==!0:l.state!=="home"&&l.state!=="on"))continue;let u=(!V(n)&&c?Qm(n,e,c.state):null)??Xm(e,s);if(!u)continue;let h=r.get(u.room.id)??0;r.set(u.room.id,h+1);let[m,d]=tp(u.room,h),g=a?.trim()||String(l.attributes.friendly_name??i),_=l.attributes.entity_picture;t.push({id:i,name:g,initials:ep(g),picture:typeof _=="string"?_:null,floorId:u.floorId,roomId:u.room.id,x:m,z:d})}return t}function np(n,e){let t=new Set;for(let r of e.rooms)for(let i of _t(n,U(n,r)))P(i)==="light"&&t.add(i);for(let r of e.placements)P(r.entity_id)==="light"&&t.add(r.entity_id);return[...t].filter(r=>n.states[r]?.state==="on").length}function rp(n,e,t){let r=o=>!!o&&n.states[o]?.state==="on",i=0;for(let o of e.openings){let s=t.get(o.id);if(s)if(o.type==="garage")(Ve(n,s,"garage").cover??1)<.95&&i++;else if(o.type==="door")(r(s.contact)||r(s.contact2))&&i++;else{let a=Ve(n,s,"window");Math.max(a.open,a.tilt,a.open2,a.tilt2)>.5&&i++}}return i}function uc(n,e,t,r){return new Map(e.floors.map(i=>{let o=V(n)?Ce(n,i,e.floors.flatMap(s=>s.rooms)).find(s=>s.kind==="electricity"&&s.metric==="power"&&s.unit==="W"):void 0;return[i.id,{rooms:i.rooms.length,lightsOn:np(n,i),open:rp(n,i,t),persons:r.filter(s=>s.floorId===i.id).length,power:V(n)?o?.value??null:i.power_entity?q(n.states[i.power_entity]):null,...o?{powerLabel:Ne(n,o)}:{},temps:ip(n,i)}]}))}function ip(n,e){let t=e.rooms.map(r=>Z(n,e,r,"temperature")).filter(r=>r!==null);return t.length>=2?[Math.min(...t),Math.max(...t)]:null}function dc(n,e){let t=[e.rooms===1?$(n,"floor_rooms_one"):$(n,"floor_rooms",{n:e.rooms})];if(e.lightsOn>0&&t.push($(n,"floor_lights",{n:e.lightsOn})),e.open>0&&t.push($(n,"floor_open",{n:e.open})),e.persons>0&&t.push($(n,"floor_persons",{n:e.persons})),e.temps&&n){let[i,o]=e.temps.map(s=>L(n,ce(n,s),0));t.push(i===o?`${i} ${re(n)}`:`${i}\u2013${o} ${re(n)}`)}let r=e.powerLabel??(e.power!=null?wt(n,e.power):null);return r&&t.push(`\u26A1 ${r}`),t.join(" \xB7 ")}function wt(n,e){let t=Math.abs(e);return t>=1e3?`${L(n,e/1e3,t>=1e4?1:2)} kW`:`${Math.round(e)} W`}function $o(n){let e=Math.max(0,Math.floor(n/6e4));return e<60?`${e} min`:`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")} h`}function Gr(n){if(n.state!=="on")return{entity:n.entity_id,on:!1};let e=n.attributes,t={entity:n.entity_id,on:!0};typeof e.brightness=="number"&&(t.brightness=e.brightness);let r=String(e.color_mode??"");return Array.isArray(e.rgb_color)&&!["color_temp","brightness","onoff"].includes(r)?t.rgb=e.rgb_color.slice(0,3):typeof e.color_temp_kelvin=="number"&&(t.kelvin=e.color_temp_kelvin),t}function Ur(n){let e=n.filter(r=>!r.on).map(r=>r.entity);return[...n.filter(r=>r.on).map(r=>({service:"turn_on",data:{entity_id:r.entity,...r.brightness!==void 0?{brightness:r.brightness}:{},...r.rgb?{rgb_color:r.rgb}:r.kelvin?{color_temp_kelvin:r.kelvin}:{}}})),...e.length?[{service:"turn_off",data:{entity_id:e}}]:[]]}function hc(n,e){let t=[...n.lights].filter(r=>r.on).sort((r,i)=>(i.brightness??255)-(r.brightness??255))[0];return e.map((r,i)=>({...n.lights[i]??t??{entity:r,on:!1},entity:r}))}var op=n=>n.slice(0,n.indexOf(".")),sp=new Set(["switch","fan","input_boolean"]);function Rn(n){let e=[],t=new Map,r=[],i=[];for(let l of n){if(!l)continue;let c=op(l.entity_id);c==="light"&&l.state==="on"?e.push(l):sp.has(c)&&l.state==="on"?t.set(c,[...t.get(c)??[],l.entity_id]):c==="media_player"&&l.state==="playing"?r.push(l.entity_id):c==="media_player"&&(l.state==="on"||l.state==="idle")&&i.push(l.entity_id)}let o=[],s=[];e.length&&(o.push({domain:"light",service:"turn_off",data:{entity_id:e.map(l=>l.entity_id)}}),s.push(...Ur(e.map(Gr)).map(l=>({domain:"light",service:l.service,data:l.data}))));for(let[l,c]of t)o.push({domain:l,service:"turn_off",data:{entity_id:c}}),s.push({domain:l,service:"turn_on",data:{entity_id:c}});r.length&&(o.push({domain:"media_player",service:"media_pause",data:{entity_id:r}}),s.push({domain:"media_player",service:"media_play",data:{entity_id:r}})),i.length&&(o.push({domain:"media_player",service:"turn_off",data:{entity_id:i}}),s.push({domain:"media_player",service:"turn_on",data:{entity_id:i}}));let a=e.length+[...t.values()].reduce((l,c)=>l+c.length,0)+r.length+i.length;return{off:o,undo:s,count:a}}function mc(n){let e=new Set,t=r=>{typeof r=="string"&&/^(light|switch|fan|input_boolean|media_player)\./.test(r)&&e.add(r)};for(let r of n.placements)t(r.entity_id);for(let r of n.furniture){t(r.entity);for(let i of r.extra_lights??[])t(i)}return[...e]}var ap=/^(light|switch|cover|binary_sensor|lock|media_player|vacuum|fan|climate|lawn_mower|input_boolean|person|device_tracker|alarm_control_panel)\./;var pc=n=>[...new Set([...n].filter(e=>ap.test(e)))].slice(0,200);function lp(n){let e=new Map;for(let[t,r]of Object.entries(n)){let i={},o=[];for(let s of r)s.a&&(i=s.a),o.push({t:Math.round((s.lu??s.lc??0)*1e3),state:s.s,attributes:i});o.sort((s,a)=>s.t-a.t),e.set(t,o)}return e}async function zn(n,e,t,r,i=!1){if(e.length===0)return new Map;let o=await n.callWS({type:"history/history_during_period",start_time:new Date(t).toISOString(),end_time:new Date(r).toISOString(),entity_ids:e,include_start_time_state:!0,significant_changes_only:!1,minimal_response:i,no_attributes:i});return lp(o)}function cp(n,e){let[t,r]=[0,n.length-1],i=null;for(;t<=r;){let o=t+r>>1;n[o].t<=e?(i=n[o],t=o+1):r=o-1}return i}function Ut(n,e,t){let r={...n.states};for(let[i,o]of e){let s=cp(o,t);if(!s)continue;let a=n.states[i];r[i]={...a??{entity_id:i},entity_id:i,state:s.state,attributes:{...a?.attributes??{},...s.attributes}}}return{...n,states:r}}function fc(n,e,t,r=400){let i=[];for(let s of n.values())for(let a=1;a=e&&s[a].t<=t&&i.push(s[a].t);if(i.sort((s,a)=>s-a),i.length<=r)return i;let o=i.length/r;return Array.from({length:r},(s,a)=>i[Math.floor(a*o)])}function gc(n,e){let t=new Set,r=new Proxy(n.states,{get(i,o){return typeof o=="string"&&t.add(o),i[o]}});return e({...n,states:r}),[...t].filter(i=>i.includes(".")&&i in n.states)}function _c(n,e,t,r,i,o=96){let s=[],a=[];for(let l=0;l{if(s===null){o=!1;return}let l=a/(n.length-1)*e,c=t-Math.max(0,Math.min(r,s))/r*t;i+=`${o?"L":"M"}${l.toFixed(1)},${c.toFixed(1)}`,o=!0}),i}var bc=n=>n==="wallbox"||/^pack:[^:]+:(wallbox|ev_charger|ev_bike_charger|charging_station)$/.test(n),yc=[["soc","\u{1F50B}","furn_soc"],["start","\u25B6","charging_start"],["end","\u25A0","charging_end"],["duration","\u23F1","charging_duration"],["energy","\u26A1","charging_energy"],["lock","\u{1F510}","charging_lock"]],vc=n=>!!n&&n!=="none",Mo=n=>/^[+-]?\d+(?:[.,\s]\d{3})*(?:[.,]\d+)?$/.test(n.trim()),up=(n,e)=>String(n.states[e]?.attributes.symcon_source_entity||e);function wc(n){return bc(n.type)?[...new Set(yc.map(([e])=>n.charging?.[e]).filter(vc))]:[]}function jt(n,e,t=""){if(fe(e)===null)return"\u2013";let r=e?.attributes.symcon_formatted;if(typeof r=="string"&&r.trim())return t&&/^[-+]?\d+(?:[.,]\d+)?$/.test(r.trim())?`${r} ${t}`:r;let i=ge(e);return i===null?De(e):`${L(n,i,Number.isInteger(i)?0:2)}${e?.attributes.unit_of_measurement||t?` ${e?.attributes.unit_of_measurement||t}`:""}`}function dp(n,e,t="auto"){if(fe(e)===null)return"\u2013";if(t==="value")return jt(n,e);let r=ge(e),i=fe(e),o=null;if(t!=="auto")o=r===null?null:r*(t==="seconds"?1e3:1);else{let s=e?.attributes.symcon_formatted;if(typeof s=="string"&&s.trim()&&!Mo(s))return s;r!==null&&r>=1e8?o=r<1e11?r*1e3:r:typeof i=="string"&&/^\d{4}-\d\d-\d\d[T ]\d\d:\d\d/.test(i)&&(o=Date.parse(i))}return o===null||!Number.isFinite(o)||!Number.isFinite(new Date(o).getTime())?jt(n,e):new Date(o).toLocaleString(n.language||"de",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function hp(n,e,t="auto"){if(fe(e)===null)return"\u2013";if(t==="value")return jt(n,e);let r=ge(e);if(r===null)return jt(n,e);if(t==="auto"){let o=e?.attributes.symcon_formatted,s=String(e?.attributes.unit_of_measurement??"").trim();if(typeof o=="string"&&o.trim()&&!Mo(o)&&!(s&&o.trim().endsWith(s)&&Mo(o.trim().slice(0,-s.length).trim())))return o;t=/^(min|minute[n]?|minutes)$/i.test(s)?"minutes":/^(h|std\.?|stunde[n]?|hours?)$/i.test(s)?"hours":"seconds"}let i=Math.round(Math.abs(r)*(t==="hours"?3600:t==="minutes"?60:1));return Number.isSafeInteger(i)?`${r<0?"\u2212":""}${Math.floor(i/3600)}:${String(Math.floor(i/60)%60).padStart(2,"0")}:${String(i%60).padStart(2,"0")}`:jt(n,e)}function jr(n,e){if(!bc(e.type))return[];let t=e.charging;return yc.flatMap(([r,i,o])=>{let s=t?.[r];if(!vc(s))return[];let a=up(n,s),l=n.states[a],c=r==="start"||r==="end"?dp(n,l,t?.[`${r}_format`]):r==="duration"?hp(n,l,t?.duration_unit):jt(n,l,r==="soc"?"%":"");return[{id:r,entity:a,icon:i,label:$(n,o),text:c}]})}var mp=4,pp=8,fp=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],qt=n=>p``,qr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Ao=n=>p``,gp=24,_p=10,Eo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Ur(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>U(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Gr)}]),this._moodName=null};return p`
${r.map(l=>p` - ${o.length?p`{let u=c.target,h=o.find(m=>m.id===u.value);u.value="",h&&this.runMood(hc(l,s(h)))}}> ${o.map(c=>p``)} `:f} @@ -271,37 +271,37 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states >this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} /> `:f} -
`}async loadCurve(e){let t=be(this.hass,this.floor,e,"temperature"),r=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Rn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Ut(this.hass,s,o+(i-o)*l/96),u=r.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,m)=>h+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=ko(this.hass,this.building,this.floor,e);try{let r=await tc(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=U(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o +
`}async loadCurve(e){let t=be(this.hass,this.floor,e,"temperature"),r=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await zn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Ut(this.hass,s,o+(i-o)*l/96),u=r.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,m)=>h+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=So(this.hass,this.building,this.floor,e);try{let r=await rc(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=U(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<_p?f:p`
💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}
`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let r=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!r.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of r)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`
🪟 ${this.t("open_heating_hint",{n:o.length})} -
`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(ql(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`
+
`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Yl(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`
☀ ${this.t("shade_hint",{n:s.length,temp:`${L(this.hass,ce(this.hass,i),1)} ${re(this.hass)}`})}
`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Kt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p``;if(!this._sunYear)return s;let a=jl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s} + `;if(!this._sunYear)return s;let a=Zl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s} `}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=nc(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`

+

`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=ic(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`

⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${L(this.hass,o.value,2)} ${o.currency}`:""} -

`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(c=>c===null?null:c-r+o*.1),a=zn(s,220,36,o*1.2),l=c=>`${L(this.hass,ce(this.hass,c),1)}\xB0`;return p`
+

`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(c=>c===null?null:c-r+o*.1),a=Tn(s,220,36,o*1.2),l=c=>`${L(this.hass,ce(this.hass,c),1)}\xB0`;return p`
24 h · ${l(r)} – ${l(i)} -
`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,r){this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`
`}allOff(e){let t=En(e);for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`
${this.t("all_off_done")}
`;let{count:t}=En(e);return t<2?f:p`
`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p``}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return p`
`}allOff(e){let t=Rn(e);for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`
${this.t("all_off_done")}
`;let{count:t}=Rn(e);return t<2?f:p`
`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p``}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return p``}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??U(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Na(this.hass,this.floor,t):{shown:r,more:[]}},a=Ui(this.hass,s).map(R=>R.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),u=new Set(c.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(R=>!V(this.hass)||!u.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>h.filter(F=>R.includes(P(F))).map(F=>this.hass.states[F]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),y=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=d.filter(R=>R.state==="on");return p`
+ >`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??U(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?La(this.hass,this.floor,t):{shown:r,more:[]}},a=ji(this.hass,s).map(R=>R.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),u=new Set(c.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(R=>!V(this.hass)||!u.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>h.filter(D=>R.includes(P(D))).map(D=>this.hass.states[D]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),y=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=d.filter(R=>R.state==="on");return p`

${t.name}

- ${M.length?p`

${M.map((R,F)=>p`${F?" \xB7 ":f}${R}`)}

`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()} + ${M.length?p`

${M.map((R,D)=>p`${D?" \xB7 ":f}${R}`)}

`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()} ${this.renderOpenWhileHeating(_)} ${this.renderEmptyLights(t,z)} ${this.renderCurve()}
@@ -331,9 +331,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states `:f}${z.length?p``:f}`):f} - ${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&hr(g,this.confirmEntities).length?p``:f):f} ${V(this.hass)?p``:f} @@ -342,18 +342,18 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${y.length?this.section("panel_switches",y.map(R=>this.switchRow(R))):f} ${S.length?this.section("panel_sensors",S.map(R=>this.sensorRow(R))):f} ${this.extraValues(t)} - ${!V(this.hass)&&ml(this.hass)&&hl(this.hass,this.floor,t)?this.announceSection(t):f} + ${!V(this.hass)&&pl(this.hass)&&ml(this.hass,this.floor,t)?this.announceSection(t):f} ${this.pluginSections(t,h)} ${l?p``:f}
- `}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Ar(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...Ur(this.hass,r),...Ar(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>p`
${r.name}${r.rows.map(i=>p`
${i.icon}${i.label}${i.text}${G(this.hass,[i.entity],i.label)}
`)}
`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,r,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,ce(this.hass,A),1)} ${re(this.hass)}`;let I=be(this.hass,this.floor,r,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??E;return`${L(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,be(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,be(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${G(this.hass,be(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let c=Wt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?xo(this.hass,this.building,this.floor,r):null;c?t.push(p`⚡ ${Ne(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${wt(this.hass,u)}`);let h=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];h.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:So(Date.now()-Math.min(...h))})}`);let m=U(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:So(Date.now()-T)})}`)}let d=this.building?oc(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let T=Kt(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,r,"temperature"),M=Z(this.hass,this.floor,r,"humidity"),z=Wr(Z(this.hass,this.floor,r,"co2"),M,Gt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Br(k,M,Z(this.hass,this.floor,r,"co2"),vt(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(p`${Fe(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[p`
${t.map(o=>p``)}
+ `}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Er(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...jr(this.hass,r),...Er(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>p`
${r.name}${r.rows.map(i=>p`
${i.icon}${i.label}${i.text}${G(this.hass,[i.entity],i.label)}
`)}
`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,r,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,ce(this.hass,A),1)} ${re(this.hass)}`;let I=be(this.hass,this.floor,r,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??E;return`${L(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,be(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,be(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${G(this.hass,be(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let c=Wt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?ko(this.hass,this.building,this.floor,r):null;c?t.push(p`⚡ ${Ne(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${wt(this.hass,u)}`);let h=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];h.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:$o(Date.now()-Math.min(...h))})}`);let m=U(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:$o(Date.now()-T)})}`)}let d=this.building?ac(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let T=Kt(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,r,"temperature"),M=Z(this.hass,this.floor,r,"humidity"),z=Br(Z(this.hass,this.floor,r,"co2"),M,Gt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Vr(k,M,Z(this.hass,this.floor,r,"co2"),vt(new Date,this.hass.config?.latitude)),D=r.hvac?.status;return D&&D!=="none"?t.push(p`${De(this.hass.states[D])}${G(this.hass,[D],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[p`
${t.map(o=>p``)}
- ${this._said?p`

${this._said.text}

`:f}`])}pluginSections(e,t){return Zs({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`
+ ${this._said?p`

${this._said.text}

`:f}`])}pluginSections(e,t){return Ys({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`

${i.title}

${typeof i.content=="string"?p`

${i.content}

`:i.content}
`)}section(e,t,r=f){return p`
@@ -384,23 +384,23 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states @change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})} />`:f} ${r&&a&&!m?p`
- ${hp.map(d=>p``)}
`:f} -
`}coverRow(e){let t=xr(this.hass,this.building?.floors??[],e.entity_id);e=kr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=C(e)&&!pn(e);return p`
+
`}coverRow(e){let t=kr(this.hass,this.building?.floors??[],e.entity_id);e=Sr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=C(e)&&!pn(e);return p`
${qt("cover")} ${this.nameButton(o)} ${this.stateOf(e)}${G(this.hass,[e.entity_id])}
- ${i&dp?p``:f} + ${i&pp?p``:f}
- ${i&up&&typeof r.current_position=="number"?p`
`}function Mu(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let h=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),m=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),d;for(let g of m){for(let _ of h)if(!t.some(b=>_-s.w/2b.x0-6&&g-s.hb.y0-6)){d={x:_,y:g};break}if(d)break}d&&(s.x=d.x,a=d.y)}for(let h=0;h<12;h++){let m={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},d=t.find(g=>m.x0g.x0-6&&m.y0g.y0-6);if(!d)break;a=d.y0-8}let l=s.y-a,c=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",u=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(c&&i>0&&(a-s.h<8||a>i-8||!u&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function Cf(n,e,t){let r=e.printer,i=(c,u)=>$(n,c,u),o=r.progress??0,s=c=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`
+
`}function Eu(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let h=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),m=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),d;for(let g of m){for(let _ of h)if(!t.some(b=>_-s.w/2b.x0-6&&g-s.hb.y0-6)){d={x:_,y:g};break}if(d)break}d&&(s.x=d.x,a=d.y)}for(let h=0;h<12;h++){let m={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},d=t.find(g=>m.x0g.x0-6&&m.y0g.y0-6);if(!d)break;a=d.y0-8}let l=s.y-a,c=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",u=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(c&&i>0&&(a-s.h<8||a>i-8||!u&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function Of(n,e,t){let r=e.printer,i=(c,u)=>$(n,c,u),o=r.progress??0,s=c=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`
- ${r.picture?p``:On(o/100,r.printing?"#38bdf8":"#8aa0c8")} + ${r.picture?p``:Wn(o/100,r.printing?"#38bdf8":"#8aa0c8")}
${r.progress!==null?`${Math.round(o)} %`:"\u2013"}${i(`printer_${r.printing?"printing":/finish|complete|fertig/.test(r.status)?"done":/pause/.test(r.status)?"paused":/error|fail/.test(r.status)?"error":"idle"}`)}
@@ -928,9 +928,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${l?p`
🌡 ${l}
`:f} ${r.filaments.length?p`
${r.filaments.map(c=>p``)}
`:f}
-
`}function Nf(n,e,t){let r=e.pump,i=a=>$(n,a),o=a=>a===null?"\u2013":`${L(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return p`
+
`}function Wf(n,e,t){let r=e.pump,i=a=>$(n,a),o=a=>a===null?"\u2013":`${L(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return p`
- ${On(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")} + ${Wn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
${r.cop!==null?L(n,r.cop,1):s}${r.cop!==null?"COP":""}
@@ -941,17 +941,17 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${r.power!==null?p`
${i("heatpump_power")}${ze(n,r.power)}
`:f} ${r.outside!==null?p`
🌡 ${i("heatpump_outside")} ${o(r.outside)}
`:f}
-
`}function Lf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${L(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>vn(n,o).length>0);return p`
+
`}function Bf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${L(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>vn(n,o).length>0);return p`
${e.showTemperature?p`
🌡${r(e.temperature===null?null:n?ce(n,e.temperature):e.temperature,1,n?re(n):"\xB0C")}${G(n,e.sources?.temperature??[],$(n,"climate_temperature"))}
`:f} ${e.showHumidity?p`
💧${r(e.humidity,0,"%")}${G(n,e.sources?.humidity??[],$(n,"climate_humidity"))}
`:f} ${e.showCo2?p`
☁${r(e.co2,0,"ppm")}${G(n,e.sources?.co2??[],$(n,"climate_co2"))}
`:f} ${e.showIlluminance?p`
☀${r(e.illuminance,0,"lx")}${G(n,e.sources?.illuminance??[],$(n,"climate_illuminance"))}
`:f} -
`}function Of(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${ze(n,e.power)}`;return p`
+
`}function Vf(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${ze(n,e.power)}`;return p`
${e.name}
${e.powerEntity?p`
${r}${G(n,[e.powerEntity],e.name)}
`:f} ${(e.readings??[]).map(i=>p`
${i.label}${i.text}${G(n,[i.entity],i.label)}
`)} -
`}function Au(n,e,t,r,i=!1){return e.length?p`
- ${e.map((o,s)=>o.kind==="roomclimate"?Lf(n,o,s):o.kind==="power"?Of(n,o,s):o.kind==="hydronic"?p`
`:i?f:o.kind==="house"?Df(n,o,s,r):o.kind==="car"?Pf(n,o,s,t):o.kind==="printer"?Cf(n,o,s):o.kind==="heatpump"?Nf(n,o,s):If(n,o,s,t))} -
`:f}var Eu=J` +
`}function Ru(n,e,t,r,i=!1){return e.length?p`
+ ${e.map((o,s)=>o.kind==="roomclimate"?Bf(n,o,s):o.kind==="power"?Vf(n,o,s):o.kind==="hydronic"?p`
`:i?f:o.kind==="house"?Pf(n,o,s,r):o.kind==="car"?Nf(n,o,s,t):o.kind==="printer"?Of(n,o,s):o.kind==="heatpump"?Wf(n,o,s):Lf(n,o,s,t))} +
`:f}var zu=J` .live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; } .live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; } .live-card-power .live-row { align-items:center; gap:6px; } @@ -1298,7 +1298,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states text-transform: uppercase; letter-spacing: 0.04em; } -`;function Jo(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Ru(n,e,t){let r=Jo(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function li(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Qo=n=>n.points.length>=3;function zu(n,e,t){return n.rooms.filter(Qo).find(r=>H([e,t],r.points))}function Wf(n,e,t,r){let i=[];for(let a of e.rooms.filter(Qo)){let[l,c]=Te(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let h=zu(e,l,c),m=[h?.name,r?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Ht(P(a.entity_id)??"sensor",xe(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=xe(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=zu(e,a.x,a.z),c=[l?.name,r?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Tu(n,e){let t=Ke(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>Wf(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&Qo(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Te(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function Bf(n,e){return(li(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Du(n,e,t=8){let r=li(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=li(e.trim());return n.filter(o=>{let s=li([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:Bf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Vf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],Kf=[2200,2700,3200,4e3,5e3,6500],Gf=["hs","rgb","rgbw","rgbww","xy"],Uf=4,Fu=16,Hu=32,jf=128;function es(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>Gf.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function ts(n){return((n.attributes.supported_features??0)&Uf)!==0&&typeof n.attributes.current_position=="number"}var Xo=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ke(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`
${r}
`})}renderLight(e){let t=es(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?Vf.map(s=>p``):t.temp?Kf.map(s=>p``):[];return p`
+`;function Qo(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Tu(n,e,t){let r=Qo(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function ci(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Xo=n=>n.points.length>=3;function Fu(n,e,t){return n.rooms.filter(Xo).find(r=>H([e,t],r.points))}function Kf(n,e,t,r){let i=[];for(let a of e.rooms.filter(Xo)){let[l,c]=Te(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let h=Fu(e,l,c),m=[h?.name,r?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Ht(P(a.entity_id)??"sensor",xe(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=xe(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Fu(e,a.x,a.z),c=[l?.name,r?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Du(n,e){let t=Ke(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>Kf(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&Xo(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Te(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function Gf(n,e){return(ci(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Hu(n,e,t=8){let r=ci(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=ci(e.trim());return n.filter(o=>{let s=ci([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:Gf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Uf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],jf=[2200,2700,3200,4e3,5e3,6500],qf=["hs","rgb","rgbw","rgbww","xy"],Zf=4,Pu=16,Iu=32,Yf=128;function ts(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>qf.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function ns(n){return((n.attributes.supported_features??0)&Zf)!==0&&typeof n.attributes.current_position=="number"}var es=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ke(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`
${r}
`})}renderLight(e){let t=ts(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?Uf.map(s=>p``):t.temp?jf.map(s=>p``):[];return p`
${this.ring(o)} `,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||r||e.state==="open"||e.state==="closed";return p`
+ />`:f}`}renderCover(e){e=Sr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=ns(e),o=(u,h,m,d=!1)=>p``,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||r||e.state==="open"||e.state==="closed";return p`
${this.ring(a)} `:f} - ${t&Hu?p``:f} + />`:t&(Pu|Iu)?p`
+ ${t&Pu?p``:f} + ${t&Iu?p``:f}
`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",r=e.entity_id.split(".")[0];return p`
${o?f:p`
LeistungEnergie / Verbrauch
${i.map(s=>p`
@@ -1660,9 +1660,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states .kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; } .row .value b { font-size:11px; font-weight:normal; } @media(max-width:600px) { .entries { max-height:32vh; } } - `};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",ns);var Wu="image:";function rs(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Wu))return t(r.slice(Wu.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Wn=n=>Number(n);function Vn(n){if(Array.isArray(n)){let[o,s]=[Wn(n[0]),Wn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Wn(e),Wn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function Bu(n){return n?Vn(n.charger)??Vn(n.charger_position):null}function Vu(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Vn(t.attributes?.vacuum_position)??Bu(t.attributes)))return e;return null}var Qf=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Bn=(n,e)=>e?[n[0],-n[1]]:n;function Xf(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Bn(n.ga,e),[i,o]=Bn(n.gb,e),[s,a]=n.a,[l,c]=n.b,[u,h]=[i-t,o-r],[m,d]=[l-s,c-a],g=Math.hypot(u,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(d,m)-Math.atan2(h,u),[S,k]=[Math.cos(y),Math.sin(y)];return M=>{let z=Bn(M,e),[R,F]=[z[0]-t,z[1]-r];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function eg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Bn(n.ga,e),[i,o]=Bn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function Ku(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=Xf(t)??(g=>g),o=eg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Vn(a),c=l?(()=>{let[g,_]=i(l),b=Wn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,u=Bu(r),h=Array.isArray(r.path)?r.path:[],m=h.length>0&&Qf(h[0])?[h]:h,d=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let y=Vn(b);y&&_.push(i(y))}_.length>1&&d.push(_)}return!c&&!u&&!d.length?null:{pose:c,charger:u?i(u):null,path:d}}var Gu="nextfloor.lock3d",Uu=520,os=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey="";todayAt=0;todayDay="";swipeSent=0;swipeTimer;viewer=null;hydronicModule=null;hydronicGeneration=0;starting=!1;shownStates=new Map;shownPacks=-1;openingLinks=null;linkedRegistry;furnitureLinks=new Map;tapPins=new Map;heatValues=new Map;watched=[];constructor(){super(),this.building=null,this.floorId=null,this.roomId=null,this.wallMode="auto",this.solidWalls=!1,this.glassWalls=null,this.explode=!0,this.keepRoof=!1,this.markerMode="important",this.markersOutside=null,this.tapInRoom=!1,this.roomDoubleTap="auto",this.heatMode="none",this.theme="neon",this.accent=null,this.furnitureColors=null,this.furnish=!1,this.weather=!0,this.weatherEntityId=null,this.weatherDensity=1,this.showEnergy=!0,this.flows=null,this._liveEnergy=null,this._liveCards=[],this._liveCardOn=localStorage.getItem("nextfloor.cards")!=="0",this._houseFolded=localStorage.getItem("nextfloor.house_card_folded")==="1";try{this._utilityOverviewVisible=localStorage.getItem("nextfloor.utility_overview")!=="0"}catch{this._utilityOverviewVisible=!0}this.selectedFurniture=null,this.selectedDevice=null,this._sky=0,this.quality="auto",this.showStats=!1,this._stats=null,this._error=null,this._energy=null,this._swipe=null,this._menu=null,this._pluginWindow=null,this._plate=null,this._wallBig=null,this._blend=.6,this._find=null,this._central=!1;try{this._thumbsCompact=localStorage.getItem("nextfloor.thumbs_compact")==="1"}catch{this._thumbsCompact=!1}this._armed=null,this.central=!0,this.buttons=null,this._thumbs=[],this.floorThumbs=!0,this.clean=!1,this.cleanButton=!1,this.clock=null,this.lockButton=!1,this.walkButton=!1,this.travelButton=!1,this._travel=null,this._walking=!1,this._stick=null,this._now=Date.now(),this._locked=(()=>{try{return localStorage.getItem(Gu)==="1"}catch{return!1}})(),this.roomLabels=!0,this.roomNamesButton=!1,this.floorStack="dim",this._low=!1,this.panelOpen=!1,this._narrowStage=!1,this._shortStage=!1,this._phoneStage=!1,this.alerts=!0,this.alertJump=!1,this.announcements=!1,this.sensorBar=!0,this.screenName=null,this._announcement=null,this._alerts=[],this.scenes=!0,this._sceneFired=null,this.dimmed=!1,this.autoOrbit=!1,this.startView=null,this.outsideOpen=!1,this.holograms=null;try{this._flows=localStorage.getItem("nextfloor.flows")==="1"}catch{this._flows=!1}}connectedCallback(){super.connectedCallback(),this.stopPlugins=zt(()=>{this.pluginsDirty=!0,this.requestUpdate()}),this.hasUpdated&&(this.observeStage(),this.viewer||this.start())}disconnectedCallback(){super.disconnectedCallback(),this.hydronicGeneration++,this.hydronicModule?.closeHydronic(),this.stopPlugins?.(),this.stopPlugins=null,this.listenToAnnouncements(!1),this.resizeObs?.disconnect(),this.resizeObs=null,clearInterval(this.alertTimer),this.alertTimer=void 0,clearInterval(this.contactTimer),this.contactTimer=void 0,clearInterval(this.clockTimer),this.clockTimer=void 0,clearInterval(this.travelTimer),this.travelTimer=void 0,this.live=null,this.viewer?.dispose(),this.viewer=null}firstUpdated(){this.observeStage(),this.start()}observeStage(){let e=this.renderRoot.querySelector(".nf-stage");!e||this.resizeObs||typeof ResizeObserver!="function"||(this.resizeObs=new ResizeObserver(t=>{let r=t[0]?.contentRect,i=(r?.width??1e3)<700||(r?.height??1e3){this._central&&!this.centralOpen&&!r.target?.closest?.(".nf-central, .nf-central-btn")&&(this._central=!1)}),this.viewer=e.createViewer(t,{quality:this.quality,explode:this.explode,onRoomTap:(r,i)=>this.fire("room-tap",{floorId:r,roomId:i}),onFloorTap:r=>this.fire("floor-tap",{floorId:r}),floorInfo:r=>r.rooms.length===1?$(this.hass,"floor_rooms_one"):$(this.hass,"floor_rooms",{n:r.rooms.length}),onBack:()=>this.fire("back",{}),onDeviceTap:(r,i,o)=>this.onDeviceTap(r,i,o),onDeviceHold:(r,i,o)=>this.onDeviceHold(r,i,o),onRoomDoubleTap:(r,i)=>this.onRoomDoubleTap(r,i),onDeviceSwipe:(r,i,o,s,a)=>this.onDeviceSwipe(r,i,o,s,a),onFurnitureSelect:r=>this.fire("furniture-select",{id:r}),onFurnitureMove:(r,i,o)=>this.fire("furniture-move",{id:r,x:i,z:o}),onDeviceSelect:r=>this.fire("device-select",{id:r}),onDeviceMove:(r,i,o)=>this.fire("device-move",{id:r,x:i,z:o}),onStats:r=>{this.showStats&&(this._stats=r)}}),this.viewer.setWallMode(this.wallMode),this.viewer.setPaintedWalls(this.solidWalls),this.viewer.setGlassWalls((this.glassWalls??20)/100),this.viewer.setTheme(this.theme),this.viewer.setAccent(this.accent??null),this.viewer.setFurnitureColors(this.furnitureColors??null),this.viewer.setNotePhotos(r=>this.hass?rs(this.hass,r,i=>this.storedPicture(this.hass,i)):null),this.viewer.setNavigationLocked(this._locked),this.viewer.setFurnishMode(this.furnish),this.viewer.setTapInRoom(this.tapInRoom),this.viewer.setSurfaceGrab(this.surfaceGrab??null),this.viewer.setFurnishTypes(this.furnishTypes??null),this.viewer.setFloorStack(this.floorStack),this.viewer.setStats(this.showStats),this.viewer.setAutoOrbit(this.autoOrbit?.06:0),this.viewer.setKeepRoof(this.keepRoof),this.viewer.setKeepCamera(!!this.keepCamera),this.viewer.setPlain(!!this.plain),this.viewer.setRightBack(!!this.rightBack),this.viewer.setZoom(this.zoom??1),this._low=this.viewer.low,this.viewer.setMeshSource(r=>this.hass?.fetchWithAuth?this.hass.fetchWithAuth(`/api/nextfloor/mesh/${encodeURIComponent(r)}`).then(i=>i.ok?i.arrayBuffer():null):Promise.resolve(null)),this.viewer.setPacks([...Ci()]),this.shownPacks=nr(),this.building&&(this.shownStartView=JSON.stringify(this.startViewOf()),this.viewer.setStartView(this.startViewOf()),this.viewer.setBuilding(this.shownBuilding(this.hass)),this.viewer.setMap(this.building.settings.map,this.building.settings.north??0)),this.scheduleThumbs(),this.syncDevices(!0),this.viewer.setFloor(this.floorId,!1),this.roomId&&this.viewer.selectRoom(this.roomId)}catch(e){this._error=String(e)}finally{this.starting=!1}}}updated(e){(e.has("announcements")||e.has("hass")&&this.announcements&&!this.stopAnnouncements)&&this.listenToAnnouncements(this.announcements&&!!this.hass&&this.isConnected),e.has("hass")&&this.live?.el&&(this.live.el.hass=this.hass);let t=this._pluginWindow?.node;e.has("hass")&&t&&"hass"in t&&(t.hass=this.hass),this._central&&!this.centralOpen&&(e.has("roomId")&&e.get("roomId")!==void 0||e.has("floorId")&&e.get("floorId")!==void 0)&&(this._central=!1),e.has("centralOpen")&&this.centralOpen&&(this._central=!0),e.has("clock")&&(clearInterval(this.clockTimer),this.clockTimer=this.clock?setInterval(()=>this._now=Date.now(),1e4):void 0);let r=this.viewer;if(!r)return;if(this.shownPacks!==nr()&&(this.shownPacks=nr(),r.setPacks([...Ci()]),this.hass&&this.building&&r.setParked(Ho(this.hass,this.building)),this.syncDevices(!0)),e.has("building")&&this.building){let s=JSON.stringify(this.startViewOf()),a=this.shownStartView!==void 0&&this.shownStartView!==s;this.shownStartView=s,r.setStartView(this.startViewOf()),r.setBuilding(this.shownBuilding(this.hass)),r.setMap(this.building?.settings.map,this.building?.settings.north??0),a&&this.floorId===null&&r.resetView()}e.has("startView")&&e.get("startView")!==void 0&&(r.setStartView(this.startViewOf()),this.floorId===null&&r.resetView()),(e.has("building")||e.has("theme")||e.has("floorThumbs")||e.has("packs"))&&this.scheduleThumbs();let i=this.markersOutside?["markersOutside","floorId","roomId"]:["markersOutside"],o=this.pluginsDirty||["building","markerMode","heatMode","flows","alerts","dimmed","holograms","roomLabels","floorId","roomId",...i].some(s=>e.has(s));if(this.pluginsDirty=!1,(o||e.has("hass"))&&this.syncDevices(o),e.has("autoOrbit")&&r.setAutoOrbit(this.autoOrbit?.06:0),(e.has("_thumbs")||e.has("_narrowStage")||e.has("_phoneStage"))&&r.setLabelInset(this._thumbs.length&&!this._phoneStage?this.narrowThumbs?136:184:0),e.has("floorId")&&r.setFloor(this.floorId),e.has("roomId")&&(this.roomId||e.get("roomId"))&&r.selectRoom(this.roomId),e.has("outsideOpen")&&e.get("outsideOpen")!==void 0){let s=this.building?.settings.outside_view;this.outsideOpen&&s?r.showView(s):!this.outsideOpen&&s&&this.floorId===null&&!this.roomId&&r.resetView()}e.has("tapInRoom")&&r.setTapInRoom(this.tapInRoom),e.has("wallMode")&&r.setWallMode(this.wallMode),e.has("solidWalls")&&r.setPaintedWalls(this.solidWalls),e.has("glassWalls")&&r.setGlassWalls((this.glassWalls??20)/100),e.has("explode")&&r.setExplode(this.explode),e.has("keepRoof")&&r.setKeepRoof(this.keepRoof),e.has("keepCamera")&&r.setKeepCamera(!!this.keepCamera),e.has("plain")&&r.setPlain(!!this.plain),e.has("rightBack")&&r.setRightBack(!!this.rightBack),e.has("zoom")&&r.setZoom(this.zoom??1),e.has("floorStack")&&r.setFloorStack(this.floorStack),e.has("theme")&&r.setTheme(this.theme),e.has("_locked")&&r.setNavigationLocked(this._locked),e.has("accent")&&r.setAccent(this.accent??null),e.has("furnitureColors")&&r.setFurnitureColors(this.furnitureColors??null),e.has("surfaceGrab")&&r.setSurfaceGrab(this.surfaceGrab??null),e.has("furnishTypes")&&r.setFurnishTypes(this.furnishTypes??null),e.has("furnish")&&(r.setFurnishMode(this.furnish),this.syncDevices(!0)),e.has("selectedFurniture")&&r.selectFurniture(this.selectedFurniture),e.has("selectedDevice")&&r.setSelectedDevice(this.selectedDevice),(e.has("weather")||e.has("weatherEntityId")||e.has("weatherDensity")||e.has("timeOfDay"))&&this.syncDevices(!0),e.has("quality")&&e.get("quality")!==void 0&&(r.setQuality(this.quality),this._low=r.low),e.has("showStats")&&r.setStats(this.showStats),e.has("building")&&(this.findIndex=null)}shownFor=null;framePictureData=new Map;framePictures(e,t){let r=[];for(let i of t.floors)for(let o of i.notes??[])o.photo?.startsWith("image:")&&this.storedPicture(e,o.photo.slice(6));for(let i of t.floors)for(let o of i.furniture){if(!o.picture||!Ue(e,o))continue;let s=rs(e,o.picture,a=>this.storedPicture(e,a));s&&r.push({furnitureId:o.id,floorId:i.id,url:s,border:o.picture_border??0,fit:o.picture_fit==="contain"?"contain":"cover"})}return r}storedPicture(e,t){let r=this.framePictureData.get(t);return r!==void 0?r||null:(this.framePictureData.set(t,""),Cs(e,t).then(i=>{this.framePictureData.set(t,i),this.syncDevices(!0)}).catch(()=>{}),null)}shownBuilding(e){let t=this.building,r=co(e,t),i=t.floors.filter(a=>a.layer&&this.hiddenLayers.has(a.id)).map(a=>a.id),o=[...r,...i.map(a=>`layer:${a}`)].join(",");if(this.shownFor?.building===t&&this.shownFor.key===o)return this.shownFor.shown;let s=_l(t,r);return this.shownFor={building:t,key:o,shown:i.length?{...s,floors:s.floors.filter(a=>!i.includes(a.id))}:s},this.shownFor.shown}hiddenLayers=(()=>{try{return new Set(JSON.parse(localStorage.getItem("nextfloor.hidden_layers")??"[]"))}catch{return new Set}})();toggleLayer(e){this.hiddenLayers.has(e)?this.hiddenLayers.delete(e):this.hiddenLayers.add(e);try{localStorage.setItem("nextfloor.hidden_layers",JSON.stringify([...this.hiddenLayers]))}catch{}this.viewer&&this.building&&this.viewer.setBuilding(this.shownBuilding(this.hass)),this.requestUpdate()}renderLayers(){let e=(this.building?.floors??[]).filter(t=>t.layer);return!e.length||this.clean?f:p`
+ `};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",rs);var Vu="image:";function is(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Vu))return t(r.slice(Vu.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Bn=n=>Number(n);function Kn(n){if(Array.isArray(n)){let[o,s]=[Bn(n[0]),Bn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Bn(e),Bn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function Ku(n){return n?Kn(n.charger)??Kn(n.charger_position):null}function Gu(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Kn(t.attributes?.vacuum_position)??Ku(t.attributes)))return e;return null}var tg=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Vn=(n,e)=>e?[n[0],-n[1]]:n;function ng(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Vn(n.ga,e),[i,o]=Vn(n.gb,e),[s,a]=n.a,[l,c]=n.b,[u,h]=[i-t,o-r],[m,d]=[l-s,c-a],g=Math.hypot(u,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(d,m)-Math.atan2(h,u),[S,k]=[Math.cos(y),Math.sin(y)];return M=>{let z=Vn(M,e),[R,D]=[z[0]-t,z[1]-r];return[s+b*(R*S-D*k),a+b*(R*k+D*S)]}}function rg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Vn(n.ga,e),[i,o]=Vn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function Uu(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=ng(t)??(g=>g),o=rg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Kn(a),c=l?(()=>{let[g,_]=i(l),b=Bn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,u=Ku(r),h=Array.isArray(r.path)?r.path:[],m=h.length>0&&tg(h[0])?[h]:h,d=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let y=Kn(b);y&&_.push(i(y))}_.length>1&&d.push(_)}return!c&&!u&&!d.length?null:{pose:c,charger:u?i(u):null,path:d}}var ju="nextfloor.lock3d",qu=520,ss=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey="";todayAt=0;todayDay="";swipeSent=0;swipeTimer;viewer=null;hydronicModule=null;hydronicGeneration=0;starting=!1;shownStates=new Map;shownPacks=-1;openingLinks=null;linkedRegistry;furnitureLinks=new Map;tapPins=new Map;heatValues=new Map;watched=[];constructor(){super(),this.building=null,this.floorId=null,this.roomId=null,this.wallMode="auto",this.solidWalls=!1,this.glassWalls=null,this.explode=!0,this.keepRoof=!1,this.markerMode="important",this.markersOutside=null,this.tapInRoom=!1,this.roomDoubleTap="auto",this.heatMode="none",this.theme="neon",this.accent=null,this.furnitureColors=null,this.furnish=!1,this.weather=!0,this.weatherEntityId=null,this.weatherDensity=1,this.showEnergy=!0,this.flows=null,this._liveEnergy=null,this._liveCards=[],this._liveCardOn=localStorage.getItem("nextfloor.cards")!=="0",this._houseFolded=localStorage.getItem("nextfloor.house_card_folded")==="1";try{this._utilityOverviewVisible=localStorage.getItem("nextfloor.utility_overview")!=="0"}catch{this._utilityOverviewVisible=!0}this.selectedFurniture=null,this.selectedDevice=null,this._sky=0,this.quality="auto",this.showStats=!1,this._stats=null,this._error=null,this._energy=null,this._swipe=null,this._menu=null,this._pluginWindow=null,this._plate=null,this._wallBig=null,this._blend=.6,this._find=null,this._central=!1;try{this._thumbsCompact=localStorage.getItem("nextfloor.thumbs_compact")==="1"}catch{this._thumbsCompact=!1}this._armed=null,this.central=!0,this.buttons=null,this._thumbs=[],this.floorThumbs=!0,this.clean=!1,this.cleanButton=!1,this.clock=null,this.lockButton=!1,this.walkButton=!1,this.travelButton=!1,this._travel=null,this._walking=!1,this._stick=null,this._now=Date.now(),this._locked=(()=>{try{return localStorage.getItem(ju)==="1"}catch{return!1}})(),this.roomLabels=!0,this.roomNamesButton=!1,this.floorStack="dim",this._low=!1,this.panelOpen=!1,this._narrowStage=!1,this._shortStage=!1,this._phoneStage=!1,this.alerts=!0,this.alertJump=!1,this.announcements=!1,this.sensorBar=!0,this.screenName=null,this._announcement=null,this._alerts=[],this.scenes=!0,this._sceneFired=null,this.dimmed=!1,this.autoOrbit=!1,this.startView=null,this.outsideOpen=!1,this.holograms=null;try{this._flows=localStorage.getItem("nextfloor.flows")==="1"}catch{this._flows=!1}}connectedCallback(){super.connectedCallback(),this.stopPlugins=zt(()=>{this.pluginsDirty=!0,this.requestUpdate()}),this.hasUpdated&&(this.observeStage(),this.viewer||this.start())}disconnectedCallback(){super.disconnectedCallback(),this.hydronicGeneration++,this.hydronicModule?.closeHydronic(),this.stopPlugins?.(),this.stopPlugins=null,this.listenToAnnouncements(!1),this.resizeObs?.disconnect(),this.resizeObs=null,clearInterval(this.alertTimer),this.alertTimer=void 0,clearInterval(this.contactTimer),this.contactTimer=void 0,clearInterval(this.clockTimer),this.clockTimer=void 0,clearInterval(this.travelTimer),this.travelTimer=void 0,this.live=null,this.viewer?.dispose(),this.viewer=null}firstUpdated(){this.observeStage(),this.start()}observeStage(){let e=this.renderRoot.querySelector(".nf-stage");!e||this.resizeObs||typeof ResizeObserver!="function"||(this.resizeObs=new ResizeObserver(t=>{let r=t[0]?.contentRect,i=(r?.width??1e3)<700||(r?.height??1e3){this._central&&!this.centralOpen&&!r.target?.closest?.(".nf-central, .nf-central-btn")&&(this._central=!1)}),this.viewer=e.createViewer(t,{quality:this.quality,explode:this.explode,onRoomTap:(r,i)=>this.fire("room-tap",{floorId:r,roomId:i}),onFloorTap:r=>this.fire("floor-tap",{floorId:r}),floorInfo:r=>r.rooms.length===1?$(this.hass,"floor_rooms_one"):$(this.hass,"floor_rooms",{n:r.rooms.length}),onBack:()=>this.fire("back",{}),onDeviceTap:(r,i,o)=>this.onDeviceTap(r,i,o),onDeviceHold:(r,i,o)=>this.onDeviceHold(r,i,o),onRoomDoubleTap:(r,i)=>this.onRoomDoubleTap(r,i),onDeviceSwipe:(r,i,o,s,a)=>this.onDeviceSwipe(r,i,o,s,a),onFurnitureSelect:r=>this.fire("furniture-select",{id:r}),onFurnitureMove:(r,i,o)=>this.fire("furniture-move",{id:r,x:i,z:o}),onDeviceSelect:r=>this.fire("device-select",{id:r}),onDeviceMove:(r,i,o)=>this.fire("device-move",{id:r,x:i,z:o}),onStats:r=>{this.showStats&&(this._stats=r)}}),this.viewer.setWallMode(this.wallMode),this.viewer.setPaintedWalls(this.solidWalls),this.viewer.setGlassWalls((this.glassWalls??20)/100),this.viewer.setTheme(this.theme),this.viewer.setAccent(this.accent??null),this.viewer.setFurnitureColors(this.furnitureColors??null),this.viewer.setNotePhotos(r=>this.hass?is(this.hass,r,i=>this.storedPicture(this.hass,i)):null),this.viewer.setNavigationLocked(this._locked),this.viewer.setFurnishMode(this.furnish),this.viewer.setTapInRoom(this.tapInRoom),this.viewer.setSurfaceGrab(this.surfaceGrab??null),this.viewer.setFurnishTypes(this.furnishTypes??null),this.viewer.setFloorStack(this.floorStack),this.viewer.setStats(this.showStats),this.viewer.setAutoOrbit(this.autoOrbit?.06:0),this.viewer.setKeepRoof(this.keepRoof),this.viewer.setKeepCamera(!!this.keepCamera),this.viewer.setPlain(!!this.plain),this.viewer.setRightBack(!!this.rightBack),this.viewer.setZoom(this.zoom??1),this._low=this.viewer.low,this.viewer.setMeshSource(r=>this.hass?.fetchWithAuth?this.hass.fetchWithAuth(`/api/nextfloor/mesh/${encodeURIComponent(r)}`).then(i=>i.ok?i.arrayBuffer():null):Promise.resolve(null)),this.viewer.setPacks([...Ni()]),this.shownPacks=rr(),this.building&&(this.shownStartView=JSON.stringify(this.startViewOf()),this.viewer.setStartView(this.startViewOf()),this.viewer.setBuilding(this.shownBuilding(this.hass)),this.viewer.setMap(this.building.settings.map,this.building.settings.north??0)),this.scheduleThumbs(),this.syncDevices(!0),this.viewer.setFloor(this.floorId,!1),this.roomId&&this.viewer.selectRoom(this.roomId)}catch(e){this._error=String(e)}finally{this.starting=!1}}}updated(e){(e.has("announcements")||e.has("hass")&&this.announcements&&!this.stopAnnouncements)&&this.listenToAnnouncements(this.announcements&&!!this.hass&&this.isConnected),e.has("hass")&&this.live?.el&&(this.live.el.hass=this.hass);let t=this._pluginWindow?.node;e.has("hass")&&t&&"hass"in t&&(t.hass=this.hass),this._central&&!this.centralOpen&&(e.has("roomId")&&e.get("roomId")!==void 0||e.has("floorId")&&e.get("floorId")!==void 0)&&(this._central=!1),e.has("centralOpen")&&this.centralOpen&&(this._central=!0),e.has("clock")&&(clearInterval(this.clockTimer),this.clockTimer=this.clock?setInterval(()=>this._now=Date.now(),1e4):void 0);let r=this.viewer;if(!r)return;if(this.shownPacks!==rr()&&(this.shownPacks=rr(),r.setPacks([...Ni()]),this.hass&&this.building&&r.setParked(Po(this.hass,this.building)),this.syncDevices(!0)),e.has("building")&&this.building){let s=JSON.stringify(this.startViewOf()),a=this.shownStartView!==void 0&&this.shownStartView!==s;this.shownStartView=s,r.setStartView(this.startViewOf()),r.setBuilding(this.shownBuilding(this.hass)),r.setMap(this.building?.settings.map,this.building?.settings.north??0),a&&this.floorId===null&&r.resetView()}e.has("startView")&&e.get("startView")!==void 0&&(r.setStartView(this.startViewOf()),this.floorId===null&&r.resetView()),(e.has("building")||e.has("theme")||e.has("floorThumbs")||e.has("packs"))&&this.scheduleThumbs();let i=this.markersOutside?["markersOutside","floorId","roomId"]:["markersOutside"],o=this.pluginsDirty||["building","markerMode","heatMode","flows","alerts","dimmed","holograms","roomLabels","floorId","roomId",...i].some(s=>e.has(s));if(this.pluginsDirty=!1,(o||e.has("hass"))&&this.syncDevices(o),e.has("autoOrbit")&&r.setAutoOrbit(this.autoOrbit?.06:0),(e.has("_thumbs")||e.has("_narrowStage")||e.has("_phoneStage"))&&r.setLabelInset(this._thumbs.length&&!this._phoneStage?this.narrowThumbs?136:184:0),e.has("floorId")&&r.setFloor(this.floorId),e.has("roomId")&&(this.roomId||e.get("roomId"))&&r.selectRoom(this.roomId),e.has("outsideOpen")&&e.get("outsideOpen")!==void 0){let s=this.building?.settings.outside_view;this.outsideOpen&&s?r.showView(s):!this.outsideOpen&&s&&this.floorId===null&&!this.roomId&&r.resetView()}e.has("tapInRoom")&&r.setTapInRoom(this.tapInRoom),e.has("wallMode")&&r.setWallMode(this.wallMode),e.has("solidWalls")&&r.setPaintedWalls(this.solidWalls),e.has("glassWalls")&&r.setGlassWalls((this.glassWalls??20)/100),e.has("explode")&&r.setExplode(this.explode),e.has("keepRoof")&&r.setKeepRoof(this.keepRoof),e.has("keepCamera")&&r.setKeepCamera(!!this.keepCamera),e.has("plain")&&r.setPlain(!!this.plain),e.has("rightBack")&&r.setRightBack(!!this.rightBack),e.has("zoom")&&r.setZoom(this.zoom??1),e.has("floorStack")&&r.setFloorStack(this.floorStack),e.has("theme")&&r.setTheme(this.theme),e.has("_locked")&&r.setNavigationLocked(this._locked),e.has("accent")&&r.setAccent(this.accent??null),e.has("furnitureColors")&&r.setFurnitureColors(this.furnitureColors??null),e.has("surfaceGrab")&&r.setSurfaceGrab(this.surfaceGrab??null),e.has("furnishTypes")&&r.setFurnishTypes(this.furnishTypes??null),e.has("furnish")&&(r.setFurnishMode(this.furnish),this.syncDevices(!0)),e.has("selectedFurniture")&&r.selectFurniture(this.selectedFurniture),e.has("selectedDevice")&&r.setSelectedDevice(this.selectedDevice),(e.has("weather")||e.has("weatherEntityId")||e.has("weatherDensity")||e.has("timeOfDay"))&&this.syncDevices(!0),e.has("quality")&&e.get("quality")!==void 0&&(r.setQuality(this.quality),this._low=r.low),e.has("showStats")&&r.setStats(this.showStats),e.has("building")&&(this.findIndex=null)}shownFor=null;framePictureData=new Map;framePictures(e,t){let r=[];for(let i of t.floors)for(let o of i.notes??[])o.photo?.startsWith("image:")&&this.storedPicture(e,o.photo.slice(6));for(let i of t.floors)for(let o of i.furniture){if(!o.picture||!Ue(e,o))continue;let s=is(e,o.picture,a=>this.storedPicture(e,a));s&&r.push({furnitureId:o.id,floorId:i.id,url:s,border:o.picture_border??0,fit:o.picture_fit==="contain"?"contain":"cover"})}return r}storedPicture(e,t){let r=this.framePictureData.get(t);return r!==void 0?r||null:(this.framePictureData.set(t,""),Ns(e,t).then(i=>{this.framePictureData.set(t,i),this.syncDevices(!0)}).catch(()=>{}),null)}shownBuilding(e){let t=this.building,r=uo(e,t),i=t.floors.filter(a=>a.layer&&this.hiddenLayers.has(a.id)).map(a=>a.id),o=[...r,...i.map(a=>`layer:${a}`)].join(",");if(this.shownFor?.building===t&&this.shownFor.key===o)return this.shownFor.shown;let s=bl(t,r);return this.shownFor={building:t,key:o,shown:i.length?{...s,floors:s.floors.filter(a=>!i.includes(a.id))}:s},this.shownFor.shown}hiddenLayers=(()=>{try{return new Set(JSON.parse(localStorage.getItem("nextfloor.hidden_layers")??"[]"))}catch{return new Set}})();toggleLayer(e){this.hiddenLayers.has(e)?this.hiddenLayers.delete(e):this.hiddenLayers.add(e);try{localStorage.setItem("nextfloor.hidden_layers",JSON.stringify([...this.hiddenLayers]))}catch{}this.viewer&&this.building&&this.viewer.setBuilding(this.shownBuilding(this.hass)),this.requestUpdate()}renderLayers(){let e=(this.building?.floors??[]).filter(t=>t.layer);return!e.length||this.clean?f:p`
${e.map(t=>p``)} -
`}syncDevices(e){let t=this.viewer,r=this.building;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ut(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Be(o,r.floors),this.furnitureLinks=Ke(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Tc(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Nc({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;co(o,r).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let a=Sn(o,r),l=nl(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(o,r,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=$n(o,r,a,Ze(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=bt(o,r.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let x of v.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,D=x.pump_entity?o.states[x.pump_entity]:void 0,[W,_e]=Te(x.points),ct=B&&Number.isFinite(Number(B.state))?`${L(o,ce(o,pr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",$t=!!D&&te(D);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:v.id,roomId:null,x:W,z:_e,y:lr(v,x,W,_e)+.7,icon:De(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[ct,$t?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:$t,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of r.floors){for(let x of v.placements)x.pin_offset&&d.set(`${v.id}:${x.entity_id}`,x.pin_offset);for(let x of v.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let g=v=>{let x=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return x?{...v,x:v.x+(x.x??0),z:v.z+(x.z??0),y:v.y+(x.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let x=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,B={...v,power:x,powerText:x===null?void 0:he(o,x),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,u,v.furnitureId)??v.text},D=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=m.has(v.id)||!!v.furnitureId&&m.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ca(o,r.floors)),t.setCovers(qa(o,r)),t.setRobots(this.robotInfos(o,r));let _=new Map;for(let v of r.floors)for(let x of v.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,Yi(o,v.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Mc(o,r)),t.setParked(Ho(o,r)),t.setGateStates(Kc(o,r));let b=new Map(r.floors.flatMap(v=>v.openings.map(x=>[x.id,x.type]))),y=new Map([...this.openingLinks].map(([v,x])=>[v,Ve(o,x,b.get(v))]));t.setOpeningStates(y),this.setAlerts(this.alertSrc?To(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...y].map(([v,x])=>`${v}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=S,v||this.scheduleThumbs(1500)}let k=iu(o,r,a,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),M=this.liveCars(o,r);for(let v of M){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let x=r.floors.flatMap(W=>W.furniture.filter(_e=>_e.type==="wallbox").map(_e=>({floorId:W.id,x:_e.x,z:_e.z,y:1}))).sort((W,_e)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(_e.x-v.at.x,_e.z-v.at.z))[0],B=x&&x.floorId===v.at.floorId&&Math.hypot(x.x-v.at.x,x.z-v.at.z)<9,D=x??Cn(r);!D||!v.car.charging&&!B||k.arcs.push({key:`car:${v.spot}`,from:D,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:v.at.floorId,x:(D.x+v.at.x)/2,z:(D.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let z=Cn(r);for(let v of this.liveHeatPumps(r)){let x=v.pump.heat??(v.pump.mode==="heating"||v.pump.mode==="water"?(v.pump.power??0)*(v.pump.cop??3):0);z&&x>100&&v.pump.mode!=="cooling"&&k.arcs.push({key:`heat:${v.id}`,from:{floorId:v.floorId,x:v.x,z:v.z,y:.8},to:z,power:x,color:[255,120,40]})}let R=(this.flows??this._flows)&&!this.dimmed;t.setLiveEnergy(R?k.arcs:[],R?k.sparks:[]),JSON.stringify(k)!==JSON.stringify(this._liveEnergy)&&(this._liveEnergy=k);let T=this.liveMedia(o,r).filter(v=>v.playing&&!this.dimmed);t.setLiveSound(T.filter(v=>v.rings>0).map(v=>({id:v.entity,at:v.at,color:v.color,level:v.volume??.5,size:v.rings})),kc(T).map(([v,x])=>[v.at,x.at])),this.syncLhCards(t,r,k,M,T,o),t.setLiveScreens(this.dimmed?[]:Ac(o,r,this.furnitureLinks)),t.setPictures(this.framePictures(o,r)),t.setLiveWater(this.dimmed?[]:Sc(o,r,this.furnitureLinks));let E=ac(o,r);t.setPersons(E);let A=lc(o,r,this.openingLinks,E);t.setFloorInfo(new Map([...A].map(([v,x])=>[v,cc(o,x)])));let I=o.config,N=this.timeOfDay!=null&&I?.latitude!==void 0&&I.longitude!==void 0?ft(Et(this.timeOfDay,I.time_zone),I.latitude,I.longitude):Ec(o);t.setSun(N),t.setLocation(I?.latitude!==void 0&&I.longitude!==void 0?{latitude:I.latitude,longitude:I.longitude,zone:I.time_zone}:null);let K=this.weather&&!this.dimmed?Gc(o,at(o,this.weatherEntityId??r.settings.weather_entity)):null,j=K?Uc(jc(K,r.settings.weather_effects),this.weatherDensity):null;this.cloud=j?.cloud??0,this._sky=Rc(N?.elevation??null,this.cloud),t.setSky(this.weather&&!this.dimmed?{weather:j,sun:N,north:r.settings.north??0,sky:this.skyColor(),disc:(r.settings.weather_effects??["sky"]).includes("sky"),low:this._low}:null),this.applyTint();let ie=u.grid!==null||u.solar!==null||u.battery!==null||u.tariff!==null?u:null;JSON.stringify(ie)!==JSON.stringify(this._energy)&&(this._energy=ie)}watchLostContacts(e){let t=!!this.alertSrc&&!this._travel&&Fc(e,this.alertSrc);t&&!this.contactTimer&&(this.contactTimer=setInterval(()=>{let r=this.building;this.alertSrc&&r&&this.hass&&this.openingLinks&&!this._travel&&this.setAlerts(To(this.hass,r,this.alertSrc,this.openingLinks))},6e4)),!t&&this.contactTimer&&(clearInterval(this.contactTimer),this.contactTimer=void 0)}setAlerts(e){let t=e.map(o=>`${o.kind}:${o.entity}`),r=e.filter((o,s)=>!this.seenAlerts.has(t[s])&&!Zr.has(o.kind));this.seenAlerts=new Set(t),t.join()!==this._alerts.map(o=>`${o.kind}:${o.entity}`).join()&&(this._alerts=e);let i=e.some(o=>!Zr.has(o.kind));i&&!this.alertTimer&&(this.alertTimer=setInterval(()=>!document.hidden&&this.applyTint(),this._low?200:100)),!i&&this.alertTimer&&(clearInterval(this.alertTimer),this.alertTimer=void 0),r.length&&this.alertJump&&this.jumpTo(r[0])}jumpTo(e){if(e.kind==="own"&&e.tap!=="room"){e.tap==="toggle"?this.hass.callService("homeassistant","toggle",{entity_id:e.entity}):ke(this,e.entity);return}if(!e.floorId){this.fire("floor-tap",{floorId:null});return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),e.roomId&&setTimeout(()=>this.fire("room-tap",{floorId:e.floorId,roomId:e.roomId}),60)}onRoomDoubleTap(e,t){let r=this.building,i=this.hass,o=r?.floors.find(u=>u.id===e),s=o?.rooms.find(u=>u.id===t);if(!r||!i||!o||!s)return;let a=Lc(r.settings.room_double_tap,this.roomDoubleTap),l=Oc(i,o,s,this.furnitureLinks,this.confirmSet,a);if(!l.length)return;let c=l.some(u=>i.states[u]?.state==="on");i.callService("homeassistant",c?"turn_off":"turn_on",{entity_id:l}),this.roomFlash={roomId:t,until:performance.now()+350},this.applyTint(),setTimeout(()=>{this.roomFlash=null,this.applyTint()},380)}runScene(e){this.hass.callService(e.split(".")[0],"turn_on",{entity_id:e}),this._sceneFired=e,setTimeout(()=>this._sceneFired=null,600)}applyTint(){let e=this.viewer,t=this.building,r=this.hass;if(!e||!t||!r)return;let i=null;if(this.heatMode!=="none"&&this.heatMode!=="values"&&this.heatMode!=="wifi"){let a=this.heatMode,l=Jl(r,t,a);!l.size!=!this.heatValues.size&&this.requestUpdate(),this.heatValues=l;let c=vt(new Date,r.config?.latitude??50);i=new Map([...l].map(([u,h])=>[u,Yl(a,h,c)]))}let o=new Map;if(this.heatMode==="values")for(let a of t.floors)for(let l of a.rooms){let c=Z(r,a,l,"temperature"),u=Z(r,a,l,"humidity"),h=Z(r,a,l,"co2"),m=Wr(h,u,Gt(c,u)),d=[c!==null?`${L(r,ce(r,c),1)} ${re(r)}`:null,u!==null?`${L(r,u,0)} %`:null,h!==null?`${L(r,h,0)} ppm`:null,m?`\u{1F4A8} ${$(r,`air_${m}`)}`:null].filter(g=>!!g);d.length&&o.set(l.id,d.join(" \xB7 "))}if(e.setRoomInfo(o),!i)for(let a of t.floors)for(let l of a.rooms){let c=l.floor_heating?r.states[l.floor_heating]:void 0;c&&(V(r)?le(c)===!0:c.entity_id.startsWith("climate.")?c.attributes.hvac_action==="heating":c.state==="on"||c.state==="open")&&(i??=new Map).set(l.id,[.55,.24,.08])}if(this._alerts.length){i??=new Map;let a=.55+.45*Math.sin(performance.now()/160);for(let l of this._alerts){if(Zr.has(l.kind))continue;let c=Hc(l.kind).map(u=>u*a);if(l.roomId)i.set(l.roomId,c);else for(let u of t.floors)for(let h of u.rooms)i.set(h.id,c)}}this.roomFlash&&performance.now()`${a}:${l.map(c=>c.toFixed(2)).join(",")}`).join(";"):"";s!==this.tintSig&&(this.tintSig=s,e.setRoomTint(i))}furnitureMarkers(e,t,r,i){let o=[],s=[],a=new Map,l=new Map,c=kn(t);for(let m of t.floors)if(!(m.layer&&this.hiddenLayers.has(m.id)))for(let d of m.furniture){if(!Ue(e,d))continue;let g=this.furnitureLinks.get(d.id),_=this.stateFaces(e,d);_.length&&a.set(d.id,{color:_[0].color,level:_[0].level,faces:_});let b=ir(d.type);if(b&&d.care_entity){let x=this.careMarker(e,m,d,b,d.care_entity);x&&(o.push(x.marker),x.glow&&a.set(d.id,{color:x.glow,level:.9,faces:[{part:"all",color:x.glow,level:.9}]}),l.set(d.id,d.care_entity));continue}let y=X(d.type);if(d.cover_entity&&rr(y)&&l.set(d.id,d.cover_entity),y?.gangs){for(let B of(d.gang_entities??[]).slice(0,y.gangs)){let D=B&&B!=="none"?ve(e,B):null,W=D?q(e.states[D]):null;D&&W!==null&&!i.has(D)&&(i.add(D),s.push({id:B,powerEntity:D,floorId:m.id,x:d.x,z:d.z,power:Math.max(0,W)}))}let x=Ka(e,(d.gang_entities??[]).slice(0,y.gangs),/socket/.test(d.type));x.length&&a.set(d.id,{color:x[0].color,level:x[0].level,gangs:x}),Xi(d.gang_entities,y.gangs).length&&l.set(d.id,`gang:${d.id}`);continue}if(ur(d.type)){let x=this.lampMarker(e,m,d,g?.entity??null),B=g?.power?q(e.states[g.power]):null;if(g?.power&&B!==null&&(B>=1&&(x.text=x.text?`${x.text} \xB7 ${wt(e,B)}`:wt(e,B)),i.has(g.power)||(i.add(g.power),s.push({id:x.id,powerEntity:g.power,floorId:m.id,x:d.x,z:d.z,power:Math.max(0,B)}))),o.push(x),d.type==="ceiling_fan"){let D=g?.fan?e.states[g.fan]:void 0;x.spin=Cu(D),D&&!r.has(D.entity_id)&&(r.add(D.entity_id),o.push({...x,id:D.entity_id,y:Math.max(.5,x.y-.3),icon:d.icon?De(d.icon):Ct("fan"),name:d.name||O(e,D.entity_id),text:ng(e,D),active:te(D),unavailable:C(D),glow:null,lamp:null,spin:void 0,pickable:void 0,effect:void 0}))}continue}let S=Zi(d.type)?Ha(e,d,x=>`${L(e,ce(e,x),1)} ${re(e)}`):null,k=Zi(d.type)?null:Ia(e,d.temp_entity),M=k===null?"":`\u{1F321} ${L(e,ce(e,k),1)} ${re(e)}`,z=d.type==="home_battery"?d.soc:d.type==="wallbox"?d.status:S?d.temp_entity&&d.temp_entity!=="none"?d.temp_entity:d.temp_entity2:k!==null?d.temp_entity:null,R=z&&z!=="none"?z:(d.values??[]).find(x=>x.entity&&x.entity!=="none")?.entity??null,F=g??(R?{entity:null,power:null}:void 0);if(!F)continue;let T=d.type==="home_battery"?R??F.entity??F.power:F.entity??F.power??R;l.set(d.id,T);let E=F.entity?e.states[F.entity]:void 0,A=c.has(d.id),I=A?!!d.meter_invert:d.type==="meter"?t.energy.grid_invert&&!d.export:d.type==="home_battery"?t.energy.battery_invert&&!d.charge:!1,N=F.power?q(e.states[F.power],I):null,K=d.type==="home_battery"&&d.charge&&d.charge!=="none"?d.charge:d.type==="meter"&&!A&&d.export&&d.export!=="none"?d.export:null,j=K?q(e.states[K]):null;j!==null&&(N=Math.max(0,N??0)-Math.max(0,j)),F.power&&N!==null&&!i.has(F.power)&&(i.add(F.power),s.push({id:T,powerEntity:F.power,floorId:m.id,x:d.x,z:d.z,power:Math.max(0,N),wallbox:d.type==="wallbox"||void 0}));let Y=(N??0)>10||E?.state==="on"||E?.state==="running"||mr(E)&&te(E);if((d.type==="radiator"||y)&&E&&P(E.entity_id)==="climate"){let x=E.attributes;if(x.hvac_action==="heating"){let B=typeof x.temperature=="number"&&typeof x.current_temperature=="number"?x.temperature-x.current_temperature:1,D=!!y&&!y.parts.some(W=>W.screen);a.set(d.id,{color:[1,.42,.1],level:Math.min(1,.45+.25*Math.max(0,B)),heat:D||void 0})}}else(d.type==="washer"||d.type==="dryer"||d.type==="dishwasher")&&Y?a.set(d.id,{color:[.3,.85,1],level:.8}):y&&Y&&!y.light&&y.parts.some(x=>x.glow||x.screen)&&a.set(d.id,{color:[.3,.85,1],level:.8,leds:!0});if(qo(d.type)){let x=jo(e,F.entity??F.power);if(x&&x.progress!==null&&(x.printing||/pause/.test(x.status))){let B=x.filaments[0]??"#38bdf8",D=[1,3,5].map(W=>parseInt(B.slice(W,W+2),16)/255);a.set(d.id,{color:D,level:.9,print:Math.max(.02,x.progress/100)})}}if(d.type==="home_battery"&&R){let x=Number(e.states[R]?.state);Number.isFinite(x)&&a.set(d.id,{color:x>60?[.29,.87,.5]:x>25?[.98,.8,.08]:[.97,.44,.44],level:.95,fill:x/100})}if(E&&yr(d.type)){let x=P(E.entity_id)==="light"?We(E):null,B=P(E.entity_id)==="media"&&["playing","on","paused","idle"].includes(E.state),D=x?x.color:te(E)||B?[.22,.88,1]:null;D&&a.set(d.id,{color:D,level:E.state==="playing"?1:.6,halo:d.ambilight??1})}if(r.has(T))continue;r.add(T);let ie=F.entity?P(F.entity):null,v=m.rooms.find(x=>x.points.length>=3&&H([d.x,d.z],x.points));o.push({id:T,floorId:m.id,roomId:v?.id??null,x:d.x,z:d.z,y:is(d)+oe(m,d),icon:d.icon?De(d.icon):Ct(ie??"switch"),name:d.name||(F.entity?O(e,F.entity):ae(e,d.type)),ownName:d.name||void 0,showName:!!d.show_name,text:[S?S.text:d.type==="home_battery"?this.batteryText(e,R,N):d.type==="wallbox"?this.wallboxText(e,R,N):d.type==="meter"?A?N===null?"":he(e,N):this.meterText(e,N):E&&(d.type==="washer"||d.type==="dryer"||d.type==="dishwasher")&&Y&&to(e,bn(e,F.entity??F.power))!==null?$(e,"care_time_left",{time:ja(to(e,bn(e,F.entity??F.power)))}):E?[se(e,E),N!==null&&N>5&&!mr(E)?he(e,N):""].filter(Boolean).join(" \xB7 "):N!==null?he(e,Math.max(0,N)):"",M,yn(e,d.values)].filter(Boolean).join(" \xB7 "),active:S?.warm||k!==null&&k>=Pa||(E?te(E):(N??0)>5),unavailable:E?C(E):!1,glow:null,furnitureId:d.id,energyDevice:d.type==="inverter"||d.type==="home_battery"||d.type==="wallbox"||d.type==="meter",readout:!!S||!!d.values?.some(x=>x.entity&&x.entity!=="none")||void 0,show:d.marker??void 0,fromFurniture:!0})}let u=this.heatMode==="wifi";for(let m of o){let d=m.furnitureId?t.floors.flatMap(_=>_.furniture).find(_=>_.id===m.furnitureId):void 0;if(!d||!Zo(d.type))continue;let g=Yo(e,this.furnitureLinks.get(d.id)?.entity??this.furnitureLinks.get(d.id)?.power??null);g&&(g.clients!==null&&(m.text=$(e,"wifi_clients",{n:g.clients})),u&&(m.wedge={angle:360,reach:9,near:0,color:wu(g),opacity:.4,through:!0,walls:!1},m.show="always"))}let h=Wc(t,o);for(let m of t.floors.flatMap(d=>d.furniture))ot(m.type)&&l.set(m.id,`hydronic:${m.id}`);this.tapPins=h.pins;for(let m of t.floors.flatMap(d=>d.furniture))m.tap?.action&&l.set(m.id,`tap:${m.id}`);for(let{floor:m,item:d}of h.bare){let g=m.rooms.find(b=>b.points.length>=3&&H([d.x,d.z],b.points)),_=d.name||ae(e,d.type);o.push({id:`tap:${d.id}`,floorId:m.id,roomId:g?.id??null,x:d.x,z:d.z,y:is(d)+oe(m,d),icon:De(d.icon||"gesture-tap-button"),name:_,ownName:d.name||void 0,showName:!!d.show_name,text:"",active:!1,unavailable:!1,glow:null,furnitureId:d.id,show:d.marker??void 0,fromFurniture:!0})}return{markers:o,consumers:s,screens:a,targets:l}}robotObstacles(e,t){let r=new Set(["rug","worktop","table","table_round","coffee_table","chair","office_chair","stool","bar_stool","bench","desk","robot_vacuum","parking","stairwell","radiator","tv_wall","kitchen_wall","led_strip"]);return e.furniture.filter(i=>{if(r.has(i.type)||i.type.startsWith("lamp_")&&i.type!=="lamp_floor"&&i.type!=="lamp_uplight"||i.h<.04||oe(e,i)>.12)return!1;let o=X(i.type);return o&&(o.hole||/table|desk|chair|stool|bench|rug|carpet|mat$/.test(i.type))?!1:H([i.x,i.z],t)||dr(i).some(s=>H(s,t))}).map(i=>dr(i))}robotInfos(e,t){let r=[],i=Vu(e),o=Ku(e,i,t.settings.vacuum_map??null),s=!1;for(let a of t.floors){for(let l of a.furniture){if(l.type!=="robot_vacuum")continue;let c=this.furnitureLinks.get(l.id)?.entity??null,u=c?e.states[c]?.state:void 0,h=u==="cleaning"?"cleaning":u==="returning"?"returning":u==="error"?"error":u==="docked"||!u?"docked":"idle",m=l.rotation*Math.PI/180,d=l.d*.14,g=[l.x-Math.sin(m)*d,l.z+Math.cos(m)*d],_=a.rooms.filter(T=>T.points.length>=3),y=(h==="cleaning"?Yi(e,_,c,vr(e,c,l.room_sensor)):null)??_.find(T=>H(g,T.points)),S=h==="cleaning"&&y?this.robotObstacles(a,y.points):[],k=i?Date.parse(e.states[i]?.last_updated??""):Number.NaN,M=!Number.isFinite(k)||Date.now()-k<120*1e3,z=c?.startsWith("vacuum.")&&o&&!s&&(M||h!=="cleaning"&&h!=="returning")?o:null;z&&(s=!0);let R=c?Date.parse(e.states[c]?.last_changed??""):Number.NaN,F=h==="cleaning"||h==="returning"?null:Number.isFinite(R)?R:null;r.push({id:l.id,floorId:a.id,rest:g,restHeading:-m,mode:h,room:y?.points??null,roomId:y?.id??null,obstacles:S,track:z?.path??null,pose:z?.pose??null,settledAt:F})}for(let l of a.furniture){if(!/:(robot_mower|mower_dock)$/.test(l.type))continue;let c=this.furnitureLinks.get(l.id)?.entity??null;if(!c?.startsWith("lawn_mower."))continue;let u=e.states[c]?.state,h=u==="mowing"?"cleaning":u==="returning"?"returning":u==="error"?"error":u==="docked"||!u?"docked":"idle",m=[l.x,l.z],d=(a.outdoor??[]).filter(b=>b.type==="lawn"&&b.points.length>=3),g=d.find(b=>H(m,b.points))??[...d].sort((b,y)=>mn(y.points)-mn(b.points))[0],_=g?(a.outdoor??[]).filter(b=>b!==g&&b.type!=="lawn"&&b.points.some(y=>H(y,g.points))).map(b=>b.points):[];r.push({id:l.id,floorId:a.id,rest:m,restHeading:-l.rotation*Math.PI/180,mode:h,room:g?.points??null,roomId:g?.id??null,obstacles:_,y:g?lr(a,g,m[0],m[1]):cr(a),mower:!0})}}return r}batteryText(e,t,r){let i=t?Number(e.states[t]?.state):Number.NaN,o=[];return Number.isFinite(i)&&o.push(`${L(e,i,0)} %`),r!==null&&Math.abs(r)>=10&&o.push(`${r<0?"\u25B2":"\u25BC"} ${he(e,Math.abs(r))}`),o.join(" \xB7 ")}subMeterText(e,t,r,i){let o=i?zl(t,r,i):null;return o?he(e,o.use)+(o.unmetered===null?"":` \xB7 ${$(e,"meter_unmetered",{w:he(e,o.unmetered)})}`):null}meterText(e,t){return t===null?"":Math.abs(t)<5?he(e,0):`${$(e,t<0?"energy_grid_export":"energy_grid_import")} ${he(e,Math.abs(t))}`}wallboxText(e,t,r){let i=t?e.states[t]:void 0,o=String(i?.state??"").toLowerCase(),s=(r??0)>50||/charg|laden|lädt/.test(o),a=i?.entity_id.startsWith("binary_sensor.")?o==="on":/connect|plug|ready|angesteckt|verbunden|wait|paused|suspend/.test(o),l=s?$(e,"wallbox_charging"):a?$(e,"wallbox_plugged"):i&&!C(i)&&!i.entity_id.startsWith("binary_sensor.")?se(e,i):"",c=r!==null&&r>50?he(e,r):"";return[l,c].filter(Boolean).join(" \xB7 ")}stateFaces(e,t){let r=[],i=t.state_entity2&&t.state_entity2!=="none"?[[t.state_entity,t.state_split==="top_bottom"?"bottom":"left"],[t.state_entity2,t.state_split==="top_bottom"?"top":"right"]]:[[t.state_entity,"all"]];for(let[o,s]of i){if(!o||o==="none")continue;let a=e.states[o];if(!a||C(a)||!(te(a)||a.state==="home"||a.state==="occupied"||a.state==="on"))continue;let c=P(o)==="light"?We(a):null;r.push({part:s,color:c?c.color:[1,.71,.28],level:c?c.level:.85})}return r}careMarker(e,t,r,i,o){let s=e.states[o];if(!s)return null;let a="",l=!1,c=null;if(i==="bin"){let m=wr(s);a=m===null?se(e,s):m===0?$(e,"care_bin_today"):m===1?$(e,"care_bin_tomorrow"):$(e,"care_bin_days",{n:m}),l=m!==null&&m<=1,l&&(c=[1,.72,.28])}else if(i==="mail")l=Ga(s),a=$(e,l?"care_mail_yes":"care_mail_no"),l&&(c=[1,.85,.3]);else{let m=Ua(s,r.thirsty_below??20);l=!!m?.thirsty,a=m?Number.isFinite(m.moisture)?`${$(e,l?"care_plant_thirsty":"care_plant_ok")} \xB7 ${Math.round(m.moisture)} %`:$(e,l?"care_plant_thirsty":"care_plant_ok"):se(e,s),l&&(c=[1,.45,.3])}let u=t.rooms.find(m=>m.points.length>=3&&H([r.x,r.z],m.points)),h={bin:"mdi:trash-can-outline",mail:"mdi:mailbox-outline",plant:"mdi:sprout-outline"}[i];return{glow:c,marker:{id:o,floorId:t.id,roomId:u?.id??null,x:r.x,z:r.z,y:is(r)+oe(t,r),icon:r.icon?De(r.icon):De(h),name:r.name||ae(e,r.type),ownName:r.name||void 0,showName:!!r.show_name,text:a,active:l,unavailable:C(s),glow:null,furnitureId:r.id,show:r.marker??void 0,fromFurniture:!0,care:!0}}}lampMarker(e,t,r,i){let o=i?e.states[i]:void 0,s=(r.extra_lights??[]).map(b=>e.states[b]).filter(b=>!!b),a=s.find(b=>te(b)),l=X(r.type),c=ha[r.type]??l?.light??"floor",u=t.rooms.some(b=>b.points.length>=3&&H([r.x,r.z],b.points)),h=c==="strip"&&!u?hn(t,r.x,r.z)+(r.mount_y??0):r.mount_y!=null&&!l?r.mount_y:l||c==="wall"||c==="strip"?oe(t,r):c==="table"?ar(t,r.x,r.z):c==="bollard"||c==="garden"?hn(t,r.x,r.z):0,m=t.rooms.find(b=>b.points.length>=3&&H([r.x,r.z],b.points)),d=sr(t,r),g=l?l.mount==="ceiling"?Math.max(.5,h-.15):h+r.h+.2:{ceiling:d-.3,downlight:d-.25,spot:d-.35,panel:d-.25,pendant:Math.max(.6,d-r.h-.25),fan:Math.max(.6,d-r.h-.2),floor:h+r.h+.25,uplight:h+r.h+.25,table:h+r.h+.2,wall:h+r.h+.2,strip:r.upright?h+r.w+.15:Math.max(.3,h-.2),bollard:h+r.h+.25,garden:h+r.h+.25}[c],_={id:i??`lamp:${r.id}`,floorId:t.id,roomId:m?.id??null,x:r.x,z:r.z,y:g,icon:Ct("light"),name:r.name||(i?O(e,i):ae(e,r.type)),text:[o&&(te(o)||!a)?se(e,o):a?O(e,a.entity_id):"",yn(e,r.values)].filter(Boolean).join(" \xB7 "),readout:!!r.values?.some(b=>b.entity&&b.entity!=="none"),active:(o?te(o):!1)||!!a,unavailable:o?C(o):!1,glow:o||s.length?oo(ya(o,s,r.color_entity&&r.color_entity!=="none"?e.states[r.color_entity]:void 0),r.glow_scale):null,lamp:c,rotation:r.rotation,mirror:!!r.mirror,roll:r.tilt??0,upright:!!r.upright,rise:r.rise??0,size:[r.w,r.d,r.h],base:h,pickable:!!i,furnitureId:r.id,pack:l?r.type:null,lightY:l?l.mount==="ceiling"?h:h+r.h*.85:void 0,ceiling:d,effect:o?.state==="on"?Er(r,el(e,r,i)):void 0,variant:r.variant,show:r.marker??void 0,fromFurniture:!0};return o&&i?so(e,_,o,!1):_}showPin(e){if(this.furnish&&!e.fromFurniture)return!0;if(e.show==="never"||this.markerMode==="none")return!1;if(e.show==="always")return!0;if(e.show==="active"||this.building?.settings.motion_markers_active&&_a(this.hass,e.id)){if(!e.active)return!1;if(e.show==="active")return!0}if(this.markersOutside&&!(this.roomId&&e.roomId===this.roomId))return this.markersOutside.includes(pa(e.id,!!e.lamp));if(this.markerMode==="all")return!0;if(e.lamp)return!1;let t=P(e.id);return t==="light"?!1:e.fromFurniture&&t==="fan"?!0:e.care?e.active:e.id.startsWith("tap:")||e.readout?!0:e.fromFurniture?(e.power??0)>=1||t==="media"&&e.active||!!e.energyDevice&&!!e.text:!0}openingTargets(){let e=new Map;for(let[t,r]of this.openingLinks??[]){let i=r.lock??r.cover??r.contact??r.tilt;i&&e.set(t,i)}return e}downloadStl(){let e=this.viewer?.exportStl(10);if(!e)return;let t=URL.createObjectURL(new Blob([e],{type:"model/stl"})),r=document.createElement("a");r.href=t,r.download=`nextfloor-${new Date().toISOString().slice(0,10)}.stl`,r.click(),setTimeout(()=>URL.revokeObjectURL(t),5e3)}secondBlinds(){let e=new Map;for(let[t,r]of this.openingLinks??[])r.cover2&&!r.lock&&r.cover&&e.set(t,r.cover2);return e}scheduleThumbs(e=600){clearTimeout(this.thumbTimer);let t=this.building?.floors.filter(i=>i.rooms.length).length??0;if(!this.floorThumbs||t<2){this._thumbs=[];return}let r=Math.max(e,this.thumbsAt+(this._low?8e3:4e3)-Date.now());this.thumbTimer=setTimeout(()=>{if(!(!this.viewer||this.dimmed&&this._thumbs.length)){if(document.hidden){this.scheduleThumbs(3e3);return}this.thumbsAt=Date.now(),this._thumbs=this.viewer.floorThumbnails(this.narrowThumbs?104:150,this.narrowThumbs?78:112)}},r)}get narrowThumbs(){return this._narrowStage}renderThumbs(){if(!this._thumbs.length||!this.building||this._phoneStage)return f;let e=new Map(this.building.floors.map(o=>[o.id,o.name])),t=[...this._thumbs].sort((o,s)=>(this.building.floors.find(a=>a.id===s.floorId)?.elevation??0)-(this.building.floors.find(a=>a.id===o.floorId)?.elevation??0)),r=this._thumbsCompact,i=()=>{this._thumbsCompact=!r;try{localStorage.setItem("nextfloor.thumbs_compact",this._thumbsCompact?"1":"0")}catch{}};return p`
`}syncDevices(e){let t=this.viewer,r=this.building;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ut(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Be(o,r.floors),this.furnitureLinks=Ke(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Dc(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Oc({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;uo(o,r).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let a=Sn(o,r),l=rl(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(o,r,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=$n(o,r,a,Ze(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=bt(o,r.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let x of v.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,F=x.pump_entity?o.states[x.pump_entity]:void 0,[W,_e]=Te(x.points),ct=B&&Number.isFinite(Number(B.state))?`${L(o,ce(o,fr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",$t=!!F&&te(F);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:v.id,roomId:null,x:W,z:_e,y:cr(v,x,W,_e)+.7,icon:Fe(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[ct,$t?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:$t,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of r.floors){for(let x of v.placements)x.pin_offset&&d.set(`${v.id}:${x.entity_id}`,x.pin_offset);for(let x of v.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let g=v=>{let x=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return x?{...v,x:v.x+(x.x??0),z:v.z+(x.z??0),y:v.y+(x.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let x=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,B={...v,power:x,powerText:x===null?void 0:he(o,x),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,u,v.furnitureId)??v.text},F=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=m.has(v.id)||!!v.furnitureId&&m.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:F}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Na(o,r.floors)),t.setCovers(Za(o,r)),t.setRobots(this.robotInfos(o,r));let _=new Map;for(let v of r.floors)for(let x of v.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,Ji(o,v.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Ec(o,r)),t.setParked(Po(o,r)),t.setGateStates(Uc(o,r));let b=new Map(r.floors.flatMap(v=>v.openings.map(x=>[x.id,x.type]))),y=new Map([...this.openingLinks].map(([v,x])=>[v,Ve(o,x,b.get(v))]));t.setOpeningStates(y),this.setAlerts(this.alertSrc?Fo(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...y].map(([v,x])=>`${v}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=S,v||this.scheduleThumbs(1500)}let k=su(o,r,a,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),M=this.liveCars(o,r);for(let v of M){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let x=r.floors.flatMap(W=>W.furniture.filter(_e=>_e.type==="wallbox").map(_e=>({floorId:W.id,x:_e.x,z:_e.z,y:1}))).sort((W,_e)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(_e.x-v.at.x,_e.z-v.at.z))[0],B=x&&x.floorId===v.at.floorId&&Math.hypot(x.x-v.at.x,x.z-v.at.z)<9,F=x??Nn(r);!F||!v.car.charging&&!B||k.arcs.push({key:`car:${v.spot}`,from:F,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...F,y:.35},{floorId:v.at.floorId,x:(F.x+v.at.x)/2,z:(F.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let z=Nn(r);for(let v of this.liveHeatPumps(r)){let x=v.pump.heat??(v.pump.mode==="heating"||v.pump.mode==="water"?(v.pump.power??0)*(v.pump.cop??3):0);z&&x>100&&v.pump.mode!=="cooling"&&k.arcs.push({key:`heat:${v.id}`,from:{floorId:v.floorId,x:v.x,z:v.z,y:.8},to:z,power:x,color:[255,120,40]})}let R=(this.flows??this._flows)&&!this.dimmed;t.setLiveEnergy(R?k.arcs:[],R?k.sparks:[]),JSON.stringify(k)!==JSON.stringify(this._liveEnergy)&&(this._liveEnergy=k);let T=this.liveMedia(o,r).filter(v=>v.playing&&!this.dimmed);t.setLiveSound(T.filter(v=>v.rings>0).map(v=>({id:v.entity,at:v.at,color:v.color,level:v.volume??.5,size:v.rings})),$c(T).map(([v,x])=>[v.at,x.at])),this.syncLhCards(t,r,k,M,T,o),t.setLiveScreens(this.dimmed?[]:Rc(o,r,this.furnitureLinks)),t.setPictures(this.framePictures(o,r)),t.setLiveWater(this.dimmed?[]:Mc(o,r,this.furnitureLinks));let E=cc(o,r);t.setPersons(E);let A=uc(o,r,this.openingLinks,E);t.setFloorInfo(new Map([...A].map(([v,x])=>[v,dc(o,x)])));let I=o.config,N=this.timeOfDay!=null&&I?.latitude!==void 0&&I.longitude!==void 0?ft(Et(this.timeOfDay,I.time_zone),I.latitude,I.longitude):zc(o);t.setSun(N),t.setLocation(I?.latitude!==void 0&&I.longitude!==void 0?{latitude:I.latitude,longitude:I.longitude,zone:I.time_zone}:null);let K=this.weather&&!this.dimmed?jc(o,at(o,this.weatherEntityId??r.settings.weather_entity)):null,j=K?qc(Zc(K,r.settings.weather_effects),this.weatherDensity):null;this.cloud=j?.cloud??0,this._sky=Tc(N?.elevation??null,this.cloud),t.setSky(this.weather&&!this.dimmed?{weather:j,sun:N,north:r.settings.north??0,sky:this.skyColor(),disc:(r.settings.weather_effects??["sky"]).includes("sky"),low:this._low}:null),this.applyTint();let ie=u.grid!==null||u.solar!==null||u.battery!==null||u.tariff!==null?u:null;JSON.stringify(ie)!==JSON.stringify(this._energy)&&(this._energy=ie)}watchLostContacts(e){let t=!!this.alertSrc&&!this._travel&&Pc(e,this.alertSrc);t&&!this.contactTimer&&(this.contactTimer=setInterval(()=>{let r=this.building;this.alertSrc&&r&&this.hass&&this.openingLinks&&!this._travel&&this.setAlerts(Fo(this.hass,r,this.alertSrc,this.openingLinks))},6e4)),!t&&this.contactTimer&&(clearInterval(this.contactTimer),this.contactTimer=void 0)}setAlerts(e){let t=e.map(o=>`${o.kind}:${o.entity}`),r=e.filter((o,s)=>!this.seenAlerts.has(t[s])&&!Yr.has(o.kind));this.seenAlerts=new Set(t),t.join()!==this._alerts.map(o=>`${o.kind}:${o.entity}`).join()&&(this._alerts=e);let i=e.some(o=>!Yr.has(o.kind));i&&!this.alertTimer&&(this.alertTimer=setInterval(()=>!document.hidden&&this.applyTint(),this._low?200:100)),!i&&this.alertTimer&&(clearInterval(this.alertTimer),this.alertTimer=void 0),r.length&&this.alertJump&&this.jumpTo(r[0])}jumpTo(e){if(e.kind==="own"&&e.tap!=="room"){e.tap==="toggle"?this.hass.callService("homeassistant","toggle",{entity_id:e.entity}):ke(this,e.entity);return}if(!e.floorId){this.fire("floor-tap",{floorId:null});return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),e.roomId&&setTimeout(()=>this.fire("room-tap",{floorId:e.floorId,roomId:e.roomId}),60)}onRoomDoubleTap(e,t){let r=this.building,i=this.hass,o=r?.floors.find(u=>u.id===e),s=o?.rooms.find(u=>u.id===t);if(!r||!i||!o||!s)return;let a=Wc(r.settings.room_double_tap,this.roomDoubleTap),l=Bc(i,o,s,this.furnitureLinks,this.confirmSet,a);if(!l.length)return;let c=l.some(u=>i.states[u]?.state==="on");i.callService("homeassistant",c?"turn_off":"turn_on",{entity_id:l}),this.roomFlash={roomId:t,until:performance.now()+350},this.applyTint(),setTimeout(()=>{this.roomFlash=null,this.applyTint()},380)}runScene(e){this.hass.callService(e.split(".")[0],"turn_on",{entity_id:e}),this._sceneFired=e,setTimeout(()=>this._sceneFired=null,600)}applyTint(){let e=this.viewer,t=this.building,r=this.hass;if(!e||!t||!r)return;let i=null;if(this.heatMode!=="none"&&this.heatMode!=="values"&&this.heatMode!=="wifi"){let a=this.heatMode,l=Xl(r,t,a);!l.size!=!this.heatValues.size&&this.requestUpdate(),this.heatValues=l;let c=vt(new Date,r.config?.latitude??50);i=new Map([...l].map(([u,h])=>[u,Ql(a,h,c)]))}let o=new Map;if(this.heatMode==="values")for(let a of t.floors)for(let l of a.rooms){let c=Z(r,a,l,"temperature"),u=Z(r,a,l,"humidity"),h=Z(r,a,l,"co2"),m=Br(h,u,Gt(c,u)),d=[c!==null?`${L(r,ce(r,c),1)} ${re(r)}`:null,u!==null?`${L(r,u,0)} %`:null,h!==null?`${L(r,h,0)} ppm`:null,m?`\u{1F4A8} ${$(r,`air_${m}`)}`:null].filter(g=>!!g);d.length&&o.set(l.id,d.join(" \xB7 "))}if(e.setRoomInfo(o),!i)for(let a of t.floors)for(let l of a.rooms){let c=l.floor_heating?r.states[l.floor_heating]:void 0;c&&(V(r)?le(c)===!0:c.entity_id.startsWith("climate.")?c.attributes.hvac_action==="heating":c.state==="on"||c.state==="open")&&(i??=new Map).set(l.id,[.55,.24,.08])}if(this._alerts.length){i??=new Map;let a=.55+.45*Math.sin(performance.now()/160);for(let l of this._alerts){if(Yr.has(l.kind))continue;let c=Ic(l.kind).map(u=>u*a);if(l.roomId)i.set(l.roomId,c);else for(let u of t.floors)for(let h of u.rooms)i.set(h.id,c)}}this.roomFlash&&performance.now()`${a}:${l.map(c=>c.toFixed(2)).join(",")}`).join(";"):"";s!==this.tintSig&&(this.tintSig=s,e.setRoomTint(i))}furnitureMarkers(e,t,r,i){let o=[],s=[],a=new Map,l=new Map,c=kn(t);for(let m of t.floors)if(!(m.layer&&this.hiddenLayers.has(m.id)))for(let d of m.furniture){if(!Ue(e,d))continue;let g=this.furnitureLinks.get(d.id),_=this.stateFaces(e,d);_.length&&a.set(d.id,{color:_[0].color,level:_[0].level,faces:_});let b=or(d.type);if(b&&d.care_entity){let x=this.careMarker(e,m,d,b,d.care_entity);x&&(o.push(x.marker),x.glow&&a.set(d.id,{color:x.glow,level:.9,faces:[{part:"all",color:x.glow,level:.9}]}),l.set(d.id,d.care_entity));continue}let y=X(d.type);if(d.cover_entity&&ir(y)&&l.set(d.id,d.cover_entity),y?.gangs){for(let B of(d.gang_entities??[]).slice(0,y.gangs)){let F=B&&B!=="none"?ve(e,B):null,W=F?q(e.states[F]):null;F&&W!==null&&!i.has(F)&&(i.add(F),s.push({id:B,powerEntity:F,floorId:m.id,x:d.x,z:d.z,power:Math.max(0,W)}))}let x=Ga(e,(d.gang_entities??[]).slice(0,y.gangs),/socket/.test(d.type));x.length&&a.set(d.id,{color:x[0].color,level:x[0].level,gangs:x}),eo(d.gang_entities,y.gangs).length&&l.set(d.id,`gang:${d.id}`);continue}if(dr(d.type)){let x=this.lampMarker(e,m,d,g?.entity??null),B=g?.power?q(e.states[g.power]):null;if(g?.power&&B!==null&&(B>=1&&(x.text=x.text?`${x.text} \xB7 ${wt(e,B)}`:wt(e,B)),i.has(g.power)||(i.add(g.power),s.push({id:x.id,powerEntity:g.power,floorId:m.id,x:d.x,z:d.z,power:Math.max(0,B)}))),o.push(x),d.type==="ceiling_fan"){let F=g?.fan?e.states[g.fan]:void 0;x.spin=Lu(F),F&&!r.has(F.entity_id)&&(r.add(F.entity_id),o.push({...x,id:F.entity_id,y:Math.max(.5,x.y-.3),icon:d.icon?Fe(d.icon):Ct("fan"),name:d.name||O(e,F.entity_id),text:og(e,F),active:te(F),unavailable:C(F),glow:null,lamp:null,spin:void 0,pickable:void 0,effect:void 0}))}continue}let S=Yi(d.type)?Pa(e,d,x=>`${L(e,ce(e,x),1)} ${re(e)}`):null,k=Yi(d.type)?null:Ca(e,d.temp_entity),M=k===null?"":`\u{1F321} ${L(e,ce(e,k),1)} ${re(e)}`,z=d.type==="home_battery"?d.soc:d.type==="wallbox"?d.status:S?d.temp_entity&&d.temp_entity!=="none"?d.temp_entity:d.temp_entity2:k!==null?d.temp_entity:null,R=z&&z!=="none"?z:(d.values??[]).find(x=>x.entity&&x.entity!=="none")?.entity??null,D=g??(R?{entity:null,power:null}:void 0);if(!D)continue;let T=d.type==="home_battery"?R??D.entity??D.power:D.entity??D.power??R;l.set(d.id,T);let E=D.entity?e.states[D.entity]:void 0,A=c.has(d.id),I=A?!!d.meter_invert:d.type==="meter"?t.energy.grid_invert&&!d.export:d.type==="home_battery"?t.energy.battery_invert&&!d.charge:!1,N=D.power?q(e.states[D.power],I):null,K=d.type==="home_battery"&&d.charge&&d.charge!=="none"?d.charge:d.type==="meter"&&!A&&d.export&&d.export!=="none"?d.export:null,j=K?q(e.states[K]):null;j!==null&&(N=Math.max(0,N??0)-Math.max(0,j)),D.power&&N!==null&&!i.has(D.power)&&(i.add(D.power),s.push({id:T,powerEntity:D.power,floorId:m.id,x:d.x,z:d.z,power:Math.max(0,N),wallbox:d.type==="wallbox"||void 0}));let Y=(N??0)>10||E?.state==="on"||E?.state==="running"||pr(E)&&te(E);if((d.type==="radiator"||y)&&E&&P(E.entity_id)==="climate"){let x=E.attributes;if(x.hvac_action==="heating"){let B=typeof x.temperature=="number"&&typeof x.current_temperature=="number"?x.temperature-x.current_temperature:1,F=!!y&&!y.parts.some(W=>W.screen);a.set(d.id,{color:[1,.42,.1],level:Math.min(1,.45+.25*Math.max(0,B)),heat:F||void 0})}}else(d.type==="washer"||d.type==="dryer"||d.type==="dishwasher")&&Y?a.set(d.id,{color:[.3,.85,1],level:.8}):y&&Y&&!y.light&&y.parts.some(x=>x.glow||x.screen)&&a.set(d.id,{color:[.3,.85,1],level:.8,leds:!0});if(Zo(d.type)){let x=qo(e,D.entity??D.power);if(x&&x.progress!==null&&(x.printing||/pause/.test(x.status))){let B=x.filaments[0]??"#38bdf8",F=[1,3,5].map(W=>parseInt(B.slice(W,W+2),16)/255);a.set(d.id,{color:F,level:.9,print:Math.max(.02,x.progress/100)})}}if(d.type==="home_battery"&&R){let x=Number(e.states[R]?.state);Number.isFinite(x)&&a.set(d.id,{color:x>60?[.29,.87,.5]:x>25?[.98,.8,.08]:[.97,.44,.44],level:.95,fill:x/100})}if(E&&vr(d.type)){let x=P(E.entity_id)==="light"?We(E):null,B=P(E.entity_id)==="media"&&["playing","on","paused","idle"].includes(E.state),F=x?x.color:te(E)||B?[.22,.88,1]:null;F&&a.set(d.id,{color:F,level:E.state==="playing"?1:.6,halo:d.ambilight??1})}if(r.has(T))continue;r.add(T);let ie=D.entity?P(D.entity):null,v=m.rooms.find(x=>x.points.length>=3&&H([d.x,d.z],x.points));o.push({id:T,floorId:m.id,roomId:v?.id??null,x:d.x,z:d.z,y:os(d)+oe(m,d),icon:d.icon?Fe(d.icon):Ct(ie??"switch"),name:d.name||(D.entity?O(e,D.entity):ae(e,d.type)),ownName:d.name||void 0,showName:!!d.show_name,text:[S?S.text:d.type==="home_battery"?this.batteryText(e,R,N):d.type==="wallbox"?this.wallboxText(e,R,N):d.type==="meter"?A?N===null?"":he(e,N):this.meterText(e,N):E&&(d.type==="washer"||d.type==="dryer"||d.type==="dishwasher")&&Y&&no(e,bn(e,D.entity??D.power))!==null?$(e,"care_time_left",{time:qa(no(e,bn(e,D.entity??D.power)))}):E?[se(e,E),N!==null&&N>5&&!pr(E)?he(e,N):""].filter(Boolean).join(" \xB7 "):N!==null?he(e,Math.max(0,N)):"",M,yn(e,d.values)].filter(Boolean).join(" \xB7 "),active:S?.warm||k!==null&&k>=Ia||(E?te(E):(N??0)>5),unavailable:E?C(E):!1,glow:null,furnitureId:d.id,energyDevice:d.type==="inverter"||d.type==="home_battery"||d.type==="wallbox"||d.type==="meter",readout:!!S||!!d.values?.some(x=>x.entity&&x.entity!=="none")||void 0,show:d.marker??void 0,fromFurniture:!0})}let u=this.heatMode==="wifi";for(let m of o){let d=m.furnitureId?t.floors.flatMap(_=>_.furniture).find(_=>_.id===m.furnitureId):void 0;if(!d||!Yo(d.type))continue;let g=Jo(e,this.furnitureLinks.get(d.id)?.entity??this.furnitureLinks.get(d.id)?.power??null);g&&(g.clients!==null&&(m.text=$(e,"wifi_clients",{n:g.clients})),u&&(m.wedge={angle:360,reach:9,near:0,color:ku(g),opacity:.4,through:!0,walls:!1},m.show="always"))}let h=Vc(t,o);for(let m of t.floors.flatMap(d=>d.furniture))ot(m.type)&&l.set(m.id,`hydronic:${m.id}`);this.tapPins=h.pins;for(let m of t.floors.flatMap(d=>d.furniture))m.tap?.action&&l.set(m.id,`tap:${m.id}`);for(let{floor:m,item:d}of h.bare){let g=m.rooms.find(b=>b.points.length>=3&&H([d.x,d.z],b.points)),_=d.name||ae(e,d.type);o.push({id:`tap:${d.id}`,floorId:m.id,roomId:g?.id??null,x:d.x,z:d.z,y:os(d)+oe(m,d),icon:Fe(d.icon||"gesture-tap-button"),name:_,ownName:d.name||void 0,showName:!!d.show_name,text:"",active:!1,unavailable:!1,glow:null,furnitureId:d.id,show:d.marker??void 0,fromFurniture:!0})}return{markers:o,consumers:s,screens:a,targets:l}}robotObstacles(e,t){let r=new Set(["rug","worktop","table","table_round","coffee_table","chair","office_chair","stool","bar_stool","bench","desk","robot_vacuum","parking","stairwell","radiator","tv_wall","kitchen_wall","led_strip"]);return e.furniture.filter(i=>{if(r.has(i.type)||i.type.startsWith("lamp_")&&i.type!=="lamp_floor"&&i.type!=="lamp_uplight"||i.h<.04||oe(e,i)>.12)return!1;let o=X(i.type);return o&&(o.hole||/table|desk|chair|stool|bench|rug|carpet|mat$/.test(i.type))?!1:H([i.x,i.z],t)||hr(i).some(s=>H(s,t))}).map(i=>hr(i))}robotInfos(e,t){let r=[],i=Gu(e),o=Uu(e,i,t.settings.vacuum_map??null),s=!1;for(let a of t.floors){for(let l of a.furniture){if(l.type!=="robot_vacuum")continue;let c=this.furnitureLinks.get(l.id)?.entity??null,u=c?e.states[c]?.state:void 0,h=u==="cleaning"?"cleaning":u==="returning"?"returning":u==="error"?"error":u==="docked"||!u?"docked":"idle",m=l.rotation*Math.PI/180,d=l.d*.14,g=[l.x-Math.sin(m)*d,l.z+Math.cos(m)*d],_=a.rooms.filter(T=>T.points.length>=3),y=(h==="cleaning"?Ji(e,_,c,wr(e,c,l.room_sensor)):null)??_.find(T=>H(g,T.points)),S=h==="cleaning"&&y?this.robotObstacles(a,y.points):[],k=i?Date.parse(e.states[i]?.last_updated??""):Number.NaN,M=!Number.isFinite(k)||Date.now()-k<120*1e3,z=c?.startsWith("vacuum.")&&o&&!s&&(M||h!=="cleaning"&&h!=="returning")?o:null;z&&(s=!0);let R=c?Date.parse(e.states[c]?.last_changed??""):Number.NaN,D=h==="cleaning"||h==="returning"?null:Number.isFinite(R)?R:null;r.push({id:l.id,floorId:a.id,rest:g,restHeading:-m,mode:h,room:y?.points??null,roomId:y?.id??null,obstacles:S,track:z?.path??null,pose:z?.pose??null,settledAt:D})}for(let l of a.furniture){if(!/:(robot_mower|mower_dock)$/.test(l.type))continue;let c=this.furnitureLinks.get(l.id)?.entity??null;if(!c?.startsWith("lawn_mower."))continue;let u=e.states[c]?.state,h=u==="mowing"?"cleaning":u==="returning"?"returning":u==="error"?"error":u==="docked"||!u?"docked":"idle",m=[l.x,l.z],d=(a.outdoor??[]).filter(b=>b.type==="lawn"&&b.points.length>=3),g=d.find(b=>H(m,b.points))??[...d].sort((b,y)=>mn(y.points)-mn(b.points))[0],_=g?(a.outdoor??[]).filter(b=>b!==g&&b.type!=="lawn"&&b.points.some(y=>H(y,g.points))).map(b=>b.points):[];r.push({id:l.id,floorId:a.id,rest:m,restHeading:-l.rotation*Math.PI/180,mode:h,room:g?.points??null,roomId:g?.id??null,obstacles:_,y:g?cr(a,g,m[0],m[1]):ur(a),mower:!0})}}return r}batteryText(e,t,r){let i=t?Number(e.states[t]?.state):Number.NaN,o=[];return Number.isFinite(i)&&o.push(`${L(e,i,0)} %`),r!==null&&Math.abs(r)>=10&&o.push(`${r<0?"\u25B2":"\u25BC"} ${he(e,Math.abs(r))}`),o.join(" \xB7 ")}subMeterText(e,t,r,i){let o=i?Tl(t,r,i):null;return o?he(e,o.use)+(o.unmetered===null?"":` \xB7 ${$(e,"meter_unmetered",{w:he(e,o.unmetered)})}`):null}meterText(e,t){return t===null?"":Math.abs(t)<5?he(e,0):`${$(e,t<0?"energy_grid_export":"energy_grid_import")} ${he(e,Math.abs(t))}`}wallboxText(e,t,r){let i=t?e.states[t]:void 0,o=String(i?.state??"").toLowerCase(),s=(r??0)>50||/charg|laden|lädt/.test(o),a=i?.entity_id.startsWith("binary_sensor.")?o==="on":/connect|plug|ready|angesteckt|verbunden|wait|paused|suspend/.test(o),l=s?$(e,"wallbox_charging"):a?$(e,"wallbox_plugged"):i&&!C(i)&&!i.entity_id.startsWith("binary_sensor.")?se(e,i):"",c=r!==null&&r>50?he(e,r):"";return[l,c].filter(Boolean).join(" \xB7 ")}stateFaces(e,t){let r=[],i=t.state_entity2&&t.state_entity2!=="none"?[[t.state_entity,t.state_split==="top_bottom"?"bottom":"left"],[t.state_entity2,t.state_split==="top_bottom"?"top":"right"]]:[[t.state_entity,"all"]];for(let[o,s]of i){if(!o||o==="none")continue;let a=e.states[o];if(!a||C(a)||!(te(a)||a.state==="home"||a.state==="occupied"||a.state==="on"))continue;let c=P(o)==="light"?We(a):null;r.push({part:s,color:c?c.color:[1,.71,.28],level:c?c.level:.85})}return r}careMarker(e,t,r,i,o){let s=e.states[o];if(!s)return null;let a="",l=!1,c=null;if(i==="bin"){let m=xr(s);a=m===null?se(e,s):m===0?$(e,"care_bin_today"):m===1?$(e,"care_bin_tomorrow"):$(e,"care_bin_days",{n:m}),l=m!==null&&m<=1,l&&(c=[1,.72,.28])}else if(i==="mail")l=Ua(s),a=$(e,l?"care_mail_yes":"care_mail_no"),l&&(c=[1,.85,.3]);else{let m=ja(s,r.thirsty_below??20);l=!!m?.thirsty,a=m?Number.isFinite(m.moisture)?`${$(e,l?"care_plant_thirsty":"care_plant_ok")} \xB7 ${Math.round(m.moisture)} %`:$(e,l?"care_plant_thirsty":"care_plant_ok"):se(e,s),l&&(c=[1,.45,.3])}let u=t.rooms.find(m=>m.points.length>=3&&H([r.x,r.z],m.points)),h={bin:"mdi:trash-can-outline",mail:"mdi:mailbox-outline",plant:"mdi:sprout-outline"}[i];return{glow:c,marker:{id:o,floorId:t.id,roomId:u?.id??null,x:r.x,z:r.z,y:os(r)+oe(t,r),icon:r.icon?Fe(r.icon):Fe(h),name:r.name||ae(e,r.type),ownName:r.name||void 0,showName:!!r.show_name,text:a,active:l,unavailable:C(s),glow:null,furnitureId:r.id,show:r.marker??void 0,fromFurniture:!0,care:!0}}}lampMarker(e,t,r,i){let o=i?e.states[i]:void 0,s=(r.extra_lights??[]).map(b=>e.states[b]).filter(b=>!!b),a=s.find(b=>te(b)),l=X(r.type),c=ma[r.type]??l?.light??"floor",u=t.rooms.some(b=>b.points.length>=3&&H([r.x,r.z],b.points)),h=c==="strip"&&!u?hn(t,r.x,r.z)+(r.mount_y??0):r.mount_y!=null&&!l?r.mount_y:l||c==="wall"||c==="strip"?oe(t,r):c==="table"?lr(t,r.x,r.z):c==="bollard"||c==="garden"?hn(t,r.x,r.z):0,m=t.rooms.find(b=>b.points.length>=3&&H([r.x,r.z],b.points)),d=ar(t,r),g=l?l.mount==="ceiling"?Math.max(.5,h-.15):h+r.h+.2:{ceiling:d-.3,downlight:d-.25,spot:d-.35,panel:d-.25,pendant:Math.max(.6,d-r.h-.25),fan:Math.max(.6,d-r.h-.2),floor:h+r.h+.25,uplight:h+r.h+.25,table:h+r.h+.2,wall:h+r.h+.2,strip:r.upright?h+r.w+.15:Math.max(.3,h-.2),bollard:h+r.h+.25,garden:h+r.h+.25}[c],_={id:i??`lamp:${r.id}`,floorId:t.id,roomId:m?.id??null,x:r.x,z:r.z,y:g,icon:Ct("light"),name:r.name||(i?O(e,i):ae(e,r.type)),text:[o&&(te(o)||!a)?se(e,o):a?O(e,a.entity_id):"",yn(e,r.values)].filter(Boolean).join(" \xB7 "),readout:!!r.values?.some(b=>b.entity&&b.entity!=="none"),active:(o?te(o):!1)||!!a,unavailable:o?C(o):!1,glow:o||s.length?so(va(o,s,r.color_entity&&r.color_entity!=="none"?e.states[r.color_entity]:void 0),r.glow_scale):null,lamp:c,rotation:r.rotation,mirror:!!r.mirror,roll:r.tilt??0,upright:!!r.upright,rise:r.rise??0,size:[r.w,r.d,r.h],base:h,pickable:!!i,furnitureId:r.id,pack:l?r.type:null,lightY:l?l.mount==="ceiling"?h:h+r.h*.85:void 0,ceiling:d,effect:o?.state==="on"?Rr(r,tl(e,r,i)):void 0,variant:r.variant,show:r.marker??void 0,fromFurniture:!0};return o&&i?ao(e,_,o,!1):_}showPin(e){if(this.furnish&&!e.fromFurniture)return!0;if(e.show==="never"||this.markerMode==="none")return!1;if(e.show==="always")return!0;if(e.show==="active"||this.building?.settings.motion_markers_active&&ba(this.hass,e.id)){if(!e.active)return!1;if(e.show==="active")return!0}if(this.markersOutside&&!(this.roomId&&e.roomId===this.roomId))return this.markersOutside.includes(fa(e.id,!!e.lamp));if(this.markerMode==="all")return!0;if(e.lamp)return!1;let t=P(e.id);return t==="light"?!1:e.fromFurniture&&t==="fan"?!0:e.care?e.active:e.id.startsWith("tap:")||e.readout?!0:e.fromFurniture?(e.power??0)>=1||t==="media"&&e.active||!!e.energyDevice&&!!e.text:!0}openingTargets(){let e=new Map;for(let[t,r]of this.openingLinks??[]){let i=r.lock??r.cover??r.contact??r.tilt;i&&e.set(t,i)}return e}downloadStl(){let e=this.viewer?.exportStl(10);if(!e)return;let t=URL.createObjectURL(new Blob([e],{type:"model/stl"})),r=document.createElement("a");r.href=t,r.download=`nextfloor-${new Date().toISOString().slice(0,10)}.stl`,r.click(),setTimeout(()=>URL.revokeObjectURL(t),5e3)}secondBlinds(){let e=new Map;for(let[t,r]of this.openingLinks??[])r.cover2&&!r.lock&&r.cover&&e.set(t,r.cover2);return e}scheduleThumbs(e=600){clearTimeout(this.thumbTimer);let t=this.building?.floors.filter(i=>i.rooms.length).length??0;if(!this.floorThumbs||t<2){this._thumbs=[];return}let r=Math.max(e,this.thumbsAt+(this._low?8e3:4e3)-Date.now());this.thumbTimer=setTimeout(()=>{if(!(!this.viewer||this.dimmed&&this._thumbs.length)){if(document.hidden){this.scheduleThumbs(3e3);return}this.thumbsAt=Date.now(),this._thumbs=this.viewer.floorThumbnails(this.narrowThumbs?104:150,this.narrowThumbs?78:112)}},r)}get narrowThumbs(){return this._narrowStage}renderThumbs(){if(!this._thumbs.length||!this.building||this._phoneStage)return f;let e=new Map(this.building.floors.map(o=>[o.id,o.name])),t=[...this._thumbs].sort((o,s)=>(this.building.floors.find(a=>a.id===s.floorId)?.elevation??0)-(this.building.floors.find(a=>a.id===o.floorId)?.elevation??0)),r=this._thumbsCompact,i=()=>{this._thumbsCompact=!r;try{localStorage.setItem("nextfloor.thumbs_compact",this._thumbsCompact?"1":"0")}catch{}};return p``}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:ke(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&es(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&ts(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,dl(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!al(e,this.screenName)||!ll(e))return;let r=cl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),ul(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p``:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p``}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p``;let t=Du(this.findIndex??=Tu(this.hass,e),this._find);return p`
+ `;let t=Hu(this.findIndex??=Du(this.hass,e),this._find);return p`
this.hass.states[r]?.attributes.symcon_path||this.hass.states ${this._find.trim()?p`
${t.length?t.map(r=>p``):p`

${$(this.hass,"find_none")}

`}
`:f} @@ -1704,7 +1704,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states @click=${()=>{this._central=!this._central,this._armed=null}} > - `;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Ji(t,b).lights),l=s.flatMap(b=>Ji(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,h=(b,y,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:k})}},m=(b,y,S,k,M)=>p``;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Qi(t,b).lights),l=s.flatMap(b=>Qi(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,h=(b,y,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:k})}},m=(b,y,S,k,M)=>p``,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!d[b]||!o||d[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i} `:f} ${r("central_favorites")} ${g.length?p`
- ${g.map(b=>{let[y,S]=Ba(b),k=t.states[b],M=y==="homeassistant"&&k?.state==="on";return p``)}
`:f} -
`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Gu,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Rn(this.hass,hc(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:mc(i,r,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p``:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`
+
`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(ju,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await zn(this.hass,pc(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:fc(i,r,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p``:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`
${t.loading?e("travel_loading"):i}
@@ -1775,7 +1775,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${O(this.hass,e.entity)} ${t?$(this.hass,"swipe_off"):`${e.value} %`} -
`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Xi(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return p`
+
`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?eo(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return p`
`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`
this._menu=null}>
@@ -1788,12 +1788,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states .presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))} ?confirmSwitch=${this.confirmSet.has(e.entity)} .myPosition=${this.myPositionOf(e.entity)} - .tiltEntity=${xr(this.hass,this.building?.floors??[],e.entity)} + .tiltEntity=${kr(this.hass,this.building?.floors??[],e.entity)} @close=${()=>this._menu=null} - >`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Uo().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Qi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ze(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ke(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=qi(this.hass,e),a=O(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&fa.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;il(this.hass,e)}else ke(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return qs({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ke(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`
t.stopPropagation()}> + >`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&jo().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Xi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ze(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ke(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=Zi(this.hass,e),a=O(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&ga.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;ol(this.hass,e)}else ke(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return Zs({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ke(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`
t.stopPropagation()}>
${e.title}
${e.node}
-
`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!yu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=bu(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!qo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=jo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Su(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Fo(e,o),l=a?Cc(o,a):null,c=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return xc(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,mu(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?at(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,gu(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=fu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=at(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=r.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`
+
`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!wu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=vu(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!Zo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=qo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Mu(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ho(e,o),l=a?Lc(o,a):null,c=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Sc(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,fu(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?at(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,bu(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=_u(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=at(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=r.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`
    ${o.map((d,g)=>p`
  • ${g===0?$(r,"today"):h.format(new Date(d.day))} @@ -1802,14 +1802,14 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}
  • `)}
-
`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`
${e}${o}${i}
`}renderTodayCard(e,t){let r=du(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=hu([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=i.flatMap((u,h)=>[(u.day??0)>0&&(i[h-1]?.day??0)!==u.day?p`
  • ${l(u.day??0)}
  • `:f,p`
  • ${u.title}${u.source}
  • `]);return p`
    +
    `}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`
    ${e}${o}${i}
    `}renderTodayCard(e,t){let r=mu(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=pu([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=i.flatMap((u,h)=>[(u.day??0)>0&&(i[h-1]?.day??0)!==u.day?p`
  • ${l(u.day??0)}
  • `:f,p`
  • ${u.title}${u.source}
  • `]);return p`
    ${o?i.length?p`
      ${c}
    `:p`

    ${$(t,"today_none")}

    `:f} -
    `}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Ze(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Xl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?Ce(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?q(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Ne(r,s):wt(r,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let h=e.energy[l],m=h?r?.states[h]:void 0;m&&!C(m)&&i.push({icon:c,label:$(r,u),value:se(r,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>$n(a,e,Sn(a,e),Ze(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=pc(t,r),o=Date.now(),s=o-24*36e5;Rn(t,i,s,o,!0).then(a=>{this.dayCurves=fc(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ot(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}Uo().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Cn(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let m=0,d=0,g=0;for(let _ of h.rooms)for(let[b,y]of _.points)m+=b,d+=y,g++;a.push({kind:"house",at:{floorId:h.id,x:g?m/g:u.x,z:g?d/g:u.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}if(this.liveCardsOn&&!this.dimmed){a.push(...ou(s,t,this.floorId,this.roomId)),a.push(...su(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let m of t.floors)for(let d of m.furniture){if(!ot(d.type)||d.hydronic?.card===!1||this.floorId&&m.id!==this.floorId||!Ue(s,d))continue;let g=this.roomId?m.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([d.x,d.z],g.points))||a.push({kind:"hydronic",item:d,readOnly:!!this._travel,at:{floorId:m.id,x:d.x+(d.pin_offset?.x??0),z:d.z+(d.pin_offset?.z??0),y:oe(m,d)+d.h+.3+(d.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_,b)=>this.placeLhCard(m,d,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,c=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",u=this.shadowRoot?.activeElement,h=!!u&&s.contains(u),m=h||Ru(a,o,c);s.dataset.zoomKey=l,s.dataset.zoomVisible=m?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(h?110:Jo(a).priority),s.dataset.focused=h?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&m?"visible":"hidden",e===this._liveCards.length-1&&Mu(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`
    ${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}
    `}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,r=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card)||c.furniture.some(u=>u.power_card||ot(u.type)&&u.hydronic?.card!==!1))?this.renderCardToggle():f,s=this.roomNamesButton?p``:f;if(!r)return e.length||o!==f||s!==f?p`
    ${s}${e}${o}
    `:f;let a=c=>$(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:he(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:he(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:he(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?he(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:he(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${L(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let c of this.meterRows(this.building))l.push({cls:"meter",label:`${c.icon} ${c.label}`,value:c.value});return p`
    +
    `}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Ze(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};tc(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?Ce(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?q(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Ne(r,s):wt(r,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let h=e.energy[l],m=h?r?.states[h]:void 0;m&&!C(m)&&i.push({icon:c,label:$(r,u),value:se(r,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>$n(a,e,Sn(a,e),Ze(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=gc(t,r),o=Date.now(),s=o-24*36e5;zn(t,i,s,o,!0).then(a=>{this.dayCurves=_c(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ot(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}jo().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Nn(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let m=0,d=0,g=0;for(let _ of h.rooms)for(let[b,y]of _.points)m+=b,d+=y,g++;a.push({kind:"house",at:{floorId:h.id,x:g?m/g:u.x,z:g?d/g:u.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}if(this.liveCardsOn&&!this.dimmed){a.push(...au(s,t,this.floorId,this.roomId)),a.push(...lu(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let m of t.floors)for(let d of m.furniture){if(!ot(d.type)||d.hydronic?.card===!1||this.floorId&&m.id!==this.floorId||!Ue(s,d))continue;let g=this.roomId?m.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([d.x,d.z],g.points))||a.push({kind:"hydronic",item:d,readOnly:!!this._travel,at:{floorId:m.id,x:d.x+(d.pin_offset?.x??0),z:d.z+(d.pin_offset?.z??0),y:oe(m,d)+d.h+.3+(d.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_,b)=>this.placeLhCard(m,d,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,c=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",u=this.shadowRoot?.activeElement,h=!!u&&s.contains(u),m=h||Tu(a,o,c);s.dataset.zoomKey=l,s.dataset.zoomVisible=m?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(h?110:Qo(a).priority),s.dataset.focused=h?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&m?"visible":"hidden",e===this._liveCards.length-1&&Eu(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`
    ${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}
    `}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,r=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card)||c.furniture.some(u=>u.power_card||ot(u.type)&&u.hydronic?.card!==!1))?this.renderCardToggle():f,s=this.roomNamesButton?p``:f;if(!r)return e.length||o!==f||s!==f?p`
    ${s}${e}${o}
    `:f;let a=c=>$(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:he(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:he(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:he(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?he(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:he(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${L(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let c of this.meterRows(this.building))l.push({cls:"meter",label:`${c.icon} ${c.label}`,value:c.value});return p`
    ${s} ${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`
    ${c.label}${c.value}
    `)} ${this.flows!==null?f:p`
    `}renderCardToggle(){return this.holograms!==null?f:p``}utilityOverview(e){let t=this.building;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>Ce(this.hass,o,r).length||Bt(this.hass,o,r,!0).length)?p`{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p``,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(c=>pl(this.hass,c.person,[0])).map(c=>p`
    ${c.name||O(this.hass,c.person)}${le(this.hass.states[c.person])===null?"\u2013":le(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}
    `):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[Ou[c]||c,u]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p` - c.stopPropagation()}>
    Wetter
    ${o.map(([c,u])=>p`

    ${c}${Fe(this.hass.states[u])}${G(this.hass,[u],c)}

    `)}
    `:f,a=V(this.hass)?(this.building?.floors??[]).filter(c=>!this.floorId||c.id===this.floorId).map(c=>({floor:c,readings:Ce(this.hass,c,this.building?.floors.flatMap(u=>u.rooms))})).filter(c=>c.readings.length):[],l=a.length?p` + @utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p``,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(c=>fl(this.hass,c.person,[0])).map(c=>p`
    ${c.name||O(this.hass,c.person)}${le(this.hass.states[c.person])===null?"\u2013":le(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}
    `):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[Bu[c]||c,u]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p` + c.stopPropagation()}>
    Wetter
    ${o.map(([c,u])=>p`

    ${c}${De(this.hass.states[u])}${G(this.hass,[u],c)}

    `)}
    `:f,a=V(this.hass)?(this.building?.floors??[]).filter(c=>!this.floorId||c.id===this.floorId).map(c=>({floor:c,readings:Ce(this.hass,c,this.building?.floors.flatMap(u=>u.rooms))})).filter(c=>c.readings.length):[],l=a.length?p` c.stopPropagation()}>
    Stockwerkszähler
    ${a.map(({floor:c,readings:u})=>p`

    ${c.name}

    `)}
    `:f;return[t,e,...i,s,l,...r.filter(c=>this.hass.states[c]).map(c=>p`${G(this.hass,[c],O(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Vc(e)?p`${Io(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=vt(new Date,this.hass?.config?.latitude??50),t=Vr(this.heatMode,e),r=this.heatMode==="temperature",i=r?ce(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`
    + ${G(this.hass,[c],O(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Gc(e)?p`${Co(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=vt(new Date,this.hass?.config?.latitude??50),t=Kr(this.heatMode,e),r=this.heatMode==="temperature",i=r?ce(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`
    ${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` ${a(e?"heat_summer":"heat_winter")}`:f} - + ${L(this.hass,i,0)} ${s}${L(this.hass,o,0)} ${s} ${this.heatValues.size?f:p`${a("heat_none_found")}`} -
    `}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Zo(u.type)).map(u=>Yo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=xu(a);return p`
    +
    `}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Yo(u.type)).map(u=>Jo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Su(a);return p`
    📶 ${r("heat_wifi")} ${r("wifi_aps",{n:i.length,clients:s})} ${l.online+l.offline.length?p`${r("wifi_network",{online:l.online,offline:l.offline.length})}`:f} ${l.offline.length?p`${l.offline.slice(0,4).join(", ")}`:f} ${i.length?f:p`${r("wifi_none")}`} -
    `}skyColor(){let e=Tn[this.theme]??Tn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=Tn[this.theme]??Tn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+vc(this.building?.settings.backdrop);return p`
    `}skyColor(){let e=Fn[this.theme]??Fn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=Fn[this.theme]??Fn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+xc(this.building?.settings.backdrop);return p`
    - ${this._error?p`

    ${this._error}

    `:f} ${this.renderTopLeft()} ${Au(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()} + ${this._error?p`

    ${this._error}

    `:f} ${this.renderTopLeft()} ${Ru(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()} ${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()} ${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()} ${this.showStats&&this._stats?p`this.hass.states[r]?.attributes.symcon_path||this.hass.states ${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} · ${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:L(this.hass,this._stats.pixelRatio,2)})}`:f} -
    `}static styles=[ye,He,Eu,J` +
    `}static styles=[ye,He,zu,J` :host { display: block; position: relative; @@ -3449,26 +3449,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states inset: auto 16px 16px; color: var(--nf-danger); } - `]};customElements.get("nf-view3d")||customElements.define("nf-view3d",os);function he(n,e){return Math.abs(e)>=1e3?`${L(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function is(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function ng(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var ju;function qu(){let n=new URL("./nextfloor-editor.js?v=b2a26935cefb",new URL(import.meta.url)).href;return ju??=import(n),ju}var rg=.25,Zu=n=>Math.round(n*1e3)/1e3,Yu=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function as(n,e,t,r,i){let o=Yu(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function ig(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ue(ee(o,t),r))<.02&&Math.abs(ue(ee(a,t),r))<.02}))}var ss=(n,e)=>Math.abs((n-e+540)%360-180);function Ju(n,e,t,r=rg){let i=Yu(n,e.x,e.z);if(!i)return null;let o=i.points,s=gt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=qe(ee(u,l));if(h<.3)return;let m=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-m[1]*s,m[0]*s],g=ue(ee([e.x,e.z],l),m);if(g<0||g>h)return;let _=ig(n,i,l,d)?t/2:0,b=ue(ee([e.x,e.z],l),d)-_,y=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((z,R)=>ss(e.rotation,R.rotation)50)return;let M=b-k.extent;Math.abs(M)>r||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Zu(e.x-d[0]*M),z:Zu(e.z-d[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ui(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function di(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function Qu(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function Xu(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function ed(n,e,t,r){return di(n,e,(i,o)=>{[i.x,i.z]=as(o,i.x,i.z,t,r)})}function td(n,e,t,r){let i=n.settings.wall_interior??.12;return ui(n,e,(o,s)=>{[o.x,o.z]=as(s,o.x,o.z,t,r);let a=Ju(s,o,i);a&&Object.assign(o,a)})}var ls=(n,e)=>((n+e)%360+360)%360,nd=n=>Number.parseFloat(n.replace(",",".")),Kn=(n,e)=>Math.round(n*10**e)/10**e;function cs(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=nd(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p``}var sd=(n,e)=>p``,od=(n,e)=>p``;function lg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>us({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,c=>c[s]=Gn(l,3))}),o=da(r)?p`${us({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=Gn(s,3))})} + ${r.mount_y!=null?sd(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function cg(n,e){let t=n.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,c,u)=>p``,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Ht(i,xe(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f} - ${cs({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,c=>c.y=Kn(l,3))})} - ${r.y!==null?id(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function od(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`${o?ae(n.hass,o):""} - ${og(n,e)} ${rd(45,s=>n.turnFurniture(e,s))} + ${us({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,c=>c.y=Gn(l,3))})} + ${r.y!==null?sd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function ad(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`${o?ae(n.hass,o):""} + ${lg(n,e)} ${od(45,s=>n.turnFurniture(e,s))} `}else t?i=p`${O(n.hass,t)} - ${sg(n,t)} ${rd(45,o=>n.turnDevice(t,o))} - `:i=p`${r("furnish_hint")}`;return p`
    ${i}
    `}var sd=ne`${r("furnish_hint")}`;return p`
    ${i}
    `}var ld=ne``;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),en=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),us={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:en("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:en("markers",["none","important","all"],"important"),heat:en("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:en("theme",Jr,"neon"),clock:en("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:en("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function ad(n=mi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function ld(n=mi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function mi(){try{return localStorage}catch{return null}}var hi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(us)){let i=us[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=us[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var cd=J` +`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),en=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),ds={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:en("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:en("markers",["none","important","all"],"important"),heat:en("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:en("theme",Qr,"neon"),clock:en("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:en("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function cd(n=pi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function ud(n=pi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function pi(){try{return localStorage}catch{return null}}var mi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(ds)){let i=ds[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=ds[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var dd=J` .nf-dot { display: inline-block; width: 8px; @@ -3960,11 +3960,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states gap: 12px; margin: auto; } -`;var ud=new WeakMap,dd=new WeakMap;function St(n,e){let t=dd.get(n)??n,r=ud.get(t)??new WeakMap;ud.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Be(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},m=Pt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(h.current_position=m);let d=c.tilt?t.states[c.tilt]:u,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?Pt(t,c.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=u.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,c,{...u,entity_id:d});let _={...u,entity_id:d},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(h.map(m)):m(h[0])}};return dd.set(a,t),r.set(e,a),a}var ds=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Ft(this);store=new hi(mi());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:ft(Et(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p` +`;var hd=new WeakMap,md=new WeakMap;function St(n,e){let t=md.get(n)??n,r=hd.get(t)??new WeakMap;hd.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Be(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},m=Pt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(h.current_position=m);let d=c.tilt?t.states[c.tilt]:u,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?Pt(t,c.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=u.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,c,{...u,entity_id:d});let _={...u,entity_id:d},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(h.map(m)):m(h[0])}};return md.set(a,t),r.set(e,a),a}var hs=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Dt(this);store=new mi(pi());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:ft(Et(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p` ${t!==null?p``:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Tr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=_n(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>ui(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>di(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>ui(r,e,i=>i.rotation=ls(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>di(r,e,i=>i.rotation=ls(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Qu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Xu(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&$r(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),p`
    + />`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Fr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=_n(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>di(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>hi(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>di(r,e,i=>i.rotation=cs(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>hi(r,e,i=>i.rotation=cs(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>ed(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>td(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&Mr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),p`
    ${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`} ${this.data.error&&!e?p`

    ${this.t("load_error")}: ${this.data.error}

    `:f} ${!e&&!this.data.error?p`

    ${this.t("loading")}

    `:f} @@ -3977,7 +3977,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states `}renderViewOptions(){let e=this._prefs;return p`
    ${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))} - ${this.choiceRow("theme",Jr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())} + ${this.choiceRow("theme",Qr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())} ${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
    `}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>p``,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return p`
    -

    ${sd}${t}

    +

    ${ld}${t}

    ${this.isAdmin?p`
    ${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}
    `:f} ${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p``:f} @@ -4031,7 +4031,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${this.t("draft_found",{time:r})} -
    `)}return t.length>0?p`
    ${t}
    `:f}whenEditorLoaded(e){return this._editorReady?e():(qu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`

    ${this.t("loading")}

    `)}renderExtensions(){return this.whenEditorLoaded(()=>p``)}return t.length>0?p`
    ${t}
    `:f}whenEditorLoaded(e){return this._editorReady?e():(Yu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`

    ${this.t("loading")}

    `)}renderExtensions(){return this.whenEditorLoaded(()=>p`{this.data.reloadPacks()}} @plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`this.hass.states[r]?.attributes.symcon_path||this.hass.states .roomLabels=${this._prefs.roomNames} @room-names-change=${t=>this.setPref("roomNames",t.detail.value)} .packs=${this.data.packs} - .loadCardEditor=${Yn} + .loadCardEditor=${Jn} @packs-changed=${()=>{this.data.reloadPacks()}} @building-changed=${t=>this.data.edit(t.detail.building)} - >`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p``}let r=En(dc(t).map(i=>this.hass.states[i]));return r.count<2?f:p``}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p``:f,s=r?p` + >`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p``}let r=Rn(mc(t).map(i=>this.hass.states[i]));return r.count<2?f:p``}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p``:f,s=r?p` ${[...e.floors].reverse().map(c=>p``)} ${o} ${this.allOffChip(e)} `:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`${c.name}`:f,...c.rooms.map(u=>p``)}
    `;return p`
    +`;function ms(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function _d(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));r.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var tn="nf-outside",ps=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Dt(this);kiosk=new fi({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Jn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=ms(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Un(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=ms(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Fr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Un(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:_d(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),r=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`
    ${a.map(([l,c,u])=>p``)}
    `;return p`
    ${e.canGoBack?p``:f} ${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f} ${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,r("floors_apart")],[!e.explode,()=>this._explode=!1,r("floors_stacked")]]):f} ${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f} -
    `}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=md(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=_n(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===tn?null:tn};return p`
    +
    `}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=fd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=_n(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===tn?null:tn};return p`
    ${r.map(l=>p`${i?p`${l.floorName}`:f}${l.rooms.map(c=>p``)}`)} ${s?p``:f}
    `}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!r?p``:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return p`this.hass.states[r]?.attributes.symcon_path||this.hass.states .zoom=${typeof r?.zoom=="number"?r.zoom:1} .buttons=${r?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null} .heatMode=${e.heat} - .theme=${Qr(r?.theme,this.hass?.states["sun.sun"]?.state)} + .theme=${Xr(r?.theme,this.hass?.states["sun.sun"]?.state)} .clock=${r?.clock&&r.clock!=="none"?r.clock:null} .lockButton=${r?.lock_button!==!1} .walkButton=${r?.walk_button!==!1} @@ -4340,10 +4340,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states .panelOpen=${!!this._roomId&&r?.room_panel!==!1} .alerts=${r?.alerts!==!1} .alertJump=${!!r?.alert_jump} - .announcements=${!V(this.hass)&&r?.announcements!==!1&&!ld()} + .announcements=${!V(this.hass)&&r?.announcements!==!1&&!ud()} .sensorBar=${r?.sensor_bar!==!1} .glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null} - .screenName=${r?.screen_name??ad()} + .screenName=${r?.screen_name??cd()} .scenes=${r?.scenes!==!1} .clean=${this._clean} .cleanButton=${o} @@ -4368,7 +4368,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states .confirmEntities=${bt(this.hass,e.floors)} .phrases=${e.settings.announce_phrases??null} @close=${()=>this._roomId=null} - >`}render(){if(this.hass&&$r(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p` + >`}render(){if(this.hass&&Mr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`
    ${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):p`

    ${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}

    `} ${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f} @@ -4376,7 +4376,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${r.showBar&&e?this.renderBar(r):f} ${this.renderCorners()}
    -
    `}static styles=[ye,He,pd,zr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",ms);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Hi();var lg="nextfloor-chunks-v1";async function ps(n,e,t){let r=await fetch(`${n.endpoint}/api?token=${encodeURIComponent(n.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:lg})}),i=await r.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${r.status}).`)}if(!r.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${r.status}`;throw new Error(String(s))}return o}async function nn(n,e,t={}){let r=await ps(n,e,t);if(!("_nextfloor_transfer"in r))return r;let i=r._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;au.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await ps(n,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function cg(){let n=window.__NEXTFLOOR_SYMCON__;if(!n?.endpoint||!n.token)throw new Error("NextFloor Symcon host configuration is missing");return n}var fi=class{settings=cg();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let r=i=>e({revision:i});return this.buildingListeners.add(r),async()=>{this.buildingListeners.delete(r)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,r)=>this.callService(e,t,r),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await nn(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await nn(this.settings,"bootstrap"):await nn(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let r of this.changeListeners)r()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let r of this.buildingListeners)r(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let r of["light","cover"]){let i=xa(t,r);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.states[i.entity_id]=i,this.entities[i.entity_id]={...this.entities[t.entity_id],entity_id:i.entity_id,hidden:!0})}if(e.areas&&(this.areas=Object.fromEntries(e.areas.map(t=>[t.area_id,t]))),this.facade.states=this.states,this.facade.entities=this.entities,this.facade.areas=this.areas,e.objects){let t=JSON.stringify(e.objects);t!==this.objectsSignature&&(this.facade.symconObjects=e.objects,this.objectsSignature=t)}}async callWS(e){let t=String(e.type??"");if(!t.startsWith("nextfloor/"))throw new Error(`Unsupported Symcon websocket command: ${t}`);let{type:r,...i}=e;return nn(this.settings,t.slice(10),i)}async callService(e,t,r={}){return nn(this.settings,"variables/action",{domain:e,service:t,data:r})}fetchWithToken(e,t={}){let r=new URL(e,window.location.origin);return r.searchParams.set("token",this.settings.token),fetch(r,{...t,credentials:"same-origin"})}};function ug(){return new URLSearchParams(window.location.search).get("mode")==="tile"?"tile":"designer"}async function dg(){let n=new fi,e=await n.start(),t=ug()==="tile",r=t?document.createElement("nextfloor-card"):document.createElement("nextfloor-panel");r.className=t?"nf-symcon-tile":"nf-symcon-designer",r.hass=e,t?r.setConfig({type:"custom:nextfloor-card",fill:!0,room_buttons:!0,controls:!0,weather:!1,announcements:!1}):r.narrow=!1,document.body.replaceChildren(r),n.onChange(()=>{r.hass=n.snapshot()}),window.addEventListener("pagehide",()=>n.stop(),{once:!0})}dg().catch(n=>{document.body.textContent=`NextFloor konnte nicht geladen werden: ${n instanceof Error?n.message:String(n)}`}); +
    `}static styles=[ye,He,gd,Tr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",ps);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Pi();var dg="nextfloor-chunks-v1";async function fs(n,e,t){let r=await fetch(`${n.endpoint}/api?token=${encodeURIComponent(n.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:dg})}),i=await r.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${r.status}).`)}if(!r.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${r.status}`;throw new Error(String(s))}return o}async function nn(n,e,t={}){let r=await fs(n,e,t);if(!("_nextfloor_transfer"in r))return r;let i=r._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;au.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await fs(n,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function hg(){let n=window.__NEXTFLOOR_SYMCON__;if(!n?.endpoint||!n.token)throw new Error("NextFloor Symcon host configuration is missing");return n}var gi=class{settings=hg();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let r=i=>e({revision:i});return this.buildingListeners.add(r),async()=>{this.buildingListeners.delete(r)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,r)=>this.callService(e,t,r),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await nn(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await nn(this.settings,"bootstrap"):await nn(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let r of this.changeListeners)r()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let r of this.buildingListeners)r(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let r of["light","cover"]){let i=ka(t,r);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.states[i.entity_id]=i,this.entities[i.entity_id]={...this.entities[t.entity_id],entity_id:i.entity_id,hidden:!0})}if(e.areas&&(this.areas=Object.fromEntries(e.areas.map(t=>[t.area_id,t]))),this.facade.states=this.states,this.facade.entities=this.entities,this.facade.areas=this.areas,e.objects){let t=JSON.stringify(e.objects);t!==this.objectsSignature&&(this.facade.symconObjects=e.objects,this.objectsSignature=t)}}async callWS(e){let t=String(e.type??"");if(!t.startsWith("nextfloor/"))throw new Error(`Unsupported Symcon websocket command: ${t}`);let{type:r,...i}=e;return nn(this.settings,t.slice(10),i)}async callService(e,t,r={}){return nn(this.settings,"variables/action",{domain:e,service:t,data:r})}fetchWithToken(e,t={}){let r=new URL(e,window.location.origin);return r.searchParams.set("token",this.settings.token),fetch(r,{...t,credentials:"same-origin"})}};function mg(){return new URLSearchParams(window.location.search).get("mode")==="tile"?"tile":"designer"}async function pg(){let n=new gi,e=await n.start(),t=mg()==="tile",r=t?document.createElement("nextfloor-card"):document.createElement("nextfloor-panel");r.className=t?"nf-symcon-tile":"nf-symcon-designer",r.hass=e,t?r.setConfig({type:"custom:nextfloor-card",fill:!0,room_buttons:!0,controls:!0,weather:!1,announcements:!1}):r.narrow=!1,document.body.replaceChildren(r),n.onChange(()=>{r.hass=n.snapshot()}),window.addEventListener("pagehide",()=>n.stop(),{once:!0})}pg().catch(n=>{document.body.textContent=`NextFloor konnte nicht geladen werden: ${n instanceof Error?n.message:String(n)}`}); /*! Bundled license information: @lit/reactive-element/css-tag.js: diff --git a/NextFloor/assets/nextfloor-editor.js b/NextFloor/assets/nextfloor-editor.js index 296ccc2..2cb5d03 100644 --- a/NextFloor/assets/nextfloor-editor.js +++ b/NextFloor/assets/nextfloor-editor.js @@ -1,7 +1,7 @@ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ -var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var Pi=globalThis,Di=Pi.ShadowRoot&&(Pi.ShadyCSS===void 0||Pi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vs=Symbol(),wc=new WeakMap,vr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==vs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(Di&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=wc.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&wc.set(n,e))}return e}toString(){return this.cssText}},kc=t=>new vr(typeof t=="string"?t:t+"",void 0,vs),ee=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new vr(n,t,vs)},xc=(t,e)=>{if(Di)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),i=Pi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}},ws=Di?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return kc(n)})(t):t;var{is:cb,defineProperty:ub,getOwnPropertyDescriptor:db,getOwnPropertyNames:hb,getOwnPropertySymbols:pb,getPrototypeOf:fb}=Object,Ii=globalThis,$c=Ii.trustedTypes,mb=$c?$c.emptyScript:"",gb=Ii.reactiveElementPolyfillSupport,wr=(t,e)=>t,ks={toAttribute(t,e){switch(e){case Boolean:t=t?mb:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Mc=(t,e)=>!cb(t,e),Sc={attribute:!0,type:String,converter:ks,reflect:!1,useDefault:!1,hasChanged:Mc};Symbol.metadata??=Symbol("metadata"),Ii.litPropertyMetadata??=new WeakMap;var bt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=Sc){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,n);i!==void 0&&ub(this.prototype,e,i)}}static getPropertyDescriptor(e,n,r){let{get:i,set:o}=db(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:i,set(s){let l=i?.call(this);o?.call(this,s),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Sc}static _$Ei(){if(this.hasOwnProperty(wr("elementProperties")))return;let e=fb(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wr("properties"))){let n=this.properties,r=[...hb(n),...pb(n)];for(let i of r)this.createProperty(i,n[i])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,i]of n)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let i=this._$Eu(n,r);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)n.unshift(ws(i))}else e!==void 0&&n.push(ws(e));return n}static _$Eu(e,n){let r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xc(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,n,r){this._$AK(e,r)}_$ET(e,n){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ks).toAttribute(n,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,n){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ks;this._$Em=i;let l=s.fromAttribute(n,o.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(e,n,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??Mc)(o,n)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,n,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??n??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(n=void 0),this._$AL.set(e,n)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,l=this[i];s!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,o,l)}}let e=!1,n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(n)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(n)}willUpdate(e){}_$AE(e){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(e){}firstUpdated(e){}};bt.elementStyles=[],bt.shadowRootOptions={mode:"open"},bt[wr("elementProperties")]=new Map,bt[wr("finalized")]=new Map,gb?.({ReactiveElement:bt}),(Ii.reactiveElementVersions??=[]).push("2.1.2");var $s=globalThis,Rc=t=>t,Oi=$s.trustedTypes,Ec=Oi?Oi.createPolicy("lit-html",{createHTML:t=>t}):void 0,Ss="$lit$",yt=`lit$${Math.random().toFixed(9).slice(2)}$`,Ms="?"+yt,_b=`<${Ms}>`,en=document,xr=()=>en.createComment(""),$r=t=>t===null||typeof t!="object"&&typeof t!="function",Rs=Array.isArray,Dc=t=>Rs(t)||typeof t?.[Symbol.iterator]=="function",xs=`[ -\f\r]`,kr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ac=/-->/g,Fc=/>/g,Jt=RegExp(`>|${xs}(?:([^\\s"'>=/]+)(${xs}*=${xs}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),Tc=/'/g,zc=/"/g,Ic=/^(?:script|style|textarea|title)$/i,Es=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=Es(1),R=Es(2),Jx=Es(3),tt=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Pc=new WeakMap,Qt=en.createTreeWalker(en,129);function Oc(t,e){if(!Rs(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ec!==void 0?Ec.createHTML(e):e}var Hc=(t,e)=>{let n=t.length-1,r=[],i,o=e===2?"":e===3?"":"",s=kr;for(let l=0;l"?(s=i??kr,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Jt:u[3]==='"'?zc:Tc):s===zc||s===Tc?s=Jt:s===Ac||s===Fc?s=kr:(s=Jt,i=void 0);let h=s===Jt&&t[l+1].startsWith("/>")?" ":"";o+=s===kr?a+_b:d>=0?(r.push(c),a.slice(0,d)+Ss+a.slice(d)+yt+h):a+yt+(d===-2?l:h)}return[Oc(t,o+(t[n]||"")+(e===2?"":e===3?"":"")),r]},Sr=class t{constructor({strings:e,_$litType$:n},r){let i;this.parts=[];let o=0,s=0,l=e.length-1,a=this.parts,[c,u]=Hc(e,n);if(this.el=t.createElement(c,r),Qt.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=Qt.nextNode())!==null&&a.length0){i.textContent=Oi?Oi.emptyScript:"";for(let h=0;h2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_}_$AI(e,n=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=tn(this,e,n,0),s=!$r(e)||e!==this._$AH&&e!==tt,s&&(this._$AH=e);else{let l=e,a,c;for(e=o[0],a=0;a{let r=n?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=n?.renderBefore??null;r._$litPart$=i=new Rn(e.insertBefore(xr(),o),o,void 0,n??{})}return i._$AI(t),i};var As=globalThis,Y=class extends bt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Cc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tt}};Y._$litElement$=!0,Y.finalized=!0,As.litElementHydrateSupport?.({LitElement:Y});var yb=As.litElementPolyfillSupport;yb?.({LitElement:Y});(As.litElementVersions??=[]).push("4.2.2");var Ts=t=>t.slice(0,t.indexOf(".")),vb={light:"light",switch:"switch",input_boolean:"switch",valve:"switch",fan:"fan",cover:"cover",climate:"climate",media_player:"media",lock:"lock",sensor:"sensor",binary_sensor:"binary",event:"sensor",scene:"scene",script:"script"},Q=t=>vb[Ts(t)]??null,zs=["light","cover","climate","media","switch","fan","lock","binary","sensor","scene","script"];var Nc=new Set(["light","switch","fan"]),Ft=t=>t!==null&&t!=="scene"&&t!=="script",Ie=t=>!t||t.state==="unavailable"||t.state==="unknown"&&!t.entity_id.startsWith("event.");function B(t,e,n){let r=String(t?.states[e]?.attributes.friendly_name??t?.entities?.[e]?.name??e);if(!n||r.length<=n.length+1||!r.toLowerCase().startsWith(`${n.toLowerCase()} `))return r;let i=r.slice(n.length+1);return i[0].toUpperCase()+i.slice(1)}var Bc=t=>!!t&&t.entity_id.startsWith("sensor.")&&t.attributes.device_class==="enum";var Wc=t=>Math.min(1,Math.max(0,t));function wb(t){let e=Wc((t-2200)/4300),n=[1,.66,.26],r=[.78,.9,1];return[0,1,2].map(i=>n[i]+(r[i]-n[i])*e)}function Fs(t,e){if(!t||t.state!=="on")return null;let n=e&&!["unavailable","unknown"].includes(e.state)?e.attributes:t.attributes,r=typeof n.brightness=="number"?.2+.8*Math.sqrt(Wc(n.brightness/255)):1,i=n.rgb_color;return i&&!["color_temp","brightness","onoff"].includes(String(n.color_mode))?{color:[i[0]/255,i[1]/255,i[2]/255],level:r}:typeof n.color_temp_kelvin=="number"?{color:wb(n.color_temp_kelvin),level:r}:{color:[1,.71,.28],level:r}}function Vc(t,e,n){let r=Fs(t,n);if(r)return r;for(let i of e){let o=Fs(i);if(o)return{color:o.color,level:o.level*.6}}return null}function Wi(t,e,n=null){if(t==="light"&&n==="floor")return 1.95;if(t==="light"&&n==="table")return 1.25;if(t==="light"&&n==="wall")return 1.95;switch(t){case"light":return Math.max(.5,e-.25);case"cover":return Math.min(2,e-.3);case"climate":return .6;case"media":return .9;case"binary":case"sensor":return 1.4;default:return 1.05}}var Gc=[],Vi=new Map,kb=0,he=(t,e)=>`pack:${t}:${e}`,vt=t=>t.startsWith("pack:");function Ps(t){Gc=t,Vi=new Map;for(let e of t)for(let n of e.items)Vi.set(he(e.id,n.id),n);kb+=1}var Rr=()=>Gc;var xb={};function G(t){if(!vt(t))return;let e=Vi.get(t);if(e)return e;let[,n,...r]=t.split(":"),i=xb[n];return i?Vi.get(he(i,r.join(":"))):void 0}var $b=.22;function Kc(t,e,n,r){let i=Math.min($b,n/3);if(r<=i*2.4||Math.abs(r-n)<1e-6)return e*(r/n)+(t-e)*(r/n);let o=e*(r/n),s=t-e;return s<=i?o+s:s>=n-i?o+r-(n-s):o+i+(s-i)*(r-2*i)/(n-2*i)}function Mr(t,e,n,r,i){return[Kc(t*r,n*r,r,i)/i,Kc(e*r,n*r,r,i)/i]}var jc=new WeakMap;function Zc(t,e,n,r){let[i,o,s]=t.size;if(t.vehicle||t.stretch||Math.abs(e-i)<1e-4&&Math.abs(n-o)<1e-4&&Math.abs(r-s)<1e-4)return t.parts;let l=`${e.toFixed(4)}|${n.toFixed(4)}|${r.toFixed(4)}`,a=jc.get(t),c=a?.get(l);if(c)return c;let u=t.parts.map(d=>{if(d.shape==="sweep")return d;let[p,h]=Mr(d.x-d.w/2,d.x+d.w/2,-.5,i,e),[f,g]=Mr(d.z-d.d/2,d.z+d.d/2,-.5,o,n),[b,y]=Mr(d.y,d.y+d.h,0,s,r);if(d.rot)return{...d,x:(p+h)/2,z:(f+g)/2,w:d.w*i/e,d:d.d*o/n,y:b,h:y-b};let v={...d,x:(p+h)/2,z:(f+g)/2,w:h-p,d:g-f,y:b,h:y-b};if(d.shape==="loft"){let[w,x,k,M]=[d.tx??d.x,d.tz??d.z,d.tw??d.w,d.td??d.d],[A,T]=Mr(w-k/2,w+k/2,-.5,i,e),[F,L]=Mr(x-M/2,x+M/2,-.5,o,n);Object.assign(v,{tx:(A+T)/2,tz:(F+L)/2,tw:T-A,td:L-F})}return v});return a||jc.set(t,a=new Map),a.size>32&&a.clear(),a.set(l,u),u}var Ds=t=>!!t?.parts.some(e=>e.move);var qc=t=>G(t)?.parts.find(e=>e.screen),Uc=.06;function Yc(t){let e=G(t);if(!e)return!1;let[n,r,i]=e.size;return e.parts.filter(o=>o.screen).some(o=>{let[s,l]=[o.w*n,o.d*r,o.h*i].sort((a,c)=>c-a);return l>=Uc&&s>=Uc})}function dt(t){return nt[t]??G(t)?.size??[.6,.6,.8]}function Tt(t){let e=G(t);return iu.has(t)||!!e?.electric||!!e?.light||!!e?.climate}var Xc=t=>!!G(t)?.parts.some(e=>e.picture),En=t=>!!G(t)?.climate;function Jc(t,e){return t.name[e.split("-")[0]]??t.name.en??Object.values(t.name)[0]??t.id}var Sb={wohnen:"Living & Pets",kino:"Home Cinema & Gaming",kueche:"Kitchen Extras",bad:"Bathroom Extras",schlafen:"Bedroom & Kids",technik:"Office & Homelab",energie:"Energy & Building Services",garten:"Garden & Terrace (older)",fitness:"Fitness (older)",fahrzeuge:"Vehicles",ikea:"IKEA sizes",treppen:"Stairs & railings",ausbau:"Architecture & fit-out",werkstatt:"Garage & workshop",a_wohnzimmer:"Living room",a_schlafzimmer:"Bedroom",a_kueche:"Kitchen",a_bad:"Bathroom",a_kinderzimmer:"Kids' room",a_buero:"Office & gaming",a_fitness:"Fitness",a_haustiere:"Pets",a_garten:"Garden & patio",a_kino:"Home cinema & hi-fi",a_smart:"Smart home & tech",a_haustechnik:"Utility & building services",a_saison:"Season & decoration",a_smart2:"Smart home 2",a_haustechnik2:"Building services 2",a_wellness:"Wellness",a_garten2:"Garden 2",a_kueche2:"Kitchen 2",a_fahrzeuge2:"Vehicles 2",a_aussenkueche:"Outdoor kitchen & terrace",a_werkstatt2:"Workshop 2",a_japandi:"Japandi & Scandi",a_loft:"Loft & industrial",a_gruen:"Indoor greenery",a_musik:"Music & studio",a_bilder:"Pictures & frames"};function Qc(t,e){if(e.split("-")[0]==="de")return t.name;let n=/^nextfloor\.(.+)$/.exec(t.id)?.[1];return n&&Sb[n]||t.name}function zt(t,e){return e.mount_y!=null?e.mount_y:Rb(t,e)+(Mb(e)?0:nu(t,e.x,e.z))}var Mb=t=>t.type==="led_strip"||G(t.type)?.mount==="ceiling";function Rb(t,e){if(e.type==="lamp_wall")return eu;if(e.type==="led_strip")return Math.max(0,ht(t,e.x,e.z)-.04-Math.max(.02,e.h));let n=G(e.type);if(!n)return tu(e);switch(n.mount){case"surface":return ru(t,e.x,e.z);case"wall":return n.wall_y??1;case"ceiling":return Math.max(0,Ki(t,e)-e.h);default:return 0}}function Is(t){if(t==="plant")return"plant";let e=G(t);return e?e.household?e.household:/monstera|plant|herb_garden|flower_pots|bonsai|ficus|cactus|kaktus/.test(e.id)?"plant":null:null}var wt=["electricity","water","gas","heating","cooling"],ou=["condition","temperature","humidity","pressure","wind_speed","wind_gust_speed","wind_bearing","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility","snow","fog","lightning"],su=["turn","slide","top"],au=["always","active","no_power","never"],lu=1.3,ji=(t,e=new Date().toISOString().slice(0,10))=>!!t.due&&t.due<=e,cu=["gable","hip","halfhip","pyramid","mansard","pent","flat","parapet"],uu=["brick","round","wide","steel"],Ui=["navigate","more_info","service","fire_dom_event"];function Gi(t,e,n){return t?e?!!n.lock_plan:!!t.locked:!1}var du=["rain","snow","fog","clouds","lightning","sky"],hu=["rain","snow","clouds","lightning","sky"],pu=["lawn","terrace","path","driveway","pool","bed","wild","hedge","fence","pergola"],Os={lawn:.012,terrace:.12,path:.02,driveway:.02,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function Hs(t){return t==="hedge"||t==="fence"||t==="pergola"}var fu=["x","-x","z","-z"];function Eb(t,e,n){let r=t.slope??0;if(!r||t.type==="pool")return 0;let i=t.slope_dir??"x",o=(c,u)=>i==="x"?c:i==="-x"?-c:i==="z"?u:-u,s=1/0,l=-1/0;for(let[c,u]of t.points){let d=o(c,u);s=Math.min(s,d),l=Math.max(l,d)}if(l-s<1e-6)return 0;let a=Math.min(1,Math.max(0,(o(e,n)-s)/(l-s)));return r*a}function Ab(t,e,n,r){return mu(t)+(e.offset??0)+Os[e.type]-Eb(e,n,r)}function mu(t){return t.elevation>.3?0:-.2}function gu(t,e,n){let r=(t.outdoor??[]).filter(o=>!Hs(o.type)&&o.type!=="pool"&&C([e,n],o.points)),i=[...r].reverse().find(o=>o.cut)??r[0];return i?Ab(t,i,e,n):mu(t)}var _u=t=>t.cut??t.type==="pool",bu=30,yu={meter:null,grid:null,grid_invert:!1,solar:null,battery:null,battery_invert:!1,battery_soc:null,consumption:null,tariff:null},vu=["wood","oak","tiles","carpet","stone","concrete"],wu={type:"none",pitch:35,overhang:.4},Zi="#d6cfc2",qi="#e8e3da",ku={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...wu}};function Pt(){return{version:1,floors:[],settings:{...ku},energy:{...yu},presence:[]}}function Ve(t,e,n){return{id:t,name:e,elevation:n,height:2.5,cut_height:1.15,rooms:[],openings:[],furniture:[],placements:[],background:null,outdoor:[],walls:[],ha_floor:null}}var Fb=2.75;function xu(t,e){if(e!=null&&Number.isFinite(e))return Math.round(e*Fb*100)/100;let n=t.reduce((r,i)=>!r||i.elevation>r.elevation?i:r,null);return n?Math.round((n.elevation+n.height+.25)*100)/100:0}function $u(t,e,n){let r=t.rooms.flatMap(l=>l.points.map(a=>a[0])),i=t.rooms.flatMap(l=>l.points.map(a=>a[1])),o=r.length?Math.ceil(Math.max(...r))+1:0,s=i.length?Math.floor(Math.min(...i)):0;return e.map((l,a)=>{let c=o+a%3*4.5,u=s+Math.floor(a/3)*3.5;return{id:n(),name:l.name,area_id:l.area_id,points:[[c,u],[c+4,u],[c+4,u+3],[c,u+3]],floor_material:"wood"}})}function Su(t,e,n,r){let i=t.rotation*Math.PI/180,o=Math.cos(i),s=Math.sin(i),[l,a]=e,c=t.x-l*(t.w/2)*o+a*(t.d/2)*s,u=t.z-l*(t.w/2)*s-a*(t.d/2)*o,d=n[0]-c,p=n[1]-u,h=y=>Math.max(.1,Math.round(y/r)*r),f=h((d*o+p*s)*l),g=h((-d*s+p*o)*a),b=y=>Math.round(y*1e3)/1e3;return{x:b(c+l*(f/2)*o-a*(g/2)*s),z:b(u+l*(f/2)*s+a*(g/2)*o),w:b(f),d:b(g)}}var Yi=["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_table","lamp_wall","led_strip","lamp_uplight","lamp_bollard","lamp_garden","radiator","sofa","armchair","stool","coffee_table","tv_board","tv_wall","sideboard","shelf","plant","rug","table","table_round","chair","bench","corner_bench","bar_stool","kitchen","kitchen_wall","kitchen_tall","island","worktop","sink","stove","dishwasher","fridge","bed","bunk_bed","nightstand","wardrobe","dresser","bathtub","shower","wc","washbasin","washer","dryer","desk","office_chair","tall_cabinet","coat_rack","stairs","robot_vacuum","inverter","home_battery","wallbox","meter","grid_point","parking","fridge_smart","heating_manifold","buffer_tank","freshwater_station","stairwell"],Mu={lights:["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"],living:["sofa","armchair","stool","coffee_table","tv_board","tv_wall","sideboard","shelf","plant","rug"],dining:["table","table_round","chair","bench","corner_bench","bar_stool"],kitchen:["kitchen","kitchen_wall","kitchen_tall","island","worktop","sink","stove","dishwasher","fridge"],sleeping:["bed","bunk_bed","nightstand","wardrobe","dresser"],bath:["bathtub","shower","wc","washbasin","washer","dryer"],work:["desk","worktop","office_chair","tall_cabinet","coat_rack","radiator","stairs","robot_vacuum","heating_manifold","buffer_tank","freshwater_station"],vehicles:["parking"]},Ke=["meter","inverter","home_battery","wallbox","grid_point"],Ru=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),eu=1.75;function Xi(t){return Ls.has(t.type)||["stairwell","parking"].includes(t.type)?!1:G(t.type)?.mount!=="ceiling"}function ue(t){return Ru.has(t)||!!G(t)?.light}var Tb=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function Eu(t,e,n,r=0){let i=de(t.points),o=i.x1-i.x0-2*r,s=i.z1-i.z0-2*r,l=[];for(let a=0;aMath.round(s*1e3)/1e3,[i,o]={right:[1,0],down:[0,1],left:[-1,0],up:[0,-1]}[n];return[r(t[0]+i*e),r(t[1]+o*e)]}function tu(t){switch(t.type){case"home_battery":return t.variant==="wall"?.5:0;case"kitchen_wall":return 1.45;case"tv_wall":return Math.max(0,1.3-t.h/2);case"radiator":return .12;case"inverter":return 1.1;case"wallbox":return 1;case"meter":return .4;default:return 0}}var Ls=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan"]);function Au(t,e){return t.filter(n=>n.elevationn.rooms.filter(r=>r.points.length>=3&&r.ceiling!=null&&r.ceiling>n.height+.005&&n.elevation+r.ceiling>e.elevation+.05)).map(n=>n.points)}var Cs=t=>t?.floor_offset&&Number.isFinite(t.floor_offset)?t.floor_offset:0;function nu(t,e,n){let r=t.rooms.find(i=>i.points.length>=3&&i.floor_offset&&C([e,n],i.points));return Cs(r)}function ht(t,e,n){let r=t.rooms.find(i=>i.points.length>=3&&C([e,n],i.points));return r?.ceiling!=null&&r.ceiling>0?r.ceiling:t.height}var Ki=(t,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:ht(t,e.x,e.z);function ru(t,e,n){let r=0;for(let i of t.furniture)!(Tb.has(i.type)||G(i.type)?.surface)||!C([e,n],Vs(i))||(r=Math.max(r,i.h));return r}var iu=new Set([...Ru,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]),nt={sofa:[2.2,.9,.82],armchair:[.85,.85,.8],table:[1.6,.9,.75],chair:[.46,.5,.9],bed:[1.6,2.05,.9],nightstand:[.45,.4,.5],wardrobe:[1.8,.6,2.1],shelf:[.9,.35,1.9],kitchen:[2.4,.62,.92],worktop:[1.2,.62,.91],inverter:[.5,.2,.65],home_battery:[.6,.25,1.1],wallbox:[.3,.15,.42],heating_manifold:[1.5,.35,1.1],buffer_tank:[.85,.85,1.85],freshwater_station:[.65,.28,.9],meter:[.55,.21,1.1],grid_point:[.4,.22,.6],fridge:[.6,.65,1.8],fridge_smart:[.91,.73,1.78],stairwell:[1,2.6,.02],stove:[.6,.62,.92],sink:[.9,.62,.92],bathtub:[1.7,.75,.58],shower:[.9,.9,2],wc:[.38,.6,.8],washbasin:[.6,.46,.85],desk:[1.4,.7,.75],tv_board:[1.8,.42,.5],plant:[.45,.45,1.1],rug:[2,1.4,.01],stairs:[1,3.2,2.75],stool:[.55,.55,.42],lamp_ceiling:[.4,.4,.08],lamp_downlight:[.1,.1,.02],lamp_spot:[.1,.1,.14],lamp_panel:[.6,.6,.03],lamp_uplight:[.35,.35,1.8],lamp_bollard:[.16,.16,.8],lamp_garden:[.12,.12,.3],radiator:[1,.1,.6],robot_vacuum:[.36,.5,.1],parking:[2.6,5.2,.02],lamp_pendant:[.4,.4,.8],ceiling_fan:[1.32,1.32,.32],lamp_floor:[.4,.4,1.7],lamp_table:[.28,.28,.45],lamp_wall:[.22,.12,.2],led_strip:[2,.04,.03],coffee_table:[1.1,.6,.42],tv_wall:[1.3,.08,.75],sideboard:[1.6,.45,.8],table_round:[1.1,1.1,.75],bench:[1.4,.45,.85],corner_bench:[2,1.6,.9],bar_stool:[.42,.42,.75],kitchen_wall:[.8,.35,.7],kitchen_tall:[.6,.62,2.1],island:[1.8,.9,.92],dishwasher:[.6,.62,.92],bunk_bed:[1,2.05,1.65],dresser:[1,.5,.9],washer:[.6,.6,.85],dryer:[.6,.6,.85],office_chair:[.65,.65,1.1],tall_cabinet:[.6,.6,2.1],coat_rack:[1,.35,1.9]};var Ns=["interior","front","front_glass","sidelight","sidelights","glass","sliding","passage"],Bs=["standard","bars","glass_wall"],Ji=new Set(["interior","front"]);function rn(t,e){return t.type==="door"?t.style&&Ns.includes(t.style)?t.style:e?"front":"interior":t.style&&Bs.includes(t.style)?t.style:"standard"}function Fu(t,e,n,r){if(e!=="sidelight"&&e!=="sidelights")return null;let i=e==="sidelights",o=t-.04,s=Math.min(1.05,Math.max(.6,o-(i?.6:.3))),l=(o-s)/(i?2:1),a=r.sidelight_width??l,c=i?r.sidelight_width2??r.sidelight_width??l:0;a=Math.max(.1,a),c=i?Math.max(.1,c):0;let u=o-.5;if(a+c>u){let p=Math.max(0,u)/(a+c);a*=p,c*=p}return i?{panels:[[.02,.02+a],[t-.02-c,t-.02]],x0:.02+a,x1:t-.02-c}:(n?!!r.sidelight_hinge:!r.sidelight_hinge)?{panels:[[.02,.02+a]],x0:.02+a,x1:t-.02}:{panels:[[t-.02-a,t-.02]],x0:.02,x1:t-.02-a}}function Ws(t){return t==="front"||t==="front_glass"||t==="sidelight"||t==="sidelights"}var Fn={door:{type:"door",leaves:1,width:.9,sill:0,height:2.05,style:"interior"},front:{type:"door",leaves:1,width:1,sill:0,height:2.1,style:"front"},door_double:{type:"door",leaves:2,width:1.6,sill:0,height:2.05},window:{type:"window",leaves:1,width:1.2,sill:.9,height:1.3},window_double:{type:"window",leaves:2,width:1.6,sill:.9,height:1.3},terrace:{type:"window",leaves:1,width:1,sill:0,height:2.1},terrace_double:{type:"window",leaves:2,width:1.8,sill:0,height:2.1},lift_slide:{type:"window",leaves:1,width:2.4,sill:0,height:2.15,opens:"slide"},garage:{type:"garage",leaves:1,width:2.5,sill:0,height:2.1},glass_wall:{type:"window",leaves:1,width:2,sill:0,height:2.4,style:"glass_wall"}};function Tn(t){if(t.type==="garage")return"garage";if(t.type==="window"&&t.style==="glass_wall")return"glass_wall";if(t.type==="window"&&t.opens==="slide"&&t.sill<.1)return"lift_slide";let e=t.leaves===2;return t.type==="door"?!e&&t.style&&Ws(t.style)?"front":e?"door_double":"door":t.sill<.1?e?"terrace_double":"terrace":e?"window_double":"window"}function Oe(t){t.energy={...yu,...t.energy??{}},t.presence=t.presence??[],t.version=1,t.settings={...ku,...t.settings,roof:{...wu,...t.settings?.roof??{}}},t.floors.forEach((e,n)=>{let r=Ve(e.id,e.name??`Floor ${n+1}`,e.elevation??n*2.8);for(let i of Object.keys(r))e[i]===void 0&&(e[i]=r[i])});for(let e of t.floors){e.outdoor=e.outdoor??[],e.walls=e.walls??[],e.rooms=e.rooms.map(r=>({...r,name:r.name??"",area_id:r.area_id??null,floor_material:r.floor_material??"wood",panel:r.panel??[]})),e.ha_floor=e.ha_floor??null,e.placements=e.placements.map(r=>({...r,mount:r.mount??null,rotation:r.rotation??0})),e.furniture=e.furniture.map(r=>({...r,entity:r.entity??null,power:r.power??null}));let n=e.placements.filter(r=>r.entity_id.startsWith("light."));if(n.length){let r={ceiling:"lamp_ceiling",floor:"lamp_floor",table:"lamp_table",wall:"lamp_wall"};for(let i of n){let o=r[i.mount??"ceiling"],[s,l,a]=nt[o],c=`lamp_${i.entity_id.slice(6).replace(/[^A-Za-z0-9_\-.]/g,"_")}`.slice(0,54),u=c,d=1;for(;e.furniture.some(p=>p.id===u);)u=`${c}_${d++}`;e.furniture.push({id:u,type:o,x:i.x,z:i.z,rotation:0,w:s,d:l,h:a,variant:null,entity:i.entity_id,power:null,animations_enabled:i.animations_enabled,effect_animations:structuredClone(i.effect_animations)})}e.placements=e.placements.filter(i=>!i.entity_id.startsWith("light."))}e.openings=e.openings.map(r=>({...r,type:["door","window","garage"].includes(r.type)?r.type:"door",edge:Number.isInteger(r.edge)?r.edge:0,offset:Number.isFinite(r.offset)?r.offset:.5,width:Number.isFinite(r.width)&&r.width>0?r.width:r.type==="garage"?2.5:r.type==="window"?1.2:.9,height:Number.isFinite(r.height)&&r.height>0?r.height:r.type==="window"?1.3:r.type==="garage"?2.1:2.05,sill:Number.isFinite(r.sill)?r.sill:r.type==="window"?.9:0,hinge:r.hinge??"left",leaves:r.leaves??1,swing:r.swing??"in",style:r.style??null,cover:r.cover??null,contact:r.contact??null,contact2:r.contact2??null,tilt:r.tilt??null}))}return zb(t),t}function zb(t){let e=(n,r)=>{let i=new Set;for(let o of n)(typeof o.id!="string"||!o.id||i.has(o.id))&&(o.id=I(r)),i.add(o.id)};e(t.floors,"floor");for(let n of t.floors){for(let r of n.rooms)(typeof r.id!="string"||!r.id)&&(r.id=I("room"));e(n.openings,"op"),e(n.furniture,"furn"),e(n.outdoor,"out")}}function I(t){return`${t}_${Math.random().toString(36).slice(2,10)}`}function _e(t){let e=0;for(let n=0;no+s[0],0)/i,t.reduce((o,s)=>o+s[1],0)/i]}let n=0,r=0;for(let i=0;i1e-6&&Math.abs(r-o)>1e-6)return!1}return!0}function de(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let[o,s]of t)e=Math.min(e,o),n=Math.min(n,s),r=Math.max(r,o),i=Math.max(i,s);return{x0:e,z0:n,x1:r,z1:i}}function Vs(t){let e=t.rotation*Math.PI/180,n=Math.cos(e),r=Math.sin(e),i=t.w/2,o=t.d/2;return[[-i,-o],[i,-o],[i,o],[-i,o]].map(([s,l])=>[t.x+s*n-l*r,t.z+s*r+l*n])}function C(t,e){let n=!1;for(let r=0,i=e.length-1;rt[1]!=a>t[1]&&t[0]<(l-o)*(t[1]-s)/(a-s)+o&&(n=!n)}return n}var Qi={lamp_ceiling:"ceiling",lamp_downlight:"downlight",lamp_spot:"spot",lamp_panel:"panel",lamp_uplight:"uplight",lamp_bollard:"bollard",lamp_garden:"garden",lamp_pendant:"pendant",ceiling_fan:"fan",lamp_floor:"floor",lamp_table:"table",lamp_wall:"wall",led_strip:"strip"};var Ks=t=>t.trim().replace(/^\/local\/www\//i,"/local/"),js=t=>/^(https:\/\/|\/local\/|\/hacsfiles\/)\S+\.m?js(\?\S*)?$/i.test(t.trim());var Db=globalThis,zu=Db.__nextfloorPluginStore??={plugins:new Map,listeners:new Set},Us=zu.plugins,Tu=zu.listeners;var Ib=5;function Pu(t,e){t.errors.lengthTu.delete(t)}var Gs=()=>[...Us.values()].map(t=>t.status),Du=()=>[...Us.values()].flatMap(t=>Object.keys(t.plugin.lightAnimations??{}));function*to(t,e){for(let{plugin:n,status:r}of Us.values())for(let i of n.devices??[]){let o=!1;try{o=i.match(t,e)}catch(s){Pu(r,s)}o&&(yield{device:i,status:r})}}function no(t,e){for(let{device:n}of to(t,e))return n.kind??"sensor";return null}function Iu(t,e){let n=t.states[e];if(!n)return null;let r=Ob({hass:t,entityId:e,state:n})?.icon?.trim();return r&&/^mdi:[a-z0-9-]+$/i.test(r)?r:null}function Ob(t){let e=null;for(let{device:n,status:r}of to(t.entityId,t.state))if(n.marker)try{let i=n.marker(t);if(!i)continue;e={...e??{}},typeof i.icon=="string"&&i.icon&&(e.icon=i.icon),typeof i.text=="string"&&(e.text=i.text.slice(0,60)),typeof i.active=="boolean"&&(e.active=i.active)}catch(i){Pu(r,i)}return e}function ro(t,e){return t?typeof t=="string"?t:t[e]??t[e.split("-")[0]]??t.en??Object.values(t)[0]??"":""}function Ou(t,e){let n=[];for(let{device:r,status:i}of to(t,e))r.settings?.length&&n.push({pluginId:i.id,name:i.name,settings:r.settings});return n}function Hu(t,e){let n={};for(let r of t??[]){let i=e?.[r.key],o=r.type==="number"?typeof i=="number"&&Number.isFinite(i):r.type==="boolean"?typeof i=="boolean":typeof i=="string"&&(r.options??[]).some(([s])=>s===i);n[r.key]=o?i:r.default}return n}function Lu(t,e){for(let{device:n}of to(t,e))if(n.floorWedge)return!0;return!1}var Hb=new Set(["temperature","humidity","power","carbon_dioxide","energy","gas","water","volume","volume_storage","volume_flow_rate","illuminance","pressure","atmospheric_pressure","pm1","pm25","pm10","volatile_organic_compounds","volatile_organic_compounds_parts","carbon_monoxide","nitrogen_dioxide","moisture","sound_pressure"]),Lb=new Set(["m\xB3","m3","L","l","kWh","Wh","MWh","lx"]),Cb=new Set(["door","window","opening","garage_door","motion","occupancy","presence","smoke","moisture","gas","carbon_monoxide"]),Nb=new Set(["battery","signal_strength","timestamp","date","duration","data_rate","data_size","frequency","enum"]);function Dt(t,e){let n=t.entities?.[e];return n&&(n.area_id||(n.device_id?t.devices?.[n.device_id]?.area_id:null))||null}var Nu=(t,e)=>{let n=t.entities?.[e];return!!(n?.hidden||n?.entity_category)},je=(t,e)=>Q(e)??no(e,t.states[e]);function Cu(t,e){let n=t.states[e];if(!n||Nu(t,e))return!1;if(no(e,n)!==null)return!0;let r=Q(e);if(!r)return!1;let i=n.attributes.device_class;return e.startsWith("event.")?!i||i==="button"||i==="doorbell":r==="sensor"?i?Hb.has(i):Lb.has(String(n.attributes.unit_of_measurement??"")):r==="binary"?i?Cb.has(i):!!t.entities?.[e]?.area_id:!0}function Bb(t,e){let n=t.states[e];return Q(e)!=="sensor"||!n?.attributes.unit_of_measurement||Nu(t,e)||Nb.has(String(n.attributes.device_class??""))?!1:Number.isFinite(Number(n.state))||Ie(n)}var oo=(t,e)=>e.startsWith("sensor.")&&t.states[e]?.attributes.device_class==="power",Zs=null;eo(()=>Zs=null);function qs(t,e){let n=t.get(e);return n||t.set(e,n=[]),n}function Wb(t){let e=new Map,n=new Map,r=new Map,i=new Map,o=[],s=u=>{(Cu(t,u)||Bb(t,u))&&Ft(je(t,u))&&o.push(u)};for(let[u,d]of Object.entries(t.entities??{})){let p=d.device_id;p&&d.area_id&&(i.get(p)??i.set(p,new Set).get(p)).add(d.area_id),p&&oo(t,u)&&qs(n,p).push(u),p&&!d.hidden&&!d.entity_category&&(r.get(p)??r.set(p,new Set).get(p)).add(Ts(u));let h=Dt(t,u);h===null?s(u):Cu(t,u)&&qs(e,h).push(u)}if(t.entities)for(let u of Object.keys(t.states))t.entities[u]||s(u);let l=zs.indexOf("binary")-.5,a=u=>{let d=Q(u),p=d?zs.indexOf(d):l;return p>l&&no(u,t.states[u])!==null?l:p};o.sort((u,d)=>a(u)-a(d)||B(t,u).localeCompare(B(t,d)));for(let[u,d]of e){let p=t.areas?.[u]?.name;d.sort((h,f)=>a(h)-a(f)||B(t,h,p).localeCompare(B(t,f,p)))}let c=new Set;for(let[u,d]of i)d.size>1&&c.add(u);return{entities:t.entities,devices:t.devices,states:t.states,stateCount:Object.keys(t.states).length,byArea:e,powerByDevice:n,withoutArea:o,domainsByDevice:r,hubs:c}}function Pn(t){let e=Zs;return e&&e.entities===t.entities&&e.devices===t.devices&&(e.states===t.states||(e.states=t.states,Object.keys(t.states).length===e.stateCount))?e:Zs=Wb(t)}function ye(t,e){let n=io(t,e.area_id);return e.sub_areas?.length?[...new Set([...n,...e.sub_areas.flatMap(r=>io(t,r))])]:n}function io(t,e){return!e||!t.entities?[]:Pn(t).byArea.get(e)??[]}function Bu(t,e){if(!t.entities)return[];let n=[];for(let[r,i]of Pn(t).byArea){let o=i.filter(s=>Ft(je(t,s)));r!==e&&o.length>0&&n.push({areaId:r,name:t.areas?.[r]?.name??r,ids:o})}return n.sort((r,i)=>r.name.localeCompare(i.name))}var Wu=t=>t.entities?Pn(t).withoutArea:[],Ys=(t,e)=>!!t.entities&&Pn(t).hubs.has(e),so=(t,e)=>t.entities?Pn(t).powerByDevice.get(e)??[]:[];function Dn(t,e){let n=new Map;for(let i of e)qs(n,t.entities?.[i]?.device_id??`entity:${i}`).push(i);let r=new Map(e.map((i,o)=>[i,o]));return[...n.values()].map(i=>{let o=i.find(s=>!t.entities?.[s]?.name)??i[0];return{primary:o,others:i.filter(s=>s!==o)}}).sort((i,o)=>r.get(i.primary)-r.get(o.primary))}var ao=(t,e)=>Dn(t,e).map(n=>n.primary),Vb={temperature:"temperature",humidity:"humidity",co2:"carbon_dioxide",illuminance:"illuminance"};function Xs(t,e,n,r=!1){let i=t.states[e]?.attributes;if(!i)return!1;let o=(i.symcon_variable_type===1||i.symcon_variable_type===2)&&typeof i.symcon_id=="number";if(typeof i.symcon_id=="number"&&!o||!o&&!/^(sensor|input_number|number)\./.test(e))return!1;if(r&&o)return!0;let s=String(i.unit_of_measurement??"").replace(/\s/g,"").toLowerCase();return n==="temperature"&&["\xB0c","\xB0f","\u2103","\u2109","k"].includes(s)||n==="humidity"&&!i.device_class&&["%","%rh","%r.h.","%rf","%r.f."].includes(s)||n==="co2"&&s==="ppm"&&/co[₂2]/i.test(String(i.friendly_name??""))||n==="illuminance"&&["lx","lux"].includes(s)?!0:i.device_class===Vb[n]}var Kb=new Set(["climate","water_heater","switch","button","camera","media_player","vacuum","light","fan","lawn_mower"]),jb=["vorlauf","r(\xFC|ue)cklauf","flow","return","d(\xFC|ue)se","nozzle","hotend","extruder","druckbett","heatbed","(^|[^a-z])bed($|[^a-z])","chamber","cpu","gpu","chip","soc","akku","batter","wasser","water","kessel","boiler","au(\xDF|ss)en","outdoor","outside","abgas","exhaust","sole","brine","verdampfer","kondensat","verdichter","compressor","motor","k(\xFC|ue)hl","freezer","fridge","gefrier"],Ub=new RegExp(`(${jb.join("|")})`,"i");function Js(t,e){let n=t.entities?.[e]?.device_id,r=n&&!Ys(t,n)?Pn(t).domainsByDevice.get(n):void 0;return r&&[...r].some(i=>Kb.has(i))?!1:!Ub.test(`${e} ${t.states[e]?.attributes.friendly_name??""}`)}function Vu(t,e,n,r){let i=n.climate?.[r];if(i==="none")return[];if(i)return[i].flat().filter(c=>t.states[c]);let o=(e?.placements??[]).filter(c=>c.entity_id.startsWith("sensor.")),s=o.filter(c=>C([c.x,c.z],n.points)).map(c=>c.entity_id),l=new Set(o.filter(c=>!C([c.x,c.z],n.points)).map(c=>c.entity_id));return[...new Set([...ye(t,n).filter(c=>!l.has(c)),...s])].filter(c=>c.startsWith("sensor.")&&Xs(t,c,r)&&Js(t,c))}function Ku(t){let e=t.attributes;if(typeof e.symcon_numeric_value!="number")return null;let n=typeof e.symcon_min=="number"?e.symcon_min:0,r=typeof e.symcon_max=="number"&&e.symcon_max>n?e.symcon_max:100;return Math.max(0,Math.min(100,(e.symcon_numeric_value-n)/(r-n)*100))}function lo(t,e){let n=t?.states[e];if(!n)return!1;let r=n.attributes;return typeof r.symcon_id=="number"?r.symcon_variable_type===1||r.symcon_variable_type===2:typeof r.current_position=="number"||/^(sensor|number|input_number)\./.test(e)&&!!n.state.trim()&&Number.isFinite(Number(n.state))}function co(t,e){let n=e?t.states[e]:void 0;if(!n||Ie(n))return null;let r=n.attributes;if(r.nf_cover_control&&typeof r.current_position=="number")return r.current_position;let i=Ku(n);if(i!==null)return i;if(typeof r.current_position=="number")return Math.max(0,Math.min(100,r.current_position));if(!n.state.trim())return null;let o=Number(n.state);if(!Number.isFinite(o))return null;let s=r.unit_of_measurement==="%"||o>1||o<0?o:o*100;return Math.max(0,Math.min(100,s))}var Gb=new Set([void 0,"shutter","blind","awning","shade","curtain","window"]),Zb=new Set(["garage","gate"]),qb=new Set(["window","opening"]);function Er(t,e,n=!1){let r=new Map;return t.forEach((i,o)=>{let s=n&&e.length===1?e[0]:e[o];s&&r.set(i.id,s)}),r}var ju=(t,e)=>t==="none"?null:t??e??null,It=t=>t&&t!=="none"?t:null;function Ot(t,e){let n=new Map;for(let r of e)for(let i of r.rooms){let o=r.openings.filter(g=>g.room_id===i.id).sort((g,b)=>g.edge-b.edge||g.offset-b.offset);if(o.length===0)continue;let s=ye(t,i),l=g=>t.states[g]?.attributes.device_class,a=g=>s.filter(b=>Q(b)==="binary"&&g(l(b)??"")),c=g=>o.filter(b=>b.type===g),u=Er(c("window"),s.filter(g=>Q(g)==="cover"&&Gb.has(l(g))),!0),d=Er(c("window"),a(g=>qb.has(g))),p=Er(c("door"),a(g=>g==="door")),h=Er(c("garage"),s.filter(g=>Q(g)==="cover"&&Zb.has(l(g)??""))),f=Er(c("garage"),a(g=>g==="garage_door"));for(let g of o){let b=g.type==="window"?u:g.type==="garage"?h:null,y=g.type==="window"?d:g.type==="garage"?f:p,v=g.leaves===2;n.set(g.id,{cover:ju(g.cover,b?.get(g.id)),contact:g.sensor==="handle"&&g.contact==null?null:ju(g.contact,y.get(g.id)),tilt:g.tilt==="none"?null:g.tilt,contact2:v?It(g.contact2):null,tilt2:v?It(g.tilt2):null,position:It(g.position),positionInverted:!!g.position_inverted,tiltAngle:It(g.tilt_angle),tiltMax:g.tilt_max??null,tiltOffset:g.tilt_offset??null,tiltInvert:!!g.tilt_invert,shut:!!g.shut,angled:g.type==="door"&&!!g.open_angle,lock:g.type==="door"?It(g.lock):null,cover2:g.type==="garage"?null:It(g.cover2),coverTilt:It(g.cover_tilt),cover2Tilt:It(g.cover2_tilt),coverInverted:!!g.cover_inverted,coverTiltInverted:!!g.cover_tilt_inverted,cover2Inverted:!!g.cover2_inverted,cover2TiltInverted:!!g.cover2_tilt_inverted})}}return n}var Yb=[[/^(tilted|tilt|gekippt|kipp)/i,"tilted"],[/^(open|opened|offen|geöffnet|on)$/i,"open"],[/^(closed|close|geschlossen|zu|off)$/i,"closed"]];function Qs(t){if(!t||Ie(t))return null;let e=t.attributes.window_state;for(let n of[typeof e=="string"?e:"",t.state]){let r=n.trim(),i=r&&Yb.find(([o])=>o.test(r));if(i)return i[1]}return null}var Uu=new WeakMap,Gu=new WeakMap;function Zu(t,e){let n=Gu.get(t)??t,r=Uu.get(n)??new WeakMap;Uu.set(n,r);let i=r.get(e);if(i)return i;let o=new Map;for(let a of e)for(let c of a.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let a of Ot(n,e).values())a.cover&&!o.has(a.cover)&&o.set(a.cover,{tilt:a.coverTilt,position:a.position}),a.cover2&&!o.has(a.cover2)&&o.set(a.cover2,{tilt:a.cover2Tilt});let s={...n.states};for(let[a,c]of o){let u=n.states[a];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},p=co(n,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(d.current_position=p);let h=c.tilt?n.states[c.tilt]:u,f=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?co(n,c.tilt):null;f!==null&&(d.current_tilt_position=f,d.supported_features=Number(d.supported_features??0)|128);let g=u.state;typeof d.current_position=="number"&&g!=="unavailable"&&g!=="unknown"&&g!=="opening"&&g!=="closing"&&(g=d.current_position>0?"open":"closed"),s[a]={...u,state:g,attributes:d}}let l={...n,states:s,callService:async(a,c,u={})=>{if(a!=="cover")return n.callService(a,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async h=>{let f=typeof h=="string"?o.get(h):void 0;if(!f)return n.callService(a,c,{...u,entity_id:h});let g={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&f.tilt&&(g.entity_id=f.tilt);let v=f.tilt?n.states[f.tilt]:void 0;return y&&f.tilt&&!v?.attributes.symcon_id&&typeof v?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",g.position=g.tilt_position,delete g.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),n.callService(a,b,g)};return Array.isArray(u.entity_id)?Promise.all(d.map(p)):p(d[0])}};return Gu.set(l,n),r.set(e,l),l}var X=t=>t?.symconObjects!==void 0;function He(t,e,n=[0,1,2,3]){let r=t?.states[e]?.attributes;return!!r?.symcon_id&&!r.symcon_source_entity&&n.includes(Number(r.symcon_variable_type))}function on(t){return!t||t.state==="unknown"||t.state==="unavailable"?null:t.attributes.symcon_value??t.attributes.symcon_numeric_value??t.state}function Ht(t){let e=on(t);if(e===null||typeof e=="boolean"||e==="")return null;let n=Number(e);return Number.isFinite(n)?n:null}function Ar(t){let e=on(t);if(e===null)return null;if(typeof e=="boolean")return e;if(typeof e=="number")return e>0;let n=String(e).trim().toLowerCase();if(["on","true","1","home","open","an","ein","ja","regen","rain","wet","nass"].includes(n))return!0;if(["off","false","0","not_home","closed","aus","nein","trocken","dry"].includes(n))return!1;let r=Number(n);return n!==""&&Number.isFinite(r)?r>0:null}function ea(t){return on(t)===null?"\u2013":String(t?.attributes.symcon_formatted??on(t))}function qu(t,e){switch(e){case"m/s":return t*3.6;case"mph":return t*1.609;case"kn":return t*1.852;case"ft/s":return t*1.097;default:return t}}var Yu="weather.nextfloor_symcon",Ju={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Xu=new WeakMap;function Xb(t){let e=t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function Qu(t,e){if(!X(t))return t;let n=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(n).some(h=>h&&h!=="none"))return t;let r=Xu.get(t)??new WeakMap;Xu.set(t,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>n[h]&&n[h]!=="none"?t.states[n[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let f=s(h),g=Ht(f);g!==null&&(o[h]=h==="cloud_coverage"&&f?.attributes.symcon_max===1?g*100:g),f?.attributes.unit_of_measurement&&(o[`${h}_unit`]=f.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let f=s(h),g=Ht(f);g!==null&&(o[h]=qu(g,f?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let l=on(s("wind_bearing"));l!==null&&(o.wind_bearing=l);let a=Xb(ea(s("condition"))),c=e.rain_sensor?t.states[e.rain_sensor]:void 0,u=Ar(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),Ar(s("lightning"))?a=u?"lightning-rainy":"lightning":Ar(s("snow"))?a=u?"snowy-rainy":"snowy":Ar(s("fog"))?a="fog":u===!0?a=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&a&&/rain|pouring/.test(a)&&(a=null),!a&&typeof o.cloud_coverage=="number"&&(a=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!a&&u===!1&&(a="sunny");let d={entity_id:Yu,state:a??"unknown",attributes:o},p={...t,states:{...t.states,[Yu]:d}};return r.set(e,p),p}var In={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},sn=t=>(...e)=>({_$litDirective$:t,values:e}),Lt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,r){this._$Ct=e,this._$AM=n,this._$Ci=r}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}};var Fr=class extends Lt{constructor(e){if(super(e),this.it=_,e.type!==In.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===_||e==null)return this._t=void 0,this.it=e;if(e===tt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let n=[e];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};Fr.directiveName="unsafeHTML",Fr.resultType=1;var ed=sn(Fr);var td=/\b(tv|fernseh|television|fire ?tv|apple ?tv|chromecast|shield)/i,nd=/(kühl|fridge|gefrier|freezer)/i,rd=/(spülmaschine|geschirrspül|dishwasher)/i,Jb=/(kochfeld|herd|induktion|cooktop)/i,Qb={robot_vacuum:/(saug|vacuum|robo|roomba|roborock|dreame|ecovacs|deebot)/i,tv_board:td,tv_wall:td,desk:/\b(pc|computer|rechner|desktop|monitor|workstation)/i,fridge:nd,fridge_smart:nd,stove:/(herd|kochfeld|cooktop|stove|induktion)/i,kitchen_tall:/(backofen|oven|ofen)/i,dishwasher:rd,washer:/(waschmaschine|washer|washing)/i,dryer:/(trockner|dryer)/i,kitchen:/(kaffee|coffee|wasserkocher|kettle)/i,island:Jb,sink:rd,radiator:/(heiz|radiator|thermostat|climate|hk|trv)/i},id={lamp_ceiling:/(decke|ceiling|haupt|main)/i,lamp_downlight:/(spot|strahler|downlight|einbau)/i,lamp_spot:/(spot|strahler)/i,lamp_panel:/(panel|decke|ceiling)/i,lamp_uplight:/(fluter|uplight|steh)/i,lamp_bollard:/(weg|garten|garden|path|poller|außen|aussen|outdoor)/i,lamp_garden:/(garten|garden|spot|außen|aussen|outdoor|baum|tree)/i,lamp_pendant:/(pendel|pendant|hänge|esstisch|dining)/i,ceiling_fan:/(ventilator|fan)/i,lamp_floor:/(steh|floor)/i,lamp_table:/(tisch|nacht|table|bedside|lese|reading)/i,lamp_wall:/(wand|wall)/i,led_strip:/(led|strip|streifen|leiste|band)/i},od=new Set(["tv_board","tv_wall"]);var On=t=>od.has(t)||!!qc(t),uo=t=>!!G(t)?.electric&&/speaker|multiroom|soundbar/.test(t.split(":").pop()??t),zr=t=>On(t)||t==="desk"||t==="fridge_smart",ey=t=>!!t&&t!=="none";function ty(t,e){if(oo(t,e))return e;let n=t.entities?.[e]?.device_id;return n?so(t,n).find(r=>r!==e)??null:null}var ny=(t,e,n)=>t.rooms.find(r=>r.points.length>=3&&C([e,n],r.points));function Tr(t,e,n,r){return t.find(i=>e?.test(n(i)))??(r?t[0]??null:null)}function Me(t,e){let n=new Map;for(let r of e){let i=new Set([...r.furniture.flatMap(o=>[o.entity,o.power,o.fan_entity]),...r.placements.map(o=>o.entity_id)].filter(ey));for(let o of r.furniture){let s=o.type in id,l=En(o.type),a=s?id[o.type]:Qb[o.type];if(!a&&!l&&!uo(o.type)&&o.entity==null&&o.power==null)continue;let c=ny(r,o.x,o.z),u=(c?ao(t,ye(t,c)):[]).filter(b=>!i.has(b)),d=b=>`${b} ${B(t,b)}`,p=b=>u.filter(y=>Q(y)===b),h=o.entity==="none"?null:o.entity??null;if(o.entity==null){if(o.type==="ceiling_fan"){let b=(c?ye(t,c):[]).filter(v=>!i.has(v)),y=new Set(b.filter(v=>Q(v)==="fan").map(v=>t.entities?.[v]?.device_id).filter(Boolean));h=b.find(v=>Q(v)==="light"&&y.has(t.entities?.[v]?.device_id))??Tr(p("light"),a,d,!1)}else if(s)h=Tr(p("light"),a,d,!0);else if(o.type==="robot_vacuum"){let b=c?.area_id??null;h=Object.keys(t.entities??{}).find(y=>y.startsWith("vacuum.")&&!i.has(y)&&Dt(t,y)===b)??null}else if(o.type==="radiator"||l)h=Tr(p("climate"),a,d,!0);else if(On(o.type)){let b=p("media");h=b.find(y=>t.states[y]?.attributes.device_class==="tv")??Tr(b,a,d,od.has(o.type))}else if(uo(o.type)){let b=p("media").filter(y=>t.states[y]?.attributes.device_class!=="tv");h=Tr(b,a,d,!1)??(b.length===1?b[0]:null)}else a&&(h=u.find(b=>["switch","media","fan"].includes(Q(b)??"")&&a.test(d(b)))??null);h&&i.add(h)}let f=o.power==="none"?null:o.power??null;o.power==null&&(f=h?ty(t,h):null,!f&&a&&c&&!s&&(f=ye(t,c).find(b=>oo(t,b)&&!i.has(b)&&a.test(d(b)))??null),f&&i.add(f));let g=null;if(o.type==="ceiling_fan"&&(g=o.fan_entity==="none"?null:o.fan_entity??null,o.fan_entity==null)){let b=(c?ye(t,c):[]).filter(v=>Q(v)==="fan"&&!i.has(v)),y=h?t.entities?.[h]?.device_id:void 0;g=(y?b.find(v=>t.entities?.[v]?.device_id===y):void 0)??b[0]??null,g&&i.add(g)}(h||f||g)&&n.set(o.id,{entity:h,power:f,...o.type==="ceiling_fan"?{fan:g}:{}})}}return n}var sd=t=>t==="fridge"||t==="fridge_smart"||/(fridge|freezer|kuehl|gefrier|chest_freezer)/.test(t.slice(t.lastIndexOf(":")+1));function ad(t,e,n=[]){let r=[];for(let i of e){let o=(l,a)=>i.rooms.some(c=>c.points.length>=3&&C([l,a],c.points)),s=Me(t,[i]);r.push(...i.placements.filter(l=>l.outside||!o(l.x,l.z)).map(l=>l.entity_id)),r.push(...i.furniture.filter(l=>!o(l.x,l.z)).flatMap(l=>[s.get(l.id)?.entity,s.get(l.id)?.power]));for(let l of i.outdoor??[])l.area_id&&r.push(...ao(t,io(t,l.area_id))),r.push(l.pump_entity,l.temp_entity)}return[...new Set(r.filter(i=>!!i&&!!t.states[i]&&!n.includes(i)))]}function ry(t,e){return Math.min(...e.map((n,r)=>{let i=e[(r+1)%e.length],[o,s]=[i[0]-n[0],i[1]-n[1]],l=Math.min(1,Math.max(0,((t[0]-n[0])*o+(t[1]-n[1])*s)/(o*o+s*s||1)));return Math.hypot(t[0]-n[0]-o*l,t[1]-n[1]-s*l)}))}function cd(t,e,n=[]){let r=t.points;if(r.length<3||e.length===0)return[];let i=r.map(y=>y[0]),o=r.map(y=>y[1]),[s,l,a,c]=[Math.min(...i),Math.max(...i),Math.min(...o),Math.max(...o)],u=Math.min(l-s,c-a),d=Math.max(.1,Math.min(.25,u/8)),p=Math.min(.35,u/5),h=Math.min(.7,u/4),f=be(r),g=[];for(let y=s+d/2;y=p&&g.push({at:w,wallDistance:x})}g.length===0&&g.push({at:f,wallDistance:0});let b=[...n];return e.map(y=>{let v=Q(y)==="light",w=g[0].at,x=-1/0;for(let{at:M,wallDistance:A}of g){let T=b.length?Math.min(...b.map(P=>Math.hypot(M[0]-P[0],M[1]-P[1]))):3,F=Math.hypot(M[0]-f[0],M[1]-f[1]),L=Math.min(T,3)*2;Fx+1e-9&&(x=L,w=M)}let k=[Math.round(w[0]*100)/100,Math.round(w[1]*100)/100];return b.push(k),{entity_id:y,x:k[0],z:k[1],y:null,mount:null}})}var ld=/(^|_)(current_room|current_segment|aktueller_raum|current_area)($|_)/;function ud(t,e,n){if(n==="none")return null;if(n)return n;let r=e?t.entities?.[e]?.device_id:null;return!r||!t.entities?null:Object.values(t.entities).find(o=>o.device_id===r&&o.entity_id.startsWith("sensor.")&&(ld.test(o.translation_key??"")||ld.test(o.entity_id.split(".")[1])))?.entity_id??null}var me=t=>/^(sensor|input_number|number)\./.test(t),ho=t=>/^(binary_sensor|input_boolean)\./.test(t);function Hn(t,e){if(!me(e))return!1;let n=t?.states[e]?.attributes;return n?.device_class==="power"||n?.unit_of_measurement==="W"||n?.unit_of_measurement==="kW"}function iy(t,e){let n=t?.entities?.[e],r=n?.area_id??(n?.device_id?t?.devices?.[n.device_id]?.area_id:null);return r?t?.areas?.[r]?.name:void 0}function O(t,e){return Object.keys(t?.states??{}).filter(e).map(n=>{let r=iy(t,n),i=t?.states[n],o=typeof i?.attributes.symcon_path=="string"?i.attributes.symcon_path:void 0,s={id:n,label:r?`${B(t,n)} \xB7 ${r}`:B(t,n)};return o&&(s.detail=`Objektbaum: ${o}`),typeof i?.attributes.symcon_source_entity=="string"&&(s.sourceEntity=i.attributes.symcon_source_entity),s}).sort((n,r)=>n.label.localeCompare(r.label))}function dd(t,e,n){return e.unsupported?[]:O(t,r=>He(t,r,e.types)&&!e.excluded?.(r)).map(r=>{if(!e.role)return r;let i=t.states[r.id],o=`${e.role}.${i.attributes.symcon_id}`,s=n?t.states[n]:void 0,l=n&&(n===r.id||s?.attributes.symcon_source_entity===r.id)?n:t.states[o]?o:r.id;return l===r.id?r:{...r,id:l,sourceEntity:r.id}})}function po(t,e){return t.power&&t.power!=="none"?t.power:e.get(t.id)?.power??null}var ve=ee` +var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var Ii=globalThis,Oi=Ii.ShadowRoot&&(Ii.ShadyCSS===void 0||Ii.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ks=Symbol(),$c=new WeakMap,kr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==ks)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(Oi&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=$c.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&$c.set(n,e))}return e}toString(){return this.cssText}},Sc=t=>new kr(typeof t=="string"?t:t+"",void 0,ks),ee=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new kr(n,t,ks)},Mc=(t,e)=>{if(Oi)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),i=Ii.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}},xs=Oi?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return Sc(n)})(t):t;var{is:fb,defineProperty:mb,getOwnPropertyDescriptor:gb,getOwnPropertyNames:_b,getOwnPropertySymbols:bb,getPrototypeOf:yb}=Object,Hi=globalThis,Rc=Hi.trustedTypes,vb=Rc?Rc.emptyScript:"",wb=Hi.reactiveElementPolyfillSupport,xr=(t,e)=>t,$s={toAttribute(t,e){switch(e){case Boolean:t=t?vb:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Ac=(t,e)=>!fb(t,e),Ec={attribute:!0,type:String,converter:$s,reflect:!1,useDefault:!1,hasChanged:Ac};Symbol.metadata??=Symbol("metadata"),Hi.litPropertyMetadata??=new WeakMap;var bt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=Ec){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,n);i!==void 0&&mb(this.prototype,e,i)}}static getPropertyDescriptor(e,n,r){let{get:i,set:o}=gb(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:i,set(s){let l=i?.call(this);o?.call(this,s),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ec}static _$Ei(){if(this.hasOwnProperty(xr("elementProperties")))return;let e=yb(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(xr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xr("properties"))){let n=this.properties,r=[..._b(n),...bb(n)];for(let i of r)this.createProperty(i,n[i])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,i]of n)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let i=this._$Eu(n,r);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)n.unshift(xs(i))}else e!==void 0&&n.push(xs(e));return n}static _$Eu(e,n){let r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Mc(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,n,r){this._$AK(e,r)}_$ET(e,n){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:$s).toAttribute(n,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,n){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:$s;this._$Em=i;let l=s.fromAttribute(n,o.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(e,n,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??Ac)(o,n)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,n,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??n??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(n=void 0),this._$AL.set(e,n)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,l=this[i];s!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,o,l)}}let e=!1,n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(n)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(n)}willUpdate(e){}_$AE(e){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(e){}firstUpdated(e){}};bt.elementStyles=[],bt.shadowRootOptions={mode:"open"},bt[xr("elementProperties")]=new Map,bt[xr("finalized")]=new Map,wb?.({ReactiveElement:bt}),(Hi.reactiveElementVersions??=[]).push("2.1.2");var Ms=globalThis,Fc=t=>t,Li=Ms.trustedTypes,Tc=Li?Li.createPolicy("lit-html",{createHTML:t=>t}):void 0,Rs="$lit$",yt=`lit$${Math.random().toFixed(9).slice(2)}$`,Es="?"+yt,kb=`<${Es}>`,en=document,Sr=()=>en.createComment(""),Mr=t=>t===null||typeof t!="object"&&typeof t!="function",As=Array.isArray,Hc=t=>As(t)||typeof t?.[Symbol.iterator]=="function",Ss=`[ +\f\r]`,$r=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zc=/-->/g,Pc=/>/g,Jt=RegExp(`>|${Ss}(?:([^\\s"'>=/]+)(${Ss}*=${Ss}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),Dc=/'/g,Ic=/"/g,Lc=/^(?:script|style|textarea|title)$/i,Fs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=Fs(1),R=Fs(2),i1=Fs(3),tt=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Oc=new WeakMap,Qt=en.createTreeWalker(en,129);function Cc(t,e){if(!As(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tc!==void 0?Tc.createHTML(e):e}var Nc=(t,e)=>{let n=t.length-1,r=[],i,o=e===2?"":e===3?"":"",s=$r;for(let l=0;l"?(s=i??$r,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Jt:u[3]==='"'?Ic:Dc):s===Ic||s===Dc?s=Jt:s===zc||s===Pc?s=$r:(s=Jt,i=void 0);let h=s===Jt&&t[l+1].startsWith("/>")?" ":"";o+=s===$r?a+kb:d>=0?(r.push(c),a.slice(0,d)+Rs+a.slice(d)+yt+h):a+yt+(d===-2?l:h)}return[Cc(t,o+(t[n]||"")+(e===2?"":e===3?"":"")),r]},Rr=class t{constructor({strings:e,_$litType$:n},r){let i;this.parts=[];let o=0,s=0,l=e.length-1,a=this.parts,[c,u]=Nc(e,n);if(this.el=t.createElement(c,r),Qt.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=Qt.nextNode())!==null&&a.length0){i.textContent=Li?Li.emptyScript:"";for(let h=0;h2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_}_$AI(e,n=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=tn(this,e,n,0),s=!Mr(e)||e!==this._$AH&&e!==tt,s&&(this._$AH=e);else{let l=e,a,c;for(e=o[0],a=0;a{let r=n?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=n?.renderBefore??null;r._$litPart$=i=new En(e.insertBefore(Sr(),o),o,void 0,n??{})}return i._$AI(t),i};var Ts=globalThis,Y=class extends bt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Wc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tt}};Y._$litElement$=!0,Y.finalized=!0,Ts.litElementHydrateSupport?.({LitElement:Y});var $b=Ts.litElementPolyfillSupport;$b?.({LitElement:Y});(Ts.litElementVersions??=[]).push("4.2.2");var Ps=t=>t.slice(0,t.indexOf(".")),Sb={light:"light",switch:"switch",input_boolean:"switch",valve:"switch",fan:"fan",cover:"cover",climate:"climate",media_player:"media",lock:"lock",sensor:"sensor",binary_sensor:"binary",event:"sensor",scene:"scene",script:"script"},Q=t=>Sb[Ps(t)]??null,Ds=["light","cover","climate","media","switch","fan","lock","binary","sensor","scene","script"];var Vc=new Set(["light","switch","fan"]),Ft=t=>t!==null&&t!=="scene"&&t!=="script",Ie=t=>!t||t.state==="unavailable"||t.state==="unknown"&&!t.entity_id.startsWith("event.");function B(t,e,n){let r=String(t?.states[e]?.attributes.friendly_name??t?.entities?.[e]?.name??e);if(!n||r.length<=n.length+1||!r.toLowerCase().startsWith(`${n.toLowerCase()} `))return r;let i=r.slice(n.length+1);return i[0].toUpperCase()+i.slice(1)}var Kc=t=>!!t&&t.entity_id.startsWith("sensor.")&&t.attributes.device_class==="enum";var jc=t=>Math.min(1,Math.max(0,t));function Mb(t){let e=jc((t-2200)/4300),n=[1,.66,.26],r=[.78,.9,1];return[0,1,2].map(i=>n[i]+(r[i]-n[i])*e)}function zs(t,e){if(!t||t.state!=="on")return null;let n=e&&!["unavailable","unknown"].includes(e.state)?e.attributes:t.attributes,r=typeof n.brightness=="number"?.2+.8*Math.sqrt(jc(n.brightness/255)):1,i=n.rgb_color;return i&&!["color_temp","brightness","onoff"].includes(String(n.color_mode))?{color:[i[0]/255,i[1]/255,i[2]/255],level:r}:typeof n.color_temp_kelvin=="number"?{color:Mb(n.color_temp_kelvin),level:r}:{color:[1,.71,.28],level:r}}function Uc(t,e,n){let r=zs(t,n);if(r)return r;for(let i of e){let o=zs(i);if(o)return{color:o.color,level:o.level*.6}}return null}function Ki(t,e,n=null){if(t==="light"&&n==="floor")return 1.95;if(t==="light"&&n==="table")return 1.25;if(t==="light"&&n==="wall")return 1.95;switch(t){case"light":return Math.max(.5,e-.25);case"cover":return Math.min(2,e-.3);case"climate":return .6;case"media":return .9;case"binary":case"sensor":return 1.4;default:return 1.05}}var Yc=[],ji=new Map,Rb=0,he=(t,e)=>`pack:${t}:${e}`,vt=t=>t.startsWith("pack:");function Is(t){Yc=t,ji=new Map;for(let e of t)for(let n of e.items)ji.set(he(e.id,n.id),n);Rb+=1}var Ar=()=>Yc;var Eb={};function G(t){if(!vt(t))return;let e=ji.get(t);if(e)return e;let[,n,...r]=t.split(":"),i=Eb[n];return i?ji.get(he(i,r.join(":"))):void 0}var Ab=.22;function Gc(t,e,n,r){let i=Math.min(Ab,n/3);if(r<=i*2.4||Math.abs(r-n)<1e-6)return e*(r/n)+(t-e)*(r/n);let o=e*(r/n),s=t-e;return s<=i?o+s:s>=n-i?o+r-(n-s):o+i+(s-i)*(r-2*i)/(n-2*i)}function Er(t,e,n,r,i){return[Gc(t*r,n*r,r,i)/i,Gc(e*r,n*r,r,i)/i]}var Zc=new WeakMap;function Xc(t,e,n,r){let[i,o,s]=t.size;if(t.vehicle||t.stretch||Math.abs(e-i)<1e-4&&Math.abs(n-o)<1e-4&&Math.abs(r-s)<1e-4)return t.parts;let l=`${e.toFixed(4)}|${n.toFixed(4)}|${r.toFixed(4)}`,a=Zc.get(t),c=a?.get(l);if(c)return c;let u=t.parts.map(d=>{if(d.shape==="sweep")return d;let[p,h]=Er(d.x-d.w/2,d.x+d.w/2,-.5,i,e),[f,g]=Er(d.z-d.d/2,d.z+d.d/2,-.5,o,n),[b,y]=Er(d.y,d.y+d.h,0,s,r);if(d.rot)return{...d,x:(p+h)/2,z:(f+g)/2,w:d.w*i/e,d:d.d*o/n,y:b,h:y-b};let v={...d,x:(p+h)/2,z:(f+g)/2,w:h-p,d:g-f,y:b,h:y-b};if(d.shape==="loft"){let[w,x,k,M]=[d.tx??d.x,d.tz??d.z,d.tw??d.w,d.td??d.d],[A,T]=Er(w-k/2,w+k/2,-.5,i,e),[F,L]=Er(x-M/2,x+M/2,-.5,o,n);Object.assign(v,{tx:(A+T)/2,tz:(F+L)/2,tw:T-A,td:L-F})}return v});return a||Zc.set(t,a=new Map),a.size>32&&a.clear(),a.set(l,u),u}var Os=t=>!!t?.parts.some(e=>e.move);var Jc=t=>G(t)?.parts.find(e=>e.screen),qc=.06;function Qc(t){let e=G(t);if(!e)return!1;let[n,r,i]=e.size;return e.parts.filter(o=>o.screen).some(o=>{let[s,l]=[o.w*n,o.d*r,o.h*i].sort((a,c)=>c-a);return l>=qc&&s>=qc})}function dt(t){return nt[t]??G(t)?.size??[.6,.6,.8]}function Tt(t){let e=G(t);return au.has(t)||!!e?.electric||!!e?.light||!!e?.climate}var eu=t=>!!G(t)?.parts.some(e=>e.picture),An=t=>!!G(t)?.climate;function tu(t,e){return t.name[e.split("-")[0]]??t.name.en??Object.values(t.name)[0]??t.id}var Fb={wohnen:"Living & Pets",kino:"Home Cinema & Gaming",kueche:"Kitchen Extras",bad:"Bathroom Extras",schlafen:"Bedroom & Kids",technik:"Office & Homelab",energie:"Energy & Building Services",garten:"Garden & Terrace (older)",fitness:"Fitness (older)",fahrzeuge:"Vehicles",ikea:"IKEA sizes",treppen:"Stairs & railings",ausbau:"Architecture & fit-out",werkstatt:"Garage & workshop",a_wohnzimmer:"Living room",a_schlafzimmer:"Bedroom",a_kueche:"Kitchen",a_bad:"Bathroom",a_kinderzimmer:"Kids' room",a_buero:"Office & gaming",a_fitness:"Fitness",a_haustiere:"Pets",a_garten:"Garden & patio",a_kino:"Home cinema & hi-fi",a_smart:"Smart home & tech",a_haustechnik:"Utility & building services",a_saison:"Season & decoration",a_smart2:"Smart home 2",a_haustechnik2:"Building services 2",a_wellness:"Wellness",a_garten2:"Garden 2",a_kueche2:"Kitchen 2",a_fahrzeuge2:"Vehicles 2",a_aussenkueche:"Outdoor kitchen & terrace",a_werkstatt2:"Workshop 2",a_japandi:"Japandi & Scandi",a_loft:"Loft & industrial",a_gruen:"Indoor greenery",a_musik:"Music & studio",a_bilder:"Pictures & frames"};function nu(t,e){if(e.split("-")[0]==="de")return t.name;let n=/^nextfloor\.(.+)$/.exec(t.id)?.[1];return n&&Fb[n]||t.name}function zt(t,e){return e.mount_y!=null?e.mount_y:zb(t,e)+(Tb(e)?0:ou(t,e.x,e.z))}var Tb=t=>t.type==="led_strip"||G(t.type)?.mount==="ceiling";function zb(t,e){if(e.type==="lamp_wall")return ru;if(e.type==="led_strip")return Math.max(0,ht(t,e.x,e.z)-.04-Math.max(.02,e.h));let n=G(e.type);if(!n)return iu(e);switch(n.mount){case"surface":return su(t,e.x,e.z);case"wall":return n.wall_y??1;case"ceiling":return Math.max(0,Ui(t,e)-e.h);default:return 0}}function Hs(t){if(t==="plant")return"plant";let e=G(t);return e?e.household?e.household:/monstera|plant|herb_garden|flower_pots|bonsai|ficus|cactus|kaktus/.test(e.id)?"plant":null:null}var wt=["electricity","water","gas","heating","cooling"],lu=["condition","temperature","humidity","pressure","wind_speed","wind_gust_speed","wind_bearing","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility","snow","fog","lightning"],cu=["turn","slide","top"],uu=["always","active","no_power","never"],du=1.3,Gi=(t,e=new Date().toISOString().slice(0,10))=>!!t.due&&t.due<=e,hu=["gable","hip","halfhip","pyramid","mansard","pent","flat","parapet"],pu=["brick","round","wide","steel"],Zi=["navigate","more_info","service","fire_dom_event"];function qi(t,e,n){return t?e?!!n.lock_plan:!!t.locked:!1}var fu=["rain","snow","fog","clouds","lightning","sky"],mu=["rain","snow","clouds","lightning","sky"],gu=["lawn","terrace","path","driveway","pool","bed","wild","hedge","fence","pergola"],Ls={lawn:.012,terrace:.12,path:.02,driveway:.02,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function Cs(t){return t==="hedge"||t==="fence"||t==="pergola"}var _u=["x","-x","z","-z"];function Pb(t,e,n){let r=t.slope??0;if(!r||t.type==="pool")return 0;let i=t.slope_dir??"x",o=(c,u)=>i==="x"?c:i==="-x"?-c:i==="z"?u:-u,s=1/0,l=-1/0;for(let[c,u]of t.points){let d=o(c,u);s=Math.min(s,d),l=Math.max(l,d)}if(l-s<1e-6)return 0;let a=Math.min(1,Math.max(0,(o(e,n)-s)/(l-s)));return r*a}function Db(t,e,n,r){return bu(t)+(e.offset??0)+Ls[e.type]-Pb(e,n,r)}function bu(t){return t.elevation>.3?0:-.2}function yu(t,e,n){let r=(t.outdoor??[]).filter(o=>!Cs(o.type)&&o.type!=="pool"&&C([e,n],o.points)),i=[...r].reverse().find(o=>o.cut)??r[0];return i?Db(t,i,e,n):bu(t)}var vu=t=>t.cut??t.type==="pool",wu=30,ku={meter:null,grid:null,grid_invert:!1,solar:null,battery:null,battery_invert:!1,battery_soc:null,consumption:null,tariff:null},xu=["wood","oak","tiles","carpet","stone","concrete"],$u={type:"none",pitch:35,overhang:.4},Yi="#d6cfc2",Xi="#e8e3da",Su={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...$u}};function Pt(){return{version:1,floors:[],settings:{...Su},energy:{...ku},presence:[]}}function Ve(t,e,n){return{id:t,name:e,elevation:n,height:2.5,cut_height:1.15,rooms:[],openings:[],furniture:[],placements:[],background:null,outdoor:[],walls:[],ha_floor:null}}var Ib=2.75;function Mu(t,e){if(e!=null&&Number.isFinite(e))return Math.round(e*Ib*100)/100;let n=t.reduce((r,i)=>!r||i.elevation>r.elevation?i:r,null);return n?Math.round((n.elevation+n.height+.25)*100)/100:0}function Ru(t,e,n){let r=t.rooms.flatMap(l=>l.points.map(a=>a[0])),i=t.rooms.flatMap(l=>l.points.map(a=>a[1])),o=r.length?Math.ceil(Math.max(...r))+1:0,s=i.length?Math.floor(Math.min(...i)):0;return e.map((l,a)=>{let c=o+a%3*4.5,u=s+Math.floor(a/3)*3.5;return{id:n(),name:l.name,area_id:l.area_id,points:[[c,u],[c+4,u],[c+4,u+3],[c,u+3]],floor_material:"wood"}})}function Eu(t,e,n,r){let i=t.rotation*Math.PI/180,o=Math.cos(i),s=Math.sin(i),[l,a]=e,c=t.x-l*(t.w/2)*o+a*(t.d/2)*s,u=t.z-l*(t.w/2)*s-a*(t.d/2)*o,d=n[0]-c,p=n[1]-u,h=y=>Math.max(.1,Math.round(y/r)*r),f=h((d*o+p*s)*l),g=h((-d*s+p*o)*a),b=y=>Math.round(y*1e3)/1e3;return{x:b(c+l*(f/2)*o-a*(g/2)*s),z:b(u+l*(f/2)*s+a*(g/2)*o),w:b(f),d:b(g)}}var Ji=["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_table","lamp_wall","led_strip","lamp_uplight","lamp_bollard","lamp_garden","radiator","sofa","armchair","stool","coffee_table","tv_board","tv_wall","sideboard","shelf","plant","rug","table","table_round","chair","bench","corner_bench","bar_stool","kitchen","kitchen_wall","kitchen_tall","island","worktop","sink","stove","dishwasher","fridge","bed","bunk_bed","nightstand","wardrobe","dresser","bathtub","shower","wc","washbasin","washer","dryer","desk","office_chair","tall_cabinet","coat_rack","stairs","robot_vacuum","inverter","home_battery","wallbox","meter","grid_point","parking","fridge_smart","heating_manifold","buffer_tank","freshwater_station","stairwell"],Au={lights:["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"],living:["sofa","armchair","stool","coffee_table","tv_board","tv_wall","sideboard","shelf","plant","rug"],dining:["table","table_round","chair","bench","corner_bench","bar_stool"],kitchen:["kitchen","kitchen_wall","kitchen_tall","island","worktop","sink","stove","dishwasher","fridge"],sleeping:["bed","bunk_bed","nightstand","wardrobe","dresser"],bath:["bathtub","shower","wc","washbasin","washer","dryer"],work:["desk","worktop","office_chair","tall_cabinet","coat_rack","radiator","stairs","robot_vacuum","heating_manifold","buffer_tank","freshwater_station"],vehicles:["parking"]},Ke=["meter","inverter","home_battery","wallbox","grid_point"],Fu=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),ru=1.75;function Qi(t){return Ns.has(t.type)||["stairwell","parking"].includes(t.type)?!1:G(t.type)?.mount!=="ceiling"}function ue(t){return Fu.has(t)||!!G(t)?.light}var Ob=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function Tu(t,e,n,r=0){let i=de(t.points),o=i.x1-i.x0-2*r,s=i.z1-i.z0-2*r,l=[];for(let a=0;aMath.round(s*1e3)/1e3,[i,o]={right:[1,0],down:[0,1],left:[-1,0],up:[0,-1]}[n];return[r(t[0]+i*e),r(t[1]+o*e)]}function iu(t){switch(t.type){case"home_battery":return t.variant==="wall"?.5:0;case"kitchen_wall":return 1.45;case"tv_wall":return Math.max(0,1.3-t.h/2);case"radiator":return .12;case"inverter":return 1.1;case"wallbox":return 1;case"meter":return .4;default:return 0}}var Ns=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan"]);function zu(t,e){return t.filter(n=>n.elevationn.rooms.filter(r=>r.points.length>=3&&r.ceiling!=null&&r.ceiling>n.height+.005&&n.elevation+r.ceiling>e.elevation+.05)).map(n=>n.points)}var Bs=t=>t?.floor_offset&&Number.isFinite(t.floor_offset)?t.floor_offset:0;function ou(t,e,n){let r=t.rooms.find(i=>i.points.length>=3&&i.floor_offset&&C([e,n],i.points));return Bs(r)}function ht(t,e,n){let r=t.rooms.find(i=>i.points.length>=3&&C([e,n],i.points));return r?.ceiling!=null&&r.ceiling>0?r.ceiling:t.height}var Ui=(t,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:ht(t,e.x,e.z);function su(t,e,n){let r=0;for(let i of t.furniture)!(Ob.has(i.type)||G(i.type)?.surface)||!C([e,n],js(i))||(r=Math.max(r,i.h));return r}var au=new Set([...Fu,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]),nt={sofa:[2.2,.9,.82],armchair:[.85,.85,.8],table:[1.6,.9,.75],chair:[.46,.5,.9],bed:[1.6,2.05,.9],nightstand:[.45,.4,.5],wardrobe:[1.8,.6,2.1],shelf:[.9,.35,1.9],kitchen:[2.4,.62,.92],worktop:[1.2,.62,.91],inverter:[.5,.2,.65],home_battery:[.6,.25,1.1],wallbox:[.3,.15,.42],heating_manifold:[1.5,.35,1.1],buffer_tank:[.85,.85,1.85],freshwater_station:[.65,.28,.9],meter:[.55,.21,1.1],grid_point:[.4,.22,.6],fridge:[.6,.65,1.8],fridge_smart:[.91,.73,1.78],stairwell:[1,2.6,.02],stove:[.6,.62,.92],sink:[.9,.62,.92],bathtub:[1.7,.75,.58],shower:[.9,.9,2],wc:[.38,.6,.8],washbasin:[.6,.46,.85],desk:[1.4,.7,.75],tv_board:[1.8,.42,.5],plant:[.45,.45,1.1],rug:[2,1.4,.01],stairs:[1,3.2,2.75],stool:[.55,.55,.42],lamp_ceiling:[.4,.4,.08],lamp_downlight:[.1,.1,.02],lamp_spot:[.1,.1,.14],lamp_panel:[.6,.6,.03],lamp_uplight:[.35,.35,1.8],lamp_bollard:[.16,.16,.8],lamp_garden:[.12,.12,.3],radiator:[1,.1,.6],robot_vacuum:[.36,.5,.1],parking:[2.6,5.2,.02],lamp_pendant:[.4,.4,.8],ceiling_fan:[1.32,1.32,.32],lamp_floor:[.4,.4,1.7],lamp_table:[.28,.28,.45],lamp_wall:[.22,.12,.2],led_strip:[2,.04,.03],coffee_table:[1.1,.6,.42],tv_wall:[1.3,.08,.75],sideboard:[1.6,.45,.8],table_round:[1.1,1.1,.75],bench:[1.4,.45,.85],corner_bench:[2,1.6,.9],bar_stool:[.42,.42,.75],kitchen_wall:[.8,.35,.7],kitchen_tall:[.6,.62,2.1],island:[1.8,.9,.92],dishwasher:[.6,.62,.92],bunk_bed:[1,2.05,1.65],dresser:[1,.5,.9],washer:[.6,.6,.85],dryer:[.6,.6,.85],office_chair:[.65,.65,1.1],tall_cabinet:[.6,.6,2.1],coat_rack:[1,.35,1.9]};var Ws=["interior","front","front_glass","sidelight","sidelights","glass","sliding","passage"],Vs=["standard","bars","glass_wall"],eo=new Set(["interior","front"]);function rn(t,e){return t.type==="door"?t.style&&Ws.includes(t.style)?t.style:e?"front":"interior":t.style&&Vs.includes(t.style)?t.style:"standard"}function Pu(t,e,n,r){if(e!=="sidelight"&&e!=="sidelights")return null;let i=e==="sidelights",o=t-.04,s=Math.min(1.05,Math.max(.6,o-(i?.6:.3))),l=(o-s)/(i?2:1),a=r.sidelight_width??l,c=i?r.sidelight_width2??r.sidelight_width??l:0;a=Math.max(.1,a),c=i?Math.max(.1,c):0;let u=o-.5;if(a+c>u){let p=Math.max(0,u)/(a+c);a*=p,c*=p}return i?{panels:[[.02,.02+a],[t-.02-c,t-.02]],x0:.02+a,x1:t-.02-c}:(n?!!r.sidelight_hinge:!r.sidelight_hinge)?{panels:[[.02,.02+a]],x0:.02+a,x1:t-.02}:{panels:[[t-.02-a,t-.02]],x0:.02,x1:t-.02-a}}function Ks(t){return t==="front"||t==="front_glass"||t==="sidelight"||t==="sidelights"}var Tn={door:{type:"door",leaves:1,width:.9,sill:0,height:2.05,style:"interior"},front:{type:"door",leaves:1,width:1,sill:0,height:2.1,style:"front"},door_double:{type:"door",leaves:2,width:1.6,sill:0,height:2.05},window:{type:"window",leaves:1,width:1.2,sill:.9,height:1.3},window_double:{type:"window",leaves:2,width:1.6,sill:.9,height:1.3},terrace:{type:"window",leaves:1,width:1,sill:0,height:2.1},terrace_double:{type:"window",leaves:2,width:1.8,sill:0,height:2.1},lift_slide:{type:"window",leaves:1,width:2.4,sill:0,height:2.15,opens:"slide"},garage:{type:"garage",leaves:1,width:2.5,sill:0,height:2.1},glass_wall:{type:"window",leaves:1,width:2,sill:0,height:2.4,style:"glass_wall"}};function zn(t){if(t.type==="garage")return"garage";if(t.type==="window"&&t.style==="glass_wall")return"glass_wall";if(t.type==="window"&&t.opens==="slide"&&t.sill<.1)return"lift_slide";let e=t.leaves===2;return t.type==="door"?!e&&t.style&&Ks(t.style)?"front":e?"door_double":"door":t.sill<.1?e?"terrace_double":"terrace":e?"window_double":"window"}function Oe(t){t.energy={...ku,...t.energy??{}},t.presence=t.presence??[],t.version=1,t.settings={...Su,...t.settings,roof:{...$u,...t.settings?.roof??{}}},t.floors.forEach((e,n)=>{let r=Ve(e.id,e.name??`Floor ${n+1}`,e.elevation??n*2.8);for(let i of Object.keys(r))e[i]===void 0&&(e[i]=r[i])});for(let e of t.floors){e.outdoor=e.outdoor??[],e.walls=e.walls??[],e.rooms=e.rooms.map(r=>({...r,name:r.name??"",area_id:r.area_id??null,floor_material:r.floor_material??"wood",panel:r.panel??[]})),e.ha_floor=e.ha_floor??null,e.placements=e.placements.map(r=>({...r,mount:r.mount??null,rotation:r.rotation??0})),e.furniture=e.furniture.map(r=>({...r,entity:r.entity??null,power:r.power??null}));let n=e.placements.filter(r=>r.entity_id.startsWith("light."));if(n.length){let r={ceiling:"lamp_ceiling",floor:"lamp_floor",table:"lamp_table",wall:"lamp_wall"};for(let i of n){let o=r[i.mount??"ceiling"],[s,l,a]=nt[o],c=`lamp_${i.entity_id.slice(6).replace(/[^A-Za-z0-9_\-.]/g,"_")}`.slice(0,54),u=c,d=1;for(;e.furniture.some(p=>p.id===u);)u=`${c}_${d++}`;e.furniture.push({id:u,type:o,x:i.x,z:i.z,rotation:0,w:s,d:l,h:a,variant:null,entity:i.entity_id,power:null,animations_enabled:i.animations_enabled,effect_animations:structuredClone(i.effect_animations)})}e.placements=e.placements.filter(i=>!i.entity_id.startsWith("light."))}e.openings=e.openings.map(r=>({...r,type:["door","window","garage"].includes(r.type)?r.type:"door",edge:Number.isInteger(r.edge)?r.edge:0,offset:Number.isFinite(r.offset)?r.offset:.5,width:Number.isFinite(r.width)&&r.width>0?r.width:r.type==="garage"?2.5:r.type==="window"?1.2:.9,height:Number.isFinite(r.height)&&r.height>0?r.height:r.type==="window"?1.3:r.type==="garage"?2.1:2.05,sill:Number.isFinite(r.sill)?r.sill:r.type==="window"?.9:0,hinge:r.hinge??"left",leaves:r.leaves??1,swing:r.swing??"in",style:r.style??null,cover:r.cover??null,contact:r.contact??null,contact2:r.contact2??null,tilt:r.tilt??null}))}return Hb(t),t}function Hb(t){let e=(n,r)=>{let i=new Set;for(let o of n)(typeof o.id!="string"||!o.id||i.has(o.id))&&(o.id=I(r)),i.add(o.id)};e(t.floors,"floor");for(let n of t.floors){for(let r of n.rooms)(typeof r.id!="string"||!r.id)&&(r.id=I("room"));e(n.openings,"op"),e(n.furniture,"furn"),e(n.outdoor,"out")}}function I(t){return`${t}_${Math.random().toString(36).slice(2,10)}`}function _e(t){let e=0;for(let n=0;no+s[0],0)/i,t.reduce((o,s)=>o+s[1],0)/i]}let n=0,r=0;for(let i=0;i1e-6&&Math.abs(r-o)>1e-6)return!1}return!0}function de(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let[o,s]of t)e=Math.min(e,o),n=Math.min(n,s),r=Math.max(r,o),i=Math.max(i,s);return{x0:e,z0:n,x1:r,z1:i}}function js(t){let e=t.rotation*Math.PI/180,n=Math.cos(e),r=Math.sin(e),i=t.w/2,o=t.d/2;return[[-i,-o],[i,-o],[i,o],[-i,o]].map(([s,l])=>[t.x+s*n-l*r,t.z+s*r+l*n])}function C(t,e){let n=!1;for(let r=0,i=e.length-1;rt[1]!=a>t[1]&&t[0]<(l-o)*(t[1]-s)/(a-s)+o&&(n=!n)}return n}var to={lamp_ceiling:"ceiling",lamp_downlight:"downlight",lamp_spot:"spot",lamp_panel:"panel",lamp_uplight:"uplight",lamp_bollard:"bollard",lamp_garden:"garden",lamp_pendant:"pendant",ceiling_fan:"fan",lamp_floor:"floor",lamp_table:"table",lamp_wall:"wall",led_strip:"strip"};var Us=t=>t.trim().replace(/^\/local\/www\//i,"/local/"),Gs=t=>/^(https:\/\/|\/local\/|\/hacsfiles\/)\S+\.m?js(\?\S*)?$/i.test(t.trim());var Cb=globalThis,Iu=Cb.__nextfloorPluginStore??={plugins:new Map,listeners:new Set},Zs=Iu.plugins,Du=Iu.listeners;var Nb=5;function Ou(t,e){t.errors.lengthDu.delete(t)}var qs=()=>[...Zs.values()].map(t=>t.status),Hu=()=>[...Zs.values()].flatMap(t=>Object.keys(t.plugin.lightAnimations??{}));function*ro(t,e){for(let{plugin:n,status:r}of Zs.values())for(let i of n.devices??[]){let o=!1;try{o=i.match(t,e)}catch(s){Ou(r,s)}o&&(yield{device:i,status:r})}}function io(t,e){for(let{device:n}of ro(t,e))return n.kind??"sensor";return null}function Lu(t,e){let n=t.states[e];if(!n)return null;let r=Bb({hass:t,entityId:e,state:n})?.icon?.trim();return r&&/^mdi:[a-z0-9-]+$/i.test(r)?r:null}function Bb(t){let e=null;for(let{device:n,status:r}of ro(t.entityId,t.state))if(n.marker)try{let i=n.marker(t);if(!i)continue;e={...e??{}},typeof i.icon=="string"&&i.icon&&(e.icon=i.icon),typeof i.text=="string"&&(e.text=i.text.slice(0,60)),typeof i.active=="boolean"&&(e.active=i.active)}catch(i){Ou(r,i)}return e}function oo(t,e){return t?typeof t=="string"?t:t[e]??t[e.split("-")[0]]??t.en??Object.values(t)[0]??"":""}function Cu(t,e){let n=[];for(let{device:r,status:i}of ro(t,e))r.settings?.length&&n.push({pluginId:i.id,name:i.name,settings:r.settings});return n}function Nu(t,e){let n={};for(let r of t??[]){let i=e?.[r.key],o=r.type==="number"?typeof i=="number"&&Number.isFinite(i):r.type==="boolean"?typeof i=="boolean":typeof i=="string"&&(r.options??[]).some(([s])=>s===i);n[r.key]=o?i:r.default}return n}function Bu(t,e){for(let{device:n}of ro(t,e))if(n.floorWedge)return!0;return!1}var Wb=new Set(["temperature","humidity","power","carbon_dioxide","energy","gas","water","volume","volume_storage","volume_flow_rate","illuminance","pressure","atmospheric_pressure","pm1","pm25","pm10","volatile_organic_compounds","volatile_organic_compounds_parts","carbon_monoxide","nitrogen_dioxide","moisture","sound_pressure"]),Vb=new Set(["m\xB3","m3","L","l","kWh","Wh","MWh","lx"]),Kb=new Set(["door","window","opening","garage_door","motion","occupancy","presence","smoke","moisture","gas","carbon_monoxide"]),jb=new Set(["battery","signal_strength","timestamp","date","duration","data_rate","data_size","frequency","enum"]);function Dt(t,e){let n=t.entities?.[e];return n&&(n.area_id||(n.device_id?t.devices?.[n.device_id]?.area_id:null))||null}var Vu=(t,e)=>{let n=t.entities?.[e];return!!(n?.hidden||n?.entity_category)},je=(t,e)=>Q(e)??io(e,t.states[e]);function Wu(t,e){let n=t.states[e];if(!n||Vu(t,e))return!1;if(io(e,n)!==null)return!0;let r=Q(e);if(!r)return!1;let i=n.attributes.device_class;return e.startsWith("event.")?!i||i==="button"||i==="doorbell":r==="sensor"?i?Wb.has(i):Vb.has(String(n.attributes.unit_of_measurement??"")):r==="binary"?i?Kb.has(i):!!t.entities?.[e]?.area_id:!0}function Ub(t,e){let n=t.states[e];return Q(e)!=="sensor"||!n?.attributes.unit_of_measurement||Vu(t,e)||jb.has(String(n.attributes.device_class??""))?!1:Number.isFinite(Number(n.state))||Ie(n)}var ao=(t,e)=>e.startsWith("sensor.")&&t.states[e]?.attributes.device_class==="power",Ys=null;no(()=>Ys=null);function Xs(t,e){let n=t.get(e);return n||t.set(e,n=[]),n}function Gb(t){let e=new Map,n=new Map,r=new Map,i=new Map,o=[],s=u=>{(Wu(t,u)||Ub(t,u))&&Ft(je(t,u))&&o.push(u)};for(let[u,d]of Object.entries(t.entities??{})){let p=d.device_id;p&&d.area_id&&(i.get(p)??i.set(p,new Set).get(p)).add(d.area_id),p&&ao(t,u)&&Xs(n,p).push(u),p&&!d.hidden&&!d.entity_category&&(r.get(p)??r.set(p,new Set).get(p)).add(Ps(u));let h=Dt(t,u);h===null?s(u):Wu(t,u)&&Xs(e,h).push(u)}if(t.entities)for(let u of Object.keys(t.states))t.entities[u]||s(u);let l=Ds.indexOf("binary")-.5,a=u=>{let d=Q(u),p=d?Ds.indexOf(d):l;return p>l&&io(u,t.states[u])!==null?l:p};o.sort((u,d)=>a(u)-a(d)||B(t,u).localeCompare(B(t,d)));for(let[u,d]of e){let p=t.areas?.[u]?.name;d.sort((h,f)=>a(h)-a(f)||B(t,h,p).localeCompare(B(t,f,p)))}let c=new Set;for(let[u,d]of i)d.size>1&&c.add(u);return{entities:t.entities,devices:t.devices,states:t.states,stateCount:Object.keys(t.states).length,byArea:e,powerByDevice:n,withoutArea:o,domainsByDevice:r,hubs:c}}function Dn(t){let e=Ys;return e&&e.entities===t.entities&&e.devices===t.devices&&(e.states===t.states||(e.states=t.states,Object.keys(t.states).length===e.stateCount))?e:Ys=Gb(t)}function ye(t,e){let n=so(t,e.area_id);return e.sub_areas?.length?[...new Set([...n,...e.sub_areas.flatMap(r=>so(t,r))])]:n}function so(t,e){return!e||!t.entities?[]:Dn(t).byArea.get(e)??[]}function Ku(t,e){if(!t.entities)return[];let n=[];for(let[r,i]of Dn(t).byArea){let o=i.filter(s=>Ft(je(t,s)));r!==e&&o.length>0&&n.push({areaId:r,name:t.areas?.[r]?.name??r,ids:o})}return n.sort((r,i)=>r.name.localeCompare(i.name))}var ju=t=>t.entities?Dn(t).withoutArea:[],Js=(t,e)=>!!t.entities&&Dn(t).hubs.has(e),lo=(t,e)=>t.entities?Dn(t).powerByDevice.get(e)??[]:[];function In(t,e){let n=new Map;for(let i of e)Xs(n,t.entities?.[i]?.device_id??`entity:${i}`).push(i);let r=new Map(e.map((i,o)=>[i,o]));return[...n.values()].map(i=>{let o=i.find(s=>!t.entities?.[s]?.name)??i[0];return{primary:o,others:i.filter(s=>s!==o)}}).sort((i,o)=>r.get(i.primary)-r.get(o.primary))}var co=(t,e)=>In(t,e).map(n=>n.primary),Zb={temperature:"temperature",humidity:"humidity",co2:"carbon_dioxide",illuminance:"illuminance"};function Qs(t,e,n,r=!1){let i=t.states[e]?.attributes;if(!i)return!1;let o=(i.symcon_variable_type===1||i.symcon_variable_type===2)&&typeof i.symcon_id=="number";if(typeof i.symcon_id=="number"&&!o||!o&&!/^(sensor|input_number|number)\./.test(e))return!1;if(r&&o)return!0;let s=String(i.unit_of_measurement??"").replace(/\s/g,"").toLowerCase();return n==="temperature"&&["\xB0c","\xB0f","\u2103","\u2109","k"].includes(s)||n==="humidity"&&!i.device_class&&["%","%rh","%r.h.","%rf","%r.f."].includes(s)||n==="co2"&&s==="ppm"&&/co[₂2]/i.test(String(i.friendly_name??""))||n==="illuminance"&&["lx","lux"].includes(s)?!0:i.device_class===Zb[n]}var qb=new Set(["climate","water_heater","switch","button","camera","media_player","vacuum","light","fan","lawn_mower"]),Yb=["vorlauf","r(\xFC|ue)cklauf","flow","return","d(\xFC|ue)se","nozzle","hotend","extruder","druckbett","heatbed","(^|[^a-z])bed($|[^a-z])","chamber","cpu","gpu","chip","soc","akku","batter","wasser","water","kessel","boiler","au(\xDF|ss)en","outdoor","outside","abgas","exhaust","sole","brine","verdampfer","kondensat","verdichter","compressor","motor","k(\xFC|ue)hl","freezer","fridge","gefrier"],Xb=new RegExp(`(${Yb.join("|")})`,"i");function ea(t,e){let n=t.entities?.[e]?.device_id,r=n&&!Js(t,n)?Dn(t).domainsByDevice.get(n):void 0;return r&&[...r].some(i=>qb.has(i))?!1:!Xb.test(`${e} ${t.states[e]?.attributes.friendly_name??""}`)}function Uu(t,e,n,r){let i=n.climate?.[r];if(i==="none")return[];if(i)return[i].flat().filter(c=>t.states[c]);let o=(e?.placements??[]).filter(c=>c.entity_id.startsWith("sensor.")),s=o.filter(c=>C([c.x,c.z],n.points)).map(c=>c.entity_id),l=new Set(o.filter(c=>!C([c.x,c.z],n.points)).map(c=>c.entity_id));return[...new Set([...ye(t,n).filter(c=>!l.has(c)),...s])].filter(c=>c.startsWith("sensor.")&&Qs(t,c,r)&&ea(t,c))}function Gu(t){let e=t.attributes;if(typeof e.symcon_numeric_value!="number")return null;let n=typeof e.symcon_min=="number"?e.symcon_min:0,r=typeof e.symcon_max=="number"&&e.symcon_max>n?e.symcon_max:100;return Math.max(0,Math.min(100,(e.symcon_numeric_value-n)/(r-n)*100))}function uo(t,e){let n=t?.states[e];if(!n)return!1;let r=n.attributes;return typeof r.symcon_id=="number"?r.symcon_variable_type===1||r.symcon_variable_type===2:typeof r.current_position=="number"||/^(sensor|number|input_number)\./.test(e)&&!!n.state.trim()&&Number.isFinite(Number(n.state))}function ho(t,e){let n=e?t.states[e]:void 0;if(!n||Ie(n))return null;let r=n.attributes;if(r.nf_cover_control&&typeof r.current_position=="number")return r.current_position;let i=Gu(n);if(i!==null)return i;if(typeof r.current_position=="number")return Math.max(0,Math.min(100,r.current_position));if(!n.state.trim())return null;let o=Number(n.state);if(!Number.isFinite(o))return null;let s=r.unit_of_measurement==="%"||o>1||o<0?o:o*100;return Math.max(0,Math.min(100,s))}var Jb=new Set([void 0,"shutter","blind","awning","shade","curtain","window"]),Qb=new Set(["garage","gate"]),ey=new Set(["window","opening"]);function Fr(t,e,n=!1){let r=new Map;return t.forEach((i,o)=>{let s=n&&e.length===1?e[0]:e[o];s&&r.set(i.id,s)}),r}var Zu=(t,e)=>t==="none"?null:t??e??null,It=t=>t&&t!=="none"?t:null;function Ot(t,e){let n=new Map;for(let r of e)for(let i of r.rooms){let o=r.openings.filter(g=>g.room_id===i.id).sort((g,b)=>g.edge-b.edge||g.offset-b.offset);if(o.length===0)continue;let s=ye(t,i),l=g=>t.states[g]?.attributes.device_class,a=g=>s.filter(b=>Q(b)==="binary"&&g(l(b)??"")),c=g=>o.filter(b=>b.type===g),u=Fr(c("window"),s.filter(g=>Q(g)==="cover"&&Jb.has(l(g))),!0),d=Fr(c("window"),a(g=>ey.has(g))),p=Fr(c("door"),a(g=>g==="door")),h=Fr(c("garage"),s.filter(g=>Q(g)==="cover"&&Qb.has(l(g)??""))),f=Fr(c("garage"),a(g=>g==="garage_door"));for(let g of o){let b=g.type==="window"?u:g.type==="garage"?h:null,y=g.type==="window"?d:g.type==="garage"?f:p,v=g.leaves===2;n.set(g.id,{cover:Zu(g.cover,b?.get(g.id)),contact:g.sensor==="handle"&&g.contact==null?null:Zu(g.contact,y.get(g.id)),tilt:g.tilt==="none"?null:g.tilt,contact2:v?It(g.contact2):null,tilt2:v?It(g.tilt2):null,position:It(g.position),positionInverted:!!g.position_inverted,tiltAngle:It(g.tilt_angle),tiltMax:g.tilt_max??null,tiltOffset:g.tilt_offset??null,tiltInvert:!!g.tilt_invert,shut:!!g.shut,angled:g.type==="door"&&!!g.open_angle,lock:g.type==="door"?It(g.lock):null,cover2:g.type==="garage"?null:It(g.cover2),coverTilt:It(g.cover_tilt),cover2Tilt:It(g.cover2_tilt),coverInverted:!!g.cover_inverted,coverTiltInverted:!!g.cover_tilt_inverted,cover2Inverted:!!g.cover2_inverted,cover2TiltInverted:!!g.cover2_tilt_inverted})}}return n}var ty=[[/^(tilted|tilt|gekippt|kipp)/i,"tilted"],[/^(open|opened|offen|geöffnet|on)$/i,"open"],[/^(closed|close|geschlossen|zu|off)$/i,"closed"]];function ta(t){if(!t||Ie(t))return null;let e=t.attributes.window_state;for(let n of[typeof e=="string"?e:"",t.state]){let r=n.trim(),i=r&&ty.find(([o])=>o.test(r));if(i)return i[1]}return null}var qu=new WeakMap,Yu=new WeakMap;function Xu(t,e){let n=Yu.get(t)??t,r=qu.get(n)??new WeakMap;qu.set(n,r);let i=r.get(e);if(i)return i;let o=new Map;for(let a of e)for(let c of a.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let a of Ot(n,e).values())a.cover&&!o.has(a.cover)&&o.set(a.cover,{tilt:a.coverTilt,position:a.position}),a.cover2&&!o.has(a.cover2)&&o.set(a.cover2,{tilt:a.cover2Tilt});let s={...n.states};for(let[a,c]of o){let u=n.states[a];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},p=ho(n,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(d.current_position=p);let h=c.tilt?n.states[c.tilt]:u,f=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?ho(n,c.tilt):null;f!==null&&(d.current_tilt_position=f,d.supported_features=Number(d.supported_features??0)|128);let g=u.state;typeof d.current_position=="number"&&g!=="unavailable"&&g!=="unknown"&&g!=="opening"&&g!=="closing"&&(g=d.current_position>0?"open":"closed"),s[a]={...u,state:g,attributes:d}}let l={...n,states:s,callService:async(a,c,u={})=>{if(a!=="cover")return n.callService(a,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async h=>{let f=typeof h=="string"?o.get(h):void 0;if(!f)return n.callService(a,c,{...u,entity_id:h});let g={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&f.tilt&&(g.entity_id=f.tilt);let v=f.tilt?n.states[f.tilt]:void 0;return y&&f.tilt&&!v?.attributes.symcon_id&&typeof v?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",g.position=g.tilt_position,delete g.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),n.callService(a,b,g)};return Array.isArray(u.entity_id)?Promise.all(d.map(p)):p(d[0])}};return Yu.set(l,n),r.set(e,l),l}var X=t=>t?.symconObjects!==void 0;function He(t,e,n=[0,1,2,3]){let r=t?.states[e]?.attributes;return!!r?.symcon_id&&!r.symcon_source_entity&&n.includes(Number(r.symcon_variable_type))}function on(t){return!t||t.state==="unknown"||t.state==="unavailable"?null:t.attributes.symcon_value??t.attributes.symcon_numeric_value??t.state}function Ht(t){let e=on(t);if(e===null||typeof e=="boolean"||e==="")return null;let n=Number(e);return Number.isFinite(n)?n:null}function Tr(t){let e=on(t);if(e===null)return null;if(typeof e=="boolean")return e;if(typeof e=="number")return e>0;let n=String(e).trim().toLowerCase();if(["on","true","1","home","open","an","ein","ja","regen","rain","wet","nass"].includes(n))return!0;if(["off","false","0","not_home","closed","aus","nein","trocken","dry"].includes(n))return!1;let r=Number(n);return n!==""&&Number.isFinite(r)?r>0:null}function na(t){return on(t)===null?"\u2013":String(t?.attributes.symcon_formatted??on(t))}function Ju(t,e){switch(e){case"m/s":return t*3.6;case"mph":return t*1.609;case"kn":return t*1.852;case"ft/s":return t*1.097;default:return t}}var Qu="weather.nextfloor_symcon",td={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},ed=new WeakMap;function ny(t){let e=t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function nd(t,e){if(!X(t))return t;let n=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(n).some(h=>h&&h!=="none"))return t;let r=ed.get(t)??new WeakMap;ed.set(t,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>n[h]&&n[h]!=="none"?t.states[n[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let f=s(h),g=Ht(f);g!==null&&(o[h]=h==="cloud_coverage"&&f?.attributes.symcon_max===1?g*100:g),f?.attributes.unit_of_measurement&&(o[`${h}_unit`]=f.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let f=s(h),g=Ht(f);g!==null&&(o[h]=Ju(g,f?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let l=on(s("wind_bearing"));l!==null&&(o.wind_bearing=l);let a=ny(na(s("condition"))),c=e.rain_sensor?t.states[e.rain_sensor]:void 0,u=Tr(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),Tr(s("lightning"))?a=u?"lightning-rainy":"lightning":Tr(s("snow"))?a=u?"snowy-rainy":"snowy":Tr(s("fog"))?a="fog":u===!0?a=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&a&&/rain|pouring/.test(a)&&(a=null),!a&&typeof o.cloud_coverage=="number"&&(a=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!a&&u===!1&&(a="sunny");let d={entity_id:Qu,state:a??"unknown",attributes:o},p={...t,states:{...t.states,[Qu]:d}};return r.set(e,p),p}var On={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},sn=t=>(...e)=>({_$litDirective$:t,values:e}),Lt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,r){this._$Ct=e,this._$AM=n,this._$Ci=r}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}};var zr=class extends Lt{constructor(e){if(super(e),this.it=_,e.type!==On.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===_||e==null)return this._t=void 0,this.it=e;if(e===tt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let n=[e];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};zr.directiveName="unsafeHTML",zr.resultType=1;var rd=sn(zr);var id=/\b(tv|fernseh|television|fire ?tv|apple ?tv|chromecast|shield)/i,od=/(kühl|fridge|gefrier|freezer)/i,sd=/(spülmaschine|geschirrspül|dishwasher)/i,ry=/(kochfeld|herd|induktion|cooktop)/i,iy={robot_vacuum:/(saug|vacuum|robo|roomba|roborock|dreame|ecovacs|deebot)/i,tv_board:id,tv_wall:id,desk:/\b(pc|computer|rechner|desktop|monitor|workstation)/i,fridge:od,fridge_smart:od,stove:/(herd|kochfeld|cooktop|stove|induktion)/i,kitchen_tall:/(backofen|oven|ofen)/i,dishwasher:sd,washer:/(waschmaschine|washer|washing)/i,dryer:/(trockner|dryer)/i,kitchen:/(kaffee|coffee|wasserkocher|kettle)/i,island:ry,sink:sd,radiator:/(heiz|radiator|thermostat|climate|hk|trv)/i},ad={lamp_ceiling:/(decke|ceiling|haupt|main)/i,lamp_downlight:/(spot|strahler|downlight|einbau)/i,lamp_spot:/(spot|strahler)/i,lamp_panel:/(panel|decke|ceiling)/i,lamp_uplight:/(fluter|uplight|steh)/i,lamp_bollard:/(weg|garten|garden|path|poller|außen|aussen|outdoor)/i,lamp_garden:/(garten|garden|spot|außen|aussen|outdoor|baum|tree)/i,lamp_pendant:/(pendel|pendant|hänge|esstisch|dining)/i,ceiling_fan:/(ventilator|fan)/i,lamp_floor:/(steh|floor)/i,lamp_table:/(tisch|nacht|table|bedside|lese|reading)/i,lamp_wall:/(wand|wall)/i,led_strip:/(led|strip|streifen|leiste|band)/i},ld=new Set(["tv_board","tv_wall"]);var Hn=t=>ld.has(t)||!!Jc(t),po=t=>!!G(t)?.electric&&/speaker|multiroom|soundbar/.test(t.split(":").pop()??t),Dr=t=>Hn(t)||t==="desk"||t==="fridge_smart",oy=t=>!!t&&t!=="none";function sy(t,e){if(ao(t,e))return e;let n=t.entities?.[e]?.device_id;return n?lo(t,n).find(r=>r!==e)??null:null}var ay=(t,e,n)=>t.rooms.find(r=>r.points.length>=3&&C([e,n],r.points));function Pr(t,e,n,r){return t.find(i=>e?.test(n(i)))??(r?t[0]??null:null)}function Me(t,e){let n=new Map;for(let r of e){let i=new Set([...r.furniture.flatMap(o=>[o.entity,o.power,o.fan_entity]),...r.placements.map(o=>o.entity_id)].filter(oy));for(let o of r.furniture){let s=o.type in ad,l=An(o.type),a=s?ad[o.type]:iy[o.type];if(!a&&!l&&!po(o.type)&&o.entity==null&&o.power==null)continue;let c=ay(r,o.x,o.z),u=(c?co(t,ye(t,c)):[]).filter(b=>!i.has(b)),d=b=>`${b} ${B(t,b)}`,p=b=>u.filter(y=>Q(y)===b),h=o.entity==="none"?null:o.entity??null;if(o.entity==null){if(o.type==="ceiling_fan"){let b=(c?ye(t,c):[]).filter(v=>!i.has(v)),y=new Set(b.filter(v=>Q(v)==="fan").map(v=>t.entities?.[v]?.device_id).filter(Boolean));h=b.find(v=>Q(v)==="light"&&y.has(t.entities?.[v]?.device_id))??Pr(p("light"),a,d,!1)}else if(s)h=Pr(p("light"),a,d,!0);else if(o.type==="robot_vacuum"){let b=c?.area_id??null;h=Object.keys(t.entities??{}).find(y=>y.startsWith("vacuum.")&&!i.has(y)&&Dt(t,y)===b)??null}else if(o.type==="radiator"||l)h=Pr(p("climate"),a,d,!0);else if(Hn(o.type)){let b=p("media");h=b.find(y=>t.states[y]?.attributes.device_class==="tv")??Pr(b,a,d,ld.has(o.type))}else if(po(o.type)){let b=p("media").filter(y=>t.states[y]?.attributes.device_class!=="tv");h=Pr(b,a,d,!1)??(b.length===1?b[0]:null)}else a&&(h=u.find(b=>["switch","media","fan"].includes(Q(b)??"")&&a.test(d(b)))??null);h&&i.add(h)}let f=o.power==="none"?null:o.power??null;o.power==null&&(f=h?sy(t,h):null,!f&&a&&c&&!s&&(f=ye(t,c).find(b=>ao(t,b)&&!i.has(b)&&a.test(d(b)))??null),f&&i.add(f));let g=null;if(o.type==="ceiling_fan"&&(g=o.fan_entity==="none"?null:o.fan_entity??null,o.fan_entity==null)){let b=(c?ye(t,c):[]).filter(v=>Q(v)==="fan"&&!i.has(v)),y=h?t.entities?.[h]?.device_id:void 0;g=(y?b.find(v=>t.entities?.[v]?.device_id===y):void 0)??b[0]??null,g&&i.add(g)}(h||f||g)&&n.set(o.id,{entity:h,power:f,...o.type==="ceiling_fan"?{fan:g}:{}})}}return n}var cd=t=>t==="fridge"||t==="fridge_smart"||/(fridge|freezer|kuehl|gefrier|chest_freezer)/.test(t.slice(t.lastIndexOf(":")+1));function ud(t,e,n=[]){let r=[];for(let i of e){let o=(l,a)=>i.rooms.some(c=>c.points.length>=3&&C([l,a],c.points)),s=Me(t,[i]);r.push(...i.placements.filter(l=>l.outside||!o(l.x,l.z)).map(l=>l.entity_id)),r.push(...i.furniture.filter(l=>!o(l.x,l.z)).flatMap(l=>[s.get(l.id)?.entity,s.get(l.id)?.power]));for(let l of i.outdoor??[])l.area_id&&r.push(...co(t,so(t,l.area_id))),r.push(l.pump_entity,l.temp_entity)}return[...new Set(r.filter(i=>!!i&&!!t.states[i]&&!n.includes(i)))]}function ly(t,e){return Math.min(...e.map((n,r)=>{let i=e[(r+1)%e.length],[o,s]=[i[0]-n[0],i[1]-n[1]],l=Math.min(1,Math.max(0,((t[0]-n[0])*o+(t[1]-n[1])*s)/(o*o+s*s||1)));return Math.hypot(t[0]-n[0]-o*l,t[1]-n[1]-s*l)}))}function hd(t,e,n=[]){let r=t.points;if(r.length<3||e.length===0)return[];let i=r.map(y=>y[0]),o=r.map(y=>y[1]),[s,l,a,c]=[Math.min(...i),Math.max(...i),Math.min(...o),Math.max(...o)],u=Math.min(l-s,c-a),d=Math.max(.1,Math.min(.25,u/8)),p=Math.min(.35,u/5),h=Math.min(.7,u/4),f=be(r),g=[];for(let y=s+d/2;y=p&&g.push({at:w,wallDistance:x})}g.length===0&&g.push({at:f,wallDistance:0});let b=[...n];return e.map(y=>{let v=Q(y)==="light",w=g[0].at,x=-1/0;for(let{at:M,wallDistance:A}of g){let T=b.length?Math.min(...b.map(P=>Math.hypot(M[0]-P[0],M[1]-P[1]))):3,F=Math.hypot(M[0]-f[0],M[1]-f[1]),L=Math.min(T,3)*2;Fx+1e-9&&(x=L,w=M)}let k=[Math.round(w[0]*100)/100,Math.round(w[1]*100)/100];return b.push(k),{entity_id:y,x:k[0],z:k[1],y:null,mount:null}})}var dd=/(^|_)(current_room|current_segment|aktueller_raum|current_area)($|_)/;function pd(t,e,n){if(n==="none")return null;if(n)return n;let r=e?t.entities?.[e]?.device_id:null;return!r||!t.entities?null:Object.values(t.entities).find(o=>o.device_id===r&&o.entity_id.startsWith("sensor.")&&(dd.test(o.translation_key??"")||dd.test(o.entity_id.split(".")[1])))?.entity_id??null}var me=t=>/^(sensor|input_number|number)\./.test(t),fo=t=>/^(binary_sensor|input_boolean)\./.test(t);function Ln(t,e){if(!me(e))return!1;let n=t?.states[e]?.attributes;return n?.device_class==="power"||n?.unit_of_measurement==="W"||n?.unit_of_measurement==="kW"}function cy(t,e){let n=t?.entities?.[e],r=n?.area_id??(n?.device_id?t?.devices?.[n.device_id]?.area_id:null);return r?t?.areas?.[r]?.name:void 0}function O(t,e){return Object.keys(t?.states??{}).filter(e).map(n=>{let r=cy(t,n),i=t?.states[n],o=typeof i?.attributes.symcon_path=="string"?i.attributes.symcon_path:void 0,s={id:n,label:r?`${B(t,n)} \xB7 ${r}`:B(t,n)};return o&&(s.detail=`Objektbaum: ${o}`),typeof i?.attributes.symcon_source_entity=="string"&&(s.sourceEntity=i.attributes.symcon_source_entity),s}).sort((n,r)=>n.label.localeCompare(r.label))}function fd(t,e,n){return e.unsupported?[]:O(t,r=>He(t,r,e.types)&&!e.excluded?.(r)).map(r=>{if(!e.role)return r;let i=t.states[r.id],o=`${e.role}.${i.attributes.symcon_id}`,s=n?t.states[n]:void 0,l=n&&(n===r.id||s?.attributes.symcon_source_entity===r.id)?n:t.states[o]?o:r.id;return l===r.id?r:{...r,id:l,sourceEntity:r.id}})}function mo(t,e){return t.power&&t.power!=="none"?t.power:e.get(t.id)?.power??null}var ve=ee` :host { --nf-text: var(--primary-text-color, #e1e1e1); --nf-muted: var(--secondary-text-color, #9b9b9b); @@ -29,7 +29,7 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f font-family: var(--nf-font); color: var(--nf-text); } -`,nS=ee` +`,lS=ee` :host([readable]) { --secondary-text-color: var(--primary-text-color, #e1e1e1); --divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent); @@ -203,7 +203,7 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f min-height: 40px; } } -`;var{I:oy}=Lc,hd=t=>t;var fd=t=>t.strings===void 0,pd=()=>document.createComment(""),Ln=(t,e,n)=>{let r=t._$AA.parentNode,i=e===void 0?t._$AB:e._$AA;if(n===void 0){let o=r.insertBefore(pd(),i),s=r.insertBefore(pd(),i);n=new oy(o,s,t,t.options)}else{let o=n._$AB.nextSibling,s=n._$AM,l=s!==t;if(l){let a;n._$AQ?.(t),n._$AM=t,n._$AP!==void 0&&(a=t._$AU)!==s._$AU&&n._$AP(a)}if(o!==i||l){let a=n._$AA;for(;a!==o;){let c=hd(a).nextSibling;hd(r).insertBefore(a,i),a=c}}}return n},Ct=(t,e,n=t)=>(t._$AI(e,n),t),sy={},md=(t,e=sy)=>t._$AH=e,gd=t=>t._$AH,fo=t=>{t._$AR(),t._$AA.remove()};var _d=(t,e,n)=>{let r=new Map;for(let i=e;i<=n;i++)r.set(t[i],i);return r},Pr=sn(class extends Lt{constructor(t){if(super(t),t.type!==In.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let r;n===void 0?n=e:e!==void 0&&(r=e);let i=[],o=[],s=0;for(let l of t)i[s]=r?r(l,s):s,o[s]=n(l,s),s++;return{values:o,keys:i}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,r]){let i=gd(t),{values:o,keys:s}=this.dt(e,n,r);if(!Array.isArray(i))return this.ut=s,o;let l=this.ut??=[],a=[],c,u,d=0,p=i.length-1,h=0,f=o.length-1;for(;d<=p&&h<=f;)if(i[d]===null)d++;else if(i[p]===null)p--;else if(l[d]===s[h])a[h]=Ct(i[d],o[h]),d++,h++;else if(l[p]===s[f])a[f]=Ct(i[p],o[f]),p--,f--;else if(l[d]===s[f])a[f]=Ct(i[d],o[f]),Ln(t,a[f+1],i[d]),d++,f--;else if(l[p]===s[h])a[h]=Ct(i[p],o[h]),Ln(t,i[d],i[p]),p--,h++;else if(c===void 0&&(c=_d(s,h,f),u=_d(l,d,p)),c.has(l[d]))if(c.has(l[p])){let g=u.get(s[h]),b=g!==void 0?i[g]:null;if(b===null){let y=Ln(t,i[d]);Ct(y,o[h]),a[h]=y}else a[h]=Ct(b,o[h]),Ln(t,i[d],b),i[g]=null;h++}else fo(i[p]),p--;else fo(i[d]),d++;for(;h<=f;){let g=Ln(t,a[f+1]);Ct(g,o[h]),a[h++]=g}for(;d<=p;){let g=i[d++];g!==null&&fo(g)}return this.ut=s,md(t,a),tt}});var ay=new Intl.Collator("de",{numeric:!0,sensitivity:"base"}),ta=-1,yd=[{type:1,name:"I/O"},{type:2,name:"Splitter"},{type:0,name:"Kerninstanzen"},{type:4,name:"Konfiguratoren"},{type:5,name:"Discovery"},{type:6,name:"Visualisierungen"}],bd=t=>t.object_type===1&&yd.some(e=>e.type===t.module_type);function ly(t){let e=new Map(t.map(a=>[a.object_id,a])),n=t.filter(a=>{if(!bd(a))return!1;let c=new Set([a.object_id]),u=e.get(a.parent_id);for(;u&&!c.has(u.object_id);){if(bd(u))return!1;c.add(u.object_id),u=e.get(u.parent_id)}return!0});if(!n.length)return t;let r=new Map(e),i=new Map;for(let a of t){let c=i.get(a.parent_id)??[];c.push(a),i.set(a.parent_id,c)}let o=(a,c,u,d,p)=>({object_id:a,parent_id:c,name:u,path:d,position:p,object_type:0,hidden:!1,icon:"",virtual:!0});r.set(ta,o(ta,0,"System","System",Number.MAX_SAFE_INTEGER));let s=new Set,l=(a,c,u)=>{if(s.has(a.object_id))return;s.add(a.object_id);let d={...a,parent_id:c,path:`${u} / ${a.name}`};r.set(a.object_id,d);for(let p of i.get(a.object_id)??[])l(p,a.object_id,d.path)};return yd.forEach((a,c)=>{let u=n.filter(h=>h.module_type===a.type);if(!u.length)return;let d=-10-a.type,p=`System / ${a.name}`;r.set(d,o(d,ta,a.name,p,c));for(let h of u)l(h,d,p)}),[...r.values()]}function na(t){let e=ly(t),n=new Map(e.map(i=>[i.object_id,i])),r=new Map;for(let i of e){let o=n.has(i.parent_id)?i.parent_id:0,s=r.get(o)??[];s.push(i),r.set(o,s)}for(let i of r.values())i.sort((o,s)=>o.position-s.position||o.object_type-s.object_type||ay.compare(o.name,s.name));return{nodes:n,children:r}}function ra(t,e){let n=[],r=new Set([e]),i=t.nodes.get(e)?.parent_id;for(;i&&!r.has(i)&&t.nodes.has(i);)n.push(i),r.add(i),i=t.nodes.get(i)?.parent_id;return n}function ia(t,e,n=""){let r=n.trim().toLocaleLowerCase("de").split(/\s+/).filter(Boolean),i=r.length?new Set:null;if(i){for(let a of t.nodes.values())if(r.every(c=>`${a.name} ${a.path}`.toLocaleLowerCase("de").includes(c))){i.add(a.object_id);for(let c of ra(t,a.object_id))i.add(c)}}let o=[],s=new Set,l=(a,c)=>{let u=(t.children.get(a)??[]).filter(d=>!i||i.has(d.object_id));u.forEach((d,p)=>{if(s.has(d.object_id))return;s.add(d.object_id);let h=(t.children.get(d.object_id)?.length??0)>0,f=h&&(!!i||e.has(d.object_id));o.push({node:d,depth:c,hasChildren:h,expanded:f,index:p+1,siblings:u.length}),f&&l(d.object_id,c+1)})};return l(0,0),o}var vd=["Boolean","Integer","Float","String"],cy={light:"Licht",cover:"Jalousie/Tor",switch:"Schalter",binary_sensor:"Bin\xE4rsensor",sensor:"Sensor",climate:"Heizung",lock:"Schloss",script:"Skript",schedule:"Schaltuhr",media_player:"Medienger\xE4t",fan:"L\xFCfter"};function wd(t,e={}){if(t.virtual||t.object_type===0)return"Das ist eine Kategorie. Klappe sie auf und w\xE4hle den Datenpunkt darunter aus.";if(t.object_type===1)return"Das ist eine Instanz. Klappe sie auf und w\xE4hle ihre Variable aus, zum Beispiel \u201EValue\u201C.";if(e.schedule&&t.object_type!==4)return"Hier wird eine klassische Symcon-Schaltuhr (Wochenplan-Ereignis) erwartet, keine Variable.";if(e.unsupported)return e.unsupported;if(!t.entity_id)return t.object_type===2?"Diese Variable wurde noch nicht geladen. Lade die Variablen oben in der Titelleiste neu und \xF6ffne die Auswahl erneut.":t.object_type===6?"Dieser Link verweist auf keinen unterst\xFCtzten Datenpunkt. W\xE4hle die Variable direkt im Objektbaum aus.":t.object_type===4?"Dieses Ereignis ist keine unterst\xFCtzte klassische Symcon-Schaltuhr (Wochenplan).":"Dieser Objekttyp kann in diesem Feld nicht verkn\xFCpft werden. W\xE4hle eine passende Variable aus.";let n=e.states?.[t.entity_id];if(e.states&&!n)return"Diese Variable ist im aktuellen Datenbestand nicht mehr vorhanden. Lade die Variablen oben in der Titelleiste neu.";let r=n?.attributes.symcon_variable_type,i=r===void 0?void 0:vd[Number(r)];if(n&&!n.attributes.symcon_schedule&&!i)return"Der native Datentyp dieser Variable ist nicht verf\xFCgbar. Lade die Variablen oben in der Titelleiste neu.";if(i&&e.types&&!e.types.includes(Number(r)))return`Datentyp ${i} passt hier nicht. F\xFCr \u201E${e.label||"dieses Feld"}\u201C wird ${e.types.map(c=>vd[c]).join(" oder ")} ben\xF6tigt.`;let o=e.excluded?.(t.entity_id);if(o)return o;let s=cy[t.entity_id.split(".")[0]],l=n?.attributes.unit_of_measurement,a=[i&&`Datentyp: ${i}`,l&&`Einheit: ${l}`,s&&`erkannte Funktion: ${s}`].filter(Boolean).join(" \xB7 ");return`Dieser Datenpunkt erf\xFCllt den Filter${e.label?` f\xFCr \u201E${e.label}\u201C`:" dieses Feldes"} nicht.${a?` ${a}.`:""}`}var uy=["Kategorie","Instanz","Variable","Skript","Ereignis","Medium","Link"],oa=class extends Y{static properties={objects:{attribute:!1},options:{attribute:!1},fixed:{attribute:!1},value:{attribute:!1},disabled:{type:Boolean},placeholder:{attribute:!1},context:{attribute:!1},_notice:{state:!0},_query:{state:!0},_expanded:{state:!0},_pending:{state:!0},_active:{state:!0},_selected:{state:!0}};tree=na([]);allowed=new Map;allowedSources=new Map;constructor(){super(),this.objects=[],this.options=[],this.fixed=[],this.value=null,this.disabled=!1,this.placeholder="Datenpunkt ausw\xE4hlen",this._notice="",this._query="",this._expanded=new Set,this._pending=null,this._active=null,this._selected=null}willUpdate(e){e.has("objects")&&(this.tree=na(this.objects)),(e.has("options")||e.has("fixed"))&&(this.allowed=new Map([...this.fixed,...this.options].map(n=>[n.id,n])),this.allowedSources=new Map(this.options.filter(n=>n.sourceEntity).map(n=>[n.sourceEntity,n.id])))}get dialog(){return this.renderRoot.querySelector("dialog")}variableNode(e){let n=this.allowed.get(e??"")?.sourceEntity??e,r=this.objects.find(i=>i.entity_id===n&&(i.object_type===2||i.object_type===4));return r?this.tree.nodes.get(r.object_id):void 0}async open(){if(this.disabled)return;this._pending=this.allowed.has(this.value??"")?this.value:null,this._query="",this._notice="";let e=this.variableNode(this.value)??this.objects.find(r=>r.entity_id===this.value);this._active=e?.object_id??null,this._selected=e?.object_id??null;let n=new Set(this._expanded);if(e)for(let r of ra(this.tree,e.object_id))n.add(r);this._expanded=n,await this.updateComplete,this.isConnected&&(this.dialog?.open||this.dialog?.showModal(),this.renderRoot.querySelector(".search")?.focus(),this.renderRoot.querySelector("[aria-selected=true]")?.scrollIntoView({block:"nearest"}))}close(){this.dialog?.close()}clear(e){e.preventDefault(),e.stopPropagation(),!this.disabled&&(this.value=this.fixed.some(n=>n.id==="none")?"none":null,this._pending=this.value,this._selected=null,this._active=null,this.close(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})))}commit(){this.disabled||!this._pending||!this.allowed.has(this._pending)||(this.value=this._pending,this.close(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})))}toggle(e){let n=new Set(this._expanded);n.has(e)?n.delete(e):n.add(e),this._expanded=n}select(e){this._active=e.object_id;let n=this.entityFor(e);n?(this._pending=n,this._selected=e.object_id,this._notice=""):(this._pending=null,this._selected=null,this._notice=wd(e,this.context))}entityFor(e){if(e.entity_id)return this.allowed.has(e.entity_id)?e.entity_id:this.allowedSources.get(e.entity_id)}async onTreeKey(e){let n=ia(this.tree,this._expanded,this._query),r=Math.max(0,n.findIndex(s=>s.node.object_id===this._active)),i=n[r];if(!i)return;let o=r;if(e.key==="ArrowDown")o=Math.min(n.length-1,r+1);else if(e.key==="ArrowUp")o=Math.max(0,r-1);else if(e.key==="Home")o=0;else if(e.key==="End")o=n.length-1;else if(e.key==="ArrowRight")i.hasChildren&&!i.expanded?this.toggle(i.node.object_id):i.hasChildren&&(o=Math.min(n.length-1,r+1));else if(e.key==="ArrowLeft")i.expanded&&!this._query?this.toggle(i.node.object_id):o=Math.max(0,n.findIndex(s=>s.node.object_id===i.node.parent_id));else if(e.key===" "||e.key==="Enter")this.select(i.node),e.key==="Enter"&&this.entityFor(i.node)&&this.commit();else return;e.preventDefault(),(o!==r||this._active===null)&&(this._active=n[o].node.object_id),await this.updateComplete,this.renderRoot.querySelector(`#object-${this._active}`)?.scrollIntoView({block:"nearest"})}icon(e){let n=[R``,R``,R``,R``,R``,R``,R``];return R``}renderRow(e){let{node:n}=e,r=this.entityFor(n),i=!!r;return m`
    t;var _d=t=>t.strings===void 0,gd=()=>document.createComment(""),Cn=(t,e,n)=>{let r=t._$AA.parentNode,i=e===void 0?t._$AB:e._$AA;if(n===void 0){let o=r.insertBefore(gd(),i),s=r.insertBefore(gd(),i);n=new uy(o,s,t,t.options)}else{let o=n._$AB.nextSibling,s=n._$AM,l=s!==t;if(l){let a;n._$AQ?.(t),n._$AM=t,n._$AP!==void 0&&(a=t._$AU)!==s._$AU&&n._$AP(a)}if(o!==i||l){let a=n._$AA;for(;a!==o;){let c=md(a).nextSibling;md(r).insertBefore(a,i),a=c}}}return n},Ct=(t,e,n=t)=>(t._$AI(e,n),t),dy={},bd=(t,e=dy)=>t._$AH=e,yd=t=>t._$AH,go=t=>{t._$AR(),t._$AA.remove()};var vd=(t,e,n)=>{let r=new Map;for(let i=e;i<=n;i++)r.set(t[i],i);return r},an=sn(class extends Lt{constructor(t){if(super(t),t.type!==On.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let r;n===void 0?n=e:e!==void 0&&(r=e);let i=[],o=[],s=0;for(let l of t)i[s]=r?r(l,s):s,o[s]=n(l,s),s++;return{values:o,keys:i}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,r]){let i=yd(t),{values:o,keys:s}=this.dt(e,n,r);if(!Array.isArray(i))return this.ut=s,o;let l=this.ut??=[],a=[],c,u,d=0,p=i.length-1,h=0,f=o.length-1;for(;d<=p&&h<=f;)if(i[d]===null)d++;else if(i[p]===null)p--;else if(l[d]===s[h])a[h]=Ct(i[d],o[h]),d++,h++;else if(l[p]===s[f])a[f]=Ct(i[p],o[f]),p--,f--;else if(l[d]===s[f])a[f]=Ct(i[d],o[f]),Cn(t,a[f+1],i[d]),d++,f--;else if(l[p]===s[h])a[h]=Ct(i[p],o[h]),Cn(t,i[d],i[p]),p--,h++;else if(c===void 0&&(c=vd(s,h,f),u=vd(l,d,p)),c.has(l[d]))if(c.has(l[p])){let g=u.get(s[h]),b=g!==void 0?i[g]:null;if(b===null){let y=Cn(t,i[d]);Ct(y,o[h]),a[h]=y}else a[h]=Ct(b,o[h]),Cn(t,i[d],b),i[g]=null;h++}else go(i[p]),p--;else go(i[d]),d++;for(;h<=f;){let g=Cn(t,a[f+1]);Ct(g,o[h]),a[h++]=g}for(;d<=p;){let g=i[d++];g!==null&&go(g)}return this.ut=s,bd(t,a),tt}});var hy=new Intl.Collator("de",{numeric:!0,sensitivity:"base"}),ra=-1,kd=[{type:1,name:"I/O"},{type:2,name:"Splitter"},{type:0,name:"Kerninstanzen"},{type:4,name:"Konfiguratoren"},{type:5,name:"Discovery"},{type:6,name:"Visualisierungen"}],wd=t=>t.object_type===1&&kd.some(e=>e.type===t.module_type);function py(t){let e=new Map(t.map(a=>[a.object_id,a])),n=t.filter(a=>{if(!wd(a))return!1;let c=new Set([a.object_id]),u=e.get(a.parent_id);for(;u&&!c.has(u.object_id);){if(wd(u))return!1;c.add(u.object_id),u=e.get(u.parent_id)}return!0});if(!n.length)return t;let r=new Map(e),i=new Map;for(let a of t){let c=i.get(a.parent_id)??[];c.push(a),i.set(a.parent_id,c)}let o=(a,c,u,d,p)=>({object_id:a,parent_id:c,name:u,path:d,position:p,object_type:0,hidden:!1,icon:"",virtual:!0});r.set(ra,o(ra,0,"System","System",Number.MAX_SAFE_INTEGER));let s=new Set,l=(a,c,u)=>{if(s.has(a.object_id))return;s.add(a.object_id);let d={...a,parent_id:c,path:`${u} / ${a.name}`};r.set(a.object_id,d);for(let p of i.get(a.object_id)??[])l(p,a.object_id,d.path)};return kd.forEach((a,c)=>{let u=n.filter(h=>h.module_type===a.type);if(!u.length)return;let d=-10-a.type,p=`System / ${a.name}`;r.set(d,o(d,ra,a.name,p,c));for(let h of u)l(h,d,p)}),[...r.values()]}function ia(t){let e=py(t),n=new Map(e.map(i=>[i.object_id,i])),r=new Map;for(let i of e){let o=n.has(i.parent_id)?i.parent_id:0,s=r.get(o)??[];s.push(i),r.set(o,s)}for(let i of r.values())i.sort((o,s)=>o.position-s.position||o.object_type-s.object_type||hy.compare(o.name,s.name));return{nodes:n,children:r}}function oa(t,e){let n=[],r=new Set([e]),i=t.nodes.get(e)?.parent_id;for(;i&&!r.has(i)&&t.nodes.has(i);)n.push(i),r.add(i),i=t.nodes.get(i)?.parent_id;return n}function sa(t,e,n=""){let r=n.trim().toLocaleLowerCase("de").split(/\s+/).filter(Boolean),i=r.length?new Set:null;if(i){for(let a of t.nodes.values())if(r.every(c=>`${a.name} ${a.path}`.toLocaleLowerCase("de").includes(c))){i.add(a.object_id);for(let c of oa(t,a.object_id))i.add(c)}}let o=[],s=new Set,l=(a,c)=>{let u=(t.children.get(a)??[]).filter(d=>!i||i.has(d.object_id));u.forEach((d,p)=>{if(s.has(d.object_id))return;s.add(d.object_id);let h=(t.children.get(d.object_id)?.length??0)>0,f=h&&(!!i||e.has(d.object_id));o.push({node:d,depth:c,hasChildren:h,expanded:f,index:p+1,siblings:u.length}),f&&l(d.object_id,c+1)})};return l(0,0),o}var xd=["Boolean","Integer","Float","String"],fy={light:"Licht",cover:"Jalousie/Tor",switch:"Schalter",binary_sensor:"Bin\xE4rsensor",sensor:"Sensor",climate:"Heizung",lock:"Schloss",script:"Skript",schedule:"Schaltuhr",media_player:"Medienger\xE4t",fan:"L\xFCfter"};function $d(t,e={}){if(t.virtual||t.object_type===0)return"Das ist eine Kategorie. Klappe sie auf und w\xE4hle den Datenpunkt darunter aus.";if(t.object_type===1)return"Das ist eine Instanz. Klappe sie auf und w\xE4hle ihre Variable aus, zum Beispiel \u201EValue\u201C.";if(e.schedule&&t.object_type!==4)return"Hier wird eine klassische Symcon-Schaltuhr (Wochenplan-Ereignis) erwartet, keine Variable.";if(e.unsupported)return e.unsupported;if(!t.entity_id)return t.object_type===2?"Diese Variable wurde noch nicht geladen. Lade die Variablen oben in der Titelleiste neu und \xF6ffne die Auswahl erneut.":t.object_type===6?"Dieser Link verweist auf keinen unterst\xFCtzten Datenpunkt. W\xE4hle die Variable direkt im Objektbaum aus.":t.object_type===4?"Dieses Ereignis ist keine unterst\xFCtzte klassische Symcon-Schaltuhr (Wochenplan).":"Dieser Objekttyp kann in diesem Feld nicht verkn\xFCpft werden. W\xE4hle eine passende Variable aus.";let n=e.states?.[t.entity_id];if(e.states&&!n)return"Diese Variable ist im aktuellen Datenbestand nicht mehr vorhanden. Lade die Variablen oben in der Titelleiste neu.";let r=n?.attributes.symcon_variable_type,i=r===void 0?void 0:xd[Number(r)];if(n&&!n.attributes.symcon_schedule&&!i)return"Der native Datentyp dieser Variable ist nicht verf\xFCgbar. Lade die Variablen oben in der Titelleiste neu.";if(i&&e.types&&!e.types.includes(Number(r)))return`Datentyp ${i} passt hier nicht. F\xFCr \u201E${e.label||"dieses Feld"}\u201C wird ${e.types.map(c=>xd[c]).join(" oder ")} ben\xF6tigt.`;let o=e.excluded?.(t.entity_id);if(o)return o;let s=fy[t.entity_id.split(".")[0]],l=n?.attributes.unit_of_measurement,a=[i&&`Datentyp: ${i}`,l&&`Einheit: ${l}`,s&&`erkannte Funktion: ${s}`].filter(Boolean).join(" \xB7 ");return`Dieser Datenpunkt erf\xFCllt den Filter${e.label?` f\xFCr \u201E${e.label}\u201C`:" dieses Feldes"} nicht.${a?` ${a}.`:""}`}var my=["Kategorie","Instanz","Variable","Skript","Ereignis","Medium","Link"],aa=class extends Y{static properties={objects:{attribute:!1},options:{attribute:!1},fixed:{attribute:!1},value:{attribute:!1},disabled:{type:Boolean},placeholder:{attribute:!1},context:{attribute:!1},_notice:{state:!0},_query:{state:!0},_expanded:{state:!0},_pending:{state:!0},_active:{state:!0},_selected:{state:!0}};tree=ia([]);allowed=new Map;allowedSources=new Map;constructor(){super(),this.objects=[],this.options=[],this.fixed=[],this.value=null,this.disabled=!1,this.placeholder="Datenpunkt ausw\xE4hlen",this._notice="",this._query="",this._expanded=new Set,this._pending=null,this._active=null,this._selected=null}willUpdate(e){e.has("objects")&&(this.tree=ia(this.objects)),(e.has("options")||e.has("fixed"))&&(this.allowed=new Map([...this.fixed,...this.options].map(n=>[n.id,n])),this.allowedSources=new Map(this.options.filter(n=>n.sourceEntity).map(n=>[n.sourceEntity,n.id])))}get dialog(){return this.renderRoot.querySelector("dialog")}variableNode(e){let n=this.allowed.get(e??"")?.sourceEntity??e,r=this.objects.find(i=>i.entity_id===n&&(i.object_type===2||i.object_type===4));return r?this.tree.nodes.get(r.object_id):void 0}async open(){if(this.disabled)return;this._pending=this.allowed.has(this.value??"")?this.value:null,this._query="",this._notice="";let e=this.variableNode(this.value)??this.objects.find(r=>r.entity_id===this.value);this._active=e?.object_id??null,this._selected=e?.object_id??null;let n=new Set(this._expanded);if(e)for(let r of oa(this.tree,e.object_id))n.add(r);this._expanded=n,await this.updateComplete,this.isConnected&&(this.dialog?.open||this.dialog?.showModal(),this.renderRoot.querySelector(".search")?.focus(),this.renderRoot.querySelector("[aria-selected=true]")?.scrollIntoView({block:"nearest"}))}close(){this.dialog?.close()}clear(e){e.preventDefault(),e.stopPropagation(),!this.disabled&&(this.value=this.fixed.some(n=>n.id==="none")?"none":null,this._pending=this.value,this._selected=null,this._active=null,this.close(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})))}commit(){this.disabled||!this._pending||!this.allowed.has(this._pending)||(this.value=this._pending,this.close(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})))}toggle(e){let n=new Set(this._expanded);n.has(e)?n.delete(e):n.add(e),this._expanded=n}select(e){this._active=e.object_id;let n=this.entityFor(e);n?(this._pending=n,this._selected=e.object_id,this._notice=""):(this._pending=null,this._selected=null,this._notice=$d(e,this.context))}entityFor(e){if(e.entity_id)return this.allowed.has(e.entity_id)?e.entity_id:this.allowedSources.get(e.entity_id)}async onTreeKey(e){let n=sa(this.tree,this._expanded,this._query),r=Math.max(0,n.findIndex(s=>s.node.object_id===this._active)),i=n[r];if(!i)return;let o=r;if(e.key==="ArrowDown")o=Math.min(n.length-1,r+1);else if(e.key==="ArrowUp")o=Math.max(0,r-1);else if(e.key==="Home")o=0;else if(e.key==="End")o=n.length-1;else if(e.key==="ArrowRight")i.hasChildren&&!i.expanded?this.toggle(i.node.object_id):i.hasChildren&&(o=Math.min(n.length-1,r+1));else if(e.key==="ArrowLeft")i.expanded&&!this._query?this.toggle(i.node.object_id):o=Math.max(0,n.findIndex(s=>s.node.object_id===i.node.parent_id));else if(e.key===" "||e.key==="Enter")this.select(i.node),e.key==="Enter"&&this.entityFor(i.node)&&this.commit();else return;e.preventDefault(),(o!==r||this._active===null)&&(this._active=n[o].node.object_id),await this.updateComplete,this.renderRoot.querySelector(`#object-${this._active}`)?.scrollIntoView({block:"nearest"})}icon(e){let n=[R``,R``,R``,R``,R``,R``,R``];return R``}renderRow(e){let{node:n}=e,r=this.entityFor(n),i=!!r;return m`
    ${this.icon(n.object_type)}${n.name||"(Ohne Namen)"} - ${n.virtual?"Systembereich":uy[n.object_type]??"Objekt"}${n.hidden?" \xB7 ausgeblendet":""} + ${n.virtual?"Systembereich":my[n.object_type]??"Objekt"}${n.hidden?" \xB7 ausgeblendet":""} ${i&&n.object_id===this._selected&&r===this._pending?m``:_} -
    `}render(){let e=this.allowed.get(this.value??""),n=this.variableNode(this.value),r=this.allowed.get(this._pending??""),i=this._selected===null?void 0:this.tree.nodes.get(this._selected),o=(i&&this.entityFor(i)===this._pending?i:void 0)??this.variableNode(this._pending),s=ia(this.tree,this._expanded,this._query),l=s.find(c=>c.node.object_id===this._active),a=!!this.value&&!this.fixed.some(c=>c.id===this.value);return m`
    `}render(){let e=this.allowed.get(this.value??""),n=this.variableNode(this.value),r=this.allowed.get(this._pending??""),i=this._selected===null?void 0:this.tree.nodes.get(this._selected),o=(i&&this.entityFor(i)===this._pending?i:void 0)??this.variableNode(this._pending),s=sa(this.tree,this._expanded,this._query),l=s.find(c=>c.node.object_id===this._active),a=!!this.value&&!this.fixed.some(c=>c.id===this.value);return m`
    ${a?m``:_}
    @@ -234,7 +234,7 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f `)}
    `:_}
    - ${Pr(s,c=>c.node.object_id,c=>this.renderRow(c))} + ${an(s,c=>c.node.object_id,c=>this.renderRow(c))} ${s.length?_:m`

    ${this.objects.length?"Keine Objekte gefunden.":"Kein Objektbaum verf\xFCgbar. Bitte das Symcon-Modul aktualisieren und den Designer neu laden."}

    `}
    ${this._notice?m`
    ${this._notice}
    `:_} @@ -294,7 +294,7 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f .tree { margin:0 8px; } .node { gap:6px; padding-left:calc(2px + var(--depth)*18px); } .node small { display:none; } footer { padding:12px; flex-direction:column; align-items:stretch; } .actions { justify-content:flex-end; } } - `]};customElements.get("nf-symcon-object-picker")||customElements.define("nf-symcon-object-picker",oa);var kd=40,sa=class extends Y{static properties={options:{attribute:!1},objectTree:{attribute:!1},context:{attribute:!1},fixed:{attribute:!1},value:{attribute:!1},disabled:{type:Boolean},placeholder:{attribute:!1},_query:{state:!0},_open:{state:!0},_cursor:{state:!0}};blurTimer;constructor(){super(),this.options=[],this.objectTree=void 0,this.fixed=[],this.value=null,this.disabled=!1,this.placeholder="",this._query="",this._open=!1,this._cursor=0}get current(){return[...this.fixed,...this.options].find(e=>e.id===this.value)}get hits(){let e=this._query.trim().toLowerCase(),n=e.split(/\s+/).filter(Boolean),r=s=>{let l=`${s.label} ${s.detail??s.id}`.toLowerCase();return n.every(a=>l.includes(a))},i=this.fixed.filter(s=>!e||r(s)),o=e?this.options.filter(r):this.options;return[...i,...o.slice(0,kd)]}get leftOut(){let e=this._query.trim().toLowerCase(),n=e.split(/\s+/).filter(Boolean),r=e?this.options.filter(i=>n.every(o=>`${i.label} ${i.detail??i.id}`.toLowerCase().includes(o))).length:this.options.length;return Math.max(0,r-kd)}choose(e){this.value=e,this._query="",this._open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0}))}onKey(e){let n=this.hits;e.key==="ArrowDown"?(this._open=!0,this._cursor=Math.min(n.length-1,this._cursor+1),e.preventDefault()):e.key==="ArrowUp"?(this._cursor=Math.max(0,this._cursor-1),e.preventDefault()):e.key==="Enter"?(this._open&&n[this._cursor]&&this.choose(n[this._cursor].id),e.preventDefault()):e.key==="Escape"&&(this._open=!1,this._query="")}render(){if(this.objectTree!==void 0)return m`e.id===this.value)}get hits(){let e=this._query.trim().toLowerCase(),n=e.split(/\s+/).filter(Boolean),r=s=>{let l=`${s.label} ${s.detail??s.id}`.toLowerCase();return n.every(a=>l.includes(a))},i=this.fixed.filter(s=>!e||r(s)),o=e?this.options.filter(r):this.options;return[...i,...o.slice(0,Sd)]}get leftOut(){let e=this._query.trim().toLowerCase(),n=e.split(/\s+/).filter(Boolean),r=e?this.options.filter(i=>n.every(o=>`${i.label} ${i.detail??i.id}`.toLowerCase().includes(o))).length:this.options.length;return Math.max(0,r-Sd)}choose(e){this.value=e,this._query="",this._open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0}))}onKey(e){let n=this.hits;e.key==="ArrowDown"?(this._open=!0,this._cursor=Math.min(n.length-1,this._cursor+1),e.preventDefault()):e.key==="ArrowUp"?(this._cursor=Math.max(0,this._cursor-1),e.preventDefault()):e.key==="Enter"?(this._open&&n[this._cursor]&&this.choose(n[this._cursor].id),e.preventDefault()):e.key==="Escape"&&(this._open=!1,this._query="")}render(){if(this.objectTree!==void 0)return m`this.dialog?.showModal()}>ⓘ + `]};customElements.get("nf-entity-picker")||customElements.define("nf-entity-picker",la);var ca=class extends Y{static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return m` e.stopPropagation()} @click=${e=>{if(e.target!==e.currentTarget)return;let n=this.dialog.getBoundingClientRect();(e.clientXn.right||e.clientYn.bottom)&&this.dialog?.close()}}>
    Information

    ${this.text}

    @@ -408,7 +408,7 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f header { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:16px; } .close { width:30px; height:30px; padding:0; font-size:23px; } p { white-space:pre-wrap; overflow-wrap:anywhere; margin:16px 0 4px; } - `]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",aa);var an=t=>t.target.value,la=t=>Number.parseFloat(t.replace(",",".")),ae=t=>Math.round(t*1e3)/1e3,xd=t=>t.wide?"nf-field nf-wide":"nf-field";function E(t,e,n,r,i=.01,o){return m`
    - `}var J=(...t)=>m`
    ${t}
    `,S=(t,e="")=>m``;function ln(t,e,n,r={}){let i=r.lowest??10;return m`
    `:_}`}function yv(t,e){let n=t.doc.settings.outside_hidden??[],r=s=>t.change(l=>l.settings.outside_hidden=gt(s)),i=new Set(t.hass?ud(t.hass,t.doc.floors):[]),o=O(t.hass,s=>!n.includes(s)&&i.has(s));return m`${e?vv(t,e):_}

    ${t.t("outside_hidden")}${n.length>0?m` ${n.length}`:_}

    ${S(t.t("outside_hidden_hint"))} - ${n.map((s,l)=>m`
    ${B(t.hass,s)}${hi(t.t("delete"),"\u2715",()=>r(Ut(n,l)))}
    `)} -
    ${z(t,t.t("outside_hidden_add"),null,void 0,o,s=>s&&s!=="none"&&!n.includes(s)&&r([...n,s]),{excluded:s=>n.includes(s)?"Diese Variable ist hier bereits eingetragen.":void 0})}
    `}function mv(t,e){let n=t.doc.settings.outside_view??null,r=()=>{let i=e();i&&t.change(o=>o.settings.outside_view=i)};return m`${S(t.t("outside_view_hint"))} - ${J(m``,n?m``:_)}`}function gv(t){let e=t.doc.settings.own_alerts??[],n=s=>t.change(l=>l.settings.own_alerts=gt(s)),r=(s,l)=>n(di(e,s,l)),i=[["",t.t("own_alert_house")],...t.doc.floors.flatMap(s=>s.rooms.map(l=>[l.id,`${l.name} \xB7 ${s.name}`]))],o=(s,l)=>m`
    + ${n.map((s,l)=>m`
    ${B(t.hass,s)}${fi(t.t("delete"),"\u2715",()=>r(Ut(n,l)))}
    `)} +
    ${z(t,t.t("outside_hidden_add"),null,void 0,o,s=>s&&s!=="none"&&!n.includes(s)&&r([...n,s]),{excluded:s=>n.includes(s)?"Diese Variable ist hier bereits eingetragen.":void 0})}
    `}function vv(t,e){let n=t.doc.settings.outside_view??null,r=()=>{let i=e();i&&t.change(o=>o.settings.outside_view=i)};return m`${S(t.t("outside_view_hint"))} + ${J(m``,n?m``:_)}`}function wv(t){let e=t.doc.settings.own_alerts??[],n=s=>t.change(l=>l.settings.own_alerts=gt(s)),r=(s,l)=>n(pi(e,s,l)),i=[["",t.t("own_alert_house")],...t.doc.floors.flatMap(s=>s.rooms.map(l=>[l.id,`${l.name} \xB7 ${s.name}`]))],o=(s,l)=>m`
    ${z(t,t.t("own_alert_entity"),s.entity||null,void 0,O(t.hass,()=>!0),a=>r(l,{entity:a&&a!=="none"?a:""}))} ${V(t,t.t("own_alert_state"),s.state??"",a=>r(l,{state:a||null}),{placeholder:t.hass?.states[s.entity]?.state??"on \xB7 <20 \xB7 >80"})} ${V(t,t.t("own_alert_text"),s.text,a=>r(l,{text:a||t.t("own_alert_new")}),{wide:!0,maxlength:120})} @@ -526,28 +526,28 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
    `;return m`

    ⚠ ${t.t("own_alerts")}

    ${S(t.t("own_alerts_hint"))} ${e.map(o)} - ${e.length<40?J(m``):_}`}function _v(t){let e=t.doc.settings.circuits??[],n=l=>t.change(a=>a.settings.circuits=gt(l)),r=(l,a)=>n(di(e,l,a)),i=t.doc.floors.flatMap(l=>l.rooms.map(a=>({id:a.id,label:t.doc.floors.length>1?`${a.name} \xB7 ${l.name}`:a.name}))),o=l=>i.find(a=>a.id===l)?.label??l,s=(l,a)=>m`
    + ${e.length<40?J(m``):_}`}function kv(t){let e=t.doc.settings.circuits??[],n=l=>t.change(a=>a.settings.circuits=gt(l)),r=(l,a)=>n(pi(e,l,a)),i=t.doc.floors.flatMap(l=>l.rooms.map(a=>({id:a.id,label:t.doc.floors.length>1?`${a.name} \xB7 ${l.name}`:a.name}))),o=l=>i.find(a=>a.id===l)?.label??l,s=(l,a)=>m`
    ${V(t,t.t("circuit_name"),l.name,c=>r(a,{name:c||t.t("circuit_new")}),{wide:!0,maxlength:80})}
    ${l.rooms.map(c=>m`${o(c)} `)}
    ${H(t,t.t("circuit_add_room"),"",[["","\u2013"],...i.filter(c=>!l.rooms.includes(c.id)).map(c=>[c.id,c.label])],c=>c&&r(a,{rooms:[...l.rooms,c]}),{wide:!0})}
    `;return m`

    🔌 ${t.t("circuits")}

    ${S(t.t("circuits_hint"))} ${e.map(s)} - ${e.length<120?J(m``):_}`}function bv(t){let e=t.doc.settings.calendars??[],n=l=>t.change(a=>a.settings.calendars=gt(l)),r=O(t.hass,l=>l.startsWith("calendar.")&&!e.includes(l)),i=(l,a)=>m`
    + ${e.length<120?J(m``):_}`}function xv(t){let e=t.doc.settings.calendars??[],n=l=>t.change(a=>a.settings.calendars=gt(l)),r=O(t.hass,l=>l.startsWith("calendar.")&&!e.includes(l)),i=(l,a)=>m`
    ${B(t.hass,l)} - ${hi(t.t("delete"),"\u2715",()=>n(Ut(e,a)))} + ${fi(t.t("delete"),"\u2715",()=>n(Ut(e,a)))}
    `,o=t.t,s=t.doc.settings.today_days??1;return m`

    📅 ${o("today_calendars")}

    ${S(o("today_calendars_hint"))} ${e.map(i)} ${e.length<12?m`
    ${z(t,o("favorites_add"),null,void 0,r,l=>l&&l!=="none"&&!e.includes(l)&&n([...e,l]),{unsupported:"Dieses Feld ben\xF6tigt eine Kalenderquelle mit Terminen. Eine Symcon-Variable ist kein Kalender; Kalenderquellen werden vom Symcon-Modul derzeit nicht bereitgestellt."})}
    `:_} ${e.length?m`
    ${H(t,o("today_days"),String(s),[1,2,3,5,7].map(l=>[String(l),o(l===1?"today_days_one":"today_days_n",{n:l})]),l=>t.change(a=>a.settings.today_days=Number(l)>1?Number(l):void 0))}
    `:_} - ${yv(t)}`}function yv(t){let e=t.t,n=t.doc.settings.forecast??null,r=i=>t.change(o=>o.settings.forecast=i??void 0);return m`

    🌦 ${e("forecast")}

    + ${$v(t)}`}function $v(t){let e=t.t,n=t.doc.settings.forecast??null,r=i=>t.change(o=>o.settings.forecast=i??void 0);return m`

    🌦 ${e("forecast")}

    ${S(e("forecast_hint"))}
    ${H(t,e("forecast_days"),n?String(n.days):"0",[0,3,5,7].map(i=>[String(i),i?e("today_days_n",{n:i}):e("forecast_off")]),i=>r(Number(i)>0?{days:Number(i),corner:n?.corner??"top_right"}:null))} ${n?H(t,e("forecast_corner"),n.corner,[["top_right",e("clock_top_right")],["top_left",e("clock_top_left")]],i=>r({...n,corner:i==="top_left"?"top_left":"top_right"})):_} -
    `}function vv(t){let e=t.doc.settings.media_presets??[],n=s=>t.change(l=>l.settings.media_presets=gt(s)),r=(s,l)=>n(di(e,s,l)),i=[...new Set(t.doc.floors.flatMap(s=>[...s.placements.map(l=>l.entity_id),...s.furniture.map(l=>l.entity??"")]).filter(s=>s.startsWith("media_player.")))],o=(s,l)=>m`
    +
    `}function Sv(t){let e=t.doc.settings.media_presets??[],n=s=>t.change(l=>l.settings.media_presets=gt(s)),r=(s,l)=>n(pi(e,s,l)),i=[...new Set(t.doc.floors.flatMap(s=>[...s.placements.map(l=>l.entity_id),...s.furniture.map(l=>l.entity??"")]).filter(s=>s.startsWith("media_player.")))],o=(s,l)=>m`
    ${V(t,t.t("own_button_label"),s.label,a=>r(l,{label:a||"Radio"}),{maxlength:60})} ${V(t,t.t("preset_type"),s.type,a=>r(l,{type:a||"music"}),{title:t.t("preset_type_hint")})} ${V(t,t.t("preset_content"),s.content,a=>r(l,{content:a}),{wide:!0,title:t.t("preset_content_hint"),placeholder:"https://\u2026 \xB7 spotify:playlist:\u2026 \xB7 Rock Antenne"})} @@ -556,32 +556,32 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
    `;return m`

    ${t.t("presets")}

    ${S(t.t("presets_hint"))} - ${hv.map(s=>m``)} + ${_v.map(s=>m``)} ${e.map(o)} - ${e.lengthn([...e,{id:I("preset"),label:"Radio",type:"music",content:""}])}>+ ${t.t("preset_add")}`):_}`}function Ya(t,e,n){let r=e.action==="fire_dom_event"?'{"browser_mod": {"service": "browser_mod.popup", "data": {"title": "Rollos", "content": {"type": "custom:my-cover-card"}}}}':'{"entity_id": "script.party"}',i=o=>{let s=o.target;s.setCustomValidity("");let l=Th(s.value);if(l.ok)return n(l.value);s.setCustomValidity(t.t("own_data_bad")),s.reportValidity()};return m`
    ${d&&c.length===0?m`

    ${i("furniture_search_none")}

    `:_} - ${d?fm(t,e,c,r):m`${Fl(t,e,"favourites",`\u2605 ${i("lib_favourites")}`,pm(e.favourites,o),r,!0)} - ${Fl(t,e,"recent",`\u{1F558} ${i("lib_recent")}`,pm(e.recent.slice(0,6),o),r,!1)} - ${b0(n).map(p=>Fl(t,e,p,i(`lib_cat_${p}`),c.filter(h=>h.card.category===p),r,p===(Ml(n)??"lights")))} + ${d?bm(t,e,c,r):m`${Pl(t,e,"favourites",`\u2605 ${i("lib_favourites")}`,_m(e.favourites,o),r,!0)} + ${Pl(t,e,"recent",`\u{1F558} ${i("lib_recent")}`,_m(e.recent.slice(0,6),o),r,!1)} + ${x0(n).map(p=>Pl(t,e,p,i(`lib_cat_${p}`),c.filter(h=>h.card.category===p),r,p===(Al(n)??"lights")))} ${a?m``:_}`} - `}function gm(t,e){return e?m``:_}function Dl(t,e,n,r=24){let i=Math.hypot(e[0]-t[0],e[1]-t[1]);if(i<1e-6||Math.abs(n)<1e-4)return[];let o=Math.max(-i*2,Math.min(i*2,n)),s=[(e[0]-t[0])/i,(e[1]-t[1])/i],l=[s[1],-s[0]],a=i*i/4/(2*Math.abs(o))+Math.abs(o)/2,c=2*Math.atan(2*Math.abs(o)/i),u=Math.max(2,Math.min(r,Math.ceil(2*c/Math.PI*180/11.25))),d=[l[0]*Math.sign(o),l[1]*Math.sign(o)],p=[(t[0]+e[0])/2,(t[1]+e[1])/2],h=[p[0]-d[0]*(a-Math.abs(o)),p[1]-d[1]*(a-Math.abs(o))],f=[];for(let g=1;gt.reduce((e,n,r)=>r?e+Math.hypot(n[0]-t[r-1][0],n[1]-t[r-1][1]):e,0);function Ol(t,e){let n=Math.max(0,e);for(let r=0;r+1Math.round(t*1e3)/1e3,Hl=t=>t.map(([e,n])=>[Pe(e),Pe(n)]);function wm(t,e){return{id:I("room"),name:e,area_id:null,points:Hl(t),floor_material:"wood"}}function km(t){return{...structuredClone(t),id:I("room"),points:Hl(t.points.map(([e,n])=>[e+.5,n+.5]))}}function xm(t,e){let n=t.rooms.find(r=>r.id===e);t.rooms=t.rooms.filter(r=>r.id!==e),t.openings=t.openings.filter(r=>r.room_id!==e||r.wall),n&&(t.placements=t.placements.filter(r=>!C([r.x,r.z],n.points)))}function $m(t,e,n){let r=t.rooms.find(s=>s.id===e);if(!r||r.points.length<=3)return!1;let i=(n-1+r.points.length)%r.points.length;r.points.splice(n,1),r.wall_heights?.splice(n,1),r.wall_slopes?.splice(n,1),r.wall_thickness?.splice(n,1);let o=s=>s.room_id===e&&!s.wall;return t.openings=t.openings.filter(s=>!(o(s)&&(s.edge===n||s.edge===i))).map(s=>o(s)&&s.edge>n?{...s,edge:s.edge-1}:s),!0}function Sm(t,e,n){if(!Number.isFinite(n))return null;let r=de(t.points),{x0:i,z0:o,x1:s,z1:l}=r;return e==="x"?[i,s]=[n,n+(s-i)]:e==="z"?[o,l]=[n,n+(l-o)]:n>.05&&(e==="w"?s=i+n:l=o+n),Hl([[i,o],[s,o],[s,l],[i,l]])}function Mm(t,e,n,r){return!Number.isFinite(r)||e<0||e>=t.points.length?null:t.points.map((i,o)=>o===e?n===0?[Pe(r),i[1]]:[i[0],Pe(r)]:[i[0],i[1]])}var $0=/^(Raum|Room) \d+$/;function Ll(t,e,n,r=!0){let i=e?n[e]:void 0,o=!t.name||$0.test(t.name)||Object.values(n).some(s=>s.name===t.name);return{area_id:e||null,...r&&i&&o?{name:i.name}:{}}}function Cl(t,e){let n=/^symcon-category-(\d+)$/.exec(e)?.[1];return(n?t?.symconObjects?.find(r=>r.object_id===Number(n))?.name:void 0)??t?.areas?.[e]?.name.split(" / ").at(-1)?.trim()??""}function Rm(t,e){let n=e.filter(a=>Q(a.entity_id)==="light"&&(a.mount??"ceiling")==="ceiling"&&C([a.x,a.z],t.points));if(n.length<2)return[];let r=de(t.points),[i,o]=[r.x1-r.x0,r.z1-r.z0],s=Math.max(1,Math.round(Math.sqrt(n.length*i/Math.max(.1,o)))),l=Math.ceil(n.length/s);return n.map((a,c)=>{let u=Math.floor(c/s),d=u===l-1?n.length-s*(l-1):s,p=c-u*s;return{entityId:a.entity_id,x:Pe(r.x0+i/d*(p+.5)),z:Pe(r.z0+o/l*(u+.5))}})}function Nl(t,e,n,r){let i=t.rooms.find(u=>u.id===e);if(!i)return;let o=i.points[n],s=i.points[(n+1)%i.points.length];i.points.splice(n+1,0,r);let[l,a]=[i.wall_heights?.[n],i.wall_slopes?.[n]];if(typeof l=="number"&&typeof a=="number"&&i.wall_slopes){let u=Math.hypot(s[0]-o[0],s[1]-o[1]),d=Pe(l+(a-l)*Math.min(1,Math.hypot(r[0]-o[0],r[1]-o[1])/(u||1)));i.wall_slopes.splice(n,1,d,a),i.wall_heights.splice(n+1,0,d)}else i.wall_heights?.splice(n+1,0,i.wall_heights[n]??null),i.wall_slopes?.splice(n+1,0,null);i.wall_thickness?.splice(n+1,0,i.wall_thickness[n]??null);let c=Math.hypot(r[0]-o[0],r[1]-o[1]);for(let u of t.openings)u.room_id!==e||u.wall||(u.edge>n?u.edge+=1:u.edge===n&&u.offset>c&&(u.edge=n+1,u.offset=Pe(u.offset-c)))}var S0=22.5;function Em(t,e,n){let r=Math.min(Math.abs(e),t*2),i=t*(1+8/3*(r/Math.max(1e-6,t))**2),o=4*Math.atan(2*r/Math.max(1e-6,t))*180/Math.PI,s=Math.max(2,Math.ceil(o/S0));if(n<=0)return 24;let l=Math.floor(i/(n+.1));return l>=s?l:0}function M0(t,e,n,r){let i=Il(n);t.forEach((o,s)=>{let{piece:l,offset:a}=Ol(n,e[s]*i),c=Math.hypot(n[l+1][0]-n[l][0],n[l+1][1]-n[l][1]);o.edge=r+l,o.offset=Pe(c>o.width?Math.min(c-o.width/2,Math.max(o.width/2,a)):c/2)})}function Am(t,e,n,r){let i=t.rooms.find(v=>v.id===e);if(!i||n<0||n>=i.points.length||Math.abs(r)<.01)return!1;let o=i.points[n],s=i.points[(n+1)%i.points.length],l=Math.hypot(s[0]-o[0],s[1]-o[1]);if(l<.2)return!1;let[a,c]=[(s[0]-o[0])/l,(s[1]-o[1])/l],u=[(o[0]+s[0])/2+c*.02,(o[1]+s[1])/2-a*.02],p=C(u,i.points)?-r:r,h=(v,w)=>t.openings.filter(x=>x.room_id===v.id&&!x.wall&&x.edge===w),f=t.rooms.flatMap(v=>v.points.map((w,x)=>{let k=v.points[(x+1)%v.points.length],M=(A,T)=>Math.abs(A[0]-T[0])<.001&&Math.abs(A[1]-T[1])<.001;return M(w,o)&&M(k,s)?[v,x,!1]:M(w,s)&&M(k,o)?[v,x,!0]:null}).filter(w=>!!w)),g=Math.max(0,...f.flatMap(([v,w])=>h(v,w).map(x=>x.width))),b=Em(l,r,g);if(!b)return!1;let y=Dl(o,s,p,b).map(([v,w])=>[Pe(v),Pe(w)]);if(!y.length)return!1;for(let[v,w,x]of f){let k=x?[...y].reverse():y,M=h(v,w),A=v.points[w],T=M.map(F=>Math.min(1,Math.max(0,F.offset/l)));for(let F of M)F.edge=-1;k.forEach((F,L)=>Nl(t,v.id,w+L,F)),v.wall_splits?.splice(w+1,0,...k.map(()=>null)),v.wall_splits?.[w]&&(v.wall_splits[w]=null),M0(M,T,[A,...k,v.points[(w+k.length+1)%v.points.length]],w)}return!0}function Fm(t,e,n){let r=t.walls??[],i=r.findIndex(f=>f.id===e);if(i<0||Math.abs(n)<.01)return[];let o=r[i],s=Math.hypot(o.b[0]-o.a[0],o.b[1]-o.a[1]),l=t.openings.filter(f=>f.wall===e),a=Math.max(0,...l.map(f=>f.width)),c=Em(s,n,a);if(!c)return[];let u=Dl(o.a,o.b,n,c).map(([f,g])=>[Pe(f),Pe(g)]);if(!u.length)return[];let d=[o.a,...u,o.b],p=d.slice(1).map((f,g)=>({...o,id:g===0?o.id:I("wall"),a:d[g],b:f}));r.splice(i,1,...p),t.walls=r;let h=Il(d);for(let f of l){let{piece:g,offset:b}=Ol(d,f.offset/s*h),y=Math.hypot(d[g+1][0]-d[g][0],d[g+1][1]-d[g][1]);f.wall=p[g].id,f.offset=Pe(y>f.width?Math.min(y-f.width/2,Math.max(f.width/2,b)):y/2)}return p.map(f=>f.id)}var ir=t=>Math.round(t*1e3)/1e3;function ns(t,e,n){return[Math.round((e[0]-t[0])/n)*n,Math.round((e[1]-t[1])/n)*n]}var $n=(t,e)=>e?.01:t,or=(t,e,n=5)=>Math.hypot(t[0]-e[0],t[1]-e[1])>=n;function Tm(t,e,n){return n?Math.abs(e[0]-t[0])>Math.abs(e[1]-t[1])?[e[0],t[1]]:[t[0],e[1]]:e}var et=(t,e)=>[ir(t[0]+e[0]),ir(t[1]+e[1])];function Bl(t,e,n,r){return[ir(Math.round((t[0]+n[0]-e[0])/r)*r),ir(Math.round((t[1]+n[1]-e[1])/r)*r)]}function Wl(t,e,n){let r=Math.atan2(-(e[0]-t[0]),e[1]-t[1])*180/Math.PI;return(Math.round(r/n)*n%360+360)%360}function zm(t,e,n){let r=Math.atan2(e[0]-t[0],-(e[1]-t[1]))*180/Math.PI;return Math.round(r/n)*n}function Pm(t,e,n){let r=Pn([...t]),i=t[e],o=[ir(n[0]),ir(n[1])];return t.map((s,l)=>l===e?o:r?[Math.abs(s[0]-i[0])<1e-6?o[0]:s[0],Math.abs(s[1]-i[1])<1e-6?o[1]:s[1]]:[s[0],s[1]])}var rs=t=>Math.round(t*1e3)/1e3,Dm=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function R0(t,e,n){let r=null,i=n;for(let o of t){let s=Dm(o,e);s{let a=o.points[(l+1)%o.points.length],[c,u]=[a[0]-s[0],a[1]-s[1]],d=c*c+u*u;if(d<1e-9)return;let p=((e[0]-s[0])*c+(e[1]-s[1])*u)/d;if(p<=0||p>=1)return;let h=[s[0]+p*c,s[1]+p*u],f=Dm(h,e),g=(b,y,v)=>Math.min(Math.max(b,Math.min(y,v)),Math.max(y,v));Math.abs(u)<1e-9&&(h[0]=g(Math.round(h[0]/n.grid)*n.grid,s[0],a[0])),Math.abs(c)<1e-9&&(h[1]=g(Math.round(h[1]/n.grid)*n.grid,s[1],a[1])),fo.points.filter((s,l)=>!(e.skip&&o.id===e.skip.roomId&&(e.skip.index===void 0||e.skip.index===l)))),r=R0(n,t,e.reach);if(r)return{point:[r[0],r[1]],guides:{point:r}};let i=E0(e.rooms,t,e);return i?{point:[rs(i[0]),rs(i[1])],guides:{point:i}}:A0(n,t,e)}var is=(t,e)=>pe(t.host.hass,e);function F0(t,e){let[n,r]=[t.toScreen(e.start),t.toScreen(e.end)];if(e.kind==="freewall"){let s=Math.hypot(e.end[0]-e.start[0],e.end[1]-e.start[1]);return R` - ${ns(t,s)} + ${is(t,s)} `}let[i,o]=[Math.abs(e.end[0]-e.start[0]),Math.abs(e.end[1]-e.start[1])];return R` - ${ns(t,i)} × ${ns(t,o)} - `}function M0(t,e,n,r){let i=[...e,...n?[n]:[]].map(u=>t.toScreen(u)),o=e.length>=3,s=r?e.slice(1).map((u,d)=>{let[p,h]=[t.toScreen(e[d]),t.toScreen(u)];return R`${ns(t,Math.hypot(u[0]-e[d][0],u[1]-e[d][1]))}`}):_,l=e.map((u,d)=>{let[p,h]=t.toScreen(u),f=d===0&&o;return R``}),[a,c]=n?t.toScreen(n):[0,0];return R` + ${is(t,i)} × ${is(t,o)} + `}function T0(t,e,n,r){let i=[...e,...n?[n]:[]].map(u=>t.toScreen(u)),o=e.length>=3,s=r?e.slice(1).map((u,d)=>{let[p,h]=[t.toScreen(e[d]),t.toScreen(u)];return R`${is(t,Math.hypot(u[0]-e[d][0],u[1]-e[d][1]))}`}):_,l=e.map((u,d)=>{let[p,h]=t.toScreen(u),f=d===0&&o;return R``}),[a,c]=n?t.toScreen(n):[0,0];return R` ${i.length>1?R`u.join(",")).join(" ")} />`:_} ${s}${l} ${n?R``:_} - `}function zm(t,e,n){let r=e.x!==void 0?t.toScreen([e.x,0])[0]:null,i=e.z!==void 0?t.toScreen([0,e.z])[1]:null,[o,s]=e.point?t.toScreen(e.point):[0,0];return R` + `}function Om(t,e,n){let r=e.x!==void 0?t.toScreen([e.x,0])[0]:null,i=e.z!==void 0?t.toScreen([0,e.z])[1]:null,[o,s]=e.point?t.toScreen(e.point):[0,0];return R` ${r!==null?R``:_} ${i!==null?R``:_} ${e.point?R``:_} - `}function Pm(t,e,n,r,i){return e?S0(t,e):n!=="polygon"&&n!=="measure"?_:M0(t,r,i,n==="measure")}var le=(t,e,n,r,i="")=>R``,ie=(t,e,n,r,i="")=>R``,Im=(t,e="")=>R`n.join(",")).join(" ")} />`,se=(t,e,n,r="")=>R``,Nl=(t,e,n,r,i="")=>R``;function Bl(t,e,n){let r=[];for(let i=1;i1.2?2:1,o=(e-.2)/i,s=[le(-e/2,-n/2,e/2,-n/2+.07,"nf-sym-fill"),ie(-e/2,-n/2+(n-.1)*.36,e/2,-n/2+(n-.1)*.36)];for(let l=0;lIm(a.poly,a.landing?`nf-sym-fill ${o}`:o));i.column>0&&s.push(se(0,0,i.column,"nf-sym-fill"));let l=i.treads.map(Go);for(let a=1;a=2){let[a,c]=[l[l.length-2],l[l.length-1]],u=Math.hypot(c[0]-a[0],c[1]-a[1])||1,[d,p]=[(c[0]-a[0])/u,(c[1]-a[1])/u],h=Math.min(.2,i.flight*.3);for(let f of[-1,1])s.push(ie(c[0],c[1],c[0]-d*h+p*h*.6*f,c[1]-p*h-d*h*.6*f,"nf-sym-strong"))}return s}function E0(t,e,n){return t.symbol?.length?t.symbol.map(r=>r.shape==="rect"?le((r.x-r.w/2)*e,(r.z-r.d/2)*n,(r.x+r.w/2)*e,(r.z+r.d/2)*n,r.fill?"nf-sym-fill":""):r.shape==="circle"?se(r.x*e,r.z*n,r.r*Math.min(e,n)):ie(r.x1*e,r.z1*n,r.x2*e,r.z2*n)):Zc(t,e,n,t.size[2]).filter(r=>r.shape==="sweep"||r.w<.98||r.d<.98).map(r=>r.shape==="sweep"&&r.stations?.length?Im([...r.stations.map(i=>[(r.x+i[3]/2)*e,i[0]*n]),...[...r.stations].reverse().map(i=>[(r.x-i[3]/2)*e,i[0]*n])]):r.shape==="cyl"&&(r.axis??"y")==="y"?se(r.x*e,r.z*n,Math.min(r.w*e,r.d*n)/2):le((r.x-r.w/2)*e,(r.z-r.d/2)*n,(r.x+r.w/2)*e,(r.z+r.d/2)*n))}var Wl=Math.PI/180,Lm=(t,e,n,r)=>{let[i,o]=r,s=R``,l=R`${s}`;return t==="data-rotate"?R`${l}`:R`${l}`};function A0(t,e){let n=e.rotation*Wl;return[[-1,-1],[1,-1],[1,1],[-1,1]].map(([r,i])=>{let[o,s]=t.toScreen([e.x+r*e.w*Math.cos(n)/2-i*e.d*Math.sin(n)/2,e.z+r*e.w*Math.sin(n)/2+i*e.d*Math.cos(n)/2]);return R``})}var Hm=new WeakMap;function F0(t,e){let n=Hm.get(e);if(n&&n.states===t.states)return n.links;let r=Me(t,[e]);return Hm.set(e,{states:t.states,links:r}),r}function T0(t,e,n){if(!t||!ue(n.type))return!1;let r=F0(t,e).get(n.id)?.entity;return!!Vc(r?t.states[r]:void 0,(n.extra_lights??[]).map(i=>t.states[i]))}function Cm(t,e,n){let{host:r,scale:i}=t,o=s=>{let l=s.id===n,a=l&&r.admin&&!s.locked,[c,u]=t.toScreen([s.x,s.z]),d=s.rotation*Wl,p=Math.min(s.w,s.d)*i>44,h=T0(r.hass,e,s),f=Ke.includes(s.type),g=`nf-furn${l?" nf-furn-sel":""}${h?" nf-furn-lit":""}${f?" nf-energy-item":""}`,b=s.d/2+Math.max(.3,26/i),y=t.toScreen([s.x-Math.sin(d)*b,s.z+Math.cos(d)*b]),v=t.toScreen([s.x-Math.sin(d)*(s.d/2),s.z+Math.cos(d)*(s.d/2)]),[w,x]=t.toScreen([s.x+Math.sin(d)*(s.d/2+18/i),s.z-Math.cos(d)*(s.d/2+18/i)]);return R` + `}function Hm(t,e,n,r,i){return e?F0(t,e):n!=="polygon"&&n!=="measure"?_:T0(t,r,i,n==="measure")}var le=(t,e,n,r,i="")=>R``,ie=(t,e,n,r,i="")=>R``,Cm=(t,e="")=>R`n.join(",")).join(" ")} />`,se=(t,e,n,r="")=>R``,Vl=(t,e,n,r,i="")=>R``;function Kl(t,e,n){let r=[];for(let i=1;i1.2?2:1,o=(e-.2)/i,s=[le(-e/2,-n/2,e/2,-n/2+.07,"nf-sym-fill"),ie(-e/2,-n/2+(n-.1)*.36,e/2,-n/2+(n-.1)*.36)];for(let l=0;lCm(a.poly,a.landing?`nf-sym-fill ${o}`:o));i.column>0&&s.push(se(0,0,i.column,"nf-sym-fill"));let l=i.treads.map(qo);for(let a=1;a=2){let[a,c]=[l[l.length-2],l[l.length-1]],u=Math.hypot(c[0]-a[0],c[1]-a[1])||1,[d,p]=[(c[0]-a[0])/u,(c[1]-a[1])/u],h=Math.min(.2,i.flight*.3);for(let f of[-1,1])s.push(ie(c[0],c[1],c[0]-d*h+p*h*.6*f,c[1]-p*h-d*h*.6*f,"nf-sym-strong"))}return s}function P0(t,e,n){return t.symbol?.length?t.symbol.map(r=>r.shape==="rect"?le((r.x-r.w/2)*e,(r.z-r.d/2)*n,(r.x+r.w/2)*e,(r.z+r.d/2)*n,r.fill?"nf-sym-fill":""):r.shape==="circle"?se(r.x*e,r.z*n,r.r*Math.min(e,n)):ie(r.x1*e,r.z1*n,r.x2*e,r.z2*n)):Xc(t,e,n,t.size[2]).filter(r=>r.shape==="sweep"||r.w<.98||r.d<.98).map(r=>r.shape==="sweep"&&r.stations?.length?Cm([...r.stations.map(i=>[(r.x+i[3]/2)*e,i[0]*n]),...[...r.stations].reverse().map(i=>[(r.x-i[3]/2)*e,i[0]*n])]):r.shape==="cyl"&&(r.axis??"y")==="y"?se(r.x*e,r.z*n,Math.min(r.w*e,r.d*n)/2):le((r.x-r.w/2)*e,(r.z-r.d/2)*n,(r.x+r.w/2)*e,(r.z+r.d/2)*n))}var jl=Math.PI/180,Wm=(t,e,n,r)=>{let[i,o]=r,s=R``,l=R`${s}`;return t==="data-rotate"?R`${l}`:R`${l}`};function D0(t,e){let n=e.rotation*jl;return[[-1,-1],[1,-1],[1,1],[-1,1]].map(([r,i])=>{let[o,s]=t.toScreen([e.x+r*e.w*Math.cos(n)/2-i*e.d*Math.sin(n)/2,e.z+r*e.w*Math.sin(n)/2+i*e.d*Math.cos(n)/2]);return R``})}var Bm=new WeakMap;function I0(t,e){let n=Bm.get(e);if(n&&n.states===t.states)return n.links;let r=Me(t,[e]);return Bm.set(e,{states:t.states,links:r}),r}function O0(t,e,n){if(!t||!ue(n.type))return!1;let r=I0(t,e).get(n.id)?.entity;return!!Uc(r?t.states[r]:void 0,(n.extra_lights??[]).map(i=>t.states[i]))}function Vm(t,e,n){let{host:r,scale:i}=t,o=s=>{let l=s.id===n,a=l&&r.admin&&!s.locked,[c,u]=t.toScreen([s.x,s.z]),d=s.rotation*jl,p=Math.min(s.w,s.d)*i>44,h=O0(r.hass,e,s),f=Ke.includes(s.type),g=`nf-furn${l?" nf-furn-sel":""}${h?" nf-furn-lit":""}${f?" nf-energy-item":""}`,b=s.d/2+Math.max(.3,26/i),y=t.toScreen([s.x-Math.sin(d)*b,s.z+Math.cos(d)*b]),v=t.toScreen([s.x-Math.sin(d)*(s.d/2),s.z+Math.cos(d)*(s.d/2)]),[w,x]=t.toScreen([s.x+Math.sin(d)*(s.d/2+18/i),s.z-Math.cos(d)*(s.d/2+18/i)]);return R` - ${Om(s.type,s.w,s.d,s)} + ${Nm(s.type,s.w,s.d,s)} ${p?R`${Ae(r.hass,s.type)}`:_} - ${a?A0(t,s):_} + ${a?D0(t,s):_} ${l?R`${pe(r.hass,s.w)} × ${pe(r.hass,s.d)}`:_} ${l&&s.locked?R`🔒`:_} - ${a?Lm("data-rotate",s.id,v,y):_}`};return R`${Af(e).map(o)}`}function Nm(t,e,n){let{host:r}=t,i=o=>{let s=Q(o.entity_id)??(r.hass?je(r.hass,o.entity_id):null);if(!s)return _;let[l,a]=t.toScreen([o.x,o.z]),c=r.hass?.states[o.entity_id]?.state==="on",u=o.entity_id===n,d=(o.rotation??0)*Wl,p=u&&r.admin&&!o.locked&&Lu(o.entity_id,r.hass?.states[o.entity_id]),h=[l-Math.sin(d)*46,a+Math.cos(d)*46],f=Cn(r,o.entity_id,o.icon);return R`${p?Lm("data-aim",o.entity_id,[l,a],h):_} + ${a?Wm("data-rotate",s.id,v,y):_}`};return R`${Pf(e).map(o)}`}function Km(t,e,n){let{host:r}=t,i=o=>{let s=Q(o.entity_id)??(r.hass?je(r.hass,o.entity_id):null);if(!s)return _;let[l,a]=t.toScreen([o.x,o.z]),c=r.hass?.states[o.entity_id]?.state==="on",u=o.entity_id===n,d=(o.rotation??0)*jl,p=u&&r.admin&&!o.locked&&Bu(o.entity_id,r.hass?.states[o.entity_id]),h=[l-Math.sin(d)*46,a+Math.cos(d)*46],f=Nn(r,o.entity_id,o.icon);return R`${p?Wm("data-aim",o.entity_id,[l,a],h):_} ${B(r.hass,o.entity_id)} ${f?R``:R``} - ${u&&o.locked?R`🔒`:_}`};return R`${e.placements.map(i)}`}function Bm(t,e,n){return R`${(e.notes??[]).map(r=>{let[i,o]=t.toScreen([r.x,r.z]);return R` + ${u&&o.locked?R`🔒`:_}`};return R`${e.placements.map(i)}`}function jm(t,e,n){return R`${(e.notes??[]).map(r=>{let[i,o]=t.toScreen([r.x,r.z]);return R` ${r.text} ✎ - `})}`}var rs=(t,e,n=6)=>R``;function Wm(t,e){let{scale:n}=t,r=n>=90?.1:n>=30?.5:1,i=n>=20?1:5,o=t.toWorld(0,0),s=t.toWorld(e.w,e.h),l=[],a=(d,p)=>{for(let h=Math.ceil(o[0]/d)*d;h<=s[0];h+=d){let f=t.toScreen([h,0])[0];l.push(R``)}for(let h=Math.ceil(o[1]/d)*d;h<=s[1];h+=d){let f=t.toScreen([0,h])[1];l.push(R``)}};r`),R`${l}`}function Vm(t){let e=t.host.doc.floors,n=e.findIndex(o=>o.id===t.floorId),r=n>0?e[n-1]:void 0;if(!r)return _;let i=Au(e,e[n]);return R`${r.rooms.map(o=>R``)}${i.map(o=>R``)}`}function Km(t,e){let n=t.host.floor?.height??2.5;return R`${e.map(r=>{let i=r.height!==void 0&&r.height`})}`}function jm(t,e,n){let r=i=>{let[o,s]=t.toScreen(be(i.points)),l=de(i.points),a=Math.min(l.x1-l.x0,l.z1-l.z0)*t.scale>40;return R` + `})}`}var os=(t,e,n=6)=>R``;function Um(t,e){let{scale:n}=t,r=n>=90?.1:n>=30?.5:1,i=n>=20?1:5,o=t.toWorld(0,0),s=t.toWorld(e.w,e.h),l=[],a=(d,p)=>{for(let h=Math.ceil(o[0]/d)*d;h<=s[0];h+=d){let f=t.toScreen([h,0])[0];l.push(R``)}for(let h=Math.ceil(o[1]/d)*d;h<=s[1];h+=d){let f=t.toScreen([0,h])[1];l.push(R``)}};r`),R`${l}`}function Gm(t){let e=t.host.doc.floors,n=e.findIndex(o=>o.id===t.floorId),r=n>0?e[n-1]:void 0;if(!r)return _;let i=zu(e,e[n]);return R`${r.rooms.map(o=>R``)}${i.map(o=>R``)}`}function Zm(t,e){let n=t.host.floor?.height??2.5;return R`${e.map(r=>{let i=r.height!==void 0&&r.height`})}`}function qm(t,e,n){let r=i=>{let[o,s]=t.toScreen(be(i.points)),l=de(i.points),a=Math.min(l.x1-l.x0,l.z1-l.z0)*t.scale>40;return R` ${a?R`${t.host.t(`out_${i.type}`)}`:_} - `};return R`${e.outdoor.map(r)}`}function Um(t,e,n){let{host:r}=t;if(!e||!r.admin||n!=="select"||r.doc.settings.lock_plan)return _;let i=e.points;return R`${i.map((o,s)=>Wo(t,o,i[(s+1)%i.length],"out",e.id,s))}${i.map((o,s)=>R`${rs(...t.toScreen(o))}`)}`}function Gm(t,e,n,r){let i=e.rooms.find(s=>s.id===n),o=i&&r!==null&&r${e.rooms.map(s=>R``)} + `};return R`${e.outdoor.map(r)}`}function Ym(t,e,n){let{host:r}=t;if(!e||!r.admin||n!=="select"||r.doc.settings.lock_plan)return _;let i=e.points;return R`${i.map((o,s)=>Ko(t,o,i[(s+1)%i.length],"out",e.id,s))}${i.map((o,s)=>R`${os(...t.toScreen(o))}`)}`}function Xm(t,e,n,r){let i=e.rooms.find(s=>s.id===n),o=i&&r!==null&&r${e.rooms.map(s=>R``)} ${o?R``:_} ${e.rooms.map(s=>{let[l,a]=t.toScreen(be(s.points));return R`${s.name} - ${ze(t.host.hass,xe(s.points))}`})}`}function Zm(t,e){let n=t.host.doc.energy?.meter;if(!n||n.floor_id!==e.id)return _;let[r,i]=t.toScreen([n.x,n.z]);return R` + ${ze(t.host.hass,xe(s.points))}`})}`}function Jm(t,e){let n=t.host.doc.energy?.meter;if(!n||n.floor_id!==e.id)return _;let[r,i]=t.toScreen([n.x,n.z]);return R` - `}function qm(t,e,n){let{host:r}=t,i=o=>{let[s,l]=[t.toScreen(o.a),t.toScreen(o.b)],a=o.id===n,c=a&&r.admin&&!Gi(o,!0,r.doc.settings);return R` + `}function Qm(t,e,n){let{host:r}=t,i=o=>{let[s,l]=[t.toScreen(o.a),t.toScreen(o.b)],a=o.id===n,c=a&&r.admin&&!qi(o,!0,r.doc.settings);return R` - ${c?R`${rs(s[0],s[1])}${rs(l[0],l[1])}`:_}`};return R`${(e.walls??[]).map(i)}`}function Ym(t,e){let n=e.points,r=(e.wall_splits??[]).flatMap((i,o)=>{if(!i||o>=n.length)return[];let[s,l]=[n[o],n[(o+1)%n.length]],a=Math.hypot(l[0]-s[0],l[1]-s[1])||1,[c,u]=[(l[0]-s[0])/a,(l[1]-s[1])/a];return i.map(d=>{let[p,h]=t.toScreen([s[0]+c*d,s[1]+u*d]);return R``})});return R`${r}`}function Xm(t,e,n){let r=e.points,[i,o]=t.toScreen(be(r)),s=(a,c,u)=>{let[[d,p],[h,f]]=[t.toScreen(a),t.toScreen(c)],[g,b]=[(d+h)/2,(p+f)/2],y=Math.hypot(h-d,f-p),[v,w]=[-(f-p),h-d],x=Math.hypot(v,w)||1;return[v,w]=[v/x,w/x],v*(g-i)+w*(b-o)<0&&([v,w]=[-v,-w]),R`${y>50?R`${pe(t.host.hass,Math.hypot(c[0]-a[0],c[1]-a[1]))}`:_} - ${y>36?R``:_}`},l=(a,c)=>{let[u,d]=t.toScreen(a);return R`${rs(u,d)}${c+1}`};return R`${r.map((a,c)=>s(a,r[(c+1)%r.length],c))}${r.map(l)}`}function Jm(t,e){let n=e.rooms.flatMap(r=>{if(r.points.length<3)return[];let[i,o]=be(r.points);return r.points.map((s,l)=>{let a=r.points[(l+1)%r.points.length],c=Math.hypot(a[0]-s[0],a[1]-s[1]);if(c<.4)return _;let u=[(s[0]+a[0])/2,(s[1]+a[1])/2],d=Math.hypot(i-u[0],o-u[1])||1,p=Math.min(.35,d/2),h=[u[0]+(i-u[0])/d*p,u[1]+(o-u[1])/d*p],[f,g]=t.toScreen(h),b=Math.atan2(a[1]-s[1],a[0]-s[0])*180/Math.PI;return b>90&&(b-=180),b<-90&&(b+=180),R`${pe(t.host.hass,c)}`})});return R`${n}`}function Qm(t,e,n){let r=t.t;return m`
    + ${c?R`${os(s[0],s[1])}${os(l[0],l[1])}`:_}`};return R`${(e.walls??[]).map(i)}`}function eg(t,e){let n=e.points,r=(e.wall_splits??[]).flatMap((i,o)=>{if(!i||o>=n.length)return[];let[s,l]=[n[o],n[(o+1)%n.length]],a=Math.hypot(l[0]-s[0],l[1]-s[1])||1,[c,u]=[(l[0]-s[0])/a,(l[1]-s[1])/a];return i.map(d=>{let[p,h]=t.toScreen([s[0]+c*d,s[1]+u*d]);return R``})});return R`${r}`}function tg(t,e,n){let r=e.points,[i,o]=t.toScreen(be(r)),s=(a,c,u)=>{let[[d,p],[h,f]]=[t.toScreen(a),t.toScreen(c)],[g,b]=[(d+h)/2,(p+f)/2],y=Math.hypot(h-d,f-p),[v,w]=[-(f-p),h-d],x=Math.hypot(v,w)||1;return[v,w]=[v/x,w/x],v*(g-i)+w*(b-o)<0&&([v,w]=[-v,-w]),R`${y>50?R`${pe(t.host.hass,Math.hypot(c[0]-a[0],c[1]-a[1]))}`:_} + ${y>36?R``:_}`},l=(a,c)=>{let[u,d]=t.toScreen(a);return R`${os(u,d)}${c+1}`};return R`${r.map((a,c)=>s(a,r[(c+1)%r.length],c))}${r.map(l)}`}function ng(t,e){let n=e.rooms.flatMap(r=>{if(r.points.length<3)return[];let[i,o]=be(r.points);return r.points.map((s,l)=>{let a=r.points[(l+1)%r.points.length],c=Math.hypot(a[0]-s[0],a[1]-s[1]);if(c<.4)return _;let u=[(s[0]+a[0])/2,(s[1]+a[1])/2],d=Math.hypot(i-u[0],o-u[1])||1,p=Math.min(.35,d/2),h=[u[0]+(i-u[0])/d*p,u[1]+(o-u[1])/d*p],[f,g]=t.toScreen(h),b=Math.atan2(a[1]-s[1],a[0]-s[0])*180/Math.PI;return b>90&&(b-=180),b<-90&&(b+=180),R`${pe(t.host.hass,c)}`})});return R`${n}`}function rg(t,e,n){let r=t.t;return m`

    ✎ ${r("note")}

    - ${ji(e)?m`

    ${r("note_is_due")}

    `:S(r("note_due_hint"),"nf-wide")} + ${Gi(e)?m`

    ${r("note_is_due")}

    `:S(r("note_due_hint"),"nf-wide")} ${E(t,r("x"),e.x,i=>n.patch({x:i}))} ${E(t,r("z"),e.z,i=>n.patch({z:i}))} - ${E(t,r("note_height"),e.y??lu,i=>n.patch({y:Math.max(0,Math.min(20,Math.round(i*100)/100))}),.1,0)} + ${E(t,r("note_height"),e.y??du,i=>n.patch({y:Math.max(0,Math.min(20,Math.round(i*100)/100))}),.1,0)} ${S(r("note_height_hint"),"nf-wide")} - ${z0(t,e,n)} + ${H0(t,e,n)}
    ${J(m``)} -
    `}function z0(t,e,n){let r=t.t,i=!!e.photo?.startsWith("image:"),o=async s=>{let l=s.target,a=l.files?.[0];if(l.value="",!a||!t.hass)return;let{data:c}=await tr(a),u=I("img");await Wt(t.hass,u,c),n.patch({photo:`image:${u}`})};return m`${t.admin?m``:_} +
    `}function H0(t,e,n){let r=t.t,i=!!e.photo?.startsWith("image:"),o=async s=>{let l=s.target,a=l.files?.[0];if(l.value="",!a||!t.hass)return;let{data:c}=await rr(a),u=I("img");await Wt(t.hass,u,c),n.patch({photo:`image:${u}`})};return m`${t.admin?m``:_} ${i?m`

    ${r("picture_stored")}

    `:V(t,r("picture_url"),e.photo??"",s=>n.patch({photo:s.trim()||null}),{wide:!0,placeholder:"/local/valve.jpg"})} - ${S(r("note_photo_hint"),"nf-wide")}`}function P0(t,e,n,r){let i=Ce(e,n.rooms,n.walls??[]);if(!i)return null;let{room:o,edge:s}=i,l=Vt(r,e,i),a=Wn(o,s,e.offset-e.width/2),c=Wn(o,s,e.offset+e.width/2),u=[(c[0]-a[0])/(e.width||1),(c[1]-a[1])/(e.width||1)],d=_e(o.points)>=0?1:-1,p=[-u[1]*d,u[0]*d],h=[.06,.06];return l&&(h=l.wall.free||l.wall.roomLeft===o.id?[l.wall.left,l.wall.right]:[l.wall.right,l.wall.left]),{room:o,edge:s,p0:a,p1:c,inward:p,direction:d,across:h,exterior:l?.wall.exterior??!1,at:(f,g)=>t.toScreen([f[0]+p[0]*g,f[1]+p[1]*g])}}var Mt=(t,e,n="")=>R``;function D0(t,e){let n=t.across[0]-.04,r=t.across[0]+Math.min(2,e.height),[i,o,s,l]=[t.at(t.p0,n),t.at(t.p1,n),t.at(t.p0,r),t.at(t.p1,r)];return R`${Mt(i,o)}`}function I0(t,e,n){let r=n.swing==="out",i=r?-e.across[1]:e.across[0],o=(e.across[0]-e.across[1])/2,s=n.hinge==="left"==e.direction>0,l=rn(n,e.exterior),a=n.leaves===2,[c,u]=[e.p0,e.p1],d=[],p=Fu(n.width,l,s,n);if(p){let v=w=>w<=.02?e.p0:w>=n.width-.02?e.p1:Wn(e.room,e.edge,n.offset-n.width/2+w);[c,u]=[v(p.x0),v(p.x1)],d=p.panels.map(([w,x])=>[v(w),v(x)])}let h=[(c[0]+u[0])/2,(c[1]+u[1])/2],f=(a?.5:1)*Math.hypot(u[0]-c[0],u[1]-c[1]),g=d.map(([v,w])=>R`${Mt(e.at(v,o+.035),e.at(w,o+.035),"nf-open-pane")}${Mt(e.at(v,o-.035),e.at(w,o-.035),"nf-open-pane")}`),b=(v,w)=>{let[x,k]=e.at(v,i),[M,A]=e.at(w,i),T=e.at(v,i+(r?-f:f)),F=f*t.scale,L=(T[0]-x)*(A-k)-(T[1]-k)*(M-x)>0?1:0;return R``},y;return l==="passage"?y=Mt(e.at(e.p0,o),e.at(e.p1,o),"nf-open-passage"):l==="sliding"?y=Mt(e.at(c,i),e.at(u,i)):a?y=R`${b(c,h)}${b(u,h)}`:y=s?b(c,u):b(u,c),R`${g}${y}`}function O0(t,e){let n=(t.across[0]-t.across[1])/2;if(e.opens==="slide"){let i=e.leaves===2?4:2,o=l=>[t.p0[0]+(t.p1[0]-t.p0[0])*l,t.p0[1]+(t.p1[1]-t.p0[1])*l],s=Array.from({length:i},(l,a)=>{let c=e.leaves===2?a===1||a===2?.035:-.035:a===0?.035:-.035;return Mt(t.at(o(Math.max(0,a/i-.03)),n+c),t.at(o(Math.min(1,(a+1)/i+.03)),n+c))});return R`${s}`}let r=e.leaves===2?Mt(t.at([(t.p0[0]+t.p1[0])/2,(t.p0[1]+t.p1[1])/2],t.across[0]),t.at([(t.p0[0]+t.p1[0])/2,(t.p0[1]+t.p1[1])/2],-t.across[1])):_;return R`${Mt(t.at(t.p0,n+.035),t.at(t.p1,n+.035))}${Mt(t.at(t.p0,n-.035),t.at(t.p1,n-.035))}${r}`}function eg(t,e,n,r){let i=e.openings.find(s=>s.id===r)?.front??null,o=s=>{let l=P0(t,s,e,n);if(!l)return _;let a=[l.at(l.p0,l.across[0]+.01),l.at(l.p1,l.across[0]+.01),l.at(l.p1,-l.across[1]-.01),l.at(l.p0,-l.across[1]-.01)],c=s.type==="door"&&Ws(rn(s,l.exterior)),u=s.id===r||!!s.front&&s.front===i,d=`nf-open nf-open-${s.type}${c?" nf-open-front":""}${u?" nf-open-sel":""}`,p=s.type==="garage"?D0(l,s):s.type==="door"?I0(t,l,s):O0(l,s);return R`h.join(",")).join(" ")} />${p}`};return R`${e.openings.map(o)}`}var tg=t=>Math.round(t*1e3)/1e3,ng=t=>Math.round(t*100)/100;function ir(t,e){let n=[...t??[]].slice(0,e);for(;n.lengtht.every(e=>e===null);function Si(t,e){let[n,r]=[t.points[e],t.points[(e+1)%t.points.length]];return Math.hypot(r[0]-n[0],r[1]-n[1])}function Vl(t,e,n){let r=ir(t.wall_heights,t.points.length);r[e]=n,t.wall_heights=is(r)?void 0:r,os(t,e,null)}function os(t,e,n){if(n===null&&!t.wall_slopes)return;let r=ir(t.wall_slopes,t.points.length);r[e]=n,t.wall_slopes=is(r)?void 0:r}function rg(t,e,n,r){let[i,o]=[n,r].map(l=>Math.min(30,Math.max(.05,tg(l)))),s=ir(t.wall_heights,t.points.length);s[e]=i,t.wall_heights=s,os(t,e,o)}function ig(t,e,n){let r=t.wall_heights?.[e];os(t,e,null),typeof r=="number"&&r>=n-.005&&Vl(t,e,null)}function og(t,e,n,r,i){let o=ir(t.wall_heights,t.points.length),s=o[e],l=Array.isArray(s)?[...s]:new Array(i).fill(typeof s=="number"?s:null);for(;l.lengtha===l[0])?l[0]:l,t.wall_heights=is(o)?void 0:o,os(t,e,null)}function sg(t,e,n,r){let i=Si(t,e),o=n===void 0?0:r[n],s=n===void 0?i:r[n+1]??i;if(s-o<.4)return!1;let l=ng((o+s)/2),a=ir(t.wall_splits,t.points.length);a[e]=[...a[e]??[],l].sort((u,d)=>u-d),t.wall_splits=a;let c=t.wall_heights?.[e];return Array.isArray(c)&&c.splice((n??0)+1,0,c[n??0]??null),!0}function ag(t,e,n,r,i){let o=Si(t,e),s=i.filter(u=>Math.abs(u-n)>.001&&u>0),l=Math.max(.1,Math.min(o-.1,ng(r)));s.some(u=>Math.abs(u-l)<.1)&&(l=n);let a=t.wall_splits?.[e];if(!a)return;let c=a.findIndex(u=>Math.abs(u-n)<.001);c>=0&&(a[c]=l),a.sort((u,d)=>u-d)}function lg(t,e,n,r){let i=t.wall_splits;if(!i?.[e])return;let o=i[e].filter(l=>Math.abs(l-n)>.001);i[e]=o.length>0?o:null,i.every(l=>!l)&&(t.wall_splits=void 0);let s=t.wall_heights?.[e];Array.isArray(s)&&(s.splice(r,1),s.every(l=>l===s[0])&&(t.wall_heights[e]=s[0]??null))}function cg(t,e,n,r,i=1){let o=ir(t.wall_thickness,t.points.length);if(r===void 0||i<2)o[e]=n;else{let s=o[e],l=Array.isArray(s)?[...s]:new Array(i).fill(typeof s=="number"?s:null);for(;l.lengtha===l[0])?l[0]:l}t.wall_thickness=is(o)?void 0:o}function ug(t,e){let n=Math.min(1.5,Math.max(.02,tg(t)));return Math.abs(n-e)<5e-4?null:n}var dg=.005,hg=(t,e)=>`room:${t.id}:${e}`;function pg(t,e,n){let r=t.t,i=e.ceiling??t.floor.height,o=e.points.length,{wall_exterior:s,wall_interior:l}=t.doc.settings,a=c=>{let u=e.wall_heights?.[c]??null,d=n.partsOf(e,c);return(d.length>1?d.map((h,f)=>f):[void 0]).map(h=>{let f=Array.isArray(u)?u[h??0]??null:u,g=e.wall_thickness?.[c]??null,b=Array.isArray(g)?g[h??0]??null:g,y=h===void 0?Si(e,c):(d[h+1]??Si(e,c))-d[h],v=P=>n.setHeight(e,c,h,P),w=n.isOuter(e,c)?s:l,x=`${r("wall_n",{a:c+1,b:(c+1)%o+1})}${h===void 0?"":` \xB7 ${r("wall_part",{n:h+1})}`}`,k=h!==void 0&&h>0&&(e.wall_splits?.[c]??[]).some(P=>Math.abs(P-d[h])<.001),M=e.wall_slopes?.[c],A=h===void 0&&typeof M=="number"&&typeof u=="number",T=f??i,F=()=>n.light(c),L=()=>n.light(null);return m`
    + ${S(r("note_photo_hint"),"nf-wide")}`}function L0(t,e,n,r){let i=Ce(e,n.rooms,n.walls??[]);if(!i)return null;let{room:o,edge:s}=i,l=Vt(r,e,i),a=Vn(o,s,e.offset-e.width/2),c=Vn(o,s,e.offset+e.width/2),u=[(c[0]-a[0])/(e.width||1),(c[1]-a[1])/(e.width||1)],d=_e(o.points)>=0?1:-1,p=[-u[1]*d,u[0]*d],h=[.06,.06];return l&&(h=l.wall.free||l.wall.roomLeft===o.id?[l.wall.left,l.wall.right]:[l.wall.right,l.wall.left]),{room:o,edge:s,p0:a,p1:c,inward:p,direction:d,across:h,exterior:l?.wall.exterior??!1,at:(f,g)=>t.toScreen([f[0]+p[0]*g,f[1]+p[1]*g])}}var Mt=(t,e,n="")=>R``;function C0(t,e){let n=t.across[0]-.04,r=t.across[0]+Math.min(2,e.height),[i,o,s,l]=[t.at(t.p0,n),t.at(t.p1,n),t.at(t.p0,r),t.at(t.p1,r)];return R`${Mt(i,o)}`}function N0(t,e,n){let r=n.swing==="out",i=r?-e.across[1]:e.across[0],o=(e.across[0]-e.across[1])/2,s=n.hinge==="left"==e.direction>0,l=rn(n,e.exterior),a=n.leaves===2,[c,u]=[e.p0,e.p1],d=[],p=Pu(n.width,l,s,n);if(p){let v=w=>w<=.02?e.p0:w>=n.width-.02?e.p1:Vn(e.room,e.edge,n.offset-n.width/2+w);[c,u]=[v(p.x0),v(p.x1)],d=p.panels.map(([w,x])=>[v(w),v(x)])}let h=[(c[0]+u[0])/2,(c[1]+u[1])/2],f=(a?.5:1)*Math.hypot(u[0]-c[0],u[1]-c[1]),g=d.map(([v,w])=>R`${Mt(e.at(v,o+.035),e.at(w,o+.035),"nf-open-pane")}${Mt(e.at(v,o-.035),e.at(w,o-.035),"nf-open-pane")}`),b=(v,w)=>{let[x,k]=e.at(v,i),[M,A]=e.at(w,i),T=e.at(v,i+(r?-f:f)),F=f*t.scale,L=(T[0]-x)*(A-k)-(T[1]-k)*(M-x)>0?1:0;return R``},y;return l==="passage"?y=Mt(e.at(e.p0,o),e.at(e.p1,o),"nf-open-passage"):l==="sliding"?y=Mt(e.at(c,i),e.at(u,i)):a?y=R`${b(c,h)}${b(u,h)}`:y=s?b(c,u):b(u,c),R`${g}${y}`}function B0(t,e){let n=(t.across[0]-t.across[1])/2;if(e.opens==="slide"){let i=e.leaves===2?4:2,o=l=>[t.p0[0]+(t.p1[0]-t.p0[0])*l,t.p0[1]+(t.p1[1]-t.p0[1])*l],s=Array.from({length:i},(l,a)=>{let c=e.leaves===2?a===1||a===2?.035:-.035:a===0?.035:-.035;return Mt(t.at(o(Math.max(0,a/i-.03)),n+c),t.at(o(Math.min(1,(a+1)/i+.03)),n+c))});return R`${s}`}let r=e.leaves===2?Mt(t.at([(t.p0[0]+t.p1[0])/2,(t.p0[1]+t.p1[1])/2],t.across[0]),t.at([(t.p0[0]+t.p1[0])/2,(t.p0[1]+t.p1[1])/2],-t.across[1])):_;return R`${Mt(t.at(t.p0,n+.035),t.at(t.p1,n+.035))}${Mt(t.at(t.p0,n-.035),t.at(t.p1,n-.035))}${r}`}function ig(t,e,n,r){let i=e.openings.find(s=>s.id===r)?.front??null,o=s=>{let l=L0(t,s,e,n);if(!l)return _;let a=[l.at(l.p0,l.across[0]+.01),l.at(l.p1,l.across[0]+.01),l.at(l.p1,-l.across[1]-.01),l.at(l.p0,-l.across[1]-.01)],c=s.type==="door"&&Ks(rn(s,l.exterior)),u=s.id===r||!!s.front&&s.front===i,d=`nf-open nf-open-${s.type}${c?" nf-open-front":""}${u?" nf-open-sel":""}`,p=s.type==="garage"?C0(l,s):s.type==="door"?N0(t,l,s):B0(l,s);return R`h.join(",")).join(" ")} />${p}`};return R`${e.openings.map(o)}`}var og=t=>Math.round(t*1e3)/1e3,sg=t=>Math.round(t*100)/100;function sr(t,e){let n=[...t??[]].slice(0,e);for(;n.lengtht.every(e=>e===null);function Ri(t,e){let[n,r]=[t.points[e],t.points[(e+1)%t.points.length]];return Math.hypot(r[0]-n[0],r[1]-n[1])}function Ul(t,e,n){let r=sr(t.wall_heights,t.points.length);r[e]=n,t.wall_heights=ss(r)?void 0:r,as(t,e,null)}function as(t,e,n){if(n===null&&!t.wall_slopes)return;let r=sr(t.wall_slopes,t.points.length);r[e]=n,t.wall_slopes=ss(r)?void 0:r}function ag(t,e,n,r){let[i,o]=[n,r].map(l=>Math.min(30,Math.max(.05,og(l)))),s=sr(t.wall_heights,t.points.length);s[e]=i,t.wall_heights=s,as(t,e,o)}function lg(t,e,n){let r=t.wall_heights?.[e];as(t,e,null),typeof r=="number"&&r>=n-.005&&Ul(t,e,null)}function cg(t,e,n,r,i){let o=sr(t.wall_heights,t.points.length),s=o[e],l=Array.isArray(s)?[...s]:new Array(i).fill(typeof s=="number"?s:null);for(;l.lengtha===l[0])?l[0]:l,t.wall_heights=ss(o)?void 0:o,as(t,e,null)}function ug(t,e,n,r){let i=Ri(t,e),o=n===void 0?0:r[n],s=n===void 0?i:r[n+1]??i;if(s-o<.4)return!1;let l=sg((o+s)/2),a=sr(t.wall_splits,t.points.length);a[e]=[...a[e]??[],l].sort((u,d)=>u-d),t.wall_splits=a;let c=t.wall_heights?.[e];return Array.isArray(c)&&c.splice((n??0)+1,0,c[n??0]??null),!0}function dg(t,e,n,r,i){let o=Ri(t,e),s=i.filter(u=>Math.abs(u-n)>.001&&u>0),l=Math.max(.1,Math.min(o-.1,sg(r)));s.some(u=>Math.abs(u-l)<.1)&&(l=n);let a=t.wall_splits?.[e];if(!a)return;let c=a.findIndex(u=>Math.abs(u-n)<.001);c>=0&&(a[c]=l),a.sort((u,d)=>u-d)}function hg(t,e,n,r){let i=t.wall_splits;if(!i?.[e])return;let o=i[e].filter(l=>Math.abs(l-n)>.001);i[e]=o.length>0?o:null,i.every(l=>!l)&&(t.wall_splits=void 0);let s=t.wall_heights?.[e];Array.isArray(s)&&(s.splice(r,1),s.every(l=>l===s[0])&&(t.wall_heights[e]=s[0]??null))}function pg(t,e,n,r,i=1){let o=sr(t.wall_thickness,t.points.length);if(r===void 0||i<2)o[e]=n;else{let s=o[e],l=Array.isArray(s)?[...s]:new Array(i).fill(typeof s=="number"?s:null);for(;l.lengtha===l[0])?l[0]:l}t.wall_thickness=ss(o)?void 0:o}function fg(t,e){let n=Math.min(1.5,Math.max(.02,og(t)));return Math.abs(n-e)<5e-4?null:n}var mg=.005,gg=(t,e)=>`room:${t.id}:${e}`;function _g(t,e,n){let r=t.t,i=e.ceiling??t.floor.height,o=e.points.length,{wall_exterior:s,wall_interior:l}=t.doc.settings,a=c=>{let u=e.wall_heights?.[c]??null,d=n.partsOf(e,c);return(d.length>1?d.map((h,f)=>f):[void 0]).map(h=>{let f=Array.isArray(u)?u[h??0]??null:u,g=e.wall_thickness?.[c]??null,b=Array.isArray(g)?g[h??0]??null:g,y=h===void 0?Ri(e,c):(d[h+1]??Ri(e,c))-d[h],v=P=>n.setHeight(e,c,h,P),w=n.isOuter(e,c)?s:l,x=`${r("wall_n",{a:c+1,b:(c+1)%o+1})}${h===void 0?"":` \xB7 ${r("wall_part",{n:h+1})}`}`,k=h!==void 0&&h>0&&(e.wall_splits?.[c]??[]).some(P=>Math.abs(P-d[h])<.001),M=e.wall_slopes?.[c],A=h===void 0&&typeof M=="number"&&typeof u=="number",T=f??i,F=()=>n.light(c),L=()=>n.light(null);return m`
    ${x}
    ${pe(t.hass,y)}
    ${f===0?m`${r("wall_none")}`:A?m`${E(t,r("wall_slope_start"),u,P=>n.setSlope(e,c,P,M),.05,.05)} ${E(t,r("wall_slope_end"),M,P=>n.setSlope(e,c,u,P),.05,.05)}`:E(t,r("wall_height"),T,P=>v(P>=i-dg?null:Math.max(.05,P)),.05,.05)} + >`:E(t,r("wall_height"),T,P=>v(P>=i-mg?null:Math.max(.05,P)),.05,.05)} ${t.admin&&A?m``:_} ${t.admin&&f!==null&&!A?m``:_} - ${t.admin&&h===void 0&&f!==0&&!A?m``:_} + ${t.admin&&h===void 0&&f!==0&&!A?m``:_} ${t.admin&&f!==0?m``:_} ${t.admin&&y>=.4?m``:_} - ${h===void 0&&y>=.4?Zo(t,hg(e,c),n.arc):_} + ${h===void 0&&y>=.4?Yo(t,gg(e,c),n.arc):_} ${(h===void 0||h===0)&&f!==0?m``:_} ${f!==0?m`${E(t,r("edge_thickness"),b??w,P=>n.setThickness(e,c,ug(P,w),h,d.length),.01,.02)} + >${E(t,r("edge_thickness"),b??w,P=>n.setThickness(e,c,fg(P,w),h,d.length),.01,.02)} ${t.admin&&b!=null?m``:_}`:_} - ${h===void 0?qo(t,hg(e,c),n.arc):_} + ${h===void 0?Xo(t,gg(e,c),n.arc):_} ${k?m`${E(t,r("wall_split_at"),d[h],P=>n.moveCut(e,c,d[h],P),.05,.1)} ${t.admin?m``:_}`})};return m`
    ${r("wall_heights")} ${e.points.flatMap((c,u)=>a(u))} ${S(r("room_wall_hint"))} -
    `}function fg(t){let e=t?.attributes;return{temperature:"\u{1F321}",humidity:"\u{1F4A7}",carbon_dioxide:"\u2601",illuminance:"\u2600",power:"\u26A1",energy:"\u26A1"}[String(e?.device_class)]??(e?.unit_of_measurement==="\xB0C"?"\u{1F321}":"\u25C9")}function or(t,e=[],n){let r=O(t.hass,o=>!t.hass?.states[o]?.attributes.symcon_source_entity||e.some(s=>s.entity===o)),i=(o,s)=>n(e.map(l=>l.id===o?{...l,...s}:l));return m``}function yg(t,e,n){let r=e.color_entity&&e.color_entity!=="none"?e.color_entity:n;return r?t.states[r]:void 0}var Gl=["none","rainbow","pulse","flicker"];function ls(t,e,n,r){let i=e.effect_animations??{},o=Hu(),s=c=>Gl.includes(c)||o.includes(c),l=[...new Set([...Object.keys(i),...Array.isArray(n)?n.filter(c=>typeof c=="string"):[]])],a=(c,u,d,p=!1)=>{let h=Object.prototype.hasOwnProperty.call(i,c),f=Array.from(c).length,g=p&&h?"light_effect_exists":u!==""&&(f<1||f>255)?"light_effect_name_limit":u!==""&&!h&&Object.keys(i).length>=100?"light_effect_count_limit":void 0;if(d.setCustomValidity?.(g?t.t(g):""),g){let y=d.closest?.("details")?.querySelector("[data-effect-feedback]");return y&&(y.textContent=t.t(g)),d.reportValidity?.(),p||(d.value=h?i[c]:""),!1}let b={...i};return u===""?delete b[c]:Object.defineProperty(b,c,{value:u,enumerable:!0,configurable:!0,writable:!0}),r({effect_animations:b}),!0};return m`
    ${t.t("light_effects")} ${S(t.t("light_effects_hint"))} `)} ${S(`${t.t("light_effect_name_limit")} ${t.t("light_effect_count_limit")}`)}

    -
    `}var H0=/speaker|sound|subwoofer|receiver|smart_|display|tv|media|turntable|projector|console/;function L0(t,e,n){let r=Q(e),i=t.hass?.language??"en",o=[...Yi.map(l=>({type:l,label:t.t(`furn_${l}`)})),...n.flatMap(l=>l.items.map(a=>({type:he(l.id,a.id),label:`${Je(a,he(l.id,a.id),i)} \xB7 ${Be(l,i)}`})))],s=l=>r==="light"?ue(l):r==="climate"?l==="radiator"||En(l):e.startsWith("vacuum.")?l==="robot_vacuum"||vt(l)&&l.endsWith(":robot_vacuum"):r==="media"?zr(l)||Tt(l)&&H0.test(l):Tt(l)&&!ue(l);return o.filter(l=>s(l.type)).sort((l,a)=>l.label.localeCompare(a.label))}function C0(t,e,n){if(!t.admin)return _;let r=L0(t,e.entity_id,n.packs);return r.length===0?_:m`
    ${t.admin?m`
    ${e.y!==null?m``:_} - ${C0(t,e,n)} + ${K0(t,e,n)}
    `:_} - `}var sr=t=>t==="wallbox"||/^pack:[^:]+:(wallbox|ev_charger|ev_bike_charger|charging_station)$/.test(t);function gg(t,e,n){if(!sr(e.type))return _;let r=t.t,i=e.charging??{},o=O(t.hass,()=>!0),s=u=>{let d={...i,...u};n({charging:Object.values(d).some(p=>p!=null)?d:null})},l=[["auto",r("charging_auto")],["value",r("charging_value")],["seconds",r("charging_unix_seconds")],["milliseconds",r("charging_unix_ms")]],a=[["auto",r("charging_auto")],["value",r("charging_value")],["seconds",r("charging_seconds")],["minutes",r("charging_minutes")],["hours",r("charging_hours")]],c=(u,d,p)=>z(t,d,i[u]??null,void 0,o,h=>s({[u]:h==="none"?null:h}),{types:p});return m``}var Ei=t=>Number(t);function cs(t){if(Array.isArray(t)){let[o,s]=[Ei(t[0]),Ei(t[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!t||typeof t!="object")return null;let{x:e,y:n}=t,[r,i]=[Ei(e),Ei(n)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function xg(t){return t?cs(t.charger)??cs(t.charger_position):null}function us(t){for(let[e,n]of Object.entries(t.states))if(e.startsWith("camera.")&&(cs(n.attributes?.vacuum_position)??xg(n.attributes)))return e;return null}var ql=(t,e)=>e?[t[0],-t[1]]:t;var $g=5e-4,Sg=2,U0=1.5;function Yl(t,e){let n=e?t.states[e]?.attributes:void 0;return{at:n?cs(n.vacuum_position):null,dock:xg(n)}}function Mg(t,e,n=!1){let r=Math.hypot(e.plan[0]-t.plan[0],e.plan[1]-t.plan[1]),i=Math.hypot(e.grid[0]-t.grid[0],e.grid[1]-t.grid[1]);if(!(i>1e-6)||!(r>=U0))return{cal:null,reason:"close"};let o=r/i;return o>=$g&&o<=Sg?{cal:{a:t.plan,ga:t.grid,b:e.plan,gb:e.grid,mirror:n}}:{cal:null,reason:"scale"}}function Rg(t,e){let n=e?t.states[e]?.attributes?.rooms:void 0;if(!n||typeof n!="object")return[];let r=[];for(let i of Object.values(n)){if(!i||typeof i!="object")continue;let o=i,s=typeof o.name=="string"?o.name.trim():"",l=[o.x0,o.y0,o.x1,o.y1].map(Ei);!s||!l.every(Number.isFinite)||r.push({name:s,center:[(l[0]+l[2])/2,(l[1]+l[3])/2]})}return r}var wg=t=>t.toLocaleLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^\p{L}\p{N}]+/gu,"");function G0(t){let e=t.length,[n,r]=t.reduce((h,f)=>[h[0]+f.seen[0]/e,h[1]+f.seen[1]/e],[0,0]),[i,o]=t.reduce((h,f)=>[h[0]+f.plan[0]/e,h[1]+f.plan[1]/e],[0,0]),[s,l,a]=[0,0,0];for(let h of t){let[f,g]=[h.seen[0]-n,h.seen[1]-r],[b,y]=[h.plan[0]-i,h.plan[1]-o];s+=f*b+g*y,l+=f*y-g*b,a+=f*f+g*g}if(!(a>1e-9))return null;let[c,u]=[s/a,l/a],d=h=>{let[f,g]=[h[0]-n,h[1]-r];return[i+c*f-u*g,o+u*f+c*g]},p=Math.sqrt(t.reduce((h,f)=>h+Math.hypot(d(f.seen)[0]-f.plan[0],d(f.seen)[1]-f.plan[1])**2,0)/e);return{map:d,scale:Math.hypot(c,u),rms:p}}function Eg(t,e,n=!1){let r=new Map(e.map(g=>[wg(g.name),g])),i=[],o=new Set;for(let g of t){let b=wg(g.name),y=r.get(b);if(!y||o.has(b)||g.points.length<3)continue;o.add(b);let v=g.points.map(x=>x[0]),w=g.points.map(x=>x[1]);i.push({name:g.name,plan:[(Math.min(...v)+Math.max(...v))/2,(Math.min(...w)+Math.max(...w))/2],grid:y.center})}let s=i.map(g=>g.name);if(i.length<2)return{cal:null,reason:"rooms",matched:s};let a=(i.length>=3?[!1,!0]:[n]).flatMap(g=>{let b=G0(i.map(y=>({plan:y.plan,seen:ql(y.grid,g)})));return b?[{mirror:g,...b}]:[]}).sort((g,b)=>g.rms-b.rms)[0];if(!a)return{cal:null,reason:"rooms",matched:s};if(!(a.scale>=$g&&a.scale<=Sg))return{cal:null,reason:"scale",matched:s};let c=Math.max(...i.map(g=>Math.hypot(g.plan[0]-i[0].plan[0],g.plan[1]-i[0].plan[1])));if(!(a.rms<=Math.max(1,c/4)))return{cal:null,reason:"fit",matched:s};let[u,d,p]=[0,1,-1];for(let g=0;gp&&([u,d,p]=[g,b,y])}let[h,f]=[i[u].grid,i[d].grid];return{cal:{a:a.map(ql(h,a.mirror)),ga:h,b:a.map(ql(f,a.mirror)),gb:f,mirror:a.mirror},matched:s,rms:a.rms}}function Ag(t,e){let[n,r]=[(t.a[0]+t.b[0])/2,(t.a[1]+t.b[1])/2],i=(e.turn??0)*Math.PI/180,[o,s,l]=[Math.cos(i),Math.sin(i),e.grow??1],[a,c]=e.move??[0,0],u=d=>{let[p,h]=[(d[0]-n)*l,(d[1]-r)*l];return[kg(n+p*o-h*s+a),kg(r+p*s+h*o+c)]};return{...t,a:u(t.a),b:u(t.b)}}var kg=t=>Math.round(t*1e3)/1e3;var Z0=/^(binary_sensor|switch|input_boolean|light|fan|person|device_tracker|sensor)\./,Rt=t=>t==="none"?null:t;function Xl(t,e,n){let r=t.t,i=O(t.hass,a=>Z0.test(a)),o=!!e.state_entity&&e.state_entity!=="none",s=o&&!!e.state_entity2&&e.state_entity2!=="none",l=[["left_right",r("furn_state_left_right")],["top_bottom",r("furn_state_top_bottom")]];return m`${z(t,r("furn_state_entity"),e.state_entity??null,void 0,i,a=>n.update({state_entity:Rt(a)}))} ${o?z(t,r("furn_state_entity2"),e.state_entity2??null,void 0,i,a=>n.update({state_entity2:Rt(a)})):_} ${s?H(t,r("furn_state_split"),e.state_split==="top_bottom"?"top_bottom":"left_right",l,a=>n.update({state_split:a})):_} - ${S(r("furn_state_hint"),"nf-wide")}`}function K0(t,e){let r=On(t.type)&&(!vt(t.type)||Yc(t.type));return ue(t.type)?{accept:i=>/^(light|switch|input_boolean)\./.test(i),label:"furn_entity_light"}:t.type==="radiator"||En(t.type)?{accept:i=>i.startsWith("climate."),label:"furn_entity_climate"}:r?{accept:i=>/^(media_player|switch|input_boolean|light)\./.test(i),label:"furn_entity_tv"}:t.type==="robot_vacuum"?{accept:i=>i.startsWith("vacuum."),label:"furn_entity_vacuum"}:/:(robot_mower|mower_dock)$/.test(t.type)?{accept:i=>i.startsWith("lawn_mower."),label:"furn_entity_mower"}:/:(sprinkler|valve_box)$/.test(t.type)?{accept:i=>/^(valve|switch|input_boolean)\./.test(i),label:"furn_entity_water"}:{accept:i=>/^(switch|media_player|fan|input_boolean|climate|vacuum|cover|valve)\./.test(i)||Bc(e?.states[i]),label:"furn_entity"}}function cs(t,e,n){if(!t.hass)return null;let r=structuredClone(t.doc.floors);for(let i of r)for(let o of i.furniture)o.id===e.id&&(o[n==="fan"?"fan_entity":n]=null);return Me(t.hass,r).get(e.id)?.[n]??null}var j0=t=>t==="meter"?"energy_grid":t==="inverter"?"energy_solar_sensor":t==="home_battery"?"energy_battery_sensor":"furn_power",ct=(...t)=>m``;async function U0(t){let e=t.hass?ls(t.hass):null;if(!t.hass||!e)return{at:null,dock:null};let n=()=>{let i=t.hass?.states[e]?.attributes??{};return`${String(i.render_count??"")}|${JSON.stringify(i.vacuum_position??null)}`},r=n();try{await t.hass.fetchWithAuth?.(`/api/camera_proxy/${e}`)}catch{}for(let i=0;i<8&&n()===r;i++)await new Promise(o=>setTimeout(o,100));return Gl(t.hass,e)}function G0(t,e){let n=t.t,r=a=>t.change(c=>{c.settings.vacuum_map=Sg(e,a)}),i=(a,c,u)=>m``,[o,s,l]=[n("robot_cal_nudge_move"),n("robot_cal_nudge_turn"),n("robot_cal_nudge_grow")];return m`${S(n("robot_cal_nudge"),"nf-wide")} + ${S(r("furn_state_hint"),"nf-wide")}`}function q0(t,e){let r=Hn(t.type)&&(!vt(t.type)||Qc(t.type));return ue(t.type)?{accept:i=>/^(light|switch|input_boolean)\./.test(i),label:"furn_entity_light"}:t.type==="radiator"||An(t.type)?{accept:i=>i.startsWith("climate."),label:"furn_entity_climate"}:r?{accept:i=>/^(media_player|switch|input_boolean|light)\./.test(i),label:"furn_entity_tv"}:t.type==="robot_vacuum"?{accept:i=>i.startsWith("vacuum."),label:"furn_entity_vacuum"}:/:(robot_mower|mower_dock)$/.test(t.type)?{accept:i=>i.startsWith("lawn_mower."),label:"furn_entity_mower"}:/:(sprinkler|valve_box)$/.test(t.type)?{accept:i=>/^(valve|switch|input_boolean)\./.test(i),label:"furn_entity_water"}:{accept:i=>/^(switch|media_player|fan|input_boolean|climate|vacuum|cover|valve)\./.test(i)||Kc(e?.states[i]),label:"furn_entity"}}function ds(t,e,n){if(!t.hass)return null;let r=structuredClone(t.doc.floors);for(let i of r)for(let o of i.furniture)o.id===e.id&&(o[n==="fan"?"fan_entity":n]=null);return Me(t.hass,r).get(e.id)?.[n]??null}var Y0=t=>t==="meter"?"energy_grid":t==="inverter"?"energy_solar_sensor":t==="home_battery"?"energy_battery_sensor":"furn_power",ct=(...t)=>m``;async function X0(t){let e=t.hass?us(t.hass):null;if(!t.hass||!e)return{at:null,dock:null};let n=()=>{let i=t.hass?.states[e]?.attributes??{};return`${String(i.render_count??"")}|${JSON.stringify(i.vacuum_position??null)}`},r=n();try{await t.hass.fetchWithAuth?.(`/api/camera_proxy/${e}`)}catch{}for(let i=0;i<8&&n()===r;i++)await new Promise(o=>setTimeout(o,100));return Yl(t.hass,e)}function J0(t,e){let n=t.t,r=a=>t.change(c=>{c.settings.vacuum_map=Ag(e,a)}),i=(a,c,u)=>m``,[o,s,l]=[n("robot_cal_nudge_move"),n("robot_cal_nudge_turn"),n("robot_cal_nudge_grow")];return m`${S(n("robot_cal_nudge"),"nf-wide")}
    ${i("\u2190",o,{move:[-.1,0]})}${i("\u2192",o,{move:[.1,0]})}${i("\u2191",o,{move:[0,-.1]})}${i("\u2193",o,{move:[0,.1]})} ${i("\u27F2",s,{turn:-1})}${i("\u27F3",s,{turn:1})}${i("\u2212",l,{grow:.99})}${i("+",l,{grow:1.01})} -
    `}function Z0(t,e){let n=t.t,r=t.doc.settings.vacuum_map??null,i=t.hass?Gl(t.hass,ls(t.hass)):{at:null,dock:null},o=r?Math.hypot(r.gb[0]-r.ga[0],r.gb[1]-r.ga[1]):0,s=r&&o>0?Math.hypot(r.b[0]-r.a[0],r.b[1]-r.a[1])/o:0,l=()=>{t.pickPoint(p=>{p&&U0(t).then(h=>{if(!h.at||!h.dock)return;let f={plan:[e.x,e.z],grid:h.dock},g=kg(f,{plan:p,grid:h.at},r?.mirror??!1);g.cal&&t.change(b=>{b.settings.vacuum_map=g.cal})})})},a=t.hass?ls(t.hass):null,c=t.hass?xg(t.hass,a):[],u=t.doc.floors.find(p=>p.furniture.some(h=>h.id===e.id)),d=()=>{if(!u)return;let p=$g(u.rooms,c,r?.mirror??!1);if(p.cal){let h=p.cal;t.change(f=>{f.settings.vacuum_map=h})}else alert(n(p.reason==="rooms"?"robot_cal_rooms_none":"robot_cal_rooms_bad",{n:p.matched.length}))};return ct(S(i.at&&i.dock?r?n("robot_cal_done",{m:s.toFixed(2)}):n("robot_cal_none"):n("robot_cal_need"),"nf-wide"),c.length>=2?m``:_,m``,r?D(t,n("robot_cal_mirror"),!!r.mirror,p=>t.change(h=>{h.settings.vacuum_map={...r,mirror:p}})):_,r?G0(t,r):_,r?m``:_,S(n("robot_cal_hint"),"nf-wide"))}function q0(t,e,n){let r=t.t,i=t.doc;if(!i.energy.advanced)return _;let o=qn(i),s=i.floors.flatMap(l=>l.furniture.filter(a=>o.has(a.id)).map(a=>[a.id,`${a.name||r("furn_meter")} \xB7 ${l.name}`]));return ct(H(t,r("meter_parent"),ai(i,e)??"",[["",r("meter_main")],...s],l=>n.update({parent_meter:l||null}),{wide:!0}),S(r("meter_device_hint"),"nf-wide"))}function Y0(t,e,n){let r=t.t,i=t.doc;if(!i.energy.advanced)return _;let o=i.floors.flatMap(c=>c.furniture.filter(u=>hh(i,e,u)).map(u=>[u.id,`${u.name||r("furn_meter")} \xB7 ${c.name}`])),s=!!_n(i,e),l=e.meter_floors??[],a=(c,u)=>n.update({meter_floors:u?[...l.filter(d=>d!==c),c]:l.filter(d=>d!==c)});return ct(H(t,r("meter_parent"),s?e.parent_meter:"",[["",r("meter_parent_none")],...o],c=>n.update({parent_meter:c||null}),{wide:!0}),s?D(t,r("energy_invert"),!!e.meter_invert,c=>n.update({meter_invert:c})):_,s?m`
    ${r("meter_floors")}
    ${i.floors.map(c=>D(t,c.name,l.includes(c.id),u=>a(c.id,u)))}`:_,S(r("meter_sub_hint"),"nf-wide"))}function Mg(t,e,n,r){let i=t.t,o=n==="mail"?s=>/^(binary_sensor|sensor|input_boolean)\./.test(s):s=>/^(sensor|binary_sensor|calendar)\./.test(s);return m``}function Q0(t,e){let n=t.t,r=t.doc.settings.vacuum_map??null,i=t.hass?Yl(t.hass,us(t.hass)):{at:null,dock:null},o=r?Math.hypot(r.gb[0]-r.ga[0],r.gb[1]-r.ga[1]):0,s=r&&o>0?Math.hypot(r.b[0]-r.a[0],r.b[1]-r.a[1])/o:0,l=()=>{t.pickPoint(p=>{p&&X0(t).then(h=>{if(!h.at||!h.dock)return;let f={plan:[e.x,e.z],grid:h.dock},g=Mg(f,{plan:p,grid:h.at},r?.mirror??!1);g.cal&&t.change(b=>{b.settings.vacuum_map=g.cal})})})},a=t.hass?us(t.hass):null,c=t.hass?Rg(t.hass,a):[],u=t.doc.floors.find(p=>p.furniture.some(h=>h.id===e.id)),d=()=>{if(!u)return;let p=Eg(u.rooms,c,r?.mirror??!1);if(p.cal){let h=p.cal;t.change(f=>{f.settings.vacuum_map=h})}else alert(n(p.reason==="rooms"?"robot_cal_rooms_none":"robot_cal_rooms_bad",{n:p.matched.length}))};return ct(S(i.at&&i.dock?r?n("robot_cal_done",{m:s.toFixed(2)}):n("robot_cal_none"):n("robot_cal_need"),"nf-wide"),c.length>=2?m``:_,m``,r?D(t,n("robot_cal_mirror"),!!r.mirror,p=>t.change(h=>{h.settings.vacuum_map={...r,mirror:p}})):_,r?J0(t,r):_,r?m``:_,S(n("robot_cal_hint"),"nf-wide"))}function ek(t,e,n){let r=t.t,i=t.doc;if(!i.energy.advanced)return _;let o=Yn(i),s=i.floors.flatMap(l=>l.furniture.filter(a=>o.has(a.id)).map(a=>[a.id,`${a.name||r("furn_meter")} \xB7 ${l.name}`]));return ct(H(t,r("meter_parent"),li(i,e)??"",[["",r("meter_main")],...s],l=>n.update({parent_meter:l||null}),{wide:!0}),S(r("meter_device_hint"),"nf-wide"))}function tk(t,e,n){let r=t.t,i=t.doc;if(!i.energy.advanced)return _;let o=i.floors.flatMap(c=>c.furniture.filter(u=>mh(i,e,u)).map(u=>[u.id,`${u.name||r("furn_meter")} \xB7 ${c.name}`])),s=!!bn(i,e),l=e.meter_floors??[],a=(c,u)=>n.update({meter_floors:u?[...l.filter(d=>d!==c),c]:l.filter(d=>d!==c)});return ct(H(t,r("meter_parent"),s?e.parent_meter:"",[["",r("meter_parent_none")],...o],c=>n.update({parent_meter:c||null}),{wide:!0}),s?D(t,r("energy_invert"),!!e.meter_invert,c=>n.update({meter_invert:c})):_,s?m`
    ${r("meter_floors")}
    ${i.floors.map(c=>D(t,c.name,l.includes(c.id),u=>a(c.id,u)))}`:_,S(r("meter_sub_hint"),"nf-wide"))}function Fg(t,e,n,r){let i=t.t,o=n==="mail"?s=>/^(binary_sensor|sensor|input_boolean)\./.test(s):s=>/^(sensor|binary_sensor|calendar)\./.test(s);return m``}function Rg(t,e,n){let r=t.t;return m``}function Tg(t,e,n){let r=t.t;return m``}function Eg(t,e,n,r){let i=t.t,o=/socket/.test(e.type),s=O(t.hass,c=>/^(light|switch|input_boolean|fan)\./.test(c)),l=e.gang_entities??[],a=c=>u=>{let d=Array.from({length:n},(p,h)=>l[h]??null);d[c]=Rt(u),r.update({gang_entities:d})};return m``}function zg(t,e,n,r){let i=t.t,o=/socket/.test(e.type),s=O(t.hass,c=>/^(light|switch|input_boolean|fan)\./.test(c)),l=e.gang_entities??[],a=c=>u=>{let d=Array.from({length:n},(p,h)=>l[h]??null);d[c]=Rt(u),r.update({gang_entities:d})};return m``}function X0(t,e,n){let r=t.t,i=O(t.hass,o=>{let s=t.hass?.states[o]?.attributes;return o.startsWith("sensor.")&&(s?.device_class==="temperature"||s?.unit_of_measurement==="\xB0C"||s?.unit_of_measurement==="\xB0F")});return ct(z(t,r("fridge_temp"),e.temp_entity??null,void 0,i,o=>n.update({temp_entity:Rt(o)}),{types:[1,2]}),z(t,r("freezer_temp"),e.temp_entity2??null,void 0,i,o=>n.update({temp_entity2:Rt(o)}),{types:[1,2]}),S(r("fridge_temp_hint"),"nf-wide"))}function J0(t,e,n){let r=t.t,i=O(t.hass,o=>{let s=t.hass?.states[o]?.attributes;return o.startsWith("sensor.")&&(s?.device_class==="temperature"||s?.unit_of_measurement==="\xB0C"||s?.unit_of_measurement==="\xB0F")});return ct(z(t,r("device_temp"),e.temp_entity??null,void 0,i,o=>n.update({temp_entity:Rt(o)}),{types:[1,2]}),S(r("device_temp_hint"),"nf-wide"))}function Q0(t,e,n){let r=t.t,i=e.extra_lights??[],o=O(t.hass,a=>a.startsWith("light.")&&a!==e.entity&&a!==e.color_entity),s=a=>c=>{let u=[...i];c&&c!=="none"?u[a]=c:u.splice(a,1),n.update({extra_lights:u.filter(Boolean).length?u.filter(Boolean):void 0})},l=Math.min(4,i.length+1);return m`${Array.from({length:l},(a,c)=>z(t,r("lamp_extra_light",{n:c+2}),i[c]??null,void 0,o,s(c),{types:[0,1,2],role:"light"}))}${S(r("lamp_extra_hint"),"nf-wide")}`}function Ag(t,e,n){let{hass:r}=t;if(!r)return _;let i=t.t,o=ue(e.type),s=K0(e,r),l=O(r,b=>X(r)?He(r,b,[1,2]):Hn(r,b)),a=b=>y=>n.update({[b]:Rt(y)}),c=b=>O(r,b),u=(t.doc.settings.roof.strings??[]).filter(b=>b.inverter===e.id).map(b=>b.name),d=!!e.entity&&e.entity!=="none",p=cs(t,e,"power"),h=e.power==="none"?null:e.power||p,f=e.type==="fridge_smart"?c(b=>b.startsWith("binary_sensor.")):[],g=e.type==="ceiling_fan"?"fan_hint":o?e.type==="lamp_pendant"?"lamp_hint_pendant":"lamp_hint":On(e.type)?"furn_links_hint_tv":e.type==="robot_vacuum"?"robot_hint":"furn_links_hint";return m`${ct(e.type==="grid_point"?S(i("grid_point_hint"),"nf-wide"):z(t,i(s.label),e.entity??null,cs(t,e,"entity"),c(s.accept),b=>n.update({entity:b}),o?{types:[0,1,2],role:"light"}:{}),e.type==="ceiling_fan"?z(t,i("furn_fan_entity"),e.fan_entity??null,cs(t,e,"fan"),c(b=>b.startsWith("fan.")),b=>n.update({fan_entity:b}),{types:[0,1,2]}):_,!o&&!Ke.includes(e.type)&&!zr(e.type)?Zl(t,e,n):_,o&&d?m`${z(t,i("furn_color_entity"),e.color_entity??null,void 0,c(b=>b.startsWith("light.")&&b!==e.entity),a("color_entity"),{types:[0,1,2],role:"light"})}${S(i("furn_color_entity_hint"),"nf-wide")}`:_,o&&d?Q0(t,e,n):_,o?ln(t,e.glow_scale,b=>n.update({glow_scale:b})):_,o?ss(t,e,mg(r,e,e.entity&&e.entity!=="none"?e.entity:cs(t,e,"entity"))?.attributes.effect_list,n.update):_,zr(e.type)?ln(t,e.ambilight,b=>n.update({ambilight:b}),{label:"ambilight",hint:"ambilight_hint",lowest:0}):_,On(e.type)||uo(e.type)?ln(t,e.sound_rings,b=>n.update({sound_rings:b}),{label:"sound_rings",hint:"sound_rings_hint",lowest:0}):_,e.type==="grid_point"?_:m`${z(t,i(_n(t.doc,e)?"meter_sub_power":j0(e.type)),e.power??null,p,l,b=>n.update({power:b}),{types:[1,2]})} - ${D(t,i(sr(e.type)?"charging_card":"furniture_power_card"),!!e.power_card,b=>n.update({power_card:b||void 0}))}${S(i(sr(e.type)?"charging_hint":"furniture_power_card_hint"),"nf-wide")}`)} - ${sd(e.type)?X0(t,e,n):o||e.type==="grid_point"?_:J0(t,e,n)} - ${e.type==="meter"?Y0(t,e,n):_} - ${e.type==="inverter"||e.type==="home_battery"?q0(t,e,n):_} - ${e.type==="meter"&&!_n(t.doc,e)?ct(z(t,i("furn_export"),e.export??null,void 0,l,a("export"),{types:[1,2]}),S(i("furn_export_hint"),"nf-wide")):_} +
    `}function nk(t,e,n){let r=t.t,i=O(t.hass,o=>{let s=t.hass?.states[o]?.attributes;return o.startsWith("sensor.")&&(s?.device_class==="temperature"||s?.unit_of_measurement==="\xB0C"||s?.unit_of_measurement==="\xB0F")});return ct(z(t,r("fridge_temp"),e.temp_entity??null,void 0,i,o=>n.update({temp_entity:Rt(o)}),{types:[1,2]}),z(t,r("freezer_temp"),e.temp_entity2??null,void 0,i,o=>n.update({temp_entity2:Rt(o)}),{types:[1,2]}),S(r("fridge_temp_hint"),"nf-wide"))}function rk(t,e,n){let r=t.t,i=O(t.hass,o=>{let s=t.hass?.states[o]?.attributes;return o.startsWith("sensor.")&&(s?.device_class==="temperature"||s?.unit_of_measurement==="\xB0C"||s?.unit_of_measurement==="\xB0F")});return ct(z(t,r("device_temp"),e.temp_entity??null,void 0,i,o=>n.update({temp_entity:Rt(o)}),{types:[1,2]}),S(r("device_temp_hint"),"nf-wide"))}function ik(t,e,n){let r=t.t,i=e.extra_lights??[],o=O(t.hass,a=>a.startsWith("light.")&&a!==e.entity&&a!==e.color_entity),s=a=>c=>{let u=[...i];c&&c!=="none"?u[a]=c:u.splice(a,1),n.update({extra_lights:u.filter(Boolean).length?u.filter(Boolean):void 0})},l=Math.min(4,i.length+1);return m`${Array.from({length:l},(a,c)=>z(t,r("lamp_extra_light",{n:c+2}),i[c]??null,void 0,o,s(c),{types:[0,1,2],role:"light"}))}${S(r("lamp_extra_hint"),"nf-wide")}`}function Pg(t,e,n){let{hass:r}=t;if(!r)return _;let i=t.t,o=ue(e.type),s=q0(e,r),l=O(r,b=>X(r)?He(r,b,[1,2]):Ln(r,b)),a=b=>y=>n.update({[b]:Rt(y)}),c=b=>O(r,b),u=(t.doc.settings.roof.strings??[]).filter(b=>b.inverter===e.id).map(b=>b.name),d=!!e.entity&&e.entity!=="none",p=ds(t,e,"power"),h=e.power==="none"?null:e.power||p,f=e.type==="fridge_smart"?c(b=>b.startsWith("binary_sensor.")):[],g=e.type==="ceiling_fan"?"fan_hint":o?e.type==="lamp_pendant"?"lamp_hint_pendant":"lamp_hint":Hn(e.type)?"furn_links_hint_tv":e.type==="robot_vacuum"?"robot_hint":"furn_links_hint";return m`${ct(e.type==="grid_point"?S(i("grid_point_hint"),"nf-wide"):z(t,i(s.label),e.entity??null,ds(t,e,"entity"),c(s.accept),b=>n.update({entity:b}),o?{types:[0,1,2],role:"light"}:{}),e.type==="ceiling_fan"?z(t,i("furn_fan_entity"),e.fan_entity??null,ds(t,e,"fan"),c(b=>b.startsWith("fan.")),b=>n.update({fan_entity:b}),{types:[0,1,2]}):_,!o&&!Ke.includes(e.type)&&!Dr(e.type)?Xl(t,e,n):_,o&&d?m`${z(t,i("furn_color_entity"),e.color_entity??null,void 0,c(b=>b.startsWith("light.")&&b!==e.entity),a("color_entity"),{types:[0,1,2],role:"light"})}${S(i("furn_color_entity_hint"),"nf-wide")}`:_,o&&d?ik(t,e,n):_,o?cn(t,e.glow_scale,b=>n.update({glow_scale:b})):_,o?ls(t,e,yg(r,e,e.entity&&e.entity!=="none"?e.entity:ds(t,e,"entity"))?.attributes.effect_list,n.update):_,Dr(e.type)?cn(t,e.ambilight,b=>n.update({ambilight:b}),{label:"ambilight",hint:"ambilight_hint",lowest:0}):_,Hn(e.type)||po(e.type)?cn(t,e.sound_rings,b=>n.update({sound_rings:b}),{label:"sound_rings",hint:"sound_rings_hint",lowest:0}):_,e.type==="grid_point"?_:m`${z(t,i(bn(t.doc,e)?"meter_sub_power":Y0(e.type)),e.power??null,p,l,b=>n.update({power:b}),{types:[1,2]})} + ${D(t,i(lr(e.type)?"charging_card":"furniture_power_card"),!!e.power_card,b=>n.update({power_card:b||void 0}))}${S(i(lr(e.type)?"charging_hint":"furniture_power_card_hint"),"nf-wide")}`)} + ${cd(e.type)?nk(t,e,n):o||e.type==="grid_point"?_:rk(t,e,n)} + ${e.type==="meter"?tk(t,e,n):_} + ${e.type==="inverter"||e.type==="home_battery"?ek(t,e,n):_} + ${e.type==="meter"&&!bn(t.doc,e)?ct(z(t,i("furn_export"),e.export??null,void 0,l,a("export"),{types:[1,2]}),S(i("furn_export_hint"),"nf-wide")):_} ${e.type==="inverter"&&(t.doc.settings.roof.solar??[]).length>0?S(u.length>0?i("inverter_strings",{names:u.join(", ")}):i("inverter_strings_none"),"nf-wide"):_} ${e.type==="home_battery"?ct(z(t,i("furn_soc"),e.soc??null,void 0,c(b=>me(b)&&(r.states[b]?.attributes.device_class==="battery"||r.states[b]?.attributes.unit_of_measurement==="%")),a("soc"),{types:[1,2]}),z(t,i("furn_charge"),e.charge??null,void 0,l,a("charge"),{types:[1,2]}),S(i("furn_charge_hint"),"nf-wide")):_} - ${sr(e.type)?ct(z(t,i("furn_wallbox_status"),e.status??null,void 0,c(b=>ho(b)||me(b)),a("status"),{types:[0,1,2,3]})):_} - ${gg(t,e,n.update)} + ${lr(e.type)?ct(z(t,i("furn_wallbox_status"),e.status??null,void 0,c(b=>fo(b)||me(b)),a("status"),{types:[0,1,2,3]})):_} + ${vg(t,e,n.update)} ${!o||d||h?m`${D(t,i("device_confirm"),!!e.confirm,b=>n.update({confirm:b}),{title:i("device_confirm_hint")})} -
    ${Nn(t,e.marker??null,b=>n.update({marker:b}))}${Nt(t,e.icon,b=>n.update({icon:b}))}${o?_:Bt(t,e.pin_offset,b=>n.update({pin_offset:b}))}
    `:_} - ${e.type==="robot_vacuum"?ct(z(t,i("furn_robot_room"),e.room_sensor??null,ud(r,Me(r,t.doc.floors).get(e.id)?.entity??null,null),c(me),b=>n.update({room_sensor:b}),{types:[1,2]})):_} - ${e.type==="robot_vacuum"&&d?Z0(t,e):_} +
    ${Bn(t,e.marker??null,b=>n.update({marker:b}))}${Nt(t,e.icon,b=>n.update({icon:b}))}${o?_:Bt(t,e.pin_offset,b=>n.update({pin_offset:b}))}
    `:_} + ${e.type==="robot_vacuum"?ct(z(t,i("furn_robot_room"),e.room_sensor??null,pd(r,Me(r,t.doc.floors).get(e.id)?.entity??null,null),c(me),b=>n.update({room_sensor:b}),{types:[1,2]})):_} + ${e.type==="robot_vacuum"&&d?Q0(t,e):_} ${e.type==="fridge_smart"?m`${ct(z(t,i("furn_door_left"),e.door_left??null,void 0,f,b=>n.update({door_left:b}),{types:[0]}),z(t,i("furn_door_right"),e.door_right??null,void 0,f,b=>n.update({door_right:b}),{types:[0]}))} ${S(i("fridge_hint"))}`:_} - ${or(t,e.values,b=>n.update({values:b}))} - ${S(i(g))}`}var ek=/^(binary_sensor|device_tracker|input_boolean|switch|sensor)\./,tk=/^(sensor|input_select|select|input_text)\./,nk=/^(device_tracker|sensor|binary_sensor|lock|climate)\./,rk=(t,e)=>t.flatMap(n=>n.items.filter(r=>r.vehicle).map(r=>({id:he(n.id,r.id),label:`${Je(r,he(n.id,r.id),e)} \xB7 ${Be(n,e)}`})));function Fg(t,e){return e.startsWith("device_tracker.")?t.hass?.states[e]?.attributes.source_type==="router"?2:0:1}function Tg(t,e,n,r){return m`r(i.target.value||null)}> ${e.map(i=>m``)} - `}function ik(t,e,n,r){let i=t.t,o=e.type_entity?t.hass?.states[e.type_entity]:void 0,s=Array.isArray(o?.attributes.options)?o.attributes.options:[],l=e.types??[],a=u=>r.update({types:u}),c=(u,d)=>a(l.map((p,h)=>h===u?{...p,...d}:p));return m`
    + `}function ck(t,e,n,r){let i=t.t,o=e.type_entity?t.hass?.states[e.type_entity]:void 0,s=Array.isArray(o?.attributes.options)?o.attributes.options:[],l=e.types??[],a=u=>r.update({types:u}),c=(u,d)=>a(l.map((p,h)=>h===u?{...p,...d}:p));return m`
    ${i("parking_types")}
    ${l.map((u,d)=>m`
    c(d,{state:p.target.value})} /> - ${Tg(t,n,u.vehicle,p=>c(d,{vehicle:p??""}))} + ${Ig(t,n,u.vehicle,p=>c(d,{vehicle:p??""}))}
    `)} ${s.map(u=>m``)} ${t.admin?m``:_} -
    `}function zg(t,e,n,r){let i=t.t,o=rk(n,t.hass?.language??"en"),s=O(t.hass,f=>ek.test(f)).sort((f,g)=>Fg(t,f.id)-Fg(t,g.id)),l=O(t.hass,f=>tk.test(f)),a=e.car??{},c=t.floor,u=c?.rooms.find(f=>f.points.length>=3&&C([e.x,e.z],f.points)),d=e.vehicle?G(e.vehicle):void 0,p=d?d.size[2]*(e.scale??1):0,h=!!u&&!!c&&p>c.height+1e-6;return m``}function Og(t,e,n,r){let i=t.t,o=lk(n,t.hass?.language??"en"),s=O(t.hass,f=>ok.test(f)).sort((f,g)=>Dg(t,f.id)-Dg(t,g.id)),l=O(t.hass,f=>sk.test(f)),a=e.car??{},c=t.floor,u=c?.rooms.find(f=>f.points.length>=3&&C([e.x,e.z],f.points)),d=e.vehicle?G(e.vehicle):void 0,p=d?d.size[2]*(e.scale??1):0,h=!!u&&!!c&&p>c.height+1e-6;return m` ${h?m`

    ${i("parking_too_tall",{car:K(t.hass,p,2),room:K(t.hass,c.height,2)})}

    `:_} ${S(i("parking_hint"))} - ${t.hass?m`${z(t,i("live_car_device"),a.device??null,null,O(t.hass,f=>nk.test(f)),f=>r.update({car:{...a,device:f}}))} + ${t.hass?m`${z(t,i("live_car_device"),a.device??null,null,O(t.hass,f=>ak.test(f)),f=>r.update({car:{...a,device:f}}))} ${S(i("live_car_device_hint"),"nf-wide")} - ${z(t,i("live_car_departure_entity"),a.departure??null,void 0,O(t.hass,f=>/^(sensor|input_datetime|time|datetime)\./.test(f)),f=>r.update({car:{...a,departure:f==="none"?null:f}}))}`:_}`}function Pg(t,e){let r=wn(t,e.w,e.d,e.h).treads.findIndex(i=>i.landing);return r>=0?r+1:1}function ok(t){let e=wn(ki(t),t.w,t.d,t.h),n=e.treads.map(Go),r=0;for(let o=1;o1?r/(n.length-1):0;return{rise:e.rise,going:i,measure:2*e.rise+i,steps:e.steps}}function sk(t){let[e,n]=ul[t],r=wn({..._t,shape:t},e,n,2.8),i=26/Math.max(e,n);return m`
    + `}function Lg(t,e,n){let r=t.t,i=$i(e),o=f=>n.update({stair:{...i,...f}}),s=i.shape!=="straight",l=f=>{let[g,b]=pl[f];n.update({stair:{...i,shape:f,run_width:null},w:g,d:b})},a=t.floor?t.doc.floors.filter(f=>f.elevationg.elevation-f.elevation)[0]:void 0,c=t.floor?t.doc.floors.filter(f=>f.elevation>t.floor.elevation).sort((f,g)=>f.elevation-g.elevation)[0]:void 0,u=f=>{let g=f?a&&t.floor?t.floor.elevation-a.elevation:null:c&&t.floor?c.elevation-t.floor.elevation:null;n.update({stair:{...i,down:f},...g?{h:Math.round(g*1e3)/1e3}:{}})},d=uk(e),p=f=>K(t.hass,f*100,1),h=d.measure>=.59&&d.measure<=.65&&d.rise<=.21;return m`
    ${r("stair_shape")}
    - ${sl.map(f=>m``)}
    ${s?H(t,r("stair_turn"),i.turn,[["left",r("stair_turn_left")],["right",r("stair_turn_right")]],f=>o({turn:f})):""} - ${H(t,r("stair_build"),i.build,al.map(f=>[f,r(`stair_build_${f}`)]),f=>o({build:f}))} + ${H(t,r("stair_build"),i.build,ul.map(f=>[f,r(`stair_build_${f}`)]),f=>o({build:f}))} ${i.build!=="solid"?D(t,r("stair_risers"),i.risers,f=>o({risers:f}),{wide:!1}):""} ${E(t,r("stair_steps"),i.steps??d.steps,f=>o({steps:Math.round(Math.min(40,Math.max(2,f)))}),1,2)} ${i.steps!=null?m``:""} - ${s&&i.shape!=="spiral"?m`${E(t,r("stair_run_width"),i.run_width??wn(i,e.w,e.d,e.h).flight,f=>o({run_width:Math.max(.4,f)}),.01,.4)} + ${s&&i.shape!=="spiral"?m`${E(t,r("stair_run_width"),i.run_width??kn(i,e.w,e.d,e.h).flight,f=>o({run_width:Math.max(.4,f)}),.01,.4)} ${i.run_width!=null?m``:""}`:""} - ${i.shape==="l"||i.shape==="u"?m`${E(t,r("stair_landing_after"),i.landing_after??Pg(i,e),f=>o({landing_after:Math.round(Math.min(d.steps-1,Math.max(1,f)))}),1,1)} + ${i.shape==="l"||i.shape==="u"?m`${E(t,r("stair_landing_after"),i.landing_after??Hg(i,e),f=>o({landing_after:Math.round(Math.min(d.steps-1,Math.max(1,f)))}),1,1)} ${i.landing_after!=null?m``:""} - ${S(r("stair_landing_hint",{h:p((i.landing_after??Pg(i,e))*Math.abs(e.h)/d.steps)}),"nf-wide")}`:""} - ${H(t,r("stair_rail"),i.rail,ll.map(f=>[f,r(`stair_rail_${f}`)]),f=>o({rail:f}))} + ${S(r("stair_landing_hint",{h:p((i.landing_after??Hg(i,e))*Math.abs(e.h)/d.steps)}),"nf-wide")}`:""} + ${H(t,r("stair_rail"),i.rail,dl.map(f=>[f,r(`stair_rail_${f}`)]),f=>o({rail:f}))} ${D(t,r("stair_down"),i.down,u,{title:r("stair_down_hint")})} - ${H(t,r("stair_opening"),i.opening,cl.map(f=>[f,r(`stair_opening_${f}`)]),f=>o({opening:f}),{wide:!0,title:r("stair_opening_hint")})} + ${H(t,r("stair_opening"),i.opening,hl.map(f=>[f,r(`stair_opening_${f}`)]),f=>o({opening:f}),{wide:!0,title:r("stair_opening_hint")})}

    ${r("stair_measures",{steps:d.steps,rise:p(d.rise),going:p(d.going),measure:p(d.measure)})} ${h?"\u2713":`\u2013 ${r("stair_uncomfortable")}`}

    ${S(r(i.down?"stair_down_note":i.opening==="headroom"?"stair_up_note":"stair_up_note_plain"),"nf-wide")} -
    `}function Ig(t,e,n){let r=Eo(e),i=O(t.hass,()=>!0),o=d=>n({hydronic:{...r,...d}}),s=(d,p,h,f)=>z(t,d,p??null,void 0,i,g=>f(g==="none"?null:g),{types:h}),l=(d,p,h)=>s(d,p,[1,2],h),a=(d,p,h,f=!1)=>m`
    ${d}
    +
    `}function Cg(t,e,n){let r=Jn(e),i=ui(e),o=O(t.hass,()=>!0),s=(h,f=!1)=>n({hydronic:yh(r,h),...f?{w:Math.round(e.w/i.length*h.length*1e3)/1e3}:{}}),l=(h,f,g,b)=>z(t,h,f??null,void 0,o,y=>b(y==="none"?null:y),{types:g}),a=(h,f,g)=>l(h,f,[1,2],g),c=(h,f,g)=>m`
    ${h}
    + ${l("R\xFCckmeldung / Istwert",f?.feedback,[0,1,2],b=>g({...f,feedback:b}))} + ${l("Befehl / Sollwert (optional)",f?.command,[0,1,2],b=>g({...f,command:b}))} + ${S("Eine zugewiesene R\xFCckmeldung bestimmt die Anzeige auch bei Ausfall. Nur ohne R\xFCckmeldung wird der Sollwert verwendet. Bedienbare Variablen verwenden ihre native Symcon-Schaltaktion und ihren unver\xE4nderten Wertebereich.","nf-wide")} +
    `,d=(t.doc.floors.find(h=>h.furniture.some(f=>f.id===e.id))?.furniture??[]).filter(h=>h.type==="buffer_tank"),p=[["","Keiner"],...d.map((h,f)=>[h.id,h.name||`Pufferspeicher ${f+1}`])];return r.buffer_id&&!d.some(h=>h.id===r.buffer_id)&&p.push([r.buffer_id,"Verkn\xFCpfter Puffer nicht im Stockwerk vorhanden"]),m`
    +
    ${H(t,"Pufferspeicher im Plan",r.buffer_id??"",p,h=>n({hydronic:{...r,buffer_id:h||null}}),{wide:!0})} + ${S("Die Zuordnung zeichnet Vorlauf und R\xFCcklauf zum platzierten Puffer im selben Stockwerk. Datenpunkte werden f\xFCr jede Station separat aus dem Objektbaum gew\xE4hlt. Eine Kaskade teilt sich die Sammelleitungen; die Zirkulationspumpe geh\xF6rt zur gemeinsamen Leitung. Das Hinzuf\xFCgen einer Station verbreitert das Bauteil, neue Stationen starten ohne Datenpunkt-Verkn\xFCpfungen.","nf-wide")} +
    + ${an(i,h=>h.id,(h,f)=>{let g=b=>s(i.map(y=>y.id===h.id?{...y,...b}:y));return m`
    K${f+1} · ${h.name||`Station ${f+1}`}
    + ${V(t,"Name",h.name,b=>g({name:b}),{wide:!0,maxlength:100})} + ${a("Vorlauf",h.flow,b=>g({flow:b}))}${a("R\xFCcklauf",h.return,b=>g({return:b}))} + ${a("Trinkwarmwasser",h.hot_water,b=>g({hot_water:b}))}${a("Kaltwasser",h.cold_water,b=>g({cold_water:b}))} + ${c("Ladepumpe",h.pump,b=>g({pump:b}))} + ${a("Pumpenleistung (optional)",h.power,b=>g({power:b}))} + ${D(t,"Kaskadenventil vorhanden",Fo(h),b=>g({has_valve:b}))} + ${Fo(h)?c("Kaskadenventil (Kaltwasser)",h.valve,b=>g({valve:b})):_} + ${i.length>1?m``:_} +
    `})} + +
    ${a("Zirkulationstemperatur",r.circulation_temperature,h=>n({hydronic:{...r,circulation_temperature:h}}))} + ${c("Zirkulationspumpe",r.circulation,h=>n({hydronic:{...r,circulation:h}}))} +
    +
    `}function Ng(t,e,n){let r=Jn(e),i=O(t.hass,()=>!0),o=d=>n({hydronic:{...r,...d}}),s=(d,p,h,f)=>z(t,d,p??null,void 0,i,g=>f(g==="none"?null:g),{types:h}),l=(d,p,h)=>s(d,p,[1,2],h),a=(d,p,h,f=!1)=>m`
    ${d}
    ${s("R\xFCckmeldung / Istwert",p?.feedback,[0,1,2],g=>h({...p,feedback:g}))} ${s("Befehl / Sollwert (optional)",p?.command,[0,1,2],g=>h({...p,command:g}))} ${f?D(t,"Ventil nur in 3D umkehren",!!p?.inverted,g=>h({...p,inverted:g})):_} @@ -1549,46 +1571,46 @@ ${o}`}else i=op(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
    `,c=m`${l("Vorlauf",r.flow,d=>o({flow:d}))}${l("R\xFCcklauf",r.return,d=>o({return:d}))}`,u=(d,p)=>{let h=f=>o({circuits:(r.circuits??[]).map(g=>g.id===d.id?{...g,...f}:g)});return m`
    ${d.name||`Kreis ${p+1}`}
    ${V(t,"Name",d.name,f=>h({name:f}),{wide:!0,maxlength:100})} ${H(t,"Kreisart",d.kind,[["heating","Heizkreis"],["cooling","K\xFChlkreis"],["changeover","Heizen / K\xFChlen"],["pump","Einspeise- / Vorschubpumpe (ohne Ventil)"]],f=>h({kind:f,...f==="pump"?{has_pump:!0,has_valve:!1}:{}}),{wide:!0})} - ${d.kind!=="pump"?m`${D(t,"Pumpe vorhanden",Xn(d),f=>h({has_pump:f}))}${D(t,"Ventil vorhanden",Ao(d),f=>h({has_valve:f}))}`:_} - ${Xn(d)?a("Pumpe",d.pump,f=>h({pump:f})):_} - ${Ao(d)?H(t,"Ventilbauart",d.valve_type??"mixing",[["mixing","Mischer (Dreiwegeventil)"],["two_way","Durchgangsventil (Zweiwege)"]],f=>h({valve_type:f}),{wide:!0}):_} - ${Ao(d)?a("Ventil",d.valve,f=>h({valve:f}),!0):_} + ${d.kind!=="pump"?m`${D(t,"Pumpe vorhanden",Qn(d),f=>h({has_pump:f}))}${D(t,"Ventil vorhanden",To(d),f=>h({has_valve:f}))}`:_} + ${Qn(d)?a("Pumpe",d.pump,f=>h({pump:f})):_} + ${To(d)?H(t,"Ventilbauart",d.valve_type??"mixing",[["mixing","Mischer (Dreiwegeventil)"],["two_way","Durchgangsventil (Zweiwege)"]],f=>h({valve_type:f}),{wide:!0}):_} + ${To(d)?a("Ventil",d.valve,f=>h({valve:f}),!0):_} ${l("Vorlauf",d.flow,f=>h({flow:f}))}${l("R\xFCcklauf",d.return,f=>h({return:f}))} - ${Xn(d)?l("Pumpenleistung (optional)",d.power,f=>h({power:f})):_} + ${Qn(d)?l("Pumpenleistung (optional)",d.power,f=>h({power:f})):_} ${d.kind==="changeover"?m`${s("Umschaltung Heizen / K\xFChlen",d.mode_entity,[0,1],f=>h({mode_entity:f}))}${E(t,"K\xFChlbetrieb bei Wert",d.cooling_value??1,f=>h({cooling_value:Math.round(f)}),1)}`:_}
    `};return m`
    ${D(t,"Schwebende 3D-Kachel",r.card!==!1,d=>o({card:d}))}${Bt(t,e.pin_offset,d=>n({pin_offset:d}))}${S("Verkn\xFCpfe jeden Datenpunkt \xFCber den Objektbaum. Namen und Pfade schr\xE4nken die Auswahl nicht ein. Nicht verkn\xFCpfte Werte bleiben in der 3D-Kachel ausgeblendet. Das Bauteil \xF6ffnet beim Antippen seine Werte und Bedienung.","nf-wide")}
    - ${e.type==="heating_manifold"?m`${Pr(r.circuits??[],d=>d.id,u)}`:_} + ${e.type==="heating_manifold"?m`${an(r.circuits??[],d=>d.id,u)}`:_} ${e.type==="buffer_tank"?m`
    ${c}${S("Die sieben Startpl\xE4tze liegen von oben nach unten. H\xF6he 100 % liegt oben, 0 % unten. F\xFChlerpl\xE4tze k\xF6nnen erg\xE4nzt, entfernt und frei in der H\xF6he positioniert werden; die Anzeige sortiert sie von oben nach unten.","nf-wide")}
    - ${Pr([...r.sensors??[]].sort((d,p)=>p.level-d.level),d=>d.id,d=>{let p=h=>o({sensors:(r.sensors??[]).map(f=>f.id===d.id?{...f,...h}:f)});return m`
    ${d.name||"F\xFChler"} · ${Math.round(d.level*100)} %
    + ${an([...r.sensors??[]].sort((d,p)=>p.level-d.level),d=>d.id,d=>{let p=h=>o({sensors:(r.sensors??[]).map(f=>f.id===d.id?{...f,...h}:f)});return m`
    ${d.name||"F\xFChler"} · ${Math.round(d.level*100)} %
    ${V(t,"Bezeichnung",d.name,h=>p({name:h}),{wide:!0,maxlength:100})}${l("Temperatur",d.entity,h=>p({entity:h}))} ${E(t,"H\xF6he (%) \xB7 100 = oben",Math.round(d.level*1e3)/10,h=>p({level:Math.max(0,Math.min(1,h/100))}),.1,0)}
    `})}`:_} - ${e.type==="freshwater_station"?m`
    ${c}${l("Zirkulationstemperatur",r.circulation_temperature,d=>o({circulation_temperature:d}))}${l("Trinkwarmwasser",r.hot_water,d=>o({hot_water:d}))}${a("Ladepumpe",r.pump,d=>o({pump:d}))}${a("Zirkulationspumpe",r.circulation,d=>o({circulation:d}))}
    `:_} - ${or(t,e.values,d=>n({values:d}))} -
    `}var ak=new Set(["parking","stairwell","rug","grid_point"]),lk={inverter:{label:"furn_model",values:["","slim","hybrid"],text:t=>`inverter_${t||"std"}`},home_battery:{label:"furn_model",values:["","wall","cube"],text:t=>`battery_${t||"std"}`},lamp_pendant:{label:"pendant_shape",values:["","globe","cone","drum"],text:t=>`pendant_${t||"shade"}`},sofa:{label:"sofa_shape",values:["","l","u"],text:t=>`sofa_${t||"straight"}`}};function ck(t,e,n,r){let i=t.hass?.language??"en",o=n.some(s=>e.type.startsWith(`pack:${s.id}:`));return m`
    `}function gx(t,e,n){let r=t.floor,i=r?dc(t.doc,r,e,n):void 0;if(!i||i.floor<=0)return _;let o=t.t;return Fi(e)?m`

    ${i.low>.05?o("living_area_low",{living:ze(t.hass,i.living),floor:ze(t.hass,i.floor),low:ze(t.hass,i.low)}):o("living_area",{living:ze(t.hass,i.living)})} -

    `:m`

    ${o("living_area_none",{floor:ze(t.hass,i.floor)})}

    `}function dx(t,e,n,r){let i=t.t,o=s=>r.patch({ceiling:Math.abs(s-n.height)<.005?null:Math.min(20,Math.max(1,Math.round(s*1e3)/1e3))});return m`${E(t,i("room_ceiling"),e.ceiling??n.height,o,.01,1)} +

    `:m`

    ${o("living_area_none",{floor:ze(t.hass,i.floor)})}

    `}function _x(t,e,n,r){let i=t.t,o=s=>r.patch({ceiling:Math.abs(s-n.height)<.005?null:Math.min(20,Math.max(1,Math.round(s*1e3)/1e3))});return m`${E(t,i("room_ceiling"),e.ceiling??n.height,o,.01,1)} ${e.ceiling!=null?m``:_} ${S(i("room_ceiling_tip"),"nf-wide")} - ${e.ceiling!=null&&e.ceiling>n.height+.005?S(i("room_ceiling_through",{ceiling:K(t.hass,e.ceiling,2),floor:K(t.hass,n.height,2)}),"nf-wide"):_}`}function hx(t,e,n,r){let i=t.t;if(!t.hass||X(t.hass))return m``;let o=v_(t.hass,n,{...e,announce_speaker:null}),s=O(t.hass,c=>/^(media_player|assist_satellite)\./.test(c)||c.startsWith("notify.")&&c.endsWith("_announce")),l=e.announce_quiet??null,a=(c,u)=>{if(!u)return r.patch({announce_quiet:null});r.patch({announce_quiet:{from:l?.from??"20:00",to:l?.to??"07:00",[c]:u}})};return m`${z(t,i("room_announce_speaker"),e.announce_speaker??null,o,s,c=>r.patch({announce_speaker:c}))} + ${e.ceiling!=null&&e.ceiling>n.height+.005?S(i("room_ceiling_through",{ceiling:K(t.hass,e.ceiling,2),floor:K(t.hass,n.height,2)}),"nf-wide"):_}`}function bx(t,e,n,r){let i=t.t;if(!t.hass||X(t.hass))return m``;let o=S_(t.hass,n,{...e,announce_speaker:null}),s=O(t.hass,c=>/^(media_player|assist_satellite)\./.test(c)||c.startsWith("notify.")&&c.endsWith("_announce")),l=e.announce_quiet??null,a=(c,u)=>{if(!u)return r.patch({announce_quiet:null});r.patch({announce_quiet:{from:l?.from??"20:00",to:l?.to??"07:00",[c]:u}})};return m`${z(t,i("room_announce_speaker"),e.announce_speaker??null,o,s,c=>r.patch({announce_speaker:c}))}
    ${i("room_announce_quiet")} @@ -1983,27 +2005,27 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${l?m``:_}
    - ${S(i("room_announce_hint"),"nf-wide")}`}function dc(t,e,n,r){let i=t.t,o=zn(n.points),s=de(n.points),l=Object.values(t.hass?.areas??{}).sort((h,f)=>h.name.localeCompare(f.name)),a=[["",i("no_area")],...l.map(h=>[h.area_id,h.name])],c=t.floor?fe(t.floor.rooms,{exterior:t.doc.settings.wall_exterior,interior:t.doc.settings.wall_interior},t.floor.walls??[]).walls:[],u=t.floor?jd(n,c):null,d=vu.map(h=>[h,i(`mat_${h}`)]),p=h=>m``;return m`
    + ${S(i("room_announce_hint"),"nf-wide")}`}function fc(t,e,n,r){let i=t.t,o=Pn(n.points),s=de(n.points),l=Object.values(t.hass?.areas??{}).sort((h,f)=>h.name.localeCompare(f.name)),a=[["",i("no_area")],...l.map(h=>[h.area_id,h.name])],c=t.floor?fe(t.floor.rooms,{exterior:t.doc.settings.wall_exterior,interior:t.doc.settings.wall_interior},t.floor.walls??[]).walls:[],u=t.floor?Zd(n,c):null,d=xu.map(h=>[h,i(`mat_${h}`)]),p=h=>m``;return m`

    ${i("room")}

    ${r.lockButton}
    ${V(t,i("room_name"),n.name,h=>r.patch({name:h}),{wide:!0})} ${H(t,i("area"),n.area_id??"",a,h=>r.setArea(h),{wide:!0})} - ${X(t.hass)&&n.area_id?m``:_} + ${X(t.hass)&&n.area_id?m``:_} ${(n.sub_areas??[]).map(h=>m`${t.hass?.areas?.[h]?.name??h} `)} ${n.area_id?H(t,i("sub_area_add"),"",a.filter(([h])=>h!==n.area_id&&!(n.sub_areas??[]).includes(h)),h=>h&&r.patch({sub_areas:[...n.sub_areas??[],h]}),{wide:!0,title:i("sub_area_hint")}):_} ${H(t,i("material"),n.floor_material,d,h=>r.patch({floor_material:h}),{wide:!0})} - ${Ue(t,i("wall_paint_room"),n.wall_paint,t.doc.settings.wall_paint_inside??qi,h=>r.patch({wall_paint:h}))} - ${t.floor?dx(t,n,t.floor,r):_} + ${Ue(t,i("wall_paint_room"),n.wall_paint,t.doc.settings.wall_paint_inside??Xi,h=>r.patch({wall_paint:h}))} + ${t.floor?_x(t,n,t.floor,r):_} ${E(t,i("room_floor_offset"),n.floor_offset??0,h=>r.patch({floor_offset:Math.abs(h)<.005?null:Math.max(-2,Math.min(2,Math.round(h*1e3)/1e3))}),.01)} ${S(i("room_floor_offset_hint"),"nf-wide")} ${z(t,i("room_clean"),n.clean_entity??null,void 0,O(t.hass,h=>/^(script|button|input_button)\./.test(h)),h=>r.patch({clean_entity:h&&h!=="none"?h:null}))} ${n.clean_entity?_:S(i("room_clean_hint"),"nf-wide")} ${X(t.hass)?_:z(t,i("floor_heating"),n.floor_heating??null,void 0,O(t.hass,h=>/^(climate|switch|valve|binary_sensor|input_boolean)\./.test(h)),h=>r.patch({floor_heating:h&&h!=="none"?h:null}))} ${n.floor_heating&&!X(t.hass)?S(i("floor_heating_hint"),"nf-wide"):_} - ${hx(t,n,t.floor??null,r)} + ${bx(t,n,t.floor??null,r)} ${u?m`

    ${i("room_inner",{w:pe(t.hass,u[0]),d:pe(t.hass,u[1])})}

    `:_} - ${ux(t,n,c)} - ${D(t,i("room_living"),Ei(n),h=>r.patch({living:h===Ei({name:n.name,living:null})?null:h}),{title:i("living_area_hint")})} + ${gx(t,n,c)} + ${D(t,i("room_living"),Fi(n),h=>r.patch({living:h===Fi({name:n.name,living:null})?null:h}),{title:i("living_area_hint")})} ${o?m`${E(t,i("x"),s.x0,h=>r.setRect("x",h))} ${E(t,i("z"),s.z0,h=>r.setRect("z",h))} ${E(t,i("width"),s.x1-s.x0,h=>r.setRect("w",h),.01,.05)} ${E(t,i("depth"),s.z1-s.z0,h=>r.setRect("d",h),.01,.05)}`:_} @@ -2012,16 +2034,16 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states ${n.start_view?m``:_}
    - ${r.wallHeights} ${r.climate} ${X(t.hass)?$h(t,n,h=>r.patch(h)):_} ${cx(t,n,o,r)} + ${r.wallHeights} ${r.climate} ${X(t.hass)?Eh(t,n,h=>r.patch(h)):_} ${mx(t,n,o,r)} ${t.admin?m`
    `:_} - ${e.spots?lx(t,e,n,r):_} - ${e.packages?m`
    ${sh.map(p)}${S(i("pkg_hint"))}
    `:_} -
    `}var k_=ee` + ${e.spots?fx(t,e,n,r):_} + ${e.packages?m`
    ${ch.map(p)}${S(i("pkg_hint"))}
    `:_} +
    `}var R_=ee` .nf-value-links h4 { margin: 12px 0; } .nf-value-add { min-width: 30px; font-size: 18px; padding: 3px 8px; } .nf-value-link { padding: 8px 0; border-bottom: 1px solid var(--nf-line); } @@ -4027,10 +4049,10 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states .nf-hydronic-form summary { cursor:pointer; font-weight:500; } .nf-hydronic-form details[open]>.nf-form { margin-top:9px; } .nf-hydronic-control { border-top:1px solid var(--nf-line); padding-top:7px; } -`;var x_=["cabinet","shelf","lamp","device"],Sn="own_studio";var px={cabinet:{w:120,d:45,h:80,doors:2,drawers:1,shelves:2,base:"plinth",handle:"bar",back:!0,lamp:"floor",display:!1,mount:"floor",body:"white",front:"wood"},shelf:{w:80,d:35,h:180,doors:0,drawers:0,shelves:4,base:"none",handle:"none",back:!0,lamp:"floor",display:!1,mount:"floor",body:"wood",front:"wood"},lamp:{w:40,d:40,h:160,doors:0,drawers:0,shelves:0,base:"none",handle:"none",back:!1,lamp:"floor",display:!1,mount:"floor",body:"metal",front:"white"},device:{w:60,d:60,h:85,doors:0,drawers:0,shelves:0,base:"none",handle:"none",back:!1,lamp:"floor",display:!0,mount:"floor",body:"white",front:"dark"}},hc=(t,e)=>({kind:t,name:e,...px[t]}),$_=(t,e)=>({...hc(e,t.name),body:t.body,front:t.front}),fr=(t,e,n)=>Math.min(n,Math.max(e,Number.isFinite(t)?t:e)),mr=t=>Math.round(t*1e4)/1e4;function pc(t){return{...t,name:t.name.trim().slice(0,60),w:fr(Math.round(t.w),5,400),d:fr(Math.round(t.d),2,200),h:fr(Math.round(t.h),2,300),doors:fr(Math.round(t.doors),0,6),drawers:fr(Math.round(t.drawers),0,6),shelves:fr(Math.round(t.shelves),0,12)}}function ce(t,e,n,r,i,o,s,l,a={}){let[c,u,d]=t,p=(x,k,M)=>{let A=Math.max(-M,x-k/2),T=Math.min(M,x+k/2);return T-A<1e-4?[Math.max(-M,Math.min(M,x)),.001*M*2]:[(A+T)/2,T-A]},[h,f]=p(e,r,c/2),[g,b]=p(n,i,u/2),y=Math.max(0,Math.min(d*.999,o)),v=Math.max(d*.001,Math.min(d-y,s)),w=x=>mr(Math.max(.001,Math.min(1,x)));return{shape:"box",x:mr(h/c),z:mr(g/u),w:w(f/c),d:w(b/u),y:mr(y/d),h:w(v/d),color:l,...a}}function S_(t,e,n){let[r,i,o]=t;if(e==="legs"){let s=Math.min(.1,o*.25),l=Math.min(.04,r/6,i/6);for(let[a,c]of[[-1,-1],[1,-1],[-1,1],[1,1]])n.push(ce(t,a*(r/2-l),c*(i/2-l),l,l,0,s,"metal"));return s}if(e==="plinth"){let s=Math.min(.08,o*.2);return n.push(ce(t,0,-.02,r-.02,i-.04,0,s,"dark")),s}return 0}function fx(t,e){let[n,r,i]=e,o=[],s=S_(e,t.base,o),l=t.doors+t.drawers>0,a=t.handle==="none"||!l?0:Math.min(.025,r*.08),c=l?Math.min(.02,r*.1):0,u=r-c-a,d=-r/2+u/2,p=i-s;if(!l){let v=Math.min(.018,n/10,p/10);o.push(ce(e,-n/2+v/2,0,v,r,s,p,t.body,{edges:!0})),o.push(ce(e,n/2-v/2,0,v,r,s,p,t.body,{edges:!0})),o.push(ce(e,0,-r/2+.005,n-2*v,.01,s,p,t.body));for(let w=0;w<=t.shelves+1;w++)o.push(ce(e,0,.005,n-2*v,r-.01,s+(p-v)*w/(t.shelves+1),v,t.front,{edges:"faint"}));return o}o.push(ce(e,0,d,n,u,s,p,t.body,{edges:!0}));let h=.004,f=-r/2+u+c/2,g=t.doors>0?Math.min(.18,Math.max(.08,(p-.3)/Math.max(1,t.drawers))):p/t.drawers,b=s+(t.drawers>0?g*t.drawers:0),y=(v,w,x)=>{if(t.handle==="none")return;let k=r/2-a/2;t.handle==="knob"?o.push(ce(e,v,k,.025,a,w-.0125,.025,"metal")):x?o.push(ce(e,v,k,.015,a,w-.08,.16,"metal")):o.push(ce(e,v,k,Math.min(.16,n*.4),a,w-.0075,.015,"metal"))};for(let v=0;v0){let v=n/t.doors,w=i-b;for(let x=0;x1.2?.45:.8);y(k+M*(v/2-.04),Math.min(A,i-.1),!0)}}return o}function mx(t,e){let[n,r,i]=e,o=Math.min(.02,n/10,i/10),s=[ce(e,-n/2+o/2,0,o,r,0,i,t.body,{edges:!0}),ce(e,n/2-o/2,0,o,r,0,i,t.body,{edges:!0})];t.back&&s.push(ce(e,0,-r/2+.005,n-2*o,.01,0,i,t.body));let l=t.shelves+2;for(let a=0;a({...ce(e,a,c,u,u,d,p,h,f),shape:"cyl"}),l=(a,c,u)=>({...ce(e,0,0,o,o,a,c,t.front,{glow:!0,edges:"faint"}),shape:"loft",tw:mr(Math.min(1,o*u/n)),td:mr(Math.min(1,o*u/r))});switch(t.lamp){case"pendant":{let a=Math.min(.3,i*.4);return[s(0,0,Math.min(.12,o),i-.03,.03,t.body),s(0,0,Math.min(.01,o/4),a,i-a-.03,"dark"),l(0,a,.35)]}case"wall":{let a=Math.min(.02,r*.2);return[ce(e,0,-r/2+a/2,Math.min(.1,n),a,i*.3,i*.4,t.body),ce(e,0,0,Math.min(.02,n),r-a,i*.45,Math.min(.02,i*.1),t.body),l(i*.15,i*.7,.7)]}default:{let a=Math.min(t.lamp==="table"?.25:.35,i*.4);return[s(0,0,o*.6,0,Math.min(.03,i*.05),t.body,{edges:!0}),s(0,0,Math.min(.03,o/6),.02,i-a-.02,t.body),l(i-a,a,.7)]}}}function _x(t,e){let[n,r,i]=e,o=[],s=t.mount==="floor"?S_(e,t.base,o):0,l=t.display?Math.min(.01,r*.1):0;if(o.push(ce(e,0,-l/2,n,r-l,s,i-s,t.body,{edges:!0})),t.display){let a=Math.min(.02,n*.08,(i-s)*.08);o.push(ce(e,0,r/2-l/2,n-2*a,l,s+a,i-s-2*a,t.front,{screen:!0}))}return o}function _s(t,e,n){let r=pc(t),i=[r.w/100,r.d/100,r.h/100],o=r.name||e,s=n==="en"?{en:o}:{[n.slice(0,5)]:o,en:o},l={id:e,name:s,size:i,parts:[],recipe:r};switch(r.kind){case"cabinet":l.parts=fx(r,i),l.surface=!0;break;case"shelf":l.parts=mx(r,i);break;case"lamp":l.parts=gx(r,i),l.light=r.lamp,l.mount=r.lamp==="pendant"?"ceiling":r.lamp==="wall"?"wall":r.lamp==="table"?"surface":"floor",r.lamp==="wall"&&(l.wall_y=1.6);break;case"device":l.parts=_x(r,i),l.electric=!0,l.mount=r.mount,r.mount==="wall"&&(l.wall_y=1.2);break}return l}function M_(t,e){let n=t.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,32)||"piece",r=/^[a-z0-9]/.test(n)?n:`p${n}`;if(!e.includes(r))return r;for(let i=2;;i++)if(!e.includes(`${r}_${i}`))return`${r}_${i}`}var R_=["white","wood","body","metal","dark","glass","accent"],bx={white:"#dfe6f2",wood:"#8a6a4a",body:"#3a4a6a",metal:"#9aa7bf",dark:"#1e2638",glass:"#7fd0e8",accent:"#37e0ff",fabric:"#4b5d8c",cushion:"#6a7fb3"},A_=t=>bx[t]??t;function yx(t){let e=_s(t,"preview","en"),[n,,r]=e.size,i=180/Math.max(n,r),[o,s]=[n*i,r*i],l=[...e.parts].sort((a,c)=>a.z+a.d/2-(c.z+c.d/2));return m``}function E_(t,e,n,r){let i=t.t,o=!R_.includes(n),s=[...R_.map(l=>[l,i(l==="body"?"studio_color_plan":`studio_color_${l}`)]),["own",i("studio_color_own")]];return m`${H(t,e,o?"own":n,s,l=>r(l==="own"?A_(n):l))} - ${o?Ue(t,i("studio_color_own"),n,"#8a6a4a",l=>r(l??"wood")):_}`}function F_(t,e,n){let r=t.t,i=e.recipe,o=c=>n.change(pc({...i,...c})),s=(c,u,d)=>E(t,r(c),u,p=>o({[d]:p}),1,1),l=(c,u,d)=>E(t,r(c),u,p=>o({[d]:p}),1,0),a=()=>{switch(i.kind){case"cabinet":return m`${l("studio_doors",i.doors,"doors")} ${l("studio_drawers",i.drawers,"drawers")} +`;var E_=["cabinet","shelf","lamp","device"],Mn="own_studio";var yx={cabinet:{w:120,d:45,h:80,doors:2,drawers:1,shelves:2,base:"plinth",handle:"bar",back:!0,lamp:"floor",display:!1,mount:"floor",body:"white",front:"wood"},shelf:{w:80,d:35,h:180,doors:0,drawers:0,shelves:4,base:"none",handle:"none",back:!0,lamp:"floor",display:!1,mount:"floor",body:"wood",front:"wood"},lamp:{w:40,d:40,h:160,doors:0,drawers:0,shelves:0,base:"none",handle:"none",back:!1,lamp:"floor",display:!1,mount:"floor",body:"metal",front:"white"},device:{w:60,d:60,h:85,doors:0,drawers:0,shelves:0,base:"none",handle:"none",back:!1,lamp:"floor",display:!0,mount:"floor",body:"white",front:"dark"}},mc=(t,e)=>({kind:t,name:e,...yx[t]}),A_=(t,e)=>({...mc(e,t.name),body:t.body,front:t.front}),gr=(t,e,n)=>Math.min(n,Math.max(e,Number.isFinite(t)?t:e)),_r=t=>Math.round(t*1e4)/1e4;function gc(t){return{...t,name:t.name.trim().slice(0,60),w:gr(Math.round(t.w),5,400),d:gr(Math.round(t.d),2,200),h:gr(Math.round(t.h),2,300),doors:gr(Math.round(t.doors),0,6),drawers:gr(Math.round(t.drawers),0,6),shelves:gr(Math.round(t.shelves),0,12)}}function ce(t,e,n,r,i,o,s,l,a={}){let[c,u,d]=t,p=(x,k,M)=>{let A=Math.max(-M,x-k/2),T=Math.min(M,x+k/2);return T-A<1e-4?[Math.max(-M,Math.min(M,x)),.001*M*2]:[(A+T)/2,T-A]},[h,f]=p(e,r,c/2),[g,b]=p(n,i,u/2),y=Math.max(0,Math.min(d*.999,o)),v=Math.max(d*.001,Math.min(d-y,s)),w=x=>_r(Math.max(.001,Math.min(1,x)));return{shape:"box",x:_r(h/c),z:_r(g/u),w:w(f/c),d:w(b/u),y:_r(y/d),h:w(v/d),color:l,...a}}function F_(t,e,n){let[r,i,o]=t;if(e==="legs"){let s=Math.min(.1,o*.25),l=Math.min(.04,r/6,i/6);for(let[a,c]of[[-1,-1],[1,-1],[-1,1],[1,1]])n.push(ce(t,a*(r/2-l),c*(i/2-l),l,l,0,s,"metal"));return s}if(e==="plinth"){let s=Math.min(.08,o*.2);return n.push(ce(t,0,-.02,r-.02,i-.04,0,s,"dark")),s}return 0}function vx(t,e){let[n,r,i]=e,o=[],s=F_(e,t.base,o),l=t.doors+t.drawers>0,a=t.handle==="none"||!l?0:Math.min(.025,r*.08),c=l?Math.min(.02,r*.1):0,u=r-c-a,d=-r/2+u/2,p=i-s;if(!l){let v=Math.min(.018,n/10,p/10);o.push(ce(e,-n/2+v/2,0,v,r,s,p,t.body,{edges:!0})),o.push(ce(e,n/2-v/2,0,v,r,s,p,t.body,{edges:!0})),o.push(ce(e,0,-r/2+.005,n-2*v,.01,s,p,t.body));for(let w=0;w<=t.shelves+1;w++)o.push(ce(e,0,.005,n-2*v,r-.01,s+(p-v)*w/(t.shelves+1),v,t.front,{edges:"faint"}));return o}o.push(ce(e,0,d,n,u,s,p,t.body,{edges:!0}));let h=.004,f=-r/2+u+c/2,g=t.doors>0?Math.min(.18,Math.max(.08,(p-.3)/Math.max(1,t.drawers))):p/t.drawers,b=s+(t.drawers>0?g*t.drawers:0),y=(v,w,x)=>{if(t.handle==="none")return;let k=r/2-a/2;t.handle==="knob"?o.push(ce(e,v,k,.025,a,w-.0125,.025,"metal")):x?o.push(ce(e,v,k,.015,a,w-.08,.16,"metal")):o.push(ce(e,v,k,Math.min(.16,n*.4),a,w-.0075,.015,"metal"))};for(let v=0;v0){let v=n/t.doors,w=i-b;for(let x=0;x1.2?.45:.8);y(k+M*(v/2-.04),Math.min(A,i-.1),!0)}}return o}function wx(t,e){let[n,r,i]=e,o=Math.min(.02,n/10,i/10),s=[ce(e,-n/2+o/2,0,o,r,0,i,t.body,{edges:!0}),ce(e,n/2-o/2,0,o,r,0,i,t.body,{edges:!0})];t.back&&s.push(ce(e,0,-r/2+.005,n-2*o,.01,0,i,t.body));let l=t.shelves+2;for(let a=0;a({...ce(e,a,c,u,u,d,p,h,f),shape:"cyl"}),l=(a,c,u)=>({...ce(e,0,0,o,o,a,c,t.front,{glow:!0,edges:"faint"}),shape:"loft",tw:_r(Math.min(1,o*u/n)),td:_r(Math.min(1,o*u/r))});switch(t.lamp){case"pendant":{let a=Math.min(.3,i*.4);return[s(0,0,Math.min(.12,o),i-.03,.03,t.body),s(0,0,Math.min(.01,o/4),a,i-a-.03,"dark"),l(0,a,.35)]}case"wall":{let a=Math.min(.02,r*.2);return[ce(e,0,-r/2+a/2,Math.min(.1,n),a,i*.3,i*.4,t.body),ce(e,0,0,Math.min(.02,n),r-a,i*.45,Math.min(.02,i*.1),t.body),l(i*.15,i*.7,.7)]}default:{let a=Math.min(t.lamp==="table"?.25:.35,i*.4);return[s(0,0,o*.6,0,Math.min(.03,i*.05),t.body,{edges:!0}),s(0,0,Math.min(.03,o/6),.02,i-a-.02,t.body),l(i-a,a,.7)]}}}function xx(t,e){let[n,r,i]=e,o=[],s=t.mount==="floor"?F_(e,t.base,o):0,l=t.display?Math.min(.01,r*.1):0;if(o.push(ce(e,0,-l/2,n,r-l,s,i-s,t.body,{edges:!0})),t.display){let a=Math.min(.02,n*.08,(i-s)*.08);o.push(ce(e,0,r/2-l/2,n-2*a,l,s+a,i-s-2*a,t.front,{screen:!0}))}return o}function ys(t,e,n){let r=gc(t),i=[r.w/100,r.d/100,r.h/100],o=r.name||e,s=n==="en"?{en:o}:{[n.slice(0,5)]:o,en:o},l={id:e,name:s,size:i,parts:[],recipe:r};switch(r.kind){case"cabinet":l.parts=vx(r,i),l.surface=!0;break;case"shelf":l.parts=wx(r,i);break;case"lamp":l.parts=kx(r,i),l.light=r.lamp,l.mount=r.lamp==="pendant"?"ceiling":r.lamp==="wall"?"wall":r.lamp==="table"?"surface":"floor",r.lamp==="wall"&&(l.wall_y=1.6);break;case"device":l.parts=xx(r,i),l.electric=!0,l.mount=r.mount,r.mount==="wall"&&(l.wall_y=1.2);break}return l}function T_(t,e){let n=t.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,32)||"piece",r=/^[a-z0-9]/.test(n)?n:`p${n}`;if(!e.includes(r))return r;for(let i=2;;i++)if(!e.includes(`${r}_${i}`))return`${r}_${i}`}var z_=["white","wood","body","metal","dark","glass","accent"],$x={white:"#dfe6f2",wood:"#8a6a4a",body:"#3a4a6a",metal:"#9aa7bf",dark:"#1e2638",glass:"#7fd0e8",accent:"#37e0ff",fabric:"#4b5d8c",cushion:"#6a7fb3"},D_=t=>$x[t]??t;function Sx(t){let e=ys(t,"preview","en"),[n,,r]=e.size,i=180/Math.max(n,r),[o,s]=[n*i,r*i],l=[...e.parts].sort((a,c)=>a.z+a.d/2-(c.z+c.d/2));return m``}function P_(t,e,n,r){let i=t.t,o=!z_.includes(n),s=[...z_.map(l=>[l,i(l==="body"?"studio_color_plan":`studio_color_${l}`)]),["own",i("studio_color_own")]];return m`${H(t,e,o?"own":n,s,l=>r(l==="own"?D_(n):l))} + ${o?Ue(t,i("studio_color_own"),n,"#8a6a4a",l=>r(l??"wood")):_}`}function I_(t,e,n){let r=t.t,i=e.recipe,o=c=>n.change(gc({...i,...c})),s=(c,u,d)=>E(t,r(c),u,p=>o({[d]:p}),1,1),l=(c,u,d)=>E(t,r(c),u,p=>o({[d]:p}),1,0),a=()=>{switch(i.kind){case"cabinet":return m`${l("studio_doors",i.doors,"doors")} ${l("studio_drawers",i.drawers,"drawers")} ${i.doors+i.drawers===0?l("studio_shelves",i.shelves,"shelves"):_} ${H(t,r("studio_handle"),i.handle,[["bar",r("studio_handle_bar")],["knob",r("studio_handle_knob")],["none",r("studio_handle_none")]],c=>o({handle:c}))} ${H(t,r("studio_base"),i.base,[["plinth",r("studio_base_plinth")],["legs",r("studio_base_legs")],["none",r("studio_base_none")]],c=>o({base:c}))}`;case"shelf":return m`${l("studio_shelves",i.shelves,"shelves")} ${D(t,r("studio_back"),i.back,c=>o({back:c}))}`;case"lamp":return H(t,r("studio_lamp"),i.lamp,[["floor",r("studio_lamp_floor")],["table",r("studio_lamp_table")],["pendant",r("studio_lamp_pendant")],["wall",r("studio_lamp_wall")]],c=>o({lamp:c}));case"device":return m`${D(t,r("studio_display"),i.display,c=>o({display:c}))} @@ -4039,37 +4061,37 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states

    🛠️ ${r(e.itemId?"studio_title_edit":"studio_title")}

    ${S(r("studio_hint"))}
    - ${x_.map(c=>m``)} + ${E_.map(c=>m``)}
    - ${yx(i)} + ${Sx(i)}
    ${V(t,r("studio_name"),i.name,c=>o({name:c}),{wide:!0,maxlength:60,placeholder:r(`studio_kind_${i.kind}`)})} ${s("studio_width",i.w,"w")} ${s("studio_depth",i.d,"d")} ${s("studio_height",i.h,"h")} ${a()} - ${E_(t,r(i.kind==="lamp"?"studio_color_lamp_body":"studio_color_body"),i.body,c=>o({body:c}))} - ${i.kind==="cabinet"||i.kind==="shelf"||i.kind==="lamp"||i.display?E_(t,r(i.kind==="lamp"?"studio_color_shade":i.kind==="device"?"studio_color_display":i.kind==="shelf"?"studio_color_boards":"studio_color_front"),i.front,c=>o({front:c})):_} + ${P_(t,r(i.kind==="lamp"?"studio_color_lamp_body":"studio_color_body"),i.body,c=>o({body:c}))} + ${i.kind==="cabinet"||i.kind==="shelf"||i.kind==="lamp"||i.display?P_(t,r(i.kind==="lamp"?"studio_color_shade":i.kind==="device"?"studio_color_display":i.kind==="shelf"?"studio_color_boards":"studio_color_front"),i.front,c=>o({front:c})):_}
    ${e.error?m`

    ${e.error}

    `:_} ${J(m``,m``)} - `}var vx={room_no_area:"\u{1F3F7}\uFE0F",areas_unplaced:"\u2795",devices_unplaced:"\u{1F4CD}",rooms_overlap:"\u29C9",opening_off_wall:"\u{1F6AA}",entity_missing:"\u2753",furniture_entity_missing:"\u2753",standby:"\u{1F50C}",battery_low:"\u{1FAAB}"};function wx(t,e){let n=e.kind==="room_no_area"&&e.vars.area?"check_room_no_area_named":`check_${e.kind}`;return t.t(n,e.vars)}function kx(t,e){let n=t.t;switch(e.fix.do){case"set_area":return n("check_fix_set_area",{area:String(e.vars.area)});case"add_area_rooms":return n("check_fix_add_rooms");case"place_devices":return n("check_fix_place",{n:e.fix.entityIds.length});case"ignore_devices":return n("check_fix_ignore");case"remove_placements":return n("check_fix_remove",{n:e.fix.entityIds.length});default:return n("check_fix_show")}}function T_(t,e,n){let r=t.t,i=t.doc.floors.filter(o=>e.some(s=>s.floorId===o.id));return m`
    +
    `}var Mx={room_no_area:"\u{1F3F7}\uFE0F",areas_unplaced:"\u2795",devices_unplaced:"\u{1F4CD}",rooms_overlap:"\u29C9",opening_off_wall:"\u{1F6AA}",entity_missing:"\u2753",furniture_entity_missing:"\u2753",standby:"\u{1F50C}",battery_low:"\u{1FAAB}"};function Rx(t,e){let n=e.kind==="room_no_area"&&e.vars.area?"check_room_no_area_named":`check_${e.kind}`;return t.t(n,e.vars)}function Ex(t,e){let n=t.t;switch(e.fix.do){case"set_area":return n("check_fix_set_area",{area:String(e.vars.area)});case"add_area_rooms":return n("check_fix_add_rooms");case"place_devices":return n("check_fix_place",{n:e.fix.entityIds.length});case"ignore_devices":return n("check_fix_ignore");case"remove_placements":return n("check_fix_remove",{n:e.fix.entityIds.length});default:return n("check_fix_show")}}function O_(t,e,n){let r=t.t,i=t.doc.floors.filter(o=>e.some(s=>s.floorId===o.id));return m`

    ✓ ${r("check_title")}

    ${e.length===0?m`

    ✅ ${r("check_all_good")}

    `:m`${S(r("check_hint",{n:e.length}))} ${i.map(o=>m`

    ${o.name}

      ${e.filter(s=>s.floorId===o.id).map(s=>m`
    • - ${wx(t,s)} - - ${s.entityIds?xx(t,s.entityIds,n):_} + ${Rx(t,s)} + + ${s.entityIds?Ax(t,s.entityIds,n):_}
    • `)}
    `)}`} ${(t.doc.settings.check_ignore??[]).length>0?m`

    `:_} -
    `}function xx(t,e,n){let r=t.t;return m`
    + `}function Ax(t,e,n){let r=t.t;return m`
    ${r("check_show_devices",{n:e.length})}
      ${e.map(i=>m`
    • ${t.hass?B(t.hass,i):i} ${i}
    • `)}
    -
    `}var z_=(t,e)=>m``;function P_(t,e){if(!e||!Number.isFinite(e.value))return null;let n=/^\s*([^/\s]+)\s*\/\s*kWh\s*$/i.exec(e.unit);if(!n)return null;let r=/^(ct|cent|cents|c)$/i.test(n[1]),i=r||/^eur$/i.test(n[1])?"\u20AC":n[1];return{value:Math.round(t*e.value*(r?1:100))/100,currency:i}}var I_=20,D_=new WeakMap;function $x(t){let e=t.entities??{},n=D_.get(e);if(!n){n=new Map;for(let[r,i]of Object.entries(e))i.device_id&&r.startsWith("sensor.")&&t.states[r]?.attributes.device_class==="battery"&&!n.has(i.device_id)&&n.set(i.device_id,r);D_.set(e,n)}return n}function Sx(t,e){let n=t.entities?.[e]?.device_id,r=n?$x(t).get(n):void 0;if(r){let s=Number(t.states[r]?.state);if(Number.isFinite(s))return s}let i=t.states[e]?.attributes;if(!i||i.battery_level===void 0&&i.battery===void 0)return null;let o=Number(i.battery_level??i.battery);return Number.isFinite(o)?o:null}function Mx(t){let e=[],n=r=>typeof r=="string"&&/^[a-z_]+\.[a-z0-9_]+$/.test(r);for(let r of t.placements)e.push({entity:r.entity_id,x:r.x,z:r.z,room:null});for(let r of t.furniture)for(let i of[r.entity,r.power])n(i)&&e.push({entity:i,x:r.x,z:r.z,room:null});for(let r of t.openings)for(let i of[r.contact,r.contact2,r.tilt,r.tilt2,r.cover,r.cover2,r.lock])n(i)&&e.push({entity:i,x:NaN,z:NaN,room:r.room_id});return e}var Rx=(t,e,n)=>t.rooms.find(r=>r.points.length>=3&&C([e,n],r.points));function O_(t,e){let n=new Set,r=[];for(let i of e.floors)for(let o of Mx(i)){let s=t.entities?.[o.entity]?.device_id??o.entity;if(n.has(s))continue;let l=Sx(t,o.entity);l!==null&&(n.add(s),r.push({entity:o.entity,level:l,floorId:i.id,roomId:o.room??Rx(i,o.x,o.z)?.id??null}))}return r.sort((i,o)=>i.level-o.level)}var gr=.08;function H_(t,e){let n=1/0;for(let r=0;r0?Math.max(0,Math.min(1,((t[0]-i[0])*s+(t[1]-i[1])*l)/a)):0;n=Math.min(n,Math.hypot(t[0]-(i[0]+s*c),t[1]-(i[1]+l*c)))}return n}var L_=t=>({x0:Math.min(...t.map(e=>e[0])),x1:Math.max(...t.map(e=>e[0])),z0:Math.min(...t.map(e=>e[1])),z1:Math.max(...t.map(e=>e[1]))});function Ex(t,e,n=.2){if(t.points.length<3||e.points.length<3)return!1;let[r,i]=[L_(t.points),L_(e.points)],o=Math.max(r.x0,i.x0)+gr,s=Math.min(r.x1,i.x1)-gr,l=Math.max(r.z0,i.z0)+gr,a=Math.min(r.z1,i.z1)-gr;if(s<=o||a<=l)return!1;for(let c=o;c<=s+1e-9;c+=Math.min(n,s-o||n))for(let u=l;u<=a+1e-9;u+=Math.min(n,a-l||n)){let d=[c,u];if(C(d,t.points)&&C(d,e.points)&&H_(d,t.points)>gr&&H_(d,e.points)>gr)return!0}return!1}function N_(t){let e=new Set(["id","type","variant","name","icon","picture","vehicle","room_id","wall"]),n=r=>typeof r=="string"&&/^[a-z_]+\.[a-z0-9_]+$/.test(r);return Object.entries(t).flatMap(([r,i])=>e.has(r)?[]:Array.isArray(i)?i.filter(n):n(i)?[i]:[])}var C_=t=>N_(t),Ax=3,Fx=new Set(["off","standby","idle"]);function Tx(t,e,n,r){let i=e.energy.tariff,o=i?t.states[i]:void 0,s=o?{value:Number(o.state),unit:String(o.attributes.unit_of_measurement??"")}:null,l=new Set,a=(c,u)=>{if(!c||c==="none"||l.has(c))return;l.add(c);let d=t.states[c]?.state;if(!d||!Fx.has(d)||c.startsWith("light."))return;let p=li(t,c),h=p?Fe(t.states[p]):null;if(h===null||h<=Ax)return;let f=P_(h*24*365/1e3,s);r.push({kind:"standby",floorId:n.id,vars:{name:B(t,c),w:Math.round(h),cost:f?`${f.value.toFixed(0)} ${f.currency}`:`${Math.round(h*24*365/1e3)} kWh`},fix:u,changes:!1})};for(let c of n.furniture)a(c.entity,{do:"show_furniture",furnitureId:c.id});for(let c of n.placements){let u=n.rooms.find(d=>d.points.length>=3&&C([c.x,c.z],d.points));u&&a(c.entity_id,{do:"show_room",roomId:u.id})}}function B_(t,e){let n=[],r=e?.areas,i=new Set(t.settings.check_ignore??[]),o=new Set(t.floors.flatMap(s=>s.rooms.map(l=>l.area_id)).filter(s=>!!s));for(let s of t.floors){if(s.layer)continue;for(let a of s.rooms){if(a.area_id)continue;let c=Object.values(r??{}).find(u=>u.name.trim().toLowerCase()===a.name.trim().toLowerCase()&&!o.has(u.area_id));n.push(c?{kind:"room_no_area",floorId:s.id,vars:{room:a.name,area:c.name},fix:{do:"set_area",roomId:a.id,areaId:c.area_id},changes:!0}:{kind:"room_no_area",floorId:s.id,vars:{room:a.name,area:""},fix:{do:"show_room",roomId:a.id},changes:!1})}let l=pr(t,s,r);if(l.length&&n.push({kind:"areas_unplaced",floorId:s.id,vars:{n:l.length,names:l.map(a=>a.name).join(", ")},fix:{do:"add_area_rooms"},changes:!0}),e){let a=Me(e,[s]),c=Ot(e,[s]);for(let u of s.rooms){if(!u.area_id)continue;let d=Xo(s,u);for(let f of s.furniture)if(C([f.x,f.z],u.points))for(let g of C_(f))d.add(g);for(let f of s.openings)if(f.room_id===u.id){for(let g of N_(f))d.add(g);for(let g of Object.values(c.get(f.id)??{}))typeof g=="string"&&d.add(g)}for(let f of s.furniture){let g=a.get(f.id);if(g&&C([f.x,f.z],u.points))for(let b of[g.entity,g.power])typeof b=="string"&&d.add(b)}let p=ye(e,u).filter(f=>Ft(je(e,f))),h=Dn(e,p).map(f=>f.primary).filter(f=>!d.has(f)&&!i.has(f));h.length&&n.push({kind:"devices_unplaced",floorId:s.id,vars:{room:u.name,n:h.length},fix:{do:"place_devices",roomId:u.id,entityIds:h},entityIds:h,changes:!0})}}for(let a=0;ad.id===c.room_id)?.name??""},fix:{do:"show_opening",openingId:c.id},changes:!1})}}if(e&&Tx(e,t,s,n),e&&Object.keys(e.states).length){let a=s.placements.map(c=>c.entity_id).filter(c=>!e.states[c]);a.length&&n.push({kind:"entity_missing",floorId:s.id,vars:{n:a.length,ids:a.slice(0,3).join(", ")},fix:{do:"remove_placements",entityIds:a},changes:!0});for(let c of s.furniture){let u=C_(c).filter(d=>d!=="none"&&!e.states[d]);u.length&&!(ue(c.type)&&!c.entity)&&n.push({kind:"furniture_entity_missing",floorId:s.id,vars:{id:u[0]},fix:{do:"show_furniture",furnitureId:c.id},changes:!1})}}}if(e)for(let s of O_(e,t)){if(s.level>=I_)break;n.push({kind:"battery_low",floorId:s.floorId,vars:{name:B(e,s.entity),level:Math.round(s.level)},fix:s.roomId?{do:"show_room",roomId:s.roomId}:{do:"show_floor"},changes:!1})}return n}var re=t=>t.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]),Mn=t=>t.map(([e,n])=>`${e.toFixed(3)},${n.toFixed(3)}`).join(" ");function zx(t,e,n,r){let i=fe(e.rooms,{exterior:t.settings.wall_exterior,interior:t.settings.wall_interior},e.walls??[]).walls,o=[...e.rooms.flatMap(y=>y.points),...i.flatMap(y=>y.footprint)];if(!o.length)return"";let[s,l]=[Math.min(...o.map(y=>y[0])),Math.max(...o.map(y=>y[0]))],[a,c]=[Math.min(...o.map(y=>y[1])),Math.max(...o.map(y=>y[1]))],u=1.2,d=[];for(let y of e.rooms)d.push(``);for(let y of i)d.push(``);for(let y of e.openings){let v=Ce(y,e.rooms,e.walls??[]),w=v?Vt(i,y,v):null;if(!w)continue;let{wall:x,s:k}=w,M=Math.hypot(x.b[0]-x.a[0],x.b[1]-x.a[1]);if(M<1e-6)continue;let A=[(x.b[0]-x.a[0])/M,(x.b[1]-x.a[1])/M],T=[-A[1],A[0]],F=(q,ke)=>[x.a[0]+A[0]*q+T[0]*ke,x.a[1]+A[1]*q+T[1]*ke],[L,P]=[k-y.width/2,k+y.width/2],[N,W]=[x.left+.01,-(x.right+.01)];if(d.push(``),y.type==="garage"){let q=(x.left-x.right)/2;d.push(``)}else if(y.type==="window"){let q=(x.left-x.right)/2;d.push(``),d.push(``)}else{let q=y.room_id===x.roomRight?-1:1,ke=F(L,q*(q>0?x.left:x.right)),At=F(L,q*((q>0?x.left:x.right)+y.width)),j=F(P,q*(q>0?x.left:x.right));d.push(``)}}let p=new Map(n.map(y=>[y.roomId,y]));for(let y of e.rooms){if(y.points.length<3)continue;let[v,w]=be(y.points),x=p.get(y.id);d.push(`${re(y.name)}`),x&&d.push(`${re(r.area(x.living>0?x.living:x.floor))}`)}let h=(y,v,w,x,k,M)=>{let T=(y+w)/2,F=(v+x)/2,L=M?`M ${y-.15} ${v} L ${y+.15} ${v} M ${w-.15} ${x} L ${w+.15} ${x}`:`M ${y} ${v-.15} L ${y} ${v+.15} M ${w} ${x-.15} L ${w} ${x+.15}`,P=M?`${re(k)}`:`${re(k)}`;return`${P}`};d.push(h(s,c+.5,l,c+.5,r.length(l-s),!1)),d.push(h(s-.5,a,s-.5,c,r.length(c-a),!0)),d.push(`${re(r.length(1))}`);let[f,g]=[l-s+2*u,c-a+2*u];return`${d.join("")}`}function W_(t,e){let n=t.floors.filter(a=>!a.layer&&a.rooms.length),r=[],i=[],o=[];for(let a of[...n].sort((c,u)=>c.elevation-u.elevation)){let c=Ai(t,a);o.push(...c);let u=hr(c);r.push(`

    ${re(a.name)}

    ${re(e.living)}: ${re(e.area(u.living))}
    ${zx(t,a,c,e)}
    `),i.push(`${re(a.name)}`);for(let d of c){let p=a.rooms.find(h=>h.id===d.roomId);i.push(`${re(p.name)}${re(e.area(d.floor))}${d.low>.05?re(e.area(d.low)):""}${re(e.area(d.living))}`)}i.push(`${re(e.total)}${re(e.area(u.floor))}${u.low>.05?re(e.area(u.low)):""}${re(e.area(u.living))}`)}let s=hr(o),l=`

    ${re(e.living)}

    ${i.join("")}
    ${re(e.room)}${re(e.floorArea)}${re(e.low)}${re(e.living)}
    ${re(e.total)}${re(e.area(s.floor))}${s.low>.05?re(e.area(s.low)):""}${re(e.area(s.living))}

    ${re(e.note)}

    `;return`${re(e.title)}${r.join("")}${l}